Sending a transaction
For transactions to be sent to the Aptos blockchain, users will have to either sign or sign and submit, to send the transactions to the blockchain for execution.
This process can take two forms using Fletch Wallet API:
- Signing and submitting the transaction to the blockchain; wherein the blockchain returns a pending transaction to the Dapp.
And,
- Signing the transaction without submitting the transaction to the blockchain; the signed transaction is returned to the Dapp for the Dapp to make the submission.
The code below can be used to call the
window.fletch.signAndSubmitTransaction(payload)
API, to sign and submit a transaction to the Aptos blockchain.var payload = {
function: "0x1::coin::transfer",
type_arguments: ["0x1::aptos_coin::AptosCoin"],
arguments: [
"0x42c84b49d7bf72ac1373f813f7b3a2bcbb9dec591c24476ff2fd3599f59ac22d",
"400"
],
type: "entry_function_payload"
}
try {
let result = window.fletch.signAndSubmitTransaction(payload)
console.log(result.hash)
} catch (error) {
}
Last modified 7mo ago