Browser Wallet Auth

Authorize transactions with a browser wallet.

The browser wallet auth type encompasses all browser wallets accessible via window.ethereum, including MetaMask, Rainbow Wallet, etc.

Transfer assets from a FunWallet with a browser wallet owner

The following example showcases how to initialize a FunWallet with a browser wallet as an owner & transfer tokens to an external address, authorizing this transaction with the browser wallet.

const ethers = require("ethers")
const { FunWallet, configureEnvironment } = require("fun-wallet")
const { Eoa } = require("fun-wallet/auth")
const API_KEY = "MYny3w7xJh6PRlRgkJ9604sHouY2MTke6lCPpSHq"
const DEST_ADDR = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045"
async function main() {
await configureEnvironment({
apiKey: API_KEY
// Create an EOA from the currently connected browser wallet
const provider = new ethers.providers.Web3Provider(window.ethereum, "any")
await provider.send('eth_requestAccounts', [])
const eoa = provider.getSigner()
const auth = new Eoa({ signer: eoa })
const uniqueId = auth.getUniqueId()
// Get FunWallet associated with EOA
const funWallet = new FunWallet( { uniqueId } )
const receipt = await funWallet.transfer(auth, {
amount: 10,
token: "USDC"

View the output:

More Features

For more features and possibilities with the Fun Wallet, check out the Fun Wallets API.