This page documents the core types and interfaces used in use-wallet.
Wallet Types
WalletId
enum WalletId {
BIATEC = 'biatec',
DEFLY = 'defly',
DEFLY_WEB = 'defly-web',
CUSTOM = 'custom',
EXODUS = 'exodus',
KIBISIS = 'kibisis',
KMD = 'kmd',
LUTE = 'lute',
MAGIC = 'magic',
MNEMONIC = 'mnemonic',
PERA = 'pera',
WALLETCONNECT = 'walletconnect',
WEB3AUTH = 'web3auth',
W3_WALLET = 'w3-wallet'
}
Enum of supported wallet providers.
WalletKey
type WalletKey = WalletId | `${WalletId.WALLETCONNECT}:${string}`
Composite key type that can be either a standard WalletId or a composite string for skinned WalletConnect instances (e.g., 'walletconnect:biatec').
WalletAccount
interface WalletAccount {
name: string
address: string
}
Represents a wallet account with a name and Algorand address.
Display name for the account
The Algorand address of the account
interface WalletMetadata {
name: string
icon: string
}
Metadata for displaying wallet information in the UI.
Display name for the wallet
Wallet icon as a data URI or URL
SupportedWallet
type SupportedWallet = WalletIdConfig<WalletId> | WalletId
A wallet configuration can be either:
- A simple
WalletId string (e.g., WalletId.PERA)
- A configuration object with id, options, and metadata
Example
// Simple wallet ID
const wallet1: SupportedWallet = WalletId.PERA
// Full configuration
const wallet2: SupportedWallet = {
id: WalletId.WALLETCONNECT,
options: { projectId: 'your-project-id' },
metadata: { name: 'Custom Name', icon: 'data:image/svg...' }
}
WalletIdConfig
type WalletIdConfig<T extends keyof WalletConfigMap> = {
[K in T]: {
id: K
} & WalletConfigMap[K]
}[T]
Configuration object for a wallet, including its ID, options, and metadata.
Wallet-specific options (e.g., WalletConnect projectId)
Custom metadata to override the wallet’s default name and icon
WalletConnectSkin
interface WalletConnectSkin {
id: string
name: string
icon: string
}
Metadata for a WalletConnect skin, used to customize the appearance of WalletConnect-based wallets.
Unique identifier for the skin
Display name for the skinned wallet
Wallet icon as a data URI or URL
State Types
State
interface State {
wallets: WalletStateMap
activeWallet: WalletKey | null
activeNetwork: string
algodClient: algosdk.Algodv2
managerStatus: ManagerStatus
networkConfig: Record<string, NetworkConfig>
customNetworkConfigs: Record<string, Partial<NetworkConfig>>
}
The global state managed by WalletManager.
Map of wallet keys to their connection state
The currently active wallet key, or null if none
The ID of the currently active network
The Algod client instance for the active network
Current status of the wallet manager
networkConfig
Record<string, NetworkConfig>
All network configurations
customNetworkConfigs
Record<string, Partial<NetworkConfig>>
User-customized network configurations
WalletState
interface WalletState {
accounts: WalletAccount[]
activeAccount: WalletAccount | null
}
The connection state for a specific wallet.
Array of connected accounts
The currently active account for this wallet
ManagerStatus
type ManagerStatus = 'initializing' | 'ready'
The initialization status of the WalletManager.
Transaction Types
WalletTransaction
interface WalletTransaction {
txn: string
authAddr?: string
msig?: MultisigMetadata
signers?: string[]
stxn?: string
message?: string
groupMessage?: string
}
Wallet transaction format following ARC-0001.
Base64 encoding of the canonical msgpack encoding of a Transaction
Optional authorized address used to sign the transaction when the account is rekeyed
Multisig metadata used to sign the transaction
Optional list of addresses that must sign the transactions
Optional base64 encoding of a SignedTxn when signers=[]
Optional message explaining the reason for the transaction
Optional message for the transaction group. Only allowed in the first transaction of a group
interface MultisigMetadata {
version: number
threshold: number
addrs: string[]
}
Multisig metadata following ARC-0001.
Authorization requires a subset of signatures equal to or greater than this value
List of Algorand addresses of possible signers. Order is important
SignerTransaction
interface SignerTransaction {
txn: algosdk.Transaction
authAddr?: string
signers?: string[]
message?: string
}
Transaction format with an algosdk.Transaction object (used by Pera Wallet).
txn
algosdk.Transaction
required
The Transaction object to sign
Optional authorized address when account is rekeyed
Optional list of addresses that must sign. Empty array means skip signing
Optional message explaining the transaction
Data Signing Types
interface SignMetadata {
scope: ScopeType
encoding: string
}
Metadata for arbitrary data signing requests.
The scope of the signature request
The encoding format of the data (e.g., ‘base64’)
ScopeType
enum ScopeType {
UNKNOWN = -1,
AUTH = 1
}
Scope types for data signing.
SignDataResponse
interface SignDataResponse extends SignData {
signature: Uint8Array
}
Response from a data signing operation, including the signature.
Siwa
interface Siwa {
domain: string
account_address: string
uri: string
version: string
statement?: string
nonce?: string
'issued-at'?: string
'expiration-time'?: string
'not-before'?: string
'request-id'?: string
chain_id: '283'
resources?: string[]
type: 'ed25519'
}
Sign In With Algorand (SIWA) message format.
Error Types
SignTxnsError
class SignTxnsError extends Error {
code: number
data?: any
constructor(message: string, code: number, data?: any)
}
Error thrown when transaction signing fails.
SignDataError
class SignDataError extends Error {
code: number
data?: any
constructor(message: string, code: number, data?: any)
}
Error thrown when data signing fails.
Utility Types
LogLevel
enum LogLevel {
ERROR = 0,
WARN = 1,
INFO = 2,
DEBUG = 3
}
Logging levels for the WalletManager and wallet implementations.