Accumulate Dart Client

Pub Version GitHub Tests

Dart client for Accumulate blockchain, a novel blockchain network designed to be hugely scalable while maintaining security. This library supports all API class and basic data types that reflect network types and structures and utility functions to ease up creation of specific requests.

Full API reference available here: https://docs.accumulatenetwork.io/accumulate/developers/api/api-reference

Installation

With Dart:

$ dart pub add accumulate_api

With Flutter:

$ flutter pub add accumulate_api

This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):

dependencies:
  accumulate_api: any

Alternatively, your editor might support dart pub get or flutter pub get. Check the docs for your editor to learn more. Import it

Now in your Dart code, you can use:

import 'package:accumulate_api/accumulate_api.dart';

Usage

1. Generate Lite Identity

ACMEClient client = ACMEClient("https://testnet.accumulatenetwork.io/v2");
var lid = LiteIdentity(Ed25519KeypairSigner.generate());

2. Add ACME token from Faucet

ACMEClient client = ACMEClient("https://testnet.accumulatenetwork.io/v2");
var lid = LiteIdentity(Ed25519KeypairSigner.generate());
final res = await client.faucet(lid.acmeTokenAccount);

3. Add Credits to Lite Identity

int creditAmount = 60000;
AddCreditsParam addCreditsParam = AddCreditsParam();  
addCreditsParam.recipient = lid.url;  
addCreditsParam.amount = (creditAmount * pow(10, 8)) ~/ oracle;  
addCreditsParam.oracle = await client.valueFromOracle();  
await client.addCredits(lid.url, addCreditsParam, lid);

4. Send ACME token to another Lite ACME token account

int sendToken = 10000;
final recipient =  
    LiteIdentity(Ed25519KeypairSigner.generate()).acmeTokenAccount;  
SendTokensParam sendTokensParam = SendTokensParam();  
TokenRecipientParam tokenRecipientParam = TokenRecipientParam();  
tokenRecipientParam.amount = sendToken * pow(10, 8);  
tokenRecipientParam.url = recipient;  
sendTokensParam.to = List<TokenRecipientParam>.from([tokenRecipientParam]);  
await client.sendTokens(lid.acmeTokenAccount, sendTokensParam, lid);

5. Create ADI

final identitySigner = Ed25519KeypairSigner.generate();  
var identityUrl = "acc://custom-adi-name";  
final bookUrl = identityUrl + "/custom-book-name";  
  
CreateIdentityParam createIdentityParam = CreateIdentityParam();  
createIdentityParam.url = identityUrl;  
createIdentityParam.keyBookUrl = bookUrl;  
createIdentityParam.keyHash = identitySigner.publicKeyHash();  
await client.createIdentity(lid.url, createIdentityParam, lid);

Contributions

The Library developed by Kompendium, LLC in partnership with Kelecorix, Inc and Sergey Bushnyak. Contributions are welcome, open new PR or submit new issue.

Library developers:

Libraries

accumulate_api