Create raw transaction object for entry_function_payload
type tx
Sender account address
Sender account sequence number
Target module address
Target module name
Target function name
Target function type args
Target function args
Optional
optionalTransactionPayloadArgs: OptionalTransactionPayloadArgsOptional arguments for transaction payload
Serialized raw transaction object
let supraCoinTransferRawTransaction = await supraClient.createRawTxObject(
senderAccount.address(),
(
await supraClient.getAccountInfo(senderAccount.address())
).sequence_number,
"0000000000000000000000000000000000000000000000000000000000000001",
"supra_account",
"transfer",
[],
[receiverAddress.toUint8Array(), BCS.bcsSerializeUint64(10000)]
);
Create serialized raw transaction for entry_function_payload
type tx
Under the hood the method utilizes createRawTxObject
method to create a raw transaction
and then it serializes using bcs serializer
Sender account address
Sender account sequence number
Target module address
Target module name
Target function name
Target function type args
Target function args
Optional
optionalTransactionPayloadArgs: OptionalTransactionPayloadArgsOptional arguments for transaction payload
Serialized raw transaction object
Airdrop test Supra token on given account
Hex-encoded 32 byte Supra account address
FaucetRequestResponse
Get Coin balance of given account
Supra account address for getting balance
Type of a coin resource
Supra Balance
Get transactions sent by the account and Coin transfer related transactions
Supra account address
Number of coin transfer transactions and account sent transaction to be considered,
For instance if the value is N
so total N*2
transactions will be returned.
List of TransactionDetail
Get info of given supra account
Hex-encoded 32 byte Supra account address
AccountInfo
Get list of all resources held by given supra account
Hex-encoded 32 byte Supra account address
Optional
paginationArgs: PaginationArgsArguments for pagination response
AccountResources
Get Supra balance of given account
Supra Account address for getting balance
Supra Balance
Get transactions sent by the account
Supra account address
Optional
paginationArgs: PaginationArgsArguments for pagination response
List of TransactionDetail
Private
getGet Coin Transfer related transactions associated with the account
Supra account address
Optional
paginationArgs: PaginationArgsList of TransactionDetail
Private
getED25519Private
getGet data of resource held by given supra account
Hex-encoded 32 byte Supra account address
Type of a resource
Resource data
let supraCoinInfo = await supraClient.getResourceData(
new HexString("0x1"),
"0x1::coin::CoinInfo<0x1::supra_coin::SupraCoin>"
)
Generate SendTxPayload
using RawTransaction
to send transaction request
Generated data can be used to send transaction directly using /rpc/v1/transactions/submit
endpoint of rpc_node
Sender KeyPair
Raw transaction data
SendTxPayload
Get transaction details of given transaction hash
Hex-encoded 32 byte Supra account address
Hex-encoded 32 byte transaction hash for getting transaction details
TransactionDetail
Private
getGet status of given supra transaction
Hex-encoded 32 byte transaction hash for getting transaction status
TransactionStatus
Check whether given account exists onchain or not
Hex-encoded 32 byte Supra account address
true
if account exists otherwise false
Publish package or module on supra network
Module Publisher KeyPair
Package Metadata
module code
Optional
optionalTransactionArgs: OptionalTransactionArgsoptional arguments for transaction
TransactionResponse
Sends multi-agent transaction
Account address of tx sender
List of account address of tx secondary signers
The raw transaction to be submitted
The sender account authenticator
List of the secondary signers account authenticator
Optional
enableTransactionWaitAndSimulationArgs: EnableTransactionWaitAndSimulationArgsenable transaction wait and simulation arguments
TransactionResponse
Private
sendSends sponsor transaction
Account address of tx sender
Account address of tx fee payer
List of account address of tx secondary signers
The raw transaction to be submitted
The sender account authenticator
The feepayer account authenticator
An optional array of the secondary signers account authenticator
Optional
enableTransactionWaitAndSimulationArgs: EnableTransactionWaitAndSimulationArgsenable transaction wait and simulation arguments
TransactionResponse
Private
sendOptional
enableTransactionWaitAndSimulationArgs: EnableTransactionWaitAndSimulationArgsSend entry_function_payload
type tx using serialized raw transaction data
Sender KeyPair
Serialized raw transaction data
Optional
enableTransactionWaitAndSimulationArgs: EnableTransactionWaitAndSimulationArgsenable transaction wait and simulation arguments
TransactionResponse
Simulate a transaction using the provided transaction payload
Transaction payload
Transaction simulation result
Simulate a transaction using the provided Serialized raw transaction data
Tx sender account address
Transaction authenticator
Serialized raw transaction data
Transaction simulation result
Transfer custom type of coin
Sender KeyPair
Receiver Supra Account address
Amount to transfer
Type of custom coin
Optional
optionalTransactionArgs: OptionalTransactionArgsoptional arguments for transaction
TransactionResponse
Transfer supra coin
Sender KeyPair
Receiver Supra Account address
Amount to transfer
Optional
optionalTransactionArgs: OptionalTransactionArgsoptional arguments for transaction
TransactionResponse
Private
unsetPrivate
waitStatic
createCreate signed transaction payload
Sender KeyPair
Raw transaction payload
SignedTransaction
Static
deriveGenerate transaction hash locally
Signed transaction payload
SignedTransaction
let supraCoinTransferSignedTransaction = SupraClient.createSignedTransaction(
senderAccount,
supraCoinTransferRawTransaction
);
console.log(
SupraClient.deriveTransactionHash(supraCoinTransferSignedTransaction)
);
Static
initCreates and initializes SupraClient
instance
The chain id will be fetched from the provided url
rpc url of supra rpc node
SupraClient
initialized instance
let supraClient = await SupraClient.init(
"http://localhost:27001/"
);
Static
signSigns a multi transaction type (multi agent / fee payer) and returns the signer authenticator to be used to submit the transaction.
the account to sign on the transaction
a MultiAgentRawTransaction or FeePayerRawTransaction
signer authenticator
Static
signGenerate ed25519_signature
for supra transaction using RawTransaction
the account to sign on the transaction
a RawTransaction, MultiAgentRawTransaction or FeePayerRawTransaction
ed25519 signature in HexString
Provides methods for interacting with supra rpc node.