slp_mdm 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 50

SLP Metadata Maker for Dart #

This package is for creating Simple Ledger Protocol (SLP) OP_RETURN messages. Both TokenType1 and NFT1 tokens are supported.

Usage #

The following snippet shows basic usage. Don't forget to adjust the BigInt quantities to account for decimal divisibility of the token (see code in example/main.dart with an example of this conversion).

  var tokenId = hex.decode('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff');
  var sendMsg = Send(tokenId, [BigInt.from(1), BigInt.from(10)]);
  print(hex.encode(sendMsg));

  var mintMsg = Mint(tokenId, BigInt.from(10), mintBatonVout);
  print(hex.encode(mintMsg));

Test #

$ dart test/slp_mdm.dart

0.1.0 #

* Added Dartdoc comments
* Code linting

0.0.1 #

* Initial version with unit tests passing

example/main.dart

import 'package:slp_mdm/slp_mdm.dart';
import 'package:convert/convert.dart';

main() {
  var divisibility = 9;
  var mintBatonVout = 2;
  var qty = BigInt.from(1000000) * BigInt.from(10).pow(divisibility);
  var genesisMsg = Genesis('', '', '', [], divisibility, qty, mintBatonVout);
  print(hex.encode(genesisMsg));

  var tokenId = hex.decode('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff');
  var sendMsg = Send(tokenId, [BigInt.from(1), BigInt.from(10)]);
  print(hex.encode(sendMsg));

  var mintMsg = Mint(tokenId, BigInt.from(10), mintBatonVout);
  print(hex.encode(mintMsg));
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  slp_mdm: ^0.1.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:slp_mdm/slp_mdm.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
50
Learn more about scoring.

We analyzed this package on Jul 10, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14

Health suggestions

Fix lib/src/util.dart. (-1.49 points)

Analysis of lib/src/util.dart reported 3 hints:

line 66 col 7: Use isNotEmpty for Iterables and Maps.

line 116 col 3: Don't explicitly initialize variables to null.

line 159 col 7: Use isEmpty instead of length

Format lib/src/nft1.dart.

Run dartfmt to format lib/src/nft1.dart.

Format lib/src/tokentype1.dart.

Run dartfmt to format lib/src/tokentype1.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.5.0 <3.0.0
convert ^2.1.1 2.1.1
Transitive dependencies
charcode 1.1.3
collection 1.14.13 1.15.0-nullsafety
typed_data 1.2.0 1.3.0-nullsafety
Dev dependencies
test ^1.14.2