Basic usage
Configuration
A custom provider object implementing the wallet interface. See Provider interface for details.
Provider interface
Your custom provider must implement the following interface:Required methods
Initiates connection to your wallet. Must return an array of wallet accounts.Parameters:
args: Optional connection arguments passed from the caller
WalletAccount objects with name and addressExample:Optional methods
Disconnects from your wallet. If not provided, the wallet can only be disconnected by removing it from state.
Resumes a previous wallet session. Called when the app initializes with cached wallet state.Returns:
WalletAccount[]: Array of accounts if session is validvoid: If session is valid but accounts unchanged- Throw error if session is invalid
Signs transactions according to ARC-0001 standard.Parameters:
txnGroup: Transaction(s) to sign (Transaction[] or Uint8Array[])indexesToSign: Optional indexes of transactions to sign
transactionSigner
(txnGroup: algosdk.Transaction[], indexesToSign: number[]) => Promise<Uint8Array[]>
Alternative transaction signing method used by algosdk’s
AtomicTransactionComposer.Parameters:txnGroup: Array of Transaction objectsindexesToSign: Indexes to sign (not optional)
makeAssetTransferTxnWithSuggestedParamsFromObject().signTxn() and similar SDK methods.Signs arbitrary data for authentication or verification.Parameters:
data: Base64-encoded data to signmetadata: Signing metadata (scope, encoding)
Features
Flexible integration
The Custom provider adapts any wallet implementation to work with use-wallet’s standardized interface.Custom metadata
Provide custom name and icon for your wallet:Method validation
The Custom wallet validates that required methods are implemented and throws errors for missing optional methods if called.Methods
connect()
Calls your provider’sconnect() method with optional arguments.
Parameters:
args?: Optional arguments to pass to your provider
Promise<WalletAccount[]>
Example:
disconnect()
Calls your provider’sdisconnect() method if implemented.
Returns: Promise<void>
signTransactions()
Calls your provider’ssignTransactions() method if implemented.
Parameters:
txnGroup: Transaction or array of transactions to signindexesToSign?: Optional array of indexes to sign
Promise<(Uint8Array | null)[]>
Throws: Error: 'Method not supported: signTransactions' if not implemented
transactionSigner()
Calls your provider’stransactionSigner() method if implemented.
Parameters:
txnGroup: Array of Transaction objectsindexesToSign: Array of indexes to sign
Promise<Uint8Array[]>
Throws: Error: 'Method not supported: transactionSigner' if not implemented
signData()
Calls your provider’ssignData() method if implemented.
Parameters:
data: Base64-encoded data to signmetadata: Signing metadata
Promise<SignDataResponse>
Throws: Error: 'Method not supported: signData' if not implemented
Session management
Session management behavior depends on your provider’sresumeSession() implementation:
- If
resumeSessionis implemented, it’s called when the app initializes - If not implemented, the wallet relies on cached state from localStorage
- If
resumeSessionthrows an error, the wallet is disconnected