0 purchases
casper dart sdk
Casper Dart SDK #
The Dart package casper_dart_sdk is an SDK for interacting with the Casper Blockchain.
Requirements #
To use the SDK, you will need to have the following tools installed:
Dart SDK version 2.16.1 or higher (haven't been tested before 2.16.1)
Installation #
Available at pub.dev.
dependencies:
casper_dart_sdk: ^0.1.3
copied to clipboard
Usage #
After importing via:
import 'package:casper_dart_sdk/casper_dart_sdk.dart';
copied to clipboard
Use the CasperClient class to interact with the Casper Blockchain.
For example:
// Pass the node's RPC endpoint
final client = CasperClient(Uri.parse("http://127.0.0.1:7777/rpc"));
client.getPeers().then((result) {
for (final peer in result.peers) {
print(peer.address);
}
});
copied to clipboard
The usage.md document contains more information about the usage of the SDK.
Development #
Building #
Get dependencies:
dart pub get
copied to clipboard
To auto-generate serialization-deserialization classes, run build runner:
dart run build_runner build
copied to clipboard
Testing #
Run all tests:
dart test
copied to clipboard
Run specific test file:
dart test test/utils_test.dart
copied to clipboard
Test Environment
The environment variable CASPER_TEST_NODE_RPC_URL must be set to run the tests. Bare in mind that currently, some of the tests might be specific to the test node http://138.201.54.44:7777/rpc. The server responses should be mocked instead of relying on a single test node.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.