UNPKG

@flaunch/sdk

Version:

Flaunch SDK to easily interact with the Flaunch protocol

1 lines 396 kB
{"version":3,"file":"index.cjs","sources":["../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/chain/defineChain.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/errors/version.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/errors/base.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/errors/encoding.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/data/isHex.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/data/size.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/data/trim.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/errors/data.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/data/pad.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/encoding/toHex.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/encoding/toBytes.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/encoding/fromHex.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/formatters/formatter.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/formatters/transaction.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/formatters/block.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/formatters/log.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/formatters/transactionReceipt.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/formatters/transactionRequest.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/constants/number.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/data/concat.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/errors/cursor.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/cursor.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/encoding/toRlp.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/constants/unit.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/unit/formatUnits.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/unit/formatGwei.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/errors/transaction.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/authorization/serializeAuthorizationList.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/blob/blobsToCommitments.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/blob/blobsToProofs.js","../../../node_modules/.pnpm/@noble+hashes@1.7.2/node_modules/@noble/hashes/esm/_assert.js","../../../node_modules/.pnpm/@noble+hashes@1.7.2/node_modules/@noble/hashes/esm/utils.js","../../../node_modules/.pnpm/@noble+hashes@1.7.2/node_modules/@noble/hashes/esm/_md.js","../../../node_modules/.pnpm/@noble+hashes@1.7.2/node_modules/@noble/hashes/esm/sha256.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/hash/sha256.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/blob/commitmentToVersionedHash.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/blob/commitmentsToVersionedHashes.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/constants/blob.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/constants/kzg.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/errors/blob.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/blob/toBlobs.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/blob/toBlobSidecars.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/errors/address.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/errors/chain.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/errors/node.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/lru.js","../../../node_modules/.pnpm/@noble+hashes@1.7.2/node_modules/@noble/hashes/esm/_u64.js","../../../node_modules/.pnpm/@noble+hashes@1.7.2/node_modules/@noble/hashes/esm/sha3.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/hash/keccak256.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/address/getAddress.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/address/isAddress.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/data/slice.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/transaction/assertTransaction.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/transaction/getTransactionType.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/transaction/serializeAccessList.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/utils/transaction/serializeTransaction.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/op-stack/contracts.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/op-stack/formatters.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/op-stack/serializers.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/op-stack/chainConfig.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/ancient8.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/ancient8Sepolia.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/base.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/baseGoerli.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/baseSepolia.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/birdlayer.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/blast.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/bob.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/bobSepolia.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/celo/fees.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/celo/utils.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/celo/formatters.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/celo/serializers.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/celo/chainConfig.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/celoAlfajores.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/crab.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/creatorTestnet.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/dchain.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/dchainTestnet.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/dodochainTestnet.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/form.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/formTestnet.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/fraxtal.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/fraxtalTestnet.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/funkiMainnet.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/funkiSepolia.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/garnet.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/ink.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/inkSepolia.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/koi.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/lisk.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/liskSepolia.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/metalL2.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/mode.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/modeTestnet.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/opBNB.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/opBNBTestnet.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/optimism.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/optimismGoerli.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/optimismSepolia.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/pyrope.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/redstone.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/rss3.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/rss3Sepolia.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/shape.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/shapeSepolia.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/snax.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/snaxTestnet.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/soneium.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/soneiumMinato.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/superseed.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/superseedSepolia.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/swellchain.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/swellchainTestnet.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/unichain.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/unichainSepolia.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/worldchain.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/worldchainSepolia.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/zora.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/zoraSepolia.js","../../../node_modules/.pnpm/viem@2.29.2_typescript@5.8.3_zod@3.22.4/node_modules/viem/_esm/chains/definitions/zoraTestnet.js","../../../src/addresses.ts"],"sourcesContent":["export function defineChain(chain) {\n return {\n formatters: undefined,\n fees: undefined,\n serializers: undefined,\n ...chain,\n };\n}\n//# sourceMappingURL=defineChain.js.map","export const version = '2.29.2';\n//# sourceMappingURL=version.js.map","import { version } from './version.js';\nlet errorConfig = {\n getDocsUrl: ({ docsBaseUrl, docsPath = '', docsSlug, }) => docsPath\n ? `${docsBaseUrl ?? 'https://viem.sh'}${docsPath}${docsSlug ? `#${docsSlug}` : ''}`\n : undefined,\n version: `viem@${version}`,\n};\nexport function setErrorConfig(config) {\n errorConfig = config;\n}\nexport class BaseError extends Error {\n constructor(shortMessage, args = {}) {\n const details = (() => {\n if (args.cause instanceof BaseError)\n return args.cause.details;\n if (args.cause?.message)\n 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 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 super(message, args.cause ? { cause: args.cause } : undefined);\n Object.defineProperty(this, \"details\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"docsPath\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"metaMessages\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"shortMessage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"version\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'BaseError'\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 walk(fn) {\n return walk(this, fn);\n }\n}\nfunction walk(err, fn) {\n if (fn?.(err))\n return err;\n if (err &&\n typeof err === 'object' &&\n 'cause' in err &&\n err.cause !== undefined)\n return walk(err.cause, fn);\n return fn ? null : err;\n}\n//# sourceMappingURL=base.js.map","import { BaseError } from './base.js';\nexport class IntegerOutOfRangeError extends BaseError {\n constructor({ max, min, signed, size, value, }) {\n super(`Number \"${value}\" is not in safe ${size ? `${size * 8}-bit ${signed ? 'signed' : 'unsigned'} ` : ''}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`, { name: 'IntegerOutOfRangeError' });\n }\n}\nexport class InvalidBytesBooleanError extends BaseError {\n constructor(bytes) {\n super(`Bytes value \"${bytes}\" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`, {\n name: 'InvalidBytesBooleanError',\n });\n }\n}\nexport class InvalidHexBooleanError extends BaseError {\n constructor(hex) {\n super(`Hex value \"${hex}\" is not a valid boolean. The hex value must be \"0x0\" (false) or \"0x1\" (true).`, { name: 'InvalidHexBooleanError' });\n }\n}\nexport class InvalidHexValueError extends BaseError {\n constructor(value) {\n super(`Hex value \"${value}\" is an odd length (${value.length}). It must be an even length.`, { name: 'InvalidHexValueError' });\n }\n}\nexport class SizeOverflowError extends BaseError {\n constructor({ givenSize, maxSize }) {\n super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`, { name: 'SizeOverflowError' });\n }\n}\n//# sourceMappingURL=encoding.js.map","export function isHex(value, { strict = true } = {}) {\n if (!value)\n return false;\n if (typeof value !== 'string')\n return false;\n return strict ? /^0x[0-9a-fA-F]*$/.test(value) : value.startsWith('0x');\n}\n//# sourceMappingURL=isHex.js.map","import { isHex } from './isHex.js';\n/**\n * @description Retrieves the size of the value (in bytes).\n *\n * @param value The value (hex or byte array) to retrieve the size of.\n * @returns The size of the value (in bytes).\n */\nexport function size(value) {\n if (isHex(value, { strict: false }))\n return Math.ceil((value.length - 2) / 2);\n return value.length;\n}\n//# sourceMappingURL=size.js.map","export function trim(hexOrBytes, { dir = 'left' } = {}) {\n let data = typeof hexOrBytes === 'string' ? hexOrBytes.replace('0x', '') : hexOrBytes;\n let sliceLength = 0;\n for (let i = 0; i < data.length - 1; i++) {\n if (data[dir === 'left' ? i : data.length - i - 1].toString() === '0')\n sliceLength++;\n else\n break;\n }\n data =\n dir === 'left'\n ? data.slice(sliceLength)\n : data.slice(0, data.length - sliceLength);\n if (typeof hexOrBytes === 'string') {\n if (data.length === 1 && dir === 'right')\n data = `${data}0`;\n return `0x${data.length % 2 === 1 ? `0${data}` : data}`;\n }\n return data;\n}\n//# sourceMappingURL=trim.js.map","import { BaseError } from './base.js';\nexport class SliceOffsetOutOfBoundsError extends BaseError {\n constructor({ offset, position, size, }) {\n super(`Slice ${position === 'start' ? 'starting' : 'ending'} at offset \"${offset}\" is out-of-bounds (size: ${size}).`, { name: 'SliceOffsetOutOfBoundsError' });\n }\n}\nexport class SizeExceedsPaddingSizeError extends BaseError {\n constructor({ size, targetSize, type, }) {\n super(`${type.charAt(0).toUpperCase()}${type\n .slice(1)\n .toLowerCase()} size (${size}) exceeds padding size (${targetSize}).`, { name: 'SizeExceedsPaddingSizeError' });\n }\n}\nexport class InvalidBytesLengthError extends BaseError {\n constructor({ size, targetSize, type, }) {\n super(`${type.charAt(0).toUpperCase()}${type\n .slice(1)\n .toLowerCase()} is expected to be ${targetSize} ${type} long, but is ${size} ${type} long.`, { name: 'InvalidBytesLengthError' });\n }\n}\n//# sourceMappingURL=data.js.map","import { SizeExceedsPaddingSizeError, } from '../../errors/data.js';\nexport function pad(hexOrBytes, { dir, size = 32 } = {}) {\n if (typeof hexOrBytes === 'string')\n return padHex(hexOrBytes, { dir, size });\n return padBytes(hexOrBytes, { dir, size });\n}\nexport function padHex(hex_, { dir, size = 32 } = {}) {\n if (size === null)\n return hex_;\n const hex = hex_.replace('0x', '');\n if (hex.length > size * 2)\n throw new SizeExceedsPaddingSizeError({\n size: Math.ceil(hex.length / 2),\n targetSize: size,\n type: 'hex',\n });\n return `0x${hex[dir === 'right' ? 'padEnd' : 'padStart'](size * 2, '0')}`;\n}\nexport function padBytes(bytes, { dir, size = 32 } = {}) {\n if (size === null)\n return bytes;\n if (bytes.length > size)\n throw new SizeExceedsPaddingSizeError({\n size: bytes.length,\n targetSize: size,\n type: 'bytes',\n });\n const paddedBytes = new Uint8Array(size);\n for (let i = 0; i < size; i++) {\n const padEnd = dir === 'right';\n paddedBytes[padEnd ? i : size - i - 1] =\n bytes[padEnd ? i : bytes.length - i - 1];\n }\n return paddedBytes;\n}\n//# sourceMappingURL=pad.js.map","import { IntegerOutOfRangeError, } from '../../errors/encoding.js';\nimport { pad } from '../data/pad.js';\nimport { assertSize } from './fromHex.js';\nconst hexes = /*#__PURE__*/ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, '0'));\n/**\n * Encodes a string, number, bigint, or ByteArray into a hex string\n *\n * - Docs: https://viem.sh/docs/utilities/toHex\n * - Example: https://viem.sh/docs/utilities/toHex#usage\n *\n * @param value Value to encode.\n * @param opts Options.\n * @returns Hex value.\n *\n * @example\n * import { toHex } from 'viem'\n * const data = toHex('Hello world')\n * // '0x48656c6c6f20776f726c6421'\n *\n * @example\n * import { toHex } from 'viem'\n * const data = toHex(420)\n * // '0x1a4'\n *\n * @example\n * import { toHex } from 'viem'\n * const data = toHex('Hello world', { size: 32 })\n * // '0x48656c6c6f20776f726c64210000000000000000000000000000000000000000'\n */\nexport function toHex(value, opts = {}) {\n if (typeof value === 'number' || typeof value === 'bigint')\n return numberToHex(value, opts);\n if (typeof value === 'string') {\n return stringToHex(value, opts);\n }\n if (typeof value === 'boolean')\n return boolToHex(value, opts);\n return bytesToHex(value, opts);\n}\n/**\n * Encodes a boolean into a hex string\n *\n * - Docs: https://viem.sh/docs/utilities/toHex#booltohex\n *\n * @param value Value to encode.\n * @param opts Options.\n * @returns Hex value.\n *\n * @example\n * import { boolToHex } from 'viem'\n * const data = boolToHex(true)\n * // '0x1'\n *\n * @example\n * import { boolToHex } from 'viem'\n * const data = boolToHex(false)\n * // '0x0'\n *\n * @example\n * import { boolToHex } from 'viem'\n * const data = boolToHex(true, { size: 32 })\n * // '0x0000000000000000000000000000000000000000000000000000000000000001'\n */\nexport function boolToHex(value, opts = {}) {\n const hex = `0x${Number(value)}`;\n if (typeof opts.size === 'number') {\n assertSize(hex, { size: opts.size });\n return pad(hex, { size: opts.size });\n }\n return hex;\n}\n/**\n * Encodes a bytes array into a hex string\n *\n * - Docs: https://viem.sh/docs/utilities/toHex#bytestohex\n *\n * @param value Value to encode.\n * @param opts Options.\n * @returns Hex value.\n *\n * @example\n * import { bytesToHex } from 'viem'\n * const data = bytesToHex(Uint8Array.from([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33])\n * // '0x48656c6c6f20576f726c6421'\n *\n * @example\n * import { bytesToHex } from 'viem'\n * const data = bytesToHex(Uint8Array.from([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33]), { size: 32 })\n * // '0x48656c6c6f20576f726c64210000000000000000000000000000000000000000'\n */\nexport function bytesToHex(value, opts = {}) {\n let string = '';\n for (let i = 0; i < value.length; i++) {\n string += hexes[value[i]];\n }\n const hex = `0x${string}`;\n if (typeof opts.size === 'number') {\n assertSize(hex, { size: opts.size });\n return pad(hex, { dir: 'right', size: opts.size });\n }\n return hex;\n}\n/**\n * Encodes a number or bigint into a hex string\n *\n * - Docs: https://viem.sh/docs/utilities/toHex#numbertohex\n *\n * @param value Value to encode.\n * @param opts Options.\n * @returns Hex value.\n *\n * @example\n * import { numberToHex } from 'viem'\n * const data = numberToHex(420)\n * // '0x1a4'\n *\n * @example\n * import { numberToHex } from 'viem'\n * const data = numberToHex(420, { size: 32 })\n * // '0x00000000000000000000000000000000000000000000000000000000000001a4'\n */\nexport function numberToHex(value_, opts = {}) {\n const { signed, size } = opts;\n const value = BigInt(value_);\n let maxValue;\n if (size) {\n if (signed)\n maxValue = (1n << (BigInt(size) * 8n - 1n)) - 1n;\n else\n maxValue = 2n ** (BigInt(size) * 8n) - 1n;\n }\n else if (typeof value_ === 'number') {\n maxValue = BigInt(Number.MAX_SAFE_INTEGER);\n }\n const minValue = typeof maxValue === 'bigint' && signed ? -maxValue - 1n : 0;\n if ((maxValue && value > maxValue) || value < minValue) {\n const suffix = typeof value_ === 'bigint' ? 'n' : '';\n throw new IntegerOutOfRangeError({\n max: maxValue ? `${maxValue}${suffix}` : undefined,\n min: `${minValue}${suffix}`,\n signed,\n size,\n value: `${value_}${suffix}`,\n });\n }\n const hex = `0x${(signed && value < 0 ? (1n << BigInt(size * 8)) + BigInt(value) : value).toString(16)}`;\n if (size)\n return pad(hex, { size });\n return hex;\n}\nconst encoder = /*#__PURE__*/ new TextEncoder();\n/**\n * Encodes a UTF-8 string into a hex string\n *\n * - Docs: https://viem.sh/docs/utilities/toHex#stringtohex\n *\n * @param value Value to encode.\n * @param opts Options.\n * @returns Hex value.\n *\n * @example\n * import { stringToHex } from 'viem'\n * const data = stringToHex('Hello World!')\n * // '0x48656c6c6f20576f726c6421'\n *\n * @example\n * import { stringToHex } from 'viem'\n * const data = stringToHex('Hello World!', { size: 32 })\n * // '0x48656c6c6f20576f726c64210000000000000000000000000000000000000000'\n */\nexport function stringToHex(value_, opts = {}) {\n const value = encoder.encode(value_);\n return bytesToHex(value, opts);\n}\n//# sourceMappingURL=toHex.js.map","import { BaseError } from '../../errors/base.js';\nimport { isHex } from '../data/isHex.js';\nimport { pad } from '../data/pad.js';\nimport { assertSize } from './fromHex.js';\nimport { numberToHex, } from './toHex.js';\nconst encoder = /*#__PURE__*/ new TextEncoder();\n/**\n * Encodes a UTF-8 string, hex value, bigint, number or boolean to a byte array.\n *\n * - Docs: https://viem.sh/docs/utilities/toBytes\n * - Example: https://viem.sh/docs/utilities/toBytes#usage\n *\n * @param value Value to encode.\n * @param opts Options.\n * @returns Byte array value.\n *\n * @example\n * import { toBytes } from 'viem'\n * const data = toBytes('Hello world')\n * // Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33])\n *\n * @example\n * import { toBytes } from 'viem'\n * const data = toBytes(420)\n * // Uint8Array([1, 164])\n *\n * @example\n * import { toBytes } from 'viem'\n * const data = toBytes(420, { size: 4 })\n * // Uint8Array([0, 0, 1, 164])\n */\nexport function toBytes(value, opts = {}) {\n if (typeof value === 'number' || typeof value === 'bigint')\n return numberToBytes(value, opts);\n if (typeof value === 'boolean')\n return boolToBytes(value, opts);\n if (isHex(value))\n return hexToBytes(value, opts);\n return stringToBytes(value, opts);\n}\n/**\n * Encodes a boolean into a byte array.\n *\n * - Docs: https://viem.sh/docs/utilities/toBytes#booltobytes\n *\n * @param value Boolean value to encode.\n * @param opts Options.\n * @returns Byte array value.\n *\n * @example\n * import { boolToBytes } from 'viem'\n * const data = boolToBytes(true)\n * // Uint8Array([1])\n *\n * @example\n * import { boolToBytes } from 'viem'\n * const data = boolToBytes(true, { size: 32 })\n * // Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])\n */\nexport function boolToBytes(value, opts = {}) {\n const bytes = new Uint8Array(1);\n bytes[0] = Number(value);\n if (typeof opts.size === 'number') {\n assertSize(bytes, { size: opts.size });\n return pad(bytes, { size: opts.size });\n }\n return bytes;\n}\n// We use very optimized technique to convert hex string to byte array\nconst charCodeMap = {\n zero: 48,\n nine: 57,\n A: 65,\n F: 70,\n a: 97,\n f: 102,\n};\nfunction charCodeToBase16(char) {\n if (char >= charCodeMap.zero && char <= charCodeMap.nine)\n return char - charCodeMap.zero;\n if (char >= charCodeMap.A && char <= charCodeMap.F)\n return char - (charCodeMap.A - 10);\n if (char >= charCodeMap.a && char <= charCodeMap.f)\n return char - (charCodeMap.a - 10);\n return undefined;\n}\n/**\n * Encodes a hex string into a byte array.\n *\n * - Docs: https://viem.sh/docs/utilities/toBytes#hextobytes\n *\n * @param hex Hex string to encode.\n * @param opts Options.\n * @returns Byte array value.\n *\n * @example\n * import { hexToBytes } from 'viem'\n * const data = hexToBytes('0x48656c6c6f20776f726c6421')\n * // Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33])\n *\n * @example\n * import { hexToBytes } from 'viem'\n * const data = hexToBytes('0x48656c6c6f20776f726c6421', { size: 32 })\n * // Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])\n */\nexport function hexToBytes(hex_, opts = {}) {\n let hex = hex_;\n if (opts.size) {\n assertSize(hex, { size: opts.size });\n hex = pad(hex, { dir: 'right', size: opts.size });\n }\n let hexString = hex.slice(2);\n if (hexString.length % 2)\n hexString = `0${hexString}`;\n const length = hexString.length / 2;\n const bytes = new Uint8Array(length);\n for (let index = 0, j = 0; index < length; index++) {\n const nibbleLeft = charCodeToBase16(hexString.charCodeAt(j++));\n const nibbleRight = charCodeToBase16(hexString.charCodeAt(j++));\n if (nibbleLeft === undefined || nibbleRight === undefined) {\n throw new BaseError(`Invalid byte sequence (\"${hexString[j - 2]}${hexString[j - 1]}\" in \"${hexString}\").`);\n }\n bytes[index] = nibbleLeft * 16 + nibbleRight;\n }\n return bytes;\n}\n/**\n * Encodes a number into a byte array.\n *\n * - Docs: https://viem.sh/docs/utilities/toBytes#numbertobytes\n *\n * @param value Number to encode.\n * @param opts Options.\n * @returns Byte array value.\n *\n * @example\n * import { numberToBytes } from 'viem'\n * const data = numberToBytes(420)\n * // Uint8Array([1, 164])\n *\n * @example\n * import { numberToBytes } from 'viem'\n * const data = numberToBytes(420, { size: 4 })\n * // Uint8Array([0, 0, 1, 164])\n */\nexport function numberToBytes(value, opts) {\n const hex = numberToHex(value, opts);\n return hexToBytes(hex);\n}\n/**\n * Encodes a UTF-8 string into a byte array.\n *\n * - Docs: https://viem.sh/docs/utilities/toBytes#stringtobytes\n *\n * @param value String to encode.\n * @param opts Options.\n * @returns Byte array value.\n *\n * @example\n * import { stringToBytes } from 'viem'\n * const data = stringToBytes('Hello world!')\n * // Uint8Array([72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33])\n *\n * @example\n * import { stringToBytes } from 'viem'\n * const data = stringToBytes('Hello world!', { size: 32 })\n * // Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])\n */\nexport function stringToBytes(value, opts = {}) {\n const bytes = encoder.encode(value);\n if (typeof opts.size === 'number') {\n assertSize(bytes, { size: opts.size });\n return pad(bytes, { dir: 'right', size: opts.size });\n }\n return bytes;\n}\n//# sourceMappingURL=toBytes.js.map","import { InvalidHexBooleanError, SizeOverflowError, } from '../../errors/encoding.js';\nimport { size as size_ } from '../data/size.js';\nimport { trim } from '../data/trim.js';\nimport { hexToBytes } from './toBytes.js';\nexport function assertSize(hexOrBytes, { size }) {\n if (size_(hexOrBytes) > size)\n throw new SizeOverflowError({\n givenSize: size_(hexOrBytes),\n maxSize: size,\n });\n}\n/**\n * Decodes a hex string into a string, number, bigint, boolean, or byte array.\n *\n * - Docs: https://viem.sh/docs/utilities/fromHex\n * - Example: https://viem.sh/docs/utilities/fromHex#usage\n *\n * @param hex Hex string to decode.\n * @param toOrOpts Type to convert to or options.\n * @returns Decoded value.\n *\n * @example\n * import { fromHex } from 'viem'\n * const data = fromHex('0x1a4', 'number')\n * // 420\n *\n * @example\n * import { fromHex } from 'viem'\n * const data = fromHex('0x48656c6c6f20576f726c6421', 'string')\n * // 'Hello world'\n *\n * @example\n * import { fromHex } from 'viem'\n * const data = fromHex('0x48656c6c6f20576f726c64210000000000000000000000000000000000000000', {\n * size: 32,\n * to: 'string'\n * })\n * // 'Hello world'\n */\nexport function fromHex(hex, toOrOpts) {\n const opts = typeof toOrOpts === 'string' ? { to: toOrOpts } : toOrOpts;\n const to = opts.to;\n if (to === 'number')\n return hexToNumber(hex, opts);\n if (to === 'bigint')\n return hexToBigInt(hex, opts);\n if (to === 'string')\n return hexToString(hex, opts);\n if (to === 'boolean')\n return hexToBool(hex, opts);\n return hexToBytes(hex, opts);\n}\n/**\n * Decodes a hex value into a bigint.\n *\n * - Docs: https://viem.sh/docs/utilities/fromHex#hextobigint\n *\n * @param hex Hex value to decode.\n * @param opts Options.\n * @returns BigInt value.\n *\n * @example\n * import { hexToBigInt } from 'viem'\n * const data = hexToBigInt('0x1a4', { signed: true })\n * // 420n\n *\n * @example\n * import { hexToBigInt } from 'viem'\n * const data = hexToBigInt('0x00000000000000000000000000000000000000000000000000000000000001a4', { size: 32 })\n * // 420n\n */\nexport function hexToBigInt(hex, opts = {}) {\n const { signed } = opts;\n if (opts.size)\n assertSize(hex, { size: opts.size });\n const value = BigInt(hex);\n if (!signed)\n return value;\n const size = (hex.length - 2) / 2;\n const max = (1n << (BigInt(size) * 8n - 1n)) - 1n;\n if (value <= max)\n return value;\n return value - BigInt(`0x${'f'.padStart(size * 2, 'f')}`) - 1n;\n}\n/**\n * Decodes a hex value into a boolean.\n *\n * - Docs: https://viem.sh/docs/utilities/fromHex#hextobool\n *\n * @param hex Hex value to decode.\n * @param opts Options.\n * @returns Boolean value.\n *\n * @example\n * import { hexToBool } from 'viem'\n * const data = hexToBool('0x01')\n * // true\n *\n * @example\n * import { hexToBool } from 'viem'\n * const data = hexToBool('0x0000000000000000000000000000000000000000000000000000000000000001', { size: 32 })\n * // true\n */\nexport function hexToBool(hex_, opts = {}) {\n let hex = hex_;\n if (opts.size) {\n assertSize(hex, { size: opts.size });\n hex = trim(hex);\n }\n if (trim(hex) === '0x00')\n return false;\n if (trim(hex) === '0x01')\n return true;\n throw new InvalidHexBooleanError(hex);\n}\n/**\n * Decodes a hex string into a number.\n *\n * - Docs: https://viem.sh/docs/utilities/fromHex#hextonumber\n *\n * @param hex Hex value to decode.\n * @param opts Options.\n * @returns Number value.\n *\n * @example\n * import { hexToNumber } from 'viem'\n * const data = hexToNumber('0x1a4')\n * // 420\n *\n * @example\n * import { hexToNumber } from 'viem'\n * const data = hexToBigInt('0x00000000000000000000000000000000000000000000000000000000000001a4', { size: 32 })\n * // 420\n */\nexport function hexToNumber(hex, opts = {}) {\n return Number(hexToBigInt(hex, opts));\n}\n/**\n * Decodes a hex value into a UTF-8 string.\n *\n * - Docs: https://viem.sh/docs/utilities/fromHex#hextostring\n *\n * @param hex Hex value to decode.\n * @param opts Options.\n * @returns String value.\n *\n * @example\n * import { hexToString } from 'viem'\n * const data = hexToString('0x48656c6c6f20576f726c6421')\n * // 'Hello world!'\n *\n * @example\n * import { hexToString } from 'viem'\n * const data = hexToString('0x48656c6c6f20576f726c64210000000000000000000000000000000000000000', {\n * size: 32,\n * })\n * // 'Hello world'\n */\nexport function hexToString(hex, opts = {}) {\n let bytes = hexToBytes(hex);\n if (opts.size) {\n assertSize(bytes, { size: opts.size });\n bytes = trim(bytes, { dir: 'right' });\n }\n return new TextDecoder().decode(bytes);\n}\n//# sourceMappingURL=fromHex.js.map","export function defineFormatter(type, format) {\n return ({ exclude, format: overrides, }) => {\n return {\n exclude,\n format: (args) => {\n const formatted = format(args);\n if (exclude) {\n for (const key of exclude) {\n delete formatted[key];\n }\n }\n return {\n ...formatted,\n ...overrides(args),\n };\n },\n type,\n };\n };\n}\n//# sourceMappingURL=formatter.js.map","import { hexToNumber } from '../encoding/fromHex.js';\nimport { defineFormatter } from './formatter.js';\nexport const transactionType = {\n '0x0': 'legacy',\n '0x1': 'eip2930',\n '0x2': 'eip1559',\n '0x3': 'eip4844',\n '0x4': 'eip7702',\n};\nexport function formatTransaction(transaction) {\n const transaction_ = {\n ...transaction,\n blockHash: transaction.blockHash ? transaction.blockHash : null,\n blockNumber: transaction.blockNumber\n ? BigInt(transaction.blockNumber)\n : null,\n chainId: transaction.chainId ? hexToNumber(transaction.chainId) : undefined,\n gas: transaction.gas ? BigInt(transaction.gas) : undefined,\n gasPrice: transaction.gasPrice ? BigInt(transaction.gasPrice) : undefined,\n maxFeePerBlobGas: transaction.maxFeePerBlobGas\n ? BigInt(transaction.maxFeePerBlobGas)\n : undefined,\n maxFeePerGas: transaction.maxFeePerGas\n ? BigInt(transaction.maxFeePerGas)\n : undefined,\n maxPriorityFeePerGas: transaction.maxPriorityFeePerGas\n ? BigInt(transaction.maxPriorityFeePerGas)\n : undefined,\n nonce: transaction.nonce ? hexToNumber(transaction.nonce) : undefined,\n to: transaction.to ? transaction.to : null,\n transactionIndex: transaction.transactionIndex\n ? Number(transaction.transactionIndex)\n : null,\n type: transaction.type\n ? transactionType[transaction.type]\n : undefined,\n typeHex: transaction.type ? transaction.type : undefined,\n value: transaction.value ? BigInt(transaction.value) : undefined,\n v: transaction.v ? BigInt(transaction.v) : undefined,\n };\n if (transaction.authorizationList)\n transaction_.authorizationList = formatAuthorizationList(transaction.authorizationList);\n transaction_.yParity = (() => {\n // If `yParity` is provided, we will use it.\n if (transaction.yParity)\n return Number(transaction.yParity);\n // If no `yParity` provided, try derive from `v`.\n if (typeof transaction_.v === 'bigint') {\n if (transaction_.v === 0n || transaction_.v === 27n)\n return 0;\n if (transaction_.v === 1n || transaction_.v === 28n)\n return 1;\n if (transaction_.v >= 35n)\n return transaction_.v % 2n === 0n ? 1 : 0;\n }\n return undefined;\n })();\n if (transaction_.type === 'legacy') {\n delete transaction_.accessList;\n delete transaction_.maxFeePerBlobGas;\n delete transaction_.maxFeePerGas;\n delete transaction_.maxPriorityFeePerGas;\n delete transaction_.yParity;\n }\n if (transaction_.type === 'eip2930') {\n delete transaction_.maxFeePerBlobGas;\n delete transaction_.maxFeePerGas;\n delete transaction_.maxPriorityFeePerGas;\n }\n if (transaction_.type === 'eip1559') {\n delete transaction_.maxFeePerBlobGas;\n }\n return transaction_;\n}\nexport const defineTransaction = /*#__PURE__*/ defineFormatter('transaction', formatTransaction);\n//////////////////////////////////////////////////////////////////////////////\nfunction formatAuthorizationList(authorizationList) {\n return authorizationList.map((authorization) => ({\n address: authorization.address,\n chainId: Number(authorization.chainId),\n nonce: Number(authorization.nonce),\n r: authorization.r,\n s: authorization.s,\n yParity: Number(authorization.yParity),\n }));\n}\n//# sourceMappingURL=transaction.js.map","import { defineFormatter } from './formatter.js';\nimport { formatTransaction } from './transaction.js';\nexport function formatBlock(block) {\n const transactions = (block.transactions ?? []).map((transaction) => {\n if (typeof transaction === 'string')\n return transaction;\n return formatTransaction(transaction);\n });\n return {\n ...block,\n baseFeePerGas: block.baseFeePerGas ? BigInt(block.baseFeePerGas) : null,\n blobGasUsed: block.blobGasUsed ? BigInt(block.blobGasUsed) : undefined,\n difficulty: block.difficulty ? BigInt(block.difficulty) : undefined,\n excessBlobGas: block.excessBlobGas\n ? BigInt(block.excessBlobGas)\n : undefined,\n gasLimit: block.gasLimit ? BigInt(block.gasLimit) : undefined,\n gasUsed: block.gasUsed ? BigInt(block.gasUsed) : undefined,\n hash: block.hash ? block.hash : null,\n logsBloom: block.logsBloom ? block.logsBloom : null,\n nonce: block.nonce ? block.nonce : null,\n number: block.number ? BigInt(block.number) : null,\n size: block.size ? BigInt(block.size) : undefined,\n timestamp: block.timestamp ? BigInt(block.timestamp) : undefined,\n transactions,\n totalDifficulty: block.totalDifficulty\n ? BigInt(block.totalDifficulty)\n : null,\n };\n}\nexport const defineBlock = /*#__PURE__*/ defineFormatter('block', formatBlock);\n//# sourceMappingURL=block.js.map","export function formatLog(log, { args, eventName, } = {}) {\n return {\n ...log,\n blockHash: log.blockHash ? log.blockHash : null,\n blockNumber: log.blockNumber ? BigInt(log.blockNumber) : null,\n logIndex: log.logIndex ? Number(log.logIndex) : null,\n transactionHash: log.transactionHash ? log.transactionHash : null,\n transactionIndex: log.transactionIndex\n ? Number(log.transactionIndex)\n : null,\n ...(eventName ? { args, eventName } : {}),\n };\n}\n//# sourceMappingURL=log.js.map","import { hexToNumber } from '../encoding/fromHex.js';\nimport { defineFormatter } from './formatter.js';\nimport { formatLog } from './log.js';\nimport { transactionType } from './transaction.js';\nexport const receiptStatuses = {\n '0x0': 'reverted',\n '0x1': 'success',\n};\nexport function formatTransactionReceipt(transactionReceipt) {\n const receipt = {\n ...transactionReceipt,\n blockNumber: transactionReceipt.blockNumber\n ? BigInt(transactionReceipt.blockNumber)\n : null,\n contractAddress: transactionReceipt.contractAddress\n ? transactionReceipt.contractAddress\n : null,\n cumulativeGasUsed: transactionReceipt.cumulativeGasUsed\n ? BigInt(transactionReceipt.cumulativeGasUsed)\n : null,\n effectiveGasPrice: transactionReceipt.effectiveGasPrice\n ? BigInt(transactionReceipt.effectiveGasPrice)\n : null,\n gasUsed: transactionReceipt.gasUsed\n ? BigInt(transactionReceipt.gasUsed)\n : null,\n logs: transactionReceipt.logs\n ? transactionReceipt.logs.map((log) => formatLog(log))\n : null,\n to: transactionReceipt.to ? transactionReceipt.to : null,\n transactionIndex: transactionReceipt.transactionIndex\n ? hexToNumber(transactionReceipt.transactionIndex)\n : null,\n status: transactionReceipt.status\n ? receiptStatuses[transactionReceipt.status]\n : null,\n type: transactionReceipt.type\n ? transactionType[transactionReceipt.type] || transactionReceipt.type\n : null,\n };\n if (transactionReceipt.blobGasPrice)\n receipt.blobGasPrice = BigInt(transactionReceipt.blobGasPrice);\n if (transactionReceipt.blobGasUsed)\n receipt.blobGasUsed = BigInt(transactionReceipt.blobGasUsed);\n return receipt;\n}\nexport const defineTransactionReceipt = /*#__PURE__*/ defineFormatter('transactionReceipt', formatTransactionReceipt);\n//# sourceMappingURL=transactionReceipt.js.map","import { bytesToHex, numberToHex } from '../encoding/toHex.js';\nimport { defineFormatter } from './formatter.js';\nexport const rpcTransactionType = {\n legacy: '0x0',\n eip2930: '0x1',\n eip1559: '0x2',\n eip4844: '0x3',\n eip7702: '0x4',\n};\nexport function formatTransactionRequest(request) {\n const rpcRequest = {};\n if (typeof request.authorizationList !== 'undefined')\n rpcRequest.authorizationList = formatAuthorizationList(request.authorizationList);\n if (typeof request.accessList !== 'undefined')\n rpcRequest.accessList = request.accessList;\n if (typeof request.blobVersionedHashes !== 'undefined')\n rpcRequest.blobVersionedHashes = request.blobVersionedHashes;\n if (typeof request.blobs !== 'undefined') {\n if (typeof request.blobs[0] !== 'string')\n rpcRequest.blobs = request.blobs.map((x) => bytesToHex(x));\n else\n rpcRequest.blobs = request.blobs;\n }\n if (typeof request.data !== 'undefined')\n rpcRequest.data = request.data;\n if (typeof request.from !== 'undefined')\n rpcRequest.from = request.from;\n if (typeof request.gas !== 'undefined')\n rpcRequest.gas = numberToHex(request.gas);\n if (typeof request.gasPrice !== 'undefined')\n rpcRequest.gasPrice = numberToHex(request.gasPrice);\n if (typeof request.maxFeePerBlobGas !== 'undefined')\n rpcRequest.maxFeePerBlobGas = numberToHex(request.maxFeePerBlobGas);\n if (typeof request.maxFeePerGas !== 'undefined')\n rpcRequest.maxFeePerGas = numberToHex(request.maxFeePerGas);\n if (typeof request.maxPriorityFeePerGas !== 'undefined')\n rpcRequest.maxPriorityFeePerGas = numberToHex(request.maxPriorityFeePerGas);\n if (typeof request.nonce !== 'undefined')\n rpcRequest.nonce = numberToHex(request.nonce);\n if (typeof request.to !== 'undefined')\n rpcRequest.to = request.to;\n if (typeof request.type !== 'undefined')\n rpcRequest.type = rpcTransactionType[request.type];\n if (typeof request.value !== 'undefined')\n rpcRequest.value = numberToHex(request.value);\n return rpcRequest;\n}\nexport const defineT