TypeScript SDK

isBaseAccountSDKWallet

Type guard to check if a wallet is a Base Account SDK wallet.

This function narrows the wallet type to Wallet<"org.base.account">, allowing TypeScript to infer the correct wallet type in conditional blocks.

Example

import { createWallet } from "thirdweb/wallets";
import { isBaseAccountSDKWallet } from "thirdweb/wallets";
const wallet = createWallet("org.base.account");
if (isBaseAccountSDKWallet(wallet)) {
// wallet is typed as Wallet<"org.base.account">
console.log("This is a Base Account wallet");
}
function isBaseAccountSDKWallet(
wallet: Wallet,
): wallet is Wallet<"org.base.account">;

Parameters

The wallet instance to check.

Type

let wallet: {
getAdminAccount?: () => Account | undefined;
getAuthToken?: () => string | null;
getConfig: () => CreateWalletArgs<TWalletId>[1];
id: TWalletId;
onConnectRequested?: () => Promise<void>;
subscribe: WalletEmitter<TWalletId>["subscribe"];
autoConnect: (
options: WalletAutoConnectionOption<TWalletId>,
) => Promise<Account>;
connect: (
options: WalletConnectionOption<TWalletId>,
) => Promise<Account>;
disconnect: () => Promise<void>;
getAccount: () => undefined | Account;
getChain: () =>
| undefined
| Readonly<ChainOptions & { rpc: string }>;
switchChain: (chain: Readonly) => Promise<void>;
};

Returns

let returnType: wallet is (Wallet<"org.base.account">)

true if the wallet is a Base Account SDK wallet, false otherwise.