ckb_sdk_dart 0.23.1 ckb_sdk_dart: ^0.23.1 copied to clipboard
A Dart SDK for Nervos CKB which is a public/permissionless blockchain, the layer 1 of Nervos network.
import 'package:ckb_sdk_dart/ckb_rpc.dart';
import 'package:ckb_sdk_dart/ckb_type.dart';
import 'package:ckb_sdk_dart/src/type/block.dart';
main() async {
Api api = Api("http://localhost:8114", hasLogger: true);
String blockHash = await api.getBlockHash('0x2');
print('blockHash: $blockHash \n');
Block block = await api.getBlock(blockHash);
print('block: ${block.toJson()}\n');
TransactionWithStatus tx =
await api.getTransaction(block.transactions[0].hash);
print('transaction: ${tx.toJson()}\n');
}