Skip to main content

Overview

DeflyWebWallet is a web-based wallet provider that implements the ARC-0027 (AVM Web Provider) standard. It extends the AVMProvider base class to provide integration with Defly’s web wallet. Unlike the mobile-focused DeflyWallet which uses WalletConnect, DeflyWebWallet connects directly through the browser using the AVM Web Provider standard.

Installation

Install the required peer dependencies:
npm install @txnlab/use-wallet @agoralabs-sh/avm-web-provider algosdk

Basic Usage

import { WalletId, WalletManager } from '@txnlab/use-wallet'

const walletManager = new WalletManager({
  wallets: [
    WalletId.DEFLY_WEB
  ]
})

Configuration

DeflyWebWallet does not require any configuration options. It automatically detects and connects to the Defly Web Wallet if available in the browser.
import { WalletId, WalletManager } from '@txnlab/use-wallet'

const walletManager = new WalletManager({
  wallets: [
    {
      id: WalletId.DEFLY_WEB,
      // No options needed
    }
  ]
})

Features

ARC-0027 Compliance

DeflyWebWallet implements the ARC-0027 standard for AVM Web Providers, which provides:
  • Standardized connection flow
  • Transaction signing with user approval
  • Account access management
  • Network detection and validation

Provider Detection

The wallet automatically detects the presence of the Defly Web Provider in the browser:
const DEFLY_WEB_PROVIDER_ID = '95426e60-5f2e-49e9-b912-c488577be962'

Session Management

Sessions are managed through the AVM Web Provider interface and persist across page reloads.

Methods

DeflyWebWallet inherits all methods from AVMProvider and BaseWallet.

connect()

Initiates the connection flow with the Defly Web Wallet.
const accounts = await deflyWebWallet.connect()
Returns: Promise<WalletAccount[]>

disconnect()

Disconnects from the Defly Web Wallet and clears the session.
await deflyWebWallet.disconnect()
Returns: Promise<void>

signTransactions()

Signs transactions using the Defly Web Wallet.
const signedTxns = await deflyWebWallet.signTransactions(txnGroup, indexesToSign)
txnGroup
algosdk.Transaction[] | Uint8Array[]
required
Array of transactions to sign
indexesToSign
number[]
Indexes of transactions to sign (optional, defaults to all)
Returns: Promise<(Uint8Array | null)[]>

Platform Support

DeflyWebWallet requires the Defly Web Wallet browser extension or web application to be installed and accessible.
PlatformSupported
Desktop browsers✅ Yes
Mobile browsers✅ Yes (with web app)
Node.js❌ No

Error Handling

DeflyWebWallet can throw ARC-0027 standard errors:
  • MethodCanceledError - User cancelled the operation
  • MethodNotSupportedError - Method not supported for the network
  • MethodTimedOutError - Operation timed out (>= 3 minutes)
  • NetworkNotSupportedError - Network not supported
  • UnknownError - Unexpected error occurred
try {
  await deflyWebWallet.connect()
} catch (error) {
  if (error.name === 'MethodCanceledError') {
    console.log('User cancelled connection')
  }
}

Class Definition

export class DeflyWebWallet extends AVMProvider {
  constructor(args: WalletConstructor<WalletId.DEFLY_WEB>)
  
  static defaultMetadata: {
    name: 'Defly Web Wallet'
    icon: string // SVG data URI
  }
}

See Also

View the Defly Web wallet implementation: defly-web.ts

Build docs developers (and LLMs) love