@mentaproject/client 0.1.36 → 0.1.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../node_modules/viem/errors/version.ts","../node_modules/viem/errors/base.ts","../node_modules/viem/errors/transaction.ts","../src/index.ts","../src/structures/Account.ts","../src/structures/Transaction.ts","../node_modules/viem/index.ts","../src/utils/toJSON.ts","../src/structures/Block.ts","../src/structures/MentaClient.ts","../src/managers/BlockManager.ts","../src/managers/TransactionManager.ts","../src/utils/bigint.ts","../src/managers/ContractManager.ts","../src/managers/AccountManager.ts","../src/managers/PersistenceManager.ts","../src/types/MentaClient.ts","../src/utils/withCache.ts","../src/structures/Cache.ts"],"sourcesContent":["export const version = '2.42.1'\n","import { version } from './version.js'\n\ntype ErrorConfig = {\n getDocsUrl?: ((args: BaseErrorParameters) => string | undefined) | undefined\n version?: string | undefined\n}\n\nlet errorConfig: ErrorConfig = {\n getDocsUrl: ({\n docsBaseUrl,\n docsPath = '',\n docsSlug,\n }: BaseErrorParameters) =>\n docsPath\n ? `${docsBaseUrl ?? 'https://viem.sh'}${docsPath}${\n docsSlug ? `#${docsSlug}` : ''\n }`\n : undefined,\n version: `viem@${version}`,\n}\n\nexport function setErrorConfig(config: ErrorConfig) {\n errorConfig = config\n}\n\ntype BaseErrorParameters = {\n cause?: BaseError | Error | undefined\n details?: string | undefined\n docsBaseUrl?: string | undefined\n docsPath?: string | undefined\n docsSlug?: string | undefined\n metaMessages?: string[] | undefined\n name?: string | undefined\n}\n\nexport type BaseErrorType = BaseError & { name: 'BaseError' }\nexport class BaseError extends Error {\n details: string\n docsPath?: string | undefined\n metaMessages?: string[] | undefined\n shortMessage: string\n version: string\n\n override name = 'BaseError'\n\n constructor(shortMessage: string, args: BaseErrorParameters = {}) {\n const details = (() => {\n if (args.cause instanceof BaseError) return args.cause.details\n if (args.cause?.message) return args.cause.message\n return args.details!\n })()\n const docsPath = (() => {\n if (args.cause instanceof BaseError)\n return args.cause.docsPath || args.docsPath\n return args.docsPath\n })()\n const docsUrl = errorConfig.getDocsUrl?.({ ...args, docsPath })\n\n const message = [\n shortMessage || 'An error occurred.',\n '',\n ...(args.metaMessages ? [...args.metaMessages, ''] : []),\n ...(docsUrl ? [`Docs: ${docsUrl}`] : []),\n ...(details ? [`Details: ${details}`] : []),\n ...(errorConfig.version ? [`Version: ${errorConfig.version}`] : []),\n ].join('\\n')\n\n super(message, args.cause ? { cause: args.cause } : undefined)\n\n this.details = details\n this.docsPath = docsPath\n this.metaMessages = args.metaMessages\n this.name = args.name ?? this.name\n this.shortMessage = shortMessage\n this.version = version\n }\n\n walk(): Error\n walk(fn: (err: unknown) => boolean): Error | null\n walk(fn?: any): any {\n return walk(this, fn)\n }\n}\n\nfunction walk(\n err: unknown,\n fn?: ((err: unknown) => boolean) | undefined,\n): unknown {\n if (fn?.(err)) return err\n if (\n err &&\n typeof err === 'object' &&\n 'cause' in err &&\n err.cause !== undefined\n )\n return walk(err.cause, fn)\n return fn ? null : err\n}\n","import type { Account } from '../accounts/types.js'\nimport type { SendTransactionParameters } from '../actions/wallet/sendTransaction.js'\nimport type { BlockTag } from '../types/block.js'\nimport type { Chain } from '../types/chain.js'\nimport type { Hash, Hex } from '../types/misc.js'\nimport type {\n TransactionReceipt,\n TransactionType,\n} from '../types/transaction.js'\nimport { formatEther } from '../utils/unit/formatEther.js'\nimport { formatGwei } from '../utils/unit/formatGwei.js'\n\nimport { BaseError } from './base.js'\n\nexport function prettyPrint(\n args: Record<string, bigint | number | string | undefined | false | unknown>,\n) {\n const entries = Object.entries(args)\n .map(([key, value]) => {\n if (value === undefined || value === false) return null\n return [key, value]\n })\n .filter(Boolean) as [string, string][]\n const maxLength = entries.reduce((acc, [key]) => Math.max(acc, key.length), 0)\n return entries\n .map(([key, value]) => ` ${`${key}:`.padEnd(maxLength + 1)} ${value}`)\n .join('\\n')\n}\n\nexport type FeeConflictErrorType = FeeConflictError & {\n name: 'FeeConflictError'\n}\nexport class FeeConflictError extends BaseError {\n constructor() {\n super(\n [\n 'Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.',\n 'Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others.',\n ].join('\\n'),\n { name: 'FeeConflictError' },\n )\n }\n}\n\nexport type InvalidLegacyVErrorType = InvalidLegacyVError & {\n name: 'InvalidLegacyVError'\n}\nexport class InvalidLegacyVError extends BaseError {\n constructor({ v }: { v: bigint }) {\n super(`Invalid \\`v\\` value \"${v}\". Expected 27 or 28.`, {\n name: 'InvalidLegacyVError',\n })\n }\n}\n\nexport type InvalidSerializableTransactionErrorType =\n InvalidSerializableTransactionError & {\n name: 'InvalidSerializableTransactionError'\n }\nexport class InvalidSerializableTransactionError extends BaseError {\n constructor({ transaction }: { transaction: Record<string, unknown> }) {\n super('Cannot infer a transaction type from provided transaction.', {\n metaMessages: [\n 'Provided Transaction:',\n '{',\n prettyPrint(transaction),\n '}',\n '',\n 'To infer the type, either provide:',\n '- a `type` to the Transaction, or',\n '- an EIP-1559 Transaction with `maxFeePerGas`, or',\n '- an EIP-2930 Transaction with `gasPrice` & `accessList`, or',\n '- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or',\n '- an EIP-7702 Transaction with `authorizationList`, or',\n '- a Legacy Transaction with `gasPrice`',\n ],\n name: 'InvalidSerializableTransactionError',\n })\n }\n}\n\nexport type InvalidSerializedTransactionTypeErrorType =\n InvalidSerializedTransactionTypeError & {\n name: 'InvalidSerializedTransactionTypeError'\n }\nexport class InvalidSerializedTransactionTypeError extends BaseError {\n serializedType: Hex\n\n constructor({ serializedType }: { serializedType: Hex }) {\n super(`Serialized transaction type \"${serializedType}\" is invalid.`, {\n name: 'InvalidSerializedTransactionType',\n })\n\n this.serializedType = serializedType\n }\n}\n\nexport type InvalidSerializedTransactionErrorType =\n InvalidSerializedTransactionError & {\n name: 'InvalidSerializedTransactionError'\n }\nexport class InvalidSerializedTransactionError extends BaseError {\n serializedTransaction: Hex\n type: TransactionType\n\n constructor({\n attributes,\n serializedTransaction,\n type,\n }: {\n attributes: Record<string, unknown>\n serializedTransaction: Hex\n type: TransactionType\n }) {\n const missing = Object.entries(attributes)\n .map(([key, value]) => (typeof value === 'undefined' ? key : undefined))\n .filter(Boolean)\n super(`Invalid serialized transaction of type \"${type}\" was provided.`, {\n metaMessages: [\n `Serialized Transaction: \"${serializedTransaction}\"`,\n missing.length > 0 ? `Missing Attributes: ${missing.join(', ')}` : '',\n ].filter(Boolean),\n name: 'InvalidSerializedTransactionError',\n })\n\n this.serializedTransaction = serializedTransaction\n this.type = type\n }\n}\n\nexport type InvalidStorageKeySizeErrorType = InvalidStorageKeySizeError & {\n name: 'InvalidStorageKeySizeError'\n}\nexport class InvalidStorageKeySizeError extends BaseError {\n constructor({ storageKey }: { storageKey: Hex }) {\n super(\n `Size for storage key \"${storageKey}\" is invalid. Expected 32 bytes. Got ${Math.floor(\n (storageKey.length - 2) / 2,\n )} bytes.`,\n { name: 'InvalidStorageKeySizeError' },\n )\n }\n}\n\nexport type TransactionExecutionErrorType = TransactionExecutionError & {\n name: 'TransactionExecutionError'\n}\nexport class TransactionExecutionError extends BaseError {\n override cause: BaseError\n\n constructor(\n cause: BaseError,\n {\n account,\n docsPath,\n chain,\n data,\n gas,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n to,\n value,\n }: Omit<SendTransactionParameters, 'account' | 'chain'> & {\n account: Account | null\n chain?: Chain | undefined\n docsPath?: string | undefined\n },\n ) {\n const prettyArgs = prettyPrint({\n chain: chain && `${chain?.name} (id: ${chain?.id})`,\n from: account?.address,\n to,\n value:\n typeof value !== 'undefined' &&\n `${formatEther(value)} ${chain?.nativeCurrency?.symbol || 'ETH'}`,\n data,\n gas,\n gasPrice:\n typeof gasPrice !== 'undefined' && `${formatGwei(gasPrice)} gwei`,\n maxFeePerGas:\n typeof maxFeePerGas !== 'undefined' &&\n `${formatGwei(maxFeePerGas)} gwei`,\n maxPriorityFeePerGas:\n typeof maxPriorityFeePerGas !== 'undefined' &&\n `${formatGwei(maxPriorityFeePerGas)} gwei`,\n nonce,\n })\n\n super(cause.shortMessage, {\n cause,\n docsPath,\n metaMessages: [\n ...(cause.metaMessages ? [...cause.metaMessages, ' '] : []),\n 'Request Arguments:',\n prettyArgs,\n ].filter(Boolean) as string[],\n name: 'TransactionExecutionError',\n })\n this.cause = cause\n }\n}\n\nexport type TransactionNotFoundErrorType = TransactionNotFoundError & {\n name: 'TransactionNotFoundError'\n}\nexport class TransactionNotFoundError extends BaseError {\n constructor({\n blockHash,\n blockNumber,\n blockTag,\n hash,\n index,\n }: {\n blockHash?: Hash | undefined\n blockNumber?: bigint | undefined\n blockTag?: BlockTag | undefined\n hash?: Hash | undefined\n index?: number | undefined\n }) {\n let identifier = 'Transaction'\n if (blockTag && index !== undefined)\n identifier = `Transaction at block time \"${blockTag}\" at index \"${index}\"`\n if (blockHash && index !== undefined)\n identifier = `Transaction at block hash \"${blockHash}\" at index \"${index}\"`\n if (blockNumber && index !== undefined)\n identifier = `Transaction at block number \"${blockNumber}\" at index \"${index}\"`\n if (hash) identifier = `Transaction with hash \"${hash}\"`\n super(`${identifier} could not be found.`, {\n name: 'TransactionNotFoundError',\n })\n }\n}\n\nexport type TransactionReceiptNotFoundErrorType =\n TransactionReceiptNotFoundError & {\n name: 'TransactionReceiptNotFoundError'\n }\nexport class TransactionReceiptNotFoundError extends BaseError {\n constructor({ hash }: { hash: Hash }) {\n super(\n `Transaction receipt with hash \"${hash}\" could not be found. The Transaction may not be processed on a block yet.`,\n {\n name: 'TransactionReceiptNotFoundError',\n },\n )\n }\n}\n\nexport type TransactionReceiptRevertedErrorType =\n TransactionReceiptRevertedError & {\n name: 'TransactionReceiptRevertedError'\n }\nexport class TransactionReceiptRevertedError extends BaseError {\n receipt: TransactionReceipt\n\n constructor({ receipt }: { receipt: TransactionReceipt }) {\n super(`Transaction with hash \"${receipt.transactionHash}\" reverted.`, {\n metaMessages: [\n 'The receipt marked the transaction as \"reverted\". This could mean that the function on the contract you are trying to call threw an error.',\n ' ',\n 'You can attempt to extract the revert reason by:',\n '- calling the `simulateContract` or `simulateCalls` Action with the `abi` and `functionName` of the contract',\n '- using the `call` Action with raw `data`',\n ],\n name: 'TransactionReceiptRevertedError',\n })\n\n this.receipt = receipt\n }\n}\n\nexport type WaitForTransactionReceiptTimeoutErrorType =\n WaitForTransactionReceiptTimeoutError & {\n name: 'WaitForTransactionReceiptTimeoutError'\n }\nexport class WaitForTransactionReceiptTimeoutError extends BaseError {\n constructor({ hash }: { hash: Hash }) {\n super(\n `Timed out while waiting for transaction with hash \"${hash}\" to be confirmed.`,\n { name: 'WaitForTransactionReceiptTimeoutError' },\n )\n }\n}\n","/**\n * @module @mentaproject/client\n * @description This library provides the client-side functionalities for interacting with the Menta blockchain.\n * It includes managers for accounts, blocks, contracts, persistence, and transactions,\n * as well as core data structures and utility types.\n */\n\n/**\n * Re-exports all core data structures like MentaClient, Account, Block, and Transaction.\n */\nexport * from './structures';\n/**\n * Re-exports all manager classes for interacting with different aspects of the Menta blockchain.\n */\nexport * from './managers';\n/**\n * Re-exports the Cache structure for managing cached data.\n */\nexport * from './structures/Cache';\n\nexport * from \"./utils/bigint\";","import {\n fetchByBlockRange,\n getBalance,\n getBlockNumber,\n getCode,\n getTransaction,\n getTransactionCount,\n sendTransaction,\n traceFilter,\n} from \"@mentaproject/core/actions\";\nimport type {\n Address,\n Hash,\n onBlockRangeCallback,\n} from \"@mentaproject/core/types\";\nimport { Transaction } from \"./Transaction\";\nimport { toHex } from \"@mentaproject/core/utils\";\nimport {\n AccountData,\n FetchTransactionParams,\n GetTransactionsParams,\n JSONAccount,\n} from \"../types/Account\";\nimport { getContractType } from \"@mentaproject/contracts\";\nimport { toJSON } from \"../utils/toJSON\";\nimport { PersistenceManager } from \"../managers/PersistenceManager\";\nimport { MentaClient } from \"./MentaClient\";\n\n/**\n * Represents a blockchain account with functionalities to interact with the Menta blockchain.\n * This class provides methods to query account information, send transactions, and manage account-related data.\n */\nexport class Account implements AccountData {\n /**\n * The blockchain address of the account.\n */\n public address: Address;\n\n private persistenceManager?: PersistenceManager;\n\n /**\n * Creates an instance of the Account class.\n * @param client.rpc The CoreClient instance used for blockchain interactions.\n * @param address The blockchain address of the account.\n * @param persistenceManager An optional PersistenceManager instance for caching and data synchronization.\n */\n constructor(\n public client: MentaClient,\n data: AccountData,\n persistenceManager?: PersistenceManager,\n ) {\n this.address = data.address;\n this.persistenceManager = persistenceManager;\n }\n\n /**\n * Checks if the account's address belongs to a smart contract.\n * @description This method queries the blockchain for the code associated with the account's address.\n * If code is found, it indicates that the account is a contract.\n * @returns {Promise<boolean>} A promise that resolves to `true` if the account is a contract, `false` otherwise.\n */\n async isContract(): Promise<boolean> {\n const code = await getCode(this.client.rpc, { address: this.address });\n\n if (!code || code === \"0x\") return false;\n return true;\n }\n\n /**\n * Retrieves the type of the contract if the account is a smart contract.\n * @description This method first checks if the account is a contract using `isContract()`.\n * If it is a contract, it then attempts to determine and return its type.\n * @returns {Promise<any>} A promise that resolves to the contract type (e.g., 'ERC20', 'ERC721') or `undefined` if the account is not a contract or its type cannot be determined.\n */\n async contractType(): Promise<any> {\n const isContract = await this.isContract();\n if (!isContract) return undefined;\n\n return await getContractType(this.client.rpc, this.address);\n }\n\n /**\n * Sends a specified amount of native cryptocurrency (ETH) to this account.\n * @description This method constructs and sends a transaction to transfer ETH to the account's address.\n * @param {bigint} amount The amount of ETH to send, specified in wei (the smallest denomination of Ether).\n * @returns {Promise<Transaction>} A promise that resolves to a `Transaction` object representing the sent transaction.\n */\n async sendETH(amount: bigint): Promise<Transaction> {\n const hash = await sendTransaction(this.client.rpc, {\n calls: [\n {\n to: this.address,\n value: amount,\n },\n ],\n });\n\n const data = await getTransaction(this.client.rpc, { hash });\n return new Transaction(this.client, data);\n }\n\n /**\n * Retrieves the current native cryptocurrency (ETH) balance of the account.\n * @description This method queries the blockchain to get the balance associated with the account's address.\n * @returns {Promise<bigint>} A promise that resolves to the ETH balance of the account, in wei.\n */\n async ETHBalance(): Promise<bigint> {\n return await getBalance(this.client.rpc, {\n address: this.address,\n });\n }\n\n /**\n * Retrieves the transaction count (nonce) for the account.\n * @description The transaction count represents the number of transactions sent from this account,\n * which is also used as the nonce for new transactions to prevent replay attacks.\n * @returns {Promise<number>} A promise that resolves to the transaction count of the account.\n */\n async transactionCount(): Promise<number> {\n return await getTransactionCount(this.client.rpc, {\n address: this.address,\n });\n }\n\n /**\n * Retrieves all transactions involving this account.\n * @description If a `PersistenceManager` is configured, this method will first attempt to retrieve transactions from the local cache.\n * If not found in cache or if no `PersistenceManager` is configured, it will fetch transactions directly from the remote RPC.\n * @param {GetTransactionsOptions} [options] - Optional parameters for filtering, pagination, and sorting the transactions.\n * @param {number} [options.startBlock] - The starting block number (inclusive) from which to retrieve transactions.\n * @param {number} [options.endBlock] - The ending block number (inclusive) up to which to retrieve transactions.\n * @param {number} [options.page] - The page number for paginated results.\n * @param {number} [options.offset] - The number of items to skip from the beginning of the result set.\n * @param {'asc' | 'desc'} [options.sort] - The sorting order for transactions based on block number ('asc' for ascending, 'desc' for descending).\n * @param {boolean} [forceFetch=false] - Forces the method to fetch transactions from the remote source even if they are already cached. (mostly used internally)\n * @returns {Promise<Transaction[]>} A promise that resolves to an array of transactions.\n */\n async transactions(\n params: GetTransactionsParams,\n forceFetch = false,\n ): Promise<Transaction[]> {\n if (!this.persistenceManager || forceFetch) {\n // If persistence is not configured, fetch directly from remote\n const hashes = await this._fetchTransactions(params);\n const transactions = await Promise.all(\n hashes.map((hash) => this.client.transactions.get({ hash })),\n );\n\n return transactions;\n }\n\n const jsons = await this.persistenceManager.getTransactions(\n this.address,\n params,\n );\n return jsons.map((j) => this.client.transactions.parse(j));\n }\n\n /**\n * Synchronizes the account's transactions with the remote data source using the configured `PersistenceManager`.\n * @description This method initiates a synchronization process to ensure that the local cache of transactions\n * for this account is up-to-date with the blockchain.\n * @param {number} [limit] The maximum number of transactions to synchronize.\n * @returns {Promise<void>} A promise that resolves when the synchronization process is complete.\n * @throws {Error} If the persistence module is not configured.\n */\n async syncTransactions(limit: number = 1000): Promise<void> {\n if (!this.persistenceManager)\n throw new Error(\"The persistence module is not configured.\");\n await this.persistenceManager.syncTransactions(this, limit);\n }\n\n /**\n * Retrieves transactions involving a specific token. (not implemented yet)\n * @description This method queries the persistence adapter to retrieve transactions involving a specific token.\n * @param {Address} tokenAddress The address of the token.\n * @returns {Promise<any>} A promise that resolves to an array of transactions involving the token.\n * @throws {Error} If the persistence module is not configured.\n */\n async tokenTransactions(tokenAddress: Address): Promise<any> {\n if (!this.persistenceManager)\n throw new Error(\"The persistence module is not configured.\");\n\n return {};\n }\n\n /**\n * Converts the Account instance into a JSON-serializable representation.\n * @description This method leverages a utility function to convert the `Account` object,\n * including its asynchronous properties (like `isContract`, `ETHBalance`), into a plain JSON object.\n * @param {number} [depth=1] The depth to which nested objects should be converted. A depth of 1 means only direct properties are included.\n * @returns {Promise<object>} A promise that resolves to the JSON representation of the account.\n */\n async toJSON<D extends number = 1>(depth: D): Promise<JSONAccount<D>> {\n return await toJSON({\n obj: {\n address: this.address,\n isContract: this.isContract.bind(this),\n contractType: this.contractType.bind(this),\n ETHBalance: this.ETHBalance.bind(this),\n transactionCount: this.transactionCount.bind(this),\n },\n depth,\n });\n }\n\n /**\n * Fetches transactions from the account using a block range exploration with trace_filter calls.\n *\n * @param params - The parameters for the block range exploration.\n * @returns A Promise that resolves to an array of transaction hashes.\n */\n protected async _fetchTransactions({\n fromBlock,\n toBlock,\n limit = 50,\n }: FetchTransactionParams): Promise<Hash[]> {\n const lastBlock = await getBlockNumber(this.client.rpc);\n\n const onBlockRange: onBlockRangeCallback = async (\n { fromBlock, toBlock },\n stop,\n ) => {\n const outgoing = await traceFilter(this.client.rpc, {\n fromBlock: toHex(fromBlock),\n toBlock: toHex(toBlock),\n fromAddress: this.address,\n });\n\n const incoming = await traceFilter(this.client.rpc, {\n fromBlock: toHex(fromBlock),\n toBlock: toHex(toBlock),\n toAddress: this.address,\n });\n\n const traces = outgoing\n .concat(incoming)\n .sort((a, b) => a.blockNumber - b.blockNumber);\n\n return traces.map((t) => t.transactionHash as Hash);\n };\n\n return await fetchByBlockRange({\n toBlock: BigInt(toBlock !== undefined ? toBlock : 0),\n fromBlock: BigInt(fromBlock !== undefined ? fromBlock : lastBlock),\n direction: \"backward\",\n itemLimit: limit,\n onBlockRange,\n });\n }\n}\n","import { AccessList, Address, Hash, Hex, Transaction as RawTransaction, WaitForTransactionReceiptReturnType } from '@mentaproject/core/types';\nimport { getBlock, getTransactionReceipt, traceTransaction, waitForTransactionReceipt } from '@mentaproject/core/actions';\nimport { hexToBigInt } from '@mentaproject/core/utils';\nimport { TransactionReceiptNotFoundError } from 'viem';\n\nimport { Account } from './Account';\nimport { Block } from './Block';\nimport { MentaClient } from './MentaClient';\n\nimport { toJSON } from '../utils/toJSON';\nimport { JSONTransaction, TransactionCall } from '../types';\n\n/**\n * Represents a blockchain transaction with its properties and methods.\n *\n * @description This class encapsulates the data and functionalities related to an Ethereum-like transaction,\n * providing methods to interact with the blockchain to retrieve transaction-related information such as\n * internal calls, receipts, and the block it belongs to.\n */\nexport class Transaction implements Omit<RawTransaction, \"from\" | \"to\"> {\n /**\n * @description The access list for the transaction.\n */\n public accessList?: AccessList;\n /**\n * @description The blob versioned hashes.\n */\n public blobVersionedHashes?: readonly Hex[];\n /**\n * @description The gas limit for the transaction.\n */\n public gas: bigint;\n /**\n * @description The gas price for the transaction.\n */\n public gasPrice?: bigint;\n /**\n * @description The hash of the transaction.\n */\n public hash: Hash;\n /**\n * @description The input data for the transaction.\n */\n public input: Hex;\n /**\n * @description The maximum fee per gas.\n */\n public maxFeePerGas?: bigint;\n /**\n * @description The maximum priority fee per gas.\n */\n public maxPriorityFeePerGas?: bigint;\n /**\n * @description The nonce of the transaction.\n */\n public nonce: number;\n /**\n * @description The r value of the signature.\n */\n public r: Hex;\n /**\n * @description The s value of the signature.\n */\n public s: Hex;\n /**\n * @description The index of the transaction within the block.\n */\n public transactionIndex: number | null;\n /**\n * @description The type of the transaction.\n */\n public type: \"legacy\" | \"eip2930\" | \"eip1559\" | \"eip4844\" | \"eip7702\";\n /**\n * @description The v value of the signature.\n */\n public v: bigint;\n /**\n * @description The value transferred in the transaction.\n */\n public value: bigint;\n /**\n * @description The y parity of the signature.\n */\n public yParity?: number;\n /**\n * @description The hash of the block containing this transaction.\n */\n public blockHash: Hash | null;\n /**\n * @description The number of the block containing this transaction.\n */\n public blockNumber: bigint | null;\n /**\n * @description The hex representation of the type of the transaction.\n */\n public typeHex: `0x${string}` | null;\n\n /**\n * @description The sender account of the transaction.\n */\n public from?: Account;\n /**\n * @description The recipient account of the transaction.\n */\n public to?: Account;\n\n\n /**\n * Creates an instance of Transaction.\n * @description Initializes a new Transaction instance with the provided RPC client and transaction data.\n * @param {MentaClient} client - The instance of MentaClient used to interact with the blockchain.\n * @param {ITransactionData} data The raw transaction data.\n */\n constructor(protected client: MentaClient, data: RawTransaction) {\n this.accessList = data.accessList;\n this.blobVersionedHashes = data.blobVersionedHashes;\n this.gas = data.gas;\n this.gasPrice = data.gasPrice;\n this.hash = data.hash;\n this.input = data.input;\n this.maxFeePerGas = data.maxFeePerGas;\n this.maxPriorityFeePerGas = data.maxPriorityFeePerGas;\n this.nonce = data.nonce;\n this.r = data.r;\n this.s = data.s;\n this.transactionIndex = data.transactionIndex;\n this.type = data.type;\n this.v = data.v;\n this.value = data.value;\n this.yParity = data.yParity;\n this.blockHash = data.blockHash;\n this.blockNumber = data.blockNumber;\n this.typeHex = data.typeHex;\n\n this.from = data.from ? this.client.accounts.get(data.from) : undefined;\n this.to = data.to ? this.client.accounts.get(data.to) : undefined;\n };\n\n /**\n * Retrieves the internal calls made by this transaction.\n * @description Fetches and processes the transaction traces to extract internal call details.\n * @returns {Promise<TransactionCall[] | undefined>} A promise that resolves to an array of call objects, each representing an internal call with sender, recipient, value, input data, gas used, and call type.\n */\n public async calls(): Promise<TransactionCall[] | undefined> {\n const traces = await traceTransaction(this.client.rpc, this.hash);\n if (!traces) return undefined;\n\n const calls = traces.filter(t => t.type === \"call\" && t.action !== undefined);\n\n return calls.map(c => ({\n from: new Account(this.client, { address: c.action!.from as Address }),\n to: new Account(this.client, { address: c.action!.to as Address }),\n value: hexToBigInt(c.action!.value as Hex),\n input: c.action!.input as Hex,\n gas: hexToBigInt(c.action!.gas as Hex),\n callType: c.action!.callType,\n })) as TransactionCall[];\n }\n\n /**\n * Waits for the transaction receipt to be available.\n * @description Asynchronously waits for the transaction to be confirmed on the blockchain and its receipt to be available.\n * @param {number} [confirmations] The number of confirmations to wait for. Defaults to 1.\n * @returns {Promise<WaitForTransactionReceiptReturnType>} A promise that resolves to the transaction receipt once the specified number of confirmations are met.\n */\n async waitForReceipt(confirmations?: number): Promise<WaitForTransactionReceiptReturnType> {\n return await waitForTransactionReceipt(this.client.rpc, {\n hash: this.hash,\n confirmations: confirmations || 1,\n });\n };\n\n /**\n * Retrieves the transaction receipt.\n * @description Fetches the transaction receipt for the current transaction hash.\n * @returns {Promise<WaitForTransactionReceiptReturnType>} A promise that resolves to the transaction receipt.\n */\n async receipt(): Promise<WaitForTransactionReceiptReturnType | undefined> {\n try {\n return await getTransactionReceipt(this.client.rpc, { hash: this.hash });\n } catch (error) {\n if (error instanceof TransactionReceiptNotFoundError) {\n return undefined;\n }\n }\n };\n\n /**\n * Retrieves the block containing this transaction.\n * @description Fetches the block data using the transaction's block hash and returns a Block instance.\n * @returns {Promise<Block>} A promise that resolves to a Block instance representing the block that includes this transaction.\n */\n async block(): Promise<Block> {\n const data = await getBlock(this.client.rpc, { blockHash: this.blockHash! });\n return new Block(this.client, data);\n };\n\n /**\n * Converts the Transaction instance to a JSON representation.\n * @description Serializes the transaction instance into a JSON object, including nested representations of related entities like block, receipt, and internal calls based on the specified depth.\n * @param {number} [depth=1] The depth of the conversion. Controls how deeply nested objects are serialized.\n * @returns {Promise<object>} A promise that resolves to the JSON representation of the transaction.\n */\n async toJSON<D extends number = 1>(depth: D): Promise<JSONTransaction<D>> {\n return await toJSON({\n obj: {\n ...this,\n block: this.block,\n receipt: this.receipt,\n calls: async () => {\n const calls = await this.calls();\n if (!calls) return undefined;\n\n return Promise.all(calls.map(async c => await toJSON({ obj: c, depth: depth })));\n }\n },\n depth\n });\n }\n};","// biome-ignore lint/performance/noBarrelFile: entrypoint module\nexport {\n type Abi,\n type AbiEvent,\n type AbiFunction,\n type AbiParameter,\n type AbiParameterKind,\n type AbiParameterToPrimitiveType,\n type AbiStateMutability,\n type Address,\n CircularReferenceError,\n InvalidAbiItemError,\n InvalidAbiParameterError,\n InvalidAbiParametersError,\n InvalidAbiTypeParameterError,\n InvalidFunctionModifierError,\n InvalidModifierError,\n InvalidParameterError,\n InvalidParenthesisError,\n InvalidSignatureError,\n InvalidStructSignatureError,\n type Narrow,\n type ParseAbi,\n type ParseAbiItem,\n type ParseAbiParameter,\n type ParseAbiParameters,\n parseAbi,\n parseAbiItem,\n parseAbiParameter,\n parseAbiParameters,\n SolidityProtectedKeywordError,\n type TypedData,\n type TypedDataDomain,\n type TypedDataParameter,\n UnknownSignatureError,\n UnknownTypeError,\n} from 'abitype'\nexport type {\n BlockOverrides,\n Rpc as RpcBlockOverrides,\n} from 'ox/BlockOverrides'\nexport type {\n RpcEstimateUserOperationGasReturnType,\n RpcGetUserOperationByHashReturnType,\n RpcUserOperation,\n RpcUserOperationReceipt,\n RpcUserOperationRequest,\n} from './account-abstraction/types/rpc.js'\nexport type {\n Account,\n AccountSource,\n CustomSource,\n HDAccount,\n HDOptions,\n JsonRpcAccount,\n LocalAccount,\n PrivateKeyAccount,\n} from './accounts/types.js'\nexport type {\n GetEnsAddressErrorType,\n GetEnsAddressParameters,\n GetEnsAddressReturnType,\n} from './actions/ens/getEnsAddress.js'\nexport type {\n GetEnsAvatarErrorType,\n GetEnsAvatarParameters,\n GetEnsAvatarReturnType,\n} from './actions/ens/getEnsAvatar.js'\nexport type {\n GetEnsNameErrorType,\n GetEnsNameParameters,\n GetEnsNameReturnType,\n} from './actions/ens/getEnsName.js'\nexport type {\n GetEnsResolverErrorType,\n GetEnsResolverParameters,\n GetEnsResolverReturnType,\n} from './actions/ens/getEnsResolver.js'\nexport type {\n GetEnsTextErrorType,\n GetEnsTextParameters,\n GetEnsTextReturnType,\n} from './actions/ens/getEnsText.js'\nexport {\n type GetContractErrorType,\n type GetContractParameters,\n type GetContractReturnType,\n getContract,\n} from './actions/getContract.js'\nexport type {\n CallErrorType,\n CallParameters,\n CallReturnType,\n} from './actions/public/call.js'\nexport type {\n CreateAccessListErrorType,\n CreateAccessListParameters,\n CreateAccessListReturnType,\n} from './actions/public/createAccessList.js'\nexport type {\n CreateBlockFilterErrorType,\n CreateBlockFilterReturnType,\n} from './actions/public/createBlockFilter.js'\nexport type {\n CreateContractEventFilterErrorType,\n CreateContractEventFilterParameters,\n CreateContractEventFilterReturnType,\n} from './actions/public/createContractEventFilter.js'\nexport type {\n CreateEventFilterErrorType,\n CreateEventFilterParameters,\n CreateEventFilterReturnType,\n} from './actions/public/createEventFilter.js'\nexport type {\n CreatePendingTransactionFilterErrorType,\n CreatePendingTransactionFilterReturnType,\n} from './actions/public/createPendingTransactionFilter.js'\nexport type {\n EstimateContractGasErrorType,\n EstimateContractGasParameters,\n EstimateContractGasReturnType,\n} from './actions/public/estimateContractGas.js'\nexport type {\n EstimateFeesPerGasErrorType,\n EstimateFeesPerGasParameters,\n EstimateFeesPerGasReturnType,\n} from './actions/public/estimateFeesPerGas.js'\nexport type {\n EstimateGasErrorType,\n EstimateGasParameters,\n EstimateGasReturnType,\n} from './actions/public/estimateGas.js'\nexport type {\n EstimateMaxPriorityFeePerGasErrorType,\n EstimateMaxPriorityFeePerGasParameters,\n EstimateMaxPriorityFeePerGasReturnType,\n} from './actions/public/estimateMaxPriorityFeePerGas.js'\nexport type {\n FillTransactionErrorType,\n FillTransactionParameters,\n FillTransactionReturnType,\n} from './actions/public/fillTransaction.js'\nexport type {\n GetBalanceErrorType,\n GetBalanceParameters,\n GetBalanceReturnType,\n} from './actions/public/getBalance.js'\nexport type {\n GetBlobBaseFeeErrorType,\n GetBlobBaseFeeReturnType,\n} from './actions/public/getBlobBaseFee.js'\nexport type {\n GetBlockErrorType,\n GetBlockParameters,\n GetBlockReturnType,\n} from './actions/public/getBlock.js'\nexport type {\n GetBlockNumberErrorType,\n GetBlockNumberParameters,\n GetBlockNumberReturnType,\n} from './actions/public/getBlockNumber.js'\nexport type {\n GetBlockTransactionCountErrorType,\n GetBlockTransactionCountParameters,\n GetBlockTransactionCountReturnType,\n} from './actions/public/getBlockTransactionCount.js'\nexport type {\n GetChainIdErrorType,\n GetChainIdReturnType,\n} from './actions/public/getChainId.js'\nexport type {\n /** @deprecated Use `GetCodeErrorType` instead */\n GetCodeErrorType as GetBytecodeErrorType,\n GetCodeErrorType,\n /** @deprecated Use `GetCodeParameters` instead */\n GetCodeParameters as GetBytecodeParameters,\n GetCodeParameters,\n /** @deprecated Use `GetCodeReturnType` instead */\n GetCodeReturnType as GetBytecodeReturnType,\n GetCodeReturnType,\n} from './actions/public/getCode.js'\nexport type {\n GetContractEventsErrorType,\n GetContractEventsParameters,\n GetContractEventsReturnType,\n} from './actions/public/getContractEvents.js'\nexport type {\n GetEip712DomainErrorType,\n GetEip712DomainParameters,\n GetEip712DomainReturnType,\n} from './actions/public/getEip712Domain.js'\nexport type {\n GetFeeHistoryErrorType,\n GetFeeHistoryParameters,\n GetFeeHistoryReturnType,\n} from './actions/public/getFeeHistory.js'\nexport type {\n GetFilterChangesErrorType,\n GetFilterChangesParameters,\n GetFilterChangesReturnType,\n} from './actions/public/getFilterChanges.js'\nexport type {\n GetFilterLogsErrorType,\n GetFilterLogsParameters,\n GetFilterLogsReturnType,\n} from './actions/public/getFilterLogs.js'\nexport type {\n GetGasPriceErrorType,\n GetGasPriceReturnType,\n} from './actions/public/getGasPrice.js'\nexport type {\n GetLogsErrorType,\n GetLogsParameters,\n GetLogsReturnType,\n} from './actions/public/getLogs.js'\nexport type {\n GetProofErrorType,\n GetProofParameters,\n GetProofReturnType,\n} from './actions/public/getProof.js'\nexport type {\n GetStorageAtErrorType,\n GetStorageAtParameters,\n GetStorageAtReturnType,\n} from './actions/public/getStorageAt.js'\nexport type {\n GetTransactionErrorType,\n GetTransactionParameters,\n GetTransactionReturnType,\n} from './actions/public/getTransaction.js'\nexport type {\n GetTransactionConfirmationsErrorType,\n GetTransactionConfirmationsParameters,\n GetTransactionConfirmationsReturnType,\n} from './actions/public/getTransactionConfirmations.js'\nexport type {\n GetTransactionCountErrorType,\n GetTransactionCountParameters,\n GetTransactionCountReturnType,\n} from './actions/public/getTransactionCount.js'\nexport type {\n GetTransactionReceiptErrorType,\n GetTransactionReceiptParameters,\n GetTransactionReceiptReturnType,\n} from './actions/public/getTransactionReceipt.js'\nexport type {\n MulticallErrorType,\n MulticallParameters,\n MulticallReturnType,\n} from './actions/public/multicall.js'\nexport type {\n ReadContractErrorType,\n ReadContractParameters,\n ReadContractReturnType,\n} from './actions/public/readContract.js'\nexport type {\n SimulateBlocksErrorType,\n SimulateBlocksParameters,\n SimulateBlocksReturnType,\n} from './actions/public/simulateBlocks.js'\nexport type {\n SimulateCallsErrorType,\n SimulateCallsParameters,\n SimulateCallsReturnType,\n} from './actions/public/simulateCalls.js'\nexport type {\n GetMutabilityAwareValue,\n SimulateContractErrorType,\n SimulateContractParameters,\n SimulateContractReturnType,\n} from './actions/public/simulateContract.js'\nexport type {\n UninstallFilterErrorType,\n UninstallFilterParameters,\n UninstallFilterReturnType,\n} from './actions/public/uninstallFilter.js'\nexport type {\n VerifyHashErrorType as VerifyHashActionErrorType,\n VerifyHashParameters as VerifyHashActionParameters,\n VerifyHashReturnType as VerifyHashActionReturnType,\n} from './actions/public/verifyHash.js'\nexport type {\n VerifyMessageErrorType as VerifyMessageActionErrorType,\n VerifyMessageParameters as VerifyMessageActionParameters,\n VerifyMessageReturnType as VerifyMessageActionReturnType,\n} from './actions/public/verifyMessage.js'\nexport type {\n VerifyTypedDataErrorType as VerifyTypedDataActionErrorType,\n VerifyTypedDataParameters as VerifyTypedDataActionParameters,\n VerifyTypedDataReturnType as VerifyTypedDataActionReturnType,\n} from './actions/public/verifyTypedData.js'\nexport type {\n ReplacementReason,\n ReplacementReturnType,\n WaitForTransactionReceiptErrorType,\n WaitForTransactionReceiptParameters,\n WaitForTransactionReceiptReturnType,\n} from './actions/public/waitForTransactionReceipt.js'\nexport type {\n OnBlockNumberFn,\n OnBlockNumberParameter,\n WatchBlockNumberErrorType,\n WatchBlockNumberParameters,\n WatchBlockNumberReturnType,\n} from './actions/public/watchBlockNumber.js'\nexport type {\n OnBlock,\n OnBlockParameter,\n WatchBlocksErrorType,\n WatchBlocksParameters,\n WatchBlocksReturnType,\n} from './actions/public/watchBlocks.js'\nexport type {\n WatchContractEventErrorType,\n WatchContractEventOnLogsFn,\n WatchContractEventOnLogsParameter,\n WatchContractEventParameters,\n WatchContractEventReturnType,\n} from './actions/public/watchContractEvent.js'\nexport type {\n WatchEventErrorType,\n WatchEventOnLogsFn,\n WatchEventOnLogsParameter,\n WatchEventParameters,\n WatchEventReturnType,\n} from './actions/public/watchEvent.js'\nexport type {\n OnTransactionsFn,\n OnTransactionsParameter,\n WatchPendingTransactionsErrorType,\n WatchPendingTransactionsParameters,\n WatchPendingTransactionsReturnType,\n} from './actions/public/watchPendingTransactions.js'\nexport type {\n DropTransactionErrorType,\n DropTransactionParameters,\n} from './actions/test/dropTransaction.js'\nexport type {\n DumpStateErrorType,\n DumpStateReturnType,\n} from './actions/test/dumpState.js'\nexport type {\n GetAutomineErrorType,\n GetAutomineReturnType,\n} from './actions/test/getAutomine.js'\nexport type {\n GetTxpoolContentErrorType,\n GetTxpoolContentReturnType,\n} from './actions/test/getTxpoolContent.js'\nexport type {\n GetTxpoolStatusErrorType,\n GetTxpoolStatusReturnType,\n} from './actions/test/getTxpoolStatus.js'\nexport type {\n ImpersonateAccountErrorType,\n ImpersonateAccountParameters,\n} from './actions/test/impersonateAccount.js'\nexport type {\n IncreaseTimeErrorType,\n IncreaseTimeParameters,\n} from './actions/test/increaseTime.js'\nexport type {\n InspectTxpoolErrorType,\n InspectTxpoolReturnType,\n} from './actions/test/inspectTxpool.js'\nexport type {\n LoadStateErrorType,\n LoadStateParameters,\n LoadStateReturnType,\n} from './actions/test/loadState.js'\nexport type { MineErrorType, MineParameters } from './actions/test/mine.js'\nexport type { RemoveBlockTimestampIntervalErrorType } from './actions/test/removeBlockTimestampInterval.js'\nexport type { ResetErrorType, ResetParameters } from './actions/test/reset.js'\nexport type {\n RevertErrorType,\n RevertParameters,\n} from './actions/test/revert.js'\nexport type {\n SendUnsignedTransactionErrorType,\n SendUnsignedTransactionParameters,\n SendUnsignedTransactionReturnType,\n} from './actions/test/sendUnsignedTransaction.js'\nexport type { SetAutomineErrorType } from './actions/test/setAutomine.js'\nexport type {\n SetBalanceErrorType,\n SetBalanceParameters,\n} from './actions/test/setBalance.js'\nexport type {\n SetBlockGasLimitErrorType,\n SetBlockGasLimitParameters,\n} from './actions/test/setBlockGasLimit.js'\nexport type {\n SetBlockTimestampIntervalErrorType,\n SetBlockTimestampIntervalParameters,\n} from './actions/test/setBlockTimestampInterval.js'\nexport type {\n SetCodeErrorType,\n SetCodeParameters,\n} from './actions/test/setCode.js'\nexport type {\n SetCoinbaseErrorType,\n SetCoinbaseParameters,\n} from './actions/test/setCoinbase.js'\nexport type {\n SetIntervalMiningErrorType,\n SetIntervalMiningParameters,\n} from './actions/test/setIntervalMining.js'\nexport type { SetLoggingEnabledErrorType } from './actions/test/setLoggingEnabled.js'\nexport type {\n SetMinGasPriceErrorType,\n SetMinGasPriceParameters,\n} from './actions/test/setMinGasPrice.js'\nexport type {\n SetNextBlockBaseFeePerGasErrorType,\n SetNextBlockBaseFeePerGasParameters,\n} from './actions/test/setNextBlockBaseFeePerGas.js'\nexport type {\n SetNextBlockTimestampErrorType,\n SetNextBlockTimestampParameters,\n} from './actions/test/setNextBlockTimestamp.js'\nexport type {\n SetNonceErrorType,\n SetNonceParameters,\n} from './actions/test/setNonce.js'\nexport type { SetRpcUrlErrorType } from './actions/test/setRpcUrl.js'\nexport type {\n SetStorageAtErrorType,\n SetStorageAtParameters,\n} from './actions/test/setStorageAt.js'\nexport type { SnapshotErrorType } from './actions/test/snapshot.js'\nexport type {\n StopImpersonatingAccountErrorType,\n StopImpersonatingAccountParameters,\n} from './actions/test/stopImpersonatingAccount.js'\nexport type {\n AddChainErrorType,\n AddChainParameters,\n} from './actions/wallet/addChain.js'\nexport type {\n DeployContractErrorType,\n DeployContractParameters,\n DeployContractReturnType,\n} from './actions/wallet/deployContract.js'\nexport type {\n GetAddressesErrorType,\n GetAddressesReturnType,\n} from './actions/wallet/getAddresses.js'\nexport type {\n GetCallsStatusErrorType,\n GetCallsStatusParameters,\n GetCallsStatusReturnType,\n} from './actions/wallet/getCallsStatus.js'\nexport type {\n GetCapabilitiesErrorType,\n GetCapabilitiesParameters,\n GetCapabilitiesReturnType,\n} from './actions/wallet/getCapabilities.js'\nexport type {\n GetPermissionsErrorType,\n GetPermissionsReturnType,\n} from './actions/wallet/getPermissions.js'\nexport type {\n PrepareAuthorizationErrorType,\n PrepareAuthorizationParameters,\n PrepareAuthorizationReturnType,\n} from './actions/wallet/prepareAuthorization.js'\nexport type {\n PrepareTransactionRequestErrorType,\n PrepareTransactionRequestParameters,\n PrepareTransactionRequestParameterType,\n PrepareTransactionRequestRequest,\n PrepareTransactionRequestReturnType,\n} from './actions/wallet/prepareTransactionRequest.js'\nexport type {\n RequestAddressesErrorType,\n RequestAddressesReturnType,\n} from './actions/wallet/requestAddresses.js'\nexport type {\n RequestPermissionsErrorType,\n RequestPermissionsParameters,\n RequestPermissionsReturnType,\n} from './actions/wallet/requestPermissions.js'\nexport type {\n SendCallsErrorType,\n SendCallsParameters,\n SendCallsReturnType,\n} from './actions/wallet/sendCalls.js'\nexport type {\n SendCallsSyncErrorType,\n SendCallsSyncParameters,\n SendCallsSyncReturnType,\n} from './actions/wallet/sendCallsSync.js'\nexport type {\n SendRawTransactionErrorType,\n SendRawTransactionParameters,\n SendRawTransactionReturnType,\n} from './actions/wallet/sendRawTransaction.js'\nexport type {\n SendRawTransactionSyncErrorType,\n SendRawTransactionSyncParameters,\n SendRawTransactionSyncReturnType,\n} from './actions/wallet/sendRawTransactionSync.js'\nexport type {\n SendTransactionErrorType,\n SendTransactionParameters,\n SendTransactionRequest,\n SendTransactionReturnType,\n} from './actions/wallet/sendTransaction.js'\nexport type {\n SendTransactionSyncErrorType,\n SendTransactionSyncParameters,\n SendTransactionSyncRequest,\n SendTransactionSyncReturnType,\n} from './actions/wallet/sendTransactionSync.js'\nexport type {\n ShowCallsStatusErrorType,\n ShowCallsStatusParameters,\n ShowCallsStatusReturnType,\n} from './actions/wallet/showCallsStatus.js'\nexport type {\n SignAuthorizationErrorType,\n SignAuthorizationParameters,\n SignAuthorizationReturnType,\n} from './actions/wallet/signAuthorization.js'\nexport type {\n SignMessageErrorType,\n SignMessageParameters,\n SignMessageReturnType,\n} from './actions/wallet/signMessage.js'\nexport type {\n SignTransactionErrorType,\n SignTransactionParameters,\n SignTransactionReturnType,\n} from './actions/wallet/signTransaction.js'\nexport type {\n SignTypedDataErrorType,\n SignTypedDataParameters,\n SignTypedDataReturnType,\n} from './actions/wallet/signTypedData.js'\nexport type {\n SwitchChainErrorType,\n SwitchChainParameters,\n} from './actions/wallet/switchChain.js'\nexport type {\n WaitForCallsStatusErrorType,\n WaitForCallsStatusParameters,\n WaitForCallsStatusReturnType,\n WaitForCallsStatusTimeoutErrorType,\n} from './actions/wallet/waitForCallsStatus.js'\nexport { WaitForCallsStatusTimeoutError } from './actions/wallet/waitForCallsStatus.js'\nexport type {\n WatchAssetErrorType,\n WatchAssetParameters,\n WatchAssetReturnType,\n} from './actions/wallet/watchAsset.js'\nexport type {\n WriteContractErrorType,\n WriteContractParameters,\n WriteContractReturnType,\n} from './actions/wallet/writeContract.js'\nexport type {\n WriteContractSyncErrorType,\n WriteContractSyncParameters,\n WriteContractSyncReturnType,\n} from './actions/wallet/writeContractSync.js'\nexport {\n type Client,\n type ClientConfig,\n type CreateClientErrorType,\n createClient,\n type MulticallBatchOptions,\n rpcSchema,\n} from './clients/createClient.js'\nexport {\n type CreatePublicClientErrorType,\n createPublicClient,\n type PublicClient,\n type PublicClientConfig,\n} from './clients/createPublicClient.js'\nexport {\n type CreateTestClientErrorType,\n createTestClient,\n type TestClient,\n type TestClientConfig,\n} from './clients/createTestClient.js'\nexport {\n type CreateWalletClientErrorType,\n createWalletClient,\n type WalletClient,\n type WalletClientConfig,\n} from './clients/createWalletClient.js'\nexport {\n type PublicActions,\n publicActions,\n} from './clients/decorators/public.js'\nexport {\n type TestActions,\n testActions,\n} from './clients/decorators/test.js'\nexport {\n type WalletActions,\n walletActions,\n} from './clients/decorators/wallet.js'\nexport {\n type CreateTransportErrorType,\n createTransport,\n type Transport,\n type TransportConfig,\n} from './clients/transports/createTransport.js'\nexport {\n type CustomTransport,\n type CustomTransportConfig,\n type CustomTransportErrorType,\n custom,\n} from './clients/transports/custom.js'\nexport {\n type FallbackTransport,\n type FallbackTransportConfig,\n type FallbackTransportErrorType,\n fallback,\n shouldThrow,\n} from './clients/transports/fallback.js'\nexport {\n type HttpTransport,\n type HttpTransportConfig,\n type HttpTransportErrorType,\n http,\n} from './clients/transports/http.js'\nexport {\n type WebSocketTransport,\n type WebSocketTransportConfig,\n type WebSocketTransportErrorType,\n webSocket,\n} from './clients/transports/webSocket.js'\nexport {\n erc20Abi,\n erc20Abi_bytes32,\n erc721Abi,\n erc1155Abi,\n erc4626Abi,\n erc6492SignatureValidatorAbi,\n /** @deprecated use `erc6492SignatureValidatorAbi` instead. */\n erc6492SignatureValidatorAbi as universalSignatureValidatorAbi,\n multicall3Abi,\n} from './constants/abis.js'\nexport { ethAddress, zeroAddress } from './constants/address.js'\nexport { zeroHash } from './constants/bytes.js'\nexport {\n deploylessCallViaBytecodeBytecode,\n deploylessCallViaFactoryBytecode,\n erc6492SignatureValidatorByteCode,\n /** @deprecated use `erc6492SignatureValidatorByteCode` instead. */\n erc6492SignatureValidatorByteCode as universalSignatureValidatorByteCode,\n} from './constants/contracts.js'\nexport {\n maxInt8,\n maxInt16,\n maxInt24,\n maxInt32,\n maxInt40,\n maxInt48,\n maxInt56,\n maxInt64,\n maxInt72,\n maxInt80,\n maxInt88,\n maxInt96,\n maxInt104,\n maxInt112,\n maxInt120,\n maxInt128,\n maxInt136,\n maxInt144,\n maxInt152,\n maxInt160,\n maxInt168,\n maxInt176,\n maxInt184,\n maxInt192,\n maxInt200,\n maxInt208,\n maxInt216,\n maxInt224,\n maxInt232,\n maxInt240,\n maxInt248,\n maxInt256,\n maxUint8,\n maxUint16,\n maxUint24,\n maxUint32,\n maxUint40,\n maxUint48,\n maxUint56,\n maxUint64,\n maxUint72,\n maxUint80,\n maxUint88,\n maxUint96,\n maxUint104,\n maxUint112,\n maxUint120,\n maxUint128,\n maxUint136,\n maxUint144,\n maxUint152,\n maxUint160,\n maxUint168,\n maxUint176,\n maxUint184,\n maxUint192,\n maxUint200,\n maxUint208,\n maxUint216,\n maxUint224,\n maxUint232,\n maxUint240,\n maxUint248,\n maxUint256,\n minInt8,\n minInt16,\n minInt24,\n minInt32,\n minInt40,\n minInt48,\n minInt56,\n minInt64,\n minInt72,\n minInt80,\n minInt88,\n minInt96,\n minInt104,\n minInt112,\n minInt120,\n minInt128,\n minInt136,\n minInt144,\n minInt152,\n minInt160,\n minInt168,\n minInt176,\n minInt184,\n minInt192,\n minInt200,\n minInt208,\n minInt216,\n minInt224,\n minInt232,\n minInt240,\n minInt248,\n minInt256,\n} from './constants/number.js'\nexport { presignMessagePrefix } from './constants/strings.js'\nexport { etherUnits, gweiUnits, weiUnits } from './constants/unit.js'\nexport {\n AbiConstructorNotFoundError,\n type AbiConstructorNotFoundErrorType,\n AbiConstructorParamsNotFoundError,\n type AbiConstructorParamsNotFoundErrorType,\n AbiDecodingDataSizeInvalidError,\n type AbiDecodingDataSizeInvalidErrorType,\n AbiDecodingDataSizeTooSmallError,\n type AbiDecodingDataSizeTooSmallErrorType,\n AbiDecodingZeroDataError,\n type AbiDecodingZeroDataErrorType,\n AbiEncodingArrayLengthMismatchError,\n type AbiEncodingArrayLengthMismatchErrorType,\n AbiEncodingBytesSizeMismatchError,\n type AbiEncodingBytesSizeMismatchErrorType,\n AbiEncodingLengthMismatchError,\n type AbiEncodingLengthMismatchErrorType,\n AbiErrorInputsNotFoundError,\n type AbiErrorInputsNotFoundErrorType,\n AbiErrorNotFoundError,\n type AbiErrorNotFoundErrorType,\n AbiErrorSignatureNotFoundError,\n type AbiErrorSignatureNotFoundErrorType,\n AbiEventNotFoundError,\n type AbiEventNotFoundErrorType,\n AbiEventSignatureEmptyTopicsError,\n type AbiEventSignatureEmptyTopicsErrorType,\n AbiEventSignatureNotFoundError,\n type AbiEventSignatureNotFoundErrorType,\n AbiFunctionNotFoundError,\n type AbiFunctionNotFoundErrorType,\n AbiFunctionOutputsNotFoundError,\n type AbiFunctionOutputsNotFoundErrorType,\n AbiFunctionSignatureNotFoundError,\n type AbiFunctionSignatureNotFoundErrorType,\n BytesSizeMismatchError,\n type BytesSizeMismatchErrorType,\n DecodeLogDataMismatch,\n type DecodeLogDataMismatchErrorType,\n DecodeLogTopicsMismatch,\n type DecodeLogTopicsMismatchErrorType,\n InvalidAbiDecodingTypeError,\n type InvalidAbiDecodingTypeErrorType,\n InvalidAbiEncodingTypeError,\n type InvalidAbiEncodingTypeErrorType,\n InvalidArrayError,\n type InvalidArrayErrorType,\n InvalidDefinitionTypeError,\n type InvalidDefinitionTypeErrorType,\n UnsupportedPackedAbiType,\n type UnsupportedPackedAbiTypeErrorType,\n} from './errors/abi.js'\nexport {\n InvalidAddressError,\n type InvalidAddressErrorType,\n} from './errors/address.js'\nexport { BaseError, type BaseErrorType, setErrorConfig } from './errors/base.js'\nexport {\n BlockNotFoundError,\n type BlockNotFoundErrorType,\n} from './errors/block.js'\nexport {\n BundleFailedError,\n type BundleFailedErrorType,\n} from './errors/calls.js'\nexport {\n ChainDoesNotSupportContract,\n type ChainDoesNotSupportContractErrorType,\n ChainMismatchError,\n type ChainMismatchErrorType,\n ChainNotFoundError,\n type ChainNotFoundErrorType,\n ClientChainNotConfiguredError,\n type ClientChainNotConfiguredErrorType,\n InvalidChainIdError,\n type InvalidChainIdErrorType,\n} from './errors/chain.js'\nexport {\n CallExecutionError,\n type CallExecutionErrorType,\n ContractFunctionExecutionError,\n type ContractFunctionExecutionErrorType,\n ContractFunctionRevertedError,\n type ContractFunctionRevertedErrorType,\n ContractFunctionZeroDataError,\n type ContractFunctionZeroDataErrorType,\n CounterfactualDeploymentFailedError,\n type CounterfactualDeploymentFailedErrorType,\n RawContractError,\n type RawContractErrorType,\n} from './errors/contract.js'\nexport {\n SizeExceedsPaddingSizeError,\n type SizeExceedsPaddingSizeErrorType,\n SliceOffsetOutOfBoundsError,\n type SliceOffsetOutOfBoundsErrorType,\n} from './errors/data.js'\nexport {\n IntegerOutOfRangeError,\n type IntegerOutOfRangeErrorType,\n InvalidBytesBooleanError,\n type InvalidBytesBooleanErrorType,\n InvalidHexBooleanError,\n type InvalidHexBooleanErrorType,\n InvalidHexValueError,\n type InvalidHexValueErrorType,\n SizeOverflowError,\n type SizeOverflowErrorType,\n} from './errors/encoding.js'\nexport {\n type EnsAvatarInvalidMetadataError,\n type EnsAvatarInvalidMetadataErrorType,\n EnsAvatarInvalidNftUriError,\n type EnsAvatarInvalidNftUriErrorType,\n EnsAvatarUnsupportedNamespaceError,\n type EnsAvatarUnsupportedNamespaceErrorType,\n EnsAvatarUriResolutionError,\n type EnsAvatarUriResolutionErrorType,\n EnsInvalidChainIdError,\n type EnsInvalidChainIdErrorType,\n} from './errors/ens.js'\nexport {\n EstimateGasExecutionError,\n type EstimateGasExecutionErrorType,\n} from './errors/estimateGas.js'\nexport {\n BaseFeeScalarError,\n type BaseFeeScalarErrorType,\n Eip1559FeesNotSupportedError,\n type Eip1559FeesNotSupportedErrorType,\n MaxFeePerGasTooLowError,\n type MaxFeePerGasTooLowErrorType,\n} from './errors/fee.js'\nexport {\n FilterTypeNotSupportedError,\n type FilterTypeNotSupportedErrorType,\n} from './errors/log.js'\nexport {\n ExecutionRevertedError,\n type ExecutionRevertedErrorType,\n FeeCapTooHighError,\n type FeeCapTooHighErrorType,\n FeeCapTooLowError,\n type FeeCapTooLowErrorType,\n InsufficientFundsError,\n type InsufficientFundsErrorType,\n IntrinsicGasTooHighError,\n type IntrinsicGasTooHighErrorType,\n IntrinsicGasTooLowError,\n type IntrinsicGasTooLowErrorType,\n NonceMaxValueError,\n type NonceMaxValueErrorType,\n NonceTooHighError,\n type NonceTooHighErrorType,\n NonceTooLowError,\n type NonceTooLowErrorType,\n TipAboveFeeCapError,\n type TipAboveFeeCapErrorType,\n TransactionTypeNotSupportedError,\n type TransactionTypeNotSupportedErrorType,\n UnknownNodeError,\n type UnknownNodeErrorType,\n} from './errors/node.js'\nexport {\n HttpRequestError,\n type HttpRequestErrorType,\n RpcRequestError,\n type RpcRequestErrorType,\n SocketClosedError,\n type SocketClosedErrorType,\n TimeoutError,\n type TimeoutErrorType,\n WebSocketRequestError,\n type WebSocketRequestErrorType,\n} from './errors/request.js'\nexport {\n AtomicityNotSupportedError,\n type AtomicityNotSupportedErrorType,\n AtomicReadyWalletRejectedUpgradeError,\n type AtomicReadyWalletRejectedUpgradeErrorType,\n BundleTooLargeError,\n type BundleTooLargeErrorType,\n ChainDisconnectedError,\n type ChainDisconnectedErrorType,\n DuplicateIdError,\n type DuplicateIdErrorType,\n InternalRpcError,\n type InternalRpcErrorType,\n InvalidInputRpcError,\n type InvalidInputRpcErrorType,\n InvalidParamsRpcError,\n type InvalidParamsRpcErrorType,\n InvalidRequestRpcError,\n type InvalidRequestRpcErrorType,\n JsonRpcVersionUnsupportedError,\n type JsonRpcVersionUnsupportedErrorType,\n LimitExceededRpcError,\n type LimitExceededRpcErrorType,\n MethodNotFoundRpcError,\n type MethodNotFoundRpcErrorType,\n MethodNotSupportedRpcError,\n type MethodNotSupportedRpcErrorType,\n ParseRpcError,\n type ParseRpcErrorType,\n ProviderDisconnectedError,\n type ProviderDisconnectedErrorType,\n ProviderRpcError,\n type ProviderRpcErrorCode,\n type ProviderRpcErrorType,\n ResourceNotFoundRpcError,\n type ResourceNotFoundRpcErrorType,\n ResourceUnavailableRpcError,\n type ResourceUnavailableRpcErrorType,\n RpcError,\n type RpcErrorCode,\n type RpcErrorType,\n SwitchChainError,\n TransactionRejectedRpcError,\n type TransactionRejectedRpcErrorType,\n UnauthorizedProviderError,\n type UnauthorizedProviderErrorType,\n UnknownBundleIdError,\n type UnknownBundleIdErrorType,\n UnknownRpcError,\n type UnknownRpcErrorType,\n UnsupportedChainIdError,\n type UnsupportedChainIdErrorType,\n UnsupportedNonOptionalCapabilityError,\n type UnsupportedNonOptionalCapabilityErrorType,\n UnsupportedProviderMethodError,\n type UnsupportedProviderMethodErrorType,\n UserRejectedRequestError,\n type UserRejectedRequestErrorType,\n} from './errors/rpc.js'\nexport {\n AccountStateConflictError,\n type AccountStateConflictErrorType,\n StateAssignmentConflictError,\n type StateAssignmentConflictErrorType,\n} from './errors/stateOverride.js'\nexport {\n FeeConflictError,\n type FeeConflictErrorType,\n InvalidLegacyVError,\n type InvalidLegacyVErrorType,\n InvalidSerializableTransactionError,\n type InvalidSerializableTransactionErrorType,\n InvalidSerializedTransactionError,\n type InvalidSerializedTransactionErrorType,\n InvalidSerializedTransactionTypeError,\n type InvalidSerializedTransactionTypeErrorType,\n InvalidStorageKeySizeError,\n type InvalidStorageKeySizeErrorType,\n TransactionExecutionError,\n type TransactionExecutionErrorType,\n TransactionNotFoundError,\n type TransactionNotFoundErrorType,\n TransactionReceiptNotFoundError,\n type TransactionReceiptNotFoundErrorType,\n WaitForTransactionReceiptTimeoutError,\n type WaitForTransactionReceiptTimeoutErrorType,\n} from './errors/transaction.js'\nexport {\n UrlRequiredError,\n type UrlRequiredErrorType,\n} from './errors/transport.js'\nexport {\n InvalidDomainError,\n type InvalidDomainErrorType,\n InvalidPrimaryTypeError,\n type InvalidPrimaryTypeErrorType,\n InvalidStructTypeError,\n type InvalidStructTypeErrorType,\n} from './errors/typedData.js'\nexport {\n InvalidDecimalNumberError,\n type InvalidDecimalNumberErrorType,\n} from './errors/unit.js'\nexport type {\n DeriveAccount,\n HDKey,\n ParseAccount,\n} from './types/account.js'\nexport type {\n Authorization,\n AuthorizationList,\n AuthorizationRequest,\n SerializedAuthorization,\n SerializedAuthorizationList,\n SignedAuthorization,\n SignedAuthorizationList,\n} from './types/authorization.js'\nexport type {\n Block,\n BlockIdentifier,\n BlockNumber,\n BlockTag,\n Uncle,\n} from './types/block.js'\nexport type { Call, Calls } from './types/calls.js'\nexport type {\n Capabilities,\n /** @deprecated Use `Capabilities` instead. */\n Capabilities as WalletCapabilities,\n CapabilitiesSchema,\n /** @deprecated Use `ChainIdToCapabilities` instead. */\n ChainIdToCapabilities as WalletCapabilitiesRecord,\n ChainIdToCapabilities,\n ExtractCapabilities,\n} from './types/capabilities.js'\nexport type {\n Chain,\n ChainConfig,\n ChainContract,\n ChainEstimateFeesPerGasFn,\n ChainEstimateFeesPerGasFnParameters,\n ChainFees,\n ChainFeesFnParameters,\n ChainFormatter,\n ChainFormatters,\n ChainMaxPriorityFeePerGasFn,\n ChainSerializers,\n DeriveChain,\n ExtractChainFormatterExclude,\n ExtractChainFormatterParameters,\n ExtractChainFormatterReturnType,\n GetChainParameter,\n} from './types/chain.js'\nexport type {\n AbiEventParametersToPrimitiveTypes,\n AbiEventParameterToPrimitiveType,\n AbiEventTopicToPrimitiveType,\n AbiItem,\n AbiItemArgs,\n AbiItemName,\n ContractConstructorArgs,\n ContractErrorArgs,\n ContractErrorName,\n ContractEventArgs,\n ContractEventArgsFromTopics,\n ContractEventName,\n ContractFunctionArgs,\n ContractFunctionName,\n ContractFunctionParameters,\n ContractFunctionReturnType,\n EventDefinition,\n ExtractAbiFunctionForArgs,\n ExtractAbiItem,\n ExtractAbiItemForArgs,\n ExtractAbiItemNames,\n GetEventArgs,\n GetValue,\n LogTopicType,\n MaybeAbiEventName,\n MaybeExtractEventArgsFromAbi,\n UnionWiden,\n Widen,\n} from './types/contract.js'\nexport type {\n AddEthereumChainParameter,\n BundlerRpcSchema,\n DebugBundlerRpcSchema,\n EIP1193EventMap,\n EIP1193Events,\n EIP1193Parameters,\n EIP1193Provider,\n EIP1193RequestFn,\n EIP1474Methods,\n NetworkSync,\n PaymasterRpcSchema,\n ProviderConnectInfo,\n ProviderMessage,\n ProviderRpcErrorType as EIP1193ProviderRpcErrorType,\n PublicRpcSchema,\n RpcSchema,\n RpcSchemaOverride,\n TestRpcSchema,\n WalletCallReceipt,\n WalletGetAssetsParameters,\n WalletGetAssetsReturnType,\n WalletGetCallsStatusReturnType,\n WalletGrantPermissionsParameters,\n WalletGrantPermissionsReturnType,\n WalletPermission,\n WalletPermissionCaveat,\n WalletRpcSchema,\n WalletSendCallsParameters,\n WalletSendCallsReturnType,\n WatchAssetParams,\n} from './types/eip1193.js'\nexport { ProviderRpcError as EIP1193ProviderRpcError } from './types/eip1193.js'\nexport type { BlobSidecar, BlobSidecars } from './types/eip4844.js'\nexport type { AssetGateway, AssetGatewayUrls } from './types/ens.js'\nexport type {\n FeeHistory,\n FeeValues,\n FeeValuesEIP1559,\n FeeValuesEIP4844,\n FeeValuesLegacy,\n FeeValuesType,\n} from './types/fee.js'\nexport type { Filter, FilterType } from './types/filter.js'\nexport type { GetTransactionRequestKzgParameter, Kzg } from './types/kzg.js'\nexport type { Log } from './types/log.js'\nexport type {\n ByteArray,\n CompactSignature,\n Hash,\n Hex,\n LogTopic,\n SignableMessage,\n Signature,\n} from './types/misc.js'\nexport type {\n MulticallContracts,\n MulticallResponse,\n MulticallResults,\n} from './types/multicall.js'\nexport type { Register, ResolvedRegister } from './types/register.js'\nexport type {\n Index,\n Quantity,\n RpcAccountStateOverride,\n RpcAuthorization,\n RpcAuthorizationList,\n RpcBlock,\n RpcBlockIdentifier,\n RpcBlockNumber,\n RpcFeeHistory,\n RpcFeeValues,\n RpcLog,\n RpcProof,\n RpcStateMapping,\n RpcStateOverride,\n RpcTransaction,\n RpcTransactionReceipt,\n RpcTransactionRequest,\n RpcUncle,\n Status,\n} from './types/rpc.js'\nexport type {\n StateMapping,\n StateOverride,\n} from './types/stateOverride.js'\nexport type {\n AccessList,\n Transaction,\n TransactionBase,\n TransactionEIP1559,\n TransactionEIP2930,\n TransactionEIP4844,\n TransactionEIP7702,\n TransactionLegacy,\n TransactionReceipt,\n TransactionRequest,\n TransactionRequestBase,\n TransactionRequestEIP1559,\n TransactionRequestEIP2930,\n TransactionRequestEIP4844,\n TransactionRequestEIP7702,\n TransactionRequestGeneric,\n TransactionRequestLegacy,\n TransactionSerializable,\n TransactionSerializableBase,\n TransactionSerializableEIP1559,\n TransactionSerializableEIP2930,\n TransactionSerializableEIP4844,\n TransactionSerializableEIP7702,\n TransactionSerializableGeneric,\n TransactionSerializableLegacy,\n TransactionSerialized,\n TransactionSerializedEIP1559,\n TransactionSerializedEIP2930,\n TransactionSerializedEIP4844,\n TransactionSerializedEIP7702,\n TransactionSerializedGeneric,\n TransactionSerializedLegacy,\n TransactionType,\n} from './types/transaction.js'\nexport type { GetPollOptions, GetTransportConfig } from './types/transport.js'\nexport type {\n EIP712DomainDefinition,\n MessageDefinition,\n TypedDataDefinition,\n} from './types/typedData.js'\nexport type {\n Assign,\n Branded,\n Evaluate,\n ExactPartial,\n ExactRequired,\n IsNarrowable,\n IsNever,\n IsUndefined,\n IsUnion,\n LooseOmit,\n MaybePartial,\n MaybePromise,\n MaybeRequired,\n Mutable,\n NoInfer,\n NoUndefined,\n Omit,\n OneOf,\n Or,\n PartialBy,\n Prettify,\n RequiredBy,\n Some,\n UnionEvaluate,\n UnionLooseOmit,\n UnionOmit,\n UnionPartialBy,\n UnionPick,\n UnionRequiredBy,\n UnionToTuple,\n ValueOf,\n} from './types/utils.js'\nexport type { Withdrawal } from './types/withdrawal.js'\nexport {\n type DecodeAbiParametersErrorType,\n type DecodeAbiParametersReturnType,\n decodeAbiParameters,\n} from './utils/abi/decodeAbiParameters.js'\nexport {\n type DecodeDeployDataErrorType,\n type DecodeDeployDataParameters,\n type DecodeDeployDataReturnType,\n decodeDeployData,\n} from './utils/abi/decodeDeployData.js'\nexport {\n type DecodeErrorResultErrorType,\n type DecodeErrorResultParameters,\n type DecodeErrorResultReturnType,\n decodeErrorResult,\n} from './utils/abi/decodeErrorResult.js'\nexport {\n type DecodeEventLogErrorType,\n type DecodeEventLogParameters,\n type DecodeEventLogReturnType,\n decodeEventLog,\n} from './utils/abi/decodeEventLog.js'\nexport {\n type DecodeFunctionDataErrorType,\n type DecodeFunctionDataParameters,\n type DecodeFunctionDataReturnType,\n decodeFunctionData,\n} from './utils/abi/decodeFunctionData.js'\nexport {\n type DecodeFunctionResultErrorType,\n type DecodeFunctionResultParameters,\n type DecodeFunctionResultReturnType,\n decodeFunctionResult,\n} from './utils/abi/decodeFunctionResult.js'\nexport {\n type EncodeAbiParametersErrorType,\n type EncodeAbiParametersReturnType,\n encodeAbiParameters,\n} from './utils/abi/encodeAbiParameters.js'\nexport {\n type EncodeDeployDataErrorType,\n type EncodeDeployDataParameters,\n type EncodeDeployDataReturnType,\n encodeDeployData,\n} from './utils/abi/encodeDeployData.js'\nexport {\n type EncodeErrorResultErrorType,\n type EncodeErrorResultParameters,\n type EncodeErrorResultReturnType,\n encodeErrorResult,\n} from './utils/abi/encodeErrorResult.js'\nexport {\n type EncodeEventTopicsErrorType,\n type EncodeEventTopicsParameters,\n type EncodeEventTopicsReturnType,\n encodeEventTopics,\n} from './utils/abi/encodeEventTopics.js'\nexport {\n type EncodeFunctionDataErrorType,\n type EncodeFunctionDataParameters,\n type EncodeFunctionDataReturnType,\n encodeFunctionData,\n} from './utils/abi/encodeFunctionData.js'\nexport {\n type EncodeFunctionResultErrorType,\n type EncodeFunctionResultParameters,\n type EncodeFunctionResultReturnType,\n encodeFunctionResult,\n} from './utils/abi/encodeFunctionResult.js'\nexport {\n type EncodePackedErrorType,\n encodePacked,\n} from './utils/abi/encodePacked.js'\nexport {\n type GetAbiItemErrorType,\n type GetAbiItemParameters,\n type GetAbiItemReturnType,\n getAbiItem,\n} from './utils/abi/getAbiItem.js'\nexport {\n type ParseEventLogsErrorType,\n type ParseEventLogsParameters,\n type ParseEventLogsReturnType,\n parseEventLogs,\n} from './utils/abi/parseEventLogs.js'\nexport {\n type PrepareEncodeFunctionDataErrorType,\n type PrepareEncodeFunctionDataParameters,\n type PrepareEncodeFunctionDataReturnType,\n prepareEncodeFunctionData,\n} from './utils/abi/prepareEncodeFunctionData.js'\nexport {\n type ChecksumAddressErrorType,\n checksumAddress,\n type GetAddressErrorType,\n getAddress,\n} from './utils/address/getAddress.js'\nexport {\n type GetContractAddressOptions,\n type GetCreate2AddressErrorType,\n type GetCreate2AddressOptions,\n type GetCreateAddressErrorType,\n type GetCreateAddressOptions,\n getContractAddress,\n getCreate2Address,\n getCreateAddress,\n} from './utils/address/getContractAddress.js'\nexport {\n type IsAddressErrorType,\n type IsAddressOptions,\n isAddress,\n} from './utils/address/isAddress.js'\nexport {\n type IsAddressEqualErrorType,\n type IsAddressEqualReturnType,\n isAddressEqual,\n} from './utils/address/isAddressEqual.js'\nexport {\n type BlobsToCommitmentsErrorType,\n type BlobsToCommitmentsParameters,\n type BlobsToCommitmentsReturnType,\n blobsToCommitments,\n} from './utils/blob/blobsToCommitments.js'\nexport {\n blobsToProofs,\n type blobsToProofsErrorType,\n type blobsToProofsParameters,\n type blobsToProofsReturnType,\n} from './utils/blob/blobsToProofs.js'\nexport {\n type CommitmentsToVersionedHashesErrorType,\n type CommitmentsToVersionedHashesParameters,\n type CommitmentsToVersionedHashesReturnType,\n commitmentsToVersionedHashes,\n} from './utils/blob/commitmentsToVersionedHashes.js'\nexport {\n type CommitmentToVersionedHashErrorType,\n type CommitmentToVersionedHashParameters,\n type CommitmentToVersionedHashReturnType,\n commitmentToVersionedHash,\n} from './utils/blob/commitmentToVersionedHash.js'\nexport {\n type FromBlobsErrorType,\n type FromBlobsParameters,\n type FromBlobsReturnType,\n fromBlobs,\n} from './utils/blob/fromBlobs.js'\nexport {\n type SidecarsToVersionedHashesErrorType,\n type SidecarsToVersionedHashesParameters,\n type SidecarsToVersionedHashesReturnType,\n sidecarsToVersionedHashes,\n} from './utils/blob/sidecarsToVersionedHashes.js'\nexport {\n type ToBlobSidecarsErrorType,\n type ToBlobSidecarsParameters,\n type ToBlobSidecarsReturnType,\n toBlobSidecars,\n} from './utils/blob/toBlobSidecars.js'\nexport {\n type ToBlobsErrorType,\n type ToBlobsParameters,\n type ToBlobsReturnType,\n toBlobs,\n} from './utils/blob/toBlobs.js'\nexport {\n type CcipRequestErrorType,\n type CcipRequestParameters,\n ccipRequest,\n /** @deprecated Use `ccipRequest`. */\n ccipRequest as ccipFetch,\n type OffchainLookupErrorType,\n offchainLookup,\n offchainLookupAbiItem,\n offchainLookupSignature,\n} from './utils/ccip.js'\nexport {\n type AssertCurrentChainErrorType,\n type AssertCurrentChainParameters,\n assertCurrentChain,\n} from './utils/chain/assertCurrentChain.js'\nexport { defineChain } from './utils/chain/defineChain.js'\nexport {\n type ExtractChainErrorType,\n type ExtractChainParameters,\n type ExtractChainReturnType,\n extractChain,\n} from './utils/chain/extractChain.js'\nexport {\n type GetChainContractAddressErrorType,\n getChainContractAddress,\n} from './utils/chain/getChainContractAddress.js'\nexport {\n type ConcatBytesErrorType,\n type ConcatErrorType,\n type ConcatHexErrorType,\n type ConcatReturnType,\n concat,\n concatBytes,\n concatHex,\n} from './utils/data/concat.js'\nexport { type IsBytesErrorType, isBytes } from './utils/data/isBytes.js'\nexport { type IsHexErrorType, isHex } from './utils/data/isHex.js'\nexport {\n type PadBytesErrorType,\n type PadErrorType,\n type PadHexErrorType,\n type PadReturnType,\n pad,\n padBytes,\n padHex,\n} from './utils/data/pad.js'\nexport { type SizeErrorType, size } from './utils/data/size.js'\nexport {\n type SliceBytesErrorType,\n type SliceErrorType,\n type SliceHexErrorType,\n slice,\n sliceBytes,\n sliceHex,\n} from './utils/data/slice.js'\nexport {\n type TrimErrorType,\n type TrimReturnType,\n trim,\n} from './utils/data/trim.js'\nexport {\n type BytesToBigIntErrorType,\n type BytesToBigIntOpts,\n type BytesToBoolErrorType,\n type BytesToBoolOpts,\n type BytesToNumberErrorType,\n type BytesToNumberOpts,\n type BytesToStringErrorType,\n type BytesToStringOpts,\n bytesToBigInt,\n bytesToBool,\n bytesToNumber,\n bytesToString,\n type FromBytesErrorType,\n type FromBytesParameters,\n fromBytes,\n} from './utils/encoding/fromBytes.js'\nexport {\n type FromHexErrorType,\n fromHex,\n type HexToBigIntErrorType,\n type HexToBoolErrorType,\n type HexToNumberErrorType,\n type HexToStringErrorType,\n hexToBigInt,\n hexToBool,\n hexToNumber,\n hexToString,\n} from './utils/encoding/fromHex.js'\nexport {\n type FromRlpErrorType,\n type FromRlpReturnType,\n fromRlp,\n} from './utils/encoding/fromRlp.js'\nexport {\n type BoolToBytesErrorType,\n type BoolToBytesOpts,\n boolToBytes,\n type HexToBytesErrorType,\n type HexToBytesOpts,\n hexToBytes,\n type NumberToBytesErrorType,\n numberToBytes,\n type StringToBytesErrorType,\n type StringToBytesOpts,\n stringToBytes,\n type ToBytesErrorType,\n type ToBytesParameters,\n toBytes,\n} from './utils/encoding/toBytes.js'\nexport {\n type BoolToHexErrorType,\n type BoolToHexOpts,\n type BytesToHexErrorType,\n type BytesToHexOpts,\n boolToHex,\n bytesToHex,\n type NumberToHexErrorType,\n type NumberToHexOpts,\n numberToHex,\n type StringToHexErrorType,\n type StringToHexOpts,\n stringToHex,\n type ToHexErrorType,\n type ToHexParameters,\n toHex,\n} from './utils/encoding/toHex.js'\nexport {\n type BytesToRlpErrorType,\n bytesToRlp,\n type HexToRlpErrorType,\n hexToRlp,\n type ToRlpErrorType,\n type ToRlpReturnType,\n toRlp,\n} from './utils/encoding/toRlp.js'\nexport { type LabelhashErrorType, labelhash } from './utils/ens/labelhash.js'\nexport { type NamehashErrorType, namehash } from './utils/ens/namehash.js'\nexport {\n type ToCoinTypeError,\n toCoinType,\n} from './utils/ens/toCoinType.js'\nexport {\n type GetContractErrorReturnType,\n getContractError,\n} from './utils/errors/getContractError.js'\nexport {\n type DefineBlockErrorType,\n defineBlock,\n type FormatBlockErrorType,\n type FormattedBlock,\n formatBlock,\n} from './utils/formatters/block.js'\nexport { type FormatLogErrorType, formatLog } from './utils/formatters/log.js'\nexport {\n type DefineTransactionErrorType,\n defineTransaction,\n type FormatTransactionErrorType,\n type FormattedTransaction,\n formatTransaction,\n transactionType,\n} from './utils/formatters/transaction.js'\nexport {\n type DefineTransactionReceiptErrorType,\n defineTransactionReceipt,\n type FormatTransactionReceiptErrorType,\n type FormattedTransactionReceipt,\n formatTransactionReceipt,\n} from './utils/formatters/transactionReceipt.js'\nexport {\n type DefineTransactionRequestErrorType,\n defineTransactionRequest,\n type FormatTransactionRequestErrorType,\n type FormattedTransactionRequest,\n formatTransactionRequest,\n rpcTransactionType,\n} from './utils/formatters/transactionRequest.js'\nexport { type IsHashErrorType, isHash } from './utils/hash/isHash.js'\nexport {\n type Keccak256ErrorType,\n type Keccak256Hash,\n keccak256,\n} from './utils/hash/keccak256.js'\nexport {\n type Ripemd160ErrorType,\n type Ripemd160Hash,\n ripemd160,\n} from './utils/hash/ripemd160.js'\nexport {\n type Sha256ErrorType,\n type Sha256Hash,\n sha256,\n} from './utils/hash/sha256.js'\nexport {\n type ToEventHashErrorType,\n toEventHash,\n} from './utils/hash/toEventHash.js'\nexport {\n type ToEventSelectorErrorType,\n /** @deprecated use `ToEventSelectorErrorType`. */\n type ToEventSelectorErrorType as GetEventSelectorErrorType,\n toEventSelector,\n /** @deprecated use `toEventSelector`. */\n toEventSelector as getEventSelector,\n} from './utils/hash/toEventSelector.js'\nexport {\n type ToEventSignatureErrorType,\n /** @deprecated use `ToEventSignatureErrorType`. */\n type ToEventSignatureErrorType as GetEventSignatureErrorType,\n toEventSignature,\n /** @deprecated use `toEventSignature`. */\n toEventSignature as getEventSignature,\n} from './utils/hash/toEventSignature.js'\nexport {\n type ToFunctionHashErrorType,\n toFunctionHash,\n} from './utils/hash/toFunctionHash.js'\nexport {\n type ToFunctionSelectorErrorType,\n /** @deprecated use `ToFunctionSelectorErrorType`. */\n type ToFunctionSelectorErrorType as GetFunctionSelectorErrorType,\n toFunctionSelector,\n /** @deprecated use `toFunctionSelector`. */\n toFunctionSelector as getFunctionSelector,\n} from './utils/hash/toFunctionSelector.js'\nexport {\n type ToFunctionSignatureErrorType,\n /** @deprecated use `ToFunctionSignatureErrorType`. */\n type ToFunctionSignatureErrorType as GetFunctionSignatureErrorType,\n toFunctionSignature,\n /** @deprecated use `toFunctionSignature`. */\n toFunctionSignature as getFunctionSignature,\n} from './utils/hash/toFunctionSignature.js'\nexport {\n type DefineKzgErrorType,\n type DefineKzgParameters,\n type DefineKzgReturnType,\n defineKzg,\n} from './utils/kzg/defineKzg.js'\nexport {\n type SetupKzgErrorType,\n type SetupKzgParameters,\n type SetupKzgReturnType,\n setupKzg,\n} from './utils/kzg/setupKzg.js'\nexport {\n type CreateNonceManagerParameters,\n createNonceManager,\n type NonceManager,\n type NonceManagerSource,\n nonceManager,\n} from './utils/nonceManager.js'\nexport { withCache } from './utils/promise/withCache.js'\nexport {\n type WithRetryErrorType,\n withRetry,\n} from './utils/promise/withRetry.js'\nexport {\n type WithTimeoutErrorType,\n withTimeout,\n} from './utils/promise/withTimeout.js'\nexport {\n type CompactSignatureToSignatureErrorType,\n compactSignatureToSignature,\n} from './utils/signature/compactSignatureToSignature.js'\nexport {\n type HashMessageErrorType,\n hashMessage,\n} from './utils/signature/hashMessage.js'\nexport {\n type HashDomainErrorType,\n type HashStructErrorType,\n type HashTypedDataErrorType,\n type HashTypedDataParameters,\n type HashTypedDataReturnType,\n hashDomain,\n hashStruct,\n hashTypedData,\n} from './utils/signature/hashTypedData.js'\nexport {\n type IsErc6492SignatureErrorType,\n type IsErc6492SignatureParameters,\n type IsErc6492SignatureReturnType,\n isErc6492Signature,\n} from './utils/signature/isErc6492Signature.js'\nexport {\n type IsErc8010SignatureErrorType,\n type IsErc8010SignatureParameters,\n type IsErc8010SignatureReturnType,\n isErc8010Signature,\n} from './utils/signature/isErc8010Signature.js'\nexport {\n /** @deprecated Use `ParseCompactSignatureErrorType`. */\n type ParseCompactSignatureErrorType as HexToCompactSignatureErrorType,\n type ParseCompactSignatureErrorType,\n /** @deprecated Use `parseCompactSignature`. */\n parseCompactSignature as hexToCompactSignature,\n parseCompactSignature,\n} from './utils/signature/parseCompactSignature.js'\nexport {\n type ParseErc6492SignatureErrorType,\n type ParseErc6492SignatureParameters,\n type ParseErc6492SignatureReturnType,\n parseErc6492Signature,\n} from './utils/signature/parseErc6492Signature.js'\nexport {\n type ParseErc8010SignatureErrorType,\n type ParseErc8010SignatureParameters,\n type ParseErc8010SignatureReturnType,\n parseErc8010Signature,\n} from './utils/signature/parseErc8010Signature.js'\nexport {\n /** @deprecated Use `ParseSignatureErrorType`. */\n type ParseSignatureErrorType as HexToSignatureErrorType,\n type ParseSignatureErrorType,\n /** @deprecated Use `parseSignature`. */\n parseSignature as hexToSignature,\n parseSignature,\n} from './utils/signature/parseSignature.js'\nexport {\n type RecoverAddressErrorType,\n type RecoverAddressParameters,\n type RecoverAddressReturnType,\n recoverAddress,\n} from './utils/signature/recoverAddress.js'\nexport {\n type RecoverMessageAddressErrorType,\n type RecoverMessageAddressParameters,\n type RecoverMessageAddressReturnType,\n recoverMessageAddress,\n} from './utils/signature/recoverMessageAddress.js'\nexport {\n type RecoverPublicKeyErrorType,\n type RecoverPublicKeyParameters,\n type RecoverPublicKeyReturnType,\n recoverPublicKey,\n} from './utils/signature/recoverPublicKey.js'\nexport {\n type RecoverTransactionAddressErrorType,\n type RecoverTransactionAddressParameters,\n type RecoverTransactionAddressReturnType,\n recoverTransactionAddress,\n} from './utils/signature/recoverTransactionAddress.js'\nexport {\n type RecoverTypedDataAddressErrorType,\n type RecoverTypedDataAddressParameters,\n type RecoverTypedDataAddressReturnType,\n recoverTypedDataAddress,\n} from './utils/signature/recoverTypedDataAddress.js'\nexport {\n /** @deprecated Use `SignatureToHexErrorType` instead. */\n type SerializeCompactSignatureErrorType as CompactSignatureToHexErrorType,\n type SerializeCompactSignatureErrorType,\n /** @deprecated Use `serializeCompactSignature` instead. */\n serializeCompactSignature as compactSignatureToHex,\n serializeCompactSignature,\n} from './utils/signature/serializeCompactSignature.js'\nexport {\n type SerializeErc6492SignatureErrorType,\n type SerializeErc6492SignatureParameters,\n type SerializeErc6492SignatureReturnType,\n serializeErc6492Signature,\n} from './utils/signature/serializeErc6492Signature.js'\nexport {\n type SerializeErc8010SignatureErrorType,\n type SerializeErc8010SignatureParameters,\n type SerializeErc8010SignatureReturnType,\n serializeErc8010Signature,\n} from './utils/signature/serializeErc8010Signature.js'\nexport {\n /** @deprecated Use `SignatureToHexErrorType` instead. */\n type SerializeSignatureErrorType as SignatureToHexErrorType,\n type SerializeSignatureErrorType,\n type SerializeSignatureParameters,\n type SerializeSignatureReturnType,\n /** @deprecated Use `serializeSignature` instead. */\n serializeSignature as signatureToHex,\n serializeSignature,\n} from './utils/signature/serializeSignature.js'\nexport {\n type SignatureToCompactSignatureErrorType,\n signatureToCompactSignature,\n} from './utils/signature/signatureToCompactSignature.js'\nexport {\n type ToPrefixedMessageErrorType,\n toPrefixedMessage,\n} from './utils/signature/toPrefixedMessage.js'\nexport {\n type VerifyHashErrorType,\n type VerifyHashParameters,\n type VerifyHashReturnType,\n verifyHash,\n} from './utils/signature/verifyHash.js'\nexport {\n type VerifyMessageErrorType,\n type VerifyMessageParameters,\n type VerifyMessageReturnType,\n verifyMessage,\n} from './utils/signature/verifyMessage.js'\nexport {\n type VerifyTypedDataErrorType,\n type VerifyTypedDataParameters,\n type VerifyTypedDataReturnType,\n verifyTypedData,\n} from './utils/signature/verifyTypedData.js'\nexport { type StringifyErrorType, stringify } from './utils/stringify.js'\nexport {\n type AssertRequestErrorType,\n assertRequest,\n} from './utils/transaction/assertRequest.js'\nexport {\n type AssertTransactionEIP1559ErrorType,\n type AssertTransactionEIP2930ErrorType,\n type AssertTransactionLegacyErrorType,\n assertTransactionEIP1559,\n assertTransactionEIP2930,\n assertTransactionLegacy,\n} from './utils/transaction/assertTransaction.js'\nexport {\n type GetSerializedTransactionType,\n type GetSerializedTransactionTypeErrorType,\n getSerializedTransactionType,\n} from './utils/transaction/getSerializedTransactionType.js'\nexport {\n type GetTransactionType,\n type GetTransactionTypeErrorType,\n getTransactionType,\n} from './utils/transaction/getTransactionType.js'\nexport {\n type ParseTransactionErrorType,\n type ParseTransactionReturnType,\n parseTransaction,\n} from './utils/transaction/parseTransaction.js'\nexport {\n type SerializeAccessListErrorType,\n serializeAccessList,\n} from './utils/transaction/serializeAccessList.js'\nexport {\n type SerializedTransactionReturnType,\n type SerializeTransactionErrorType,\n type SerializeTransactionFn,\n serializeTransaction,\n} from './utils/transaction/serializeTransaction.js'\nexport {\n type DomainSeparatorErrorType,\n domainSeparator,\n type GetTypesForEIP712DomainErrorType,\n getTypesForEIP712Domain,\n type SerializeTypedDataErrorType,\n serializeTypedData,\n type ValidateTypedDataErrorType,\n validateTypedData,\n} from './utils/typedData.js'\nexport {\n type FormatEtherErrorType,\n formatEther,\n} from './utils/unit/formatEther.js'\nexport {\n type FormatGweiErrorType,\n formatGwei,\n} from './utils/unit/formatGwei.js'\nexport {\n type FormatUnitsErrorType,\n formatUnits,\n} from './utils/unit/formatUnits.js'\nexport {\n type ParseEtherErrorType,\n parseEther,\n} from './utils/unit/parseEther.js'\nexport { type ParseGweiErrorType, parseGwei } from './utils/unit/parseGwei.js'\nexport {\n type ParseUnitsErrorType,\n parseUnits,\n} from './utils/unit/parseUnits.js'\n","/**\n * @module toJSON\n */\n\n/**\n * Interface for parameters passed to the toJSON function.\n * @template T The type of the object to be converted to JSON.\n */\nexport interface IToJSONParams<T extends { [key: string]: any } = { [key: string]: any }> {\n /** The object to convert. */\n obj: T;\n /** The depth for recursive conversion. Defaults to 0. */\n depth?: number;\n}\n\n/**\n * Checks if an object is a class instance (not a native JavaScript object like Array, Date, etc.).\n * @param {any} obj The object to check.\n * @returns {boolean} True if the object is a class instance, false otherwise.\n */\nfunction isClassInstance(obj: any): boolean {\n if (!obj) return false;\n\n const constructor = obj.constructor;\n const nativeConstructors = [Array, Date, RegExp, Map, Set, Promise, Function, Number, String, Boolean, Error, Object];\n\n if (nativeConstructors.includes(constructor)) {\n return false;\n }\n\n return true\n};\n\n/**\n * Recursively converts BigInt values in an object to strings.\n * @param {any} obj The object to convert.\n * @returns {any} The object with BigInts converted to strings.\n */\nfunction convertBigintsToStrings(obj: any): any {\n if (typeof obj === 'bigint') {\n return obj.toString() + \"n\";\n }\n\n if (typeof obj === 'object') {\n for (const key in obj) {\n obj[key] = convertBigintsToStrings(obj[key]);\n }\n }\n\n if (Array.isArray(obj)) {\n for (let i = 0; i < obj.length; i++) {\n obj[i] = convertBigintsToStrings(obj[i]);\n }\n }\n\n return obj;\n}\n\n/**\n * Converts an object, including its nested class instances and getter methods, into a plain JSON object.\n * BigInt values are converted to strings.\n *\n * @param params - The parameters for conversion.\n * @param params.obj - The object to convert.\n * @param [params.depth=0] - The depth for recursive conversion. Defaults to 0.\n * @returns A promise that resolves to the JSON representation of the object.\n */\nexport async function toJSON({ obj, depth = 0 }: IToJSONParams) {\n const data: any = {};\n const promises: Promise<any>[] = [];\n\n for (const key in obj) {\n // skip class related properties\n if (key === \"toJSON\" || key === \"constructor\" || key === \"client\" || key === \"persistenceManager\") continue;\n\n const prop: any = obj[key];\n\n if (typeof prop === \"function\") {\n // do not fetch getters if depth is 0\n if (depth === 0) continue;\n\n const promise = async () => {\n const value = await obj[key]();\n\n // if the value is a class instance, convert it to JSON recursively\n if (typeof value === \"object\" && isClassInstance(value)) return data[key] = await toJSON({ obj: value, depth: depth - 1 });\n\n data[key] = value;\n };\n\n promises.push(promise());\n };\n\n if (typeof prop === \"object\" && isClassInstance(prop)) {\n // If depth is 0, just flatten the object using recursion\n if (depth === 0) {\n const promise = async () => {\n data[key] = await toJSON({\n obj: prop,\n depth: depth - 1\n });\n };\n promises.push(promise());\n\n continue;\n };\n \n // If depth is not 0, fetch the object\n const promise = async () => {\n data[key] = await prop.toJSON({ depth: depth - 1 });\n };\n promises.push(promise());\n\n continue;\n };\n\n data[key] = prop;\n };\n\n await Promise.all(promises);\n\n return convertBigintsToStrings(data);\n};","import { Block as RawBlock, Hash, Hex, Withdrawal } from \"@mentaproject/core\";\n\nimport { Account } from \"./Account\";\nimport { Transaction } from \"./Transaction\";\nimport { JSONBlock } from \"../types/Block\";\nimport { toJSON } from \"../utils/toJSON\";\nimport { MentaClient } from \"./MentaClient\";\n\n/**\n * @description Represents a blockchain block with its properties and methods.\n * This class provides a structured way to access block-related data and interact with the blockchain client.\n */\nexport class Block implements Omit<RawBlock, \"miner\" | \"transactions\"> {\n /**\n * @description The base fee per gas for the block.\n */\n baseFeePerGas: bigint | null\n /**\n * @description The gas used for blobs in the block.\n */\n blobGasUsed: bigint\n /**\n * @description The block's difficulty.\n */\n difficulty: bigint\n /**\n * @description The excess blob gas in the block.\n */\n excessBlobGas: bigint\n /**\n * @description Extra data included in the block.\n */\n extraData: Hex\n /**\n * @description The gas limit for the block.\n */\n gasLimit: bigint\n /**\n * @description The gas used in the block.\n */\n gasUsed: bigint\n /**\n * @description The hash of the block.\n */\n hash: Hash | null\n /**\n * @description The logs bloom filter for the block.\n */\n logsBloom: Hex | null\n /**\n * @description The mix hash of the block.\n */\n mixHash: Hash\n /**\n * @description The nonce of the block.\n */\n nonce: Hex | null\n /**\n * @description The block number.\n */\n number: bigint | null\n /**\n * @description The parent beacon block root.\n */\n parentBeaconBlockRoot?: Hex\n /**\n * @description The hash of the parent block.\n */\n parentHash: Hash\n /**\n * @description The root of the receipts trie.\n */\n receiptsRoot: Hex\n /**\n * @description The seal fields of the block.\n */\n sealFields: Hex[]\n /**\n * @description The SHA3 uncles hash.\n */\n sha3Uncles: Hash\n /**\n * @description The size of the block in bytes.\n */\n size: bigint\n /**\n * @description The state root of the block.\n */\n stateRoot: Hash\n /**\n * @description The timestamp of the block.\n */\n timestamp: bigint\n /**\n * @description The total difficulty of the chain up to this block.\n */\n totalDifficulty: bigint | null\n /**\n * @description The root of the transactions trie.\n */\n transactionsRoot: Hash\n /**\n * @description The list of uncle hashes.\n */\n uncles: Hash[]\n /**\n * @description The list of withdrawals.\n */\n withdrawals?: Withdrawal[]\n /**\n * @description The root of the withdrawals trie.\n */\n withdrawalsRoot?: Hex\n\n /**\n * @description The miner of the block, represented as an Account instance.\n */\n miner: Account\n /**\n * @description The transactions included in the block, represented as an array of Transaction instances.\n */\n transactions?: Transaction[] | Hash[]\n\n /**\n * @description Creates an instance of Block.\n * @param client - The instance of MentaClient used to interact with the blockchain.\n * @param data The raw block data conforming to IBlockData.\n * @param includeTransactions Whether to include full transaction objects. Defaults to false.\n */\n constructor(public client: MentaClient, data: RawBlock) {\n this.baseFeePerGas = data.baseFeePerGas;\n this.blobGasUsed = data.blobGasUsed;\n this.difficulty = data.difficulty;\n this.excessBlobGas = data.excessBlobGas;\n this.extraData = data.extraData;\n this.gasLimit = data.gasLimit;\n this.gasUsed = data.gasUsed;\n this.hash = data.hash;\n this.logsBloom = data.logsBloom;\n this.mixHash = data.mixHash;\n this.nonce = data.nonce;\n this.number = data.number;\n this.parentBeaconBlockRoot = data.parentBeaconBlockRoot;\n this.parentHash = data.parentHash;\n this.receiptsRoot = data.receiptsRoot;\n this.sealFields = data.sealFields;\n this.sha3Uncles = data.sha3Uncles;\n this.size = data.size;\n this.stateRoot = data.stateRoot;\n this.timestamp = data.timestamp;\n this.totalDifficulty = data.totalDifficulty;\n this.transactionsRoot = data.transactionsRoot;\n this.uncles = data.uncles;\n this.withdrawals = data.withdrawals;\n this.withdrawalsRoot = data.withdrawalsRoot;\n\n this.miner = new Account(this.client, { address: data.miner});\n \n if (!data.transactions || data.transactions.length === 0) {\n const parsed = data.transactions.map((data) => typeof data === \"string\" ? data : new Transaction(this.client, data))\n this.transactions = parsed as Transaction[] | Hash[];\n }\n };\n\n protected includeTransactions(): this is this & { transactions: Transaction[] } {\n if (!this.transactions || this.transactions.length === 0) return false;\n return true\n }\n\n /**\n * @description Converts the Block instance to a JSON representation.\n * This method serializes the block's properties into a plain JavaScript object,\n * suitable for JSON serialization.\n * @param depth The depth of the conversion. Defaults to 1.\n * @returns A promise that resolves to the JSON representation of the block.\n */\n async toJSON<D extends number = 1>(depth: D): Promise<JSONBlock<D>> {\n return await toJSON({\n obj: {\n ...this,\n },\n depth\n });\n }\n};","/**\n * @module MentaClient\n */\nimport type { MentaAccountClient } from \"@mentaproject/core/types\";\nimport { createMentaAccount } from \"@mentaproject/core/clients\";\nimport { createClient } from \"@mentaproject/core\";\n\nimport { BlockManager } from \"../managers/BlockManager\";\nimport { TransactionManager } from \"../managers/TransactionManager\";\nimport { ContractManager } from \"../managers/ContractManager\";\nimport { AccountManager } from \"../managers/AccountManager\";\nimport { PersistenceManager } from \"../managers/PersistenceManager\";\nimport {\n ClientEvents,\n GetListenerCallback,\n MentaClientConfig,\n} from \"../types/MentaClient\";\nimport { withCache } from \"../utils/withCache\";\nimport { Account } from \"./Account\";\n\n/**\n * The main client for interacting with the Menta API.\n * It provides managers for blocks, transactions, contracts, and accounts.\n *\n * @description This class serves as the primary entry point for interacting with the Menta blockchain.\n * It encapsulates the core RPC client and provides specialized managers for various blockchain entities,\n * simplifying common operations.\n */\nexport class MentaClient {\n protected _rpc?: MentaAccountClient;\n protected _account?: Account;\n /**\n * The underlying RPC client used for blockchain interactions.\n * @description This client is responsible for low-level communication with the RPC node.\n */\n public get rpc(): MentaAccountClient {\n if (!this._rpc) {\n throw new Error(\"RPC client not initialized\");\n }\n return this._rpc;\n }\n\n /**\n * The account associated with the client.\n * @description This account is used for signing transactions and interacting with the blockchain.\n */\n public get account(): Account {\n if (!this._account) {\n throw new Error(\"Account not initialized\");\n }\n return this._account;\n }\n\n /**\n * Manager for block-related operations.\n * @description Provides methods to query and interact with blockchain blocks.\n */\n public blocks!: BlockManager;\n /**\n * Manager for transaction-related operations.\n * @description Provides methods to send, query, and manage blockchain transactions.\n */\n public transactions!: TransactionManager;\n /**\n * Manager for contract-related operations.\n * @description Provides methods to deploy, interact with, and query smart contracts.\n */\n public contracts!: ContractManager;\n /**\n * Manager for account-related operations.\n * @description Provides methods to manage and interact with blockchain accounts.\n */\n public accounts!: AccountManager;\n\n /**\n * Subscribes to a specific client event.\n * @template TEvent The type of the event to listen for.\n * @param {TEvent} event - The event to listen for (e.g., 'block', 'transaction').\n * @param {GetListenerCallback<TEvent>} callback - The callback function to execute when the event is triggered.\n * @returns {() => void} An unsubscribe function to stop listening to the event.\n * @description This method allows the client to listen for real-time events from the blockchain, such as new blocks or transactions.\n * @example\n * import { MentaClient } from '@mentaproject/client';\n *\n * const client = new MentaClient({ url: 'http://rpcurlhere.com' });\n *\n * // Subscribe to new blocks\n * const unsubscribe = client.on('block', (block) => {\n * console.log('New block received:', block);\n * });\n *\n * // To stop listening\n * // unsubscribe();\n */\n on<TEvent extends keyof typeof ClientEvents>(\n event: TEvent,\n callback: GetListenerCallback<TEvent>,\n ) {\n const eventFunction = ClientEvents[event];\n const capitalizedEvent = event.charAt(0).toUpperCase() + event.slice(1);\n const params = {\n [`on${capitalizedEvent}`]: callback,\n pollingInterval: 1000,\n };\n\n return (eventFunction as any)(this.rpc, params);\n }\n\n /**\n * Creates an instance of MentaClient.\n * @param {MentaClientConfig} params - The configuration parameters for the client.\n * @description The constructor initializes the RPC client and the various managers based on the provided configuration.\n * It also applies caching and persistence if specified in the configuration.\n * @example\n * import { MentaClient } from '@mentaproject/client';\n *\n * // Basic initialization\n * const client = new MentaClient({\n * url: 'http://rpcurlhere.com',\n * });\n *\n * // Initialization with a persistent cache\n * const clientWithCache = new MentaClient({\n * url: 'http://rpcurlhere.com',\n * cache: {\n * ttl: 60000, // 1 minute\n * },\n * });\n */\n constructor(protected params: MentaClientConfig) {\n this.blocks = new BlockManager(this);\n this.transactions = new TransactionManager(this);\n this.contracts = new ContractManager(this);\n\n if (params.persistenceAdapter) {\n this.persistenceManager = new PersistenceManager(\n this,\n params.persistenceAdapter,\n );\n this.accounts = new AccountManager(this, this.persistenceManager);\n } else {\n this.accounts = new AccountManager(this);\n }\n }\n\n async init() {\n let coreClient = createClient(this.params);\n\n if (this.params.cache) {\n coreClient = withCache(coreClient, this.params.cache);\n }\n\n this._rpc = await createMentaAccount(coreClient as any, {\n bundlerTransport: this.params.bundlerTransport,\n publicTransport: this.params.transport,\n signer: this.params.signer,\n validatorAddress: this.params.validatorAddress,\n });\n\n this._account = this.accounts.get(this.rpc.account.address);\n }\n\n /**\n * Optional manager for persistence-related operations.\n * @description This manager is initialized if a persistence adapter is provided in the client configuration,\n * allowing for data storage and retrieval.\n */\n public persistenceManager?: PersistenceManager;\n}\n","/**\n * @module BlockManager\n */\nimport { BlockTag, GetBlockParameters } from \"@mentaproject/core/types\";\nimport { Block } from \"../structures/Block\";\nimport { getBlock } from \"@mentaproject/core/actions\";\nimport { MentaClient } from \"../structures\";\n\n/**\n * Manages blockchain block-related operations, providing methods to interact with and retrieve block data.\n */\nexport class BlockManager {\n /**\n * Creates an instance of BlockManager.\n * @param client - The instance of MentaClient used to interact with the blockchain.\n */\n constructor(public client: MentaClient) {};\n\n /**\n * Retrieves a block from the blockchain based on the provided parameters.\n * This method uses the underlying RPC client to fetch block data and then\n * encapsulates it within a {@link Block} instance.\n * @param params The parameters for retrieving the block, including block hash, block number, or block tag.\n * @returns A promise that resolves to a {@link Block} instance representing the retrieved block.\n * @example\n * import { http } from '@mentaproject/core';\n * import { mainnet } from '@mentaproject/core/chains';\n * import { MentaClient } from '@mentaproject/client';\n *\n * // Initialize the MentaClient\n * const mentaClient = new MentaClient({ chain: mainnet, transport: http(\"http://rpcurlhere.com\") });\n *\n * async function fetchBlock() {\n * // Retrieve the latest block\n * const latestBlock = await mentaClient.blocks.get({ blockTag: 'latest' });\n * console.log('Latest block number:', latestBlock.number);\n *\n * // Retrieve a specific block by its number\n * if (latestBlock.number) {\n * const specificBlock = await mentaClient.blocks.get({ blockNumber: latestBlock.number - 10n });\n * console.log('Specific block hash:', specificBlock.hash);\n * }\n * }\n *\n * fetchBlock();\n */\n async get(params: GetBlockParameters<boolean, BlockTag>): Promise<Block> {\n const data = await getBlock(this.client.rpc, params);\n return new Block(this.client, data);\n };\n}","/**\n * @module TransactionManager\n */\nimport { GetTransactionParameters, Transaction as RawTransaction, SendTransactionParameters } from \"@mentaproject/core/types\";\nimport { Transaction } from \"../structures/Transaction\";\nimport { getTransaction, sendTransaction } from \"@mentaproject/core/actions\";\nimport { MentaClient } from \"../structures\";\nimport { JSONTransaction } from \"../types\";\nimport { parseBingints } from \"../utils/bigint\";\n\n/**\n * Manages blockchain transaction-related operations, providing methods to retrieve and send transactions.\n * @class\n * @description This class provides an interface to interact with blockchain transactions,\n * allowing for retrieval of transaction details and submission of new transactions\n * to the network via an RPC client.\n */\nexport class TransactionManager {\n /**\n * Creates an instance of `TransactionManager`.\n * @constructor\n * @param {MentaClient} client - The instance of MentaClient used to interact with the blockchain.\n */\n constructor(public client: MentaClient) {};\n\n /**\n * Retrieves a transaction by its hash or block number and index.\n * @description This method fetches detailed information about a specific transaction\n * from the blockchain using the provided parameters.\n * @param {GetTransactionParameters} params - The parameters for retrieving the transaction,\n * typically including `hash` or `blockNumber` and `index`.\n * @returns {Promise<Transaction>} A promise that resolves to a {@link Transaction} instance\n * containing the retrieved transaction data.\n * @example\n * const txHash = '0x...'; // Replace with a valid transaction hash\n * const transaction = await client.transactions.get({ hash: txHash });\n * console.log(transaction);\n */\n async get(params: GetTransactionParameters): Promise<Transaction> {\n const data = await getTransaction(this.client.rpc, params);\n return new Transaction(this.client, data);\n };\n\n /**\n * Parse a transaction object from a JSON converted transaction data object.\n * \n * @param {J} data - The JSON converted transaction data object.\n * @returns {Transaction} A Transaction instance representing the parsed transaction.\n */\n parse<J extends JSONTransaction<0>>(data: J): Transaction {\n const parsed = parseBingints(data);\n\n const rawData = {\n ...parsed,\n from: parsed.from.address,\n to: parsed.to ? parsed.to.address : null,\n };\n \n return new Transaction(this.client, rawData as RawTransaction);\n };\n\n /**\n * Sends a transaction to the blockchain network.\n * @description This method submits a new transaction to the blockchain. After the transaction\n * is successfully sent, it retrieves and returns the full transaction details.\n * @param {SendTransactionParameters} params - The parameters required to send the transaction,\n * such as `to`, `value`, `data`, `gasLimit`, etc.\n * @returns {Promise<Transaction>} A promise that resolves to a {@link Transaction} instance\n * representing the sent transaction, including its hash and other details.\n * @example\n * import { MentaClient } from '@mentaproject/client';\n * import { http } from '@mentaproject/core';\n *\n * // This example assumes you have an account with funds, which is available to the client.\n * const client = new MentaClient({\n * chain: 'mainnet',\n * transport: http('http://rpcurlhere.com')\n * });\n *\n * const transactionResult = await client.transactions.send({\n * to: '0xRecipientAddress...', // Replace with a valid recipient address\n * value: 1000000000000000000n, // 1 ETH in wei\n * });\n *\n * console.log('Transaction sent with hash:', transactionResult.hash);\n */\n async send(params: SendTransactionParameters): Promise<Transaction> {\n const hash = await sendTransaction(this.client.rpc, params);\n \n return await this.get({ hash });\n };\n};","import { WithoutBigintStringified } from \"../types/Utils\";\n\nexport const bigIntMax = (...args: bigint[]) => args.reduce((m, e) => e > m ? e : m);\nexport const bigIntMin = (...args: bigint[]) => args.reduce((m, e) => e < m ? e : m);\n\nexport function bigIntReviver(key: string, value: any) {\n if (typeof value === 'string') {\n if (value.endsWith('n')) {\n try {\n return BigInt(value.slice(0, -1));\n } catch (e) {\n return value;\n }\n };\n };\n\n return value;\n};\n\nexport function stringifyBingints(obj: any) {\n if (typeof obj === 'bigint') {\n return obj.toString() + \"n\";\n }\n\n if (typeof obj === 'object') {\n for (const key in obj) {\n obj[key] = stringifyBingints(obj[key]);\n }\n }\n\n if (Array.isArray(obj)) {\n for (let i = 0; i < obj.length; i++) {\n obj[i] = stringifyBingints(obj[i]);\n }\n }\n\n return obj;\n};\n\nexport function parseBingints<T extends { [key: string]: any }>(obj: T): WithoutBigintStringified<T> {\n if (typeof obj !== 'object' || obj === null) {\n return obj;\n }\n\n if (Array.isArray(obj)) {\n return obj.map((item, index) => bigIntReviver(index.toString(), parseBingints(item))) as WithoutBigintStringified<T>;\n }\n\n const newObj: { [key: string]: any } = {};\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n const value = obj[key];\n const processedValue = parseBingints(value);\n newObj[key] = bigIntReviver(key, processedValue);\n }\n };\n\n return newObj as WithoutBigintStringified<T>;\n};","/**\n * @module ContractManager\n */\nimport type { AbiItem } from \"@mentaproject/core/types\";\nimport { getContract, GetContractParameters } from \"@mentaproject/contracts\";\nimport { MentaClient } from \"../structures\";\n\n/**\n * Manages smart contract-related operations within the Menta client.\n * This class provides methods to interact with smart contracts deployed on the blockchain,\n * facilitating the retrieval of contract instances for various operations.\n */\nexport class ContractManager {\n /**\n * Creates an instance of ContractManager.\n * @description Initializes the ContractManager with a CoreClient instance, which is used for RPC communication.\n * @param client - The instance of MentaClient used to interact with the blockchain.\n */\n constructor(protected client: MentaClient) {};\n\n /**\n * Retrieves a contract instance to interact with it.\n * @description This method fetches a contract instance based on the provided parameters, allowing for interaction with its methods and events.\n * @template P The type of the contract retrieval parameters, extending `GetContractParameters` with `AbiItem` array.\n * @param {P} params The parameters for retrieving the contract, including its Application Binary Interface (ABI) and address.\n * @returns {ReturnType<typeof getContract<ReadonlyArray<AbiItem>, P>>} A contract instance that can be used to call contract methods or listen to events.\n * @example\n * import { MentaClient } from '@mentaproject/client';\n * import { http } from '@mentaproject/core';\n *\n * // Initialize the MentaClient with a transport\n * const client = new MentaClient({\n * transport: http('http://rpcurlhere.com'),\n * });\n *\n * // Define the ABI and address for the smart contract\n * const abi = [\n * {\n * \"type\": \"function\",\n * \"name\": \"greet\",\n * \"stateMutability\": \"view\",\n * \"inputs\": [],\n * \"outputs\": [{ \"name\": \"\", \"type\": \"string\" }]\n * }\n * ] as const;\n * const contractAddress = '0x...'; // Replace with your contract address\n *\n * // Retrieve the contract instance\n * const contract = client.contracts.get({\n * abi,\n * address: contractAddress,\n * });\n *\n * // Example of interacting with the contract\n * const greeting = await contract.greet();\n */\n get<P extends GetContractParameters<ReadonlyArray<AbiItem>>>(params: P) {\n return getContract(this.client.rpc, params);\n };\n};","/**\n * @module AccountManager\n */\nimport { Address } from \"@mentaproject/core/types\";\nimport { Account } from \"../structures/Account\";\nimport { PersistenceManager } from \"./PersistenceManager\";\nimport { MentaClient } from \"../structures\";\n\n/**\n * Manages blockchain account operations.\n * This class provides methods to interact with accounts,\n * including retrieving and managing them via an RPC client and a persistence manager.\n *\n * @class AccountManager\n */\nexport class AccountManager {\n /**\n * Creates an instance of AccountManager.\n *\n * @param {MentaClient} client - The instance of MentaClient used to interact with the blockchain.\n * @param {persistenceManager} persistenceManager - The optional persistence manager to store and retrieve account data.\n */\n constructor(public client: MentaClient, private persistenceManager?: PersistenceManager) { };\n\n /**\n * Retrieves an account instance by its blockchain address.\n * @param address - The blockchain address of the account to retrieve.\n * @returns An instance of the `Account` class.\n * @example\n * ```typescript\n * import { MentaClient } from '@mentaproject/client';\n * import { http } from '@mentaproject/core';\n *\n * // Initialize the MentaClient\n * const client = new MentaClient({\n * transport: http('http://rpcurlhere.com'),\n * });\n *\n * // The address of the account to retrieve\n * const accountAddress = '0x1234567890123456789012345678901234567890';\n *\n * // Retrieve the account instance using the account manager from the client\n * const account = client.accounts.get(accountAddress);\n *\n * console.log(account.address); // 0x1234567890123456789012345678901234567890\n * ```\n */\n get(address: Address): Account {\n return new Account(this.client, { address: address }, this.persistenceManager);\n };\n}","import { getBlockNumber } from '@mentaproject/core/actions';\nimport { Address } from '@mentaproject/core/types';\n\nimport { Account } from '../structures/Account';\nimport { MentaClient, Transaction } from '../structures';\nimport { bigIntMax } from '../utils/bigint';\nimport { GetTransactionsParams, IPersistenceAdapter, JSONTransaction } from 'src/types';\n\n/**\n * Manages the persistence of data, including transactions, using a specified persistence adapter.\n * It handles fetching data from both local storage and remote sources, and synchronizing them.\n */\nexport class PersistenceManager {\n /**\n * Creates an instance of PersistenceManager.\n * @param client - The instance of MentaClient used to interact with the blockchain.\n * @param persistenceAdapter - The adapter responsible for actual data persistence operations.\n */\n constructor(\n private client: MentaClient,\n private persistenceAdapter: IPersistenceAdapter\n ) {}\n\n /**\n * Retrieves transactions for a given account, applying a \"stale-while-revalidate\" strategy.\n * @param params - Parameters for retrieving transactions.\n * @returns A promise that resolves to an array of transactions with associated account information.\n */\n public async getTransactions(address: Address, params: GetTransactionsParams): Promise<JSONTransaction<0>[]> {\n return await this.persistenceAdapter.getTransactions(address, params);\n }\n\n /**\n * Synchronizes an account's transactions from the remote source to the local persistence.\n * It fetches new transactions starting from the last synced block and updates the local storage.\n * @param account - The account whose transactions are to be synchronized.\n * @param limit - The maximum number of transactions to fetch.\n * @returns A promise that resolves when the synchronization is complete.\n */\n public async syncTransactions(account: Account, limit: number = 100_000): Promise<void> {\n const lastSyncedBlock = await this.persistenceAdapter.getLastSyncedBlock(account.address);\n const lastBlock = lastSyncedBlock ?? 0n;\n\n const fromBlock = lastSyncedBlock ? lastSyncedBlock + 1n : (await getBlockNumber(this.client.rpc));\n\n const newTransactions = await account.transactions({\n fromBlock: fromBlock,\n toBlock: lastBlock,\n limit: limit\n }, true)\n\n if (newTransactions.length > 0) {\n await this.persistenceAdapter.upsertTransactions(newTransactions);\n \n const latestBlock = bigIntMax(...newTransactions.map(t => t.blockNumber || 0n));\n await this.persistenceAdapter.setLastSyncedBlock(account.address, latestBlock);\n }\n }\n}","/**\n * @module MentaClientTypes\n */\nimport { Address, CoreClientConfig, Transport } from \"@mentaproject/core/types\";\nimport { ICache } from \"./Cache\";\nimport { watchBlockNumber, watchBlocks } from \"@mentaproject/core/actions\";\nimport { IPersistenceAdapter } from \"./PersistenceAdapter\";\nimport { WebAuthnAccount } from \"@mentaproject/core/account-abstraction\";\n\n/**\n * Configuration for the client's cache.\n * @interface CacheConfig\n */\nexport interface CacheConfig {\n /**\n * Time-to-live policies for different RPC methods.\n * Keys are RPC method names (e.g., \"eth_getBlockByNumber\"), and values are\n * the TTL in milliseconds for caching responses from those methods.\n */\n ttl_policies: Record<string, number>;\n}\n\n/**\n * Configuration options for the MentaClient.\n * Extends {@link CoreClientConfig} from `@mentaproject/core`.\n * @interface MentaClientConfig\n */\nexport interface MentaClientConfig extends CoreClientConfig {\n /**\n * Optional cache implementation for the client.\n * If provided, the client will use this cache for RPC responses.\n */\n cache?: ICache;\n /**\n * Optional persistence adapter for local data storage.\n * If provided, the client will use this adapter to persist and retrieve data.\n */\n persistenceAdapter?: IPersistenceAdapter;\n /**\n * Bundler transport used for userOperations\n */\n bundlerTransport: Transport;\n /**\n * Passkey compatible signer used for signing user operations\n */\n signer: WebAuthnAccount;\n /**\n * Validator address used for userOperations\n */\n validatorAddress: Address;\n}\n\n/**\n * Defines the available client events and their corresponding watch functions.\n * These functions are used to subscribe to real-time updates from the client.\n */\nexport const ClientEvents = {\n /**\n * Event for new blocks.\n * Uses the {@link watchBlocks} function from `@mentaproject/core`.\n */\n block: watchBlocks,\n /**\n * Event for new block numbers.\n * Uses the {@link watchBlockNumber} function from `@mentaproject/core`.\n */\n blockNumber: watchBlockNumber,\n};\n\n/**\n * Utility type to extract the callback function type for a given event.\n * This type dynamically determines the expected callback signature for a specific client event.\n * @template TEvent The name of the event (e.g., 'block' or 'blockNumber') for which to get the listener callback type.\n */\nexport type GetListenerCallback<TEvent extends keyof typeof ClientEvents> =\n Parameters<(typeof ClientEvents)[TEvent]>[1] extends infer P\n ? P extends { [K in `on${Capitalize<TEvent>}`]: infer TCallback }\n ? TCallback\n : never\n : never;\n","/**\n * @module withCache\n */\nimport { watchBlockNumber } from \"@mentaproject/core/actions\";\nimport type { CoreClient } from \"@mentaproject/core/types\";\nimport { ICache } from \"../types/Cache\";\nimport { Methods } from \"../types/JsonRPC\";\n\n/**\n * A higher-order function that enhances a class method with caching capabilities.\n * It intercepts RPC requests made through the client and caches their responses\n * based on the provided cache implementation.\n *\n * @param client The CoreClient instance to enhance with caching.\n * @param cache The cache implementation (ICache) to use for storing and retrieving responses.\n * @returns The enhanced CoreClient instance with caching enabled.\n */\nexport function withCache<T extends CoreClient>(client: T, cache: ICache): T {\n watchBlockNumber(client, {\n onBlockNumber: (blockNumber) => {\n cache.setBlockNumber(blockNumber);\n },\n pollingInterval: 1000,\n });\n // 2. We keep a reference to the original request method\n const originalRequest = client.request;\n\n // 3. We replace the client's `request` method\n client.request = (async (args: { method: Methods, params: any }) => {\n const { method, params } = args;\n\n const cacheKey = `${client.chain!.id}:${method}:${JSON.stringify(params || [], (_, v) => typeof v === 'bigint' ? v.toString() : v)}`;\n\n let result;\n if (method !== \"eth_blockNumber\") result = cache.get(cacheKey);\n\n if (!result) {\n result = await originalRequest(args as any);\n };\n\n if (result !== null && result !== undefined && method !== \"eth_blockNumber\") {\n const ttl = cache.config.ttlPolicies[method] || cache.config.defaultTtl;\n await cache.set(cacheKey, result, ttl);\n }\n\n return result;\n }) as any;\n\n return client;\n}\n","/**\n * @module MemoryCache\n */\nimport { ICache, ICacheEntry, ICacheConfig } from '../types/Cache';\n\n/**\n/**\n * @class MemoryCache\n * @description A simple in-memory cache implementation that adheres to the ICache interface.\n * It stores key-value pairs with an associated time-to-live (TTL) based on block numbers.\n * The cache automatically evicts the oldest entries when its maximum size is reached.\n */\nexport class MemoryCache implements ICache {\n /**\n * @property {Map<string, ICacheEntry<any>>} cache - The internal Map used to store cache entries.\n * @private\n */\n private cache = new Map<string, ICacheEntry<any>>();\n /**\n * @property {ICacheConfig} config - The configuration object for the cache, including maxSize, defaultTtl, and ttlPolicies.\n */\n public config: ICacheConfig;\n /**\n * @property {bigint} blockNumber - The current block number used for TTL calculations.\n * @private\n */\n private blockNumber: bigint;\n\n /**\n * @constructor\n * @description Creates an instance of MemoryCache.\n * @param {bigint} blockNumber - The current block number to use for TTL calculations.\n * @param {Partial<ICacheConfig>} [options] - Optional configuration for the cache.\n * @param {number} [options.maxSize=500] - The maximum number of entries the cache can hold.\n * @param {number} [options.defaultTtl=1] - The default time-to-live in blocks for cache entries if not specified.\n * @param {Object.<string, number>} [options.ttlPolicies={}] - A map of specific TTL policies for different keys.\n */\n constructor(blockNumber: bigint, options?: Partial<ICacheConfig>) {\n this.blockNumber = blockNumber;\n this.config = {\n maxSize: 500,\n defaultTtl: 1,\n ttlPolicies: options?.ttlPolicies || {},\n ...options,\n };\n };\n\n /**\n * @method isExpired\n * @description Checks if a cache entry has expired based on the current block number and the entry's expiry block.\n * @param {bigint} expiry - The expiry block number of the cache entry.\n * @returns {boolean} `true` if the entry has expired, `false` otherwise.\n * @protected\n */\n protected isExpired(expiry: bigint): boolean {\n return this.blockNumber > expiry;\n };\n\n /**\n * @method setBlockNumber\n * @description Sets the current block number for TTL calculations. This is crucial for managing cache entry expiry.\n * @param {bigint} blockNumber - The new current block number.\n * @returns {void}\n */\n setBlockNumber(blockNumber: bigint): void {\n this.blockNumber = blockNumber;\n }\n\n /**\n * @method set\n * @description Sets a value in the cache. If the key already exists, its entry will be updated.\n * If the cache reaches its maximum size, the oldest entry will be evicted before adding the new one.\n * @template T - The type of the value being stored.\n * @param {string} key - The unique key for the cache entry.\n * @param {T} value - The value to store in the cache.\n * @param {number} [ttl=this.config.defaultTtl] - The time-to-live (in blocks) for this specific entry. Defaults to the cache's `defaultTtl`.\n * @returns {void}\n */\n set<T>(key: string, value: T, ttl: number = this.config.defaultTtl): void {\n if (this.cache.has(key)) {\n this.cache.delete(key);\n }\n\n if (this.cache.size >= this.config.maxSize) this.evict();\n \n const expiry = this.blockNumber + BigInt(ttl);\n this.cache.set(key, { value, expiry });\n }\n\n /**\n * @method get\n * @description Retrieves a value from the cache. If the entry is found and has not expired,\n * it is moved to the end of the cache (making it the most recently used) to prevent premature eviction.\n * @template T - The expected type of the value.\n * @param {string} key - The key of the cache entry to retrieve.\n * @returns {T | undefined} The cached value if found and not expired, otherwise `undefined`.\n */\n get<T>(key: string): T | undefined {\n const entry = this.cache.get(key);\n if (!entry) return undefined;\n\n if (this.isExpired(entry.expiry)) {\n this.cache.delete(key);\n return undefined;\n }\n\n this.cache.delete(key);\n this.cache.set(key, entry);\n\n return entry.value as T;\n }\n\n /**\n * @method evict\n * @description Evicts the oldest entry from the cache. This method is called internally when the cache\n * reaches its `maxSize` to make room for new entries.\n * @returns {void}\n * @private\n */\n private evict(): void {\n const oldestKey = this.cache.keys().next().value;\n if (!oldestKey) return;\n\n this.cache.delete(oldestKey);\n }\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAa;AAAb;;;AAAO,IAAM,UAAU;;;;;ACoFvB,SAAS,KACP,KACA,IAA4C;AAE5C,MAAI,KAAK,GAAG;AAAG,WAAO;AACtB,MACE,OACA,OAAO,QAAQ,YACf,WAAW,OACX,IAAI,UAAU;AAEd,WAAO,KAAK,IAAI,OAAO,EAAE;AAC3B,SAAO,KAAK,OAAO;AACrB;AAjGA,IAOI,aA6BS;AApCb;;;;AAOA,IAAI,cAA2B;MAC7B,YAAY,CAAC,EACX,aACA,WAAW,IACX,SAAQ,MAER,WACI,GAAG,eAAe,iBAAiB,GAAG,QAAQ,GAC5C,WAAW,IAAI,QAAQ,KAAK,EAC9B,KACA;MACN,SAAS,QAAQ,OAAO;;AAkBpB,IAAO,YAAP,MAAO,mBAAkB,MAAK;MASlC,YAAY,cAAsB,OAA4B,CAAA,GAAE;AAC9D,cAAM,WAAW,MAAK;AACpB,cAAI,KAAK,iBAAiB;AAAW,mBAAO,KAAK,MAAM;AACvD,cAAI,KAAK,OAAO;AAAS,mBAAO,KAAK,MAAM;AAC3C,iBAAO,KAAK;QACd,GAAE;AACF,cAAM,YAAY,MAAK;AACrB,cAAI,KAAK,iBAAiB;AACxB,mBAAO,KAAK,MAAM,YAAY,KAAK;AACrC,iBAAO,KAAK;QACd,GAAE;AACF,cAAM,UAAU,YAAY,aAAa,EAAE,GAAG,MA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names":["import_actions","promise","data","import_utils","fromBlock","toBlock","import_actions","import_actions","import_contracts","import_actions","import_actions","import_actions"]}
1
+ {"version":3,"sources":["../node_modules/viem/errors/version.ts","../node_modules/viem/errors/base.ts","../node_modules/viem/errors/transaction.ts","../src/index.ts","../src/structures/Account.ts","../src/structures/Transaction.ts","../node_modules/viem/index.ts","../src/utils/toJSON.ts","../src/structures/Block.ts","../src/structures/MentaClient.ts","../src/managers/BlockManager.ts","../src/managers/TransactionManager.ts","../src/utils/bigint.ts","../src/managers/ContractManager.ts","../src/managers/AccountManager.ts","../src/managers/PersistenceManager.ts","../src/types/MentaClient.ts","../src/utils/withCache.ts","../src/structures/Cache.ts"],"sourcesContent":["export const version = '2.42.1'\n","import { version } from './version.js'\n\ntype ErrorConfig = {\n getDocsUrl?: ((args: BaseErrorParameters) => string | undefined) | undefined\n version?: string | undefined\n}\n\nlet errorConfig: ErrorConfig = {\n getDocsUrl: ({\n docsBaseUrl,\n docsPath = '',\n docsSlug,\n }: BaseErrorParameters) =>\n docsPath\n ? `${docsBaseUrl ?? 'https://viem.sh'}${docsPath}${\n docsSlug ? `#${docsSlug}` : ''\n }`\n : undefined,\n version: `viem@${version}`,\n}\n\nexport function setErrorConfig(config: ErrorConfig) {\n errorConfig = config\n}\n\ntype BaseErrorParameters = {\n cause?: BaseError | Error | undefined\n details?: string | undefined\n docsBaseUrl?: string | undefined\n docsPath?: string | undefined\n docsSlug?: string | undefined\n metaMessages?: string[] | undefined\n name?: string | undefined\n}\n\nexport type BaseErrorType = BaseError & { name: 'BaseError' }\nexport class BaseError extends Error {\n details: string\n docsPath?: string | undefined\n metaMessages?: string[] | undefined\n shortMessage: string\n version: string\n\n override name = 'BaseError'\n\n constructor(shortMessage: string, args: BaseErrorParameters = {}) {\n const details = (() => {\n if (args.cause instanceof BaseError) return args.cause.details\n if (args.cause?.message) return args.cause.message\n return args.details!\n })()\n const docsPath = (() => {\n if (args.cause instanceof BaseError)\n return args.cause.docsPath || args.docsPath\n return args.docsPath\n })()\n const docsUrl = errorConfig.getDocsUrl?.({ ...args, docsPath })\n\n const message = [\n shortMessage || 'An error occurred.',\n '',\n ...(args.metaMessages ? [...args.metaMessages, ''] : []),\n ...(docsUrl ? [`Docs: ${docsUrl}`] : []),\n ...(details ? [`Details: ${details}`] : []),\n ...(errorConfig.version ? [`Version: ${errorConfig.version}`] : []),\n ].join('\\n')\n\n super(message, args.cause ? { cause: args.cause } : undefined)\n\n this.details = details\n this.docsPath = docsPath\n this.metaMessages = args.metaMessages\n this.name = args.name ?? this.name\n this.shortMessage = shortMessage\n this.version = version\n }\n\n walk(): Error\n walk(fn: (err: unknown) => boolean): Error | null\n walk(fn?: any): any {\n return walk(this, fn)\n }\n}\n\nfunction walk(\n err: unknown,\n fn?: ((err: unknown) => boolean) | undefined,\n): unknown {\n if (fn?.(err)) return err\n if (\n err &&\n typeof err === 'object' &&\n 'cause' in err &&\n err.cause !== undefined\n )\n return walk(err.cause, fn)\n return fn ? null : err\n}\n","import type { Account } from '../accounts/types.js'\nimport type { SendTransactionParameters } from '../actions/wallet/sendTransaction.js'\nimport type { BlockTag } from '../types/block.js'\nimport type { Chain } from '../types/chain.js'\nimport type { Hash, Hex } from '../types/misc.js'\nimport type {\n TransactionReceipt,\n TransactionType,\n} from '../types/transaction.js'\nimport { formatEther } from '../utils/unit/formatEther.js'\nimport { formatGwei } from '../utils/unit/formatGwei.js'\n\nimport { BaseError } from './base.js'\n\nexport function prettyPrint(\n args: Record<string, bigint | number | string | undefined | false | unknown>,\n) {\n const entries = Object.entries(args)\n .map(([key, value]) => {\n if (value === undefined || value === false) return null\n return [key, value]\n })\n .filter(Boolean) as [string, string][]\n const maxLength = entries.reduce((acc, [key]) => Math.max(acc, key.length), 0)\n return entries\n .map(([key, value]) => ` ${`${key}:`.padEnd(maxLength + 1)} ${value}`)\n .join('\\n')\n}\n\nexport type FeeConflictErrorType = FeeConflictError & {\n name: 'FeeConflictError'\n}\nexport class FeeConflictError extends BaseError {\n constructor() {\n super(\n [\n 'Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.',\n 'Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others.',\n ].join('\\n'),\n { name: 'FeeConflictError' },\n )\n }\n}\n\nexport type InvalidLegacyVErrorType = InvalidLegacyVError & {\n name: 'InvalidLegacyVError'\n}\nexport class InvalidLegacyVError extends BaseError {\n constructor({ v }: { v: bigint }) {\n super(`Invalid \\`v\\` value \"${v}\". Expected 27 or 28.`, {\n name: 'InvalidLegacyVError',\n })\n }\n}\n\nexport type InvalidSerializableTransactionErrorType =\n InvalidSerializableTransactionError & {\n name: 'InvalidSerializableTransactionError'\n }\nexport class InvalidSerializableTransactionError extends BaseError {\n constructor({ transaction }: { transaction: Record<string, unknown> }) {\n super('Cannot infer a transaction type from provided transaction.', {\n metaMessages: [\n 'Provided Transaction:',\n '{',\n prettyPrint(transaction),\n '}',\n '',\n 'To infer the type, either provide:',\n '- a `type` to the Transaction, or',\n '- an EIP-1559 Transaction with `maxFeePerGas`, or',\n '- an EIP-2930 Transaction with `gasPrice` & `accessList`, or',\n '- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or',\n '- an EIP-7702 Transaction with `authorizationList`, or',\n '- a Legacy Transaction with `gasPrice`',\n ],\n name: 'InvalidSerializableTransactionError',\n })\n }\n}\n\nexport type InvalidSerializedTransactionTypeErrorType =\n InvalidSerializedTransactionTypeError & {\n name: 'InvalidSerializedTransactionTypeError'\n }\nexport class InvalidSerializedTransactionTypeError extends BaseError {\n serializedType: Hex\n\n constructor({ serializedType }: { serializedType: Hex }) {\n super(`Serialized transaction type \"${serializedType}\" is invalid.`, {\n name: 'InvalidSerializedTransactionType',\n })\n\n this.serializedType = serializedType\n }\n}\n\nexport type InvalidSerializedTransactionErrorType =\n InvalidSerializedTransactionError & {\n name: 'InvalidSerializedTransactionError'\n }\nexport class InvalidSerializedTransactionError extends BaseError {\n serializedTransaction: Hex\n type: TransactionType\n\n constructor({\n attributes,\n serializedTransaction,\n type,\n }: {\n attributes: Record<string, unknown>\n serializedTransaction: Hex\n type: TransactionType\n }) {\n const missing = Object.entries(attributes)\n .map(([key, value]) => (typeof value === 'undefined' ? key : undefined))\n .filter(Boolean)\n super(`Invalid serialized transaction of type \"${type}\" was provided.`, {\n metaMessages: [\n `Serialized Transaction: \"${serializedTransaction}\"`,\n missing.length > 0 ? `Missing Attributes: ${missing.join(', ')}` : '',\n ].filter(Boolean),\n name: 'InvalidSerializedTransactionError',\n })\n\n this.serializedTransaction = serializedTransaction\n this.type = type\n }\n}\n\nexport type InvalidStorageKeySizeErrorType = InvalidStorageKeySizeError & {\n name: 'InvalidStorageKeySizeError'\n}\nexport class InvalidStorageKeySizeError extends BaseError {\n constructor({ storageKey }: { storageKey: Hex }) {\n super(\n `Size for storage key \"${storageKey}\" is invalid. Expected 32 bytes. Got ${Math.floor(\n (storageKey.length - 2) / 2,\n )} bytes.`,\n { name: 'InvalidStorageKeySizeError' },\n )\n }\n}\n\nexport type TransactionExecutionErrorType = TransactionExecutionError & {\n name: 'TransactionExecutionError'\n}\nexport class TransactionExecutionError extends BaseError {\n override cause: BaseError\n\n constructor(\n cause: BaseError,\n {\n account,\n docsPath,\n chain,\n data,\n gas,\n gasPrice,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce,\n to,\n value,\n }: Omit<SendTransactionParameters, 'account' | 'chain'> & {\n account: Account | null\n chain?: Chain | undefined\n docsPath?: string | undefined\n },\n ) {\n const prettyArgs = prettyPrint({\n chain: chain && `${chain?.name} (id: ${chain?.id})`,\n from: account?.address,\n to,\n value:\n typeof value !== 'undefined' &&\n `${formatEther(value)} ${chain?.nativeCurrency?.symbol || 'ETH'}`,\n data,\n gas,\n gasPrice:\n typeof gasPrice !== 'undefined' && `${formatGwei(gasPrice)} gwei`,\n maxFeePerGas:\n typeof maxFeePerGas !== 'undefined' &&\n `${formatGwei(maxFeePerGas)} gwei`,\n maxPriorityFeePerGas:\n typeof maxPriorityFeePerGas !== 'undefined' &&\n `${formatGwei(maxPriorityFeePerGas)} gwei`,\n nonce,\n })\n\n super(cause.shortMessage, {\n cause,\n docsPath,\n metaMessages: [\n ...(cause.metaMessages ? [...cause.metaMessages, ' '] : []),\n 'Request Arguments:',\n prettyArgs,\n ].filter(Boolean) as string[],\n name: 'TransactionExecutionError',\n })\n this.cause = cause\n }\n}\n\nexport type TransactionNotFoundErrorType = TransactionNotFoundError & {\n name: 'TransactionNotFoundError'\n}\nexport class TransactionNotFoundError extends BaseError {\n constructor({\n blockHash,\n blockNumber,\n blockTag,\n hash,\n index,\n }: {\n blockHash?: Hash | undefined\n blockNumber?: bigint | undefined\n blockTag?: BlockTag | undefined\n hash?: Hash | undefined\n index?: number | undefined\n }) {\n let identifier = 'Transaction'\n if (blockTag && index !== undefined)\n identifier = `Transaction at block time \"${blockTag}\" at index \"${index}\"`\n if (blockHash && index !== undefined)\n identifier = `Transaction at block hash \"${blockHash}\" at index \"${index}\"`\n if (blockNumber && index !== undefined)\n identifier = `Transaction at block number \"${blockNumber}\" at index \"${index}\"`\n if (hash) identifier = `Transaction with hash \"${hash}\"`\n super(`${identifier} could not be found.`, {\n name: 'TransactionNotFoundError',\n })\n }\n}\n\nexport type TransactionReceiptNotFoundErrorType =\n TransactionReceiptNotFoundError & {\n name: 'TransactionReceiptNotFoundError'\n }\nexport class TransactionReceiptNotFoundError extends BaseError {\n constructor({ hash }: { hash: Hash }) {\n super(\n `Transaction receipt with hash \"${hash}\" could not be found. The Transaction may not be processed on a block yet.`,\n {\n name: 'TransactionReceiptNotFoundError',\n },\n )\n }\n}\n\nexport type TransactionReceiptRevertedErrorType =\n TransactionReceiptRevertedError & {\n name: 'TransactionReceiptRevertedError'\n }\nexport class TransactionReceiptRevertedError extends BaseError {\n receipt: TransactionReceipt\n\n constructor({ receipt }: { receipt: TransactionReceipt }) {\n super(`Transaction with hash \"${receipt.transactionHash}\" reverted.`, {\n metaMessages: [\n 'The receipt marked the transaction as \"reverted\". This could mean that the function on the contract you are trying to call threw an error.',\n ' ',\n 'You can attempt to extract the revert reason by:',\n '- calling the `simulateContract` or `simulateCalls` Action with the `abi` and `functionName` of the contract',\n '- using the `call` Action with raw `data`',\n ],\n name: 'TransactionReceiptRevertedError',\n })\n\n this.receipt = receipt\n }\n}\n\nexport type WaitForTransactionReceiptTimeoutErrorType =\n WaitForTransactionReceiptTimeoutError & {\n name: 'WaitForTransactionReceiptTimeoutError'\n }\nexport class WaitForTransactionReceiptTimeoutError extends BaseError {\n constructor({ hash }: { hash: Hash }) {\n super(\n `Timed out while waiting for transaction with hash \"${hash}\" to be confirmed.`,\n { name: 'WaitForTransactionReceiptTimeoutError' },\n )\n }\n}\n","/**\n * @module @mentaproject/client\n * @description This library provides the client-side functionalities for interacting with the Menta blockchain.\n * It includes managers for accounts, blocks, contracts, persistence, and transactions,\n * as well as core data structures and utility types.\n */\n\n/**\n * Re-exports all core data structures like MentaClient, Account, Block, and Transaction.\n */\nexport * from './structures';\n/**\n * Re-exports all manager classes for interacting with different aspects of the Menta blockchain.\n */\nexport * from './managers';\n/**\n * Re-exports the Cache structure for managing cached data.\n */\nexport * from './structures/Cache';\n\nexport * from \"./utils/bigint\";","import {\n fetchByBlockRange,\n getBalance,\n getBlockNumber,\n getCode,\n getTransaction,\n getTransactionCount,\n sendTransaction,\n traceFilter,\n} from \"@mentaproject/core/actions\";\nimport type {\n Address,\n Hash,\n onBlockRangeCallback,\n} from \"@mentaproject/core/types\";\nimport { Transaction } from \"./Transaction\";\nimport { toHex } from \"@mentaproject/core/utils\";\nimport {\n AccountData,\n FetchTransactionParams,\n GetTransactionsParams,\n JSONAccount,\n} from \"../types/Account\";\nimport { getContractType } from \"@mentaproject/contracts\";\nimport { toJSON } from \"../utils/toJSON\";\nimport { PersistenceManager } from \"../managers/PersistenceManager\";\nimport { MentaClient } from \"./MentaClient\";\n\n/**\n * Represents a blockchain account with functionalities to interact with the Menta blockchain.\n * This class provides methods to query account information, send transactions, and manage account-related data.\n */\nexport class Account implements AccountData {\n /**\n * The blockchain address of the account.\n */\n public address: Address;\n\n private persistenceManager?: PersistenceManager;\n\n /**\n * Creates an instance of the Account class.\n * @param client.rpc The CoreClient instance used for blockchain interactions.\n * @param address The blockchain address of the account.\n * @param persistenceManager An optional PersistenceManager instance for caching and data synchronization.\n */\n constructor(\n public client: MentaClient,\n data: AccountData,\n persistenceManager?: PersistenceManager,\n ) {\n this.address = data.address;\n this.persistenceManager = persistenceManager;\n }\n\n /**\n * Checks if the account's address belongs to a smart contract.\n * @description This method queries the blockchain for the code associated with the account's address.\n * If code is found, it indicates that the account is a contract.\n * @returns {Promise<boolean>} A promise that resolves to `true` if the account is a contract, `false` otherwise.\n */\n async isContract(): Promise<boolean> {\n const code = await getCode(this.client.rpc, { address: this.address });\n\n if (!code || code === \"0x\") return false;\n return true;\n }\n\n /**\n * Retrieves the type of the contract if the account is a smart contract.\n * @description This method first checks if the account is a contract using `isContract()`.\n * If it is a contract, it then attempts to determine and return its type.\n * @returns {Promise<any>} A promise that resolves to the contract type (e.g., 'ERC20', 'ERC721') or `undefined` if the account is not a contract or its type cannot be determined.\n */\n async contractType(): Promise<any> {\n const isContract = await this.isContract();\n if (!isContract) return undefined;\n\n return await getContractType(this.client.rpc, this.address);\n }\n\n /**\n * Sends a specified amount of native cryptocurrency (ETH) to this account.\n * @description This method constructs and sends a transaction to transfer ETH to the account's address.\n * @param {bigint} amount The amount of ETH to send, specified in wei (the smallest denomination of Ether).\n * @returns {Promise<Transaction>} A promise that resolves to a `Transaction` object representing the sent transaction.\n */\n async sendETH(amount: bigint): Promise<Transaction> {\n const hash = await sendTransaction(this.client.rpc, {\n calls: [\n {\n to: this.address,\n value: amount,\n },\n ],\n });\n\n const data = await getTransaction(this.client.rpc, { hash });\n return new Transaction(this.client, data);\n }\n\n /**\n * Retrieves the current native cryptocurrency (ETH) balance of the account.\n * @description This method queries the blockchain to get the balance associated with the account's address.\n * @returns {Promise<bigint>} A promise that resolves to the ETH balance of the account, in wei.\n */\n async ETHBalance(): Promise<bigint> {\n return await getBalance(this.client.rpc, {\n address: this.address,\n });\n }\n\n /**\n * Retrieves the transaction count (nonce) for the account.\n * @description The transaction count represents the number of transactions sent from this account,\n * which is also used as the nonce for new transactions to prevent replay attacks.\n * @returns {Promise<number>} A promise that resolves to the transaction count of the account.\n */\n async transactionCount(): Promise<number> {\n return await getTransactionCount(this.client.rpc, {\n address: this.address,\n });\n }\n\n /**\n * Retrieves all transactions involving this account.\n * @description If a `PersistenceManager` is configured, this method will first attempt to retrieve transactions from the local cache.\n * If not found in cache or if no `PersistenceManager` is configured, it will fetch transactions directly from the remote RPC.\n * @param {GetTransactionsOptions} [options] - Optional parameters for filtering, pagination, and sorting the transactions.\n * @param {number} [options.startBlock] - The starting block number (inclusive) from which to retrieve transactions.\n * @param {number} [options.endBlock] - The ending block number (inclusive) up to which to retrieve transactions.\n * @param {number} [options.page] - The page number for paginated results.\n * @param {number} [options.offset] - The number of items to skip from the beginning of the result set.\n * @param {'asc' | 'desc'} [options.sort] - The sorting order for transactions based on block number ('asc' for ascending, 'desc' for descending).\n * @param {boolean} [forceFetch=false] - Forces the method to fetch transactions from the remote source even if they are already cached. (mostly used internally)\n * @returns {Promise<Transaction[]>} A promise that resolves to an array of transactions.\n */\n async transactions(\n params: GetTransactionsParams,\n forceFetch = false,\n ): Promise<Transaction[]> {\n if (!this.persistenceManager || forceFetch) {\n // If persistence is not configured, fetch directly from remote\n const hashes = await this._fetchTransactions(params);\n const transactions = await Promise.all(\n hashes.map((hash) => this.client.transactions.get({ hash })),\n );\n\n return transactions;\n }\n\n const jsons = await this.persistenceManager.getTransactions(\n this.address,\n params,\n );\n return jsons.map((j) => this.client.transactions.parse(j));\n }\n\n /**\n * Synchronizes the account's transactions with the remote data source using the configured `PersistenceManager`.\n * @description This method initiates a synchronization process to ensure that the local cache of transactions\n * for this account is up-to-date with the blockchain.\n * @param {number} [limit] The maximum number of transactions to synchronize.\n * @returns {Promise<void>} A promise that resolves when the synchronization process is complete.\n * @throws {Error} If the persistence module is not configured.\n */\n async syncTransactions(limit: number = 1000): Promise<void> {\n if (!this.persistenceManager)\n throw new Error(\"The persistence module is not configured.\");\n await this.persistenceManager.syncTransactions(this, limit);\n }\n\n /**\n * Retrieves transactions involving a specific token. (not implemented yet)\n * @description This method queries the persistence adapter to retrieve transactions involving a specific token.\n * @param {Address} tokenAddress The address of the token.\n * @returns {Promise<any>} A promise that resolves to an array of transactions involving the token.\n * @throws {Error} If the persistence module is not configured.\n */\n async tokenTransactions(tokenAddress: Address): Promise<any> {\n if (!this.persistenceManager)\n throw new Error(\"The persistence module is not configured.\");\n\n return {};\n }\n\n /**\n * Converts the Account instance into a JSON-serializable representation.\n * @description This method leverages a utility function to convert the `Account` object,\n * including its asynchronous properties (like `isContract`, `ETHBalance`), into a plain JSON object.\n * @param {number} [depth=1] The depth to which nested objects should be converted. A depth of 1 means only direct properties are included.\n * @returns {Promise<object>} A promise that resolves to the JSON representation of the account.\n */\n async toJSON<D extends number = 1>(depth: D): Promise<JSONAccount<D>> {\n return await toJSON({\n obj: {\n address: this.address,\n isContract: this.isContract.bind(this),\n contractType: this.contractType.bind(this),\n ETHBalance: this.ETHBalance.bind(this),\n transactionCount: this.transactionCount.bind(this),\n },\n depth,\n });\n }\n\n /**\n * Fetches transactions from the account using a block range exploration with trace_filter calls.\n *\n * @param params - The parameters for the block range exploration.\n * @returns A Promise that resolves to an array of transaction hashes.\n */\n protected async _fetchTransactions({\n fromBlock,\n toBlock,\n limit = 50,\n }: FetchTransactionParams): Promise<Hash[]> {\n const lastBlock = await getBlockNumber(this.client.rpc);\n\n const onBlockRange: onBlockRangeCallback = async (\n { fromBlock, toBlock },\n stop,\n ) => {\n const outgoing = await traceFilter(this.client.rpc, {\n fromBlock: toHex(fromBlock),\n toBlock: toHex(toBlock),\n fromAddress: this.address,\n });\n\n const incoming = await traceFilter(this.client.rpc, {\n fromBlock: toHex(fromBlock),\n toBlock: toHex(toBlock),\n toAddress: this.address,\n });\n\n const traces = outgoing\n .concat(incoming)\n .sort((a, b) => a.blockNumber - b.blockNumber);\n\n return traces.map((t) => t.transactionHash as Hash);\n };\n\n return await fetchByBlockRange({\n toBlock: BigInt(toBlock !== undefined ? toBlock : 0),\n fromBlock: BigInt(fromBlock !== undefined ? fromBlock : lastBlock),\n direction: \"backward\",\n itemLimit: limit,\n onBlockRange,\n });\n }\n}\n","import { AccessList, Address, Hash, Hex, Transaction as RawTransaction, WaitForTransactionReceiptReturnType } from '@mentaproject/core/types';\nimport { getBlock, getTransactionReceipt, traceTransaction, waitForTransactionReceipt } from '@mentaproject/core/actions';\nimport { hexToBigInt } from '@mentaproject/core/utils';\nimport { TransactionReceiptNotFoundError } from 'viem';\n\nimport { Account } from './Account';\nimport { Block } from './Block';\nimport { MentaClient } from './MentaClient';\n\nimport { toJSON } from '../utils/toJSON';\nimport { JSONTransaction, TransactionCall } from '../types';\n\n/**\n * Represents a blockchain transaction with its properties and methods.\n *\n * @description This class encapsulates the data and functionalities related to an Ethereum-like transaction,\n * providing methods to interact with the blockchain to retrieve transaction-related information such as\n * internal calls, receipts, and the block it belongs to.\n */\nexport class Transaction implements Omit<RawTransaction, \"from\" | \"to\"> {\n /**\n * @description The access list for the transaction.\n */\n public accessList?: AccessList;\n /**\n * @description The blob versioned hashes.\n */\n public blobVersionedHashes?: readonly Hex[];\n /**\n * @description The gas limit for the transaction.\n */\n public gas: bigint;\n /**\n * @description The gas price for the transaction.\n */\n public gasPrice?: bigint;\n /**\n * @description The hash of the transaction.\n */\n public hash: Hash;\n /**\n * @description The input data for the transaction.\n */\n public input: Hex;\n /**\n * @description The maximum fee per gas.\n */\n public maxFeePerGas?: bigint;\n /**\n * @description The maximum priority fee per gas.\n */\n public maxPriorityFeePerGas?: bigint;\n /**\n * @description The nonce of the transaction.\n */\n public nonce: number;\n /**\n * @description The r value of the signature.\n */\n public r: Hex;\n /**\n * @description The s value of the signature.\n */\n public s: Hex;\n /**\n * @description The index of the transaction within the block.\n */\n public transactionIndex: number | null;\n /**\n * @description The type of the transaction.\n */\n public type: \"legacy\" | \"eip2930\" | \"eip1559\" | \"eip4844\" | \"eip7702\";\n /**\n * @description The v value of the signature.\n */\n public v: bigint;\n /**\n * @description The value transferred in the transaction.\n */\n public value: bigint;\n /**\n * @description The y parity of the signature.\n */\n public yParity?: number;\n /**\n * @description The hash of the block containing this transaction.\n */\n public blockHash: Hash | null;\n /**\n * @description The number of the block containing this transaction.\n */\n public blockNumber: bigint | null;\n /**\n * @description The hex representation of the type of the transaction.\n */\n public typeHex: `0x${string}` | null;\n\n /**\n * @description The sender account of the transaction.\n */\n public from?: Account;\n /**\n * @description The recipient account of the transaction.\n */\n public to?: Account;\n\n\n /**\n * Creates an instance of Transaction.\n * @description Initializes a new Transaction instance with the provided RPC client and transaction data.\n * @param {MentaClient} client - The instance of MentaClient used to interact with the blockchain.\n * @param {ITransactionData} data The raw transaction data.\n */\n constructor(protected client: MentaClient, data: RawTransaction) {\n this.accessList = data.accessList;\n this.blobVersionedHashes = data.blobVersionedHashes;\n this.gas = data.gas;\n this.gasPrice = data.gasPrice;\n this.hash = data.hash;\n this.input = data.input;\n this.maxFeePerGas = data.maxFeePerGas;\n this.maxPriorityFeePerGas = data.maxPriorityFeePerGas;\n this.nonce = data.nonce;\n this.r = data.r;\n this.s = data.s;\n this.transactionIndex = data.transactionIndex;\n this.type = data.type;\n this.v = data.v;\n this.value = data.value;\n this.yParity = data.yParity;\n this.blockHash = data.blockHash;\n this.blockNumber = data.blockNumber;\n this.typeHex = data.typeHex;\n\n this.from = data.from ? this.client.accounts.get(data.from) : undefined;\n this.to = data.to ? this.client.accounts.get(data.to) : undefined;\n };\n\n /**\n * Retrieves the internal calls made by this transaction.\n * @description Fetches and processes the transaction traces to extract internal call details.\n * @returns {Promise<TransactionCall[] | undefined>} A promise that resolves to an array of call objects, each representing an internal call with sender, recipient, value, input data, gas used, and call type.\n */\n public async calls(): Promise<TransactionCall[] | undefined> {\n const traces = await traceTransaction(this.client.rpc, this.hash);\n if (!traces) return undefined;\n\n const calls = traces.filter(t => t.type === \"call\" && t.action !== undefined);\n\n return calls.map(c => ({\n from: new Account(this.client, { address: c.action!.from as Address }),\n to: new Account(this.client, { address: c.action!.to as Address }),\n value: hexToBigInt(c.action!.value as Hex),\n input: c.action!.input as Hex,\n gas: hexToBigInt(c.action!.gas as Hex),\n callType: c.action!.callType,\n })) as TransactionCall[];\n }\n\n /**\n * Waits for the transaction receipt to be available.\n * @description Asynchronously waits for the transaction to be confirmed on the blockchain and its receipt to be available.\n * @param {number} [confirmations] The number of confirmations to wait for. Defaults to 1.\n * @returns {Promise<WaitForTransactionReceiptReturnType>} A promise that resolves to the transaction receipt once the specified number of confirmations are met.\n */\n async waitForReceipt(confirmations?: number): Promise<WaitForTransactionReceiptReturnType> {\n return await waitForTransactionReceipt(this.client.rpc, {\n hash: this.hash,\n confirmations: confirmations || 1,\n });\n };\n\n /**\n * Retrieves the transaction receipt.\n * @description Fetches the transaction receipt for the current transaction hash.\n * @returns {Promise<WaitForTransactionReceiptReturnType>} A promise that resolves to the transaction receipt.\n */\n async receipt(): Promise<WaitForTransactionReceiptReturnType | undefined> {\n try {\n return await getTransactionReceipt(this.client.rpc, { hash: this.hash });\n } catch (error) {\n if (error instanceof TransactionReceiptNotFoundError) {\n return undefined;\n }\n }\n };\n\n /**\n * Retrieves the block containing this transaction.\n * @description Fetches the block data using the transaction's block hash and returns a Block instance.\n * @returns {Promise<Block>} A promise that resolves to a Block instance representing the block that includes this transaction.\n */\n async block(): Promise<Block> {\n const data = await getBlock(this.client.rpc, { blockHash: this.blockHash! });\n return new Block(this.client, data);\n };\n\n /**\n * Converts the Transaction instance to a JSON representation.\n * @description Serializes the transaction instance into a JSON object, including nested representations of related entities like block, receipt, and internal calls based on the specified depth.\n * @param {number} [depth=1] The depth of the conversion. Controls how deeply nested objects are serialized.\n * @returns {Promise<object>} A promise that resolves to the JSON representation of the transaction.\n */\n async toJSON<D extends number = 1>(depth: D): Promise<JSONTransaction<D>> {\n return await toJSON({\n obj: {\n ...this,\n block: this.block,\n receipt: this.receipt,\n calls: async () => {\n const calls = await this.calls();\n if (!calls) return undefined;\n\n return Promise.all(calls.map(async c => await toJSON({ obj: c, depth: depth })));\n }\n },\n depth\n });\n }\n};","// biome-ignore lint/performance/noBarrelFile: entrypoint module\nexport {\n type Abi,\n type AbiEvent,\n type AbiFunction,\n type AbiParameter,\n type AbiParameterKind,\n type AbiParameterToPrimitiveType,\n type AbiStateMutability,\n type Address,\n CircularReferenceError,\n InvalidAbiItemError,\n InvalidAbiParameterError,\n InvalidAbiParametersError,\n InvalidAbiTypeParameterError,\n InvalidFunctionModifierError,\n InvalidModifierError,\n InvalidParameterError,\n InvalidParenthesisError,\n InvalidSignatureError,\n InvalidStructSignatureError,\n type Narrow,\n type ParseAbi,\n type ParseAbiItem,\n type ParseAbiParameter,\n type ParseAbiParameters,\n parseAbi,\n parseAbiItem,\n parseAbiParameter,\n parseAbiParameters,\n SolidityProtectedKeywordError,\n type TypedData,\n type TypedDataDomain,\n type TypedDataParameter,\n UnknownSignatureError,\n UnknownTypeError,\n} from 'abitype'\nexport type {\n BlockOverrides,\n Rpc as RpcBlockOverrides,\n} from 'ox/BlockOverrides'\nexport type {\n RpcEstimateUserOperationGasReturnType,\n RpcGetUserOperationByHashReturnType,\n RpcUserOperation,\n RpcUserOperationReceipt,\n RpcUserOperationRequest,\n} from './account-abstraction/types/rpc.js'\nexport type {\n Account,\n AccountSource,\n CustomSource,\n HDAccount,\n HDOptions,\n JsonRpcAccount,\n LocalAccount,\n PrivateKeyAccount,\n} from './accounts/types.js'\nexport type {\n GetEnsAddressErrorType,\n GetEnsAddressParameters,\n GetEnsAddressReturnType,\n} from './actions/ens/getEnsAddress.js'\nexport type {\n GetEnsAvatarErrorType,\n GetEnsAvatarParameters,\n GetEnsAvatarReturnType,\n} from './actions/ens/getEnsAvatar.js'\nexport type {\n GetEnsNameErrorType,\n GetEnsNameParameters,\n GetEnsNameReturnType,\n} from './actions/ens/getEnsName.js'\nexport type {\n GetEnsResolverErrorType,\n GetEnsResolverParameters,\n GetEnsResolverReturnType,\n} from './actions/ens/getEnsResolver.js'\nexport type {\n GetEnsTextErrorType,\n GetEnsTextParameters,\n GetEnsTextReturnType,\n} from './actions/ens/getEnsText.js'\nexport {\n type GetContractErrorType,\n type GetContractParameters,\n type GetContractReturnType,\n getContract,\n} from './actions/getContract.js'\nexport type {\n CallErrorType,\n CallParameters,\n CallReturnType,\n} from './actions/public/call.js'\nexport type {\n CreateAccessListErrorType,\n CreateAccessListParameters,\n CreateAccessListReturnType,\n} from './actions/public/createAccessList.js'\nexport type {\n CreateBlockFilterErrorType,\n CreateBlockFilterReturnType,\n} from './actions/public/createBlockFilter.js'\nexport type {\n CreateContractEventFilterErrorType,\n CreateContractEventFilterParameters,\n CreateContractEventFilterReturnType,\n} from './actions/public/createContractEventFilter.js'\nexport type {\n CreateEventFilterErrorType,\n CreateEventFilterParameters,\n CreateEventFilterReturnType,\n} from './actions/public/createEventFilter.js'\nexport type {\n CreatePendingTransactionFilterErrorType,\n CreatePendingTransactionFilterReturnType,\n} from './actions/public/createPendingTransactionFilter.js'\nexport type {\n EstimateContractGasErrorType,\n EstimateContractGasParameters,\n EstimateContractGasReturnType,\n} from './actions/public/estimateContractGas.js'\nexport type {\n EstimateFeesPerGasErrorType,\n EstimateFeesPerGasParameters,\n EstimateFeesPerGasReturnType,\n} from './actions/public/estimateFeesPerGas.js'\nexport type {\n EstimateGasErrorType,\n EstimateGasParameters,\n EstimateGasReturnType,\n} from './actions/public/estimateGas.js'\nexport type {\n EstimateMaxPriorityFeePerGasErrorType,\n EstimateMaxPriorityFeePerGasParameters,\n EstimateMaxPriorityFeePerGasReturnType,\n} from './actions/public/estimateMaxPriorityFeePerGas.js'\nexport type {\n FillTransactionErrorType,\n FillTransactionParameters,\n FillTransactionReturnType,\n} from './actions/public/fillTransaction.js'\nexport type {\n GetBalanceErrorType,\n GetBalanceParameters,\n GetBalanceReturnType,\n} from './actions/public/getBalance.js'\nexport type {\n GetBlobBaseFeeErrorType,\n GetBlobBaseFeeReturnType,\n} from './actions/public/getBlobBaseFee.js'\nexport type {\n GetBlockErrorType,\n GetBlockParameters,\n GetBlockReturnType,\n} from './actions/public/getBlock.js'\nexport type {\n GetBlockNumberErrorType,\n GetBlockNumberParameters,\n GetBlockNumberReturnType,\n} from './actions/public/getBlockNumber.js'\nexport type {\n GetBlockTransactionCountErrorType,\n GetBlockTransactionCountParameters,\n GetBlockTransactionCountReturnType,\n} from './actions/public/getBlockTransactionCount.js'\nexport type {\n GetChainIdErrorType,\n GetChainIdReturnType,\n} from './actions/public/getChainId.js'\nexport type {\n /** @deprecated Use `GetCodeErrorType` instead */\n GetCodeErrorType as GetBytecodeErrorType,\n GetCodeErrorType,\n /** @deprecated Use `GetCodeParameters` instead */\n GetCodeParameters as GetBytecodeParameters,\n GetCodeParameters,\n /** @deprecated Use `GetCodeReturnType` instead */\n GetCodeReturnType as GetBytecodeReturnType,\n GetCodeReturnType,\n} from './actions/public/getCode.js'\nexport type {\n GetContractEventsErrorType,\n GetContractEventsParameters,\n GetContractEventsReturnType,\n} from './actions/public/getContractEvents.js'\nexport type {\n GetEip712DomainErrorType,\n GetEip712DomainParameters,\n GetEip712DomainReturnType,\n} from './actions/public/getEip712Domain.js'\nexport type {\n GetFeeHistoryErrorType,\n GetFeeHistoryParameters,\n GetFeeHistoryReturnType,\n} from './actions/public/getFeeHistory.js'\nexport type {\n GetFilterChangesErrorType,\n GetFilterChangesParameters,\n GetFilterChangesReturnType,\n} from './actions/public/getFilterChanges.js'\nexport type {\n GetFilterLogsErrorType,\n GetFilterLogsParameters,\n GetFilterLogsReturnType,\n} from './actions/public/getFilterLogs.js'\nexport type {\n GetGasPriceErrorType,\n GetGasPriceReturnType,\n} from './actions/public/getGasPrice.js'\nexport type {\n GetLogsErrorType,\n GetLogsParameters,\n GetLogsReturnType,\n} from './actions/public/getLogs.js'\nexport type {\n GetProofErrorType,\n GetProofParameters,\n GetProofReturnType,\n} from './actions/public/getProof.js'\nexport type {\n GetStorageAtErrorType,\n GetStorageAtParameters,\n GetStorageAtReturnType,\n} from './actions/public/getStorageAt.js'\nexport type {\n GetTransactionErrorType,\n GetTransactionParameters,\n GetTransactionReturnType,\n} from './actions/public/getTransaction.js'\nexport type {\n GetTransactionConfirmationsErrorType,\n GetTransactionConfirmationsParameters,\n GetTransactionConfirmationsReturnType,\n} from './actions/public/getTransactionConfirmations.js'\nexport type {\n GetTransactionCountErrorType,\n GetTransactionCountParameters,\n GetTransactionCountReturnType,\n} from './actions/public/getTransactionCount.js'\nexport type {\n GetTransactionReceiptErrorType,\n GetTransactionReceiptParameters,\n GetTransactionReceiptReturnType,\n} from './actions/public/getTransactionReceipt.js'\nexport type {\n MulticallErrorType,\n MulticallParameters,\n MulticallReturnType,\n} from './actions/public/multicall.js'\nexport type {\n ReadContractErrorType,\n ReadContractParameters,\n ReadContractReturnType,\n} from './actions/public/readContract.js'\nexport type {\n SimulateBlocksErrorType,\n SimulateBlocksParameters,\n SimulateBlocksReturnType,\n} from './actions/public/simulateBlocks.js'\nexport type {\n SimulateCallsErrorType,\n SimulateCallsParameters,\n SimulateCallsReturnType,\n} from './actions/public/simulateCalls.js'\nexport type {\n GetMutabilityAwareValue,\n SimulateContractErrorType,\n SimulateContractParameters,\n SimulateContractReturnType,\n} from './actions/public/simulateContract.js'\nexport type {\n UninstallFilterErrorType,\n UninstallFilterParameters,\n UninstallFilterReturnType,\n} from './actions/public/uninstallFilter.js'\nexport type {\n VerifyHashErrorType as VerifyHashActionErrorType,\n VerifyHashParameters as VerifyHashActionParameters,\n VerifyHashReturnType as VerifyHashActionReturnType,\n} from './actions/public/verifyHash.js'\nexport type {\n VerifyMessageErrorType as VerifyMessageActionErrorType,\n VerifyMessageParameters as VerifyMessageActionParameters,\n VerifyMessageReturnType as VerifyMessageActionReturnType,\n} from './actions/public/verifyMessage.js'\nexport type {\n VerifyTypedDataErrorType as VerifyTypedDataActionErrorType,\n VerifyTypedDataParameters as VerifyTypedDataActionParameters,\n VerifyTypedDataReturnType as VerifyTypedDataActionReturnType,\n} from './actions/public/verifyTypedData.js'\nexport type {\n ReplacementReason,\n ReplacementReturnType,\n WaitForTransactionReceiptErrorType,\n WaitForTransactionReceiptParameters,\n WaitForTransactionReceiptReturnType,\n} from './actions/public/waitForTransactionReceipt.js'\nexport type {\n OnBlockNumberFn,\n OnBlockNumberParameter,\n WatchBlockNumberErrorType,\n WatchBlockNumberParameters,\n WatchBlockNumberReturnType,\n} from './actions/public/watchBlockNumber.js'\nexport type {\n OnBlock,\n OnBlockParameter,\n WatchBlocksErrorType,\n WatchBlocksParameters,\n WatchBlocksReturnType,\n} from './actions/public/watchBlocks.js'\nexport type {\n WatchContractEventErrorType,\n WatchContractEventOnLogsFn,\n WatchContractEventOnLogsParameter,\n WatchContractEventParameters,\n WatchContractEventReturnType,\n} from './actions/public/watchContractEvent.js'\nexport type {\n WatchEventErrorType,\n WatchEventOnLogsFn,\n WatchEventOnLogsParameter,\n WatchEventParameters,\n WatchEventReturnType,\n} from './actions/public/watchEvent.js'\nexport type {\n OnTransactionsFn,\n OnTransactionsParameter,\n WatchPendingTransactionsErrorType,\n WatchPendingTransactionsParameters,\n WatchPendingTransactionsReturnType,\n} from './actions/public/watchPendingTransactions.js'\nexport type {\n DropTransactionErrorType,\n DropTransactionParameters,\n} from './actions/test/dropTransaction.js'\nexport type {\n DumpStateErrorType,\n DumpStateReturnType,\n} from './actions/test/dumpState.js'\nexport type {\n GetAutomineErrorType,\n GetAutomineReturnType,\n} from './actions/test/getAutomine.js'\nexport type {\n GetTxpoolContentErrorType,\n GetTxpoolContentReturnType,\n} from './actions/test/getTxpoolContent.js'\nexport type {\n GetTxpoolStatusErrorType,\n GetTxpoolStatusReturnType,\n} from './actions/test/getTxpoolStatus.js'\nexport type {\n ImpersonateAccountErrorType,\n ImpersonateAccountParameters,\n} from './actions/test/impersonateAccount.js'\nexport type {\n IncreaseTimeErrorType,\n IncreaseTimeParameters,\n} from './actions/test/increaseTime.js'\nexport type {\n InspectTxpoolErrorType,\n InspectTxpoolReturnType,\n} from './actions/test/inspectTxpool.js'\nexport type {\n LoadStateErrorType,\n LoadStateParameters,\n LoadStateReturnType,\n} from './actions/test/loadState.js'\nexport type { MineErrorType, MineParameters } from './actions/test/mine.js'\nexport type { RemoveBlockTimestampIntervalErrorType } from './actions/test/removeBlockTimestampInterval.js'\nexport type { ResetErrorType, ResetParameters } from './actions/test/reset.js'\nexport type {\n RevertErrorType,\n RevertParameters,\n} from './actions/test/revert.js'\nexport type {\n SendUnsignedTransactionErrorType,\n SendUnsignedTransactionParameters,\n SendUnsignedTransactionReturnType,\n} from './actions/test/sendUnsignedTransaction.js'\nexport type { SetAutomineErrorType } from './actions/test/setAutomine.js'\nexport type {\n SetBalanceErrorType,\n SetBalanceParameters,\n} from './actions/test/setBalance.js'\nexport type {\n SetBlockGasLimitErrorType,\n SetBlockGasLimitParameters,\n} from './actions/test/setBlockGasLimit.js'\nexport type {\n SetBlockTimestampIntervalErrorType,\n SetBlockTimestampIntervalParameters,\n} from './actions/test/setBlockTimestampInterval.js'\nexport type {\n SetCodeErrorType,\n SetCodeParameters,\n} from './actions/test/setCode.js'\nexport type {\n SetCoinbaseErrorType,\n SetCoinbaseParameters,\n} from './actions/test/setCoinbase.js'\nexport type {\n SetIntervalMiningErrorType,\n SetIntervalMiningParameters,\n} from './actions/test/setIntervalMining.js'\nexport type { SetLoggingEnabledErrorType } from './actions/test/setLoggingEnabled.js'\nexport type {\n SetMinGasPriceErrorType,\n SetMinGasPriceParameters,\n} from './actions/test/setMinGasPrice.js'\nexport type {\n SetNextBlockBaseFeePerGasErrorType,\n SetNextBlockBaseFeePerGasParameters,\n} from './actions/test/setNextBlockBaseFeePerGas.js'\nexport type {\n SetNextBlockTimestampErrorType,\n SetNextBlockTimestampParameters,\n} from './actions/test/setNextBlockTimestamp.js'\nexport type {\n SetNonceErrorType,\n SetNonceParameters,\n} from './actions/test/setNonce.js'\nexport type { SetRpcUrlErrorType } from './actions/test/setRpcUrl.js'\nexport type {\n SetStorageAtErrorType,\n SetStorageAtParameters,\n} from './actions/test/setStorageAt.js'\nexport type { SnapshotErrorType } from './actions/test/snapshot.js'\nexport type {\n StopImpersonatingAccountErrorType,\n StopImpersonatingAccountParameters,\n} from './actions/test/stopImpersonatingAccount.js'\nexport type {\n AddChainErrorType,\n AddChainParameters,\n} from './actions/wallet/addChain.js'\nexport type {\n DeployContractErrorType,\n DeployContractParameters,\n DeployContractReturnType,\n} from './actions/wallet/deployContract.js'\nexport type {\n GetAddressesErrorType,\n GetAddressesReturnType,\n} from './actions/wallet/getAddresses.js'\nexport type {\n GetCallsStatusErrorType,\n GetCallsStatusParameters,\n GetCallsStatusReturnType,\n} from './actions/wallet/getCallsStatus.js'\nexport type {\n GetCapabilitiesErrorType,\n GetCapabilitiesParameters,\n GetCapabilitiesReturnType,\n} from './actions/wallet/getCapabilities.js'\nexport type {\n GetPermissionsErrorType,\n GetPermissionsReturnType,\n} from './actions/wallet/getPermissions.js'\nexport type {\n PrepareAuthorizationErrorType,\n PrepareAuthorizationParameters,\n PrepareAuthorizationReturnType,\n} from './actions/wallet/prepareAuthorization.js'\nexport type {\n PrepareTransactionRequestErrorType,\n PrepareTransactionRequestParameters,\n PrepareTransactionRequestParameterType,\n PrepareTransactionRequestRequest,\n PrepareTransactionRequestReturnType,\n} from './actions/wallet/prepareTransactionRequest.js'\nexport type {\n RequestAddressesErrorType,\n RequestAddressesReturnType,\n} from './actions/wallet/requestAddresses.js'\nexport type {\n RequestPermissionsErrorType,\n RequestPermissionsParameters,\n RequestPermissionsReturnType,\n} from './actions/wallet/requestPermissions.js'\nexport type {\n SendCallsErrorType,\n SendCallsParameters,\n SendCallsReturnType,\n} from './actions/wallet/sendCalls.js'\nexport type {\n SendCallsSyncErrorType,\n SendCallsSyncParameters,\n SendCallsSyncReturnType,\n} from './actions/wallet/sendCallsSync.js'\nexport type {\n SendRawTransactionErrorType,\n SendRawTransactionParameters,\n SendRawTransactionReturnType,\n} from './actions/wallet/sendRawTransaction.js'\nexport type {\n SendRawTransactionSyncErrorType,\n SendRawTransactionSyncParameters,\n SendRawTransactionSyncReturnType,\n} from './actions/wallet/sendRawTransactionSync.js'\nexport type {\n SendTransactionErrorType,\n SendTransactionParameters,\n SendTransactionRequest,\n SendTransactionReturnType,\n} from './actions/wallet/sendTransaction.js'\nexport type {\n SendTransactionSyncErrorType,\n SendTransactionSyncParameters,\n SendTransactionSyncRequest,\n SendTransactionSyncReturnType,\n} from './actions/wallet/sendTransactionSync.js'\nexport type {\n ShowCallsStatusErrorType,\n ShowCallsStatusParameters,\n ShowCallsStatusReturnType,\n} from './actions/wallet/showCallsStatus.js'\nexport type {\n SignAuthorizationErrorType,\n SignAuthorizationParameters,\n SignAuthorizationReturnType,\n} from './actions/wallet/signAuthorization.js'\nexport type {\n SignMessageErrorType,\n SignMessageParameters,\n SignMessageReturnType,\n} from './actions/wallet/signMessage.js'\nexport type {\n SignTransactionErrorType,\n SignTransactionParameters,\n SignTransactionReturnType,\n} from './actions/wallet/signTransaction.js'\nexport type {\n SignTypedDataErrorType,\n SignTypedDataParameters,\n SignTypedDataReturnType,\n} from './actions/wallet/signTypedData.js'\nexport type {\n SwitchChainErrorType,\n SwitchChainParameters,\n} from './actions/wallet/switchChain.js'\nexport type {\n WaitForCallsStatusErrorType,\n WaitForCallsStatusParameters,\n WaitForCallsStatusReturnType,\n WaitForCallsStatusTimeoutErrorType,\n} from './actions/wallet/waitForCallsStatus.js'\nexport { WaitForCallsStatusTimeoutError } from './actions/wallet/waitForCallsStatus.js'\nexport type {\n WatchAssetErrorType,\n WatchAssetParameters,\n WatchAssetReturnType,\n} from './actions/wallet/watchAsset.js'\nexport type {\n WriteContractErrorType,\n WriteContractParameters,\n WriteContractReturnType,\n} from './actions/wallet/writeContract.js'\nexport type {\n WriteContractSyncErrorType,\n WriteContractSyncParameters,\n WriteContractSyncReturnType,\n} from './actions/wallet/writeContractSync.js'\nexport {\n type Client,\n type ClientConfig,\n type CreateClientErrorType,\n createClient,\n type MulticallBatchOptions,\n rpcSchema,\n} from './clients/createClient.js'\nexport {\n type CreatePublicClientErrorType,\n createPublicClient,\n type PublicClient,\n type PublicClientConfig,\n} from './clients/createPublicClient.js'\nexport {\n type CreateTestClientErrorType,\n createTestClient,\n type TestClient,\n type TestClientConfig,\n} from './clients/createTestClient.js'\nexport {\n type CreateWalletClientErrorType,\n createWalletClient,\n type WalletClient,\n type WalletClientConfig,\n} from './clients/createWalletClient.js'\nexport {\n type PublicActions,\n publicActions,\n} from './clients/decorators/public.js'\nexport {\n type TestActions,\n testActions,\n} from './clients/decorators/test.js'\nexport {\n type WalletActions,\n walletActions,\n} from './clients/decorators/wallet.js'\nexport {\n type CreateTransportErrorType,\n createTransport,\n type Transport,\n type TransportConfig,\n} from './clients/transports/createTransport.js'\nexport {\n type CustomTransport,\n type CustomTransportConfig,\n type CustomTransportErrorType,\n custom,\n} from './clients/transports/custom.js'\nexport {\n type FallbackTransport,\n type FallbackTransportConfig,\n type FallbackTransportErrorType,\n fallback,\n shouldThrow,\n} from './clients/transports/fallback.js'\nexport {\n type HttpTransport,\n type HttpTransportConfig,\n type HttpTransportErrorType,\n http,\n} from './clients/transports/http.js'\nexport {\n type WebSocketTransport,\n type WebSocketTransportConfig,\n type WebSocketTransportErrorType,\n webSocket,\n} from './clients/transports/webSocket.js'\nexport {\n erc20Abi,\n erc20Abi_bytes32,\n erc721Abi,\n erc1155Abi,\n erc4626Abi,\n erc6492SignatureValidatorAbi,\n /** @deprecated use `erc6492SignatureValidatorAbi` instead. */\n erc6492SignatureValidatorAbi as universalSignatureValidatorAbi,\n multicall3Abi,\n} from './constants/abis.js'\nexport { ethAddress, zeroAddress } from './constants/address.js'\nexport { zeroHash } from './constants/bytes.js'\nexport {\n deploylessCallViaBytecodeBytecode,\n deploylessCallViaFactoryBytecode,\n erc6492SignatureValidatorByteCode,\n /** @deprecated use `erc6492SignatureValidatorByteCode` instead. */\n erc6492SignatureValidatorByteCode as universalSignatureValidatorByteCode,\n} from './constants/contracts.js'\nexport {\n maxInt8,\n maxInt16,\n maxInt24,\n maxInt32,\n maxInt40,\n maxInt48,\n maxInt56,\n maxInt64,\n maxInt72,\n maxInt80,\n maxInt88,\n maxInt96,\n maxInt104,\n maxInt112,\n maxInt120,\n maxInt128,\n maxInt136,\n maxInt144,\n maxInt152,\n maxInt160,\n maxInt168,\n maxInt176,\n maxInt184,\n maxInt192,\n maxInt200,\n maxInt208,\n maxInt216,\n maxInt224,\n maxInt232,\n maxInt240,\n maxInt248,\n maxInt256,\n maxUint8,\n maxUint16,\n maxUint24,\n maxUint32,\n maxUint40,\n maxUint48,\n maxUint56,\n maxUint64,\n maxUint72,\n maxUint80,\n maxUint88,\n maxUint96,\n maxUint104,\n maxUint112,\n maxUint120,\n maxUint128,\n maxUint136,\n maxUint144,\n maxUint152,\n maxUint160,\n maxUint168,\n maxUint176,\n maxUint184,\n maxUint192,\n maxUint200,\n maxUint208,\n maxUint216,\n maxUint224,\n maxUint232,\n maxUint240,\n maxUint248,\n maxUint256,\n minInt8,\n minInt16,\n minInt24,\n minInt32,\n minInt40,\n minInt48,\n minInt56,\n minInt64,\n minInt72,\n minInt80,\n minInt88,\n minInt96,\n minInt104,\n minInt112,\n minInt120,\n minInt128,\n minInt136,\n minInt144,\n minInt152,\n minInt160,\n minInt168,\n minInt176,\n minInt184,\n minInt192,\n minInt200,\n minInt208,\n minInt216,\n minInt224,\n minInt232,\n minInt240,\n minInt248,\n minInt256,\n} from './constants/number.js'\nexport { presignMessagePrefix } from './constants/strings.js'\nexport { etherUnits, gweiUnits, weiUnits } from './constants/unit.js'\nexport {\n AbiConstructorNotFoundError,\n type AbiConstructorNotFoundErrorType,\n AbiConstructorParamsNotFoundError,\n type AbiConstructorParamsNotFoundErrorType,\n AbiDecodingDataSizeInvalidError,\n type AbiDecodingDataSizeInvalidErrorType,\n AbiDecodingDataSizeTooSmallError,\n type AbiDecodingDataSizeTooSmallErrorType,\n AbiDecodingZeroDataError,\n type AbiDecodingZeroDataErrorType,\n AbiEncodingArrayLengthMismatchError,\n type AbiEncodingArrayLengthMismatchErrorType,\n AbiEncodingBytesSizeMismatchError,\n type AbiEncodingBytesSizeMismatchErrorType,\n AbiEncodingLengthMismatchError,\n type AbiEncodingLengthMismatchErrorType,\n AbiErrorInputsNotFoundError,\n type AbiErrorInputsNotFoundErrorType,\n AbiErrorNotFoundError,\n type AbiErrorNotFoundErrorType,\n AbiErrorSignatureNotFoundError,\n type AbiErrorSignatureNotFoundErrorType,\n AbiEventNotFoundError,\n type AbiEventNotFoundErrorType,\n AbiEventSignatureEmptyTopicsError,\n type AbiEventSignatureEmptyTopicsErrorType,\n AbiEventSignatureNotFoundError,\n type AbiEventSignatureNotFoundErrorType,\n AbiFunctionNotFoundError,\n type AbiFunctionNotFoundErrorType,\n AbiFunctionOutputsNotFoundError,\n type AbiFunctionOutputsNotFoundErrorType,\n AbiFunctionSignatureNotFoundError,\n type AbiFunctionSignatureNotFoundErrorType,\n BytesSizeMismatchError,\n type BytesSizeMismatchErrorType,\n DecodeLogDataMismatch,\n type DecodeLogDataMismatchErrorType,\n DecodeLogTopicsMismatch,\n type DecodeLogTopicsMismatchErrorType,\n InvalidAbiDecodingTypeError,\n type InvalidAbiDecodingTypeErrorType,\n InvalidAbiEncodingTypeError,\n type InvalidAbiEncodingTypeErrorType,\n InvalidArrayError,\n type InvalidArrayErrorType,\n InvalidDefinitionTypeError,\n type InvalidDefinitionTypeErrorType,\n UnsupportedPackedAbiType,\n type UnsupportedPackedAbiTypeErrorType,\n} from './errors/abi.js'\nexport {\n InvalidAddressError,\n type InvalidAddressErrorType,\n} from './errors/address.js'\nexport { BaseError, type BaseErrorType, setErrorConfig } from './errors/base.js'\nexport {\n BlockNotFoundError,\n type BlockNotFoundErrorType,\n} from './errors/block.js'\nexport {\n BundleFailedError,\n type BundleFailedErrorType,\n} from './errors/calls.js'\nexport {\n ChainDoesNotSupportContract,\n type ChainDoesNotSupportContractErrorType,\n ChainMismatchError,\n type ChainMismatchErrorType,\n ChainNotFoundError,\n type ChainNotFoundErrorType,\n ClientChainNotConfiguredError,\n type ClientChainNotConfiguredErrorType,\n InvalidChainIdError,\n type InvalidChainIdErrorType,\n} from './errors/chain.js'\nexport {\n CallExecutionError,\n type CallExecutionErrorType,\n ContractFunctionExecutionError,\n type ContractFunctionExecutionErrorType,\n ContractFunctionRevertedError,\n type ContractFunctionRevertedErrorType,\n ContractFunctionZeroDataError,\n type ContractFunctionZeroDataErrorType,\n CounterfactualDeploymentFailedError,\n type CounterfactualDeploymentFailedErrorType,\n RawContractError,\n type RawContractErrorType,\n} from './errors/contract.js'\nexport {\n SizeExceedsPaddingSizeError,\n type SizeExceedsPaddingSizeErrorType,\n SliceOffsetOutOfBoundsError,\n type SliceOffsetOutOfBoundsErrorType,\n} from './errors/data.js'\nexport {\n IntegerOutOfRangeError,\n type IntegerOutOfRangeErrorType,\n InvalidBytesBooleanError,\n type InvalidBytesBooleanErrorType,\n InvalidHexBooleanError,\n type InvalidHexBooleanErrorType,\n InvalidHexValueError,\n type InvalidHexValueErrorType,\n SizeOverflowError,\n type SizeOverflowErrorType,\n} from './errors/encoding.js'\nexport {\n type EnsAvatarInvalidMetadataError,\n type EnsAvatarInvalidMetadataErrorType,\n EnsAvatarInvalidNftUriError,\n type EnsAvatarInvalidNftUriErrorType,\n EnsAvatarUnsupportedNamespaceError,\n type EnsAvatarUnsupportedNamespaceErrorType,\n EnsAvatarUriResolutionError,\n type EnsAvatarUriResolutionErrorType,\n EnsInvalidChainIdError,\n type EnsInvalidChainIdErrorType,\n} from './errors/ens.js'\nexport {\n EstimateGasExecutionError,\n type EstimateGasExecutionErrorType,\n} from './errors/estimateGas.js'\nexport {\n BaseFeeScalarError,\n type BaseFeeScalarErrorType,\n Eip1559FeesNotSupportedError,\n type Eip1559FeesNotSupportedErrorType,\n MaxFeePerGasTooLowError,\n type MaxFeePerGasTooLowErrorType,\n} from './errors/fee.js'\nexport {\n FilterTypeNotSupportedError,\n type FilterTypeNotSupportedErrorType,\n} from './errors/log.js'\nexport {\n ExecutionRevertedError,\n type ExecutionRevertedErrorType,\n FeeCapTooHighError,\n type FeeCapTooHighErrorType,\n FeeCapTooLowError,\n type FeeCapTooLowErrorType,\n InsufficientFundsError,\n type InsufficientFundsErrorType,\n IntrinsicGasTooHighError,\n type IntrinsicGasTooHighErrorType,\n IntrinsicGasTooLowError,\n type IntrinsicGasTooLowErrorType,\n NonceMaxValueError,\n type NonceMaxValueErrorType,\n NonceTooHighError,\n type NonceTooHighErrorType,\n NonceTooLowError,\n type NonceTooLowErrorType,\n TipAboveFeeCapError,\n type TipAboveFeeCapErrorType,\n TransactionTypeNotSupportedError,\n type TransactionTypeNotSupportedErrorType,\n UnknownNodeError,\n type UnknownNodeErrorType,\n} from './errors/node.js'\nexport {\n HttpRequestError,\n type HttpRequestErrorType,\n RpcRequestError,\n type RpcRequestErrorType,\n SocketClosedError,\n type SocketClosedErrorType,\n TimeoutError,\n type TimeoutErrorType,\n WebSocketRequestError,\n type WebSocketRequestErrorType,\n} from './errors/request.js'\nexport {\n AtomicityNotSupportedError,\n type AtomicityNotSupportedErrorType,\n AtomicReadyWalletRejectedUpgradeError,\n type AtomicReadyWalletRejectedUpgradeErrorType,\n BundleTooLargeError,\n type BundleTooLargeErrorType,\n ChainDisconnectedError,\n type ChainDisconnectedErrorType,\n DuplicateIdError,\n type DuplicateIdErrorType,\n InternalRpcError,\n type InternalRpcErrorType,\n InvalidInputRpcError,\n type InvalidInputRpcErrorType,\n InvalidParamsRpcError,\n type InvalidParamsRpcErrorType,\n InvalidRequestRpcError,\n type InvalidRequestRpcErrorType,\n JsonRpcVersionUnsupportedError,\n type JsonRpcVersionUnsupportedErrorType,\n LimitExceededRpcError,\n type LimitExceededRpcErrorType,\n MethodNotFoundRpcError,\n type MethodNotFoundRpcErrorType,\n MethodNotSupportedRpcError,\n type MethodNotSupportedRpcErrorType,\n ParseRpcError,\n type ParseRpcErrorType,\n ProviderDisconnectedError,\n type ProviderDisconnectedErrorType,\n ProviderRpcError,\n type ProviderRpcErrorCode,\n type ProviderRpcErrorType,\n ResourceNotFoundRpcError,\n type ResourceNotFoundRpcErrorType,\n ResourceUnavailableRpcError,\n type ResourceUnavailableRpcErrorType,\n RpcError,\n type RpcErrorCode,\n type RpcErrorType,\n SwitchChainError,\n TransactionRejectedRpcError,\n type TransactionRejectedRpcErrorType,\n UnauthorizedProviderError,\n type UnauthorizedProviderErrorType,\n UnknownBundleIdError,\n type UnknownBundleIdErrorType,\n UnknownRpcError,\n type UnknownRpcErrorType,\n UnsupportedChainIdError,\n type UnsupportedChainIdErrorType,\n UnsupportedNonOptionalCapabilityError,\n type UnsupportedNonOptionalCapabilityErrorType,\n UnsupportedProviderMethodError,\n type UnsupportedProviderMethodErrorType,\n UserRejectedRequestError,\n type UserRejectedRequestErrorType,\n} from './errors/rpc.js'\nexport {\n AccountStateConflictError,\n type AccountStateConflictErrorType,\n StateAssignmentConflictError,\n type StateAssignmentConflictErrorType,\n} from './errors/stateOverride.js'\nexport {\n FeeConflictError,\n type FeeConflictErrorType,\n InvalidLegacyVError,\n type InvalidLegacyVErrorType,\n InvalidSerializableTransactionError,\n type InvalidSerializableTransactionErrorType,\n InvalidSerializedTransactionError,\n type InvalidSerializedTransactionErrorType,\n InvalidSerializedTransactionTypeError,\n type InvalidSerializedTransactionTypeErrorType,\n InvalidStorageKeySizeError,\n type InvalidStorageKeySizeErrorType,\n TransactionExecutionError,\n type TransactionExecutionErrorType,\n TransactionNotFoundError,\n type TransactionNotFoundErrorType,\n TransactionReceiptNotFoundError,\n type TransactionReceiptNotFoundErrorType,\n WaitForTransactionReceiptTimeoutError,\n type WaitForTransactionReceiptTimeoutErrorType,\n} from './errors/transaction.js'\nexport {\n UrlRequiredError,\n type UrlRequiredErrorType,\n} from './errors/transport.js'\nexport {\n InvalidDomainError,\n type InvalidDomainErrorType,\n InvalidPrimaryTypeError,\n type InvalidPrimaryTypeErrorType,\n InvalidStructTypeError,\n type InvalidStructTypeErrorType,\n} from './errors/typedData.js'\nexport {\n InvalidDecimalNumberError,\n type InvalidDecimalNumberErrorType,\n} from './errors/unit.js'\nexport type {\n DeriveAccount,\n HDKey,\n ParseAccount,\n} from './types/account.js'\nexport type {\n Authorization,\n AuthorizationList,\n AuthorizationRequest,\n SerializedAuthorization,\n SerializedAuthorizationList,\n SignedAuthorization,\n SignedAuthorizationList,\n} from './types/authorization.js'\nexport type {\n Block,\n BlockIdentifier,\n BlockNumber,\n BlockTag,\n Uncle,\n} from './types/block.js'\nexport type { Call, Calls } from './types/calls.js'\nexport type {\n Capabilities,\n /** @deprecated Use `Capabilities` instead. */\n Capabilities as WalletCapabilities,\n CapabilitiesSchema,\n /** @deprecated Use `ChainIdToCapabilities` instead. */\n ChainIdToCapabilities as WalletCapabilitiesRecord,\n ChainIdToCapabilities,\n ExtractCapabilities,\n} from './types/capabilities.js'\nexport type {\n Chain,\n ChainConfig,\n ChainContract,\n ChainEstimateFeesPerGasFn,\n ChainEstimateFeesPerGasFnParameters,\n ChainFees,\n ChainFeesFnParameters,\n ChainFormatter,\n ChainFormatters,\n ChainMaxPriorityFeePerGasFn,\n ChainSerializers,\n DeriveChain,\n ExtractChainFormatterExclude,\n ExtractChainFormatterParameters,\n ExtractChainFormatterReturnType,\n GetChainParameter,\n} from './types/chain.js'\nexport type {\n AbiEventParametersToPrimitiveTypes,\n AbiEventParameterToPrimitiveType,\n AbiEventTopicToPrimitiveType,\n AbiItem,\n AbiItemArgs,\n AbiItemName,\n ContractConstructorArgs,\n ContractErrorArgs,\n ContractErrorName,\n ContractEventArgs,\n ContractEventArgsFromTopics,\n ContractEventName,\n ContractFunctionArgs,\n ContractFunctionName,\n ContractFunctionParameters,\n ContractFunctionReturnType,\n EventDefinition,\n ExtractAbiFunctionForArgs,\n ExtractAbiItem,\n ExtractAbiItemForArgs,\n ExtractAbiItemNames,\n GetEventArgs,\n GetValue,\n LogTopicType,\n MaybeAbiEventName,\n MaybeExtractEventArgsFromAbi,\n UnionWiden,\n Widen,\n} from './types/contract.js'\nexport type {\n AddEthereumChainParameter,\n BundlerRpcSchema,\n DebugBundlerRpcSchema,\n EIP1193EventMap,\n EIP1193Events,\n EIP1193Parameters,\n EIP1193Provider,\n EIP1193RequestFn,\n EIP1474Methods,\n NetworkSync,\n PaymasterRpcSchema,\n ProviderConnectInfo,\n ProviderMessage,\n ProviderRpcErrorType as EIP1193ProviderRpcErrorType,\n PublicRpcSchema,\n RpcSchema,\n RpcSchemaOverride,\n TestRpcSchema,\n WalletCallReceipt,\n WalletGetAssetsParameters,\n WalletGetAssetsReturnType,\n WalletGetCallsStatusReturnType,\n WalletGrantPermissionsParameters,\n WalletGrantPermissionsReturnType,\n WalletPermission,\n WalletPermissionCaveat,\n WalletRpcSchema,\n WalletSendCallsParameters,\n WalletSendCallsReturnType,\n WatchAssetParams,\n} from './types/eip1193.js'\nexport { ProviderRpcError as EIP1193ProviderRpcError } from './types/eip1193.js'\nexport type { BlobSidecar, BlobSidecars } from './types/eip4844.js'\nexport type { AssetGateway, AssetGatewayUrls } from './types/ens.js'\nexport type {\n FeeHistory,\n FeeValues,\n FeeValuesEIP1559,\n FeeValuesEIP4844,\n FeeValuesLegacy,\n FeeValuesType,\n} from './types/fee.js'\nexport type { Filter, FilterType } from './types/filter.js'\nexport type { GetTransactionRequestKzgParameter, Kzg } from './types/kzg.js'\nexport type { Log } from './types/log.js'\nexport type {\n ByteArray,\n CompactSignature,\n Hash,\n Hex,\n LogTopic,\n SignableMessage,\n Signature,\n} from './types/misc.js'\nexport type {\n MulticallContracts,\n MulticallResponse,\n MulticallResults,\n} from './types/multicall.js'\nexport type { Register, ResolvedRegister } from './types/register.js'\nexport type {\n Index,\n Quantity,\n RpcAccountStateOverride,\n RpcAuthorization,\n RpcAuthorizationList,\n RpcBlock,\n RpcBlockIdentifier,\n RpcBlockNumber,\n RpcFeeHistory,\n RpcFeeValues,\n RpcLog,\n RpcProof,\n RpcStateMapping,\n RpcStateOverride,\n RpcTransaction,\n RpcTransactionReceipt,\n RpcTransactionRequest,\n RpcUncle,\n Status,\n} from './types/rpc.js'\nexport type {\n StateMapping,\n StateOverride,\n} from './types/stateOverride.js'\nexport type {\n AccessList,\n Transaction,\n TransactionBase,\n TransactionEIP1559,\n TransactionEIP2930,\n TransactionEIP4844,\n TransactionEIP7702,\n TransactionLegacy,\n TransactionReceipt,\n TransactionRequest,\n TransactionRequestBase,\n TransactionRequestEIP1559,\n TransactionRequestEIP2930,\n TransactionRequestEIP4844,\n TransactionRequestEIP7702,\n TransactionRequestGeneric,\n TransactionRequestLegacy,\n TransactionSerializable,\n TransactionSerializableBase,\n TransactionSerializableEIP1559,\n TransactionSerializableEIP2930,\n TransactionSerializableEIP4844,\n TransactionSerializableEIP7702,\n TransactionSerializableGeneric,\n TransactionSerializableLegacy,\n TransactionSerialized,\n TransactionSerializedEIP1559,\n TransactionSerializedEIP2930,\n TransactionSerializedEIP4844,\n TransactionSerializedEIP7702,\n TransactionSerializedGeneric,\n TransactionSerializedLegacy,\n TransactionType,\n} from './types/transaction.js'\nexport type { GetPollOptions, GetTransportConfig } from './types/transport.js'\nexport type {\n EIP712DomainDefinition,\n MessageDefinition,\n TypedDataDefinition,\n} from './types/typedData.js'\nexport type {\n Assign,\n Branded,\n Evaluate,\n ExactPartial,\n ExactRequired,\n IsNarrowable,\n IsNever,\n IsUndefined,\n IsUnion,\n LooseOmit,\n MaybePartial,\n MaybePromise,\n MaybeRequired,\n Mutable,\n NoInfer,\n NoUndefined,\n Omit,\n OneOf,\n Or,\n PartialBy,\n Prettify,\n RequiredBy,\n Some,\n UnionEvaluate,\n UnionLooseOmit,\n UnionOmit,\n UnionPartialBy,\n UnionPick,\n UnionRequiredBy,\n UnionToTuple,\n ValueOf,\n} from './types/utils.js'\nexport type { Withdrawal } from './types/withdrawal.js'\nexport {\n type DecodeAbiParametersErrorType,\n type DecodeAbiParametersReturnType,\n decodeAbiParameters,\n} from './utils/abi/decodeAbiParameters.js'\nexport {\n type DecodeDeployDataErrorType,\n type DecodeDeployDataParameters,\n type DecodeDeployDataReturnType,\n decodeDeployData,\n} from './utils/abi/decodeDeployData.js'\nexport {\n type DecodeErrorResultErrorType,\n type DecodeErrorResultParameters,\n type DecodeErrorResultReturnType,\n decodeErrorResult,\n} from './utils/abi/decodeErrorResult.js'\nexport {\n type DecodeEventLogErrorType,\n type DecodeEventLogParameters,\n type DecodeEventLogReturnType,\n decodeEventLog,\n} from './utils/abi/decodeEventLog.js'\nexport {\n type DecodeFunctionDataErrorType,\n type DecodeFunctionDataParameters,\n type DecodeFunctionDataReturnType,\n decodeFunctionData,\n} from './utils/abi/decodeFunctionData.js'\nexport {\n type DecodeFunctionResultErrorType,\n type DecodeFunctionResultParameters,\n type DecodeFunctionResultReturnType,\n decodeFunctionResult,\n} from './utils/abi/decodeFunctionResult.js'\nexport {\n type EncodeAbiParametersErrorType,\n type EncodeAbiParametersReturnType,\n encodeAbiParameters,\n} from './utils/abi/encodeAbiParameters.js'\nexport {\n type EncodeDeployDataErrorType,\n type EncodeDeployDataParameters,\n type EncodeDeployDataReturnType,\n encodeDeployData,\n} from './utils/abi/encodeDeployData.js'\nexport {\n type EncodeErrorResultErrorType,\n type EncodeErrorResultParameters,\n type EncodeErrorResultReturnType,\n encodeErrorResult,\n} from './utils/abi/encodeErrorResult.js'\nexport {\n type EncodeEventTopicsErrorType,\n type EncodeEventTopicsParameters,\n type EncodeEventTopicsReturnType,\n encodeEventTopics,\n} from './utils/abi/encodeEventTopics.js'\nexport {\n type EncodeFunctionDataErrorType,\n type EncodeFunctionDataParameters,\n type EncodeFunctionDataReturnType,\n encodeFunctionData,\n} from './utils/abi/encodeFunctionData.js'\nexport {\n type EncodeFunctionResultErrorType,\n type EncodeFunctionResultParameters,\n type EncodeFunctionResultReturnType,\n encodeFunctionResult,\n} from './utils/abi/encodeFunctionResult.js'\nexport {\n type EncodePackedErrorType,\n encodePacked,\n} from './utils/abi/encodePacked.js'\nexport {\n type GetAbiItemErrorType,\n type GetAbiItemParameters,\n type GetAbiItemReturnType,\n getAbiItem,\n} from './utils/abi/getAbiItem.js'\nexport {\n type ParseEventLogsErrorType,\n type ParseEventLogsParameters,\n type ParseEventLogsReturnType,\n parseEventLogs,\n} from './utils/abi/parseEventLogs.js'\nexport {\n type PrepareEncodeFunctionDataErrorType,\n type PrepareEncodeFunctionDataParameters,\n type PrepareEncodeFunctionDataReturnType,\n prepareEncodeFunctionData,\n} from './utils/abi/prepareEncodeFunctionData.js'\nexport {\n type ChecksumAddressErrorType,\n checksumAddress,\n type GetAddressErrorType,\n getAddress,\n} from './utils/address/getAddress.js'\nexport {\n type GetContractAddressOptions,\n type GetCreate2AddressErrorType,\n type GetCreate2AddressOptions,\n type GetCreateAddressErrorType,\n type GetCreateAddressOptions,\n getContractAddress,\n getCreate2Address,\n getCreateAddress,\n} from './utils/address/getContractAddress.js'\nexport {\n type IsAddressErrorType,\n type IsAddressOptions,\n isAddress,\n} from './utils/address/isAddress.js'\nexport {\n type IsAddressEqualErrorType,\n type IsAddressEqualReturnType,\n isAddressEqual,\n} from './utils/address/isAddressEqual.js'\nexport {\n type BlobsToCommitmentsErrorType,\n type BlobsToCommitmentsParameters,\n type BlobsToCommitmentsReturnType,\n blobsToCommitments,\n} from './utils/blob/blobsToCommitments.js'\nexport {\n blobsToProofs,\n type blobsToProofsErrorType,\n type blobsToProofsParameters,\n type blobsToProofsReturnType,\n} from './utils/blob/blobsToProofs.js'\nexport {\n type CommitmentsToVersionedHashesErrorType,\n type CommitmentsToVersionedHashesParameters,\n type CommitmentsToVersionedHashesReturnType,\n commitmentsToVersionedHashes,\n} from './utils/blob/commitmentsToVersionedHashes.js'\nexport {\n type CommitmentToVersionedHashErrorType,\n type CommitmentToVersionedHashParameters,\n type CommitmentToVersionedHashReturnType,\n commitmentToVersionedHash,\n} from './utils/blob/commitmentToVersionedHash.js'\nexport {\n type FromBlobsErrorType,\n type FromBlobsParameters,\n type FromBlobsReturnType,\n fromBlobs,\n} from './utils/blob/fromBlobs.js'\nexport {\n type SidecarsToVersionedHashesErrorType,\n type SidecarsToVersionedHashesParameters,\n type SidecarsToVersionedHashesReturnType,\n sidecarsToVersionedHashes,\n} from './utils/blob/sidecarsToVersionedHashes.js'\nexport {\n type ToBlobSidecarsErrorType,\n type ToBlobSidecarsParameters,\n type ToBlobSidecarsReturnType,\n toBlobSidecars,\n} from './utils/blob/toBlobSidecars.js'\nexport {\n type ToBlobsErrorType,\n type ToBlobsParameters,\n type ToBlobsReturnType,\n toBlobs,\n} from './utils/blob/toBlobs.js'\nexport {\n type CcipRequestErrorType,\n type CcipRequestParameters,\n ccipRequest,\n /** @deprecated Use `ccipRequest`. */\n ccipRequest as ccipFetch,\n type OffchainLookupErrorType,\n offchainLookup,\n offchainLookupAbiItem,\n offchainLookupSignature,\n} from './utils/ccip.js'\nexport {\n type AssertCurrentChainErrorType,\n type AssertCurrentChainParameters,\n assertCurrentChain,\n} from './utils/chain/assertCurrentChain.js'\nexport { defineChain } from './utils/chain/defineChain.js'\nexport {\n type ExtractChainErrorType,\n type ExtractChainParameters,\n type ExtractChainReturnType,\n extractChain,\n} from './utils/chain/extractChain.js'\nexport {\n type GetChainContractAddressErrorType,\n getChainContractAddress,\n} from './utils/chain/getChainContractAddress.js'\nexport {\n type ConcatBytesErrorType,\n type ConcatErrorType,\n type ConcatHexErrorType,\n type ConcatReturnType,\n concat,\n concatBytes,\n concatHex,\n} from './utils/data/concat.js'\nexport { type IsBytesErrorType, isBytes } from './utils/data/isBytes.js'\nexport { type IsHexErrorType, isHex } from './utils/data/isHex.js'\nexport {\n type PadBytesErrorType,\n type PadErrorType,\n type PadHexErrorType,\n type PadReturnType,\n pad,\n padBytes,\n padHex,\n} from './utils/data/pad.js'\nexport { type SizeErrorType, size } from './utils/data/size.js'\nexport {\n type SliceBytesErrorType,\n type SliceErrorType,\n type SliceHexErrorType,\n slice,\n sliceBytes,\n sliceHex,\n} from './utils/data/slice.js'\nexport {\n type TrimErrorType,\n type TrimReturnType,\n trim,\n} from './utils/data/trim.js'\nexport {\n type BytesToBigIntErrorType,\n type BytesToBigIntOpts,\n type BytesToBoolErrorType,\n type BytesToBoolOpts,\n type BytesToNumberErrorType,\n type BytesToNumberOpts,\n type BytesToStringErrorType,\n type BytesToStringOpts,\n bytesToBigInt,\n bytesToBool,\n bytesToNumber,\n bytesToString,\n type FromBytesErrorType,\n type FromBytesParameters,\n fromBytes,\n} from './utils/encoding/fromBytes.js'\nexport {\n type FromHexErrorType,\n fromHex,\n type HexToBigIntErrorType,\n type HexToBoolErrorType,\n type HexToNumberErrorType,\n type HexToStringErrorType,\n hexToBigInt,\n hexToBool,\n hexToNumber,\n hexToString,\n} from './utils/encoding/fromHex.js'\nexport {\n type FromRlpErrorType,\n type FromRlpReturnType,\n fromRlp,\n} from './utils/encoding/fromRlp.js'\nexport {\n type BoolToBytesErrorType,\n type BoolToBytesOpts,\n boolToBytes,\n type HexToBytesErrorType,\n type HexToBytesOpts,\n hexToBytes,\n type NumberToBytesErrorType,\n numberToBytes,\n type StringToBytesErrorType,\n type StringToBytesOpts,\n stringToBytes,\n type ToBytesErrorType,\n type ToBytesParameters,\n toBytes,\n} from './utils/encoding/toBytes.js'\nexport {\n type BoolToHexErrorType,\n type BoolToHexOpts,\n type BytesToHexErrorType,\n type BytesToHexOpts,\n boolToHex,\n bytesToHex,\n type NumberToHexErrorType,\n type NumberToHexOpts,\n numberToHex,\n type StringToHexErrorType,\n type StringToHexOpts,\n stringToHex,\n type ToHexErrorType,\n type ToHexParameters,\n toHex,\n} from './utils/encoding/toHex.js'\nexport {\n type BytesToRlpErrorType,\n bytesToRlp,\n type HexToRlpErrorType,\n hexToRlp,\n type ToRlpErrorType,\n type ToRlpReturnType,\n toRlp,\n} from './utils/encoding/toRlp.js'\nexport { type LabelhashErrorType, labelhash } from './utils/ens/labelhash.js'\nexport { type NamehashErrorType, namehash } from './utils/ens/namehash.js'\nexport {\n type ToCoinTypeError,\n toCoinType,\n} from './utils/ens/toCoinType.js'\nexport {\n type GetContractErrorReturnType,\n getContractError,\n} from './utils/errors/getContractError.js'\nexport {\n type DefineBlockErrorType,\n defineBlock,\n type FormatBlockErrorType,\n type FormattedBlock,\n formatBlock,\n} from './utils/formatters/block.js'\nexport { type FormatLogErrorType, formatLog } from './utils/formatters/log.js'\nexport {\n type DefineTransactionErrorType,\n defineTransaction,\n type FormatTransactionErrorType,\n type FormattedTransaction,\n formatTransaction,\n transactionType,\n} from './utils/formatters/transaction.js'\nexport {\n type DefineTransactionReceiptErrorType,\n defineTransactionReceipt,\n type FormatTransactionReceiptErrorType,\n type FormattedTransactionReceipt,\n formatTransactionReceipt,\n} from './utils/formatters/transactionReceipt.js'\nexport {\n type DefineTransactionRequestErrorType,\n defineTransactionRequest,\n type FormatTransactionRequestErrorType,\n type FormattedTransactionRequest,\n formatTransactionRequest,\n rpcTransactionType,\n} from './utils/formatters/transactionRequest.js'\nexport { type IsHashErrorType, isHash } from './utils/hash/isHash.js'\nexport {\n type Keccak256ErrorType,\n type Keccak256Hash,\n keccak256,\n} from './utils/hash/keccak256.js'\nexport {\n type Ripemd160ErrorType,\n type Ripemd160Hash,\n ripemd160,\n} from './utils/hash/ripemd160.js'\nexport {\n type Sha256ErrorType,\n type Sha256Hash,\n sha256,\n} from './utils/hash/sha256.js'\nexport {\n type ToEventHashErrorType,\n toEventHash,\n} from './utils/hash/toEventHash.js'\nexport {\n type ToEventSelectorErrorType,\n /** @deprecated use `ToEventSelectorErrorType`. */\n type ToEventSelectorErrorType as GetEventSelectorErrorType,\n toEventSelector,\n /** @deprecated use `toEventSelector`. */\n toEventSelector as getEventSelector,\n} from './utils/hash/toEventSelector.js'\nexport {\n type ToEventSignatureErrorType,\n /** @deprecated use `ToEventSignatureErrorType`. */\n type ToEventSignatureErrorType as GetEventSignatureErrorType,\n toEventSignature,\n /** @deprecated use `toEventSignature`. */\n toEventSignature as getEventSignature,\n} from './utils/hash/toEventSignature.js'\nexport {\n type ToFunctionHashErrorType,\n toFunctionHash,\n} from './utils/hash/toFunctionHash.js'\nexport {\n type ToFunctionSelectorErrorType,\n /** @deprecated use `ToFunctionSelectorErrorType`. */\n type ToFunctionSelectorErrorType as GetFunctionSelectorErrorType,\n toFunctionSelector,\n /** @deprecated use `toFunctionSelector`. */\n toFunctionSelector as getFunctionSelector,\n} from './utils/hash/toFunctionSelector.js'\nexport {\n type ToFunctionSignatureErrorType,\n /** @deprecated use `ToFunctionSignatureErrorType`. */\n type ToFunctionSignatureErrorType as GetFunctionSignatureErrorType,\n toFunctionSignature,\n /** @deprecated use `toFunctionSignature`. */\n toFunctionSignature as getFunctionSignature,\n} from './utils/hash/toFunctionSignature.js'\nexport {\n type DefineKzgErrorType,\n type DefineKzgParameters,\n type DefineKzgReturnType,\n defineKzg,\n} from './utils/kzg/defineKzg.js'\nexport {\n type SetupKzgErrorType,\n type SetupKzgParameters,\n type SetupKzgReturnType,\n setupKzg,\n} from './utils/kzg/setupKzg.js'\nexport {\n type CreateNonceManagerParameters,\n createNonceManager,\n type NonceManager,\n type NonceManagerSource,\n nonceManager,\n} from './utils/nonceManager.js'\nexport { withCache } from './utils/promise/withCache.js'\nexport {\n type WithRetryErrorType,\n withRetry,\n} from './utils/promise/withRetry.js'\nexport {\n type WithTimeoutErrorType,\n withTimeout,\n} from './utils/promise/withTimeout.js'\nexport {\n type CompactSignatureToSignatureErrorType,\n compactSignatureToSignature,\n} from './utils/signature/compactSignatureToSignature.js'\nexport {\n type HashMessageErrorType,\n hashMessage,\n} from './utils/signature/hashMessage.js'\nexport {\n type HashDomainErrorType,\n type HashStructErrorType,\n type HashTypedDataErrorType,\n type HashTypedDataParameters,\n type HashTypedDataReturnType,\n hashDomain,\n hashStruct,\n hashTypedData,\n} from './utils/signature/hashTypedData.js'\nexport {\n type IsErc6492SignatureErrorType,\n type IsErc6492SignatureParameters,\n type IsErc6492SignatureReturnType,\n isErc6492Signature,\n} from './utils/signature/isErc6492Signature.js'\nexport {\n type IsErc8010SignatureErrorType,\n type IsErc8010SignatureParameters,\n type IsErc8010SignatureReturnType,\n isErc8010Signature,\n} from './utils/signature/isErc8010Signature.js'\nexport {\n /** @deprecated Use `ParseCompactSignatureErrorType`. */\n type ParseCompactSignatureErrorType as HexToCompactSignatureErrorType,\n type ParseCompactSignatureErrorType,\n /** @deprecated Use `parseCompactSignature`. */\n parseCompactSignature as hexToCompactSignature,\n parseCompactSignature,\n} from './utils/signature/parseCompactSignature.js'\nexport {\n type ParseErc6492SignatureErrorType,\n type ParseErc6492SignatureParameters,\n type ParseErc6492SignatureReturnType,\n parseErc6492Signature,\n} from './utils/signature/parseErc6492Signature.js'\nexport {\n type ParseErc8010SignatureErrorType,\n type ParseErc8010SignatureParameters,\n type ParseErc8010SignatureReturnType,\n parseErc8010Signature,\n} from './utils/signature/parseErc8010Signature.js'\nexport {\n /** @deprecated Use `ParseSignatureErrorType`. */\n type ParseSignatureErrorType as HexToSignatureErrorType,\n type ParseSignatureErrorType,\n /** @deprecated Use `parseSignature`. */\n parseSignature as hexToSignature,\n parseSignature,\n} from './utils/signature/parseSignature.js'\nexport {\n type RecoverAddressErrorType,\n type RecoverAddressParameters,\n type RecoverAddressReturnType,\n recoverAddress,\n} from './utils/signature/recoverAddress.js'\nexport {\n type RecoverMessageAddressErrorType,\n type RecoverMessageAddressParameters,\n type RecoverMessageAddressReturnType,\n recoverMessageAddress,\n} from './utils/signature/recoverMessageAddress.js'\nexport {\n type RecoverPublicKeyErrorType,\n type RecoverPublicKeyParameters,\n type RecoverPublicKeyReturnType,\n recoverPublicKey,\n} from './utils/signature/recoverPublicKey.js'\nexport {\n type RecoverTransactionAddressErrorType,\n type RecoverTransactionAddressParameters,\n type RecoverTransactionAddressReturnType,\n recoverTransactionAddress,\n} from './utils/signature/recoverTransactionAddress.js'\nexport {\n type RecoverTypedDataAddressErrorType,\n type RecoverTypedDataAddressParameters,\n type RecoverTypedDataAddressReturnType,\n recoverTypedDataAddress,\n} from './utils/signature/recoverTypedDataAddress.js'\nexport {\n /** @deprecated Use `SignatureToHexErrorType` instead. */\n type SerializeCompactSignatureErrorType as CompactSignatureToHexErrorType,\n type SerializeCompactSignatureErrorType,\n /** @deprecated Use `serializeCompactSignature` instead. */\n serializeCompactSignature as compactSignatureToHex,\n serializeCompactSignature,\n} from './utils/signature/serializeCompactSignature.js'\nexport {\n type SerializeErc6492SignatureErrorType,\n type SerializeErc6492SignatureParameters,\n type SerializeErc6492SignatureReturnType,\n serializeErc6492Signature,\n} from './utils/signature/serializeErc6492Signature.js'\nexport {\n type SerializeErc8010SignatureErrorType,\n type SerializeErc8010SignatureParameters,\n type SerializeErc8010SignatureReturnType,\n serializeErc8010Signature,\n} from './utils/signature/serializeErc8010Signature.js'\nexport {\n /** @deprecated Use `SignatureToHexErrorType` instead. */\n type SerializeSignatureErrorType as SignatureToHexErrorType,\n type SerializeSignatureErrorType,\n type SerializeSignatureParameters,\n type SerializeSignatureReturnType,\n /** @deprecated Use `serializeSignature` instead. */\n serializeSignature as signatureToHex,\n serializeSignature,\n} from './utils/signature/serializeSignature.js'\nexport {\n type SignatureToCompactSignatureErrorType,\n signatureToCompactSignature,\n} from './utils/signature/signatureToCompactSignature.js'\nexport {\n type ToPrefixedMessageErrorType,\n toPrefixedMessage,\n} from './utils/signature/toPrefixedMessage.js'\nexport {\n type VerifyHashErrorType,\n type VerifyHashParameters,\n type VerifyHashReturnType,\n verifyHash,\n} from './utils/signature/verifyHash.js'\nexport {\n type VerifyMessageErrorType,\n type VerifyMessageParameters,\n type VerifyMessageReturnType,\n verifyMessage,\n} from './utils/signature/verifyMessage.js'\nexport {\n type VerifyTypedDataErrorType,\n type VerifyTypedDataParameters,\n type VerifyTypedDataReturnType,\n verifyTypedData,\n} from './utils/signature/verifyTypedData.js'\nexport { type StringifyErrorType, stringify } from './utils/stringify.js'\nexport {\n type AssertRequestErrorType,\n assertRequest,\n} from './utils/transaction/assertRequest.js'\nexport {\n type AssertTransactionEIP1559ErrorType,\n type AssertTransactionEIP2930ErrorType,\n type AssertTransactionLegacyErrorType,\n assertTransactionEIP1559,\n assertTransactionEIP2930,\n assertTransactionLegacy,\n} from './utils/transaction/assertTransaction.js'\nexport {\n type GetSerializedTransactionType,\n type GetSerializedTransactionTypeErrorType,\n getSerializedTransactionType,\n} from './utils/transaction/getSerializedTransactionType.js'\nexport {\n type GetTransactionType,\n type GetTransactionTypeErrorType,\n getTransactionType,\n} from './utils/transaction/getTransactionType.js'\nexport {\n type ParseTransactionErrorType,\n type ParseTransactionReturnType,\n parseTransaction,\n} from './utils/transaction/parseTransaction.js'\nexport {\n type SerializeAccessListErrorType,\n serializeAccessList,\n} from './utils/transaction/serializeAccessList.js'\nexport {\n type SerializedTransactionReturnType,\n type SerializeTransactionErrorType,\n type SerializeTransactionFn,\n serializeTransaction,\n} from './utils/transaction/serializeTransaction.js'\nexport {\n type DomainSeparatorErrorType,\n domainSeparator,\n type GetTypesForEIP712DomainErrorType,\n getTypesForEIP712Domain,\n type SerializeTypedDataErrorType,\n serializeTypedData,\n type ValidateTypedDataErrorType,\n validateTypedData,\n} from './utils/typedData.js'\nexport {\n type FormatEtherErrorType,\n formatEther,\n} from './utils/unit/formatEther.js'\nexport {\n type FormatGweiErrorType,\n formatGwei,\n} from './utils/unit/formatGwei.js'\nexport {\n type FormatUnitsErrorType,\n formatUnits,\n} from './utils/unit/formatUnits.js'\nexport {\n type ParseEtherErrorType,\n parseEther,\n} from './utils/unit/parseEther.js'\nexport { type ParseGweiErrorType, parseGwei } from './utils/unit/parseGwei.js'\nexport {\n type ParseUnitsErrorType,\n parseUnits,\n} from './utils/unit/parseUnits.js'\n","/**\n * @module toJSON\n */\n\n/**\n * Interface for parameters passed to the toJSON function.\n * @template T The type of the object to be converted to JSON.\n */\nexport interface IToJSONParams<T extends { [key: string]: any } = { [key: string]: any }> {\n /** The object to convert. */\n obj: T;\n /** The depth for recursive conversion. Defaults to 0. */\n depth?: number;\n}\n\n/**\n * Checks if an object is a class instance (not a native JavaScript object like Array, Date, etc.).\n * @param {any} obj The object to check.\n * @returns {boolean} True if the object is a class instance, false otherwise.\n */\nfunction isClassInstance(obj: any): boolean {\n if (!obj) return false;\n\n const constructor = obj.constructor;\n const nativeConstructors = [Array, Date, RegExp, Map, Set, Promise, Function, Number, String, Boolean, Error, Object];\n\n if (nativeConstructors.includes(constructor)) {\n return false;\n }\n\n return true\n};\n\n/**\n * Recursively converts BigInt values in an object to strings.\n * @param {any} obj The object to convert.\n * @returns {any} The object with BigInts converted to strings.\n */\nfunction convertBigintsToStrings(obj: any): any {\n if (typeof obj === 'bigint') {\n return obj.toString() + \"n\";\n }\n\n if (typeof obj === 'object') {\n for (const key in obj) {\n obj[key] = convertBigintsToStrings(obj[key]);\n }\n }\n\n if (Array.isArray(obj)) {\n for (let i = 0; i < obj.length; i++) {\n obj[i] = convertBigintsToStrings(obj[i]);\n }\n }\n\n return obj;\n}\n\n/**\n * Converts an object, including its nested class instances and getter methods, into a plain JSON object.\n * BigInt values are converted to strings.\n *\n * @param params - The parameters for conversion.\n * @param params.obj - The object to convert.\n * @param [params.depth=0] - The depth for recursive conversion. Defaults to 0.\n * @returns A promise that resolves to the JSON representation of the object.\n */\nexport async function toJSON({ obj, depth = 0 }: IToJSONParams) {\n const data: any = {};\n const promises: Promise<any>[] = [];\n\n for (const key in obj) {\n // skip class related properties\n if (key === \"toJSON\" || key === \"constructor\" || key === \"client\" || key === \"persistenceManager\") continue;\n\n const prop: any = obj[key];\n\n if (typeof prop === \"function\") {\n // do not fetch getters if depth is 0\n if (depth === 0) continue;\n\n const promise = async () => {\n const value = await obj[key]();\n\n // if the value is a class instance, convert it to JSON recursively\n if (typeof value === \"object\" && isClassInstance(value)) return data[key] = await toJSON({ obj: value, depth: depth - 1 });\n\n data[key] = value;\n };\n\n promises.push(promise());\n };\n\n if (typeof prop === \"object\" && isClassInstance(prop)) {\n // If depth is 0, just flatten the object using recursion\n if (depth === 0) {\n const promise = async () => {\n data[key] = await toJSON({\n obj: prop,\n depth: depth - 1\n });\n };\n promises.push(promise());\n\n continue;\n };\n \n // If depth is not 0, fetch the object\n const promise = async () => {\n data[key] = await prop.toJSON({ depth: depth - 1 });\n };\n promises.push(promise());\n\n continue;\n };\n\n data[key] = prop;\n };\n\n await Promise.all(promises);\n\n return convertBigintsToStrings(data);\n};","import { Block as RawBlock, Hash, Hex, Withdrawal } from \"@mentaproject/core\";\n\nimport { Account } from \"./Account\";\nimport { Transaction } from \"./Transaction\";\nimport { JSONBlock } from \"../types/Block\";\nimport { toJSON } from \"../utils/toJSON\";\nimport { MentaClient } from \"./MentaClient\";\n\n/**\n * @description Represents a blockchain block with its properties and methods.\n * This class provides a structured way to access block-related data and interact with the blockchain client.\n */\nexport class Block implements Omit<RawBlock, \"miner\" | \"transactions\"> {\n /**\n * @description The base fee per gas for the block.\n */\n baseFeePerGas: bigint | null\n /**\n * @description The gas used for blobs in the block.\n */\n blobGasUsed: bigint\n /**\n * @description The block's difficulty.\n */\n difficulty: bigint\n /**\n * @description The excess blob gas in the block.\n */\n excessBlobGas: bigint\n /**\n * @description Extra data included in the block.\n */\n extraData: Hex\n /**\n * @description The gas limit for the block.\n */\n gasLimit: bigint\n /**\n * @description The gas used in the block.\n */\n gasUsed: bigint\n /**\n * @description The hash of the block.\n */\n hash: Hash | null\n /**\n * @description The logs bloom filter for the block.\n */\n logsBloom: Hex | null\n /**\n * @description The mix hash of the block.\n */\n mixHash: Hash\n /**\n * @description The nonce of the block.\n */\n nonce: Hex | null\n /**\n * @description The block number.\n */\n number: bigint | null\n /**\n * @description The parent beacon block root.\n */\n parentBeaconBlockRoot?: Hex\n /**\n * @description The hash of the parent block.\n */\n parentHash: Hash\n /**\n * @description The root of the receipts trie.\n */\n receiptsRoot: Hex\n /**\n * @description The seal fields of the block.\n */\n sealFields: Hex[]\n /**\n * @description The SHA3 uncles hash.\n */\n sha3Uncles: Hash\n /**\n * @description The size of the block in bytes.\n */\n size: bigint\n /**\n * @description The state root of the block.\n */\n stateRoot: Hash\n /**\n * @description The timestamp of the block.\n */\n timestamp: bigint\n /**\n * @description The total difficulty of the chain up to this block.\n */\n totalDifficulty: bigint | null\n /**\n * @description The root of the transactions trie.\n */\n transactionsRoot: Hash\n /**\n * @description The list of uncle hashes.\n */\n uncles: Hash[]\n /**\n * @description The list of withdrawals.\n */\n withdrawals?: Withdrawal[]\n /**\n * @description The root of the withdrawals trie.\n */\n withdrawalsRoot?: Hex\n\n /**\n * @description The miner of the block, represented as an Account instance.\n */\n miner: Account\n /**\n * @description The transactions included in the block, represented as an array of Transaction instances.\n */\n transactions?: Transaction[] | Hash[]\n\n /**\n * @description Creates an instance of Block.\n * @param client - The instance of MentaClient used to interact with the blockchain.\n * @param data The raw block data conforming to IBlockData.\n * @param includeTransactions Whether to include full transaction objects. Defaults to false.\n */\n constructor(public client: MentaClient, data: RawBlock) {\n this.baseFeePerGas = data.baseFeePerGas;\n this.blobGasUsed = data.blobGasUsed;\n this.difficulty = data.difficulty;\n this.excessBlobGas = data.excessBlobGas;\n this.extraData = data.extraData;\n this.gasLimit = data.gasLimit;\n this.gasUsed = data.gasUsed;\n this.hash = data.hash;\n this.logsBloom = data.logsBloom;\n this.mixHash = data.mixHash;\n this.nonce = data.nonce;\n this.number = data.number;\n this.parentBeaconBlockRoot = data.parentBeaconBlockRoot;\n this.parentHash = data.parentHash;\n this.receiptsRoot = data.receiptsRoot;\n this.sealFields = data.sealFields;\n this.sha3Uncles = data.sha3Uncles;\n this.size = data.size;\n this.stateRoot = data.stateRoot;\n this.timestamp = data.timestamp;\n this.totalDifficulty = data.totalDifficulty;\n this.transactionsRoot = data.transactionsRoot;\n this.uncles = data.uncles;\n this.withdrawals = data.withdrawals;\n this.withdrawalsRoot = data.withdrawalsRoot;\n\n this.miner = new Account(this.client, { address: data.miner});\n \n if (!data.transactions || data.transactions.length === 0) {\n const parsed = data.transactions.map((data) => typeof data === \"string\" ? data : new Transaction(this.client, data))\n this.transactions = parsed as Transaction[] | Hash[];\n }\n };\n\n protected includeTransactions(): this is this & { transactions: Transaction[] } {\n if (!this.transactions || this.transactions.length === 0) return false;\n return true\n }\n\n /**\n * @description Converts the Block instance to a JSON representation.\n * This method serializes the block's properties into a plain JavaScript object,\n * suitable for JSON serialization.\n * @param depth The depth of the conversion. Defaults to 1.\n * @returns A promise that resolves to the JSON representation of the block.\n */\n async toJSON<D extends number = 1>(depth: D): Promise<JSONBlock<D>> {\n return await toJSON({\n obj: {\n ...this,\n },\n depth\n });\n }\n};","/**\n * @module MentaClient\n */\nimport type { MentaAccountClient } from \"@mentaproject/core/types\";\nimport { createMentaAccount } from \"@mentaproject/core/clients\";\nimport { createClient } from \"@mentaproject/core\";\n\nimport { BlockManager } from \"../managers/BlockManager\";\nimport { TransactionManager } from \"../managers/TransactionManager\";\nimport { ContractManager } from \"../managers/ContractManager\";\nimport { AccountManager } from \"../managers/AccountManager\";\nimport { PersistenceManager } from \"../managers/PersistenceManager\";\nimport {\n ClientEvents,\n GetListenerCallback,\n MentaClientConfig,\n} from \"../types/MentaClient\";\nimport { withCache } from \"../utils/withCache\";\nimport { Account } from \"./Account\";\n\n/**\n * The main client for interacting with the Menta API.\n * It provides managers for blocks, transactions, contracts, and accounts.\n *\n * @description This class serves as the primary entry point for interacting with the Menta blockchain.\n * It encapsulates the core RPC client and provides specialized managers for various blockchain entities,\n * simplifying common operations.\n */\nexport class MentaClient {\n protected _rpc?: MentaAccountClient;\n protected _account?: Account;\n /**\n * The underlying RPC client used for blockchain interactions.\n * @description This client is responsible for low-level communication with the RPC node.\n */\n public get rpc(): MentaAccountClient {\n if (!this._rpc) {\n throw new Error(\"RPC client not initialized\");\n }\n return this._rpc;\n }\n\n /**\n * The account associated with the client.\n * @description This account is used for signing transactions and interacting with the blockchain.\n */\n public get account(): Account {\n if (!this._account) {\n throw new Error(\"Account not initialized\");\n }\n return this._account;\n }\n\n /**\n * Manager for block-related operations.\n * @description Provides methods to query and interact with blockchain blocks.\n */\n public blocks!: BlockManager;\n /**\n * Manager for transaction-related operations.\n * @description Provides methods to send, query, and manage blockchain transactions.\n */\n public transactions!: TransactionManager;\n /**\n * Manager for contract-related operations.\n * @description Provides methods to deploy, interact with, and query smart contracts.\n */\n public contracts!: ContractManager;\n /**\n * Manager for account-related operations.\n * @description Provides methods to manage and interact with blockchain accounts.\n */\n public accounts!: AccountManager;\n\n /**\n * Subscribes to a specific client event.\n * @template TEvent The type of the event to listen for.\n * @param {TEvent} event - The event to listen for (e.g., 'block', 'transaction').\n * @param {GetListenerCallback<TEvent>} callback - The callback function to execute when the event is triggered.\n * @returns {() => void} An unsubscribe function to stop listening to the event.\n * @description This method allows the client to listen for real-time events from the blockchain, such as new blocks or transactions.\n * @example\n * import { MentaClient } from '@mentaproject/client';\n *\n * const client = new MentaClient({ url: 'http://rpcurlhere.com' });\n *\n * // Subscribe to new blocks\n * const unsubscribe = client.on('block', (block) => {\n * console.log('New block received:', block);\n * });\n *\n * // To stop listening\n * // unsubscribe();\n */\n on<TEvent extends keyof typeof ClientEvents>(\n event: TEvent,\n callback: GetListenerCallback<TEvent>,\n ) {\n const eventFunction = ClientEvents[event];\n const capitalizedEvent = event.charAt(0).toUpperCase() + event.slice(1);\n const params = {\n [`on${capitalizedEvent}`]: callback,\n pollingInterval: 1000,\n };\n\n return (eventFunction as any)(this.rpc, params);\n }\n\n /**\n * Creates an instance of MentaClient.\n * @param {MentaClientConfig} params - The configuration parameters for the client.\n * @description The constructor initializes the RPC client and the various managers based on the provided configuration.\n * It also applies caching and persistence if specified in the configuration.\n * @example\n * import { MentaClient } from '@mentaproject/client';\n *\n * // Basic initialization\n * const client = new MentaClient({\n * url: 'http://rpcurlhere.com',\n * });\n *\n * // Initialization with a persistent cache\n * const clientWithCache = new MentaClient({\n * url: 'http://rpcurlhere.com',\n * cache: {\n * ttl: 60000, // 1 minute\n * },\n * });\n */\n constructor(protected params: MentaClientConfig) {\n this.blocks = new BlockManager(this);\n this.transactions = new TransactionManager(this);\n this.contracts = new ContractManager(this);\n\n if (params.persistenceAdapter) {\n this.persistenceManager = new PersistenceManager(\n this,\n params.persistenceAdapter,\n );\n this.accounts = new AccountManager(this, this.persistenceManager);\n } else {\n this.accounts = new AccountManager(this);\n }\n }\n\n async init() {\n let coreClient = createClient(this.params);\n\n if (this.params.cache) {\n coreClient = withCache(coreClient, this.params.cache);\n }\n\n this._rpc = await createMentaAccount(coreClient as any, {\n bundlerTransport: this.params.bundlerTransport,\n publicTransport: this.params.transport,\n signer: this.params.signer,\n validatorAddress: this.params.validatorAddress,\n });\n\n this._account = this.accounts.get(this.rpc.account.address);\n }\n\n /**\n * Optional manager for persistence-related operations.\n * @description This manager is initialized if a persistence adapter is provided in the client configuration,\n * allowing for data storage and retrieval.\n */\n public persistenceManager?: PersistenceManager;\n}\n","/**\n * @module BlockManager\n */\nimport { BlockTag, GetBlockParameters } from \"@mentaproject/core/types\";\nimport { Block } from \"../structures/Block\";\nimport { getBlock } from \"@mentaproject/core/actions\";\nimport { MentaClient } from \"../structures\";\n\n/**\n * Manages blockchain block-related operations, providing methods to interact with and retrieve block data.\n */\nexport class BlockManager {\n /**\n * Creates an instance of BlockManager.\n * @param client - The instance of MentaClient used to interact with the blockchain.\n */\n constructor(public client: MentaClient) {};\n\n /**\n * Retrieves a block from the blockchain based on the provided parameters.\n * This method uses the underlying RPC client to fetch block data and then\n * encapsulates it within a {@link Block} instance.\n * @param params The parameters for retrieving the block, including block hash, block number, or block tag.\n * @returns A promise that resolves to a {@link Block} instance representing the retrieved block.\n * @example\n * import { http } from '@mentaproject/core';\n * import { mainnet } from '@mentaproject/core/chains';\n * import { MentaClient } from '@mentaproject/client';\n *\n * // Initialize the MentaClient\n * const mentaClient = new MentaClient({ chain: mainnet, transport: http(\"http://rpcurlhere.com\") });\n *\n * async function fetchBlock() {\n * // Retrieve the latest block\n * const latestBlock = await mentaClient.blocks.get({ blockTag: 'latest' });\n * console.log('Latest block number:', latestBlock.number);\n *\n * // Retrieve a specific block by its number\n * if (latestBlock.number) {\n * const specificBlock = await mentaClient.blocks.get({ blockNumber: latestBlock.number - 10n });\n * console.log('Specific block hash:', specificBlock.hash);\n * }\n * }\n *\n * fetchBlock();\n */\n async get(params: GetBlockParameters<boolean, BlockTag>): Promise<Block> {\n const data = await getBlock(this.client.rpc, params);\n return new Block(this.client, data);\n };\n}","/**\n * @module TransactionManager\n */\nimport { GetTransactionParameters, Transaction as RawTransaction, SendTransactionParameters } from \"@mentaproject/core/types\";\nimport { Transaction } from \"../structures/Transaction\";\nimport { getTransaction, sendTransaction } from \"@mentaproject/core/actions\";\nimport { MentaClient } from \"../structures\";\nimport { JSONTransaction } from \"../types\";\nimport { parseBingints } from \"../utils/bigint\";\n\n/**\n * Manages blockchain transaction-related operations, providing methods to retrieve and send transactions.\n * @class\n * @description This class provides an interface to interact with blockchain transactions,\n * allowing for retrieval of transaction details and submission of new transactions\n * to the network via an RPC client.\n */\nexport class TransactionManager {\n /**\n * Creates an instance of `TransactionManager`.\n * @constructor\n * @param {MentaClient} client - The instance of MentaClient used to interact with the blockchain.\n */\n constructor(public client: MentaClient) {};\n\n /**\n * Retrieves a transaction by its hash or block number and index.\n * @description This method fetches detailed information about a specific transaction\n * from the blockchain using the provided parameters.\n * @param {GetTransactionParameters} params - The parameters for retrieving the transaction,\n * typically including `hash` or `blockNumber` and `index`.\n * @returns {Promise<Transaction>} A promise that resolves to a {@link Transaction} instance\n * containing the retrieved transaction data.\n * @example\n * const txHash = '0x...'; // Replace with a valid transaction hash\n * const transaction = await client.transactions.get({ hash: txHash });\n * console.log(transaction);\n */\n async get(params: GetTransactionParameters): Promise<Transaction> {\n const data = await getTransaction(this.client.rpc, params);\n return new Transaction(this.client, data);\n };\n\n /**\n * Parse a transaction object from a JSON converted transaction data object.\n * \n * @param {J} data - The JSON converted transaction data object.\n * @returns {Transaction} A Transaction instance representing the parsed transaction.\n */\n parse<J extends JSONTransaction<0>>(data: J): Transaction {\n const parsed = parseBingints(data);\n\n const rawData = {\n ...parsed,\n from: parsed.from.address,\n to: parsed.to ? parsed.to.address : null,\n };\n \n return new Transaction(this.client, rawData as RawTransaction);\n };\n\n /**\n * Sends a transaction to the blockchain network.\n * @description This method submits a new transaction to the blockchain. After the transaction\n * is successfully sent, it retrieves and returns the full transaction details.\n * @param {SendTransactionParameters} params - The parameters required to send the transaction,\n * such as `to`, `value`, `data`, `gasLimit`, etc.\n * @returns {Promise<Transaction>} A promise that resolves to a {@link Transaction} instance\n * representing the sent transaction, including its hash and other details.\n * @example\n * import { MentaClient } from '@mentaproject/client';\n * import { http } from '@mentaproject/core';\n *\n * // This example assumes you have an account with funds, which is available to the client.\n * const client = new MentaClient({\n * chain: 'mainnet',\n * transport: http('http://rpcurlhere.com')\n * });\n *\n * const transactionResult = await client.transactions.send({\n * to: '0xRecipientAddress...', // Replace with a valid recipient address\n * value: 1000000000000000000n, // 1 ETH in wei\n * });\n *\n * console.log('Transaction sent with hash:', transactionResult.hash);\n */\n async send(params: SendTransactionParameters): Promise<Transaction> {\n const hash = await sendTransaction(this.client.rpc, params);\n \n return await this.get({ hash });\n };\n};","import { WithoutBigintStringified } from \"../types/Utils\";\n\nexport const bigIntMax = (...args: bigint[]) => args.reduce((m, e) => e > m ? e : m);\nexport const bigIntMin = (...args: bigint[]) => args.reduce((m, e) => e < m ? e : m);\n\nexport function bigIntReviver(key: string, value: any) {\n if (typeof value === 'string') {\n if (value.endsWith('n')) {\n try {\n return BigInt(value.slice(0, -1));\n } catch (e) {\n return value;\n }\n };\n };\n\n return value;\n};\n\nexport function stringifyBingints(obj: any) {\n if (typeof obj === 'bigint') {\n return obj.toString() + \"n\";\n }\n\n if (typeof obj === 'object') {\n for (const key in obj) {\n obj[key] = stringifyBingints(obj[key]);\n }\n }\n\n if (Array.isArray(obj)) {\n for (let i = 0; i < obj.length; i++) {\n obj[i] = stringifyBingints(obj[i]);\n }\n }\n\n return obj;\n};\n\nexport function parseBingints<T extends { [key: string]: any }>(obj: T): WithoutBigintStringified<T> {\n if (typeof obj !== 'object' || obj === null) {\n return obj;\n }\n\n if (Array.isArray(obj)) {\n return obj.map((item, index) => bigIntReviver(index.toString(), parseBingints(item))) as WithoutBigintStringified<T>;\n }\n\n const newObj: { [key: string]: any } = {};\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n const value = obj[key];\n const processedValue = parseBingints(value);\n newObj[key] = bigIntReviver(key, processedValue);\n }\n };\n\n return newObj as WithoutBigintStringified<T>;\n};","/**\n * @module ContractManager\n */\nimport type { AbiItem } from \"@mentaproject/core/types\";\nimport { getContract, GetContractParameters } from \"@mentaproject/contracts\";\nimport { MentaClient } from \"../structures\";\n\n/**\n * Manages smart contract-related operations within the Menta client.\n * This class provides methods to interact with smart contracts deployed on the blockchain,\n * facilitating the retrieval of contract instances for various operations.\n */\nexport class ContractManager {\n /**\n * Creates an instance of ContractManager.\n * @description Initializes the ContractManager with a CoreClient instance, which is used for RPC communication.\n * @param client - The instance of MentaClient used to interact with the blockchain.\n */\n constructor(protected client: MentaClient) {};\n\n /**\n * Retrieves a contract instance to interact with it.\n * @description This method fetches a contract instance based on the provided parameters, allowing for interaction with its methods and events.\n * @template P The type of the contract retrieval parameters, extending `GetContractParameters` with `AbiItem` array.\n * @param {P} params The parameters for retrieving the contract, including its Application Binary Interface (ABI) and address.\n * @returns {ReturnType<typeof getContract<ReadonlyArray<AbiItem>, P>>} A contract instance that can be used to call contract methods or listen to events.\n * @example\n * import { MentaClient } from '@mentaproject/client';\n * import { http } from '@mentaproject/core';\n *\n * // Initialize the MentaClient with a transport\n * const client = new MentaClient({\n * transport: http('http://rpcurlhere.com'),\n * });\n *\n * // Define the ABI and address for the smart contract\n * const abi = [\n * {\n * \"type\": \"function\",\n * \"name\": \"greet\",\n * \"stateMutability\": \"view\",\n * \"inputs\": [],\n * \"outputs\": [{ \"name\": \"\", \"type\": \"string\" }]\n * }\n * ] as const;\n * const contractAddress = '0x...'; // Replace with your contract address\n *\n * // Retrieve the contract instance\n * const contract = client.contracts.get({\n * abi,\n * address: contractAddress,\n * });\n *\n * // Example of interacting with the contract\n * const greeting = await contract.greet();\n */\n get<P extends GetContractParameters<ReadonlyArray<AbiItem>>>(params: P) {\n return getContract(this.client.rpc, params);\n };\n};","/**\n * @module AccountManager\n */\nimport { Address } from \"@mentaproject/core/types\";\nimport { Account } from \"../structures/Account\";\nimport { PersistenceManager } from \"./PersistenceManager\";\nimport { MentaClient } from \"../structures\";\n\n/**\n * Manages blockchain account operations.\n * This class provides methods to interact with accounts,\n * including retrieving and managing them via an RPC client and a persistence manager.\n *\n * @class AccountManager\n */\nexport class AccountManager {\n /**\n * Creates an instance of AccountManager.\n *\n * @param {MentaClient} client - The instance of MentaClient used to interact with the blockchain.\n * @param {persistenceManager} persistenceManager - The optional persistence manager to store and retrieve account data.\n */\n constructor(public client: MentaClient, private persistenceManager?: PersistenceManager) { };\n\n /**\n * Retrieves an account instance by its blockchain address.\n * @param address - The blockchain address of the account to retrieve.\n * @returns An instance of the `Account` class.\n * @example\n * ```typescript\n * import { MentaClient } from '@mentaproject/client';\n * import { http } from '@mentaproject/core';\n *\n * // Initialize the MentaClient\n * const client = new MentaClient({\n * transport: http('http://rpcurlhere.com'),\n * });\n *\n * // The address of the account to retrieve\n * const accountAddress = '0x1234567890123456789012345678901234567890';\n *\n * // Retrieve the account instance using the account manager from the client\n * const account = client.accounts.get(accountAddress);\n *\n * console.log(account.address); // 0x1234567890123456789012345678901234567890\n * ```\n */\n get(address: Address): Account {\n return new Account(this.client, { address: address }, this.persistenceManager);\n };\n}","import { getBlockNumber } from '@mentaproject/core/actions';\nimport { Address } from '@mentaproject/core/types';\n\nimport { Account } from '../structures/Account';\nimport { MentaClient, Transaction } from '../structures';\nimport { bigIntMax } from '../utils/bigint';\nimport { GetTransactionsParams, IPersistenceAdapter, JSONTransaction } from 'src/types';\n\n/**\n * Manages the persistence of data, including transactions, using a specified persistence adapter.\n * It handles fetching data from both local storage and remote sources, and synchronizing them.\n */\nexport class PersistenceManager {\n /**\n * Creates an instance of PersistenceManager.\n * @param client - The instance of MentaClient used to interact with the blockchain.\n * @param persistenceAdapter - The adapter responsible for actual data persistence operations.\n */\n constructor(\n private client: MentaClient,\n private persistenceAdapter: IPersistenceAdapter\n ) {}\n\n /**\n * Retrieves transactions for a given account, applying a \"stale-while-revalidate\" strategy.\n * @param params - Parameters for retrieving transactions.\n * @returns A promise that resolves to an array of transactions with associated account information.\n */\n public async getTransactions(address: Address, params: GetTransactionsParams): Promise<JSONTransaction<0>[]> {\n return await this.persistenceAdapter.getTransactions(address, params);\n }\n\n /**\n * Synchronizes an account's transactions from the remote source to the local persistence.\n * It fetches new transactions starting from the last synced block and updates the local storage.\n * @param account - The account whose transactions are to be synchronized.\n * @param limit - The maximum number of transactions to fetch.\n * @returns A promise that resolves when the synchronization is complete.\n */\n public async syncTransactions(account: Account, limit: number = 100_000): Promise<void> {\n const lastSyncedBlock = await this.persistenceAdapter.getLastSyncedBlock(account.address);\n const lastBlock = lastSyncedBlock ?? 0n;\n\n const fromBlock = lastSyncedBlock ? lastSyncedBlock + 1n : (await getBlockNumber(this.client.rpc));\n\n const newTransactions = await account.transactions({\n fromBlock: fromBlock,\n toBlock: lastBlock,\n limit: limit\n }, true)\n\n if (newTransactions.length > 0) {\n await this.persistenceAdapter.upsertTransactions(newTransactions);\n \n const latestBlock = bigIntMax(...newTransactions.map(t => t.blockNumber || 0n));\n await this.persistenceAdapter.setLastSyncedBlock(account.address, latestBlock);\n }\n }\n}","/**\n * @module MentaClientTypes\n */\nimport { Address, CoreClientConfig, Transport } from \"@mentaproject/core/types\";\nimport { ICache } from \"./Cache\";\nimport { watchBlockNumber, watchBlocks } from \"@mentaproject/core/actions\";\nimport { IPersistenceAdapter } from \"./PersistenceAdapter\";\nimport { WebAuthnAccount } from \"@mentaproject/core/account-abstraction\";\n\n/**\n * Configuration for the client's cache.\n * @interface CacheConfig\n */\nexport interface CacheConfig {\n /**\n * Time-to-live policies for different RPC methods.\n * Keys are RPC method names (e.g., \"eth_getBlockByNumber\"), and values are\n * the TTL in milliseconds for caching responses from those methods.\n */\n ttl_policies: Record<string, number>;\n}\n\n/**\n * Configuration options for the MentaClient.\n * Extends {@link CoreClientConfig} from `@mentaproject/core`.\n * @interface MentaClientConfig\n */\nexport interface MentaClientConfig extends CoreClientConfig {\n /**\n * Optional cache implementation for the client.\n * If provided, the client will use this cache for RPC responses.\n */\n cache?: ICache;\n /**\n * Optional persistence adapter for local data storage.\n * If provided, the client will use this adapter to persist and retrieve data.\n */\n persistenceAdapter?: IPersistenceAdapter;\n /**\n * Bundler transport used for userOperations\n */\n bundlerTransport: Transport;\n /**\n * Passkey compatible signer used for signing user operations\n */\n signer: WebAuthnAccount;\n /**\n * Validator address used for userOperations\n */\n validatorAddress: Address;\n}\n\n/**\n * Defines the available client events and their corresponding watch functions.\n * These functions are used to subscribe to real-time updates from the client.\n */\nexport const ClientEvents = {\n /**\n * Event for new blocks.\n * Uses the {@link watchBlocks} function from `@mentaproject/core`.\n */\n block: watchBlocks,\n /**\n * Event for new block numbers.\n * Uses the {@link watchBlockNumber} function from `@mentaproject/core`.\n */\n blockNumber: watchBlockNumber,\n};\n\n/**\n * Utility type to extract the callback function type for a given event.\n * This type dynamically determines the expected callback signature for a specific client event.\n * @template TEvent The name of the event (e.g., 'block' or 'blockNumber') for which to get the listener callback type.\n */\nexport type GetListenerCallback<TEvent extends keyof typeof ClientEvents> =\n Parameters<(typeof ClientEvents)[TEvent]>[1] extends infer P\n ? P extends { [K in `on${Capitalize<TEvent>}`]: infer TCallback }\n ? TCallback\n : never\n : never;\n","/**\n * @module withCache\n */\nimport { watchBlockNumber } from \"@mentaproject/core/actions\";\nimport type { CoreClient } from \"@mentaproject/core/types\";\nimport { ICache } from \"../types/Cache\";\nimport { Methods } from \"../types/JsonRPC\";\n\n// EntryPoint.getNonce selector - must never be cached to avoid nonce reuse\nconst GET_NONCE_SELECTOR = \"0x35567e1a\";\n\n/**\n * Checks if an eth_call is a getNonce call to the EntryPoint.\n * These calls must not be cached to ensure fresh nonce values for each UserOperation.\n */\nfunction isNonceCall(method: Methods, params: any): boolean {\n if (method !== \"eth_call\") return false;\n const callData = params?.[0]?.data;\n return typeof callData === \"string\" && callData.startsWith(GET_NONCE_SELECTOR);\n}\n\n/**\n * A higher-order function that enhances a class method with caching capabilities.\n * It intercepts RPC requests made through the client and caches their responses\n * based on the provided cache implementation.\n *\n * @param client The CoreClient instance to enhance with caching.\n * @param cache The cache implementation (ICache) to use for storing and retrieving responses.\n * @returns The enhanced CoreClient instance with caching enabled.\n */\nexport function withCache<T extends CoreClient>(client: T, cache: ICache): T {\n watchBlockNumber(client, {\n onBlockNumber: (blockNumber) => {\n cache.setBlockNumber(blockNumber);\n },\n pollingInterval: 1000,\n });\n // 2. We keep a reference to the original request method\n const originalRequest = client.request;\n\n // 3. We replace the client's `request` method\n client.request = (async (args: { method: Methods, params: any }) => {\n const { method, params } = args;\n\n // Never cache nonce calls - they must always return fresh values\n const shouldSkipCache = method === \"eth_blockNumber\" || isNonceCall(method, params);\n\n const cacheKey = `${client.chain!.id}:${method}:${JSON.stringify(params || [], (_, v) => typeof v === 'bigint' ? v.toString() : v)}`;\n\n let result;\n if (!shouldSkipCache) {\n result = cache.get(cacheKey);\n }\n\n if (!result) {\n result = await originalRequest(args as any);\n };\n\n if (result !== null && result !== undefined && !shouldSkipCache) {\n const ttl = cache.config.ttlPolicies[method] || cache.config.defaultTtl;\n await cache.set(cacheKey, result, ttl);\n }\n\n return result;\n }) as any;\n\n return client;\n}\n","/**\n * @module MemoryCache\n */\nimport { ICache, ICacheEntry, ICacheConfig } from '../types/Cache';\n\n/**\n/**\n * @class MemoryCache\n * @description A simple in-memory cache implementation that adheres to the ICache interface.\n * It stores key-value pairs with an associated time-to-live (TTL) based on block numbers.\n * The cache automatically evicts the oldest entries when its maximum size is reached.\n */\nexport class MemoryCache implements ICache {\n /**\n * @property {Map<string, ICacheEntry<any>>} cache - The internal Map used to store cache entries.\n * @private\n */\n private cache = new Map<string, ICacheEntry<any>>();\n /**\n * @property {ICacheConfig} config - The configuration object for the cache, including maxSize, defaultTtl, and ttlPolicies.\n */\n public config: ICacheConfig;\n /**\n * @property {bigint} blockNumber - The current block number used for TTL calculations.\n * @private\n */\n private blockNumber: bigint;\n\n /**\n * @constructor\n * @description Creates an instance of MemoryCache.\n * @param {bigint} blockNumber - The current block number to use for TTL calculations.\n * @param {Partial<ICacheConfig>} [options] - Optional configuration for the cache.\n * @param {number} [options.maxSize=500] - The maximum number of entries the cache can hold.\n * @param {number} [options.defaultTtl=1] - The default time-to-live in blocks for cache entries if not specified.\n * @param {Object.<string, number>} [options.ttlPolicies={}] - A map of specific TTL policies for different keys.\n */\n constructor(blockNumber: bigint, options?: Partial<ICacheConfig>) {\n this.blockNumber = blockNumber;\n this.config = {\n maxSize: 500,\n defaultTtl: 1,\n ttlPolicies: options?.ttlPolicies || {},\n ...options,\n };\n };\n\n /**\n * @method isExpired\n * @description Checks if a cache entry has expired based on the current block number and the entry's expiry block.\n * @param {bigint} expiry - The expiry block number of the cache entry.\n * @returns {boolean} `true` if the entry has expired, `false` otherwise.\n * @protected\n */\n protected isExpired(expiry: bigint): boolean {\n return this.blockNumber > expiry;\n };\n\n /**\n * @method setBlockNumber\n * @description Sets the current block number for TTL calculations. This is crucial for managing cache entry expiry.\n * @param {bigint} blockNumber - The new current block number.\n * @returns {void}\n */\n setBlockNumber(blockNumber: bigint): void {\n this.blockNumber = blockNumber;\n }\n\n /**\n * @method set\n * @description Sets a value in the cache. If the key already exists, its entry will be updated.\n * If the cache reaches its maximum size, the oldest entry will be evicted before adding the new one.\n * @template T - The type of the value being stored.\n * @param {string} key - The unique key for the cache entry.\n * @param {T} value - The value to store in the cache.\n * @param {number} [ttl=this.config.defaultTtl] - The time-to-live (in blocks) for this specific entry. Defaults to the cache's `defaultTtl`.\n * @returns {void}\n */\n set<T>(key: string, value: T, ttl: number = this.config.defaultTtl): void {\n if (this.cache.has(key)) {\n this.cache.delete(key);\n }\n\n if (this.cache.size >= this.config.maxSize) this.evict();\n \n const expiry = this.blockNumber + BigInt(ttl);\n this.cache.set(key, { value, expiry });\n }\n\n /**\n * @method get\n * @description Retrieves a value from the cache. If the entry is found and has not expired,\n * it is moved to the end of the cache (making it the most recently used) to prevent premature eviction.\n * @template T - The expected type of the value.\n * @param {string} key - The key of the cache entry to retrieve.\n * @returns {T | undefined} The cached value if found and not expired, otherwise `undefined`.\n */\n get<T>(key: string): T | undefined {\n const entry = this.cache.get(key);\n if (!entry) return undefined;\n\n if (this.isExpired(entry.expiry)) {\n this.cache.delete(key);\n return undefined;\n }\n\n this.cache.delete(key);\n this.cache.set(key, entry);\n\n return entry.value as T;\n }\n\n /**\n * @method evict\n * @description Evicts the oldest entry from the cache. This method is called internally when the cache\n * reaches its `maxSize` to make room for new entries.\n * @returns {void}\n * @private\n */\n private evict(): void {\n const oldestKey = this.cache.keys().next().value;\n if (!oldestKey) return;\n\n this.cache.delete(oldestKey);\n }\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAa;AAAb;;;AAAO,IAAM,UAAU;;;;;ACoFvB,SAAS,KACP,KACA,IAA4C;AAE5C,MAAI,KAAK,GAAG;AAAG,WAAO;AACtB,MACE,OACA,OAAO,QAAQ,YACf,WAAW,OACX,IAAI,UAAU;AAEd,WAAO,KAAK,IAAI,OAAO,EAAE;AAC3B,SAAO,KAAK,OAAO;AACrB;AAjGA,IAOI,aA6BS;AApCb;;;;AAOA,IAAI,cAA2B;MAC7B,YAAY,CAAC,EACX,aACA,WAAW,IACX,SAAQ,MAER,WACI,GAAG,eAAe,iBAAiB,GAAG,QAAQ,GAC5C,WAAW,IAAI,QAAQ,KAAK,EAC9B,KACA;MACN,SAAS,QAAQ,OAAO;;AAkBpB,IAAO,YAAP,MAAO,mBAAkB,MAAK;MASlC,YAAY,cAAsB,OAA4B,CAAA,GAAE;AAC9D,cAAM,WAAW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,OAAO,CAAC;AAAA,EACvC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUD,IAAO,KAA4B;AACjC,UAAM,QAAQ,KAAK,MAAM,IAAI,GAAG;AAChC,QAAI,CAAC,MAAO,QAAO;AAElB,QAAI,KAAK,UAAU,MAAM,MAAM,GAAG;AAChC,WAAK,MAAM,OAAO,GAAG;AACrB,aAAO;AAAA,IACT;AAEA,SAAK,MAAM,OAAO,GAAG;AACrB,SAAK,MAAM,IAAI,KAAK,KAAK;AAEzB,WAAO,MAAM;AAAA,EACf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASO,QAAc;AACpB,UAAM,YAAY,KAAK,MAAM,KAAK,EAAE,KAAK,EAAE;AAC3C,QAAI,CAAC,UAAW;AAEf,SAAK,MAAM,OAAO,SAAS;AAAA,EAC7B;AACF;","names":["import_actions","promise","data","import_utils","fromBlock","toBlock","import_actions","import_actions","import_contracts","import_actions","import_actions","import_actions"]}