UNPKG

@etherspot/remote-signer

Version:

Etherspot Permissioned Signer SDK - signs the UserOp with SessionKey and sends it to the Bundler

1,411 lines (1,380 loc) 168 kB
import { Hash, bytes, exists, number, output, toBytes, u32, wrapConstructor, wrapXOFConstructorWithOpts } from "./chunk-ZAJP3MQW.mjs"; // node_modules/abitype/dist/esm/version.js var version = "1.0.4"; // node_modules/abitype/dist/esm/errors.js var BaseError = class _BaseError extends Error { constructor(shortMessage, args = {}) { const details = args.cause instanceof _BaseError ? args.cause.details : args.cause?.message ? args.cause.message : args.details; const docsPath4 = args.cause instanceof _BaseError ? args.cause.docsPath || args.docsPath : args.docsPath; const message = [ shortMessage || "An error occurred.", "", ...args.metaMessages ? [...args.metaMessages, ""] : [], ...docsPath4 ? [`Docs: https://abitype.dev${docsPath4}`] : [], ...details ? [`Details: ${details}`] : [], `Version: abitype@${version}` ].join("\n"); super(message); Object.defineProperty(this, "details", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "docsPath", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "metaMessages", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "shortMessage", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "AbiTypeError" }); if (args.cause) this.cause = args.cause; this.details = details; this.docsPath = docsPath4; this.metaMessages = args.metaMessages; this.shortMessage = shortMessage; } }; // node_modules/abitype/dist/esm/regex.js function execTyped(regex, string) { const match = regex.exec(string); return match?.groups; } var bytesRegex = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/; var integerRegex = /^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/; var isTupleRegex = /^\(.+?\).*?$/; // node_modules/abitype/dist/esm/human-readable/formatAbiParameter.js var tupleRegex = /^tuple(?<array>(\[(\d*)\])*)$/; function formatAbiParameter(abiParameter) { let type = abiParameter.type; if (tupleRegex.test(abiParameter.type) && "components" in abiParameter) { type = "("; const length = abiParameter.components.length; for (let i = 0; i < length; i++) { const component = abiParameter.components[i]; type += formatAbiParameter(component); if (i < length - 1) type += ", "; } const result = execTyped(tupleRegex, abiParameter.type); type += `)${result?.array ?? ""}`; return formatAbiParameter({ ...abiParameter, type }); } if ("indexed" in abiParameter && abiParameter.indexed) type = `${type} indexed`; if (abiParameter.name) return `${type} ${abiParameter.name}`; return type; } // node_modules/abitype/dist/esm/human-readable/formatAbiParameters.js function formatAbiParameters(abiParameters) { let params = ""; const length = abiParameters.length; for (let i = 0; i < length; i++) { const abiParameter = abiParameters[i]; params += formatAbiParameter(abiParameter); if (i !== length - 1) params += ", "; } return params; } // node_modules/abitype/dist/esm/human-readable/formatAbiItem.js function formatAbiItem(abiItem) { if (abiItem.type === "function") return `function ${abiItem.name}(${formatAbiParameters(abiItem.inputs)})${abiItem.stateMutability && abiItem.stateMutability !== "nonpayable" ? ` ${abiItem.stateMutability}` : ""}${abiItem.outputs.length ? ` returns (${formatAbiParameters(abiItem.outputs)})` : ""}`; if (abiItem.type === "event") return `event ${abiItem.name}(${formatAbiParameters(abiItem.inputs)})`; if (abiItem.type === "error") return `error ${abiItem.name}(${formatAbiParameters(abiItem.inputs)})`; if (abiItem.type === "constructor") return `constructor(${formatAbiParameters(abiItem.inputs)})${abiItem.stateMutability === "payable" ? " payable" : ""}`; if (abiItem.type === "fallback") return "fallback()"; return "receive() external payable"; } // node_modules/abitype/dist/esm/human-readable/runtime/signatures.js var errorSignatureRegex = /^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/; function isErrorSignature(signature) { return errorSignatureRegex.test(signature); } function execErrorSignature(signature) { return execTyped(errorSignatureRegex, signature); } var eventSignatureRegex = /^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/; function isEventSignature(signature) { return eventSignatureRegex.test(signature); } function execEventSignature(signature) { return execTyped(eventSignatureRegex, signature); } var functionSignatureRegex = /^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/; function isFunctionSignature(signature) { return functionSignatureRegex.test(signature); } function execFunctionSignature(signature) { return execTyped(functionSignatureRegex, signature); } var structSignatureRegex = /^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/; function isStructSignature(signature) { return structSignatureRegex.test(signature); } function execStructSignature(signature) { return execTyped(structSignatureRegex, signature); } var constructorSignatureRegex = /^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/; function isConstructorSignature(signature) { return constructorSignatureRegex.test(signature); } function execConstructorSignature(signature) { return execTyped(constructorSignatureRegex, signature); } var fallbackSignatureRegex = /^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/; function isFallbackSignature(signature) { return fallbackSignatureRegex.test(signature); } var receiveSignatureRegex = /^receive\(\) external payable$/; function isReceiveSignature(signature) { return receiveSignatureRegex.test(signature); } var modifiers = /* @__PURE__ */ new Set([ "memory", "indexed", "storage", "calldata" ]); var eventModifiers = /* @__PURE__ */ new Set(["indexed"]); var functionModifiers = /* @__PURE__ */ new Set([ "calldata", "memory", "storage" ]); // node_modules/abitype/dist/esm/human-readable/errors/abiItem.js var InvalidAbiItemError = class extends BaseError { constructor({ signature }) { super("Failed to parse ABI item.", { details: `parseAbiItem(${JSON.stringify(signature, null, 2)})`, docsPath: "/api/human#parseabiitem-1" }); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "InvalidAbiItemError" }); } }; var UnknownTypeError = class extends BaseError { constructor({ type }) { super("Unknown type.", { metaMessages: [ `Type "${type}" is not a valid ABI type. Perhaps you forgot to include a struct signature?` ] }); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "UnknownTypeError" }); } }; var UnknownSolidityTypeError = class extends BaseError { constructor({ type }) { super("Unknown type.", { metaMessages: [`Type "${type}" is not a valid ABI type.`] }); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "UnknownSolidityTypeError" }); } }; // node_modules/abitype/dist/esm/human-readable/errors/abiParameter.js var InvalidAbiParametersError = class extends BaseError { constructor({ params }) { super("Failed to parse ABI parameters.", { details: `parseAbiParameters(${JSON.stringify(params, null, 2)})`, docsPath: "/api/human#parseabiparameters-1" }); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "InvalidAbiParametersError" }); } }; var InvalidParameterError = class extends BaseError { constructor({ param }) { super("Invalid ABI parameter.", { details: param }); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "InvalidParameterError" }); } }; var SolidityProtectedKeywordError = class extends BaseError { constructor({ param, name }) { super("Invalid ABI parameter.", { details: param, metaMessages: [ `"${name}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html` ] }); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "SolidityProtectedKeywordError" }); } }; var InvalidModifierError = class extends BaseError { constructor({ param, type, modifier }) { super("Invalid ABI parameter.", { details: param, metaMessages: [ `Modifier "${modifier}" not allowed${type ? ` in "${type}" type` : ""}.` ] }); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "InvalidModifierError" }); } }; var InvalidFunctionModifierError = class extends BaseError { constructor({ param, type, modifier }) { super("Invalid ABI parameter.", { details: param, metaMessages: [ `Modifier "${modifier}" not allowed${type ? ` in "${type}" type` : ""}.`, `Data location can only be specified for array, struct, or mapping types, but "${modifier}" was given.` ] }); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "InvalidFunctionModifierError" }); } }; var InvalidAbiTypeParameterError = class extends BaseError { constructor({ abiParameter }) { super("Invalid ABI parameter.", { details: JSON.stringify(abiParameter, null, 2), metaMessages: ["ABI parameter type is invalid."] }); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "InvalidAbiTypeParameterError" }); } }; // node_modules/abitype/dist/esm/human-readable/errors/signature.js var InvalidSignatureError = class extends BaseError { constructor({ signature, type }) { super(`Invalid ${type} signature.`, { details: signature }); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "InvalidSignatureError" }); } }; var UnknownSignatureError = class extends BaseError { constructor({ signature }) { super("Unknown signature.", { details: signature }); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "UnknownSignatureError" }); } }; var InvalidStructSignatureError = class extends BaseError { constructor({ signature }) { super("Invalid struct signature.", { details: signature, metaMessages: ["No properties exist."] }); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "InvalidStructSignatureError" }); } }; // node_modules/abitype/dist/esm/human-readable/errors/struct.js var CircularReferenceError = class extends BaseError { constructor({ type }) { super("Circular reference detected.", { metaMessages: [`Struct "${type}" is a circular reference.`] }); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "CircularReferenceError" }); } }; // node_modules/abitype/dist/esm/human-readable/errors/splitParameters.js var InvalidParenthesisError = class extends BaseError { constructor({ current, depth }) { super("Unbalanced parentheses.", { metaMessages: [ `"${current.trim()}" has too many ${depth > 0 ? "opening" : "closing"} parentheses.` ], details: `Depth "${depth}"` }); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "InvalidParenthesisError" }); } }; // node_modules/abitype/dist/esm/human-readable/runtime/cache.js function getParameterCacheKey(param, type) { if (type) return `${type}:${param}`; return param; } var parameterCache = /* @__PURE__ */ new Map([ // Unnamed ["address", { type: "address" }], ["bool", { type: "bool" }], ["bytes", { type: "bytes" }], ["bytes32", { type: "bytes32" }], ["int", { type: "int256" }], ["int256", { type: "int256" }], ["string", { type: "string" }], ["uint", { type: "uint256" }], ["uint8", { type: "uint8" }], ["uint16", { type: "uint16" }], ["uint24", { type: "uint24" }], ["uint32", { type: "uint32" }], ["uint64", { type: "uint64" }], ["uint96", { type: "uint96" }], ["uint112", { type: "uint112" }], ["uint160", { type: "uint160" }], ["uint192", { type: "uint192" }], ["uint256", { type: "uint256" }], // Named ["address owner", { type: "address", name: "owner" }], ["address to", { type: "address", name: "to" }], ["bool approved", { type: "bool", name: "approved" }], ["bytes _data", { type: "bytes", name: "_data" }], ["bytes data", { type: "bytes", name: "data" }], ["bytes signature", { type: "bytes", name: "signature" }], ["bytes32 hash", { type: "bytes32", name: "hash" }], ["bytes32 r", { type: "bytes32", name: "r" }], ["bytes32 root", { type: "bytes32", name: "root" }], ["bytes32 s", { type: "bytes32", name: "s" }], ["string name", { type: "string", name: "name" }], ["string symbol", { type: "string", name: "symbol" }], ["string tokenURI", { type: "string", name: "tokenURI" }], ["uint tokenId", { type: "uint256", name: "tokenId" }], ["uint8 v", { type: "uint8", name: "v" }], ["uint256 balance", { type: "uint256", name: "balance" }], ["uint256 tokenId", { type: "uint256", name: "tokenId" }], ["uint256 value", { type: "uint256", name: "value" }], // Indexed [ "event:address indexed from", { type: "address", name: "from", indexed: true } ], ["event:address indexed to", { type: "address", name: "to", indexed: true }], [ "event:uint indexed tokenId", { type: "uint256", name: "tokenId", indexed: true } ], [ "event:uint256 indexed tokenId", { type: "uint256", name: "tokenId", indexed: true } ] ]); // node_modules/abitype/dist/esm/human-readable/runtime/utils.js function parseSignature(signature, structs = {}) { if (isFunctionSignature(signature)) { const match = execFunctionSignature(signature); if (!match) throw new InvalidSignatureError({ signature, type: "function" }); const inputParams = splitParameters(match.parameters); const inputs = []; const inputLength = inputParams.length; for (let i = 0; i < inputLength; i++) { inputs.push(parseAbiParameter(inputParams[i], { modifiers: functionModifiers, structs, type: "function" })); } const outputs = []; if (match.returns) { const outputParams = splitParameters(match.returns); const outputLength = outputParams.length; for (let i = 0; i < outputLength; i++) { outputs.push(parseAbiParameter(outputParams[i], { modifiers: functionModifiers, structs, type: "function" })); } } return { name: match.name, type: "function", stateMutability: match.stateMutability ?? "nonpayable", inputs, outputs }; } if (isEventSignature(signature)) { const match = execEventSignature(signature); if (!match) throw new InvalidSignatureError({ signature, type: "event" }); const params = splitParameters(match.parameters); const abiParameters = []; const length = params.length; for (let i = 0; i < length; i++) { abiParameters.push(parseAbiParameter(params[i], { modifiers: eventModifiers, structs, type: "event" })); } return { name: match.name, type: "event", inputs: abiParameters }; } if (isErrorSignature(signature)) { const match = execErrorSignature(signature); if (!match) throw new InvalidSignatureError({ signature, type: "error" }); const params = splitParameters(match.parameters); const abiParameters = []; const length = params.length; for (let i = 0; i < length; i++) { abiParameters.push(parseAbiParameter(params[i], { structs, type: "error" })); } return { name: match.name, type: "error", inputs: abiParameters }; } if (isConstructorSignature(signature)) { const match = execConstructorSignature(signature); if (!match) throw new InvalidSignatureError({ signature, type: "constructor" }); const params = splitParameters(match.parameters); const abiParameters = []; const length = params.length; for (let i = 0; i < length; i++) { abiParameters.push(parseAbiParameter(params[i], { structs, type: "constructor" })); } return { type: "constructor", stateMutability: match.stateMutability ?? "nonpayable", inputs: abiParameters }; } if (isFallbackSignature(signature)) return { type: "fallback" }; if (isReceiveSignature(signature)) return { type: "receive", stateMutability: "payable" }; throw new UnknownSignatureError({ signature }); } var abiParameterWithoutTupleRegex = /^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/; var abiParameterWithTupleRegex = /^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/; var dynamicIntegerRegex = /^u?int$/; function parseAbiParameter(param, options) { const parameterCacheKey = getParameterCacheKey(param, options?.type); if (parameterCache.has(parameterCacheKey)) return parameterCache.get(parameterCacheKey); const isTuple = isTupleRegex.test(param); const match = execTyped(isTuple ? abiParameterWithTupleRegex : abiParameterWithoutTupleRegex, param); if (!match) throw new InvalidParameterError({ param }); if (match.name && isSolidityKeyword(match.name)) throw new SolidityProtectedKeywordError({ param, name: match.name }); const name = match.name ? { name: match.name } : {}; const indexed = match.modifier === "indexed" ? { indexed: true } : {}; const structs = options?.structs ?? {}; let type; let components = {}; if (isTuple) { type = "tuple"; const params = splitParameters(match.type); const components_ = []; const length = params.length; for (let i = 0; i < length; i++) { components_.push(parseAbiParameter(params[i], { structs })); } components = { components: components_ }; } else if (match.type in structs) { type = "tuple"; components = { components: structs[match.type] }; } else if (dynamicIntegerRegex.test(match.type)) { type = `${match.type}256`; } else { type = match.type; if (!(options?.type === "struct") && !isSolidityType(type)) throw new UnknownSolidityTypeError({ type }); } if (match.modifier) { if (!options?.modifiers?.has?.(match.modifier)) throw new InvalidModifierError({ param, type: options?.type, modifier: match.modifier }); if (functionModifiers.has(match.modifier) && !isValidDataLocation(type, !!match.array)) throw new InvalidFunctionModifierError({ param, type: options?.type, modifier: match.modifier }); } const abiParameter = { type: `${type}${match.array ?? ""}`, ...name, ...indexed, ...components }; parameterCache.set(parameterCacheKey, abiParameter); return abiParameter; } function splitParameters(params, result = [], current = "", depth = 0) { const length = params.trim().length; for (let i = 0; i < length; i++) { const char = params[i]; const tail = params.slice(i + 1); switch (char) { case ",": return depth === 0 ? splitParameters(tail, [...result, current.trim()]) : splitParameters(tail, result, `${current}${char}`, depth); case "(": return splitParameters(tail, result, `${current}${char}`, depth + 1); case ")": return splitParameters(tail, result, `${current}${char}`, depth - 1); default: return splitParameters(tail, result, `${current}${char}`, depth); } } if (current === "") return result; if (depth !== 0) throw new InvalidParenthesisError({ current, depth }); result.push(current.trim()); return result; } function isSolidityType(type) { return type === "address" || type === "bool" || type === "function" || type === "string" || bytesRegex.test(type) || integerRegex.test(type); } var protectedKeywordsRegex = /^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/; function isSolidityKeyword(name) { return name === "address" || name === "bool" || name === "function" || name === "string" || name === "tuple" || bytesRegex.test(name) || integerRegex.test(name) || protectedKeywordsRegex.test(name); } function isValidDataLocation(type, isArray) { return isArray || type === "bytes" || type === "string" || type === "tuple"; } // node_modules/abitype/dist/esm/human-readable/runtime/structs.js function parseStructs(signatures) { const shallowStructs = {}; const signaturesLength = signatures.length; for (let i = 0; i < signaturesLength; i++) { const signature = signatures[i]; if (!isStructSignature(signature)) continue; const match = execStructSignature(signature); if (!match) throw new InvalidSignatureError({ signature, type: "struct" }); const properties = match.properties.split(";"); const components = []; const propertiesLength = properties.length; for (let k = 0; k < propertiesLength; k++) { const property = properties[k]; const trimmed = property.trim(); if (!trimmed) continue; const abiParameter = parseAbiParameter(trimmed, { type: "struct" }); components.push(abiParameter); } if (!components.length) throw new InvalidStructSignatureError({ signature }); shallowStructs[match.name] = components; } const resolvedStructs = {}; const entries = Object.entries(shallowStructs); const entriesLength = entries.length; for (let i = 0; i < entriesLength; i++) { const [name, parameters] = entries[i]; resolvedStructs[name] = resolveStructs(parameters, shallowStructs); } return resolvedStructs; } var typeWithoutTupleRegex = /^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/; function resolveStructs(abiParameters, structs, ancestors = /* @__PURE__ */ new Set()) { const components = []; const length = abiParameters.length; for (let i = 0; i < length; i++) { const abiParameter = abiParameters[i]; const isTuple = isTupleRegex.test(abiParameter.type); if (isTuple) components.push(abiParameter); else { const match = execTyped(typeWithoutTupleRegex, abiParameter.type); if (!match?.type) throw new InvalidAbiTypeParameterError({ abiParameter }); const { array, type } = match; if (type in structs) { if (ancestors.has(type)) throw new CircularReferenceError({ type }); components.push({ ...abiParameter, type: `tuple${array ?? ""}`, components: resolveStructs(structs[type] ?? [], structs, /* @__PURE__ */ new Set([...ancestors, type])) }); } else { if (isSolidityType(type)) components.push(abiParameter); else throw new UnknownTypeError({ type }); } } } return components; } // node_modules/abitype/dist/esm/human-readable/parseAbi.js function parseAbi(signatures) { const structs = parseStructs(signatures); const abi = []; const length = signatures.length; for (let i = 0; i < length; i++) { const signature = signatures[i]; if (isStructSignature(signature)) continue; abi.push(parseSignature(signature, structs)); } return abi; } // node_modules/abitype/dist/esm/human-readable/parseAbiItem.js function parseAbiItem(signature) { let abiItem; if (typeof signature === "string") abiItem = parseSignature(signature); else { const structs = parseStructs(signature); const length = signature.length; for (let i = 0; i < length; i++) { const signature_ = signature[i]; if (isStructSignature(signature_)) continue; abiItem = parseSignature(signature_, structs); break; } } if (!abiItem) throw new InvalidAbiItemError({ signature }); return abiItem; } // node_modules/abitype/dist/esm/human-readable/parseAbiParameters.js function parseAbiParameters(params) { const abiParameters = []; if (typeof params === "string") { const parameters = splitParameters(params); const length = parameters.length; for (let i = 0; i < length; i++) { abiParameters.push(parseAbiParameter(parameters[i], { modifiers })); } } else { const structs = parseStructs(params); const length = params.length; for (let i = 0; i < length; i++) { const signature = params[i]; if (isStructSignature(signature)) continue; const parameters = splitParameters(signature); const length2 = parameters.length; for (let k = 0; k < length2; k++) { abiParameters.push(parseAbiParameter(parameters[k], { modifiers, structs })); } } } if (abiParameters.length === 0) throw new InvalidAbiParametersError({ params }); return abiParameters; } // node_modules/viem/_esm/accounts/utils/parseAccount.js function parseAccount(account) { if (typeof account === "string") return { address: account, type: "json-rpc" }; return account; } // node_modules/viem/_esm/constants/abis.js var multicall3Abi = [ { inputs: [ { components: [ { name: "target", type: "address" }, { name: "allowFailure", type: "bool" }, { name: "callData", type: "bytes" } ], name: "calls", type: "tuple[]" } ], name: "aggregate3", outputs: [ { components: [ { name: "success", type: "bool" }, { name: "returnData", type: "bytes" } ], name: "returnData", type: "tuple[]" } ], stateMutability: "view", type: "function" } ]; var universalResolverErrors = [ { inputs: [], name: "ResolverNotFound", type: "error" }, { inputs: [], name: "ResolverWildcardNotSupported", type: "error" }, { inputs: [], name: "ResolverNotContract", type: "error" }, { inputs: [ { name: "returnData", type: "bytes" } ], name: "ResolverError", type: "error" }, { inputs: [ { components: [ { name: "status", type: "uint16" }, { name: "message", type: "string" } ], name: "errors", type: "tuple[]" } ], name: "HttpError", type: "error" } ]; var universalResolverResolveAbi = [ ...universalResolverErrors, { name: "resolve", type: "function", stateMutability: "view", inputs: [ { name: "name", type: "bytes" }, { name: "data", type: "bytes" } ], outputs: [ { name: "", type: "bytes" }, { name: "address", type: "address" } ] }, { name: "resolve", type: "function", stateMutability: "view", inputs: [ { name: "name", type: "bytes" }, { name: "data", type: "bytes" }, { name: "gateways", type: "string[]" } ], outputs: [ { name: "", type: "bytes" }, { name: "address", type: "address" } ] } ]; var universalResolverReverseAbi = [ ...universalResolverErrors, { name: "reverse", type: "function", stateMutability: "view", inputs: [{ type: "bytes", name: "reverseName" }], outputs: [ { type: "string", name: "resolvedName" }, { type: "address", name: "resolvedAddress" }, { type: "address", name: "reverseResolver" }, { type: "address", name: "resolver" } ] }, { name: "reverse", type: "function", stateMutability: "view", inputs: [ { type: "bytes", name: "reverseName" }, { type: "string[]", name: "gateways" } ], outputs: [ { type: "string", name: "resolvedName" }, { type: "address", name: "resolvedAddress" }, { type: "address", name: "reverseResolver" }, { type: "address", name: "resolver" } ] } ]; var textResolverAbi = [ { name: "text", type: "function", stateMutability: "view", inputs: [ { name: "name", type: "bytes32" }, { name: "key", type: "string" } ], outputs: [{ name: "", type: "string" }] } ]; var addressResolverAbi = [ { name: "addr", type: "function", stateMutability: "view", inputs: [{ name: "name", type: "bytes32" }], outputs: [{ name: "", type: "address" }] }, { name: "addr", type: "function", stateMutability: "view", inputs: [ { name: "name", type: "bytes32" }, { name: "coinType", type: "uint256" } ], outputs: [{ name: "", type: "bytes" }] } ]; var universalSignatureValidatorAbi = [ { inputs: [ { internalType: "address", name: "_signer", type: "address" }, { internalType: "bytes32", name: "_hash", type: "bytes32" }, { internalType: "bytes", name: "_signature", type: "bytes" } ], stateMutability: "nonpayable", type: "constructor" } ]; // node_modules/viem/_esm/constants/contract.js var aggregate3Signature = "0x82ad56cb"; // node_modules/viem/_esm/constants/contracts.js var deploylessCallViaBytecodeBytecode = "0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe"; var deploylessCallViaFactoryBytecode = "0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe"; var universalSignatureValidatorByteCode = "0x60806040523480156200001157600080fd5b50604051620007003803806200070083398101604081905262000034916200056f565b6000620000438484846200004f565b9050806000526001601ff35b600080846001600160a01b0316803b806020016040519081016040528181526000908060200190933c90507f6492649264926492649264926492649264926492649264926492649264926492620000a68462000451565b036200021f57600060608085806020019051810190620000c79190620005ce565b8651929550909350915060000362000192576000836001600160a01b031683604051620000f5919062000643565b6000604051808303816000865af19150503d806000811462000134576040519150601f19603f3d011682016040523d82523d6000602084013e62000139565b606091505b5050905080620001905760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b505b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90620001c4908b90869060040162000661565b602060405180830381865afa158015620001e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200020891906200069d565b6001600160e01b031916149450505050506200044a565b805115620002b157604051630b135d3f60e11b808252906001600160a01b03871690631626ba7e9062000259908890889060040162000661565b602060405180830381865afa15801562000277573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200029d91906200069d565b6001600160e01b031916149150506200044a565b8251604114620003195760405162461bcd60e51b815260206004820152603a6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e677468000000000000606482015260840162000187565b620003236200046b565b506020830151604080850151855186939260009185919081106200034b576200034b620006c9565b016020015160f81c9050601b81148015906200036b57508060ff16601c14155b15620003cf5760405162461bcd60e51b815260206004820152603b6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c75650000000000606482015260840162000187565b6040805160008152602081018083528a905260ff83169181019190915260608101849052608081018390526001600160a01b038a169060019060a0016020604051602081039080840390855afa1580156200042e573d6000803e3d6000fd5b505050602060405103516001600160a01b031614955050505050505b9392505050565b60006020825110156200046357600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b03811681146200049f57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620004d5578181015183820152602001620004bb565b50506000910152565b600082601f830112620004f057600080fd5b81516001600160401b03808211156200050d576200050d620004a2565b604051601f8301601f19908116603f01168101908282118183101715620005385762000538620004a2565b816040528381528660208588010111156200055257600080fd5b62000565846020830160208901620004b8565b9695505050505050565b6000806000606084860312156200058557600080fd5b8351620005928162000489565b6020850151604086015191945092506001600160401b03811115620005b657600080fd5b620005c486828701620004de565b9150509250925092565b600080600060608486031215620005e457600080fd5b8351620005f18162000489565b60208501519093506001600160401b03808211156200060f57600080fd5b6200061d87838801620004de565b935060408601519150808211156200063457600080fd5b50620005c486828701620004de565b6000825162000657818460208701620004b8565b9190910192915050565b828152604060208201526000825180604084015262000688816060850160208701620004b8565b601f01601f1916919091016060019392505050565b600060208284031215620006b057600080fd5b81516001600160e01b0319811681146200044a57600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572"; // node_modules/viem/_esm/errors/version.js var version2 = "2.16.3"; // node_modules/viem/_esm/errors/utils.js var getContractAddress = (address) => address; var getUrl = (url) => url; var getVersion = () => `viem@${version2}`; // node_modules/viem/_esm/errors/base.js var BaseError2 = class _BaseError extends Error { constructor(shortMessage, args = {}) { super(); Object.defineProperty(this, "details", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "docsPath", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "metaMessages", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "shortMessage", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "ViemError" }); Object.defineProperty(this, "version", { enumerable: true, configurable: true, writable: true, value: getVersion() }); const details = args.cause instanceof _BaseError ? args.cause.details : args.cause?.message ? args.cause.message : args.details; const docsPath4 = args.cause instanceof _BaseError ? args.cause.docsPath || args.docsPath : args.docsPath; this.message = [ shortMessage || "An error occurred.", "", ...args.metaMessages ? [...args.metaMessages, ""] : [], ...docsPath4 ? [ `Docs: ${args.docsBaseUrl ?? "https://viem.sh"}${docsPath4}${args.docsSlug ? `#${args.docsSlug}` : ""}` ] : [], ...details ? [`Details: ${details}`] : [], `Version: ${this.version}` ].join("\n"); if (args.cause) this.cause = args.cause; this.details = details; this.docsPath = docsPath4; this.metaMessages = args.metaMessages; this.shortMessage = shortMessage; } walk(fn) { return walk(this, fn); } }; function walk(err, fn) { if (fn?.(err)) return err; if (err && typeof err === "object" && "cause" in err) return walk(err.cause, fn); return fn ? null : err; } // node_modules/viem/_esm/errors/chain.js var ChainDoesNotSupportContract = class extends BaseError2 { constructor({ blockNumber, chain, contract }) { super(`Chain "${chain.name}" does not support contract "${contract.name}".`, { metaMessages: [ "This could be due to any of the following:", ...blockNumber && contract.blockCreated && contract.blockCreated > blockNumber ? [ `- The contract "${contract.name}" was not deployed until block ${contract.blockCreated} (current block ${blockNumber}).` ] : [ `- The chain does not have the contract "${contract.name}" configured.` ] ] }); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "ChainDoesNotSupportContract" }); } }; var ChainMismatchError = class extends BaseError2 { constructor({ chain, currentChainId }) { super(`The current chain of the wallet (id: ${currentChainId}) does not match the target chain for the transaction (id: ${chain.id} \u2013 ${chain.name}).`, { metaMessages: [ `Current Chain ID: ${currentChainId}`, `Expected Chain ID: ${chain.id} \u2013 ${chain.name}` ] }); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "ChainMismatchError" }); } }; var ChainNotFoundError = class extends BaseError2 { constructor() { super([ "No chain was provided to the request.", "Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient." ].join("\n")); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "ChainNotFoundError" }); } }; var ClientChainNotConfiguredError = class extends BaseError2 { constructor() { super("No chain was provided to the Client."); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "ClientChainNotConfiguredError" }); } }; var InvalidChainIdError = class extends BaseError2 { constructor({ chainId }) { super(typeof chainId === "number" ? `Chain ID "${chainId}" is invalid.` : "Chain ID is invalid."); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "InvalidChainIdError" }); } }; // node_modules/viem/_esm/constants/solidity.js var panicReasons = { 1: "An `assert` condition failed.", 17: "Arithmetic operation resulted in underflow or overflow.", 18: "Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).", 33: "Attempted to convert to an invalid type.", 34: "Attempted to access a storage byte array that is incorrectly encoded.", 49: "Performed `.pop()` on an empty array", 50: "Array index is out of bounds.", 65: "Allocated too much memory or created an array which is too large.", 81: "Attempted to call a zero-initialized variable of internal function type." }; var solidityError = { inputs: [ { name: "message", type: "string" } ], name: "Error", type: "error" }; var solidityPanic = { inputs: [ { name: "reason", type: "uint256" } ], name: "Panic", type: "error" }; // node_modules/viem/_esm/utils/abi/formatAbiItem.js function formatAbiItem2(abiItem, { includeName = false } = {}) { if (abiItem.type !== "function" && abiItem.type !== "event" && abiItem.type !== "error") throw new InvalidDefinitionTypeError(abiItem.type); return `${abiItem.name}(${formatAbiParams(abiItem.inputs, { includeName })})`; } function formatAbiParams(params, { includeName = false } = {}) { if (!params) return ""; return params.map((param) => formatAbiParam(param, { includeName })).join(includeName ? ", " : ","); } function formatAbiParam(param, { includeName }) { if (param.type.startsWith("tuple")) { return `(${formatAbiParams(param.components, { includeName })})${param.type.slice("tuple".length)}`; } return param.type + (includeName && param.name ? ` ${param.name}` : ""); } // node_modules/viem/_esm/utils/data/isHex.js function isHex(value, { strict = true } = {}) { if (!value) return false; if (typeof value !== "string") return false; return strict ? /^0x[0-9a-fA-F]*$/.test(value) : value.startsWith("0x"); } // node_modules/viem/_esm/utils/data/size.js function size(value) { if (isHex(value, { strict: false })) return Math.ceil((value.length - 2) / 2); return value.length; } // node_modules/viem/_esm/errors/abi.js var AbiConstructorNotFoundError = class extends BaseError2 { constructor({ docsPath: docsPath4 }) { super([ "A constructor was not found on the ABI.", "Make sure you are using the correct ABI and that the constructor exists on it." ].join("\n"), { docsPath: docsPath4 }); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "AbiConstructorNotFoundError" }); } }; var AbiConstructorParamsNotFoundError = class extends BaseError2 { constructor({ docsPath: docsPath4 }) { super([ "Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.", "Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists." ].join("\n"), { docsPath: docsPath4 }); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "AbiConstructorParamsNotFoundError" }); } }; var AbiDecodingDataSizeTooSmallError = class extends BaseError2 { constructor({ data, params, size: size2 }) { super([`Data size of ${size2} bytes is too small for given parameters.`].join("\n"), { metaMessages: [ `Params: (${formatAbiParams(params, { includeName: true })})`, `Data: ${data} (${size2} bytes)` ] }); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "AbiDecodingDataSizeTooSmallError" }); Object.defineProperty(this, "data", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "params", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "size", { enumerable: true, configurable: true, writable: true, value: void 0 }); this.data = data; this.params = params; this.size = size2; } }; var AbiDecodingZeroDataError = class extends BaseError2 { constructor() { super('Cannot decode zero data ("0x") with ABI parameters.'); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "AbiDecodingZeroDataError" }); } }; var AbiEncodingArrayLengthMismatchError = class extends BaseError2 { constructor({ expectedLength, givenLength, type }) { super([ `ABI encoding array length mismatch for type ${type}.`, `Expected length: ${expectedLength}`, `Given length: ${givenLength}` ].join("\n")); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "AbiEncodingArrayLengthMismatchError" }); } }; var AbiEncodingBytesSizeMismatchError = class extends BaseError2 { constructor({ expectedSize, value }) { super(`Size of bytes "${value}" (bytes${size(value)}) does not match expected size (bytes${expectedSize}).`); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "AbiEncodingBytesSizeMismatchError" }); } }; var AbiEncodingLengthMismatchError = class extends BaseError2 { constructor({ expectedLength, givenLength }) { super([ "ABI encoding params/values length mismatch.", `Expected length (params): ${expectedLength}`, `Given length (values): ${givenLength}` ].join("\n")); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "AbiEncodingLengthMismatchError" }); } }; var AbiErrorSignatureNotFoundError = class extends BaseError2 { constructor(signature, { docsPath: docsPath4 }) { super([ `Encoded error signature "${signature}" not found on ABI.`, "Make sure you are using the correct ABI and that the error exists on it.", `You can look up the decoded signature here: https://openchain.xyz/signatures?query=${signature}.` ].join("\n"), { docsPath: docsPath4 }); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "AbiErrorSignatureNotFoundError" }); Object.defineProperty(this, "signature", { enumerable: true, configurable: true, writable: true, value: void 0 }); this.signature = signature; } }; var AbiEventSignatureEmptyTopicsError = class extends BaseError2 { constructor({ docsPath: docsPath4 }) { super("Cannot extract event signature from empty topics.", { docsPath: docsPath4 }); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "AbiEventSignatureEmptyTopicsError" }); } }; var AbiEventSignatureNotFoundError = class extends BaseError2 { constructor(signature, { docsPath: docsPath4 }) { super([ `Encoded event signature "${signature}" not found on ABI.`, "Make sure you are using the correct ABI and that the event exists on it.", `You can look up the signature here: https://openchain.xyz/signatures?query=${signature}.` ].join("\n"), { docsPath: docsPath4 }); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "AbiEventSignatureNotFoundError" }); } }; var AbiEventNotFoundError = class extends BaseError2 { constructor(eventName, { docsPath: docsPath4 } = {}) { super([ `Event ${eventName ? `"${eventName}" ` : ""}not found on ABI.`, "Make sure you are using the correct ABI and that the event exists on it." ].join("\n"), { docsPath: docsPath4 }); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: "AbiEventNotFoundError" }); } }; var AbiFunctio