aa-sdk/core
Enumerations
| Enumeration | Description |
|---|---|
| DeploymentState | - |
| LogLevel | - |
| RoundingMode | - |
Classes
| Class | Description |
|---|---|
| AccountNotFoundError | This error is thrown when an account could not be found to execute a specific action. It extends the BaseError class. |
| AccountRequiresOwnerError | Represents an error that occurs when an account requires an owner to execute but none is provided. |
| BaseError | A custom error class that extends from ViemBaseError. This class allows for error messages to include links to relevant documentation based on provided docsPath and docsSlug parameters. This is based on on viem’s BaseError type (obviously from the import and extend) we want the errors here to point to our docs if we supply a docsPath though |
| BatchExecutionNotSupportedError | Represents an error indicating that batch execution is not supported for a specific account type. |
| ChainNotFoundError | Error class representing a “Chain Not Found” error, typically thrown when no chain is supplied to the client. |
| DefaultFactoryNotDefinedError | Represents an error that is thrown when no default factory is defined for a specific account type on a given chain and entry point version. This error suggests providing an override via the factoryAddress parameter when creating an account. |
| EntityIdOverrideError | Error class denoting that the provided entity id is invalid because it’s overriding the native entity id. |
| EntryPointNotFoundError | Represents an error thrown when an entry point is not found for a specific chain and entry point version. This error indicates that a default entry point does not exist for the given chain and version, and suggests providing an override. |
| FailedToFindTransactionError | Represents an error that occurs when a transaction cannot be found for a given user operation. This error extends from BaseError. The hash of the transaction is provided to indicate which transaction could not be found. |
| FailedToGetStorageSlotError | Custom error class FailedToGetStorageSlotError which is used to signal a failure when attempting to retrieve a storage slot. This error includes the slot and slot descriptor in its message and inherits from BaseError. |
| GetCounterFactualAddressError | Custom error class for handling errors when getting a counterfactual address. This extends the BaseError class and provides a custom error message and name. |
| IncompatibleClientError | Represents an error thrown when a client is not compatible with the expected client type for a specific method. The error message provides guidance on how to create a compatible client. |
| IncorrectAccountType | Represents an error thrown when an account type does not match the expected type. |
| InvalidDeferredActionNonce | Error class denoting that the deferred action nonce used is invalid. |
| InvalidEntityIdError | Error class denoting that the provided entity id is invalid because it’s too large. |
| InvalidEntryPointError | Represents an error thrown when an invalid entry point version is encountered for a specific chain. This error extends the BaseError class. |
| InvalidModularAccountV2Mode | Error class denoting that the provided ma v2 account mode is invalid. |
| InvalidNonceKeyError | Error class denoting that the nonce key is invalid because its too large. |
| InvalidRpcUrlError | Represents an error that occurs when an invalid RPC URL is provided. This class extends the BaseError class and includes the invalid URL in the error message. |
| InvalidSignerTypeError | Represents an error thrown when an invalid signer type is provided to the SmartAccountSigner. |
| InvalidUserOperationError | Thrown when a UserOperationStruct is not a valid request |
| LocalAccountSigner | Represents a local account signer and provides methods to sign messages and transactions, as well as static methods to create the signer from mnemonic or private key. |
| Logger | Logger class provides static methods for logging at different levels such as error, warn, debug, info, and verbose. This class allows setting log levels and log filters to control the logging behavior. |
| NotAModularAccountV2Error | This error is thrown when an account is not a Modular Account V2 |
| SignTransactionNotSupportedError | Error thrown when attempting to sign a transaction that is not supported by smart contracts. |
| SmartAccountWithSignerRequiredError | Error class indicating that a smart account operation requires a signer. |
| TraceHeader | Some tools that are useful when dealing with the values of the trace header. Follows the W3C trace context standard. |
| TransactionMissingToParamError | Error thrown when a transaction is missing the to address parameter. This class extends the BaseError class. |
| UpgradesNotSupportedError | An error class representing the condition where upgrades are not supported for a specific account type. This error extends the BaseError class and provides a custom error message based on the account type. |
| UpgradeToAndCallNotSupportedError | Represents an error that occurs when an attempt is made to call UpgradeToAndCall on an account type that does not support it. Includes the account type in the error message. |
| WaitForUserOperationError | Error thrown when waiting for user operation request to be mined. |
| WalletClientSigner | Represents a wallet client signer for smart accounts, providing methods to get the address, sign messages, sign typed data, and sign 7702 authorizations. |
Interfaces
| Interface | Description |
|---|---|
| AccountEntryPointRegistry | - |
| EntryPointDefRegistry | - |
| EntryPointRegistry | - |
| EntryPointRegistryBase | - |
| SmartAccountAuthenticator | Extends the SmartAccountSigner interface with authentication. |
| SmartAccountSigner | A signer that can sign messages and typed data. |
| SplitTransportParams | - |
| UserOperationEstimateGasResponse | - |
| UserOperationReceipt | - |
| UserOperationRequest_v6 | - |
| UserOperationRequest_v7 | - |
| UserOperationResponse | - |
| UserOperationStruct_v6 | - |
| UserOperationStruct_v7 | - |
Type Aliases
Variables
| Variable | Description |
|---|---|
| ADD_BREADCRUMB | The symbol that is used to add a breadcrumb to the headers. Is an optional function that is used to add a breadcrumb to the headers. |
| BigNumberishRangeSchema | - |
| BigNumberishSchema | - |
| bundlerActions | A viem client decorator that provides Bundler specific actions. These actions include estimating gas for user operations, sending raw user operations, retrieving user operations by hash, getting supported entry points, and getting user operation receipts. |
| ChainSchema | - |
| ConnectionConfigSchema | - |
| createBundlerClientFromExisting | Creates a bundler client from an existing public client with the provided transport and chain. |
A middleware function to estimate the gas usage of a user operation when using an EIP-7702 delegated account. Has an optional custom gas estimator. This function is only compatible with accounts using EntryPoint v0.7.0, and the account must have an implementation address defined in getImplementationAddress(). | |
Provides a default middleware function for signing user operations with a client account when using EIP-7702 delegated accounts. If the signer doesn’t support signAuthorization, then this just runs the provided signUserOperation middleware. This function is only compatible with accounts using EntryPoint v0.7.0, and the account must have an implementation address defined in getImplementationAddress(). | |
| defaultEntryPointVersion | - |
| defaultGasEstimator | Description default gas estimator middleware for SmartAccountClient You can override this middleware with your custom gas estimator middleware by passing it to the client constructor |
| defaultPaymasterAndData | Middleware function that sets the paymasterAndData field in the given struct based on the entry point version of the account. This is the default used by createSmartAccountClient and is not necessary to be used directly. |
| defaultUserOpSigner | Provides a default middleware function for signing user operations with a client account. This function validates the request and adds the signature to it. This is already included in the client returned from createSmartAccountClient |
| EntryPointAbi_v6 | - |
| EntryPointAbi_v7 | - |
| entryPointRegistry | - |
| HexSchema | - |
| minPriorityFeePerBidDefaults | - |
| MultiplierSchema | - |
| noopMiddleware | Noop middleware that does nothing and passes the arguments through |
| SignerSchema | - |
| SimpleAccountAbi_v6 | - |
| SimpleAccountAbi_v7 | - |
| SimpleAccountFactoryAbi | - |
| smartAccountClientActions | Provides a set of smart account client actions to decorate the provided client. These actions include building and signing user operations, sending transactions, and more. |
| smartAccountClientMethodKeys | - |
| SmartAccountClientOptsSchema | - |
| TRACE_HEADER_NAME | These are the headers that are used in the trace headers, could be found in the spec |
| TRACE_HEADER_STATE | These are the headers that are used in the trace headers, could be found in the spec |
| waitForUserOperationTransaction | Waits for a user operation transaction to be confirmed by checking the receipt periodically until it is found or a maximum number of retries is reached. |
| webauthnGasEstimator | A middleware function to estimate the gas usage of a user operation when using a Modular Account V2 WebAuthn account. Has an optional custom gas estimator. This function is only compatible with accounts using EntryPoint v0.7.0, and the account must have an implementation address defined in getImplementationAddress(). |
Functions
| Function | Description |
|---|---|
| allEqual | Utility method for checking if the passed in values are all equal (strictly) |
| applyUserOpFeeOption | Utility method for applying a UserOperationFeeOptionsField value over the current value set for the field |
| applyUserOpOverride | Utility method for applying a UserOperationOverrides field value over the current value set for the field |
| applyUserOpOverrideOrFeeOption | Utility method for applying a UserOperationOverrides field value and a UserOperationFeeOptionsField value over the current value set for the field, with the override taking precedence over the fee option |
| asyncPipe | Utility function that allows for piping a series of async functions together |
| bigIntClamp | Given a bigint and a min-max range, returns the min-max clamped bigint value |
| bigIntMax | Returns the max bigint in a list of bigints |
| bigIntMin | Returns the min bigint in a list of bigints |
| bigIntMultiply | Given a bigint and a number (which can be a float), returns the bigint value. Note: this function has loss and will round down to the nearest integer. |
| buildUserOperation | Builds a user operation using the provided client and operation parameters. Ensures that the account exists and the client is compatible. |
| buildUserOperationFromTx | Performs buildUserOperationFromTx in batch and builds into a single, yet to be signed UserOperation (UO) struct. The output user operation struct will be filled with all gas fields (and paymaster data if a paymaster is used) based on the transactions data (to, data, value, maxFeePerGas, maxPriorityFeePerGas) computed using the configured ClientMiddlewares on the SmartAccountClient |
| buildUserOperationFromTxs | Performs buildUserOperationFromTx in batch and builds into a single, yet to be signed UserOperation (UO) struct. The output user operation struct will be filled with all gas fields (and paymaster data if a paymaster is used) based on the transactions data (to, data, value, maxFeePerGas, maxPriorityFeePerGas) computed using the configured ClientMiddlewares on the SmartAccountClient. |
| bypassPaymasterAndData | Utility method for checking whether the middleware pipeline should bypass the paymaster middleware for the user operation with the given overrides, either because the UserOp is paying for its own gas, or passing a specific paymaster |
| bypassPaymasterAndDataEmptyHex | An alternative to bypassPaymasterAndData which only returns true if the data parameter is “0x,” this is useful for cases when middleware should be bypassed ONLY IF the UserOp will pay for its own gas |
| checkGasSponsorshipEligibility | This function verifies the eligibility of the connected account for gas sponsorship concerning the upcoming UserOperation (UO) that is intended to be sent. Internally, this method invokes buildUserOperation, which navigates through the middleware pipeline, including the PaymasterMiddleware. Its purpose is to construct the UO struct meant for transmission to the bundler. Following the construction of the UO struct, this function verifies if the resulting structure contains a non-empty paymasterAndData field. You can utilize this method before sending the user operation to confirm its eligibility for gas sponsorship. Depending on the outcome, it allows you to tailor the user experience accordingly, based on eligibility. |
| clientHeaderTrack | Add a crumb to the breadcrumb. |
| concatPaymasterAndData | Utility method for converting the object containing the paymaster address and paymaster data to the paymaster and data concatenated hex string |
| conditionalReturn | Utility method for checking the condition and return the value if condition holds true, undefined if not. |
| convertChainIdToCoinType | Converts a given chain ID to a coin type, following specific standards for mainnet and non-mainnet chains. |
| convertCoinTypeToChain | Converts a coin type to its corresponding blockchain chain based on a predefined mapping. |
| convertCoinTypeToChainId | Converts a coin type to a chain ID based on predefined mappings. This function follows ENSIP-9 for coin type 60 and ENSIP-11 for other coin types. |
| createBundlerClient | Creates a Bundler Client using the provided configuration parameters, including chain and optional type. |
| createSmartAccountClient | Creates a smart account client using the provided configuration. This client handles various Ethereum transactions and message signing operations. |
| createSmartAccountClientFromExisting | Creates a smart account client using an existing client and specific configuration. This function can be used to reuse a pre-existing BundlerClient while customizing other aspects of the smart account. |
| deepHexlify | Recursively converts all values in an object to hex strings |
| defaultFeeEstimator | Default fee estimator middleware function that estimates the maximum fee per gas and maximum priority fee per gas for a given client and applies the necessary overrides and fee options. |
| dropAndReplaceUserOperation | Drops an existing user operation and replaces it with a new one while ensuring the appropriate fees and overrides are applied. |
| erc7677Middleware | Middleware function for interacting with ERC-7677 enabled clients. It supports resolving paymaster and data fields for user operations. This middleware assumes that your RPC provider supports the ERC-7677 methods (pm_getPaymasterStubData and pm_getPaymasterData). |
| filterUndefined | Filters out properties with undefined or null values from the provided object. |
| getAccountAddress | Retrieves the account address. Uses a provided accountAddress if available; otherwise, it computes the address using the entry point contract and the initial code. |
| getDefaultUserOperationFeeOptions | - |
| getEntryPoint | Retrieves the entry point definition for the specified chain and version, falling back to the default version if not provided. Throws an error if the entry point address cannot be found. |
| getUserOperationError | Retrieves the error message from an entrypoint for a User Operation. |
| isBigNumberish | - |
| isEntryPointVersion | Checks if the given value is a valid key of the EntryPointRegistry. |
| isMultiplier | - |
| isSigner | Checks if the provided object is a SmartAccountSigner. |
| isSmartAccountClient | Use this method to assert that a client is a BaseSmartAccountClient. Useful for narrowing the type of the client down when used within the smart account client decorators |
| isSmartAccountWithSigner | Determines if the given SmartContractAccount has a signer associated with it. |
| isValidFactoryAndData | Utility method for asserting a UserOperationStruct has valid fields for the paymaster data |
| isValidPaymasterAndData | Utility method for asserting a UserOperationRequest has valid fields for the paymaster data |
| isValidRequest | Utility method for asserting a UserOperationStruct has valid fields for the given entry point version |
| middlewareActions | function that takes in ClientMiddlewareConfig used during client initiation and returns the middleware actions object that the smart account client extends with |
| parseFactoryAddressFromAccountInitCode | Parses the factory address and factory calldata from the provided account initialization code (initCode). |
| parsePaymasterAndData | Utility method for parsing the paymaster address and paymasterData from the paymasterAndData hex string |
| pick | Picks the specified keys from an object and returns a new object containing only those key-value pairs. |
| resolveProperties | Await all of the properties of a Deferrable object |
| sendTransaction | Sends a transaction using the provided client, arguments, optional overrides, and context. This sends a UO and then waits for it to be mined |
| sendTransactions | Sends transactions using the provided client and transaction parameters. This function builds user operations from the transactions, sends them, and waits for the transaction to be mined. |
| sendUserOperation | Sends a user operation or batch of user operations using the connected account. Before executing, sendUserOperation will run the user operation through the middleware pipeline. |
| split | The Split Transport allows you to split RPC traffic for specific methods across different RPC providers. This is done by specifying the methods you want handled specially as overrides and providing a fallback transport for all other methods. |
| stringToIndex | Useful if you want to use a string, such as a user’s email address, as salt to generate a unique SmartAccount per user. |
| takeBytes | Given a bytes string, returns a slice of the bytes |
| toRecord | Converts an array of objects into a record (object) where each key is determined by the specified selector and the value is determined by the provided function. |
| toSmartContractAccount | Converts an account to a smart contract account and sets up various account-related methods using the provided parameters like transport, chain, entry point, and other utilities. |
| unpackSignRawMessageBytes | - |
| wrapSignatureWith6492 | Wraps a given signature with additional data following the EIP-6492 standard. |