/** * ERC-4337 Account Abstraction — Sequence0Account * * A smart account backed by FROST threshold signing. Enables gas-sponsored * transactions, batch calls, and programmable transaction validation -- * all secured by the decentralized Sequence0 signing network. * * The account uses a Schnorr signature verifier on-chain: the FROST group * public key is the account's "owner", and every UserOperation is signed * by t-of-n agents producing a BIP-340 Schnorr signature. * * @example * ```typescript * import { Sequence0Account } from '@sequence0/sdk'; * * // Create a new AA wallet backed by FROST * const account = await Sequence0Account.create({ * threshold: 16, * committeeSize: 24, * chain: 'ethereum', * ownerPrivateKey: '0x...', * }); * * // Get the counterfactual address (before deployment) * console.log('Address:', account.getAddress()); * * // Send a transaction via UserOperation * const txHash = await account.sendTransaction({ * to: '0xRecipient...', * value: BigInt('1000000000000000000'), // 1 ETH * }); * * // Batch multiple calls * const txHash2 = await account.sendBatchTransaction([ * { to: '0xTokenA', data: '0xa9059cbb...' }, * { to: '0xTokenB', data: '0xa9059cbb...' }, * ]); * ``` */ import type { PackedUserOperation, AccountTransaction, Sequence0AccountOptions, UserOperationGasEstimate, UserOperationReceipt } from './types'; export declare class Sequence0Account { /** The counterfactual smart account address */ private accountAddress; /** The FROST group public key (33 bytes compressed, hex) */ private groupPublicKey; /** The Sequence0 wallet ID backing this account */ private walletId; /** The Sequence0 SDK client instance */ private s0; /** Target EVM chain name */ private chain; /** Target chain ID */ private chainId; /** EntryPoint contract address */ private entryPoint; /** Factory contract address */ private factory; /** RPC provider for the target chain */ private provider; /** Bundler RPC URL */ private bundlerUrl; /** Whether the account has been deployed on-chain */ private deployed; private constructor(); /** * Create a new ERC-4337 smart account backed by FROST threshold signing. * * This performs a DKG ceremony to create a new FROST wallet, then * derives the counterfactual smart account address using CREATE2. * The account is not deployed on-chain until the first UserOperation * is sent (initCode handles deployment). * * @param options - Account creation options * @returns A new Sequence0Account instance * * @example * ```typescript * const account = await Sequence0Account.create({ * threshold: 16, * committeeSize: 24, * chain: 'ethereum', * ownerPrivateKey: '0x...', * }); * ``` */ static create(options: Sequence0AccountOptions): Promise; /** * Reconnect to an existing Sequence0 AA wallet by its wallet ID and group public key. * * Use this when you have previously created an account and want to * reconnect without running DKG again. * * @param walletId - The Sequence0 wallet ID * @param groupPublicKey - The FROST group public key (hex) * @param options - Account options (chain, network, etc.) * @returns A Sequence0Account instance */ static fromExisting(walletId: string, groupPublicKey: string, options: Omit): Promise; /** * Get the smart account address (counterfactual or deployed). * * This address is deterministic: it is derived from the FROST group * public key and the factory address via CREATE2. It is known before * the account is deployed on-chain. */ getAddress(): string; /** Get the FROST wallet ID */ getWalletId(): string; /** Get the FROST group public key */ getGroupPublicKey(): string; /** Get the target chain name */ getChain(): string; /** Get the target chain ID */ getChainId(): number; /** Check if the account has been deployed on-chain */ isDeployed(): boolean; /** * Build, sign, and submit a single transaction as a UserOperation. * * If the account is not yet deployed, the initCode is automatically * included to deploy it in the same transaction. * * @param tx - Transaction to execute * @returns Transaction hash from the bundler * * @example * ```typescript * const txHash = await account.sendTransaction({ * to: '0xRecipient', * value: BigInt('1000000000000000000'), // 1 ETH * }); * ``` */ sendTransaction(tx: AccountTransaction): Promise; /** * Build, sign, and submit multiple calls as a single batched UserOperation. * * All calls are executed atomically in a single transaction. * If any call reverts, the entire batch reverts. * * @param txs - Array of transactions to batch * @returns Transaction hash from the bundler * * @example * ```typescript * const txHash = await account.sendBatchTransaction([ * { to: '0xTokenA', data: '0xa9059cbb...' }, // ERC-20 transfer * { to: '0xTokenB', data: '0xa9059cbb...' }, // Another transfer * ]); * ``` */ sendBatchTransaction(txs: AccountTransaction[]): Promise; /** * Sign an arbitrary message using the FROST threshold signing network. * * The message is hashed with EIP-191 prefix before signing. * The resulting signature is a 64-byte Schnorr signature. * * @param message - Message to sign (string or bytes) * @returns Hex-encoded Schnorr signature * * @example * ```typescript * const sig = await account.signMessage('Hello from Sequence0 AA!'); * ``` */ signMessage(message: string | Uint8Array): Promise; /** * Build a UserOperation without signing or submitting. * * Useful for gas estimation or inspection before submission. * * @param callData - Encoded call data for the account * @returns A PackedUserOperation (without signature) */ buildUserOp(callData: string): Promise; /** * Submit a pre-built and signed UserOperation to a bundler. * * @param userOp - The signed UserOperation * @param bundlerUrl - Optional bundler URL override * @returns UserOperation hash from the bundler */ submitUserOp(userOp: PackedUserOperation, bundlerUrl?: string): Promise; /** * Estimate gas for a UserOperation via the bundler. * * @param userOp - The UserOperation to estimate * @param bundlerUrl - Optional bundler URL override * @returns Gas estimates */ estimateUserOpGas(userOp: PackedUserOperation, bundlerUrl?: string): Promise; /** * Get the receipt for a submitted UserOperation. * * @param userOpHash - The UserOperation hash from submitUserOp * @param bundlerUrl - Optional bundler URL override * @returns Receipt if the UserOp has been included, null otherwise */ getUserOpReceipt(userOpHash: string, bundlerUrl?: string): Promise; /** * Wait for a UserOperation to be included on-chain. * * Polls the bundler for the receipt until it appears or timeout. * * @param userOpHash - The UserOperation hash * @param timeoutMs - Timeout in milliseconds (default: 60000) * @param pollIntervalMs - Poll interval (default: 2000) * @returns The UserOperation receipt */ waitForUserOp(userOpHash: string, timeoutMs?: number, pollIntervalMs?: number): Promise; /** * Get the native token balance of the smart account. * * @returns Balance in wei as a string */ getBalance(): Promise; /** * Get account information summary. */ info(): Record; /** * Clean up resources. */ destroy(): void; /** * Build, sign, and submit a UserOperation. */ private buildSignAndSubmit; /** * Get the current nonce from the EntryPoint contract. */ private getNonce; /** * Compute the initCode for first-time account deployment. * * initCode = factoryAddress (20 bytes) + createAccount(groupPublicKey) calldata */ private computeInitCode; } //# sourceMappingURL=account.d.ts.map