chainwallet 1.0.4

Chainsql的Dart API

1.0.0 #

  • 初始化版本

1.0.4 #

  • 格式化代码
  • 导出接口的Model类

example/main.dart

import 'dart:convert';

import 'package:test/test.dart';
import 'package:chainwallet/chainwallet.dart';


void main() {

    var walletInfo = Chainsql.generateAddress();
    String jsonStr = json.encode(walletInfo);
    print(jsonStr);

    var walletMap = walletInfo.toJson();
    expect(walletMap.containsKey("address"), true);
    expect(walletMap.containsKey("secret"), true);
    expect(walletMap.containsKey("publicKey"), true);

    var walletFromSeed =
    Chainsql.generateAddressFromStr("xpkpdVP3LKhtdSfQX3uHNs1f7jN42");

    var walletFromSeedMap = walletFromSeed.toJson();
    expect(walletFromSeedMap.containsKey("address"), true);
    expect(walletFromSeedMap.containsKey("secret"), true);
    expect(walletFromSeedMap.containsKey("publicKey"), true);

    expect(walletFromSeedMap["address"], "zKa9fxNT4KJwya73M4TYiCKxCQv97511Ve");
    expect(walletFromSeedMap["secret"], "xpkpdVP3LKhtdSfQX3uHNs1f7jN42");
    expect(walletFromSeedMap["publicKey"],
        "cB4e4YpAbPTLyYHmHmEBpLHCNU9TQc8jBUgERoAoQJBkhxT5fRfw");
}

Use this package as a library

1. Depend on it

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


dependencies:
  chainwallet: ^1.0.4

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:chainwallet/chainwallet.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
75
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
39
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.5

Health suggestions

Fix lib/src/core/fields/Field.dart. (-11.33 points)

Analysis of lib/src/core/fields/Field.dart reported 24 hints, including:

line 6 col 26: Unnecessary new keyword.

line 8 col 34: Unnecessary new keyword.

line 10 col 34: Unnecessary new keyword.

line 12 col 32: Unnecessary new keyword.

line 13 col 31: Unnecessary new keyword.

Fix lib/src/core/coretypes/Amount.dart. (-9.08 points)

Analysis of lib/src/core/coretypes/Amount.dart reported 19 hints, including:

line 7 col 8: Unused import: '../fields/Field.dart'.

line 8 col 8: Unused import: '../format/Format.dart'.

line 11 col 8: Unused import: '../serialized/BinarySerializer.dart'.

line 19 col 8: Unused import: 'package:chainwallet/src/core/serialized/enums/TransactionType.dart'.

line 28 col 7: Unnecessary new keyword.

Fix lib/src/core/serialized/TypeTranslator.dart. (-9.08 points)

Analysis of lib/src/core/serialized/TypeTranslator.dart reported 19 hints, including:

line 11 col 1: Prefer using /// for doc comments.

line 44 col 11: Unnecessary new keyword.

line 48 col 11: Unnecessary new keyword.

line 52 col 11: Unnecessary new keyword.

line 56 col 11: Unnecessary new keyword.

Fix additional 34 files with analysis or formatting issues. (-113.01 points)

Additional issues in the following files:

  • lib/src/ecdsa/K256KeyPair.dart (18 hints)
  • lib/src/core/coretypes/AccountID.dart (15 hints)
  • lib/src/core/coretypes/STObject.dart (15 hints)
  • lib/src/core/fields/Type.dart (15 hints)
  • lib/src/ChainsqlAPI.dart (13 hints)
  • lib/src/utils/Util.dart (13 hints)
  • lib/src/core/coretypes/Blob.dart (10 hints)
  • lib/src/core/coretypes/Currency.dart (10 hints)
  • lib/src/core/coretypes/hash/HalfSha512.dart (10 hints)
  • lib/src/core/coretypes/hash/prefixes/HashPrefix.dart (10 hints)
  • lib/src/core/types/signed/SignedTransaction.dart (10 hints)
  • lib/src/core/coretypes/STObjectFormatter.dart (8 hints)
  • lib/src/core/serialized/BinaryParser.dart (8 hints)
  • lib/src/core/serialized/enums/TransactionType.dart (7 hints)
  • lib/src/core/coretypes/hash/Hash.dart (6 hints)
  • lib/src/core/coretypes/hash/Hash160.dart (5 hints)
  • lib/src/core/coretypes/hash/Hash256.dart (5 hints)
  • lib/src/core/coretypes/uint/UInt32.dart (5 hints)
  • lib/src/ecdsa/Seed.dart (5 hints)
  • lib/src/utils/B58IdentiferCodecs.dart (5 hints)
  • lib/src/core/coretypes/uint/UInt.dart (4 hints)
  • lib/src/core/coretypes/uint/UInt64.dart (4 hints)
  • lib/src/core/serialized/BinarySerializer.dart (4 hints)
  • lib/src/core/serialized/ByteList.dart (4 hints)
  • lib/src/core/types/tx/Transaction.dart (4 hints)
  • lib/src/utils/Sha512half.dart (4 hints)
  • lib/src/core/coretypes/uint/UInt16.dart (3 hints)
  • lib/src/core/format/TxFormat.dart (3 hints)
  • lib/src/core/format/Format.dart (2 hints)
  • lib/src/core/serialized/MultiSink.dart (2 hints)
  • lib/src/core/fields/UInt32Field.dart (1 hint)
  • lib/src/core/serialized/BytesSink.dart (1 hint)
  • lib/src/core/types/txns/Payment.dart (1 hint)
  • lib/src/core/types/txns/TrustSet.dart (1 hint)

Maintenance issues and suggestions

Support latest dependencies. (-20 points)

The version constraint in pubspec.yaml does not support the latest published versions for 2 dependencies (asn1lib, encrypt).

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
asn1lib ^0.5.8 0.5.15 0.6.0
base58check ^1.0.1 1.0.1
collection ^1.14.11 1.14.12
crypto ^2.1.2 2.1.4
cryptoutils ^0.4.0 0.4.0
decimal ^0.3.0 0.3.5
encrypt ^3.3.1 3.3.1 4.0.0
hex ^0.1.2 0.1.2
pointycastle ^1.0.1 1.0.2
secp256k1cipher ^0.2.0 0.2.1
Transitive dependencies
args 1.5.2
charcode 1.1.3
clock 1.0.1
convert 2.1.1
meta 1.1.8
rational 0.3.8
typed_data 1.1.6
Dev dependencies
test ^1.6.8