ckb_sdk 0.23.0

  • Readme
  • Changelog
  • Installing
  • 49

CKB SDK Dart #

FOSSA Status pub package

Dart SDK for CKB.Nervos test network has not been released yet,so it is very early stage.Be careful when using this library.

Prerequisites #

To build CKB SDK, you'll need:

  • Dart sdk: ">=2.2.2 <3.0.0"

Usage #

JSON-RPC #

final apiClient = CKBApiClient(nodeUrl: NodeUrl);
String blockHash = await apiClient.getBlockHash("1");

You can see more JSON-RPC requests from RPC Document

Address #

 final ckbAddress = CKBAddress(Network.TestNet);
 final address = ckbAddress.generate(PublicKey);

You can find more in here.

api_client_example

address_example

test

License #

FOSSA Status

Changelog #

See CHANGELOG.md file.

CHANGELOG #

0.23.0 #

Support ckb release v0.23.0

0.18.0 #

Support ckb release v0.18.0

0.17.0 #

Support ckb release v0.17.0

Feature #

  • Add hash_type to Script (bd9007)

  • Update address format generator according recent RFC (83ec45)

  • Add get_cellbase_output_capacity_details rpc (f845eb)

  • Add get_header and get_header_by_number rpcs (696fb4)

  • Add set_ban and get_banned_address rpcs (2dd87c)

0.16.0 #

Support ckb release v0.16.0

Feature #

0.15.0 #

Support ckb release v0.15.0

Fix #

0.15.0 #

Support ckb release v0.14.0

Features #

  • add Indexer rpc (56)

  • update get_blockchain_info rpc(a0c2b7)

0.14.0 #

Support ckb release v0.14.0

Features #

  • remove the args field in cell input type(7caac4)

  • implement Secp256k1 recoverable sign(885e85)

Refactor #

Breaking Changes #

  • the type of cell input changes, its args field is removed
  • make sdk more in line with the dart rules

0.13.0 #

Support ckb release v0.13.0

Features #

  • update data type in RPC tx_pool_info (41c412)

0.12.0 #

Support ckb release v0.12.0

  • add sign transaction hash to witness
  • add RPC txPoolInfo,getPeers,epoch,dryTransaction,computeTransactionHash

0.11.0 #

Support ckb release v0.11.0

  • add RPC getBlockByBlockNumber
  • add RPC request time out
  • add parse address

0.10.1 #

Support ckb release v0.10.0

  • refactor RPCError

0.10.0 #

Support ckb release v0.10.0

  • add since to cell input

0.9.0 #

Support ckb release v0.9.0

  • add segregated witness structure
  • refactor rpc types
  • add Bech32
  • format address
  • fix hexStringToByteArray

0.8.0 #

Support ckb release v0.8.0

  • adapt CKB v0.8.0

0.7.1 #

Support ckb release v0.7.0

  • refactor script structure
  • remove wallet part

0.7.0 #

Support ckb release v0.7.0

  • add transaction trace RPC
  • replace SHA3 with Blake2b

0.6.2 #

Support ckb release v0.6.0

  • change pub name to ckb_sdk

0.6.1 #

Support ckb release v0.6.0

  • fix dart pub warning

0.6.0 #

Support ckb release v0.6.0

  • RPC
  • asw account and transfer
  • generate wallet

Use this package as a library

1. Depend on it

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


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

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

  • Dart: 2.6.0
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

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

Health issues and suggestions

Document public APIs. (-1 points)

595 out of 595 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/src/ckb_serialization/dynamic/table.dart. (-0.50 points)

Analysis of lib/src/ckb_serialization/dynamic/table.dart reported 1 hint:

line 6 col 21: Use ; instead of {} for empty constructor bodies.

Fix lib/src/ckb_serialization/fixed/struct.dart. (-0.50 points)

Analysis of lib/src/ckb_serialization/fixed/struct.dart reported 1 hint:

line 6 col 22: Use ; instead of {} for empty constructor bodies.

Fix lib/src/ckb_system_contract/ckb_system_contract.dart. (-0.50 points)

Analysis of lib/src/ckb_system_contract/ckb_system_contract.dart reported 1 hint:

line 6 col 5: DO use curly braces for all flow control structures.

Fix additional 20 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/ckb_address/ckb_address.dart (Run dartfmt to format lib/src/ckb_address/ckb_address.dart.)
  • lib/src/ckb_crypto/blake2b.dart (Run dartfmt to format lib/src/ckb_crypto/blake2b.dart.)
  • lib/src/ckb_crypto/signature.dart (Run dartfmt to format lib/src/ckb_crypto/signature.dart.)
  • lib/src/ckb_rpc/api_request.dart (Run dartfmt to format lib/src/ckb_rpc/api_request.dart.)
  • lib/src/ckb_serialization/base/fixed_type.dart (Run dartfmt to format lib/src/ckb_serialization/base/fixed_type.dart.)
  • lib/src/ckb_serialization/base/type.dart (Run dartfmt to format lib/src/ckb_serialization/base/type.dart.)
  • lib/src/ckb_types/banned_address.dart (Run dartfmt to format lib/src/ckb_types/banned_address.dart.)
  • lib/src/ckb_types/block.dart (Run dartfmt to format lib/src/ckb_types/block.dart.)
  • lib/src/ckb_types/blockchain_info.dart (Run dartfmt to format lib/src/ckb_types/blockchain_info.dart.)
  • lib/src/ckb_types/cell_base_output_capacity.dart (Run dartfmt to format lib/src/ckb_types/cell_base_output_capacity.dart.)
  • lib/src/ckb_types/cell_input.dart (Run dartfmt to format lib/src/ckb_types/cell_input.dart.)
  • lib/src/ckb_types/cell_with_status.dart (Run dartfmt to format lib/src/ckb_types/cell_with_status.dart.)
  • lib/src/ckb_types/live_cell.dart (Run dartfmt to format lib/src/ckb_types/live_cell.dart.)
  • lib/src/ckb_types/lock_hash_index_state.dart (Run dartfmt to format lib/src/ckb_types/lock_hash_index_state.dart.)
  • lib/src/ckb_types/node_info.dart (Run dartfmt to format lib/src/ckb_types/node_info.dart.)
  • lib/src/ckb_types/transaction_by_lock_hash.dart (Run dartfmt to format lib/src/ckb_types/transaction_by_lock_hash.dart.)
  • lib/src/ckb_types/transaction_point.dart (Run dartfmt to format lib/src/ckb_types/transaction_point.dart.)
  • lib/src/ckb_types/transaction_with_status.dart (Run dartfmt to format lib/src/ckb_types/transaction_with_status.dart.)
  • lib/src/ckb_types/tx_pool_info.dart (Run dartfmt to format lib/src/ckb_types/tx_pool_info.dart.)
  • lib/src/ckb_types/uncle_block.dart (Run dartfmt to format lib/src/ckb_types/uncle_block.dart.)

Maintenance suggestions

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and ckb_sdk.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.2 <3.0.0
bip_bech32 ^0.1.3 0.1.3
convert ^2.1.1 2.1.1
http ^0.12.0+2 0.12.0+2
pointycastle ^1.0.1 1.0.2
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.12
http_parser 3.1.3
meta 1.1.8
path 1.6.4
pedantic 1.8.0+1
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
test ^1.5.1+1