UserWallet
Connect and Interact with a user wallet
const balance = await sdk.wallet.balance();
class UserWallet {}
function constructor( options: | undefined | { clientId?: string; gasless?: | { experimentalChainlessSupport?: boolean; openzeppelin: { domainName?: string; domainSeparatorVersion?: string; domainVersion?: string; relayerForwarderAddress?: string; relayerUrl: string; useEOAForwarder?: boolean; }; } | { biconomy: { apiId: string; apiKey: string; deadlineSeconds?: number; }; } | { engine: { domainName?: string; domainSeparatorVersion?: string; domainVersion?: string; relayerForwarderAddress?: string; relayerUrl: string; }; experimentalChainlessSupport?: boolean; }; gasSettings?: { maxPriceInGwei?: number; speed?: "standard" | "fast" | "fastest"; }; gatewayUrls?: Array<string>; readonlySettings?: { chainId?: number; rpcUrl: string }; rpcBatchSettings?: { sizeLimit?: number; timeLimit?: number }; secretKey?: string; supportedChains?: Array<{ chainId: number; nativeCurrency: { decimals: number; name: string; symbol: string; }; rpc: Array<string>; slug: string; }>; },
let options: | undefined | { clientId?: string; gasless?: | { experimentalChainlessSupport?: boolean; openzeppelin: { domainName?: string; domainSeparatorVersion?: string; domainVersion?: string; relayerForwarderAddress?: string; relayerUrl: string; useEOAForwarder?: boolean; }; } | { biconomy: { apiId: string; apiKey: string; deadlineSeconds?: number; }; } | { engine: { domainName?: string; domainSeparatorVersion?: string; domainVersion?: string; relayerForwarderAddress?: string; relayerUrl: string; }; experimentalChainlessSupport?: boolean; }; gasSettings?: { maxPriceInGwei?: number; speed?: "standard" | "fast" | "fastest"; }; gatewayUrls?: Array<string>; readonlySettings?: { chainId?: number; rpcUrl: string }; rpcBatchSettings?: { sizeLimit?: number; timeLimit?: number }; secretKey?: string; supportedChains?: Array<{ chainId: number; nativeCurrency: { decimals: number; name: string; symbol: string; }; rpc: Array<string>; slug: string; }>; };
Fetch the native or ERC20 token balance of this wallet
// native currency balanceconst balance = await sdk.wallet.balance();// ERC20 token balanceconst erc20balance = await sdk.wallet.balance(tokenContractAddress);
function balance( currencyAddress: string,): Promise<{ decimals: number; displayValue: string; name: string; symbol: string; value: BigNumber;}>;
Execute a raw transaction to the blockchain from the connected wallet and wait for it to be mined
function executeRawTransaction( transactionRequest: TransactionRequest,): Promise<Omit<TransactionResultWithMetadata<unknown>, "data">>;
Get the currently connected address
const address = await sdk.wallet.getAddress();
function getAddress(): Promise<string>;
Get the number of transactions sent from this address.
function getNonce(blockTag?: BlockTag): Promise<BigNumberish>;
Recover the signing address from a signed message
const message = "Sign this message...";const signature = await sdk.wallet.sign(message); // Now we can recover the signing addressconst address = sdk.wallet.recoverAddress(message, signature);
function recoverAddress(message: string, signature: string): string;
Request funds from a running local node to the currently connected wallet
function requestFunds( amount: string | number,): Promise<Omit<TransactionResultWithMetadata<unknown>, "data">>;
Send a raw transaction to the blockchain from the connected wallet
function sendRawTransaction( transactionRequest: TransactionRequest,): Promise<TransactionResponse>;
Sign any message with the connected wallet private key
// This is the message to be signedconst message = "Sign this message..."; // Now we can sign the message with the connected walletconst signature = await sdk.wallet.sign(message);
function sign(message: string): Promise<string>;
Sign a typed data structure (EIP712) with the connected wallet private key
// This is the message to be signed// Now we can sign the message with the connected walletconst { payload, signature } = await sdk.wallet.signTypedData( { name: "MyEIP721Domain", version: "1", chainId: 1, verifyingContract: "0x...", }, { MyStruct: [ { name: "to", type: "address" }, { name: "quantity", type: "uint256" }, ], }, { to: "0x...", quantity: 1 },);
function signTypedData( domain: EIP712Domain, types: Record<string, Array<TypedDataField>>, message: Record<string, any>,): Promise<{ payload: any; signature: string }>;
Transfer native or ERC20 tokens from this wallet to another wallet
// transfer 0.8 ETHawait sdk.wallet.transfer("0x...", 0.8);// transfer 0.8 tokens of `tokenContractAddress`await sdk.wallet.transfer("0x...", 0.8, tokenContractAddress);
function transfer( to: string, amount: string | number, currencyAddress: string,): Promise<Omit<TransactionResultWithMetadata<unknown>, "data">>;