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.

Kindly refer to the Aptos Typescript SDK to learn more about transactions on Aptos.

To Sign and Submit:

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) {

}

To Sign Only:

Last updated