Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mofalabs/aptos
A cross-platform Aptos SDK for Mobile, Web and Desktop
https://github.com/mofalabs/aptos
Last synced: 3 months ago
JSON representation
A cross-platform Aptos SDK for Mobile, Web and Desktop
- Host: GitHub
- URL: https://github.com/mofalabs/aptos
- Owner: mofalabs
- License: mit
- Created: 2022-10-05T14:36:56.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-20T16:32:24.000Z (12 months ago)
- Last Synced: 2024-05-28T13:28:42.196Z (6 months ago)
- Language: Dart
- Homepage:
- Size: 349 KB
- Stars: 7
- Watchers: 1
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Aptos Dart SDK
-[![Pub](https://img.shields.io/badge/pub-v0.0.5-blue)](https://pub.dev/packages/aptos)
Installation
-```
dependencies:
aptos: ^0.0.5
```Usage
-```dart
// 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);
```