AbstractWallet
The base class for any wallet in the Wallet SDK, including backend wallets. It contains the functionality common to all wallets.
This wallet is not meant to be used directly, but instead be extended to build your own wallet
class AbstractWallet
EventEmitter<WalletEvents>.constructor
Returns the account address of the connected wallet
function getAddress(): Promise<string>;
Returns 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;}>;
Returns the chain id of the network that the wallet is connected to
function getChainId(): Promise<number>;
Returns an ethers Signer object of the connected wallet
function getSigner(): Promise<Signer>;
Sign a message with the connected wallet and return the signature
function signMessage(message: string | Bytes): Promise<string>;
Transfers some amount of tokens to the specified address
function transfer( to: string, amount: string | number, currencyAddress: string,): Promise<Omit<TransactionResultWithMetadata<unknown>, "data">>;
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>;
EventEmitter.addListener
function addListener( event: T, fn: ( ) => void, context?: any,): this;
let fn: () => void;
EventEmitter.emit
Calls each of the listeners registered for a given event.
function emit( event: T,): boolean;
EventEmitter.eventNames
Return an array listing the events for which the emitter has registered listeners.
EventEmitter.listenerCount
Return the number of listeners listening to a given event.
EventEmitter.listeners
Return the listeners registered for a given event.
function listeners( event: T,): Array< ( ) => void>;
let returnType: Array< ( ) => void>;
EventEmitter.off
function off( event: T, fn?: ( ) => void, context?: any, once?: boolean,): this;
let fn: () => void;
EventEmitter.on
Add a listener for a given event.
function on( event: T, fn: ( ) => void, context?: any,): this;
let fn: () => void;
EventEmitter.once
Add a one-time listener for a given event.
function once( event: T, fn: ( ) => void, context?: any,): this;
let fn: () => void;
EventEmitter.removeListener
Remove the listeners of a given event.
function removeListener( event: T, fn?: ( ) => void, context?: any, once?: boolean,): this;
let fn: () => void;