Basic implementation
To create a custom provider, you’ll need to:
Here’s a minimal example:
Provider interface
TheCustomProvider interface defines the following methods:
Required methods
connect
Theconnect method is the only required method. It should:
- Connect to the wallet provider
- Return an array of
WalletAccountobjects - Accept an optional
argsparameter for custom configuration
Optional methods
disconnect
Thedisconnect method should clean up any resources or state when the wallet is disconnected. This might include:
- Removing event listeners
- Clearing cached data
- Notifying the wallet provider
resumeSession
TheresumeSession method enables automatic reconnection when the application loads. If implemented, it should:
- Check for an existing wallet connection
- Return connected accounts if found
- Return void if no session exists
Signing methods
At least one of the signing methods should be implemented to enable transaction signing.signTransactions
ThesignTransactions method provides direct transaction signing:
transactionSigner
ThetransactionSigner method provides an ATC-compatible signer:
Complete example
Here’s a complete example showing a custom provider with all optional methods implemented:Next steps
Signing transactions
Learn more about implementing transaction signing methods.
Configuration
Read about setting up the provider in your application.
Example projects
Browse complete implementation examples.