Web3MoveEx.Aptos.RPC (web3_move_ex v0.3.7)
Copy From: https://github.com/myastrallabs/stormstout
Link to this section Summary
Functions
= AptosRPC.connect() {:ok, res} = Aptos.RPC.get_collection_data(
= Aptos.RPC.connect() {:ok, result} = Aptos.RPC.get_token_data(
Link to this section Functions
build_event_path(map, address, event_handle, field)
build_resource(map, address, resource_type)
check_transaction_by_hash(client, hash, times \\ 3)
connect()
connect(endpoint)
connect(atom, network_type)
get_account(client, address)
get_collection_data(client, account, collection_name)
= AptosRPC.connect() {:ok, res} = Aptos.RPC.get_collection_data(
client,
"0xdc4e806913a006d86da8327a079d794435e2e3117fd418062ddf43943d663490",
"DummyDog"
)
get_events(client, event_key)
get_events(client, address, event_handle, field, query \\ [limit: 10])
get_faucet(client, address, amount \\ 100000000)
get_resource(client, address, resource_type)
get_resources(client, address, query \\ [])
get_table_item(client, table_handle, table_key)
get_table_item(client, table_handle, key_type, value_type, key)
https://fullnode.devnet.aptoslabs.com/v1/spec#/operations/get_table_item
Example by curl:
curl --request POST --url https://fullnode.testnet.aptoslabs.com/v1/tables/0x55faf86aea81d23c0f8ec9bb5fa6ec8fed920a3482ea75d5bf27474a00d42198/item --header 'Content-Type: application/json' --data '{ "key_type": "0x1::string::String", "value_type": "0xb923303d20c38a120669ad0ed751a105f254b049e75a350111d566009df9ba11::addr_info::AddrInfo", "key": "0x73c7448760517E3E6e416b2c130E3c6dB2026A1d" }' {"addr":"0x73c7448760517E3E6e416b2c130E3c6dB2026A1d","addr_type":"0","chains":["Ethereum"],"created_at":"1668826549","description":"Cool Addr","expired_at":"1700362549","id":"1","msg":"33344091.1.nonce_geek","pubkey":"","signature":"0x","updated_at":"0"}%
Example to call by func: > Web3MoveEx.Aptos.RPC.get_table_item(client, "0x55faf86aea81d23c0f8ec9bb5fa6ec8fed920a3482ea75d5bf27474a00d42198", "0x1::string::String", "0xb923303d20c38a120669ad0ed751a105f254b049e75a350111d566009df9ba11::addr_info::AddrInfo", "0x73c7448760517E3E6e416b2c130E3c6dB2026A1d")
get_token_data(client, creator, collection_name, token_name)
= Aptos.RPC.connect() {:ok, result} = Aptos.RPC.get_token_data(
client,
"0xdc4e806913a006d86da8327a079d794435e2e3117fd418062ddf43943d663490",
"DummyDog",
"DummyDog 1"
)