moonchute
Version:
React hook for account abstraction
1,633 lines (1,594 loc) • 80.4 kB
JavaScript
"use client";
import {
Hash,
bytes,
exists,
number,
output,
toBytes,
u32,
wrapConstructor,
wrapXOFConstructorWithOpts
} from "./chunk-PWB7F2CX.js";
// 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"
}
];
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" }
]
}
];
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" }
]
}
];
// node_modules/viem/_esm/constants/contract.js
var aggregate3Signature = "0x82ad56cb";
// node_modules/viem/_esm/errors/version.js
var version = "1.18.6";
// node_modules/viem/_esm/errors/utils.js
var getUrl = (url) => url;
var getVersion = () => `viem@${version}`;
// node_modules/viem/_esm/errors/base.js
var BaseError = 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 docsPath2 = args.cause instanceof _BaseError ? args.cause.docsPath || args.docsPath : args.docsPath;
this.message = [
shortMessage || "An error occurred.",
"",
...args.metaMessages ? [...args.metaMessages, ""] : [],
...docsPath2 ? [
`Docs: https://viem.sh${docsPath2}.html${args.docsSlug ? `#${args.docsSlug}` : ""}`
] : [],
...details ? [`Details: ${details}`] : [],
`Version: ${this.version}`
].join("\n");
if (args.cause)
this.cause = args.cause;
this.details = details;
this.docsPath = docsPath2;
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 BaseError {
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 ClientChainNotConfiguredError = class extends BaseError {
constructor() {
super("No chain was provided to the Client.");
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: "ClientChainNotConfiguredError"
});
}
};
// node_modules/viem/_esm/constants/solidity.js
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 formatAbiItem(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 AbiDecodingDataSizeTooSmallError = class extends BaseError {
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 BaseError {
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 BaseError {
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 BaseError {
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 BaseError {
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 BaseError {
constructor(signature, { docsPath: docsPath2 }) {
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: docsPath2
});
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 AbiFunctionNotFoundError = class extends BaseError {
constructor(functionName, { docsPath: docsPath2 } = {}) {
super([
`Function ${functionName ? `"${functionName}" ` : ""}not found on ABI.`,
"Make sure you are using the correct ABI and that the function exists on it."
].join("\n"), {
docsPath: docsPath2
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: "AbiFunctionNotFoundError"
});
}
};
var AbiFunctionOutputsNotFoundError = class extends BaseError {
constructor(functionName, { docsPath: docsPath2 }) {
super([
`Function "${functionName}" does not contain any \`outputs\` on ABI.`,
"Cannot decode function result without knowing what the parameter types are.",
"Make sure you are using the correct ABI and that the function exists on it."
].join("\n"), {
docsPath: docsPath2
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: "AbiFunctionOutputsNotFoundError"
});
}
};
var InvalidAbiEncodingTypeError = class extends BaseError {
constructor(type, { docsPath: docsPath2 }) {
super([
`Type "${type}" is not a valid encoding type.`,
"Please provide a valid ABI type."
].join("\n"), { docsPath: docsPath2 });
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: "InvalidAbiEncodingType"
});
}
};
var InvalidAbiDecodingTypeError = class extends BaseError {
constructor(type, { docsPath: docsPath2 }) {
super([
`Type "${type}" is not a valid decoding type.`,
"Please provide a valid ABI type."
].join("\n"), { docsPath: docsPath2 });
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: "InvalidAbiDecodingType"
});
}
};
var InvalidArrayError = class extends BaseError {
constructor(value) {
super([`Value "${value}" is not a valid array.`].join("\n"));
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: "InvalidArrayError"
});
}
};
var InvalidDefinitionTypeError = class extends BaseError {
constructor(type) {
super([
`"${type}" is not a valid definition type.`,
'Valid types: "function", "event", "error"'
].join("\n"));
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: "InvalidDefinitionTypeError"
});
}
};
// node_modules/viem/_esm/errors/data.js
var SliceOffsetOutOfBoundsError = class extends BaseError {
constructor({ offset, position, size: size2 }) {
super(`Slice ${position === "start" ? "starting" : "ending"} at offset "${offset}" is out-of-bounds (size: ${size2}).`);
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: "SliceOffsetOutOfBoundsError"
});
}
};
var SizeExceedsPaddingSizeError = class extends BaseError {
constructor({ size: size2, targetSize, type }) {
super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (${size2}) exceeds padding size (${targetSize}).`);
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: "SizeExceedsPaddingSizeError"
});
}
};
// node_modules/viem/_esm/utils/data/slice.js
function slice(value, start, end, { strict } = {}) {
if (isHex(value, { strict: false }))
return sliceHex(value, start, end, {
strict
});
return sliceBytes(value, start, end, {
strict
});
}
function assertStartOffset(value, start) {
if (typeof start === "number" && start > 0 && start > size(value) - 1)
throw new SliceOffsetOutOfBoundsError({
offset: start,
position: "start",
size: size(value)
});
}
function assertEndOffset(value, start, end) {
if (typeof start === "number" && typeof end === "number" && size(value) !== end - start) {
throw new SliceOffsetOutOfBoundsError({
offset: end,
position: "end",
size: size(value)
});
}
}
function sliceBytes(value_, start, end, { strict } = {}) {
assertStartOffset(value_, start);
const value = value_.slice(start, end);
if (strict)
assertEndOffset(value, start, end);
return value;
}
function sliceHex(value_, start, end, { strict } = {}) {
assertStartOffset(value_, start);
const value = `0x${value_.replace("0x", "").slice((start ?? 0) * 2, (end ?? value_.length) * 2)}`;
if (strict)
assertEndOffset(value, start, end);
return value;
}
// node_modules/viem/_esm/utils/data/pad.js
function pad(hexOrBytes, { dir, size: size2 = 32 } = {}) {
if (typeof hexOrBytes === "string")
return padHex(hexOrBytes, { dir, size: size2 });
return padBytes(hexOrBytes, { dir, size: size2 });
}
function padHex(hex_, { dir, size: size2 = 32 } = {}) {
if (size2 === null)
return hex_;
const hex = hex_.replace("0x", "");
if (hex.length > size2 * 2)
throw new SizeExceedsPaddingSizeError({
size: Math.ceil(hex.length / 2),
targetSize: size2,
type: "hex"
});
return `0x${hex[dir === "right" ? "padEnd" : "padStart"](size2 * 2, "0")}`;
}
function padBytes(bytes2, { dir, size: size2 = 32 } = {}) {
if (size2 === null)
return bytes2;
if (bytes2.length > size2)
throw new SizeExceedsPaddingSizeError({
size: bytes2.length,
targetSize: size2,
type: "bytes"
});
const paddedBytes = new Uint8Array(size2);
for (let i = 0; i < size2; i++) {
const padEnd = dir === "right";
paddedBytes[padEnd ? i : size2 - i - 1] = bytes2[padEnd ? i : bytes2.length - i - 1];
}
return paddedBytes;
}
// node_modules/viem/_esm/errors/encoding.js
var IntegerOutOfRangeError = class extends BaseError {
constructor({ max, min, signed, size: size2, value }) {
super(`Number "${value}" is not in safe ${size2 ? `${size2 * 8}-bit ${signed ? "signed" : "unsigned"} ` : ""}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`);
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: "IntegerOutOfRangeError"
});
}
};
var InvalidHexBooleanError = class extends BaseError {
constructor(hex) {
super(`Hex value "${hex}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`);
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: "InvalidHexBooleanError"
});
}
};
var SizeOverflowError = class extends BaseError {
constructor({ givenSize, maxSize }) {
super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`);
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: "SizeOverflowError"
});
}
};
// node_modules/viem/_esm/utils/data/trim.js
function trim(hexOrBytes, { dir = "left" } = {}) {
let data = typeof hexOrBytes === "string" ? hexOrBytes.replace("0x", "") : hexOrBytes;
let sliceLength = 0;
for (let i = 0; i < data.length - 1; i++) {
if (data[dir === "left" ? i : data.length - i - 1].toString() === "0")
sliceLength++;
else
break;
}
data = dir === "left" ? data.slice(sliceLength) : data.slice(0, data.length - sliceLength);
if (typeof hexOrBytes === "string") {
if (data.length === 1 && dir === "right")
data = `${data}0`;
return `0x${data.length % 2 === 1 ? `0${data}` : data}`;
}
return data;
}
// node_modules/viem/_esm/utils/encoding/fromHex.js
function assertSize(hexOrBytes, { size: size2 }) {
if (size(hexOrBytes) > size2)
throw new SizeOverflowError({
givenSize: size(hexOrBytes),
maxSize: size2
});
}
function hexToBigInt(hex, opts = {}) {
const { signed } = opts;
if (opts.size)
assertSize(hex, { size: opts.size });
const value = BigInt(hex);
if (!signed)
return value;
const size2 = (hex.length - 2) / 2;
const max = (1n << BigInt(size2) * 8n - 1n) - 1n;
if (value <= max)
return value;
return value - BigInt(`0x${"f".padStart(size2 * 2, "f")}`) - 1n;
}
function hexToBool(hex_, opts = {}) {
let hex = hex_;
if (opts.size) {
assertSize(hex, { size: opts.size });
hex = trim(hex);
}
if (trim(hex) === "0x00")
return false;
if (trim(hex) === "0x01")
return true;
throw new InvalidHexBooleanError(hex);
}
function hexToNumber(hex, opts = {}) {
return Number(hexToBigInt(hex, opts));
}
function hexToString(hex, opts = {}) {
let bytes2 = hexToBytes(hex);
if (opts.size) {
assertSize(bytes2, { size: opts.size });
bytes2 = trim(bytes2, { dir: "right" });
}
return new TextDecoder().decode(bytes2);
}
// node_modules/viem/_esm/utils/encoding/toHex.js
var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0"));
function toHex(value, opts = {}) {
if (typeof value === "number" || typeof value === "bigint")
return numberToHex(value, opts);
if (typeof value === "string") {
return stringToHex(value, opts);
}
if (typeof value === "boolean")
return boolToHex(value, opts);
return bytesToHex(value, opts);
}
function boolToHex(value, opts = {}) {
const hex = `0x${Number(value)}`;
if (typeof opts.size === "number") {
assertSize(hex, { size: opts.size });
return pad(hex, { size: opts.size });
}
return hex;
}
function bytesToHex(value, opts = {}) {
let string = "";
for (let i = 0; i < value.length; i++) {
string += hexes[value[i]];
}
const hex = `0x${string}`;
if (typeof opts.size === "number") {
assertSize(hex, { size: opts.size });
return pad(hex, { dir: "right", size: opts.size });
}
return hex;
}
function numberToHex(value_, opts = {}) {
const { signed, size: size2 } = opts;
const value = BigInt(value_);
let maxValue;
if (size2) {
if (signed)
maxValue = (1n << BigInt(size2) * 8n - 1n) - 1n;
else
maxValue = 2n ** (BigInt(size2) * 8n) - 1n;
} else if (typeof value_ === "number") {
maxValue = BigInt(Number.MAX_SAFE_INTEGER);
}
const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
if (maxValue && value > maxValue || value < minValue) {
const suffix = typeof value_ === "bigint" ? "n" : "";
throw new IntegerOutOfRangeError({
max: maxValue ? `${maxValue}${suffix}` : void 0,
min: `${minValue}${suffix}`,
signed,
size: size2,
value: `${value_}${suffix}`
});
}
const hex = `0x${(signed && value < 0 ? (1n << BigInt(size2 * 8)) + BigInt(value) : value).toString(16)}`;
if (size2)
return pad(hex, { size: size2 });
return hex;
}
var encoder = /* @__PURE__ */ new TextEncoder();
function stringToHex(value_, opts = {}) {
const value = encoder.encode(value_);
return bytesToHex(value, opts);
}
// node_modules/viem/_esm/utils/encoding/toBytes.js
var encoder2 = /* @__PURE__ */ new TextEncoder();
function toBytes2(value, opts = {}) {
if (typeof value === "number" || typeof value === "bigint")
return numberToBytes(value, opts);
if (typeof value === "boolean")
return boolToBytes(value, opts);
if (isHex(value))
return hexToBytes(value, opts);
return stringToBytes(value, opts);
}
function boolToBytes(value, opts = {}) {
const bytes2 = new Uint8Array(1);
bytes2[0] = Number(value);
if (typeof opts.size === "number") {
assertSize(bytes2, { size: opts.size });
return pad(bytes2, { size: opts.size });
}
return bytes2;
}
var charCodeMap = {
zero: 48,
nine: 57,
A: 65,
F: 70,
a: 97,
f: 102
};
function charCodeToBase16(char) {
if (char >= charCodeMap.zero && char <= charCodeMap.nine)
return char - charCodeMap.zero;
else if (char >= charCodeMap.A && char <= charCodeMap.F)
return char - (charCodeMap.A - 10);
else if (char >= charCodeMap.a && char <= charCodeMap.f)
return char - (charCodeMap.a - 10);
return void 0;
}
function hexToBytes(hex_, opts = {}) {
let hex = hex_;
if (opts.size) {
assertSize(hex, { size: opts.size });
hex = pad(hex, { dir: "right", size: opts.size });
}
let hexString = hex.slice(2);
if (hexString.length % 2)
hexString = `0${hexString}`;
const length = hexString.length / 2;
const bytes2 = new Uint8Array(length);
for (let index = 0, j = 0; index < length; index++) {
const nibbleLeft = charCodeToBase16(hexString.charCodeAt(j++));
const nibbleRight = charCodeToBase16(hexString.charCodeAt(j++));
if (nibbleLeft === void 0 || nibbleRight === void 0) {
throw new BaseError(`Invalid byte sequence ("${hexString[j - 2]}${hexString[j - 1]}" in "${hexString}").`);
}
bytes2[index] = nibbleLeft * 16 + nibbleRight;
}
return bytes2;
}
function numberToBytes(value, opts) {
const hex = numberToHex(value, opts);
return hexToBytes(hex);
}
function stringToBytes(value, opts = {}) {
const bytes2 = encoder2.encode(value);
if (typeof opts.size === "number") {
assertSize(bytes2, { size: opts.size });
return pad(bytes2, { dir: "right", size: opts.size });
}
return bytes2;
}
// node_modules/viem/_esm/utils/contract/extractFunctionParts.js
var paramsRegex = /((function|event)\s)?(.*)(\((.*)\))/;
function extractFunctionParts(def) {
const parts = def.match(paramsRegex);
const type = parts?.[2] || void 0;
const name = parts?.[3];
const params = parts?.[5] || void 0;
return { type, name, params };
}
function extractFunctionName(def) {
return extractFunctionParts(def).name;
}
function extractFunctionParams(def) {
const params = extractFunctionParts(def).params;
const splitParams = params?.split(",").map((x) => x.trim().split(" "));
return splitParams?.map((param) => ({
type: param[0],
name: param[1] === "indexed" ? param[2] : param[1],
...param[1] === "indexed" ? { indexed: true } : {}
}));
}
// node_modules/viem/_esm/utils/hash/getFunctionSignature.js
var getFunctionSignature = (fn) => {
if (typeof fn === "string") {
const name = extractFunctionName(fn);
const params = extractFunctionParams(fn) || [];
return `${name}(${params.map(({ type }) => type).join(",")})`;
}
return formatAbiItem(fn);
};
// node_modules/@noble/hashes/esm/_u64.js
var U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
var _32n = /* @__PURE__ */ BigInt(32);
function fromBig(n, le = false) {
if (le)
return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
}
function split(lst, le = false) {
let Ah = new Uint32Array(lst.length);
let Al = new Uint32Array(lst.length);
for (let i = 0; i < lst.length; i++) {
const { h, l } = fromBig(lst[i], le);
[Ah[i], Al[i]] = [h, l];
}
return [Ah, Al];
}
var rotlSH = (h, l, s) => h << s | l >>> 32 - s;
var rotlSL = (h, l, s) => l << s | h >>> 32 - s;
var rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s;
var rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
// node_modules/@noble/hashes/esm/sha3.js
var [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []];
var _0n = /* @__PURE__ */ BigInt(0);
var _1n = /* @__PURE__ */ BigInt(1);
var _2n = /* @__PURE__ */ BigInt(2);
var _7n = /* @__PURE__ */ BigInt(7);
var _256n = /* @__PURE__ */ BigInt(256);
var _0x71n = /* @__PURE__ */ BigInt(113);
for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
[x, y] = [y, (2 * x + 3 * y) % 5];
SHA3_PI.push(2 * (5 * y + x));
SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
let t = _0n;
for (let j = 0; j < 7; j++) {
R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n;
if (R & _2n)
t ^= _1n << (_1n << /* @__PURE__ */ BigInt(j)) - _1n;
}
_SHA3_IOTA.push(t);
}
var [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);
var rotlH = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s);
var rotlL = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s);
function keccakP(s, rounds = 24) {
const B = new Uint32Array(5 * 2);
for (let round = 24 - rounds; round < 24; round++) {
for (let x = 0; x < 10; x++)
B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
for (let x = 0; x < 10; x += 2) {
const idx1 = (x + 8) % 10;
const idx0 = (x + 2) % 10;
const B0 = B[idx0];
const B1 = B[idx0 + 1];
const Th = rotlH(B0, B1, 1) ^ B[idx1];
const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
for (let y = 0; y < 50; y += 10) {
s[x + y] ^= Th;
s[x + y + 1] ^= Tl;
}
}
let curH = s[2];
let curL = s[3];
for (let t = 0; t < 24; t++) {
const shift = SHA3_ROTL[t];
const Th = rotlH(curH, curL, shift);
const Tl = rotlL(curH, curL, shift);
const PI = SHA3_PI[t];
curH = s[PI];
curL = s[PI + 1];
s[PI] = Th;
s[PI + 1] = Tl;
}
for (let y = 0; y < 50; y += 10) {
for (let x = 0; x < 10; x++)
B[x] = s[y + x];
for (let x = 0; x < 10; x++)
s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
}
s[0] ^= SHA3_IOTA_H[round];
s[1] ^= SHA3_IOTA_L[round];
}
B.fill(0);
}
var Keccak = class _Keccak extends Hash {
// NOTE: we accept arguments in bytes instead of bits here.
constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
super();
this.blockLen = blockLen;
this.suffix = suffix;
this.outputLen = outputLen;
this.enableXOF = enableXOF;
this.rounds = rounds;
this.pos = 0;
this.posOut = 0;
this.finished = false;
this.destroyed = false;
number(outputLen);
if (0 >= this.blockLen || this.blockLen >= 200)
throw new Error("Sha3 supports only keccak-f1600 function");
this.state = new Uint8Array(200);
this.state32 = u32(this.state);
}
keccak() {
keccakP(this.state32, this.rounds);
this.posOut = 0;
this.pos = 0;
}
update(data) {
exists(this);
const { blockLen, state } = this;
data = toBytes(data);
const len = data.length;
for (let pos = 0; pos < len; ) {
const take = Math.min(blockLen - this.pos, len - pos);
for (let i = 0; i < take; i++)
state[this.pos++] ^= data[pos++];
if (this.pos === blockLen)
this.keccak();
}
return this;
}
finish() {
if (this.finished)
return;
this.finished = true;
const { state, suffix, pos, blockLen } = this;
state[pos] ^= suffix;
if ((suffix & 128) !== 0 && pos === blockLen - 1)
this.keccak();
state[blockLen - 1] ^= 128;
this.keccak();
}
writeInto(out) {
exists(this, false);
bytes(out);
this.finish();
const bufferOut = this.state;
const { blockLen } = this;
for (let pos = 0, len = out.length; pos < len; ) {
if (this.posOut >= blockLen)
this.keccak();
const take = Math.min(blockLen - this.posOut, len - pos);
out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
this.posOut += take;
pos += take;
}
return out;
}
xofInto(out) {
if (!this.enableXOF)
throw new Error("XOF is not possible for this instance");
return this.writeInto(out);
}
xof(bytes2) {
number(bytes2);
return this.xofInto(new Uint8Array(bytes2));
}
digestInto(out) {
output(out, this);
if (this.finished)
throw new Error("digest() was already called");
this.writeInto(out);
this.destroy();
return out;
}
digest() {
return this.digestInto(new Uint8Array(this.outputLen));
}
destroy() {
this.destroyed = true;
this.state.fill(0);
}
_cloneInto(to) {
const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
to || (to = new _Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
to.state32.set(this.state32);
to.pos = this.pos;
to.posOut = this.posOut;
to.finished = this.finished;
to.rounds = rounds;
to.suffix = suffix;
to.outputLen = outputLen;
to.enableXOF = enableXOF;
to.destroyed = this.destroyed;
return to;
}
};
var gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));
var sha3_224 = /* @__PURE__ */ gen(6, 144, 224 / 8);
var sha3_256 = /* @__PURE__ */ gen(6, 136, 256 / 8);
var sha3_384 = /* @__PURE__ */ gen(6, 104, 384 / 8);
var sha3_512 = /* @__PURE__ */ gen(6, 72, 512 / 8);
var keccak_224 = /* @__PURE__ */ gen(1, 144, 224 / 8);
var keccak_256 = /* @__PURE__ */ gen(1, 136, 256 / 8);
var keccak_384 = /* @__PURE__ */ gen(1, 104, 384 / 8);
var keccak_512 = /* @__PURE__ */ gen(1, 72, 512 / 8);
var genShake = (suffix, blockLen, outputLen) => wrapXOFConstructorWithOpts((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === void 0 ? outputLen : opts.dkLen, true));
var shake128 = /* @__PURE__ */ genShake(31, 168, 128 / 8);
var shake256 = /* @__PURE__ */ genShake(31, 136, 256 / 8);
// node_modules/viem/_esm/utils/hash/keccak256.js
function keccak256(value, to_) {
const to = to_ || "hex";
const bytes2 = keccak_256(isHex(value, { strict: false }) ? toBytes2(value) : value);
if (to === "bytes")
return bytes2;
return toHex(bytes2);
}
// node_modules/viem/_esm/utils/hash/getFunctionSelector.js
var hash = (value) => keccak256(toBytes2(value));
var getFunctionSelector = (fn) => slice(hash(getFunctionSignature(fn)), 0, 4);
// node_modules/viem/_esm/errors/address.js
var InvalidAddressError = class extends BaseError {
constructor({ address }) {
super(`Address "${address}" is invalid.`);
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: "InvalidAddressError"
});
}
};
// node_modules/viem/_esm/utils/address/isAddress.js
var addressRegex = /^0x[a-fA-F0-9]{40}$/;
function isAddress(address) {
return addressRegex.test(address);
}
// node_modules/viem/_esm/utils/address/getAddress.js
function checksumAddress(address_, chainId) {
const hexAddress = chainId ? `${chainId}${address_.toLowerCase()}` : address_.substring(2).toLowerCase();
const hash3 = keccak256(stringToBytes(hexAddress), "bytes");
const address = (chainId ? hexAddress.substring(`${chainId}0x`.length) : hexAddress).split("");
for (let i = 0; i < 40; i += 2) {
if (hash3[i >> 1] >> 4 >= 8 && address[i]) {
address[i] = address[i].toUpperCase();
}
if ((hash3[i >> 1] & 15) >= 8 && address[i + 1]) {
address[i + 1] = address[i + 1].toUpperCase();
}
}
return `0x${address.join("")}`;
}
// node_modules/viem/_esm/utils/data/concat.js
function concat(values) {
if (typeof values[0] === "string")
return concatHex(values);
return concatBytes(values);
}
function concatBytes(values) {
let length = 0;
for (const arr of values) {
length += arr.length;
}
const result = new Uint8Array(length);
let offset = 0;
for (const arr of values) {
result.set(arr, offset);
offset += arr.length;
}
return result;
}
function concatHex(values) {
return `0x${values.reduce((acc, x) => acc + x.replace("0x", ""), "")}`;
}
// node_modules/viem/_esm/utils/abi/encodeAbiParameters.js
function encodeAbiParameters(params, values) {
if (params.length !== values.length)
throw new AbiEncodingLengthMismatchError({
expectedLength: params.length,
givenLength: values.length
});
const preparedParams = prepareParams({
params,
values
});
const data = encodeParams(preparedParams);
if (data.length === 0)
return "0x";
return data;
}
function prepareParams({ params, values }) {
const preparedParams = [];
for (let i = 0; i < params.length; i++) {
preparedParams.push(prepareParam({ param: params[i], value: values[i] }));
}
return preparedParams;
}
function prepareParam({ param, value }) {
const arrayComponents = getArrayComponents(param.type);
if (arrayComponents) {
const [length, type] = arrayComponents;
return encodeArray(value, { length, param: { ...param, type } });
}
if (param.type === "tuple") {
return encodeTuple(value, {
param
});
}
if (param.type === "address") {
return encodeAddress(value);
}
if (param.type === "bool") {
return encodeBool(value);
}
if (param.type.startsWith("uint") || param.type.startsWith("int")) {
const signed = param.type.startsWith("int");
return encodeNumber(value, { signed });
}
if (param.type.startsWith("bytes")) {
return encodeBytes(value, { param });
}
if (param.type === "string") {
return encodeString(value);
}
throw new InvalidAbiEncodingTypeError(param.type, {
docsPath: "/docs/contract/encodeAbiParameters"
});
}
function encodeParams(preparedParams) {
let staticSize = 0;
for (let i = 0; i < preparedParams.length; i++) {
const { dynamic, encoded } = preparedParams[i];
if (dynamic)
staticSize += 32;
else
staticSize += size(encoded);
}
const staticParams = [];
const dynamicParams = [];
let dynamicSize = 0;
for (let i = 0; i < preparedParams.length; i++) {
const { dynamic, encoded } = preparedParams[i];
if (dynamic) {
staticParams.push(numberToHex(staticSize + dynamicSize, { size: 32 }));
dynamicParams.push(encoded);
dynamicSize += size(encoded);
} else {
staticParams.push(encoded);
}
}
return concat([...staticParams, ...dynamicParams]);
}
function encodeAddress(value) {
if (!isAddress(value))
throw new InvalidAddressError({ address: value });
return { dynamic: false, encoded: padHex(value.toLowerCase()) };
}
function encodeArray(value, { length, param }) {
const dynamic = length === null;
if (!Array.isArray(value))
throw new InvalidArrayError(value);
if (!dynamic && value.length !== length)
throw new AbiEncodingArrayLengthMismatchError({
expectedLength: length,
givenLength: value.length,
type: `${param.type}[${length}]`
});
let dynamicChild = false;
const preparedParams = [];
for (let i = 0; i < value.length; i++) {
const preparedParam = prepareParam({ param, value: value[i] });
if (preparedParam.dynamic)
dynamicChild = true;
preparedParams.push(preparedParam);
}
if (dynamic || dynamicChild) {
const data = encodeParams(preparedParams);
if (dynamic) {
const length2 = numberToHex(preparedParams.length, { size: 32 });
return {
dynamic: true,
encoded: preparedParams.length > 0 ? concat([length2, data]) : length2
};
}
if (dynamicChild)
return { dynamic: true, encoded: data };
}
return {
dynamic: false,
encoded: concat(preparedParams.map(({ encoded }) => encoded))
};
}
function encodeBytes(value, { param }) {
const [, paramSize] = param.type.split("bytes");
const bytesSize = size(value);
if (!paramSize) {
let value_ = value;
if (bytesSize % 32 !== 0)
value_ = padHex(value_, {
dir: "right",
size: Math.ceil((value.length - 2) / 2 / 32) * 32
});
return {
dynamic: true,
encoded: concat([padHex(numberToHex(bytesSize, { size: 32 })), value_])
};
}
if (bytesSize !== parseInt(paramSize))
throw new AbiEncodingBytesSizeMismatchError({
expectedSize: parseInt(paramSize),
value
});
return { dynamic: false, encoded: padHex(value, { dir: "right" }) };
}
function encodeBool(value) {
return { dynamic: false, encoded: padHex(boolToHex(value)) };
}
function encodeNumber(value, { signed }) {
return {
dynamic: false,
encoded: numberToHex(value, {
size: 32,
signed
})
};
}
function encodeString(value) {
const hexValue = stringToHex(value);
const partsLength = Math.ceil(size(hexValue) / 32);
const parts = [];
for (let i = 0; i < partsLength; i++) {
parts.push(padHex(slice(hexValue, i * 32, (i + 1) * 32), {
dir: "right"
}));
}
return {
dynamic: true,
encoded: concat([
padHex(numberToHex(size(hexValue), { size: 32 })),
...parts
])
};
}
function encodeTuple(value, { param }) {
let dynamic = false;
const preparedParams = [];
for (let i = 0; i < param.components.length; i++) {
const param_ = param.components[i];
const index = Array.isArray(value) ? i : param_.name;
const preparedParam = prepareParam({
param: param_,
value: value[index]
});
preparedParams.push(preparedParam);
if (preparedParam.dynamic)
dynamic = true;
}
return {
dynamic,
encoded: dynamic ? encodeParams(preparedParams) : concat(preparedParams.map(({ encoded }) => encoded))
};
}
function getArrayComponents(type) {
const matches = type.match(/^(.*)\[(\d+)?\]$/);
return matches ? (
// Return `null` if the array is dynamic.
[matches[2] ? Number(matches[2]) : null, matches[1]]
) : void 0;
}
// node_modules/viem/_esm/utils/abi/decodeAbiParameters.js
function decodeAbiParameters(params, data) {
if (data === "0x" && params.length > 0)
throw new AbiDecodingZeroDataError();
if (size(data) && size(data) < 32)
throw new AbiDecodingDataSizeTooSmallError({
data,
params,
size: size(data)
});
return decodeParams({
data,
params
});
}
function decodeParams({ data, params }) {
const decodedValues = [];
let position = 0;
for (let i = 0; i < params.length; i++) {
if (position >= size(data))
throw new AbiDecodingDataSizeTooSmallError({
data,
params,
size: size(data)
});
const param = params[i];
const { consumed, value } = decodeParam({ data, param, position });
decodedValues.push(value);
position += consumed;
}
return decodedValues;
}
function decodeParam({ data, param, position }) {
const arrayComponents = getArrayComponents(param.type);
if (arrayComponents) {
const [length, type] = arrayComponents;
return decodeArray(data, {
length,
param: { ...param, type },
position
});
}
if (param.type === "tuple") {
return decodeTuple(data, { param, position });
}
if (param.type === "string") {
return decodeString(data, { position });
}
if (param.type.startsWith("bytes")) {
return decodeBytes(data, { param, position });
}
const value = slice(data, position, position + 32, { strict: true });
if (param.type.startsWith("uint") || param.type.startsWith("int")) {
return decodeNumber(value, { param });
}
if (param.type === "address") {
return decodeAddress(value);
}
if (param.type === "bool") {
return decodeBool(value);
}
throw new InvalidAbiDecodingTypeError(param.type, {
docsPath: "/docs/contract/decodeAbiParameters"
});
}
function decodeAddress(value) {
return { consumed: 32, value: checksumAddress(slice(value, -20)) };
}
function decodeArray(data, { param, length, position }) {
if (!length) {
const offset = hexToNumber(slice(data, position, position + 32, { strict: true }));
const length2 = hexToNumber(slice(data, offset, offset + 32, { strict: true }));
let consumed2 = 0;
const value2 = [];
for (let i = 0; i < length2; ++i) {
const decodedChild = decodeParam({
data: slice(data, offset + 32),
param,
position: consumed2
});
consumed2 += decodedChild.consumed;
value2.push(decodedChild.value);
}
return { value: value2, consumed: 32 };
}
if (hasDynamicChild(param)) {
const arrayComponents = getArrayComponents(param.type);
const dynamicChild = !arrayComponents?.[0];
let consumed2 = 0;
const value2 = [];
for (let i = 0; i < length; ++i) {
const offset = hexToNumber(slice(data, position, position + 32, { strict: true }));
const decodedChild = decodeParam({
data: slice(data, offset),
param,
position: dynamicChild ? consumed2 : i * 32
});
consumed2 += decodedChild.consumed;
value2.push(decodedChild.value);
}
return { value: value2, consumed: 32 };
}
let consumed = 0;
const value = [];
for (let i = 0; i < length; ++i) {
const decodedChild = decodeParam({
data,
param,
position: position + consumed
});
consumed += decodedChild.consumed;
value.push(decodedChild.value);
}
return { value, consumed };
}
function decodeBool(value) {
return { consumed: 32, value: hexToBool(value) };
}
function decodeBytes(data, { param, position }) {
const [_, size2] = param.type.split("bytes");
if (!size2) {
const offset = hexToNumber(slice(data, position, position + 32, { strict: true }));
const length = hexToNumber(slice(data, offset, offset + 32, { strict: true }));
if (length === 0)
return { consumed: 32, value: "0x" };
const value2 = slice(data, offset + 32, offset + 32 + length, {
strict: true
});
return { consumed: 32, value: value2 };
}
const value = slice(data, position, position + parseInt(size2), {
strict: true
});
return { consumed: 32, value };
}
function decodeNumber(value, { param }) {
const signed = param.type.startsWith("int");
const size2 = parseInt(param.type.split("int")[1] || "256");
return {
consumed: 32,
value: size2 > 48 ? hexToBigInt(value, { signed }) : hexToNumber(value, { signed })
};
}
function decodeString(data, { position }) {
const offset = hexToNumber(slice(data, position, position + 32, { strict: true }));
const length = hexToNumber(slice(data, offset, offset + 32, { strict: true }));
if (length === 0)
return { consumed: 32, value: "" };
const value = hexToString(trim(slice(data, offset + 32, offset + 32 + length, { strict: true })));
return { consumed: 32, value };
}
function decodeTuple(data, { param, position }) {
const hasUnnamedChild = param.components.length === 0 || param.components.some(({ name }) => !name);
const value = hasUnnamedChild ? [] : {};
let consumed = 0;
if (hasDynamicChild(param)) {
const offset = hexToNumber(slice(data, position, position + 32, { strict: true }));
for (let i = 0; i < param.components.length; ++i) {
const component = param.components[i];
const decodedChild = decodeParam({
data: slice(data, offset),
param: component,
position: consumed
});
consumed += decodedChild.consumed;
value[hasUnnamedChild ? i : component?.name] = decodedChild.value;
}
return { consumed: 32, value };
}
for (let i = 0; i < param.components.length; ++i) {
const component = param.components[i];
const decodedChild = decodeParam({
data,
param: component,
position: position + consumed
});
consumed += decodedChild.consumed;
value[hasUnnamedChild ? i : component?.name] = decodedChild.value;
}
return { consumed, value };
}
function hasDynamicChild(param) {
const { type } = param;
if (type === "string")
return true;
if (type === "bytes")
return true;
if (type.endsWith("[]"))
return true;
if (type === "tuple")
return param.components?.some(hasDynamicChild);
const arrayComponents = getArrayComponents(param.type);
if (arrayComponents && hasDynamicChild({ ...param, type: arrayComponents[1] }))
return true;
return false;
}
// node_modules/viem/_esm/utils/abi/decodeErrorResult.js
function decodeErrorResult({ abi, data }) {
const signature = slice(data, 0, 4);
if (signature === "0x")
throw new AbiDecodingZeroDataError();
const abi_ = [...abi || [], solidityError, solidityPanic];
const abiItem = abi_.find((x) => x.type === "error" && signature === getFunctionSelector(formatAbiItem(x)));
if (!abiItem)
throw new AbiErrorSignatureNotFoundError(signature, {
docsPath: "/docs/contract/decodeErrorResult"
});
return {
abiItem,
args: "inputs" in abiItem && abiItem.inputs && abiItem.inputs.length > 0 ? decodeAbiParameters(abiItem.inputs, slice(data, 4)) : void 0,
errorName: abiItem.name
};
}
// node_modules/viem/_esm/utils/stringify.js
var stringify = (value, replacer, space) => JSON.stringify(value, (key, value_) => {
const value2 = typeof value_ === "bigint" ? value_.toString() : value_;
return typeof replacer === "function" ? replacer(key, value2) : value2;
}, space);
// node_modules/viem/_esm/utils/hash/getEventSignature.js
var getEventSignature = (fn) => {
return getFunctionSignature(fn);
};
// node_modules/viem/_esm/utils/hash/getEventSelector.js
var hash2 = (value) => keccak256(toBytes2(value));
var getEventSelector = (fn) => hash2(getEventSignature(fn));
// node_modules/viem/_esm/utils/abi/getAbiItem.js
function getAbiItem({ abi, args = [], name }) {
const isSelector = isHex(name, { strict: false });
const abiItems = abi.filter((abiItem) => {
if (isSelector) {
if (abiItem.type === "function")
return getFunctionSelector(abiItem) === name;
if (abiItem.type === "event")
return getEventSelector(abiItem) === name;
return false;
}
return "name" in abiItem && abiItem.name === name;
});
if (abiItems.length === 0)
return void 0;
if (abiItems.length === 1)
return abiItems[0];
for (const abiItem of abiItems) {
if (!("inputs" in abiItem))
continue;
if (!args || args.length === 0) {
if (!abiItem.inputs || abiItem.inputs.length === 0)
return abiItem;
continue;
}
if (!abiItem.inputs)
continue;
if (abiItem.inputs.length === 0)
continue;
if (abiItem.inputs.length !== args.length)
continue;
const matched = args.every((arg, index) => {
const abiParameter = "inputs" in abiItem && abiItem.inputs[index];
if (!abiParameter)
return false;
return isArgOfType(arg, abiParameter);
});
if (matched)
return abiItem;
}
return abiItems[0];
}
function isArgOfType(arg, abiParameter) {
const argType = typeof arg;
const abiParameterType = abiParameter.type;
switch (abiParameterType) {
case "address":
return isAddress(arg);
case "bool":
return argType === "boolean";
case "function":
return argType === "string";
case "string":
return argType === "string";
default: {
if (abiParameterType === "tuple" && "components" in abiParameter)
return Object.values(abiParameter.components).every((component, index) => {
return isArgOfType(Object.values(arg)[index], component);
});
if (/^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)?$/.test(abiParameterType))
return argType === "number" || argType === "bigint";
if (/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(abiParameterType))
return argType === "string" || arg instanceof Uint8Array;
if (/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(abiParameterType)) {
return Array.isArray(arg) && arg.every((x) => isArgOfType(x, {
...abiParameter,
// Pop off `[]` or `[M]` from end of type
type: abiParameterType.replace(/(\[[0-9]{0,}\])$/, "")
}));
}
return false;
}
}
}
// node_modules/viem/_esm/constants/unit.js
var etherUnits = {
gwei: 9,
wei: 18
};
var gweiUnits = {
ether: -9,
wei: 9
};
// node_modules/viem/