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

Account Change Event

This method can be used to detect for account change. It takes one parameter listed below.

  • cb: callback function which will be called when account change occurs.

Below is an example code describing the way to check for account change.

window.martian.onAccountChange((address) => console.log("Changed address", address));
// above code output
Changed address: 0x34c1e7efa0808b7b0113d71b722f483585e4c4b47ba2b0e703b090937f0c63a1
window.martian..sui.onAccountChange((address) => console.log("Changed address", address));
// above code output
Changed address: 0x34c1e7efa0808b7b0113d71b722f483585e4c4b47ba2b0e703b090937f0c63a
PreviousNetwork Change Event

Last updated 2 years ago

⚙️