Martian Wallet Dev Docs
HomeChrome web store
  • Introduction
  • 🏗️Integration
    • Detecting the Provider
    • Establishing a Connection
    • Displaying Your App
  • ⚙️methods
    • Aptos
      • Generate Transaction
      • Sign Transaction
      • Submit Transaction
      • Sign and Submit Transaction
      • Sign Generic Transaction
      • Generate Sign and Submit Transaction
      • Create Collection
      • Create Token
      • Add Network
      • Change Network
      • Get Networks
      • Get Transaction
      • Get Transactions
      • Get Account Transactions
      • Get Account Resources
      • Get Account
      • Get Chain Id
      • Get Ledger Info
    • Sui
      • Sign Transaction Block
      • Sign and Execute Transaction
      • Get Public Key
      • Get Old Address
      • Get Accounts
    • Sign Message
    • Get Network
    • Get Current Blockchain
    • Cancel Submitted Transactions
    • Network Change Event
    • Account Change Event
Powered by GitBook
On this page
  1. methods
  2. Sui

Sign and Execute Transaction

PreviousSign Transaction BlockNextGet Public Key

Last updated 2 years ago

Once an application is connected to Martian wallet via the method, the app can request the user to sign and execute the transaction on the Sui Network using window.martian.sui.signAndExecuteTransaction()and it will return a that resolves when the user accepts the request and rejects (throw when awaited) when the user declines the request or the request is not valid/fails. It takes one parameter listed below

  • input: { transactionBlockSerialized: Serialized , options: }

Here is an example code that demonstrates how to call the signAndExecuteTransactionBlock API on the Sui Network using Martian Wallet:

// Create a transaction
const response = await window.martian.sui.connect(['viewAccount', 'suggestTransactions']);
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.signAndExecuteTransactionBlock(input);

By using this function, developers can easily integrate their applications with the Sui Network and leverage the security and decentralization provided by the Sui blockchain.

⚙️
Promise
TransactionBlock
SuiTransactionBlockResponseOptions
connect