Build a Wallet interface
Building a Wallet interface is done in two steps:
- Create a
- Create a
Walletclass and use the
Connectorclass in it
1. Create Connector class
Extend the abstract
Connector interface and implement the all the required methods.
You can throw an exception or leave the implementation empty if you don't want to implement these methods.
2. Create Wallet class
Now that the hard part is done, the rest is easy, we just need to wrap our connector in a
AbstractClientWallet class is the base
class that provides an interface for interacting with your connector on one side and with applications on the other.
The main method that needs to be overridden is the
getConnector method. This method should return a
that resolves to the
class that you implemented.
You can expose any custom logic here as the public API for your wallet.
Using your new wallet
At this point, you should be able to instantiate your new wallet and call
connect on it.
You can look at how the built-in wallets in
@thirdweb-dev/wallets package are created for reference