@martiandao/aptos-web3-bip44.js / Exports / WalletClient
- accountTransactions
- airdrop
- cancelTokenOffer
- claimToken
- createCollection
- createNewAccount
- createToken
- createWallet
- getAccountResource
- getBalance
- getCoinBalance
- getCoinData
- getCollection
- getCustomResource
- getEventStream
- getReceivedEvents
- getSentEvents
- getToken
- getTokenIds
- getTokens
- importWallet
- initializeCoin
- mintCoin
- offerToken
- registerCoin
- rotateAuthKey
- signAndSubmitTransaction
- signAndSubmitTransactions
- signGenericTransaction
- signTransaction
- submitBCSSimulation
- submitSignedBCSTransaction
- submitTransaction
- transfer
- transferCoin
- generateBCSSimulation
- generateBCSTransaction
- getAccountFromMetaData
- getAccountFromMnemonic
- getAccountFromPrivateKey
- signMessage
• new WalletClient(node_url
, faucet_url
)
Name | Type |
---|---|
node_url |
any |
faucet_url |
any |
wallet_client.ts:44
• aptosClient: AptosClient
wallet_client.ts:40
• faucetClient: FaucetClient
wallet_client.ts:38
• tokenClient: TokenClient
wallet_client.ts:42
▸ accountTransactions(accountAddress
): Promise
<{ data
: any
= item.payload; from
: any
= item.sender; gas
: any
= item.gas_used; gasPrice
: any
= item.gas_unit_price; hash
: any
= item.hash; price
: any
; success
: any
= item.success; timestamp
: any
= item.timestamp; toAddress
: any
; type
: any
= item.type; version
: any
= item.version; vmStatus
: any
= item.vm_status }[]>
returns the list of on-chain transactions sent by the said account
Name | Type | Description |
---|---|---|
accountAddress |
MaybeHexString |
address of the desired account |
Promise
<{ data
: any
= item.payload; from
: any
= item.sender; gas
: any
= item.gas_used; gasPrice
: any
= item.gas_unit_price; hash
: any
= item.hash; price
: any
; success
: any
= item.success; timestamp
: any
= item.timestamp; toAddress
: any
; type
: any
= item.type; version
: any
= item.version; vmStatus
: any
= item.vm_status }[]>
list of transactions
wallet_client.ts:240
▸ airdrop(address
, amount
): Promise
<string
[]>
airdrops test coins in the given account
Name | Type | Description |
---|---|---|
address |
string |
address of the receiver's account |
amount |
number |
amount to be airdropped |
Promise
<string
[]>
list of transaction hashs
wallet_client.ts:211
▸ cancelTokenOffer(account
, receiver_address
, creator_address
, collection_name
, token_name
): Promise
<string
>
cancels an NFT offer
Name | Type | Description |
---|---|---|
account |
AptosAccount |
AptosAccount of the signing account |
receiver_address |
string |
address of the receiver account |
creator_address |
string |
address of the creator account |
collection_name |
string |
collection name |
token_name |
string |
NFT name |
Promise
<string
>
transaction hash
wallet_client.ts:424
▸ claimToken(account
, sender_address
, creator_address
, collection_name
, token_name
): Promise
<string
>
claims offered NFT
Name | Type | Description |
---|---|---|
account |
AptosAccount |
AptosAccount of the signing account |
sender_address |
string |
address of the sender account |
creator_address |
string |
address of the creator account |
collection_name |
string |
collection name |
token_name |
string |
NFT name |
Promise
<string
>
transaction hash
wallet_client.ts:452
▸ createCollection(account
, name
, description
, uri
): Promise
<string
>
creates an NFT collection
Name | Type | Description |
---|---|---|
account |
AptosAccount |
AptosAccount object of the signing account |
name |
string |
collection name |
description |
string |
collection description |
uri |
string |
collection URI |
Promise
<string
>
transaction hash
wallet_client.ts:338
▸ createNewAccount(code
): Promise
<AccountMetaData
>
Creates a new account in the provided wallet
Name | Type | Description |
---|---|---|
code |
string |
mnemonic phrase of the wallet |
Promise
<AccountMetaData
>
wallet_client.ts:136
▸ createToken(account
, collection_name
, name
, description
, supply
, uri
, royalty_points_per_million?
): Promise
<string
>
creates an NFT
Name | Type | Default value | Description |
---|---|---|---|
account |
AptosAccount |
undefined |
AptosAccount object of the signing account |
collection_name |
string |
undefined |
collection name |
name |
string |
undefined |
NFT name |
description |
string |
undefined |
NFT description |
supply |
number |
undefined |
supply for the NFT |
uri |
string |
undefined |
NFT URI |
royalty_points_per_million |
number |
0 |
royalty points per million |
Promise
<string
>
transaction hash
wallet_client.ts:361
▸ createWallet(): Promise
<Wallet
>
Creates a new wallet which contains a single account, which is registered on Aptos
Promise
<Wallet
>
A wallet object
wallet_client.ts:124
▸ getAccountResource(accountAddress
, resourceType
): Promise
<any
>
returns info about a particular resource inside an account
Name | Type | Description |
---|---|---|
accountAddress |
string |
address of the desired account |
resourceType |
string |
type of the desired resource |
Promise
<any
>
resource information
wallet_client.ts:842
▸ getBalance(address
): Promise
<number
>
returns the balance of the said account
Name | Type | Description |
---|---|---|
address |
string | HexString |
address of the desired account |
Promise
<number
>
balance of the account
wallet_client.ts:223
▸ getCoinBalance(address
, coin_type_path
): Promise
<number
>
returns the balance of the coin for an account
Name | Type | Description |
---|---|---|
address |
string |
address of the desired account |
coin_type_path |
string |
address path of the desired coin |
Promise
<number
>
number of coins
wallet_client.ts:1035
▸ getCoinData(coin_type_path
): Promise
<any
>
returns the information about the coin
Name | Type | Description |
---|---|---|
coin_type_path |
string |
address path of the desired coin |
Promise
<any
>
coin information
wallet_client.ts:1020
▸ getCollection(address
, collectionName
): Promise
<any
>
returns the information about a collection of an account
Name | Type | Description |
---|---|---|
address |
string |
address of the desired account |
collectionName |
string |
collection name |
Promise
<any
>
collection information
wallet_client.ts:786
▸ getCustomResource(address
, resourceType
, fieldName
, keyType
, valueType
, key
): Promise
<any
>
Name | Type |
---|---|
address |
string |
resourceType |
string |
fieldName |
string |
keyType |
string |
valueType |
string |
key |
any |
Promise
<any
>
wallet_client.ts:807
▸ getEventStream(address
, eventHandleStruct
, fieldName
): Promise
<any
>
Name | Type |
---|---|
address |
string |
eventHandleStruct |
string |
fieldName |
string |
Promise
<any
>
wallet_client.ts:641
▸ getReceivedEvents(address
): Promise
<Event
[]>
returns the list of events involving transactions of Aptos Coins received by the said account
Name | Type | Description |
---|---|---|
address |
string |
address of the desired account |
Promise
<Event
[]>
list of events
wallet_client.ts:319
▸ getSentEvents(address
): Promise
<OnChainTransaction
[]>
returns the list of events involving transactions starting from the said account
Name | Type | Description |
---|---|---|
address |
MaybeHexString |
address of the desired account |
Promise
<OnChainTransaction
[]>
list of events
wallet_client.ts:306
▸ getToken(tokenId
): Promise
<any
>
returns the token information (including the collection information) about a said tokenID
Name | Type | Description |
---|---|---|
tokenId |
TokenId |
token ID of the desired token |
Promise
<any
>
token information
wallet_client.ts:758
▸ getTokenIds(address
): Promise
<any
[]>
returns a list of token IDs of the tokens in a user's account (including the tokens that were minted)
Name | Type | Description |
---|---|---|
address |
string |
address of the desired account |
Promise
<any
[]>
list of token IDs
wallet_client.ts:667
▸ getTokens(address
): Promise
<any
[]>
returns the tokens in an account
Name | Type | Description |
---|---|---|
address |
string |
address of the desired account |
Promise
<any
[]>
list of tokens and their collection data
wallet_client.ts:717
▸ importWallet(code
): Promise
<Wallet
>
Each mnemonic phrase corresponds to a single wallet Wallet can contain multiple accounts An account corresponds to a key pair + address
Get all the accounts of a user from their mnemonic phrase
Name | Type | Description |
---|---|---|
code |
string |
The mnemonic phrase (12 word) |
Promise
<Wallet
>
Wallet object containing all accounts of a user
wallet_client.ts:60
▸ initializeCoin(account
, coin_type_path
, name
, symbol
, scaling_factor
): Promise
<{ success
: any
= resp.success; txnHash
: string
; vm_status
: any
= resp.vm_status }>
initializes a coin
precondition: a module of the desired coin has to be deployed in the signer's account
Name | Type | Description |
---|---|---|
account |
AptosAccount |
AptosAccount object of the signing account |
coin_type_path |
string |
address path of the desired coin |
name |
string |
name of the coin |
symbol |
string |
symbol of the coin |
scaling_factor |
number |
scaling factor of the coin |
Promise
<{ success
: any
= resp.success; txnHash
: string
; vm_status
: any
= resp.vm_status }>
transaction hash
wallet_client.ts:871
▸ mintCoin(account
, coin_type_path
, dst_address
, amount
): Promise
<{ success
: any
= resp.success; txnHash
: string
; vm_status
: any
= resp.vm_status }>
mints a coin in a receiver account
precondition: the signer should have minting capability unless specifically granted, only the account where the module of the desired coin lies has the minting capability
Name | Type | Description |
---|---|---|
account |
AptosAccount |
AptosAccount object of the signing account |
coin_type_path |
string |
address path of the desired coin |
dst_address |
string |
address of the receiver account |
amount |
number |
amount to be minted |
Promise
<{ success
: any
= resp.success; txnHash
: string
; vm_status
: any
= resp.vm_status }>
transaction hash
wallet_client.ts:951
▸ offerToken(account
, receiver_address
, creator_address
, collection_name
, token_name
, amount
): Promise
<string
>
offers an NFT to another account
Name | Type | Description |
---|---|---|
account |
AptosAccount |
AptosAccount object of the signing account |
receiver_address |
string |
address of the receiver account |
creator_address |
string |
address of the creator account |
collection_name |
string |
collection name |
token_name |
string |
NFT name |
amount |
number |
amount to receive while offering the token |
Promise
<string
>
transaction hash
wallet_client.ts:394
▸ registerCoin(account
, coin_type_path
): Promise
<{ success
: any
= resp.success; txnHash
: string
; vm_status
: any
= resp.vm_status }>
registers a coin for an account
creates the resource for the desired account such that the account can start transacting in the desired coin
Name | Type | Description |
---|---|---|
account |
AptosAccount |
AptosAccount object of the signing account |
coin_type_path |
string |
address path of the desired coin |
Promise
<{ success
: any
= resp.success; txnHash
: string
; vm_status
: any
= resp.vm_status }>
transaction hash
wallet_client.ts:914
▸ rotateAuthKey(code
, metaData
): Promise
<{ authkey
: string
= ""; success
: boolean
= false; vm_status
: any
= transactionStatus.vm_status }>
Rotates the auth key
Name | Type | Description |
---|---|---|
code |
string |
mnemonic phrase for the desired wallet |
metaData |
AccountMetaData |
metadata for the desired account |
Promise
<{ authkey
: string
= ""; success
: boolean
= false; vm_status
: any
= transactionStatus.vm_status }>
status object
wallet_client.ts:601
▸ signAndSubmitTransaction(account
, txnRequest
): Promise
<string
>
Name | Type |
---|---|
account |
AptosAccount |
txnRequest |
UserTransactionRequest |
Promise
<string
>
wallet_client.ts:508
▸ signAndSubmitTransactions(account
, txnRequests
): Promise
<any
[]>
Name | Type |
---|---|
account |
AptosAccount |
txnRequests |
UserTransactionRequest [] |
Promise
<any
[]>
wallet_client.ts:522
▸ signGenericTransaction(account
, func
, args
, type_args
): Promise
<{ success
: any
= resp.success; txnHash
: string
; vm_status
: any
= resp.vm_status }>
sign a generic transaction
Name | Type | Description |
---|---|---|
account |
AptosAccount |
AptosAccount of the signing account |
func |
string |
function name to be called |
args |
string [] |
arguments of the function to be called |
type_args |
string [] |
type arguments of the function to be called |
Promise
<{ success
: any
= resp.success; txnHash
: string
; vm_status
: any
= resp.vm_status }>
transaction hash
wallet_client.ts:479
▸ signTransaction(account
, txnRequest
): Promise
<SubmitTransactionRequest
>
Name | Type |
---|---|
account |
AptosAccount |
txnRequest |
UserTransactionRequest |
Promise
<SubmitTransactionRequest
>
wallet_client.ts:549
▸ submitBCSSimulation(bcsBody
): Promise
<OnChainTransaction
>
Name | Type |
---|---|
bcsBody |
Uint8Array |
Promise
<OnChainTransaction
>
wallet_client.ts:584
▸ submitSignedBCSTransaction(signedTxn
): Promise
<PendingTransaction
>
Name | Type |
---|---|
signedTxn |
Uint8Array |
Promise
<PendingTransaction
>
wallet_client.ts:576
▸ submitTransaction(signedTxn
): Promise
<PendingTransaction
>
Name | Type |
---|---|
signedTxn |
SubmitTransactionRequest |
Promise
<PendingTransaction
>
wallet_client.ts:558
▸ transfer(account
, recipient_address
, amount
): Promise
<string
| Error
>
transfers Aptos Coins from signer to receiver
Name | Type | Description |
---|---|---|
account |
AptosAccount |
AptosAccount object of the signing account |
recipient_address |
string | HexString |
address of the receiver account |
amount |
number |
amount of aptos coins to be transferred |
Promise
<string
| Error
>
transaction hash
wallet_client.ts:267
▸ transferCoin(account
, coin_type_path
, to_address
, amount
): Promise
<{ success
: any
= resp.success; txnHash
: string
; vm_status
: any
= resp.vm_status }>
transfers coin (applicable for all altcoins on Aptos) to receiver account
Name | Type | Description |
---|---|---|
account |
AptosAccount |
AptosAccount object of the signing account |
coin_type_path |
string |
address path of the desired coin |
to_address |
string |
address of the receiver account |
amount |
number |
amount to be transferred |
Promise
<{ success
: any
= resp.success; txnHash
: string
; vm_status
: any
= resp.vm_status }>
transaction hash
wallet_client.ts:987
▸ Static
generateBCSSimulation(account
, rawTxn
): Promise
<Uint8Array
>
Name | Type |
---|---|
account |
AptosAccount |
rawTxn |
RawTransaction |
Promise
<Uint8Array
>
wallet_client.ts:569
▸ Static
generateBCSTransaction(account
, rawTxn
): Promise
<Uint8Array
>
Name | Type |
---|---|
account |
AptosAccount |
rawTxn |
RawTransaction |
Promise
<Uint8Array
>
wallet_client.ts:562
▸ Static
getAccountFromMetaData(code
, metaData
): AptosAccount
returns an AptosAccount object for the desired account using the metadata of the account
Name | Type | Description |
---|---|---|
code |
string |
mnemonic phrase of the wallet |
metaData |
AccountMetaData |
metadata of the account to be fetched |
AptosAccount
wallet_client.ts:197
▸ Static
getAccountFromMnemonic(code
): AptosAccount
returns an AptosAccount at position m/44'/COIN_TYPE'/0'/0/0
Name | Type | Description |
---|---|---|
code |
string |
mnemonic phrase of the wallet |
AptosAccount
AptosAccount object
wallet_client.ts:182
▸ Static
getAccountFromPrivateKey(privateKey
, address?
): AptosAccount
returns an AptosAccount object given a private key and address of the account
Name | Type | Description |
---|---|---|
privateKey |
Buffer |
Private key of an account as a Buffer |
address? |
string |
address of a user |
AptosAccount
AptosAccount object
wallet_client.ts:172
▸ Static
signMessage(account
, message
): Promise
<string
>
Name | Type |
---|---|
account |
AptosAccount |
message |
string |
Promise
<string
>
wallet_client.ts:590