Wander Docs
HomeGithub
  • ๐Ÿ‘‹Welcome to Wander
  • โšกWander Connect
    • Intro - Wander Connect
    • Options
    • Properties
    • Methods
    • Event Callbacks
    • Custom UI
    • Advanced Customization
  • ๐Ÿ”ญExamples
    • Playground
    • Applications
  • โ”How To
    • Subsidizing Payments
  • ๐ŸงชAPI
    • Intro - Wander Injected API
    • Events
    • Connect
    • Disconnect
    • Get active address
    • Get active public key
    • Get all addresses
    • Get wallet names
    • Sign Transaction
    • Dispatch Transaction
    • Sign DataItem
    • Batch Sign DataItem
    • Sign message
    • Verify message
    • Private hash
    • User Tokens
    • Token Balance
    • Encrypt
    • Decrypt
    • Crypto signature
    • Subscriptions
    • Retrive permissions
    • Retrive Gateway Config
  • โ›๏ธDeveloper tooling
    • Wander Devtools
    • ArLocal Devtools
  • ๐Ÿ“šExternal libraries
    • Arweave Wallet Kit
    • arweave-js
  • ๐ŸŒWander.app
Powered by GitBook
On this page
  • arweaveWalletLoaded event
  • Example
  • walletSwitch event
  • Example
  • Event emitter

Was this helpful?

Edit on GitHub
  1. API

Events

Wander DOM events

PreviousIntro - Wander Injected APINextConnect

Last updated 1 month ago

Was this helpful?

Wander provides useful custom events to track the state of the extension. These events implement the browser API.

arweaveWalletLoaded event

This event is dispatched once the Wander Injected API has been initialized in the window object. Before this event is fired, you cannot interact with Wander and the window.arweaveWallet object will be undefined.

Example

addEventListener("arweaveWalletLoaded", (e) => {
  const { permissions } = e.detail;

  if (permissions === 0) {
    await window.arweaveWallet.connect(["ACCESS_ADDRESS"]);
  } else {
    // We can already interact with the wallet...
  }
});

walletSwitch event

This event is fired when the user manually switches their active wallet. The even also includes the new active wallet's address, if the user allowed the ACCESS_ADDRESS and the ACCESS_ALL_ADDRESSES permissions.

Example

addEventListener("walletSwitch", (e) => {
  const { address } = e.detail;

  // Handle wallet switch...
});

Event emitter

The event emitter is available under window.arweaveWallet.events as a more advanced event system for the extension.

Note: This documentation is incomplete and the feature is experimental.

๐Ÿงช
CustomEvent