AbstractClientWallet
The base class for all client-side wallets (web, mobile) in the Wallet SDK. It extends AbstractWallet and adds client side specific logic. A client side wallet delegates the wallet-specific connection logic to a Connector.
This wallet is not meant to be used directly, but instead be extended to build your own wallet
class AbstractClientWallet< TAdditionalOpts extends Record<string, any> = {}, TConnectParams extends Record<string, any> = {},
Creates an returns instance of AbstractClientWallet
function constructor( walletId: string,
auto-connect the wallet if possible
function autoConnect(): Promise<string>;
Connect wallet
function connect(): Promise<string>;
Disconnect the wallet
function disconnect(): Promise<void>;
If the wallet uses another "personal wallet" under the hood, return it
This is only useful for wallets like Safe or Smart Wallet uses a "personal wallet" under the hood to sign transactions. This method returns that wallet
Get ethers Signer object of the connected wallet
function getSigner(): Promise<Signer>;
Switch to different Network/Blockchain in the connected wallet
function switchChain(chainId: number): Promise<void>;
Update the chains supported by the wallet. This is useful if wallet was initialized with some chains and this needs to be updated without re-initializing the wallet
function updateChains(chains: Array<Chain>): Promise<void>;
AbstractWallet.addListenerfunction addListener( event: T, fn: ( ) => void, context?: any,): this;
let fn: () => void;
AbstractWallet.emitCalls each of the listeners registered for a given event.
function emit( event: T,): boolean;
AbstractWallet.eventNamesReturn an array listing the events for which the emitter has registered listeners.
AbstractWallet.getAddressReturns the account address of the connected wallet
function getAddress(): Promise<string>;
AbstractWallet.getBalanceReturns the balance of the connected wallet for the specified token address. If no token address is specified, it returns the balance of the native token
function getBalance( tokenAddress: string,): Promise<{ decimals: number; displayValue: string; name: string; symbol: string; value: BigNumber;}>;
AbstractWallet.getChainIdReturns the chain id of the network that the wallet is connected to
function getChainId(): Promise<number>;
AbstractWallet.listenerCountReturn the number of listeners listening to a given event.
AbstractWallet.listenersReturn the listeners registered for a given event.
function listeners( event: T,): Array< ( ) => void>;
let returnType: Array< ( ) => void>;
AbstractWallet.offfunction off( event: T, fn?: ( ) => void, context?: any, once?: boolean,): this;
let fn: () => void;
AbstractWallet.onAdd a listener for a given event.
function on( event: T, fn: ( ) => void, context?: any,): this;
let fn: () => void;
AbstractWallet.onceAdd a one-time listener for a given event.
function once( event: T, fn: ( ) => void, context?: any,): this;
let fn: () => void;
AbstractWallet.removeListenerRemove the listeners of a given event.
function removeListener( event: T, fn?: ( ) => void, context?: any, once?: boolean,): this;
let fn: () => void;
AbstractWallet.signMessageSign a message with the connected wallet and return the signature
function signMessage(message: string | Bytes): Promise<string>;
AbstractWallet.transferTransfers some amount of tokens to the specified address
function transfer( to: string, amount: string | number, currencyAddress: string,): Promise<Omit<TransactionResultWithMetadata<unknown>, "data">>;
AbstractWallet.verifySignature Verify the signature of a message. It returns true if the signature is valid, false otherwise
function verifySignature( message: string, signature: string, address: string, _chainId?: number,): Promise<boolean>;
let walletId: string;
let prefixed: string | boolean;