chainwallet 1.0.4

  • Readme
  • Changelog
  • Example
  • Installing
  • new60

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]
41
Health:
Code health derived from static analysis. [more]
66
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
60
Learn more about scoring.

We analyzed this package on Oct 9, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:chainwallet/chainwallet.dart.

Health suggestions

Fix lib/src/core/coretypes/AccountID.dart. (-3.93 points)

Analysis of lib/src/core/coretypes/AccountID.dart reported 8 hints, including:

line 5 col 8: Unused import: '../serialized/SerializedType.dart'.

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

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

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

line 15 col 8: Unused import: 'package:chainwallet/src/core/coretypes/uint/UInt16.dart'.

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

Analysis of lib/src/core/coretypes/Amount.dart reported 8 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 38 col 10: Don't explicitly initialize variables to null.

Fix lib/src/core/coretypes/STObject.dart. (-3.93 points)

Analysis of lib/src/core/coretypes/STObject.dart reported 8 hints, including:

line 255 col 7: DO use curly braces for all flow control structures.

line 257 col 7: DO use curly braces for all flow control structures.

line 259 col 7: DO use curly braces for all flow control structures.

line 261 col 7: DO use curly braces for all flow control structures.

line 263 col 7: DO use curly braces for all flow control structures.

Fix additional 25 files with analysis or formatting issues. (-29.81 points)

Additional issues in the following files:

  • lib/src/core/coretypes/Blob.dart (7 hints)
  • lib/src/core/coretypes/hash/HalfSha512.dart (6 hints)
  • lib/src/core/coretypes/STObjectFormatter.dart (5 hints)
  • lib/src/core/serialized/BinaryParser.dart (5 hints)
  • lib/src/utils/Util.dart (5 hints)
  • lib/src/core/coretypes/Currency.dart (3 hints)
  • lib/src/core/coretypes/hash/Hash160.dart (3 hints)
  • lib/src/core/coretypes/hash/Hash256.dart (3 hints)
  • lib/src/ecdsa/K256KeyPair.dart (3 hints)
  • lib/src/core/fields/Field.dart (2 hints)
  • lib/src/core/serialized/MultiSink.dart (2 hints)
  • lib/src/core/serialized/TypeTranslator.dart (2 hints)
  • lib/src/core/types/signed/SignedTransaction.dart (2 hints)
  • lib/src/ChainsqlAPI.dart (1 hint)
  • lib/src/core/coretypes/hash/prefixes/HashPrefix.dart (1 hint)
  • lib/src/core/coretypes/uint/UInt32.dart (1 hint)
  • lib/src/core/fields/Type.dart (1 hint)
  • lib/src/core/fields/UInt32Field.dart (1 hint)
  • lib/src/core/serialized/BytesSink.dart (1 hint)
  • lib/src/core/serialized/enums/TransactionType.dart (1 hint)
  • lib/src/core/types/tx/Transaction.dart (1 hint)
  • lib/src/core/types/txns/Payment.dart (1 hint)
  • lib/src/core/types/txns/TrustSet.dart (1 hint)
  • lib/src/utils/B58IdentiferCodecs.dart (1 hint)
  • lib/src/utils/Sha512half.dart (1 hint)

Dependencies

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