Sign Transaction Block

Once an application is connected to Martian wallet via connect method, an app can request the user to sign a transaction using window.martian.sui.signTransaction()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

By using this method, users can securely sign transactions and ensure the safety of their assets on the Sui blockchain.

// Create a transaction
const response = await window.martian.sui.connect();
const tx = new TransactionBlock();
tx.moveCall({
  target: '0x2::devnet_nft::mint',
  arguments: [
    tx.pure('Hello'),
    tx.pure('Martians'),
    tx.pure('http://cdn.martianwallet.xyz/assets/icon.png'),
  ],
});
const input = {
  transactionBlockSerialized: tx.serialize(),
  options: {
    showEffects: true,
  }
}l
const transaction = await window.martian.sui.signTransactionBlock(input);

Last updated