sign and submit transaction

await msafe.signAndSubmit(payload, option);

signAndSubmit is used to sign the transaction and then submit it to the blockchain. It takes two parameters:

  • payload - mandatory parameter containing the transaction body.

    • For arguments of type vector, you can pass in an array.

    • For vector<u8>, you can pass in Uint8Array.

    • You can also pass in a BCS serialized transaction as payload(Uint8Array), which ignores option.

  • option - optional parameter that overrides transaction parameters.

In the current implementation, `signAndSubmitTransaction` call is expected to never resolve. This is because when a transaction is initiated, MSafe is actually submitting a transaction to initiate a transaction proposal. It will require other owner's approval until the specific transaction can be executed from the MSafe wallet.

Thus upon a transaction proposal being successfully submitted, the application page will be closed, and the user is redirected to transaction queue page waiting for confirmation from other owners.


import { MSafeWallet } from "msafe-wallet";
const msafe = await;
const payload = {
    type: "entry_function",
    function: "0x1::coin::transfer",
    type_arguments: ["0x1::aptos_coin::AptosCoin"],
    arguments: ["0x997b38d2127711011462bc42e788a537eae77806404769188f20d3dc46d72750", 50]
// each field of option is optional.
const option = {
    max_gas_amount: "4000",
    gas_unit_price: "100",
await msafe.signAndSubmit(payload, option);

Last updated