@m3s/wallet
Version:
A flexible wallet interface supporting multiple blockchain wallet types, including EVM wallets and Web3Auth integration
87 lines • 3.58 kB
TypeScript
import { CustomChainConfig, IBaseProvider } from "@web3auth/base";
import { ethers, Provider, TransactionReceipt } from "ethers";
import { AdapterArguments, NetworkConfig } from "@m3s/shared";
import { LoginConfig } from "@web3auth/auth-adapter";
import { IEVMWallet, WalletEvent, GenericTransactionData, AssetBalance, EIP712TypedData, EstimatedFeeData } from '../../types/index.js';
/**
* Configuration specific to the Web3AuthWalletAdapter.
*/
export interface IWeb3AuthWalletOptionsV1 {
web3authConfig: {
clientId: string;
web3AuthNetwork: string;
chainConfig: CustomChainConfig;
loginConfig: LoginConfig;
privateKeyProvider?: IBaseProvider<any>;
};
multiChainRpcs?: Record<string, string[]>;
}
interface args extends AdapterArguments<IWeb3AuthWalletOptionsV1> {
}
/**
* An adapter for EVM-based wallets using Web3Auth for social logins.
* It implements the IEVMWallet interface directly.
*/
export declare class Web3AuthWalletAdapter implements IEVMWallet {
readonly name: string;
readonly version: string;
private web3auth;
private config;
protected initialized: boolean;
protected decimals: number;
protected eventListeners: Map<string, Set<(payload: any) => void>>;
private multiChainRpcs;
private network;
private constructor();
/**
* Factory method to create and initialize an instance of Web3AuthWalletAdapter.
*/
static create(args: args): Promise<Web3AuthWalletAdapter>;
initialize(): Promise<void>;
disconnect(): Promise<void>;
isConnected(): boolean;
isInitialized(): boolean;
/**
* Get ALL configured RPC URLs for ALL chains
*/
getAllChainRpcs(): Record<string, string[]>;
/**
* Update ALL RPC configurations at once
*/
updateAllChainRpcs(multiChainRpcs: Record<string, string[]>): Promise<void>;
setProvider(config: NetworkConfig): Promise<void>;
on(event: WalletEvent | string, callback: (...args: any[]) => void): void;
off(event: WalletEvent | string, callback: (...args: any[]) => void): void;
protected emitEvent(eventName: WalletEvent | string, payload: any): void;
getAccounts(): Promise<string[]>;
getNetwork(): Promise<NetworkConfig>;
getBalance(account?: string): Promise<AssetBalance>;
signMessage(message: string | Uint8Array): Promise<string>;
signTransaction(tx: GenericTransactionData): Promise<string>;
signTypedData(data: EIP712TypedData): Promise<string>;
verifySignature(message: string | Uint8Array | EIP712TypedData, signature: string, address: string): Promise<boolean>;
getNonce(type?: 'latest' | 'pending'): Promise<number>;
sendTransaction(tx: GenericTransactionData): Promise<string>;
getTransactionReceipt(txHash: string): Promise<TransactionReceipt | null>;
callContract(options: {
contractAddress: string;
abi: any;
method: string;
args?: any[];
}): Promise<any>;
writeContract(options: {
contractAddress: string;
abi: any;
method: string;
args?: any[];
value?: string | bigint;
overrides?: Partial<GenericTransactionData['options']>;
}): Promise<string>;
estimateGas(tx: GenericTransactionData): Promise<EstimatedFeeData>;
getGasPrice(): Promise<bigint>;
protected getProvider(): Promise<Provider>;
protected getSigner(): Promise<ethers.Signer>;
prepareTransactionRequest(tx: GenericTransactionData): Promise<ethers.TransactionRequest>;
}
export {};
//# sourceMappingURL=web3authWallet.d.ts.map