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. Aptos

Sign and Submit Transaction

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

  • Signed serialized Aptos RawTransaction serialized string

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

// Create a transaction
const response = await window.martian.connect();
const sender = response.address;
const payload = {
    function: "0x1::coin::transfer",
    type_arguments: ["0x1::aptos_coin::AptosCoin"],
    arguments: ["0x997b38d2127711011462bc42e788a537eae77806404769188f20d3dc46d72750", 50]
};
const transaction = await window.martian.generateTransaction(sender, payload);
const txnHash = await window.martian.signAndSubmitTransaction(transaction);

PreviousSubmit TransactionNextSign Generic Transaction

Last updated 2 years ago

⚙️