Skip to content

0xhappyboy/aptos-light-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Aptos Light SDK

It is used to simplify complex operations on the aptos network, reduce the difficulty of aptos development, and allow more people to happily build on the aptos network.
continuous building 🔨

Use

### Cargo.toml
[dependencies]
aptos-light-sdk = {git = "https://github.com/0xhappyboy/aptos-light-sdk", branch = "main"}
tokio = {version = "1.4", features = ["full"]}

[patch.crates-io]
merlin = {git = "https://github.com/aptos-labs/merlin"}
x25519-dalek = {git = "https://github.com/aptos-labs/x25519-dalek", branch = "zeroize_v1"}
### .cargo/config.toml
[build]
rustflags = ["--cfg", "tokio_unstable"]

Module

account: provides operations for accounts
client : used to initialize the client and oper
config : overall situation config
transfer : provides methods for transactions
net : provides methods for net
coin : provides methods for coin
net : provides methods for net
faucet : faucet related methods, valid in Mode::DEV Mode::TEST mode
utils : internal utils

Function

account::create_new_account

create a account

Examples

account::create_new_account()

account::create_account_by_private_key

create a account by private key

Examples

account::create_account_by_private_key("private_key")

account::create_vanity_account

create a vanity account

Examples

/// trying to create an account whose public key meets the conditions starting with 6 and ending with 8
account::create_vanity_account("6666".to_string(),"8888".to_string())

account::get_public_key

get the public key string of an account

Examples

get_public_key(&account).unwrap();

account::get_private_key

get the private key string of an account

Examples

get_private_key(&account).unwrap();

account::get_account_balance

get account balance

Examples

let mut aptos_client = AptosClient::new(Mode::DEV);
get_account_balance(&mut aptos_client,&account).unwrap();

client::AptosClient::new

initialize client instance

Examples

AptosClient::new(Mode::DEV)

transfer::create_txn_hash

create a txn hash

Examples

let aptos_client = AptosClient::new(Mode::DEV);
crate_txn_hash(aptos_client,from address,to address,amount)

transfer::send_txn_hash

send a txn hash

Examples

let aptos_client = AptosClient::new(Mode::DEV);
let txn = crate_txn_hash(aptos_client,from address,to address,amount)?
send_txn_hash(aptos_client,txn)

transfer::batch_transfer

batch transfer

Examples

let aptos_client = AptosClient::new(Mode::DEV);
let mut from = account::create_account_by_private_key("0x");
let mut to_1 = account::create_account_by_private_key("0x");
let mut to_2 = account::create_account_by_private_key("0x");

let mut v = vec![];
v.push(to_1);
v.push(to_2);

transfer::batch_transfer(&aptos_client, &mut from, &v, 0.1).await;

faucet::get_faucet_coin

use the designated account to obtain faucet tokens

Examples

let aptos_client = AptosClient::new(Mode::DEV);
let mut account = create_new_account();
faucet::get_faucet_coin(&aptos_client,account,10)

Releases

No releases published

Packages

No packages published

Languages