accumulate_api

Creator: coderz1093

Last updated:

0 purchases

accumulate_api Image
accumulate_api Images
Add to Cart

Description:

accumulate api

Accumulate Dart Client #



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
copied to clipboard
With Flutter:
$ flutter pub add accumulate_api
copied to clipboard
This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):
dependencies:
accumulate_api: any
copied to clipboard
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';
copied to clipboard
Usage #
1. Generate Lite Identity #
ACMEClient client = ACMEClient("https://testnet.accumulatenetwork.io/v2");
var lid = LiteIdentity(Ed25519KeypairSigner.generate());
copied to clipboard
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);
copied to clipboard
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);
copied to clipboard
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);

copied to clipboard
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);
copied to clipboard
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:

Sergey Bushnyak [email protected]
Jimmy Jose [email protected]

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.