User state

When interacting with Fletch Wallet, there are two (2) constants to consider:

Currently:

  • Selected Account

  • Selected Network

Selected Account:

To get the currently selected account, call window.fletch.account().

See the code below to get the currently selected account:

let account = await window.fletch.account()
console.log(account) // { address: "0x123456789abcdef...", publicKey: "0x123456789abcdef..." }

Selected Network:

To get the currently selected network, call window.fletch.network().

See the code below to get the currently selected network:

let network = await window.fletch.network()
console.log(network) // "devnet" || "testnet" || "mainnet"

Last updated