import { type Account, type Address, type Chain, type ClientConfig, type Hex, type LocalAccount, type OneOf, type Prettify, type PublicClient, type RpcSchema, type Transport, type WalletClient } from "viem"; import { type SmartAccount, type SmartAccountImplementation, type UserOperation } from "viem/account-abstraction"; import type { SignAuthorizationReturnType } from "viem/accounts"; import type { MeeAuthorization } from "../clients/decorators/mee/getQuote"; import { EntrypointAbi } from "../constants/abi"; import type { ComposableCall } from "../modules/utils/composabilityCalls"; import type { Validator } from "../modules/validators/toValidator"; import type { Call } from "./utils/Types"; import { type EthersWallet } from "./utils/Utils"; import { type MEEVersionConfig, type NexusAccountId } from "./utils/getVersion"; import { type EthereumProvider, type Signer } from "./utils/toSigner"; export type GetInitDataParams = { accountIndex: bigint; defaultValidator: GenericModuleConfig; prevalidationHooks: PrevalidationHookModuleConfig[]; validators: GenericModuleConfig[]; executors: GenericModuleConfig[]; hook: GenericModuleConfig; fallbacks: GenericModuleConfig[]; customInitData?: Hex; }; /** * Base module configuration type */ export type MinimalModuleConfig = { module: Address; data: Hex; }; /** * Generic module configuration type that can be extended with additional properties */ export type GenericModuleConfig = T; export type PrevalidationHookModuleConfig = GenericModuleConfig & { hookType: bigint; }; /** * Parameters for chain configuration */ export type ChainConfiguration = { /** The blockchain network */ chain: Chain; /** The transport configuration */ transport: ClientConfig["transport"]; /** MEE version config */ version: MEEVersionConfig; }; /** * Parameters for creating a Nexus Smart Account */ export type ToNexusSmartAccountParameters = { /** The signer account or address */ signer: OneOf | LocalAccount | EthersWallet>; /** Chain configuration */ chainConfiguration: ChainConfiguration; /** Optional index for the account */ index?: bigint | undefined; /** Optional account address override */ accountAddress?: Address; /** Optional validator modules configuration */ validators?: Array; /** Optional executor modules configuration */ executors?: Array; /** Optional prevalidation hook modules configuration */ prevalidationHooks?: Array; /** Optional hook module configuration */ hook?: GenericModuleConfig; /** Optional fallback modules configuration */ fallbacks?: Array; /** Optional init data */ initData?: Hex; } & Prettify, "account" | "cacheTime" | "key" | "name" | "pollingInterval" | "rpcSchema">>; /** * Nexus Smart Account type */ export type NexusAccount = Prettify>; /** * NonceInfo type */ export type NonceInfo = { nonceKey: bigint; nonce: bigint; }; /** * Delegation type * @param authorization - Custom authorization to use. Optional * @param delegatedContract - The contract address to delegate the authorization to. Defaults to the implementation address. * @param multiChain - Whether to use the multi-chain authorization. Defaults to false. */ export type DelegationParams = { delegatedContract?: Address; } & OneOf<{ authorization: SignAuthorizationReturnType; } | { multiChain: boolean; } | { chainId: number; }>; /** * UnDelegation type * @param authorization - Custom authorization to use. Optional */ export type UnDelegationParams = { authorization?: SignAuthorizationReturnType; }; /** * Nexus Smart Account Implementation */ export type NexusSmartAccountImplementation = SmartAccountImplementation Promise
; /** Gets the init code for the account */ getInitCode: () => Hex; /** Gets the nonce with key for the account */ getNonceWithKey: (accountAddress: Address, parameters?: { key?: bigint; validationMode?: "0x00" | "0x01" | "0x02"; moduleAddress?: Address; }) => Promise; /** Encodes a single call for execution */ encodeExecute: (call: Call) => Promise; /** Encodes a batch of calls for execution */ encodeExecuteBatch: (calls: readonly Call[]) => Promise; /** Encodes a composable call for execution */ encodeExecuteComposable: (calls: ComposableCall[]) => Promise; /** Calculates the hash of a user operation */ getUserOpHash: (userOp: UserOperation) => Hex; /** Factory data used for account creation */ factoryData: Hex; /** Factory address used for account creation */ factoryAddress: Address; /** The signer instance */ signer: Signer; /** The public client instance */ publicClient: PublicClient; /** The wallet client instance */ walletClient: WalletClient; /** The blockchain network */ chain: Chain; /** Get the active module */ getModule: () => Validator; /** Set the active module */ setModule: (validationModule: Validator) => void; /** Get authorization data for the EOA to Nexus Account * @param params - {@link DelegationParams} * @returns MeeAuthorization */ toDelegation: (params?: DelegationParams) => Promise; /** Execute the transaction to unauthorize the account * @param params - {@link UnDelegationParams} */ unDelegate: (params?: UnDelegationParams) => Promise; /** Check if the account is delegated to the implementation address */ isDelegated: () => Promise; /** Account ID */ accountId: NexusAccountId; /** Nexus version config */ version: MEEVersionConfig; }>; /** * @description Create a Nexus Smart Account. * * @param parameters - {@link ToNexusSmartAccountParameters} * @returns Nexus Smart Account. {@link NexusAccount} * * @example * import { toNexusAccount } from '@biconomy/abstractjs' * import { createWalletClient, http } from 'viem' * import { mainnet } from 'viem/chains' * * const account = await toNexusAccount({ * signer: '0x...', * chainConfiguration: { * chain: mainnet, * transport: http(), * version: getMEEVersion(DEFAULT_MEE_VERSION), * } * }) */ export declare const toNexusAccount: (parameters: ToNexusSmartAccountParameters) => Promise; //# sourceMappingURL=toNexusAccount.d.ts.map