@arbius/aa-wallet
Version:
A secure and flexible Account Abstraction wallet implementation for Arbitrum One chain applications.
70 lines (69 loc) • 3.86 kB
TypeScript
/**
* Initializes or retrieves a cached deterministic wallet.
* This wallet is derived from the owner's signature, is unique to the ownerAddress,
* and is connected to the provided provider.
*
* @param appEthers The ethers.js library object provided by the consuming application.
* Pass the full ethers object (e.g., initDeterministicWallet(ethers, ...))
* @param ownerAddress The address of the EOA wallet that owns the deterministic wallet.
* @param signMessage A function that takes a message string and returns a Promise resolving to the signature.
* @param provider A provider instance.
* @returns A Promise that resolves to a Wallet instance of the deterministic wallet.
*/
export declare function initDeterministicWallet(appEthers: any, ownerAddress: string, signMessage: (message: string) => Promise<string>, provider: any): Promise<any>;
/**
* Retrieves the address of the deterministic wallet for deposit purposes.
* It ensures the wallet is initialized (created and cached if it's the first time).
*
* @param appEthers The ethers.js library object provided by the consuming application.
* @param ownerAddress The address of the EOA wallet.
* @param signMessage A function that takes a message string and returns a Promise resolving to the signature.
* @param provider A provider instance.
* @returns A Promise that resolves to the address (string) of the deterministic wallet.
*/
export declare function getDeterministicWalletAddressForDeposit(appEthers: any, ownerAddress: string, signMessage: (message: string) => Promise<string>, provider: any): Promise<string>;
/**
* Withdraws funds (ETH or AIUS token) from the deterministic wallet to a recipient address.
*
* @param appEthers The ethers.js library object provided by the consuming application.
* @param deterministicWallet The initialized ethers.Wallet instance of the deterministic wallet (should be from appEthers.Wallet).
* @param recipientAddress The address to withdraw funds to (typically the owner's EOA).
* @param options An object containing withdrawal options:
* - amount?: The amount to withdraw (string). If not provided for ETH, attempts to withdraw max.
* For AIUS, if not provided, withdraws the entire token balance.
* - token: Specifies whether to withdraw 'ETH' or 'AIUS'.
* @returns A Promise that resolves to the transaction hash (string) if successful, or null otherwise.
* @throws Will throw an error if the withdrawal process fails.
*/
export declare function withdrawFromDeterministicWallet(appEthers: any, deterministicWallet: any, recipientAddress: string, options: {
amount?: string;
token: 'ETH' | 'AIUS';
}): Promise<string | null>;
/**
* Sends a transaction from the deterministic wallet to a contract
* @param appEthers The ethers instance from the application
* @param wallet The deterministic wallet instance
* @param to The contract address to call
* @param data The encoded function data
* @param value Optional ETH value to send with the transaction
* @returns Transaction hash or null if failed
*/
export declare function sendContractTransaction(appEthers: any, wallet: any, to: string, data: string, value?: string): Promise<{
hash: string | null;
error?: {
message: string;
code?: string;
data?: any;
transaction?: any;
};
}>;
/**
* Gets the ETH and AIUS token balances of the deterministic wallet
* @param appEthers The ethers instance from the application
* @param wallet The deterministic wallet instance
* @returns Object containing ETH and AIUS balances in string format
*/
export declare function getDeterministicWalletBalances(appEthers: any, wallet: any): Promise<{
eth: string;
aius: string;
}>;