Sign Generic Transaction

Once an application is connected to Martian wallet via connect method, an app can request the user to Sign a generic transaction using window.martian.signGenericTransaction()and it will return a Promise that resolves when the user accepts the request and reject (throw when awaited) when the user declines the request or request is not valid/fails. It takes one parameter listed below:

  • Object

Below is the object structure:

{
    func: string, 
    args: [], 
    type_args: []
}

Here:

  • "func" should have function name, For e.g. 0x1::coin::transfer

  • "args" should have list of arguments for the specified function

  • "type_args" should have list of type arguments, For e.g. 0x1::aptos_coin::AptosCoin

Below is an example code describing the way to sign a generic transaction.

const genericTransactionArgument = {
    func: "0x1::coin::transfer",
    args: ["0x997b38d2127711011462bc42e788a537eae77806404769188f20d3dc46d72750", 500],
    type_args: ["0x1::aptos_coin::AptosCoin"]
};
await window.martian.signGenericTransaction(genericTransactionArgument);

Last updated