Skip to main content

Abstract Client Wallet

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.

Usage

export class MyFrontendWallet extends AbstractClientWallet {
async getConnector(): Promise<Connector> {
// your implementation
}
}

Public Methods

The wallet inherits all the public methods from the AbstractWallet class. In addition to the following ones:

connect

Prompt the user to connect their wallet to your app.

const address = await wallet.connect();
Configuration

Return Value

Returns a string containing the wallet address, or throws an error if the connection failed.

string;

disconnect

Disconnect the currently connected wallet from your app.

await wallet.disconnect();

autoConnect

Attempts to connect to the wallet without asking the user explicitly. Only possible if the user has already connected to the wallet to your app before.

const address = await wallet.autoConnect();
Configuration

Return Value

Returns a string containing the wallet address, or undefined if the connection failed.

string | undefined;

getMeta

Get metadata about the wallet, such as the name and iconURL.

const metadata = wallet.getMeta();
Configuration

Return Value

{
name: string;
iconURL: string;
}

switchChain

Switch the currently connected wallet to a different chain.

await wallet.switchChain(1);
Configuration

chainId

The chain ID to switch to.

Must be a number.

getPersonalWallet

Get the connected personal wallet. Useful for wallets that have an underlying personal wallet, such as SmartWallet or Safe.

const connectedPersonalWallet = wallet.getPersonalWallet();
Configuration

Return Value

Returns an EVMWallet or `undefined if there is no connected wallet.

EVMWallet | undefined;