aptos 0.0.6 copy "aptos: ^0.0.6" to clipboard
aptos: ^0.0.6 copied to clipboard

Aptos Dart SDK.

Aptos Dart SDK #

Pub

Installation #

dependencies:
  aptos: ^0.0.6
copied to clipboard

Usage #

// Generate Aptos Account
final mnemonics = AptosAccount.generateMnemonic();
final sender = AptosAccount.generateAccount(mnemonics);
final receiver = AptosAccount();

// AptosClient connect with Aptos Node
final aptosClient = AptosClient(Constants.devnetAPI, enableDebugLog: true);

// Check and fund account
final amount = BigInt.from(10000000);
bool isExists = await aptosClient.accountExist(sender.address);
if (!isExists) {
  final faucetClient = FaucetClient.fromClient(Constants.faucetDevAPI, aptosClient);
  await faucetClient.fundAccount(sender.address, amount.toString());
  await Future.delayed(const Duration(seconds: 2));
}

final coinClient = CoinClient(aptosClient);

// Check account balance
final balance = await coinClient.checkBalance(sender.address);
print(balance);

// Transfer Aptos Coin
final txHash = await coinClient.transfer(
  sender, 
  receiver.address, 
  BigInt.from(10000),
  createReceiverIfMissing: true);
print(txHash);
copied to clipboard
3
likes
110
points
122
downloads

Publisher

verified publishermofalabs.com

Weekly Downloads

2024.09.28 - 2025.04.12

Aptos Dart SDK.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

bip39, dio, ed25519_edwards, flutter, freezed_annotation, graphql, hex, json_annotation, pointycastle

More

Packages that depend on aptos