tenjin-cli 0.1.0-alpha.14 → 0.1.0-alpha.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE.md +54 -7
- package/README.md +41 -295
- package/dist/{_esm-N4KAVXQR.js → _esm-CE7KNONL.js} +9 -10
- package/dist/{ccip-ZGGWQN4X.js → ccip-7RMRLAGV.js} +4 -4
- package/dist/{ccip-RPPPKTJR.js → ccip-NLCSCHKI.js} +5 -5
- package/dist/chunk-25TJPVBF.js +353 -0
- package/dist/chunk-25TJPVBF.js.map +1 -0
- package/dist/chunk-2BKS2FVE.js +93 -0
- package/dist/chunk-2BKS2FVE.js.map +1 -0
- package/dist/chunk-2QYORQBF.js +55 -0
- package/dist/chunk-2QYORQBF.js.map +1 -0
- package/dist/{chunk-ACBEHJAH.js → chunk-2U5ZVEV3.js} +14 -16
- package/dist/chunk-2U5ZVEV3.js.map +1 -0
- package/dist/{chunk-MJSXP4LW.js → chunk-3AJS6LLN.js} +11 -8
- package/dist/chunk-3AJS6LLN.js.map +1 -0
- package/dist/{chunk-OWVVI4VQ.js → chunk-3AUDA53C.js} +7650 -7361
- package/dist/chunk-3AUDA53C.js.map +1 -0
- package/dist/{chunk-MJZZTKCC.js → chunk-56MOAIP5.js} +5 -10
- package/dist/chunk-56MOAIP5.js.map +1 -0
- package/dist/{chunk-U5S527PP.js → chunk-5IEP5EGE.js} +3 -3
- package/dist/chunk-5X4SZ5BF.js +227 -0
- package/dist/chunk-5X4SZ5BF.js.map +1 -0
- package/dist/chunk-7WEQQJLG.js +68 -0
- package/dist/chunk-7WEQQJLG.js.map +1 -0
- package/dist/{chunk-7FK2UN2T.js → chunk-AWQPGIR6.js} +65 -67
- package/dist/{chunk-7FK2UN2T.js.map → chunk-AWQPGIR6.js.map} +1 -1
- package/dist/{chunk-PAOVPSP6.js → chunk-BBVUVBUO.js} +517 -138
- package/dist/chunk-BBVUVBUO.js.map +1 -0
- package/dist/{chunk-ETKZWJ4B.js → chunk-BFFM2WFK.js} +8 -8
- package/dist/chunk-BFFM2WFK.js.map +1 -0
- package/dist/{chunk-KYQVEKP5.js → chunk-BPMWXTFX.js} +8 -8
- package/dist/chunk-DMZZLPZN.js +205 -0
- package/dist/chunk-DMZZLPZN.js.map +1 -0
- package/dist/{chunk-47PP7TAG.js → chunk-EGELTSPU.js} +1356 -1356
- package/dist/chunk-EGELTSPU.js.map +1 -0
- package/dist/chunk-GULLJQXA.js +698 -0
- package/dist/chunk-GULLJQXA.js.map +1 -0
- package/dist/{chunk-S5RYMCV6.js → chunk-HPWO4O6S.js} +3 -3
- package/dist/chunk-HVRC33OL.js +174 -0
- package/dist/chunk-HVRC33OL.js.map +1 -0
- package/dist/{chunk-W6R3HAAG.js → chunk-JRGFKVAZ.js} +2 -2
- package/dist/{chunk-XJN5WUKL.js → chunk-KG3D7FIF.js} +2 -2
- package/dist/chunk-L3PVMIYQ.js +10328 -0
- package/dist/chunk-L3PVMIYQ.js.map +1 -0
- package/dist/{chunk-QW2Q2KAH.js → chunk-LHHMV4GU.js} +2 -2
- package/dist/{chunk-ZOBNS7CX.js → chunk-MEFB5KHA.js} +4 -18
- package/dist/chunk-MEFB5KHA.js.map +1 -0
- package/dist/{chunk-M2O56UK7.js → chunk-N35E6CM2.js} +293 -163
- package/dist/chunk-N35E6CM2.js.map +1 -0
- package/dist/chunk-OCBHUHWB.js +69 -0
- package/dist/chunk-OCBHUHWB.js.map +1 -0
- package/dist/chunk-OIM4HLN6.js +1405 -0
- package/dist/chunk-OIM4HLN6.js.map +1 -0
- package/dist/{chunk-PKW3H26Z.js → chunk-OJLYNM4Z.js} +56 -33
- package/dist/chunk-OJLYNM4Z.js.map +1 -0
- package/dist/{chunk-POJRB2AE.js → chunk-POUWHWID.js} +2 -2
- package/dist/chunk-PZEN5PHN.js +285 -0
- package/dist/chunk-PZEN5PHN.js.map +1 -0
- package/dist/chunk-SKAHDQH7.js +1785 -0
- package/dist/chunk-SKAHDQH7.js.map +1 -0
- package/dist/{chunk-KZAAWQNP.js → chunk-TTNESUPQ.js} +3 -3
- package/dist/{chunk-QWBUKIP2.js → chunk-U5DXNFJC.js} +23 -94
- package/dist/chunk-U5DXNFJC.js.map +1 -0
- package/dist/chunk-USS336NF.js +165 -0
- package/dist/chunk-USS336NF.js.map +1 -0
- package/dist/{chunk-UO22YNY4.js → chunk-WH7OWT6G.js} +49 -1
- package/dist/chunk-WH7OWT6G.js.map +1 -0
- package/dist/chunk-WXC57XGG.js +29 -0
- package/dist/chunk-WXC57XGG.js.map +1 -0
- package/dist/{chunk-YLYINX2H.js → chunk-XZKD7DIF.js} +3 -3
- package/dist/{chunk-7GJQ5RGA.js → chunk-YEETV6IW.js} +1077 -1039
- package/dist/chunk-YEETV6IW.js.map +1 -0
- package/dist/{chunk-B676GPS2.js → chunk-YJHHCWM3.js} +39 -16
- package/dist/chunk-YJHHCWM3.js.map +1 -0
- package/dist/{cli-U2BEUA55.js → cli-M3XCSOU6.js} +295 -349
- package/dist/cli-M3XCSOU6.js.map +1 -0
- package/dist/config-MXOX7XDR.js +41 -0
- package/dist/{dist-U4M6QCKE.js → dist-3LOO6M4U.js} +10 -10
- package/dist/doctor-LU4YIZWM.js +349 -0
- package/dist/doctor-LU4YIZWM.js.map +1 -0
- package/dist/{ethersCompat-Df4a6QIZ-WHYKB6HA.js → ethersCompat-Df4a6QIZ-THAVUGIJ.js} +5 -5
- package/dist/{chunk-3ZW7HPY5.js → fund-A54P2QFK.js} +81 -22
- package/dist/fund-A54P2QFK.js.map +1 -0
- package/dist/hook-command-U6KWPEDQ.js +377 -0
- package/dist/hook-command-U6KWPEDQ.js.map +1 -0
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/dist/install-XUM2XSHW.js +53 -0
- package/dist/install-wallet-QIOFORTX.js +105 -0
- package/dist/install-wallet-QIOFORTX.js.map +1 -0
- package/dist/{run-CJWPGMIQ.js → mcp-HJC2PLRV.js} +3725 -10661
- package/dist/mcp-HJC2PLRV.js.map +1 -0
- package/dist/paths-P2N4JTDZ.js +49 -0
- package/dist/pay-SBXZEPEP.js +37 -0
- package/dist/redact-46ZHF2NH.js +17 -0
- package/dist/{secp256k1-XRPVBC6V.js → secp256k1-ZZZT2CAX.js} +3 -3
- package/dist/{send-C5EOKXOU.js → send-ASD2ZXJD.js} +28 -30
- package/dist/send-ASD2ZXJD.js.map +1 -0
- package/dist/{chunk-NAAMHWSI.js → skill-placement-NFVHY6A3.js} +159 -12
- package/dist/skill-placement-NFVHY6A3.js.map +1 -0
- package/dist/status-T2SDB57A.js +63 -0
- package/dist/status-T2SDB57A.js.map +1 -0
- package/dist/status-line-CGPUSDMC.js +71 -0
- package/dist/status-line-CGPUSDMC.js.map +1 -0
- package/dist/status-line-wiring-BYPHTYZE.js +30 -0
- package/dist/tenjin-daemon.mjs +20060 -0
- package/dist/tenjin-shim.mjs +251 -0
- package/dist/tenjin-vitest-reporter.mjs +49 -0
- package/dist/uninstall-FKYZHAM3.js +144 -0
- package/dist/uninstall-FKYZHAM3.js.map +1 -0
- package/dist/{update-24Y2CQTT.js → update-ANJ2AOTN.js} +133 -17
- package/dist/update-ANJ2AOTN.js.map +1 -0
- package/dist/{viemAdapter-By13KInL-TUQJBMHM.js → viemAdapter-By13KInL-X2VY6CY3.js} +5 -5
- package/dist/wallet-PWAHVKWW.js +31 -0
- package/dist/wallet-kdf-worker.mjs +980 -0
- package/docs/agent-permissions.md +68 -342
- package/docs/safety-model.md +25 -6
- package/package.json +8 -7
- package/LICENSE +0 -21
- package/dist/buy-2JBYPHAI.js +0 -46
- package/dist/chunk-3P3ES4XU.js +0 -144
- package/dist/chunk-3P3ES4XU.js.map +0 -1
- package/dist/chunk-3ZW7HPY5.js.map +0 -1
- package/dist/chunk-47PP7TAG.js.map +0 -1
- package/dist/chunk-4UHNXY6B.js +0 -786
- package/dist/chunk-4UHNXY6B.js.map +0 -1
- package/dist/chunk-4Y53PDH6.js +0 -213
- package/dist/chunk-4Y53PDH6.js.map +0 -1
- package/dist/chunk-54AJIO3E.js +0 -198
- package/dist/chunk-54AJIO3E.js.map +0 -1
- package/dist/chunk-736DW4V3.js +0 -65
- package/dist/chunk-736DW4V3.js.map +0 -1
- package/dist/chunk-7GJQ5RGA.js.map +0 -1
- package/dist/chunk-7NADDA2V.js +0 -161
- package/dist/chunk-7NADDA2V.js.map +0 -1
- package/dist/chunk-ACBEHJAH.js.map +0 -1
- package/dist/chunk-B676GPS2.js.map +0 -1
- package/dist/chunk-DAZAXFSF.js +0 -1357
- package/dist/chunk-DAZAXFSF.js.map +0 -1
- package/dist/chunk-DTCXO7HS.js +0 -791
- package/dist/chunk-DTCXO7HS.js.map +0 -1
- package/dist/chunk-ETKZWJ4B.js.map +0 -1
- package/dist/chunk-FDUD3W5V.js +0 -317
- package/dist/chunk-FDUD3W5V.js.map +0 -1
- package/dist/chunk-GEHL43VE.js +0 -711
- package/dist/chunk-GEHL43VE.js.map +0 -1
- package/dist/chunk-IU2HVT3Y.js +0 -313
- package/dist/chunk-IU2HVT3Y.js.map +0 -1
- package/dist/chunk-IUQZ4Z7M.js +0 -162
- package/dist/chunk-IUQZ4Z7M.js.map +0 -1
- package/dist/chunk-IXZJ3JOO.js +0 -614
- package/dist/chunk-IXZJ3JOO.js.map +0 -1
- package/dist/chunk-J6FUAIRR.js +0 -205
- package/dist/chunk-J6FUAIRR.js.map +0 -1
- package/dist/chunk-L6G35FU5.js +0 -105
- package/dist/chunk-L6G35FU5.js.map +0 -1
- package/dist/chunk-LSWP7MU2.js +0 -290
- package/dist/chunk-LSWP7MU2.js.map +0 -1
- package/dist/chunk-M2O56UK7.js.map +0 -1
- package/dist/chunk-MJSXP4LW.js.map +0 -1
- package/dist/chunk-MJZZTKCC.js.map +0 -1
- package/dist/chunk-NAAMHWSI.js.map +0 -1
- package/dist/chunk-O75FOHXS.js +0 -372
- package/dist/chunk-O75FOHXS.js.map +0 -1
- package/dist/chunk-OWVVI4VQ.js.map +0 -1
- package/dist/chunk-PAOVPSP6.js.map +0 -1
- package/dist/chunk-PCX2JQ2J.js +0 -233
- package/dist/chunk-PCX2JQ2J.js.map +0 -1
- package/dist/chunk-PKW3H26Z.js.map +0 -1
- package/dist/chunk-PQZVDCCA.js +0 -125
- package/dist/chunk-PQZVDCCA.js.map +0 -1
- package/dist/chunk-QWBUKIP2.js.map +0 -1
- package/dist/chunk-SGK2B724.js +0 -67
- package/dist/chunk-SGK2B724.js.map +0 -1
- package/dist/chunk-UHTVXQ2O.js +0 -140
- package/dist/chunk-UHTVXQ2O.js.map +0 -1
- package/dist/chunk-UO22YNY4.js.map +0 -1
- package/dist/chunk-VEAERJVJ.js +0 -43
- package/dist/chunk-VEAERJVJ.js.map +0 -1
- package/dist/chunk-VRPLZERE.js +0 -1421
- package/dist/chunk-VRPLZERE.js.map +0 -1
- package/dist/chunk-W4VW5XYB.js +0 -149
- package/dist/chunk-W4VW5XYB.js.map +0 -1
- package/dist/chunk-WU5CZPLD.js +0 -145
- package/dist/chunk-WU5CZPLD.js.map +0 -1
- package/dist/chunk-WYLMJQVH.js +0 -240
- package/dist/chunk-WYLMJQVH.js.map +0 -1
- package/dist/chunk-XGZ5EVMB.js +0 -35
- package/dist/chunk-XGZ5EVMB.js.map +0 -1
- package/dist/chunk-XVPQGCH4.js +0 -176
- package/dist/chunk-XVPQGCH4.js.map +0 -1
- package/dist/chunk-ZOBNS7CX.js.map +0 -1
- package/dist/chunk-ZQIQ55KK.js +0 -51
- package/dist/chunk-ZQIQ55KK.js.map +0 -1
- package/dist/cli-U2BEUA55.js.map +0 -1
- package/dist/config-CNUIX23Q.js +0 -32
- package/dist/doctor-QJJXRWTO.js +0 -31
- package/dist/edit-HJ44P44P.js +0 -40
- package/dist/fund-Y5IAHZ5D.js +0 -40
- package/dist/inspect-NFQ6SQQQ.js +0 -37
- package/dist/install-DXX7PVUP.js +0 -854
- package/dist/install-DXX7PVUP.js.map +0 -1
- package/dist/outcome-ANV4QIED.js +0 -24
- package/dist/publish-PCBTCXCZ.js +0 -42
- package/dist/read-W7QVRBVD.js +0 -160
- package/dist/read-W7QVRBVD.js.map +0 -1
- package/dist/run-CJWPGMIQ.js.map +0 -1
- package/dist/search-JGAVKTYJ.js +0 -25
- package/dist/secp256k1-XRPVBC6V.js.map +0 -1
- package/dist/send-C5EOKXOU.js.map +0 -1
- package/dist/session-OBCUUIFX.js +0 -89
- package/dist/session-OBCUUIFX.js.map +0 -1
- package/dist/skill-heal-D6EPLPS6.js +0 -84
- package/dist/skill-heal-D6EPLPS6.js.map +0 -1
- package/dist/uninstall-OWJNJ5LI.js +0 -73
- package/dist/uninstall-OWJNJ5LI.js.map +0 -1
- package/dist/update-24Y2CQTT.js.map +0 -1
- package/dist/usdc-4VCDHFWX.js +0 -38
- package/dist/usdc-4VCDHFWX.js.map +0 -1
- package/dist/viemAdapter-By13KInL-TUQJBMHM.js.map +0 -1
- package/dist/wallet-OFXDIIGP.js +0 -33
- package/dist/wallet-OFXDIIGP.js.map +0 -1
- package/dist/wallet-SLRIYJ2U.js +0 -42
- package/dist/wallet-SLRIYJ2U.js.map +0 -1
- package/docs/command-reference.md +0 -261
- package/skills/tenjin/SKILL.md +0 -364
- package/skills/tenjin-publish/SKILL.md +0 -224
- package/skills/tenjin-publish/references/maintain.md +0 -39
- package/skills/tenjin-search/SKILL.md +0 -149
- package/skills/tenjin-search/references/permissions.md +0 -106
- /package/dist/{_esm-N4KAVXQR.js.map → _esm-CE7KNONL.js.map} +0 -0
- /package/dist/{buy-2JBYPHAI.js.map → ccip-7RMRLAGV.js.map} +0 -0
- /package/dist/{ccip-RPPPKTJR.js.map → ccip-NLCSCHKI.js.map} +0 -0
- /package/dist/{chunk-U5S527PP.js.map → chunk-5IEP5EGE.js.map} +0 -0
- /package/dist/{chunk-KYQVEKP5.js.map → chunk-BPMWXTFX.js.map} +0 -0
- /package/dist/{chunk-S5RYMCV6.js.map → chunk-HPWO4O6S.js.map} +0 -0
- /package/dist/{chunk-W6R3HAAG.js.map → chunk-JRGFKVAZ.js.map} +0 -0
- /package/dist/{chunk-XJN5WUKL.js.map → chunk-KG3D7FIF.js.map} +0 -0
- /package/dist/{chunk-QW2Q2KAH.js.map → chunk-LHHMV4GU.js.map} +0 -0
- /package/dist/{chunk-POJRB2AE.js.map → chunk-POUWHWID.js.map} +0 -0
- /package/dist/{chunk-KZAAWQNP.js.map → chunk-TTNESUPQ.js.map} +0 -0
- /package/dist/{chunk-YLYINX2H.js.map → chunk-XZKD7DIF.js.map} +0 -0
- /package/dist/{ccip-ZGGWQN4X.js.map → config-MXOX7XDR.js.map} +0 -0
- /package/dist/{dist-U4M6QCKE.js.map → dist-3LOO6M4U.js.map} +0 -0
- /package/dist/{config-CNUIX23Q.js.map → ethersCompat-Df4a6QIZ-THAVUGIJ.js.map} +0 -0
- /package/dist/{doctor-QJJXRWTO.js.map → install-XUM2XSHW.js.map} +0 -0
- /package/dist/{edit-HJ44P44P.js.map → paths-P2N4JTDZ.js.map} +0 -0
- /package/dist/{ethersCompat-Df4a6QIZ-WHYKB6HA.js.map → pay-SBXZEPEP.js.map} +0 -0
- /package/dist/{fund-Y5IAHZ5D.js.map → redact-46ZHF2NH.js.map} +0 -0
- /package/dist/{inspect-NFQ6SQQQ.js.map → secp256k1-ZZZT2CAX.js.map} +0 -0
- /package/dist/{outcome-ANV4QIED.js.map → status-line-wiring-BYPHTYZE.js.map} +0 -0
- /package/dist/{publish-PCBTCXCZ.js.map → viemAdapter-By13KInL-X2VY6CY3.js.map} +0 -0
- /package/dist/{search-JGAVKTYJ.js.map → wallet-PWAHVKWW.js.map} +0 -0
|
@@ -1,27 +1,11 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
keccak_256
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KG3D7FIF.js";
|
|
5
5
|
import {
|
|
6
6
|
equalBytes
|
|
7
7
|
} from "./chunk-RBJPAZFI.js";
|
|
8
8
|
|
|
9
|
-
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/data/isHex.js
|
|
10
|
-
function isHex(value, { strict = true } = {}) {
|
|
11
|
-
if (!value)
|
|
12
|
-
return false;
|
|
13
|
-
if (typeof value !== "string")
|
|
14
|
-
return false;
|
|
15
|
-
return strict ? /^0x[0-9a-fA-F]*$/.test(value) : value.startsWith("0x");
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/data/size.js
|
|
19
|
-
function size(value) {
|
|
20
|
-
if (isHex(value, { strict: false }))
|
|
21
|
-
return Math.ceil((value.length - 2) / 2);
|
|
22
|
-
return value.length;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
9
|
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/errors/version.js
|
|
26
10
|
var version = "2.55.2";
|
|
27
11
|
|
|
@@ -112,442 +96,119 @@ function walk(err, fn) {
|
|
|
112
96
|
return fn ? null : err;
|
|
113
97
|
}
|
|
114
98
|
|
|
115
|
-
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
return `${abiItem.name}(${formatAbiParams(abiItem.inputs, { includeName })})`;
|
|
120
|
-
}
|
|
121
|
-
function formatAbiParams(params, { includeName = false } = {}) {
|
|
122
|
-
if (!params)
|
|
123
|
-
return "";
|
|
124
|
-
return params.map((param) => formatAbiParam(param, { includeName })).join(includeName ? ", " : ",");
|
|
125
|
-
}
|
|
126
|
-
function formatAbiParam(param, { includeName }) {
|
|
127
|
-
if (param.type.startsWith("tuple")) {
|
|
128
|
-
return `(${formatAbiParams(param.components, { includeName })})${param.type.slice("tuple".length)}`;
|
|
129
|
-
}
|
|
130
|
-
return param.type + (includeName && param.name ? ` ${param.name}` : "");
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/errors/abi.js
|
|
134
|
-
var AbiConstructorNotFoundError = class extends BaseError {
|
|
135
|
-
constructor({ docsPath }) {
|
|
136
|
-
super([
|
|
137
|
-
"A constructor was not found on the ABI.",
|
|
138
|
-
"Make sure you are using the correct ABI and that the constructor exists on it."
|
|
139
|
-
].join("\n"), {
|
|
140
|
-
docsPath,
|
|
141
|
-
name: "AbiConstructorNotFoundError"
|
|
142
|
-
});
|
|
99
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/errors/encoding.js
|
|
100
|
+
var IntegerOutOfRangeError = class extends BaseError {
|
|
101
|
+
constructor({ max, min, signed, size: size4, value }) {
|
|
102
|
+
super(`Number "${value}" is not in safe ${size4 ? `${size4 * 8}-bit ${signed ? "signed" : "unsigned"} ` : ""}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`, { name: "IntegerOutOfRangeError" });
|
|
143
103
|
}
|
|
144
104
|
};
|
|
145
|
-
var
|
|
146
|
-
constructor(
|
|
147
|
-
super(
|
|
148
|
-
|
|
149
|
-
"Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."
|
|
150
|
-
].join("\n"), {
|
|
151
|
-
docsPath,
|
|
152
|
-
name: "AbiConstructorParamsNotFoundError"
|
|
105
|
+
var InvalidBytesBooleanError = class extends BaseError {
|
|
106
|
+
constructor(bytes) {
|
|
107
|
+
super(`Bytes value "${bytes}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`, {
|
|
108
|
+
name: "InvalidBytesBooleanError"
|
|
153
109
|
});
|
|
154
110
|
}
|
|
155
111
|
};
|
|
156
|
-
var
|
|
157
|
-
constructor(
|
|
158
|
-
super(
|
|
159
|
-
`Data size of ${size4} bytes is invalid.`,
|
|
160
|
-
"Size must be in increments of 32 bytes (size % 32 === 0)."
|
|
161
|
-
].join("\n"), {
|
|
162
|
-
metaMessages: [`Data: ${data} (${size4} bytes)`],
|
|
163
|
-
name: "AbiDecodingDataSizeInvalidError"
|
|
164
|
-
});
|
|
112
|
+
var InvalidHexBooleanError = class extends BaseError {
|
|
113
|
+
constructor(hex) {
|
|
114
|
+
super(`Hex value "${hex}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`, { name: "InvalidHexBooleanError" });
|
|
165
115
|
}
|
|
166
116
|
};
|
|
167
|
-
var
|
|
168
|
-
constructor(
|
|
169
|
-
super(
|
|
170
|
-
metaMessages: [
|
|
171
|
-
`Params: (${formatAbiParams(params, { includeName: true })})`,
|
|
172
|
-
`Data: ${data} (${size4} bytes)`
|
|
173
|
-
],
|
|
174
|
-
name: "AbiDecodingDataSizeTooSmallError"
|
|
175
|
-
});
|
|
176
|
-
Object.defineProperty(this, "data", {
|
|
177
|
-
enumerable: true,
|
|
178
|
-
configurable: true,
|
|
179
|
-
writable: true,
|
|
180
|
-
value: void 0
|
|
181
|
-
});
|
|
182
|
-
Object.defineProperty(this, "params", {
|
|
183
|
-
enumerable: true,
|
|
184
|
-
configurable: true,
|
|
185
|
-
writable: true,
|
|
186
|
-
value: void 0
|
|
187
|
-
});
|
|
188
|
-
Object.defineProperty(this, "size", {
|
|
189
|
-
enumerable: true,
|
|
190
|
-
configurable: true,
|
|
191
|
-
writable: true,
|
|
192
|
-
value: void 0
|
|
193
|
-
});
|
|
194
|
-
this.data = data;
|
|
195
|
-
this.params = params;
|
|
196
|
-
this.size = size4;
|
|
117
|
+
var InvalidHexValueError = class extends BaseError {
|
|
118
|
+
constructor(value) {
|
|
119
|
+
super(`Hex value "${value}" is an odd length (${value.length}). It must be an even length.`, { name: "InvalidHexValueError" });
|
|
197
120
|
}
|
|
198
121
|
};
|
|
199
|
-
var
|
|
200
|
-
constructor({
|
|
201
|
-
super(
|
|
202
|
-
name: "
|
|
203
|
-
cause
|
|
122
|
+
var RlpDepthLimitExceededError = class extends BaseError {
|
|
123
|
+
constructor({ limit }) {
|
|
124
|
+
super(`RLP depth limit of \`${limit}\` exceeded.`, {
|
|
125
|
+
name: "RlpDepthLimitExceededError"
|
|
204
126
|
});
|
|
205
127
|
}
|
|
206
128
|
};
|
|
207
|
-
var
|
|
208
|
-
constructor({
|
|
209
|
-
super(
|
|
210
|
-
`ABI encoding array length mismatch for type ${type}.`,
|
|
211
|
-
`Expected length: ${expectedLength}`,
|
|
212
|
-
`Given length: ${givenLength}`
|
|
213
|
-
].join("\n"), { name: "AbiEncodingArrayLengthMismatchError" });
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
var AbiEncodingBytesSizeMismatchError = class extends BaseError {
|
|
217
|
-
constructor({ expectedSize, value }) {
|
|
218
|
-
super(`Size of bytes "${value}" (bytes${size(value)}) does not match expected size (bytes${expectedSize}).`, { name: "AbiEncodingBytesSizeMismatchError" });
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
var AbiEncodingLengthMismatchError = class extends BaseError {
|
|
222
|
-
constructor({ expectedLength, givenLength }) {
|
|
223
|
-
super([
|
|
224
|
-
"ABI encoding params/values length mismatch.",
|
|
225
|
-
`Expected length (params): ${expectedLength}`,
|
|
226
|
-
`Given length (values): ${givenLength}`
|
|
227
|
-
].join("\n"), { name: "AbiEncodingLengthMismatchError" });
|
|
129
|
+
var RlpListBoundaryExceededError = class extends BaseError {
|
|
130
|
+
constructor({ consumed, declared }) {
|
|
131
|
+
super(`RLP list items consumed \`${consumed}\` bytes but the list declared a length of \`${declared}\`.`, { name: "RlpListBoundaryExceededError" });
|
|
228
132
|
}
|
|
229
133
|
};
|
|
230
|
-
var
|
|
231
|
-
constructor(
|
|
232
|
-
super(
|
|
233
|
-
`Arguments (\`args\`) were provided to "${errorName}", but "${errorName}" on the ABI does not contain any parameters (\`inputs\`).`,
|
|
234
|
-
"Cannot encode error result without knowing what the parameter types are.",
|
|
235
|
-
"Make sure you are using the correct ABI and that the inputs exist on it."
|
|
236
|
-
].join("\n"), {
|
|
237
|
-
docsPath,
|
|
238
|
-
name: "AbiErrorInputsNotFoundError"
|
|
239
|
-
});
|
|
134
|
+
var RlpTrailingBytesError = class extends BaseError {
|
|
135
|
+
constructor({ count }) {
|
|
136
|
+
super(`RLP payload encodes a single item, but \`${count}\` trailing ${count === 1 ? "byte remains" : "bytes remain"}.`, { name: "RlpTrailingBytesError" });
|
|
240
137
|
}
|
|
241
138
|
};
|
|
242
|
-
var
|
|
243
|
-
constructor(
|
|
244
|
-
super(
|
|
245
|
-
`Error ${errorName ? `"${errorName}" ` : ""}not found on ABI.`,
|
|
246
|
-
"Make sure you are using the correct ABI and that the error exists on it."
|
|
247
|
-
].join("\n"), {
|
|
248
|
-
docsPath,
|
|
249
|
-
name: "AbiErrorNotFoundError"
|
|
250
|
-
});
|
|
139
|
+
var SizeOverflowError = class extends BaseError {
|
|
140
|
+
constructor({ givenSize, maxSize }) {
|
|
141
|
+
super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`, { name: "SizeOverflowError" });
|
|
251
142
|
}
|
|
252
143
|
};
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
`You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${signature}.`
|
|
259
|
-
].join("\n"), {
|
|
260
|
-
docsPath,
|
|
261
|
-
name: "AbiErrorSignatureNotFoundError",
|
|
262
|
-
cause
|
|
263
|
-
});
|
|
264
|
-
Object.defineProperty(this, "signature", {
|
|
265
|
-
enumerable: true,
|
|
266
|
-
configurable: true,
|
|
267
|
-
writable: true,
|
|
268
|
-
value: void 0
|
|
269
|
-
});
|
|
270
|
-
this.signature = signature;
|
|
144
|
+
|
|
145
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/errors/data.js
|
|
146
|
+
var SliceOffsetOutOfBoundsError = class extends BaseError {
|
|
147
|
+
constructor({ offset, position, size: size4 }) {
|
|
148
|
+
super(`Slice ${position === "start" ? "starting" : "ending"} at offset "${offset}" is out-of-bounds (size: ${size4}).`, { name: "SliceOffsetOutOfBoundsError" });
|
|
271
149
|
}
|
|
272
150
|
};
|
|
273
|
-
var
|
|
274
|
-
constructor({
|
|
275
|
-
super(
|
|
276
|
-
docsPath,
|
|
277
|
-
name: "AbiEventSignatureEmptyTopicsError"
|
|
278
|
-
});
|
|
151
|
+
var SizeExceedsPaddingSizeError = class extends BaseError {
|
|
152
|
+
constructor({ size: size4, targetSize, type }) {
|
|
153
|
+
super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (${size4}) exceeds padding size (${targetSize}).`, { name: "SizeExceedsPaddingSizeError" });
|
|
279
154
|
}
|
|
280
155
|
};
|
|
281
|
-
var
|
|
282
|
-
constructor(
|
|
283
|
-
super(
|
|
284
|
-
`Encoded event signature "${signature}" not found on ABI.`,
|
|
285
|
-
"Make sure you are using the correct ABI and that the event exists on it.",
|
|
286
|
-
`You can look up the signature here: https://4byte.sourcify.dev/?q=${signature}.`
|
|
287
|
-
].join("\n"), {
|
|
288
|
-
docsPath,
|
|
289
|
-
name: "AbiEventSignatureNotFoundError"
|
|
290
|
-
});
|
|
156
|
+
var InvalidBytesLengthError = class extends BaseError {
|
|
157
|
+
constructor({ size: size4, targetSize, type }) {
|
|
158
|
+
super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} is expected to be ${targetSize} ${type} long, but is ${size4} ${type} long.`, { name: "InvalidBytesLengthError" });
|
|
291
159
|
}
|
|
292
160
|
};
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
161
|
+
|
|
162
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/data/pad.js
|
|
163
|
+
function pad(hexOrBytes, { dir, size: size4 = 32 } = {}) {
|
|
164
|
+
if (typeof hexOrBytes === "string")
|
|
165
|
+
return padHex(hexOrBytes, { dir, size: size4 });
|
|
166
|
+
return padBytes(hexOrBytes, { dir, size: size4 });
|
|
167
|
+
}
|
|
168
|
+
function padHex(hex_, { dir, size: size4 = 32 } = {}) {
|
|
169
|
+
if (size4 === null)
|
|
170
|
+
return hex_;
|
|
171
|
+
const hex = hex_.replace("0x", "");
|
|
172
|
+
if (hex.length > size4 * 2)
|
|
173
|
+
throw new SizeExceedsPaddingSizeError({
|
|
174
|
+
size: Math.ceil(hex.length / 2),
|
|
175
|
+
targetSize: size4,
|
|
176
|
+
type: "hex"
|
|
301
177
|
});
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
178
|
+
return `0x${hex[dir === "right" ? "padEnd" : "padStart"](size4 * 2, "0")}`;
|
|
179
|
+
}
|
|
180
|
+
function padBytes(bytes, { dir, size: size4 = 32 } = {}) {
|
|
181
|
+
if (size4 === null)
|
|
182
|
+
return bytes;
|
|
183
|
+
if (bytes.length > size4)
|
|
184
|
+
throw new SizeExceedsPaddingSizeError({
|
|
185
|
+
size: bytes.length,
|
|
186
|
+
targetSize: size4,
|
|
187
|
+
type: "bytes"
|
|
312
188
|
});
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
super([
|
|
318
|
-
`Function "${functionName}" does not contain any \`outputs\` on ABI.`,
|
|
319
|
-
"Cannot decode function result without knowing what the parameter types are.",
|
|
320
|
-
"Make sure you are using the correct ABI and that the function exists on it."
|
|
321
|
-
].join("\n"), {
|
|
322
|
-
docsPath,
|
|
323
|
-
name: "AbiFunctionOutputsNotFoundError"
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
};
|
|
327
|
-
var AbiFunctionSignatureNotFoundError = class extends BaseError {
|
|
328
|
-
constructor(signature, { docsPath }) {
|
|
329
|
-
super([
|
|
330
|
-
`Encoded function signature "${signature}" not found on ABI.`,
|
|
331
|
-
"Make sure you are using the correct ABI and that the function exists on it.",
|
|
332
|
-
`You can look up the signature here: https://4byte.sourcify.dev/?q=${signature}.`
|
|
333
|
-
].join("\n"), {
|
|
334
|
-
docsPath,
|
|
335
|
-
name: "AbiFunctionSignatureNotFoundError"
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
};
|
|
339
|
-
var AbiItemAmbiguityError = class extends BaseError {
|
|
340
|
-
constructor(x, y) {
|
|
341
|
-
super("Found ambiguous types in overloaded ABI items.", {
|
|
342
|
-
metaMessages: [
|
|
343
|
-
`\`${x.type}\` in \`${formatAbiItem(x.abiItem)}\`, and`,
|
|
344
|
-
`\`${y.type}\` in \`${formatAbiItem(y.abiItem)}\``,
|
|
345
|
-
"",
|
|
346
|
-
"These types encode differently and cannot be distinguished at runtime.",
|
|
347
|
-
"Remove one of the ambiguous items in the ABI."
|
|
348
|
-
],
|
|
349
|
-
name: "AbiItemAmbiguityError"
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
};
|
|
353
|
-
var BytesSizeMismatchError = class extends BaseError {
|
|
354
|
-
constructor({ expectedSize, givenSize }) {
|
|
355
|
-
super(`Expected bytes${expectedSize}, got bytes${givenSize}.`, {
|
|
356
|
-
name: "BytesSizeMismatchError"
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
};
|
|
360
|
-
var DecodeLogDataMismatch = class extends BaseError {
|
|
361
|
-
constructor({ abiItem, data, params, size: size4 }) {
|
|
362
|
-
super([
|
|
363
|
-
`Data size of ${size4} bytes is too small for non-indexed event parameters.`
|
|
364
|
-
].join("\n"), {
|
|
365
|
-
metaMessages: [
|
|
366
|
-
`Params: (${formatAbiParams(params, { includeName: true })})`,
|
|
367
|
-
`Data: ${data} (${size4} bytes)`
|
|
368
|
-
],
|
|
369
|
-
name: "DecodeLogDataMismatch"
|
|
370
|
-
});
|
|
371
|
-
Object.defineProperty(this, "abiItem", {
|
|
372
|
-
enumerable: true,
|
|
373
|
-
configurable: true,
|
|
374
|
-
writable: true,
|
|
375
|
-
value: void 0
|
|
376
|
-
});
|
|
377
|
-
Object.defineProperty(this, "data", {
|
|
378
|
-
enumerable: true,
|
|
379
|
-
configurable: true,
|
|
380
|
-
writable: true,
|
|
381
|
-
value: void 0
|
|
382
|
-
});
|
|
383
|
-
Object.defineProperty(this, "params", {
|
|
384
|
-
enumerable: true,
|
|
385
|
-
configurable: true,
|
|
386
|
-
writable: true,
|
|
387
|
-
value: void 0
|
|
388
|
-
});
|
|
389
|
-
Object.defineProperty(this, "size", {
|
|
390
|
-
enumerable: true,
|
|
391
|
-
configurable: true,
|
|
392
|
-
writable: true,
|
|
393
|
-
value: void 0
|
|
394
|
-
});
|
|
395
|
-
this.abiItem = abiItem;
|
|
396
|
-
this.data = data;
|
|
397
|
-
this.params = params;
|
|
398
|
-
this.size = size4;
|
|
399
|
-
}
|
|
400
|
-
};
|
|
401
|
-
var DecodeLogTopicsMismatch = class extends BaseError {
|
|
402
|
-
constructor({ abiItem, param }) {
|
|
403
|
-
super([
|
|
404
|
-
`Expected a topic for indexed event parameter${param.name ? ` "${param.name}"` : ""} on event "${formatAbiItem(abiItem, { includeName: true })}".`
|
|
405
|
-
].join("\n"), { name: "DecodeLogTopicsMismatch" });
|
|
406
|
-
Object.defineProperty(this, "abiItem", {
|
|
407
|
-
enumerable: true,
|
|
408
|
-
configurable: true,
|
|
409
|
-
writable: true,
|
|
410
|
-
value: void 0
|
|
411
|
-
});
|
|
412
|
-
this.abiItem = abiItem;
|
|
413
|
-
}
|
|
414
|
-
};
|
|
415
|
-
var InvalidAbiEncodingTypeError = class extends BaseError {
|
|
416
|
-
constructor(type, { docsPath }) {
|
|
417
|
-
super([
|
|
418
|
-
`Type "${type}" is not a valid encoding type.`,
|
|
419
|
-
"Please provide a valid ABI type."
|
|
420
|
-
].join("\n"), { docsPath, name: "InvalidAbiEncodingType" });
|
|
421
|
-
}
|
|
422
|
-
};
|
|
423
|
-
var InvalidAbiDecodingTypeError = class extends BaseError {
|
|
424
|
-
constructor(type, { docsPath }) {
|
|
425
|
-
super([
|
|
426
|
-
`Type "${type}" is not a valid decoding type.`,
|
|
427
|
-
"Please provide a valid ABI type."
|
|
428
|
-
].join("\n"), { docsPath, name: "InvalidAbiDecodingType" });
|
|
429
|
-
}
|
|
430
|
-
};
|
|
431
|
-
var InvalidArrayError = class extends BaseError {
|
|
432
|
-
constructor(value) {
|
|
433
|
-
super([`Value "${value}" is not a valid array.`].join("\n"), {
|
|
434
|
-
name: "InvalidArrayError"
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
|
-
};
|
|
438
|
-
var InvalidDefinitionTypeError = class extends BaseError {
|
|
439
|
-
constructor(type) {
|
|
440
|
-
super([
|
|
441
|
-
`"${type}" is not a valid definition type.`,
|
|
442
|
-
'Valid types: "function", "event", "error"'
|
|
443
|
-
].join("\n"), { name: "InvalidDefinitionTypeError" });
|
|
444
|
-
}
|
|
445
|
-
};
|
|
446
|
-
var UnsupportedPackedAbiType = class extends BaseError {
|
|
447
|
-
constructor(type) {
|
|
448
|
-
super(`Type "${type}" is not supported for packed encoding.`, {
|
|
449
|
-
name: "UnsupportedPackedAbiType"
|
|
450
|
-
});
|
|
451
|
-
}
|
|
452
|
-
};
|
|
453
|
-
|
|
454
|
-
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/errors/data.js
|
|
455
|
-
var SliceOffsetOutOfBoundsError = class extends BaseError {
|
|
456
|
-
constructor({ offset, position, size: size4 }) {
|
|
457
|
-
super(`Slice ${position === "start" ? "starting" : "ending"} at offset "${offset}" is out-of-bounds (size: ${size4}).`, { name: "SliceOffsetOutOfBoundsError" });
|
|
458
|
-
}
|
|
459
|
-
};
|
|
460
|
-
var SizeExceedsPaddingSizeError = class extends BaseError {
|
|
461
|
-
constructor({ size: size4, targetSize, type }) {
|
|
462
|
-
super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (${size4}) exceeds padding size (${targetSize}).`, { name: "SizeExceedsPaddingSizeError" });
|
|
463
|
-
}
|
|
464
|
-
};
|
|
465
|
-
var InvalidBytesLengthError = class extends BaseError {
|
|
466
|
-
constructor({ size: size4, targetSize, type }) {
|
|
467
|
-
super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} is expected to be ${targetSize} ${type} long, but is ${size4} ${type} long.`, { name: "InvalidBytesLengthError" });
|
|
468
|
-
}
|
|
469
|
-
};
|
|
470
|
-
|
|
471
|
-
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/data/pad.js
|
|
472
|
-
function pad(hexOrBytes, { dir, size: size4 = 32 } = {}) {
|
|
473
|
-
if (typeof hexOrBytes === "string")
|
|
474
|
-
return padHex(hexOrBytes, { dir, size: size4 });
|
|
475
|
-
return padBytes(hexOrBytes, { dir, size: size4 });
|
|
476
|
-
}
|
|
477
|
-
function padHex(hex_, { dir, size: size4 = 32 } = {}) {
|
|
478
|
-
if (size4 === null)
|
|
479
|
-
return hex_;
|
|
480
|
-
const hex = hex_.replace("0x", "");
|
|
481
|
-
if (hex.length > size4 * 2)
|
|
482
|
-
throw new SizeExceedsPaddingSizeError({
|
|
483
|
-
size: Math.ceil(hex.length / 2),
|
|
484
|
-
targetSize: size4,
|
|
485
|
-
type: "hex"
|
|
486
|
-
});
|
|
487
|
-
return `0x${hex[dir === "right" ? "padEnd" : "padStart"](size4 * 2, "0")}`;
|
|
488
|
-
}
|
|
489
|
-
function padBytes(bytes, { dir, size: size4 = 32 } = {}) {
|
|
490
|
-
if (size4 === null)
|
|
491
|
-
return bytes;
|
|
492
|
-
if (bytes.length > size4)
|
|
493
|
-
throw new SizeExceedsPaddingSizeError({
|
|
494
|
-
size: bytes.length,
|
|
495
|
-
targetSize: size4,
|
|
496
|
-
type: "bytes"
|
|
497
|
-
});
|
|
498
|
-
const paddedBytes = new Uint8Array(size4);
|
|
499
|
-
for (let i = 0; i < size4; i++) {
|
|
500
|
-
const padEnd = dir === "right";
|
|
501
|
-
paddedBytes[padEnd ? i : size4 - i - 1] = bytes[padEnd ? i : bytes.length - i - 1];
|
|
189
|
+
const paddedBytes = new Uint8Array(size4);
|
|
190
|
+
for (let i = 0; i < size4; i++) {
|
|
191
|
+
const padEnd = dir === "right";
|
|
192
|
+
paddedBytes[padEnd ? i : size4 - i - 1] = bytes[padEnd ? i : bytes.length - i - 1];
|
|
502
193
|
}
|
|
503
194
|
return paddedBytes;
|
|
504
195
|
}
|
|
505
196
|
|
|
506
|
-
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
super(`Hex value "${hex}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`, { name: "InvalidHexBooleanError" });
|
|
522
|
-
}
|
|
523
|
-
};
|
|
524
|
-
var InvalidHexValueError = class extends BaseError {
|
|
525
|
-
constructor(value) {
|
|
526
|
-
super(`Hex value "${value}" is an odd length (${value.length}). It must be an even length.`, { name: "InvalidHexValueError" });
|
|
527
|
-
}
|
|
528
|
-
};
|
|
529
|
-
var RlpDepthLimitExceededError = class extends BaseError {
|
|
530
|
-
constructor({ limit }) {
|
|
531
|
-
super(`RLP depth limit of \`${limit}\` exceeded.`, {
|
|
532
|
-
name: "RlpDepthLimitExceededError"
|
|
533
|
-
});
|
|
534
|
-
}
|
|
535
|
-
};
|
|
536
|
-
var RlpListBoundaryExceededError = class extends BaseError {
|
|
537
|
-
constructor({ consumed, declared }) {
|
|
538
|
-
super(`RLP list items consumed \`${consumed}\` bytes but the list declared a length of \`${declared}\`.`, { name: "RlpListBoundaryExceededError" });
|
|
539
|
-
}
|
|
540
|
-
};
|
|
541
|
-
var RlpTrailingBytesError = class extends BaseError {
|
|
542
|
-
constructor({ count }) {
|
|
543
|
-
super(`RLP payload encodes a single item, but \`${count}\` trailing ${count === 1 ? "byte remains" : "bytes remain"}.`, { name: "RlpTrailingBytesError" });
|
|
544
|
-
}
|
|
545
|
-
};
|
|
546
|
-
var SizeOverflowError = class extends BaseError {
|
|
547
|
-
constructor({ givenSize, maxSize }) {
|
|
548
|
-
super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`, { name: "SizeOverflowError" });
|
|
549
|
-
}
|
|
550
|
-
};
|
|
197
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/data/isHex.js
|
|
198
|
+
function isHex(value, { strict = true } = {}) {
|
|
199
|
+
if (!value)
|
|
200
|
+
return false;
|
|
201
|
+
if (typeof value !== "string")
|
|
202
|
+
return false;
|
|
203
|
+
return strict ? /^0x[0-9a-fA-F]*$/.test(value) : value.startsWith("0x");
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/data/size.js
|
|
207
|
+
function size(value) {
|
|
208
|
+
if (isHex(value, { strict: false }))
|
|
209
|
+
return Math.ceil((value.length - 2) / 2);
|
|
210
|
+
return value.length;
|
|
211
|
+
}
|
|
551
212
|
|
|
552
213
|
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/data/trim.js
|
|
553
214
|
function trim(hexOrBytes, { dir = "left" } = {}) {
|
|
@@ -568,13 +229,81 @@ function trim(hexOrBytes, { dir = "left" } = {}) {
|
|
|
568
229
|
return data;
|
|
569
230
|
}
|
|
570
231
|
|
|
571
|
-
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/encoding/
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
232
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/encoding/fromHex.js
|
|
233
|
+
function assertSize(hexOrBytes, { size: size4 }) {
|
|
234
|
+
if (size(hexOrBytes) > size4)
|
|
235
|
+
throw new SizeOverflowError({
|
|
236
|
+
givenSize: size(hexOrBytes),
|
|
237
|
+
maxSize: size4
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
function fromHex(hex, toOrOpts) {
|
|
241
|
+
const opts = typeof toOrOpts === "string" ? { to: toOrOpts } : toOrOpts;
|
|
242
|
+
const to = opts.to;
|
|
243
|
+
if (to === "number")
|
|
244
|
+
return hexToNumber(hex, opts);
|
|
245
|
+
if (to === "bigint")
|
|
246
|
+
return hexToBigInt(hex, opts);
|
|
247
|
+
if (to === "string")
|
|
248
|
+
return hexToString(hex, opts);
|
|
249
|
+
if (to === "boolean")
|
|
250
|
+
return hexToBool(hex, opts);
|
|
251
|
+
return hexToBytes(hex, opts);
|
|
252
|
+
}
|
|
253
|
+
function hexToBigInt(hex, opts = {}) {
|
|
254
|
+
const { signed } = opts;
|
|
255
|
+
if (opts.size)
|
|
256
|
+
assertSize(hex, { size: opts.size });
|
|
257
|
+
const value = BigInt(hex);
|
|
258
|
+
if (!signed)
|
|
259
|
+
return value;
|
|
260
|
+
const size4 = (hex.length - 2) / 2;
|
|
261
|
+
const max = (1n << BigInt(size4) * 8n - 1n) - 1n;
|
|
262
|
+
if (value <= max)
|
|
263
|
+
return value;
|
|
264
|
+
return value - BigInt(`0x${"f".padStart(size4 * 2, "f")}`) - 1n;
|
|
265
|
+
}
|
|
266
|
+
function hexToBool(hex_, opts = {}) {
|
|
267
|
+
let hex = hex_;
|
|
268
|
+
if (opts.size) {
|
|
269
|
+
assertSize(hex, { size: opts.size });
|
|
270
|
+
hex = trim(hex);
|
|
271
|
+
}
|
|
272
|
+
if (trim(hex) === "0x00")
|
|
273
|
+
return false;
|
|
274
|
+
if (trim(hex) === "0x01")
|
|
275
|
+
return true;
|
|
276
|
+
throw new InvalidHexBooleanError(hex);
|
|
277
|
+
}
|
|
278
|
+
function hexToNumber(hex, opts = {}) {
|
|
279
|
+
const value = hexToBigInt(hex, opts);
|
|
280
|
+
const number = Number(value);
|
|
281
|
+
if (!Number.isSafeInteger(number))
|
|
282
|
+
throw new IntegerOutOfRangeError({
|
|
283
|
+
max: `${Number.MAX_SAFE_INTEGER}`,
|
|
284
|
+
min: `${Number.MIN_SAFE_INTEGER}`,
|
|
285
|
+
signed: opts.signed,
|
|
286
|
+
size: opts.size,
|
|
287
|
+
value: `${value}n`
|
|
288
|
+
});
|
|
289
|
+
return number;
|
|
290
|
+
}
|
|
291
|
+
function hexToString(hex, opts = {}) {
|
|
292
|
+
let bytes = hexToBytes(hex);
|
|
293
|
+
if (opts.size) {
|
|
294
|
+
assertSize(bytes, { size: opts.size });
|
|
295
|
+
bytes = trim(bytes, { dir: "right" });
|
|
296
|
+
}
|
|
297
|
+
return new TextDecoder().decode(bytes);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/encoding/toHex.js
|
|
301
|
+
var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0"));
|
|
302
|
+
function toHex(value, opts = {}) {
|
|
303
|
+
if (typeof value === "number" || typeof value === "bigint")
|
|
304
|
+
return numberToHex(value, opts);
|
|
305
|
+
if (typeof value === "string") {
|
|
306
|
+
return stringToHex(value, opts);
|
|
578
307
|
}
|
|
579
308
|
if (typeof value === "boolean")
|
|
580
309
|
return boolToHex(value, opts);
|
|
@@ -705,83 +434,6 @@ function stringToBytes(value, opts = {}) {
|
|
|
705
434
|
return bytes;
|
|
706
435
|
}
|
|
707
436
|
|
|
708
|
-
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/encoding/fromHex.js
|
|
709
|
-
function assertSize(hexOrBytes, { size: size4 }) {
|
|
710
|
-
if (size(hexOrBytes) > size4)
|
|
711
|
-
throw new SizeOverflowError({
|
|
712
|
-
givenSize: size(hexOrBytes),
|
|
713
|
-
maxSize: size4
|
|
714
|
-
});
|
|
715
|
-
}
|
|
716
|
-
function fromHex(hex, toOrOpts) {
|
|
717
|
-
const opts = typeof toOrOpts === "string" ? { to: toOrOpts } : toOrOpts;
|
|
718
|
-
const to = opts.to;
|
|
719
|
-
if (to === "number")
|
|
720
|
-
return hexToNumber(hex, opts);
|
|
721
|
-
if (to === "bigint")
|
|
722
|
-
return hexToBigInt(hex, opts);
|
|
723
|
-
if (to === "string")
|
|
724
|
-
return hexToString(hex, opts);
|
|
725
|
-
if (to === "boolean")
|
|
726
|
-
return hexToBool(hex, opts);
|
|
727
|
-
return hexToBytes(hex, opts);
|
|
728
|
-
}
|
|
729
|
-
function hexToBigInt(hex, opts = {}) {
|
|
730
|
-
const { signed } = opts;
|
|
731
|
-
if (opts.size)
|
|
732
|
-
assertSize(hex, { size: opts.size });
|
|
733
|
-
const value = BigInt(hex);
|
|
734
|
-
if (!signed)
|
|
735
|
-
return value;
|
|
736
|
-
const size4 = (hex.length - 2) / 2;
|
|
737
|
-
const max = (1n << BigInt(size4) * 8n - 1n) - 1n;
|
|
738
|
-
if (value <= max)
|
|
739
|
-
return value;
|
|
740
|
-
return value - BigInt(`0x${"f".padStart(size4 * 2, "f")}`) - 1n;
|
|
741
|
-
}
|
|
742
|
-
function hexToBool(hex_, opts = {}) {
|
|
743
|
-
let hex = hex_;
|
|
744
|
-
if (opts.size) {
|
|
745
|
-
assertSize(hex, { size: opts.size });
|
|
746
|
-
hex = trim(hex);
|
|
747
|
-
}
|
|
748
|
-
if (trim(hex) === "0x00")
|
|
749
|
-
return false;
|
|
750
|
-
if (trim(hex) === "0x01")
|
|
751
|
-
return true;
|
|
752
|
-
throw new InvalidHexBooleanError(hex);
|
|
753
|
-
}
|
|
754
|
-
function hexToNumber(hex, opts = {}) {
|
|
755
|
-
const value = hexToBigInt(hex, opts);
|
|
756
|
-
const number = Number(value);
|
|
757
|
-
if (!Number.isSafeInteger(number))
|
|
758
|
-
throw new IntegerOutOfRangeError({
|
|
759
|
-
max: `${Number.MAX_SAFE_INTEGER}`,
|
|
760
|
-
min: `${Number.MIN_SAFE_INTEGER}`,
|
|
761
|
-
signed: opts.signed,
|
|
762
|
-
size: opts.size,
|
|
763
|
-
value: `${value}n`
|
|
764
|
-
});
|
|
765
|
-
return number;
|
|
766
|
-
}
|
|
767
|
-
function hexToString(hex, opts = {}) {
|
|
768
|
-
let bytes = hexToBytes(hex);
|
|
769
|
-
if (opts.size) {
|
|
770
|
-
assertSize(bytes, { size: opts.size });
|
|
771
|
-
bytes = trim(bytes, { dir: "right" });
|
|
772
|
-
}
|
|
773
|
-
return new TextDecoder().decode(bytes);
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/hash/keccak256.js
|
|
777
|
-
function keccak256(value, to_) {
|
|
778
|
-
const to = to_ || "hex";
|
|
779
|
-
const bytes = keccak_256(isHex(value, { strict: false }) ? toBytes(value) : value);
|
|
780
|
-
if (to === "bytes")
|
|
781
|
-
return bytes;
|
|
782
|
-
return toHex(bytes);
|
|
783
|
-
}
|
|
784
|
-
|
|
785
437
|
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/errors/address.js
|
|
786
438
|
var InvalidAddressError = class extends BaseError {
|
|
787
439
|
constructor({ address }) {
|
|
@@ -795,6 +447,15 @@ var InvalidAddressError = class extends BaseError {
|
|
|
795
447
|
}
|
|
796
448
|
};
|
|
797
449
|
|
|
450
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/hash/keccak256.js
|
|
451
|
+
function keccak256(value, to_) {
|
|
452
|
+
const to = to_ || "hex";
|
|
453
|
+
const bytes = keccak_256(isHex(value, { strict: false }) ? toBytes(value) : value);
|
|
454
|
+
if (to === "bytes")
|
|
455
|
+
return bytes;
|
|
456
|
+
return toHex(bytes);
|
|
457
|
+
}
|
|
458
|
+
|
|
798
459
|
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/lru.js
|
|
799
460
|
var LruMap = class extends Map {
|
|
800
461
|
constructor(size4) {
|
|
@@ -898,325 +559,43 @@ function concatHex(values) {
|
|
|
898
559
|
return `0x${values.reduce((acc, x) => acc + x.replace("0x", ""), "")}`;
|
|
899
560
|
}
|
|
900
561
|
|
|
901
|
-
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
}
|
|
928
|
-
function sliceBytes(value_, start, end, { strict } = {}) {
|
|
929
|
-
assertStartOffset(value_, start);
|
|
930
|
-
const value = value_.slice(start, end);
|
|
931
|
-
if (strict)
|
|
932
|
-
assertEndOffset(value, start, end);
|
|
933
|
-
return value;
|
|
934
|
-
}
|
|
935
|
-
function sliceHex(value_, start, end, { strict } = {}) {
|
|
936
|
-
assertStartOffset(value_, start);
|
|
937
|
-
const value = `0x${value_.replace("0x", "").slice((start ?? 0) * 2, (end ?? value_.length) * 2)}`;
|
|
938
|
-
if (strict)
|
|
939
|
-
assertEndOffset(value, start, end);
|
|
940
|
-
return value;
|
|
562
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/constants/unit.js
|
|
563
|
+
var etherUnits = {
|
|
564
|
+
gwei: 9,
|
|
565
|
+
wei: 18
|
|
566
|
+
};
|
|
567
|
+
var gweiUnits = {
|
|
568
|
+
ether: -9,
|
|
569
|
+
wei: 9
|
|
570
|
+
};
|
|
571
|
+
var weiUnits = {
|
|
572
|
+
ether: -18,
|
|
573
|
+
gwei: -9
|
|
574
|
+
};
|
|
575
|
+
|
|
576
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/unit/formatUnits.js
|
|
577
|
+
function formatUnits(value, decimals) {
|
|
578
|
+
let display = value.toString();
|
|
579
|
+
const negative = display.startsWith("-");
|
|
580
|
+
if (negative)
|
|
581
|
+
display = display.slice(1);
|
|
582
|
+
display = display.padStart(decimals, "0");
|
|
583
|
+
let [integer, fraction] = [
|
|
584
|
+
display.slice(0, display.length - decimals),
|
|
585
|
+
display.slice(display.length - decimals)
|
|
586
|
+
];
|
|
587
|
+
fraction = fraction.replace(/(0+)$/, "");
|
|
588
|
+
return `${negative ? "-" : ""}${integer || "0"}${fraction ? `.${fraction}` : ""}`;
|
|
941
589
|
}
|
|
942
590
|
|
|
943
|
-
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
591
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/unit/formatEther.js
|
|
592
|
+
function formatEther(wei, unit = "wei") {
|
|
593
|
+
return formatUnits(wei, etherUnits[unit]);
|
|
594
|
+
}
|
|
947
595
|
|
|
948
|
-
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/
|
|
949
|
-
function
|
|
950
|
-
|
|
951
|
-
throw new AbiEncodingLengthMismatchError({
|
|
952
|
-
expectedLength: params.length,
|
|
953
|
-
givenLength: values.length
|
|
954
|
-
});
|
|
955
|
-
const preparedParams = prepareParams({
|
|
956
|
-
params,
|
|
957
|
-
values
|
|
958
|
-
});
|
|
959
|
-
return encodeParams(preparedParams);
|
|
960
|
-
}
|
|
961
|
-
function prepareParams({ params, values }) {
|
|
962
|
-
const preparedParams = [];
|
|
963
|
-
for (let i = 0; i < params.length; i++) {
|
|
964
|
-
preparedParams.push(prepareParam({ param: params[i], value: values[i] }));
|
|
965
|
-
}
|
|
966
|
-
return preparedParams;
|
|
967
|
-
}
|
|
968
|
-
function prepareParam({ param, value }) {
|
|
969
|
-
const arrayComponents = getArrayComponents(param.type);
|
|
970
|
-
if (arrayComponents) {
|
|
971
|
-
const [length, type] = arrayComponents;
|
|
972
|
-
return encodeArray(value, { length, param: { ...param, type } });
|
|
973
|
-
}
|
|
974
|
-
if (param.type === "tuple") {
|
|
975
|
-
return encodeTuple(value, {
|
|
976
|
-
param
|
|
977
|
-
});
|
|
978
|
-
}
|
|
979
|
-
if (param.type === "address") {
|
|
980
|
-
return encodeAddress(value);
|
|
981
|
-
}
|
|
982
|
-
if (param.type === "bool") {
|
|
983
|
-
return encodeBool(value);
|
|
984
|
-
}
|
|
985
|
-
if (param.type.startsWith("uint") || param.type.startsWith("int")) {
|
|
986
|
-
const signed = param.type.startsWith("int");
|
|
987
|
-
const [, , size4 = "256"] = integerRegex.exec(param.type) ?? [];
|
|
988
|
-
return encodeNumber(value, {
|
|
989
|
-
signed,
|
|
990
|
-
size: Number(size4)
|
|
991
|
-
});
|
|
992
|
-
}
|
|
993
|
-
if (param.type.startsWith("bytes")) {
|
|
994
|
-
return encodeBytes(value, { param });
|
|
995
|
-
}
|
|
996
|
-
if (param.type === "string") {
|
|
997
|
-
return encodeString(value);
|
|
998
|
-
}
|
|
999
|
-
throw new InvalidAbiEncodingTypeError(param.type, {
|
|
1000
|
-
docsPath: "/docs/contract/encodeAbiParameters"
|
|
1001
|
-
});
|
|
1002
|
-
}
|
|
1003
|
-
function encodeParams(preparedParams) {
|
|
1004
|
-
let staticSize = 0;
|
|
1005
|
-
for (let i = 0; i < preparedParams.length; i++) {
|
|
1006
|
-
const { dynamic, encoded } = preparedParams[i];
|
|
1007
|
-
if (dynamic)
|
|
1008
|
-
staticSize += 32;
|
|
1009
|
-
else
|
|
1010
|
-
staticSize += size(encoded);
|
|
1011
|
-
}
|
|
1012
|
-
const staticParams = [];
|
|
1013
|
-
const dynamicParams = [];
|
|
1014
|
-
let dynamicSize = 0;
|
|
1015
|
-
for (let i = 0; i < preparedParams.length; i++) {
|
|
1016
|
-
const { dynamic, encoded } = preparedParams[i];
|
|
1017
|
-
if (dynamic) {
|
|
1018
|
-
staticParams.push(numberToHex(staticSize + dynamicSize, { size: 32 }));
|
|
1019
|
-
dynamicParams.push(encoded);
|
|
1020
|
-
dynamicSize += size(encoded);
|
|
1021
|
-
} else {
|
|
1022
|
-
staticParams.push(encoded);
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
return concatHex([...staticParams, ...dynamicParams]);
|
|
1026
|
-
}
|
|
1027
|
-
function encodeAddress(value) {
|
|
1028
|
-
if (!isAddress(value))
|
|
1029
|
-
throw new InvalidAddressError({ address: value });
|
|
1030
|
-
return { dynamic: false, encoded: padHex(value.toLowerCase()) };
|
|
1031
|
-
}
|
|
1032
|
-
function encodeArray(value, { length, param }) {
|
|
1033
|
-
const dynamic = length === null;
|
|
1034
|
-
if (!Array.isArray(value))
|
|
1035
|
-
throw new InvalidArrayError(value);
|
|
1036
|
-
if (!dynamic && value.length !== length)
|
|
1037
|
-
throw new AbiEncodingArrayLengthMismatchError({
|
|
1038
|
-
expectedLength: length,
|
|
1039
|
-
givenLength: value.length,
|
|
1040
|
-
type: `${param.type}[${length}]`
|
|
1041
|
-
});
|
|
1042
|
-
let dynamicChild = value.length === 0 && isDynamicType(param);
|
|
1043
|
-
const preparedParams = [];
|
|
1044
|
-
for (let i = 0; i < value.length; i++) {
|
|
1045
|
-
const preparedParam = prepareParam({ param, value: value[i] });
|
|
1046
|
-
if (preparedParam.dynamic)
|
|
1047
|
-
dynamicChild = true;
|
|
1048
|
-
preparedParams.push(preparedParam);
|
|
1049
|
-
}
|
|
1050
|
-
if (dynamic || dynamicChild) {
|
|
1051
|
-
const data = encodeParams(preparedParams);
|
|
1052
|
-
if (dynamic) {
|
|
1053
|
-
const length2 = numberToHex(preparedParams.length, { size: 32 });
|
|
1054
|
-
return {
|
|
1055
|
-
dynamic: true,
|
|
1056
|
-
encoded: concatHex([length2, data])
|
|
1057
|
-
};
|
|
1058
|
-
}
|
|
1059
|
-
if (dynamicChild)
|
|
1060
|
-
return { dynamic: true, encoded: data };
|
|
1061
|
-
}
|
|
1062
|
-
return {
|
|
1063
|
-
dynamic: false,
|
|
1064
|
-
encoded: concatHex(preparedParams.map(({ encoded }) => encoded))
|
|
1065
|
-
};
|
|
1066
|
-
}
|
|
1067
|
-
function encodeBytes(value, { param }) {
|
|
1068
|
-
const [, paramSize] = param.type.split("bytes");
|
|
1069
|
-
const bytesSize = size(value);
|
|
1070
|
-
if (!paramSize) {
|
|
1071
|
-
let value_ = value;
|
|
1072
|
-
if (bytesSize % 32 !== 0)
|
|
1073
|
-
value_ = padHex(value_, {
|
|
1074
|
-
dir: "right",
|
|
1075
|
-
size: Math.ceil((value.length - 2) / 2 / 32) * 32
|
|
1076
|
-
});
|
|
1077
|
-
return {
|
|
1078
|
-
dynamic: true,
|
|
1079
|
-
encoded: concatHex([
|
|
1080
|
-
padHex(numberToHex(bytesSize, { size: 32 })),
|
|
1081
|
-
value_
|
|
1082
|
-
])
|
|
1083
|
-
};
|
|
1084
|
-
}
|
|
1085
|
-
if (bytesSize !== Number.parseInt(paramSize, 10))
|
|
1086
|
-
throw new AbiEncodingBytesSizeMismatchError({
|
|
1087
|
-
expectedSize: Number.parseInt(paramSize, 10),
|
|
1088
|
-
value
|
|
1089
|
-
});
|
|
1090
|
-
return { dynamic: false, encoded: padHex(value, { dir: "right" }) };
|
|
1091
|
-
}
|
|
1092
|
-
function encodeBool(value) {
|
|
1093
|
-
if (typeof value !== "boolean")
|
|
1094
|
-
throw new BaseError(`Invalid boolean value: "${value}" (type: ${typeof value}). Expected: \`true\` or \`false\`.`);
|
|
1095
|
-
return { dynamic: false, encoded: padHex(boolToHex(value)) };
|
|
1096
|
-
}
|
|
1097
|
-
function encodeNumber(value, { signed, size: size4 = 256 }) {
|
|
1098
|
-
if (typeof size4 === "number") {
|
|
1099
|
-
const max = 2n ** (BigInt(size4) - (signed ? 1n : 0n)) - 1n;
|
|
1100
|
-
const min = signed ? -max - 1n : 0n;
|
|
1101
|
-
if (value > max || value < min)
|
|
1102
|
-
throw new IntegerOutOfRangeError({
|
|
1103
|
-
max: max.toString(),
|
|
1104
|
-
min: min.toString(),
|
|
1105
|
-
signed,
|
|
1106
|
-
size: size4 / 8,
|
|
1107
|
-
value: value.toString()
|
|
1108
|
-
});
|
|
1109
|
-
}
|
|
1110
|
-
return {
|
|
1111
|
-
dynamic: false,
|
|
1112
|
-
encoded: numberToHex(value, {
|
|
1113
|
-
size: 32,
|
|
1114
|
-
signed
|
|
1115
|
-
})
|
|
1116
|
-
};
|
|
1117
|
-
}
|
|
1118
|
-
function encodeString(value) {
|
|
1119
|
-
const hexValue = stringToHex(value);
|
|
1120
|
-
const partsLength = Math.ceil(size(hexValue) / 32);
|
|
1121
|
-
const parts = [];
|
|
1122
|
-
for (let i = 0; i < partsLength; i++) {
|
|
1123
|
-
parts.push(padHex(slice(hexValue, i * 32, (i + 1) * 32), {
|
|
1124
|
-
dir: "right"
|
|
1125
|
-
}));
|
|
1126
|
-
}
|
|
1127
|
-
return {
|
|
1128
|
-
dynamic: true,
|
|
1129
|
-
encoded: concatHex([
|
|
1130
|
-
padHex(numberToHex(size(hexValue), { size: 32 })),
|
|
1131
|
-
...parts
|
|
1132
|
-
])
|
|
1133
|
-
};
|
|
1134
|
-
}
|
|
1135
|
-
function encodeTuple(value, { param }) {
|
|
1136
|
-
let dynamic = false;
|
|
1137
|
-
const preparedParams = [];
|
|
1138
|
-
for (let i = 0; i < param.components.length; i++) {
|
|
1139
|
-
const param_ = param.components[i];
|
|
1140
|
-
const index = Array.isArray(value) ? i : param_.name;
|
|
1141
|
-
const preparedParam = prepareParam({
|
|
1142
|
-
param: param_,
|
|
1143
|
-
value: value[index]
|
|
1144
|
-
});
|
|
1145
|
-
preparedParams.push(preparedParam);
|
|
1146
|
-
if (preparedParam.dynamic)
|
|
1147
|
-
dynamic = true;
|
|
1148
|
-
}
|
|
1149
|
-
return {
|
|
1150
|
-
dynamic,
|
|
1151
|
-
encoded: dynamic ? encodeParams(preparedParams) : concatHex(preparedParams.map(({ encoded }) => encoded))
|
|
1152
|
-
};
|
|
1153
|
-
}
|
|
1154
|
-
function getArrayComponents(type) {
|
|
1155
|
-
const matches = type.match(/^(.*)\[(\d+)?\]$/);
|
|
1156
|
-
return matches ? (
|
|
1157
|
-
// Return `null` if the array is dynamic.
|
|
1158
|
-
[matches[2] ? Number(matches[2]) : null, matches[1]]
|
|
1159
|
-
) : void 0;
|
|
1160
|
-
}
|
|
1161
|
-
function isDynamicType(param) {
|
|
1162
|
-
const { type } = param;
|
|
1163
|
-
if (type === "string")
|
|
1164
|
-
return true;
|
|
1165
|
-
if (type === "bytes")
|
|
1166
|
-
return true;
|
|
1167
|
-
if (type.endsWith("[]"))
|
|
1168
|
-
return true;
|
|
1169
|
-
if (type === "tuple")
|
|
1170
|
-
return param.components.some(isDynamicType);
|
|
1171
|
-
const arrayComponents = getArrayComponents(type);
|
|
1172
|
-
if (arrayComponents)
|
|
1173
|
-
return isDynamicType({ ...param, type: arrayComponents[1] });
|
|
1174
|
-
return false;
|
|
1175
|
-
}
|
|
1176
|
-
|
|
1177
|
-
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/stringify.js
|
|
1178
|
-
var stringify = (value, replacer, space) => JSON.stringify(value, (key, value_) => {
|
|
1179
|
-
const value2 = typeof value_ === "bigint" ? value_.toString() : value_;
|
|
1180
|
-
return typeof replacer === "function" ? replacer(key, value2) : value2;
|
|
1181
|
-
}, space);
|
|
1182
|
-
|
|
1183
|
-
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/constants/unit.js
|
|
1184
|
-
var etherUnits = {
|
|
1185
|
-
gwei: 9,
|
|
1186
|
-
wei: 18
|
|
1187
|
-
};
|
|
1188
|
-
var gweiUnits = {
|
|
1189
|
-
ether: -9,
|
|
1190
|
-
wei: 9
|
|
1191
|
-
};
|
|
1192
|
-
var weiUnits = {
|
|
1193
|
-
ether: -18,
|
|
1194
|
-
gwei: -9
|
|
1195
|
-
};
|
|
1196
|
-
|
|
1197
|
-
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/unit/formatUnits.js
|
|
1198
|
-
function formatUnits(value, decimals) {
|
|
1199
|
-
let display = value.toString();
|
|
1200
|
-
const negative = display.startsWith("-");
|
|
1201
|
-
if (negative)
|
|
1202
|
-
display = display.slice(1);
|
|
1203
|
-
display = display.padStart(decimals, "0");
|
|
1204
|
-
let [integer, fraction] = [
|
|
1205
|
-
display.slice(0, display.length - decimals),
|
|
1206
|
-
display.slice(display.length - decimals)
|
|
1207
|
-
];
|
|
1208
|
-
fraction = fraction.replace(/(0+)$/, "");
|
|
1209
|
-
return `${negative ? "-" : ""}${integer || "0"}${fraction ? `.${fraction}` : ""}`;
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
|
-
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/unit/formatEther.js
|
|
1213
|
-
function formatEther(wei, unit = "wei") {
|
|
1214
|
-
return formatUnits(wei, etherUnits[unit]);
|
|
1215
|
-
}
|
|
1216
|
-
|
|
1217
|
-
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/unit/formatGwei.js
|
|
1218
|
-
function formatGwei(wei, unit = "wei") {
|
|
1219
|
-
return formatUnits(wei, gweiUnits[unit]);
|
|
596
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/unit/formatGwei.js
|
|
597
|
+
function formatGwei(wei, unit = "wei") {
|
|
598
|
+
return formatUnits(wei, gweiUnits[unit]);
|
|
1220
599
|
}
|
|
1221
600
|
|
|
1222
601
|
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/errors/transaction.js
|
|
@@ -1400,7 +779,155 @@ var WaitForTransactionReceiptTimeoutError = class extends BaseError {
|
|
|
1400
779
|
}
|
|
1401
780
|
};
|
|
1402
781
|
|
|
1403
|
-
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/
|
|
782
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/constants/number.js
|
|
783
|
+
var maxInt8 = 2n ** (8n - 1n) - 1n;
|
|
784
|
+
var maxInt16 = 2n ** (16n - 1n) - 1n;
|
|
785
|
+
var maxInt24 = 2n ** (24n - 1n) - 1n;
|
|
786
|
+
var maxInt32 = 2n ** (32n - 1n) - 1n;
|
|
787
|
+
var maxInt40 = 2n ** (40n - 1n) - 1n;
|
|
788
|
+
var maxInt48 = 2n ** (48n - 1n) - 1n;
|
|
789
|
+
var maxInt56 = 2n ** (56n - 1n) - 1n;
|
|
790
|
+
var maxInt64 = 2n ** (64n - 1n) - 1n;
|
|
791
|
+
var maxInt72 = 2n ** (72n - 1n) - 1n;
|
|
792
|
+
var maxInt80 = 2n ** (80n - 1n) - 1n;
|
|
793
|
+
var maxInt88 = 2n ** (88n - 1n) - 1n;
|
|
794
|
+
var maxInt96 = 2n ** (96n - 1n) - 1n;
|
|
795
|
+
var maxInt104 = 2n ** (104n - 1n) - 1n;
|
|
796
|
+
var maxInt112 = 2n ** (112n - 1n) - 1n;
|
|
797
|
+
var maxInt120 = 2n ** (120n - 1n) - 1n;
|
|
798
|
+
var maxInt128 = 2n ** (128n - 1n) - 1n;
|
|
799
|
+
var maxInt136 = 2n ** (136n - 1n) - 1n;
|
|
800
|
+
var maxInt144 = 2n ** (144n - 1n) - 1n;
|
|
801
|
+
var maxInt152 = 2n ** (152n - 1n) - 1n;
|
|
802
|
+
var maxInt160 = 2n ** (160n - 1n) - 1n;
|
|
803
|
+
var maxInt168 = 2n ** (168n - 1n) - 1n;
|
|
804
|
+
var maxInt176 = 2n ** (176n - 1n) - 1n;
|
|
805
|
+
var maxInt184 = 2n ** (184n - 1n) - 1n;
|
|
806
|
+
var maxInt192 = 2n ** (192n - 1n) - 1n;
|
|
807
|
+
var maxInt200 = 2n ** (200n - 1n) - 1n;
|
|
808
|
+
var maxInt208 = 2n ** (208n - 1n) - 1n;
|
|
809
|
+
var maxInt216 = 2n ** (216n - 1n) - 1n;
|
|
810
|
+
var maxInt224 = 2n ** (224n - 1n) - 1n;
|
|
811
|
+
var maxInt232 = 2n ** (232n - 1n) - 1n;
|
|
812
|
+
var maxInt240 = 2n ** (240n - 1n) - 1n;
|
|
813
|
+
var maxInt248 = 2n ** (248n - 1n) - 1n;
|
|
814
|
+
var maxInt256 = 2n ** (256n - 1n) - 1n;
|
|
815
|
+
var minInt8 = -(2n ** (8n - 1n));
|
|
816
|
+
var minInt16 = -(2n ** (16n - 1n));
|
|
817
|
+
var minInt24 = -(2n ** (24n - 1n));
|
|
818
|
+
var minInt32 = -(2n ** (32n - 1n));
|
|
819
|
+
var minInt40 = -(2n ** (40n - 1n));
|
|
820
|
+
var minInt48 = -(2n ** (48n - 1n));
|
|
821
|
+
var minInt56 = -(2n ** (56n - 1n));
|
|
822
|
+
var minInt64 = -(2n ** (64n - 1n));
|
|
823
|
+
var minInt72 = -(2n ** (72n - 1n));
|
|
824
|
+
var minInt80 = -(2n ** (80n - 1n));
|
|
825
|
+
var minInt88 = -(2n ** (88n - 1n));
|
|
826
|
+
var minInt96 = -(2n ** (96n - 1n));
|
|
827
|
+
var minInt104 = -(2n ** (104n - 1n));
|
|
828
|
+
var minInt112 = -(2n ** (112n - 1n));
|
|
829
|
+
var minInt120 = -(2n ** (120n - 1n));
|
|
830
|
+
var minInt128 = -(2n ** (128n - 1n));
|
|
831
|
+
var minInt136 = -(2n ** (136n - 1n));
|
|
832
|
+
var minInt144 = -(2n ** (144n - 1n));
|
|
833
|
+
var minInt152 = -(2n ** (152n - 1n));
|
|
834
|
+
var minInt160 = -(2n ** (160n - 1n));
|
|
835
|
+
var minInt168 = -(2n ** (168n - 1n));
|
|
836
|
+
var minInt176 = -(2n ** (176n - 1n));
|
|
837
|
+
var minInt184 = -(2n ** (184n - 1n));
|
|
838
|
+
var minInt192 = -(2n ** (192n - 1n));
|
|
839
|
+
var minInt200 = -(2n ** (200n - 1n));
|
|
840
|
+
var minInt208 = -(2n ** (208n - 1n));
|
|
841
|
+
var minInt216 = -(2n ** (216n - 1n));
|
|
842
|
+
var minInt224 = -(2n ** (224n - 1n));
|
|
843
|
+
var minInt232 = -(2n ** (232n - 1n));
|
|
844
|
+
var minInt240 = -(2n ** (240n - 1n));
|
|
845
|
+
var minInt248 = -(2n ** (248n - 1n));
|
|
846
|
+
var minInt256 = -(2n ** (256n - 1n));
|
|
847
|
+
var maxUint8 = 2n ** 8n - 1n;
|
|
848
|
+
var maxUint16 = 2n ** 16n - 1n;
|
|
849
|
+
var maxUint24 = 2n ** 24n - 1n;
|
|
850
|
+
var maxUint32 = 2n ** 32n - 1n;
|
|
851
|
+
var maxUint40 = 2n ** 40n - 1n;
|
|
852
|
+
var maxUint48 = 2n ** 48n - 1n;
|
|
853
|
+
var maxUint56 = 2n ** 56n - 1n;
|
|
854
|
+
var maxUint64 = 2n ** 64n - 1n;
|
|
855
|
+
var maxUint72 = 2n ** 72n - 1n;
|
|
856
|
+
var maxUint80 = 2n ** 80n - 1n;
|
|
857
|
+
var maxUint88 = 2n ** 88n - 1n;
|
|
858
|
+
var maxUint96 = 2n ** 96n - 1n;
|
|
859
|
+
var maxUint104 = 2n ** 104n - 1n;
|
|
860
|
+
var maxUint112 = 2n ** 112n - 1n;
|
|
861
|
+
var maxUint120 = 2n ** 120n - 1n;
|
|
862
|
+
var maxUint128 = 2n ** 128n - 1n;
|
|
863
|
+
var maxUint136 = 2n ** 136n - 1n;
|
|
864
|
+
var maxUint144 = 2n ** 144n - 1n;
|
|
865
|
+
var maxUint152 = 2n ** 152n - 1n;
|
|
866
|
+
var maxUint160 = 2n ** 160n - 1n;
|
|
867
|
+
var maxUint168 = 2n ** 168n - 1n;
|
|
868
|
+
var maxUint176 = 2n ** 176n - 1n;
|
|
869
|
+
var maxUint184 = 2n ** 184n - 1n;
|
|
870
|
+
var maxUint192 = 2n ** 192n - 1n;
|
|
871
|
+
var maxUint200 = 2n ** 200n - 1n;
|
|
872
|
+
var maxUint208 = 2n ** 208n - 1n;
|
|
873
|
+
var maxUint216 = 2n ** 216n - 1n;
|
|
874
|
+
var maxUint224 = 2n ** 224n - 1n;
|
|
875
|
+
var maxUint232 = 2n ** 232n - 1n;
|
|
876
|
+
var maxUint240 = 2n ** 240n - 1n;
|
|
877
|
+
var maxUint248 = 2n ** 248n - 1n;
|
|
878
|
+
var maxUint256 = 2n ** 256n - 1n;
|
|
879
|
+
|
|
880
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/errors/chain.js
|
|
881
|
+
var ChainDoesNotSupportContract = class extends BaseError {
|
|
882
|
+
constructor({ blockNumber, chain, contract }) {
|
|
883
|
+
super(`Chain "${chain.name}" does not support contract "${contract.name}".`, {
|
|
884
|
+
metaMessages: [
|
|
885
|
+
"This could be due to any of the following:",
|
|
886
|
+
...blockNumber && contract.blockCreated && contract.blockCreated > blockNumber ? [
|
|
887
|
+
`- The contract "${contract.name}" was not deployed until block ${contract.blockCreated} (current block ${blockNumber}).`
|
|
888
|
+
] : [
|
|
889
|
+
`- The chain does not have the contract "${contract.name}" configured.`
|
|
890
|
+
]
|
|
891
|
+
],
|
|
892
|
+
name: "ChainDoesNotSupportContract"
|
|
893
|
+
});
|
|
894
|
+
}
|
|
895
|
+
};
|
|
896
|
+
var ChainMismatchError = class extends BaseError {
|
|
897
|
+
constructor({ chain, currentChainId }) {
|
|
898
|
+
super(`The current chain of the wallet (id: ${currentChainId}) does not match the target chain for the transaction (id: ${chain.id} \u2013 ${chain.name}).`, {
|
|
899
|
+
metaMessages: [
|
|
900
|
+
`Current Chain ID: ${currentChainId}`,
|
|
901
|
+
`Expected Chain ID: ${chain.id} \u2013 ${chain.name}`
|
|
902
|
+
],
|
|
903
|
+
name: "ChainMismatchError"
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
};
|
|
907
|
+
var ChainNotFoundError = class extends BaseError {
|
|
908
|
+
constructor() {
|
|
909
|
+
super([
|
|
910
|
+
"No chain was provided to the request.",
|
|
911
|
+
"Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."
|
|
912
|
+
].join("\n"), {
|
|
913
|
+
name: "ChainNotFoundError"
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
};
|
|
917
|
+
var ClientChainNotConfiguredError = class extends BaseError {
|
|
918
|
+
constructor() {
|
|
919
|
+
super("No chain was provided to the Client.", {
|
|
920
|
+
name: "ClientChainNotConfiguredError"
|
|
921
|
+
});
|
|
922
|
+
}
|
|
923
|
+
};
|
|
924
|
+
var InvalidChainIdError = class extends BaseError {
|
|
925
|
+
constructor({ chainId }) {
|
|
926
|
+
super(typeof chainId === "number" ? `Chain ID "${chainId}" is invalid.` : "Chain ID is invalid.", { name: "InvalidChainIdError" });
|
|
927
|
+
}
|
|
928
|
+
};
|
|
929
|
+
|
|
930
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/errors/node.js
|
|
1404
931
|
var ExecutionRevertedError = class extends BaseError {
|
|
1405
932
|
constructor({ cause, message } = {}) {
|
|
1406
933
|
const reason = message?.replace("execution reverted: ", "")?.replace("execution reverted", "");
|
|
@@ -1579,159 +1106,637 @@ var UnknownNodeError = class extends BaseError {
|
|
|
1579
1106
|
}
|
|
1580
1107
|
};
|
|
1581
1108
|
|
|
1582
|
-
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
var
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
var maxUint40 = 2n ** 40n - 1n;
|
|
1652
|
-
var maxUint48 = 2n ** 48n - 1n;
|
|
1653
|
-
var maxUint56 = 2n ** 56n - 1n;
|
|
1654
|
-
var maxUint64 = 2n ** 64n - 1n;
|
|
1655
|
-
var maxUint72 = 2n ** 72n - 1n;
|
|
1656
|
-
var maxUint80 = 2n ** 80n - 1n;
|
|
1657
|
-
var maxUint88 = 2n ** 88n - 1n;
|
|
1658
|
-
var maxUint96 = 2n ** 96n - 1n;
|
|
1659
|
-
var maxUint104 = 2n ** 104n - 1n;
|
|
1660
|
-
var maxUint112 = 2n ** 112n - 1n;
|
|
1661
|
-
var maxUint120 = 2n ** 120n - 1n;
|
|
1662
|
-
var maxUint128 = 2n ** 128n - 1n;
|
|
1663
|
-
var maxUint136 = 2n ** 136n - 1n;
|
|
1664
|
-
var maxUint144 = 2n ** 144n - 1n;
|
|
1665
|
-
var maxUint152 = 2n ** 152n - 1n;
|
|
1666
|
-
var maxUint160 = 2n ** 160n - 1n;
|
|
1667
|
-
var maxUint168 = 2n ** 168n - 1n;
|
|
1668
|
-
var maxUint176 = 2n ** 176n - 1n;
|
|
1669
|
-
var maxUint184 = 2n ** 184n - 1n;
|
|
1670
|
-
var maxUint192 = 2n ** 192n - 1n;
|
|
1671
|
-
var maxUint200 = 2n ** 200n - 1n;
|
|
1672
|
-
var maxUint208 = 2n ** 208n - 1n;
|
|
1673
|
-
var maxUint216 = 2n ** 216n - 1n;
|
|
1674
|
-
var maxUint224 = 2n ** 224n - 1n;
|
|
1675
|
-
var maxUint232 = 2n ** 232n - 1n;
|
|
1676
|
-
var maxUint240 = 2n ** 240n - 1n;
|
|
1677
|
-
var maxUint248 = 2n ** 248n - 1n;
|
|
1678
|
-
var maxUint256 = 2n ** 256n - 1n;
|
|
1679
|
-
|
|
1680
|
-
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/errors/chain.js
|
|
1681
|
-
var ChainDoesNotSupportContract = class extends BaseError {
|
|
1682
|
-
constructor({ blockNumber, chain, contract }) {
|
|
1683
|
-
super(`Chain "${chain.name}" does not support contract "${contract.name}".`, {
|
|
1684
|
-
metaMessages: [
|
|
1685
|
-
"This could be due to any of the following:",
|
|
1686
|
-
...blockNumber && contract.blockCreated && contract.blockCreated > blockNumber ? [
|
|
1687
|
-
`- The contract "${contract.name}" was not deployed until block ${contract.blockCreated} (current block ${blockNumber}).`
|
|
1688
|
-
] : [
|
|
1689
|
-
`- The chain does not have the contract "${contract.name}" configured.`
|
|
1690
|
-
]
|
|
1691
|
-
],
|
|
1692
|
-
name: "ChainDoesNotSupportContract"
|
|
1109
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/data/slice.js
|
|
1110
|
+
function slice(value, start, end, { strict } = {}) {
|
|
1111
|
+
if (isHex(value, { strict: false }))
|
|
1112
|
+
return sliceHex(value, start, end, {
|
|
1113
|
+
strict
|
|
1114
|
+
});
|
|
1115
|
+
return sliceBytes(value, start, end, {
|
|
1116
|
+
strict
|
|
1117
|
+
});
|
|
1118
|
+
}
|
|
1119
|
+
function assertStartOffset(value, start) {
|
|
1120
|
+
if (typeof start === "number" && start > 0 && start > size(value) - 1)
|
|
1121
|
+
throw new SliceOffsetOutOfBoundsError({
|
|
1122
|
+
offset: start,
|
|
1123
|
+
position: "start",
|
|
1124
|
+
size: size(value)
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
function assertEndOffset(value, start, end) {
|
|
1128
|
+
if (typeof start === "number" && typeof end === "number" && size(value) !== end - start) {
|
|
1129
|
+
throw new SliceOffsetOutOfBoundsError({
|
|
1130
|
+
offset: end,
|
|
1131
|
+
position: "end",
|
|
1132
|
+
size: size(value)
|
|
1133
|
+
});
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
function sliceBytes(value_, start, end, { strict } = {}) {
|
|
1137
|
+
assertStartOffset(value_, start);
|
|
1138
|
+
const value = value_.slice(start, end);
|
|
1139
|
+
if (strict)
|
|
1140
|
+
assertEndOffset(value, start, end);
|
|
1141
|
+
return value;
|
|
1142
|
+
}
|
|
1143
|
+
function sliceHex(value_, start, end, { strict } = {}) {
|
|
1144
|
+
assertStartOffset(value_, start);
|
|
1145
|
+
const value = `0x${value_.replace("0x", "").slice((start ?? 0) * 2, (end ?? value_.length) * 2)}`;
|
|
1146
|
+
if (strict)
|
|
1147
|
+
assertEndOffset(value, start, end);
|
|
1148
|
+
return value;
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/abi/formatAbiItem.js
|
|
1152
|
+
function formatAbiItem(abiItem, { includeName = false } = {}) {
|
|
1153
|
+
if (abiItem.type !== "function" && abiItem.type !== "event" && abiItem.type !== "error")
|
|
1154
|
+
throw new InvalidDefinitionTypeError(abiItem.type);
|
|
1155
|
+
return `${abiItem.name}(${formatAbiParams(abiItem.inputs, { includeName })})`;
|
|
1156
|
+
}
|
|
1157
|
+
function formatAbiParams(params, { includeName = false } = {}) {
|
|
1158
|
+
if (!params)
|
|
1159
|
+
return "";
|
|
1160
|
+
return params.map((param) => formatAbiParam(param, { includeName })).join(includeName ? ", " : ",");
|
|
1161
|
+
}
|
|
1162
|
+
function formatAbiParam(param, { includeName }) {
|
|
1163
|
+
if (param.type.startsWith("tuple")) {
|
|
1164
|
+
return `(${formatAbiParams(param.components, { includeName })})${param.type.slice("tuple".length)}`;
|
|
1165
|
+
}
|
|
1166
|
+
return param.type + (includeName && param.name ? ` ${param.name}` : "");
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/errors/abi.js
|
|
1170
|
+
var AbiConstructorNotFoundError = class extends BaseError {
|
|
1171
|
+
constructor({ docsPath }) {
|
|
1172
|
+
super([
|
|
1173
|
+
"A constructor was not found on the ABI.",
|
|
1174
|
+
"Make sure you are using the correct ABI and that the constructor exists on it."
|
|
1175
|
+
].join("\n"), {
|
|
1176
|
+
docsPath,
|
|
1177
|
+
name: "AbiConstructorNotFoundError"
|
|
1693
1178
|
});
|
|
1694
1179
|
}
|
|
1695
1180
|
};
|
|
1696
|
-
var
|
|
1697
|
-
constructor({
|
|
1698
|
-
super(
|
|
1181
|
+
var AbiConstructorParamsNotFoundError = class extends BaseError {
|
|
1182
|
+
constructor({ docsPath }) {
|
|
1183
|
+
super([
|
|
1184
|
+
"Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.",
|
|
1185
|
+
"Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."
|
|
1186
|
+
].join("\n"), {
|
|
1187
|
+
docsPath,
|
|
1188
|
+
name: "AbiConstructorParamsNotFoundError"
|
|
1189
|
+
});
|
|
1190
|
+
}
|
|
1191
|
+
};
|
|
1192
|
+
var AbiDecodingDataSizeInvalidError = class extends BaseError {
|
|
1193
|
+
constructor({ data, size: size4 }) {
|
|
1194
|
+
super([
|
|
1195
|
+
`Data size of ${size4} bytes is invalid.`,
|
|
1196
|
+
"Size must be in increments of 32 bytes (size % 32 === 0)."
|
|
1197
|
+
].join("\n"), {
|
|
1198
|
+
metaMessages: [`Data: ${data} (${size4} bytes)`],
|
|
1199
|
+
name: "AbiDecodingDataSizeInvalidError"
|
|
1200
|
+
});
|
|
1201
|
+
}
|
|
1202
|
+
};
|
|
1203
|
+
var AbiDecodingDataSizeTooSmallError = class extends BaseError {
|
|
1204
|
+
constructor({ data, params, size: size4 }) {
|
|
1205
|
+
super([`Data size of ${size4} bytes is too small for given parameters.`].join("\n"), {
|
|
1699
1206
|
metaMessages: [
|
|
1700
|
-
`
|
|
1701
|
-
`
|
|
1207
|
+
`Params: (${formatAbiParams(params, { includeName: true })})`,
|
|
1208
|
+
`Data: ${data} (${size4} bytes)`
|
|
1702
1209
|
],
|
|
1703
|
-
name: "
|
|
1210
|
+
name: "AbiDecodingDataSizeTooSmallError"
|
|
1211
|
+
});
|
|
1212
|
+
Object.defineProperty(this, "data", {
|
|
1213
|
+
enumerable: true,
|
|
1214
|
+
configurable: true,
|
|
1215
|
+
writable: true,
|
|
1216
|
+
value: void 0
|
|
1217
|
+
});
|
|
1218
|
+
Object.defineProperty(this, "params", {
|
|
1219
|
+
enumerable: true,
|
|
1220
|
+
configurable: true,
|
|
1221
|
+
writable: true,
|
|
1222
|
+
value: void 0
|
|
1223
|
+
});
|
|
1224
|
+
Object.defineProperty(this, "size", {
|
|
1225
|
+
enumerable: true,
|
|
1226
|
+
configurable: true,
|
|
1227
|
+
writable: true,
|
|
1228
|
+
value: void 0
|
|
1229
|
+
});
|
|
1230
|
+
this.data = data;
|
|
1231
|
+
this.params = params;
|
|
1232
|
+
this.size = size4;
|
|
1233
|
+
}
|
|
1234
|
+
};
|
|
1235
|
+
var AbiDecodingZeroDataError = class extends BaseError {
|
|
1236
|
+
constructor({ cause } = {}) {
|
|
1237
|
+
super('Cannot decode zero data ("0x") with ABI parameters.', {
|
|
1238
|
+
name: "AbiDecodingZeroDataError",
|
|
1239
|
+
cause
|
|
1704
1240
|
});
|
|
1705
1241
|
}
|
|
1706
1242
|
};
|
|
1707
|
-
var
|
|
1708
|
-
constructor() {
|
|
1243
|
+
var AbiEncodingArrayLengthMismatchError = class extends BaseError {
|
|
1244
|
+
constructor({ expectedLength, givenLength, type }) {
|
|
1709
1245
|
super([
|
|
1710
|
-
|
|
1711
|
-
|
|
1246
|
+
`ABI encoding array length mismatch for type ${type}.`,
|
|
1247
|
+
`Expected length: ${expectedLength}`,
|
|
1248
|
+
`Given length: ${givenLength}`
|
|
1249
|
+
].join("\n"), { name: "AbiEncodingArrayLengthMismatchError" });
|
|
1250
|
+
}
|
|
1251
|
+
};
|
|
1252
|
+
var AbiEncodingBytesSizeMismatchError = class extends BaseError {
|
|
1253
|
+
constructor({ expectedSize, value }) {
|
|
1254
|
+
super(`Size of bytes "${value}" (bytes${size(value)}) does not match expected size (bytes${expectedSize}).`, { name: "AbiEncodingBytesSizeMismatchError" });
|
|
1255
|
+
}
|
|
1256
|
+
};
|
|
1257
|
+
var AbiEncodingLengthMismatchError = class extends BaseError {
|
|
1258
|
+
constructor({ expectedLength, givenLength }) {
|
|
1259
|
+
super([
|
|
1260
|
+
"ABI encoding params/values length mismatch.",
|
|
1261
|
+
`Expected length (params): ${expectedLength}`,
|
|
1262
|
+
`Given length (values): ${givenLength}`
|
|
1263
|
+
].join("\n"), { name: "AbiEncodingLengthMismatchError" });
|
|
1264
|
+
}
|
|
1265
|
+
};
|
|
1266
|
+
var AbiErrorInputsNotFoundError = class extends BaseError {
|
|
1267
|
+
constructor(errorName, { docsPath }) {
|
|
1268
|
+
super([
|
|
1269
|
+
`Arguments (\`args\`) were provided to "${errorName}", but "${errorName}" on the ABI does not contain any parameters (\`inputs\`).`,
|
|
1270
|
+
"Cannot encode error result without knowing what the parameter types are.",
|
|
1271
|
+
"Make sure you are using the correct ABI and that the inputs exist on it."
|
|
1712
1272
|
].join("\n"), {
|
|
1713
|
-
|
|
1273
|
+
docsPath,
|
|
1274
|
+
name: "AbiErrorInputsNotFoundError"
|
|
1714
1275
|
});
|
|
1715
1276
|
}
|
|
1716
1277
|
};
|
|
1717
|
-
var
|
|
1718
|
-
constructor() {
|
|
1719
|
-
super(
|
|
1720
|
-
|
|
1278
|
+
var AbiErrorNotFoundError = class extends BaseError {
|
|
1279
|
+
constructor(errorName, { docsPath } = {}) {
|
|
1280
|
+
super([
|
|
1281
|
+
`Error ${errorName ? `"${errorName}" ` : ""}not found on ABI.`,
|
|
1282
|
+
"Make sure you are using the correct ABI and that the error exists on it."
|
|
1283
|
+
].join("\n"), {
|
|
1284
|
+
docsPath,
|
|
1285
|
+
name: "AbiErrorNotFoundError"
|
|
1721
1286
|
});
|
|
1722
1287
|
}
|
|
1723
1288
|
};
|
|
1724
|
-
var
|
|
1725
|
-
constructor({
|
|
1726
|
-
super(
|
|
1289
|
+
var AbiErrorSignatureNotFoundError = class extends BaseError {
|
|
1290
|
+
constructor(signature, { docsPath, cause }) {
|
|
1291
|
+
super([
|
|
1292
|
+
`Encoded error signature "${signature}" not found on ABI.`,
|
|
1293
|
+
"Make sure you are using the correct ABI and that the error exists on it.",
|
|
1294
|
+
`You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${signature}.`
|
|
1295
|
+
].join("\n"), {
|
|
1296
|
+
docsPath,
|
|
1297
|
+
name: "AbiErrorSignatureNotFoundError",
|
|
1298
|
+
cause
|
|
1299
|
+
});
|
|
1300
|
+
Object.defineProperty(this, "signature", {
|
|
1301
|
+
enumerable: true,
|
|
1302
|
+
configurable: true,
|
|
1303
|
+
writable: true,
|
|
1304
|
+
value: void 0
|
|
1305
|
+
});
|
|
1306
|
+
this.signature = signature;
|
|
1727
1307
|
}
|
|
1728
1308
|
};
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1309
|
+
var AbiEventSignatureEmptyTopicsError = class extends BaseError {
|
|
1310
|
+
constructor({ docsPath }) {
|
|
1311
|
+
super("Cannot extract event signature from empty topics.", {
|
|
1312
|
+
docsPath,
|
|
1313
|
+
name: "AbiEventSignatureEmptyTopicsError"
|
|
1314
|
+
});
|
|
1315
|
+
}
|
|
1316
|
+
};
|
|
1317
|
+
var AbiEventSignatureNotFoundError = class extends BaseError {
|
|
1318
|
+
constructor(signature, { docsPath }) {
|
|
1319
|
+
super([
|
|
1320
|
+
`Encoded event signature "${signature}" not found on ABI.`,
|
|
1321
|
+
"Make sure you are using the correct ABI and that the event exists on it.",
|
|
1322
|
+
`You can look up the signature here: https://4byte.sourcify.dev/?q=${signature}.`
|
|
1323
|
+
].join("\n"), {
|
|
1324
|
+
docsPath,
|
|
1325
|
+
name: "AbiEventSignatureNotFoundError"
|
|
1326
|
+
});
|
|
1327
|
+
}
|
|
1328
|
+
};
|
|
1329
|
+
var AbiEventNotFoundError = class extends BaseError {
|
|
1330
|
+
constructor(eventName, { docsPath } = {}) {
|
|
1331
|
+
super([
|
|
1332
|
+
`Event ${eventName ? `"${eventName}" ` : ""}not found on ABI.`,
|
|
1333
|
+
"Make sure you are using the correct ABI and that the event exists on it."
|
|
1334
|
+
].join("\n"), {
|
|
1335
|
+
docsPath,
|
|
1336
|
+
name: "AbiEventNotFoundError"
|
|
1337
|
+
});
|
|
1338
|
+
}
|
|
1339
|
+
};
|
|
1340
|
+
var AbiFunctionNotFoundError = class extends BaseError {
|
|
1341
|
+
constructor(functionName, { docsPath } = {}) {
|
|
1342
|
+
super([
|
|
1343
|
+
`Function ${functionName ? `"${functionName}" ` : ""}not found on ABI.`,
|
|
1344
|
+
"Make sure you are using the correct ABI and that the function exists on it."
|
|
1345
|
+
].join("\n"), {
|
|
1346
|
+
docsPath,
|
|
1347
|
+
name: "AbiFunctionNotFoundError"
|
|
1348
|
+
});
|
|
1349
|
+
}
|
|
1350
|
+
};
|
|
1351
|
+
var AbiFunctionOutputsNotFoundError = class extends BaseError {
|
|
1352
|
+
constructor(functionName, { docsPath }) {
|
|
1353
|
+
super([
|
|
1354
|
+
`Function "${functionName}" does not contain any \`outputs\` on ABI.`,
|
|
1355
|
+
"Cannot decode function result without knowing what the parameter types are.",
|
|
1356
|
+
"Make sure you are using the correct ABI and that the function exists on it."
|
|
1357
|
+
].join("\n"), {
|
|
1358
|
+
docsPath,
|
|
1359
|
+
name: "AbiFunctionOutputsNotFoundError"
|
|
1360
|
+
});
|
|
1361
|
+
}
|
|
1362
|
+
};
|
|
1363
|
+
var AbiFunctionSignatureNotFoundError = class extends BaseError {
|
|
1364
|
+
constructor(signature, { docsPath }) {
|
|
1365
|
+
super([
|
|
1366
|
+
`Encoded function signature "${signature}" not found on ABI.`,
|
|
1367
|
+
"Make sure you are using the correct ABI and that the function exists on it.",
|
|
1368
|
+
`You can look up the signature here: https://4byte.sourcify.dev/?q=${signature}.`
|
|
1369
|
+
].join("\n"), {
|
|
1370
|
+
docsPath,
|
|
1371
|
+
name: "AbiFunctionSignatureNotFoundError"
|
|
1372
|
+
});
|
|
1373
|
+
}
|
|
1374
|
+
};
|
|
1375
|
+
var AbiItemAmbiguityError = class extends BaseError {
|
|
1376
|
+
constructor(x, y) {
|
|
1377
|
+
super("Found ambiguous types in overloaded ABI items.", {
|
|
1378
|
+
metaMessages: [
|
|
1379
|
+
`\`${x.type}\` in \`${formatAbiItem(x.abiItem)}\`, and`,
|
|
1380
|
+
`\`${y.type}\` in \`${formatAbiItem(y.abiItem)}\``,
|
|
1381
|
+
"",
|
|
1382
|
+
"These types encode differently and cannot be distinguished at runtime.",
|
|
1383
|
+
"Remove one of the ambiguous items in the ABI."
|
|
1384
|
+
],
|
|
1385
|
+
name: "AbiItemAmbiguityError"
|
|
1386
|
+
});
|
|
1387
|
+
}
|
|
1388
|
+
};
|
|
1389
|
+
var BytesSizeMismatchError = class extends BaseError {
|
|
1390
|
+
constructor({ expectedSize, givenSize }) {
|
|
1391
|
+
super(`Expected bytes${expectedSize}, got bytes${givenSize}.`, {
|
|
1392
|
+
name: "BytesSizeMismatchError"
|
|
1393
|
+
});
|
|
1394
|
+
}
|
|
1395
|
+
};
|
|
1396
|
+
var DecodeLogDataMismatch = class extends BaseError {
|
|
1397
|
+
constructor({ abiItem, data, params, size: size4 }) {
|
|
1398
|
+
super([
|
|
1399
|
+
`Data size of ${size4} bytes is too small for non-indexed event parameters.`
|
|
1400
|
+
].join("\n"), {
|
|
1401
|
+
metaMessages: [
|
|
1402
|
+
`Params: (${formatAbiParams(params, { includeName: true })})`,
|
|
1403
|
+
`Data: ${data} (${size4} bytes)`
|
|
1404
|
+
],
|
|
1405
|
+
name: "DecodeLogDataMismatch"
|
|
1406
|
+
});
|
|
1407
|
+
Object.defineProperty(this, "abiItem", {
|
|
1408
|
+
enumerable: true,
|
|
1409
|
+
configurable: true,
|
|
1410
|
+
writable: true,
|
|
1411
|
+
value: void 0
|
|
1412
|
+
});
|
|
1413
|
+
Object.defineProperty(this, "data", {
|
|
1414
|
+
enumerable: true,
|
|
1415
|
+
configurable: true,
|
|
1416
|
+
writable: true,
|
|
1417
|
+
value: void 0
|
|
1418
|
+
});
|
|
1419
|
+
Object.defineProperty(this, "params", {
|
|
1420
|
+
enumerable: true,
|
|
1421
|
+
configurable: true,
|
|
1422
|
+
writable: true,
|
|
1423
|
+
value: void 0
|
|
1424
|
+
});
|
|
1425
|
+
Object.defineProperty(this, "size", {
|
|
1426
|
+
enumerable: true,
|
|
1427
|
+
configurable: true,
|
|
1428
|
+
writable: true,
|
|
1429
|
+
value: void 0
|
|
1430
|
+
});
|
|
1431
|
+
this.abiItem = abiItem;
|
|
1432
|
+
this.data = data;
|
|
1433
|
+
this.params = params;
|
|
1434
|
+
this.size = size4;
|
|
1435
|
+
}
|
|
1436
|
+
};
|
|
1437
|
+
var DecodeLogTopicsMismatch = class extends BaseError {
|
|
1438
|
+
constructor({ abiItem, param }) {
|
|
1439
|
+
super([
|
|
1440
|
+
`Expected a topic for indexed event parameter${param.name ? ` "${param.name}"` : ""} on event "${formatAbiItem(abiItem, { includeName: true })}".`
|
|
1441
|
+
].join("\n"), { name: "DecodeLogTopicsMismatch" });
|
|
1442
|
+
Object.defineProperty(this, "abiItem", {
|
|
1443
|
+
enumerable: true,
|
|
1444
|
+
configurable: true,
|
|
1445
|
+
writable: true,
|
|
1446
|
+
value: void 0
|
|
1447
|
+
});
|
|
1448
|
+
this.abiItem = abiItem;
|
|
1449
|
+
}
|
|
1450
|
+
};
|
|
1451
|
+
var InvalidAbiEncodingTypeError = class extends BaseError {
|
|
1452
|
+
constructor(type, { docsPath }) {
|
|
1453
|
+
super([
|
|
1454
|
+
`Type "${type}" is not a valid encoding type.`,
|
|
1455
|
+
"Please provide a valid ABI type."
|
|
1456
|
+
].join("\n"), { docsPath, name: "InvalidAbiEncodingType" });
|
|
1457
|
+
}
|
|
1458
|
+
};
|
|
1459
|
+
var InvalidAbiDecodingTypeError = class extends BaseError {
|
|
1460
|
+
constructor(type, { docsPath }) {
|
|
1461
|
+
super([
|
|
1462
|
+
`Type "${type}" is not a valid decoding type.`,
|
|
1463
|
+
"Please provide a valid ABI type."
|
|
1464
|
+
].join("\n"), { docsPath, name: "InvalidAbiDecodingType" });
|
|
1465
|
+
}
|
|
1466
|
+
};
|
|
1467
|
+
var InvalidArrayError = class extends BaseError {
|
|
1468
|
+
constructor(value) {
|
|
1469
|
+
super([`Value "${value}" is not a valid array.`].join("\n"), {
|
|
1470
|
+
name: "InvalidArrayError"
|
|
1471
|
+
});
|
|
1472
|
+
}
|
|
1473
|
+
};
|
|
1474
|
+
var InvalidDefinitionTypeError = class extends BaseError {
|
|
1475
|
+
constructor(type) {
|
|
1476
|
+
super([
|
|
1477
|
+
`"${type}" is not a valid definition type.`,
|
|
1478
|
+
'Valid types: "function", "event", "error"'
|
|
1479
|
+
].join("\n"), { name: "InvalidDefinitionTypeError" });
|
|
1480
|
+
}
|
|
1481
|
+
};
|
|
1482
|
+
var UnsupportedPackedAbiType = class extends BaseError {
|
|
1483
|
+
constructor(type) {
|
|
1484
|
+
super(`Type "${type}" is not supported for packed encoding.`, {
|
|
1485
|
+
name: "UnsupportedPackedAbiType"
|
|
1486
|
+
});
|
|
1487
|
+
}
|
|
1488
|
+
};
|
|
1489
|
+
|
|
1490
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/regex.js
|
|
1491
|
+
var arrayRegex = /^(.*)\[([0-9]*)\]$/;
|
|
1492
|
+
var bytesRegex = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/;
|
|
1493
|
+
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)?$/;
|
|
1494
|
+
|
|
1495
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/abi/encodeAbiParameters.js
|
|
1496
|
+
function encodeAbiParameters(params, values) {
|
|
1497
|
+
if (params.length !== values.length)
|
|
1498
|
+
throw new AbiEncodingLengthMismatchError({
|
|
1499
|
+
expectedLength: params.length,
|
|
1500
|
+
givenLength: values.length
|
|
1501
|
+
});
|
|
1502
|
+
const preparedParams = prepareParams({
|
|
1503
|
+
params,
|
|
1504
|
+
values
|
|
1505
|
+
});
|
|
1506
|
+
return encodeParams(preparedParams);
|
|
1507
|
+
}
|
|
1508
|
+
function prepareParams({ params, values }) {
|
|
1509
|
+
const preparedParams = [];
|
|
1510
|
+
for (let i = 0; i < params.length; i++) {
|
|
1511
|
+
preparedParams.push(prepareParam({ param: params[i], value: values[i] }));
|
|
1512
|
+
}
|
|
1513
|
+
return preparedParams;
|
|
1514
|
+
}
|
|
1515
|
+
function prepareParam({ param, value }) {
|
|
1516
|
+
const arrayComponents = getArrayComponents(param.type);
|
|
1517
|
+
if (arrayComponents) {
|
|
1518
|
+
const [length, type] = arrayComponents;
|
|
1519
|
+
return encodeArray(value, { length, param: { ...param, type } });
|
|
1520
|
+
}
|
|
1521
|
+
if (param.type === "tuple") {
|
|
1522
|
+
return encodeTuple(value, {
|
|
1523
|
+
param
|
|
1524
|
+
});
|
|
1525
|
+
}
|
|
1526
|
+
if (param.type === "address") {
|
|
1527
|
+
return encodeAddress(value);
|
|
1528
|
+
}
|
|
1529
|
+
if (param.type === "bool") {
|
|
1530
|
+
return encodeBool(value);
|
|
1531
|
+
}
|
|
1532
|
+
if (param.type.startsWith("uint") || param.type.startsWith("int")) {
|
|
1533
|
+
const signed = param.type.startsWith("int");
|
|
1534
|
+
const [, , size4 = "256"] = integerRegex.exec(param.type) ?? [];
|
|
1535
|
+
return encodeNumber(value, {
|
|
1536
|
+
signed,
|
|
1537
|
+
size: Number(size4)
|
|
1538
|
+
});
|
|
1539
|
+
}
|
|
1540
|
+
if (param.type.startsWith("bytes")) {
|
|
1541
|
+
return encodeBytes(value, { param });
|
|
1542
|
+
}
|
|
1543
|
+
if (param.type === "string") {
|
|
1544
|
+
return encodeString(value);
|
|
1545
|
+
}
|
|
1546
|
+
throw new InvalidAbiEncodingTypeError(param.type, {
|
|
1547
|
+
docsPath: "/docs/contract/encodeAbiParameters"
|
|
1548
|
+
});
|
|
1549
|
+
}
|
|
1550
|
+
function encodeParams(preparedParams) {
|
|
1551
|
+
let staticSize = 0;
|
|
1552
|
+
for (let i = 0; i < preparedParams.length; i++) {
|
|
1553
|
+
const { dynamic, encoded } = preparedParams[i];
|
|
1554
|
+
if (dynamic)
|
|
1555
|
+
staticSize += 32;
|
|
1556
|
+
else
|
|
1557
|
+
staticSize += size(encoded);
|
|
1558
|
+
}
|
|
1559
|
+
const staticParams = [];
|
|
1560
|
+
const dynamicParams = [];
|
|
1561
|
+
let dynamicSize = 0;
|
|
1562
|
+
for (let i = 0; i < preparedParams.length; i++) {
|
|
1563
|
+
const { dynamic, encoded } = preparedParams[i];
|
|
1564
|
+
if (dynamic) {
|
|
1565
|
+
staticParams.push(numberToHex(staticSize + dynamicSize, { size: 32 }));
|
|
1566
|
+
dynamicParams.push(encoded);
|
|
1567
|
+
dynamicSize += size(encoded);
|
|
1568
|
+
} else {
|
|
1569
|
+
staticParams.push(encoded);
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
return concatHex([...staticParams, ...dynamicParams]);
|
|
1573
|
+
}
|
|
1574
|
+
function encodeAddress(value) {
|
|
1575
|
+
if (!isAddress(value))
|
|
1576
|
+
throw new InvalidAddressError({ address: value });
|
|
1577
|
+
return { dynamic: false, encoded: padHex(value.toLowerCase()) };
|
|
1578
|
+
}
|
|
1579
|
+
function encodeArray(value, { length, param }) {
|
|
1580
|
+
const dynamic = length === null;
|
|
1581
|
+
if (!Array.isArray(value))
|
|
1582
|
+
throw new InvalidArrayError(value);
|
|
1583
|
+
if (!dynamic && value.length !== length)
|
|
1584
|
+
throw new AbiEncodingArrayLengthMismatchError({
|
|
1585
|
+
expectedLength: length,
|
|
1586
|
+
givenLength: value.length,
|
|
1587
|
+
type: `${param.type}[${length}]`
|
|
1588
|
+
});
|
|
1589
|
+
let dynamicChild = value.length === 0 && isDynamicType(param);
|
|
1590
|
+
const preparedParams = [];
|
|
1591
|
+
for (let i = 0; i < value.length; i++) {
|
|
1592
|
+
const preparedParam = prepareParam({ param, value: value[i] });
|
|
1593
|
+
if (preparedParam.dynamic)
|
|
1594
|
+
dynamicChild = true;
|
|
1595
|
+
preparedParams.push(preparedParam);
|
|
1596
|
+
}
|
|
1597
|
+
if (dynamic || dynamicChild) {
|
|
1598
|
+
const data = encodeParams(preparedParams);
|
|
1599
|
+
if (dynamic) {
|
|
1600
|
+
const length2 = numberToHex(preparedParams.length, { size: 32 });
|
|
1601
|
+
return {
|
|
1602
|
+
dynamic: true,
|
|
1603
|
+
encoded: concatHex([length2, data])
|
|
1604
|
+
};
|
|
1605
|
+
}
|
|
1606
|
+
if (dynamicChild)
|
|
1607
|
+
return { dynamic: true, encoded: data };
|
|
1608
|
+
}
|
|
1609
|
+
return {
|
|
1610
|
+
dynamic: false,
|
|
1611
|
+
encoded: concatHex(preparedParams.map(({ encoded }) => encoded))
|
|
1612
|
+
};
|
|
1613
|
+
}
|
|
1614
|
+
function encodeBytes(value, { param }) {
|
|
1615
|
+
const [, paramSize] = param.type.split("bytes");
|
|
1616
|
+
const bytesSize = size(value);
|
|
1617
|
+
if (!paramSize) {
|
|
1618
|
+
let value_ = value;
|
|
1619
|
+
if (bytesSize % 32 !== 0)
|
|
1620
|
+
value_ = padHex(value_, {
|
|
1621
|
+
dir: "right",
|
|
1622
|
+
size: Math.ceil((value.length - 2) / 2 / 32) * 32
|
|
1623
|
+
});
|
|
1624
|
+
return {
|
|
1625
|
+
dynamic: true,
|
|
1626
|
+
encoded: concatHex([
|
|
1627
|
+
padHex(numberToHex(bytesSize, { size: 32 })),
|
|
1628
|
+
value_
|
|
1629
|
+
])
|
|
1630
|
+
};
|
|
1631
|
+
}
|
|
1632
|
+
if (bytesSize !== Number.parseInt(paramSize, 10))
|
|
1633
|
+
throw new AbiEncodingBytesSizeMismatchError({
|
|
1634
|
+
expectedSize: Number.parseInt(paramSize, 10),
|
|
1635
|
+
value
|
|
1636
|
+
});
|
|
1637
|
+
return { dynamic: false, encoded: padHex(value, { dir: "right" }) };
|
|
1638
|
+
}
|
|
1639
|
+
function encodeBool(value) {
|
|
1640
|
+
if (typeof value !== "boolean")
|
|
1641
|
+
throw new BaseError(`Invalid boolean value: "${value}" (type: ${typeof value}). Expected: \`true\` or \`false\`.`);
|
|
1642
|
+
return { dynamic: false, encoded: padHex(boolToHex(value)) };
|
|
1643
|
+
}
|
|
1644
|
+
function encodeNumber(value, { signed, size: size4 = 256 }) {
|
|
1645
|
+
if (typeof size4 === "number") {
|
|
1646
|
+
const max = 2n ** (BigInt(size4) - (signed ? 1n : 0n)) - 1n;
|
|
1647
|
+
const min = signed ? -max - 1n : 0n;
|
|
1648
|
+
if (value > max || value < min)
|
|
1649
|
+
throw new IntegerOutOfRangeError({
|
|
1650
|
+
max: max.toString(),
|
|
1651
|
+
min: min.toString(),
|
|
1652
|
+
signed,
|
|
1653
|
+
size: size4 / 8,
|
|
1654
|
+
value: value.toString()
|
|
1655
|
+
});
|
|
1656
|
+
}
|
|
1657
|
+
return {
|
|
1658
|
+
dynamic: false,
|
|
1659
|
+
encoded: numberToHex(value, {
|
|
1660
|
+
size: 32,
|
|
1661
|
+
signed
|
|
1662
|
+
})
|
|
1663
|
+
};
|
|
1664
|
+
}
|
|
1665
|
+
function encodeString(value) {
|
|
1666
|
+
const hexValue = stringToHex(value);
|
|
1667
|
+
const partsLength = Math.ceil(size(hexValue) / 32);
|
|
1668
|
+
const parts = [];
|
|
1669
|
+
for (let i = 0; i < partsLength; i++) {
|
|
1670
|
+
parts.push(padHex(slice(hexValue, i * 32, (i + 1) * 32), {
|
|
1671
|
+
dir: "right"
|
|
1672
|
+
}));
|
|
1673
|
+
}
|
|
1674
|
+
return {
|
|
1675
|
+
dynamic: true,
|
|
1676
|
+
encoded: concatHex([
|
|
1677
|
+
padHex(numberToHex(size(hexValue), { size: 32 })),
|
|
1678
|
+
...parts
|
|
1679
|
+
])
|
|
1680
|
+
};
|
|
1681
|
+
}
|
|
1682
|
+
function encodeTuple(value, { param }) {
|
|
1683
|
+
let dynamic = false;
|
|
1684
|
+
const preparedParams = [];
|
|
1685
|
+
for (let i = 0; i < param.components.length; i++) {
|
|
1686
|
+
const param_ = param.components[i];
|
|
1687
|
+
const index = Array.isArray(value) ? i : param_.name;
|
|
1688
|
+
const preparedParam = prepareParam({
|
|
1689
|
+
param: param_,
|
|
1690
|
+
value: value[index]
|
|
1691
|
+
});
|
|
1692
|
+
preparedParams.push(preparedParam);
|
|
1693
|
+
if (preparedParam.dynamic)
|
|
1694
|
+
dynamic = true;
|
|
1695
|
+
}
|
|
1696
|
+
return {
|
|
1697
|
+
dynamic,
|
|
1698
|
+
encoded: dynamic ? encodeParams(preparedParams) : concatHex(preparedParams.map(({ encoded }) => encoded))
|
|
1699
|
+
};
|
|
1700
|
+
}
|
|
1701
|
+
function getArrayComponents(type) {
|
|
1702
|
+
const matches = type.match(/^(.*)\[(\d+)?\]$/);
|
|
1703
|
+
return matches ? (
|
|
1704
|
+
// Return `null` if the array is dynamic.
|
|
1705
|
+
[matches[2] ? Number(matches[2]) : null, matches[1]]
|
|
1706
|
+
) : void 0;
|
|
1707
|
+
}
|
|
1708
|
+
function isDynamicType(param) {
|
|
1709
|
+
const { type } = param;
|
|
1710
|
+
if (type === "string")
|
|
1711
|
+
return true;
|
|
1712
|
+
if (type === "bytes")
|
|
1713
|
+
return true;
|
|
1714
|
+
if (type.endsWith("[]"))
|
|
1715
|
+
return true;
|
|
1716
|
+
if (type === "tuple")
|
|
1717
|
+
return param.components.some(isDynamicType);
|
|
1718
|
+
const arrayComponents = getArrayComponents(type);
|
|
1719
|
+
if (arrayComponents)
|
|
1720
|
+
return isDynamicType({ ...param, type: arrayComponents[1] });
|
|
1721
|
+
return false;
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/stringify.js
|
|
1725
|
+
var stringify = (value, replacer, space) => JSON.stringify(value, (key, value_) => {
|
|
1726
|
+
const value2 = typeof value_ === "bigint" ? value_.toString() : value_;
|
|
1727
|
+
return typeof replacer === "function" ? replacer(key, value2) : value2;
|
|
1728
|
+
}, space);
|
|
1729
|
+
|
|
1730
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/block/formatBlockParameter.js
|
|
1731
|
+
function formatBlockParameter(parameters) {
|
|
1732
|
+
const { blockHash, blockNumber, blockTag, requireCanonical } = parameters;
|
|
1733
|
+
if (requireCanonical !== void 0 && !blockHash)
|
|
1734
|
+
throw new BaseError("`requireCanonical` can only be provided when `blockHash` is set.");
|
|
1735
|
+
if (blockHash)
|
|
1736
|
+
return requireCanonical ? { blockHash, requireCanonical } : { blockHash };
|
|
1737
|
+
if (typeof blockNumber === "bigint")
|
|
1738
|
+
return numberToHex(blockNumber);
|
|
1739
|
+
return blockTag ?? "latest";
|
|
1735
1740
|
}
|
|
1736
1741
|
|
|
1737
1742
|
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/errors/cursor.js
|
|
@@ -1922,16 +1927,11 @@ function createCursor(bytes, { recursiveReadLimit = 8192 } = {}) {
|
|
|
1922
1927
|
return cursor;
|
|
1923
1928
|
}
|
|
1924
1929
|
|
|
1925
|
-
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/
|
|
1926
|
-
function
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
if (blockHash)
|
|
1931
|
-
return requireCanonical ? { blockHash, requireCanonical } : { blockHash };
|
|
1932
|
-
if (typeof blockNumber === "bigint")
|
|
1933
|
-
return numberToHex(blockNumber);
|
|
1934
|
-
return blockTag ?? "latest";
|
|
1930
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/accounts/utils/parseAccount.js
|
|
1931
|
+
function parseAccount(account) {
|
|
1932
|
+
if (typeof account === "string")
|
|
1933
|
+
return { address: account, type: "json-rpc" };
|
|
1934
|
+
return account;
|
|
1935
1935
|
}
|
|
1936
1936
|
|
|
1937
1937
|
// node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.4.3/node_modules/ox/_esm/core/version.js
|
|
@@ -2151,270 +2151,71 @@ function assertSize3(hex, size_) {
|
|
|
2151
2151
|
givenSize: size3(hex),
|
|
2152
2152
|
maxSize: size_
|
|
2153
2153
|
});
|
|
2154
|
-
}
|
|
2155
|
-
function assertStartOffset3(value, start) {
|
|
2156
|
-
if (typeof start === "number" && start > 0 && start > size3(value) - 1)
|
|
2157
|
-
throw new SliceOffsetOutOfBoundsError3({
|
|
2158
|
-
offset: start,
|
|
2159
|
-
position: "start",
|
|
2160
|
-
size: size3(value)
|
|
2161
|
-
});
|
|
2162
|
-
}
|
|
2163
|
-
function assertEndOffset3(value, start, end) {
|
|
2164
|
-
if (typeof start === "number" && typeof end === "number" && size3(value) !== end - start) {
|
|
2165
|
-
throw new SliceOffsetOutOfBoundsError3({
|
|
2166
|
-
offset: end,
|
|
2167
|
-
position: "end",
|
|
2168
|
-
size: size3(value)
|
|
2169
|
-
});
|
|
2170
|
-
}
|
|
2171
|
-
}
|
|
2172
|
-
function pad3(hex_, options = {}) {
|
|
2173
|
-
const { dir, size: size4 = 32 } = options;
|
|
2174
|
-
if (size4 === 0)
|
|
2175
|
-
return hex_;
|
|
2176
|
-
const hex = hex_.replace("0x", "");
|
|
2177
|
-
if (hex.length > size4 * 2)
|
|
2178
|
-
throw new SizeExceedsPaddingSizeError3({
|
|
2179
|
-
size: Math.ceil(hex.length / 2),
|
|
2180
|
-
targetSize: size4,
|
|
2181
|
-
type: "Hex"
|
|
2182
|
-
});
|
|
2183
|
-
return `0x${hex[dir === "right" ? "padEnd" : "padStart"](size4 * 2, "0")}`;
|
|
2184
|
-
}
|
|
2185
|
-
function trim3(value, options = {}) {
|
|
2186
|
-
const { dir = "left" } = options;
|
|
2187
|
-
let data = value.replace("0x", "");
|
|
2188
|
-
let sliceLength = 0;
|
|
2189
|
-
for (let i = 0; i < data.length - 1; i++) {
|
|
2190
|
-
if (data[dir === "left" ? i : data.length - i - 1].toString() === "0")
|
|
2191
|
-
sliceLength++;
|
|
2192
|
-
else
|
|
2193
|
-
break;
|
|
2194
|
-
}
|
|
2195
|
-
data = dir === "left" ? data.slice(sliceLength) : data.slice(0, data.length - sliceLength);
|
|
2196
|
-
if (data === "0")
|
|
2197
|
-
return "0x";
|
|
2198
|
-
if (dir === "right" && data.length % 2 === 1)
|
|
2199
|
-
return `0x${data}0`;
|
|
2200
|
-
return `0x${data}`;
|
|
2201
|
-
}
|
|
2202
|
-
|
|
2203
|
-
// node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.4.3/node_modules/ox/_esm/core/Json.js
|
|
2204
|
-
var bigIntSuffix = "#__bigint";
|
|
2205
|
-
function stringify2(value, replacer, space) {
|
|
2206
|
-
return JSON.stringify(value, (key, value2) => {
|
|
2207
|
-
if (typeof replacer === "function")
|
|
2208
|
-
return replacer(key, value2);
|
|
2209
|
-
if (typeof value2 === "bigint")
|
|
2210
|
-
return value2.toString() + bigIntSuffix;
|
|
2211
|
-
return value2;
|
|
2212
|
-
}, space);
|
|
2213
|
-
}
|
|
2214
|
-
|
|
2215
|
-
// node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.4.3/node_modules/ox/_esm/core/Hex.js
|
|
2216
|
-
var encoder3 = /* @__PURE__ */ new TextEncoder();
|
|
2217
|
-
var hexes2 = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0"));
|
|
2218
|
-
function assert(value, options = {}) {
|
|
2219
|
-
const { strict = false } = options;
|
|
2220
|
-
if (!value)
|
|
2221
|
-
throw new InvalidHexTypeError(value);
|
|
2222
|
-
if (typeof value !== "string")
|
|
2223
|
-
throw new InvalidHexTypeError(value);
|
|
2224
|
-
if (strict) {
|
|
2225
|
-
if (!/^0x[0-9a-fA-F]*$/.test(value))
|
|
2226
|
-
throw new InvalidHexValueError2(value);
|
|
2227
|
-
}
|
|
2228
|
-
if (!value.startsWith("0x"))
|
|
2229
|
-
throw new InvalidHexValueError2(value);
|
|
2230
|
-
}
|
|
2231
|
-
function concat2(...values) {
|
|
2232
|
-
return `0x${values.reduce((acc, x) => acc + x.replace("0x", ""), "")}`;
|
|
2233
|
-
}
|
|
2234
|
-
function from(value) {
|
|
2235
|
-
if (value instanceof Uint8Array)
|
|
2236
|
-
return fromBytes(value);
|
|
2237
|
-
if (Array.isArray(value))
|
|
2238
|
-
return fromBytes(new Uint8Array(value));
|
|
2239
|
-
return value;
|
|
2240
|
-
}
|
|
2241
|
-
function fromBoolean(value, options = {}) {
|
|
2242
|
-
const hex = `0x${Number(value)}`;
|
|
2243
|
-
if (typeof options.size === "number") {
|
|
2244
|
-
assertSize3(hex, options.size);
|
|
2245
|
-
return padLeft(hex, options.size);
|
|
2246
|
-
}
|
|
2247
|
-
return hex;
|
|
2248
|
-
}
|
|
2249
|
-
function fromBytes(value, options = {}) {
|
|
2250
|
-
let string = "";
|
|
2251
|
-
for (let i = 0; i < value.length; i++)
|
|
2252
|
-
string += hexes2[value[i]];
|
|
2253
|
-
const hex = `0x${string}`;
|
|
2254
|
-
if (typeof options.size === "number") {
|
|
2255
|
-
assertSize3(hex, options.size);
|
|
2256
|
-
return padRight(hex, options.size);
|
|
2257
|
-
}
|
|
2258
|
-
return hex;
|
|
2259
|
-
}
|
|
2260
|
-
function fromNumber(value, options = {}) {
|
|
2261
|
-
const { signed, size: size4 } = options;
|
|
2262
|
-
const value_ = BigInt(value);
|
|
2263
|
-
let maxValue;
|
|
2264
|
-
if (size4) {
|
|
2265
|
-
if (signed)
|
|
2266
|
-
maxValue = (1n << BigInt(size4) * 8n - 1n) - 1n;
|
|
2267
|
-
else
|
|
2268
|
-
maxValue = 2n ** (BigInt(size4) * 8n) - 1n;
|
|
2269
|
-
} else if (typeof value === "number") {
|
|
2270
|
-
maxValue = BigInt(Number.MAX_SAFE_INTEGER);
|
|
2271
|
-
}
|
|
2272
|
-
const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
|
|
2273
|
-
if (maxValue && value_ > maxValue || value_ < minValue) {
|
|
2274
|
-
const suffix = typeof value === "bigint" ? "n" : "";
|
|
2275
|
-
throw new IntegerOutOfRangeError2({
|
|
2276
|
-
max: maxValue ? `${maxValue}${suffix}` : void 0,
|
|
2277
|
-
min: `${minValue}${suffix}`,
|
|
2278
|
-
signed,
|
|
2279
|
-
size: size4,
|
|
2280
|
-
value: `${value}${suffix}`
|
|
2281
|
-
});
|
|
2282
|
-
}
|
|
2283
|
-
const stringValue = (signed && value_ < 0 ? BigInt.asUintN(size4 * 8, BigInt(value_)) : value_).toString(16);
|
|
2284
|
-
const hex = `0x${stringValue}`;
|
|
2285
|
-
if (size4)
|
|
2286
|
-
return padLeft(hex, size4);
|
|
2287
|
-
return hex;
|
|
2288
|
-
}
|
|
2289
|
-
function fromString(value, options = {}) {
|
|
2290
|
-
return fromBytes(encoder3.encode(value), options);
|
|
2291
|
-
}
|
|
2292
|
-
function padLeft(value, size4) {
|
|
2293
|
-
return pad3(value, { dir: "left", size: size4 });
|
|
2294
|
-
}
|
|
2295
|
-
function padRight(value, size4) {
|
|
2296
|
-
return pad3(value, { dir: "right", size: size4 });
|
|
2297
|
-
}
|
|
2298
|
-
function slice2(value, start, end, options = {}) {
|
|
2299
|
-
const { strict } = options;
|
|
2300
|
-
assertStartOffset3(value, start);
|
|
2301
|
-
const value_ = `0x${value.replace("0x", "").slice((start ?? 0) * 2, (end ?? value.length) * 2)}`;
|
|
2302
|
-
if (strict)
|
|
2303
|
-
assertEndOffset3(value_, start, end);
|
|
2304
|
-
return value_;
|
|
2305
|
-
}
|
|
2306
|
-
function size3(value) {
|
|
2307
|
-
return Math.ceil((value.length - 2) / 2);
|
|
2308
|
-
}
|
|
2309
|
-
function trimLeft(value) {
|
|
2310
|
-
return trim3(value, { dir: "left" });
|
|
2311
|
-
}
|
|
2312
|
-
function toBigInt(hex, options = {}) {
|
|
2313
|
-
const { signed } = options;
|
|
2314
|
-
if (options.size)
|
|
2315
|
-
assertSize3(hex, options.size);
|
|
2316
|
-
const value = BigInt(hex);
|
|
2317
|
-
if (!signed)
|
|
2318
|
-
return value;
|
|
2319
|
-
const size4 = (hex.length - 2) / 2;
|
|
2320
|
-
const max_unsigned = (1n << BigInt(size4) * 8n) - 1n;
|
|
2321
|
-
const max_signed = max_unsigned >> 1n;
|
|
2322
|
-
if (value <= max_signed)
|
|
2323
|
-
return value;
|
|
2324
|
-
return value - max_unsigned - 1n;
|
|
2325
|
-
}
|
|
2326
|
-
function toNumber(hex, options = {}) {
|
|
2327
|
-
const { signed, size: size4 } = options;
|
|
2328
|
-
if (!signed && !size4)
|
|
2329
|
-
return Number(hex);
|
|
2330
|
-
return Number(toBigInt(hex, options));
|
|
2331
|
-
}
|
|
2332
|
-
function validate(value, options = {}) {
|
|
2333
|
-
const { strict = false } = options;
|
|
2334
|
-
try {
|
|
2335
|
-
assert(value, { strict });
|
|
2336
|
-
return true;
|
|
2337
|
-
} catch {
|
|
2338
|
-
return false;
|
|
2339
|
-
}
|
|
2340
|
-
}
|
|
2341
|
-
var IntegerOutOfRangeError2 = class extends BaseError2 {
|
|
2342
|
-
constructor({ max, min, signed, size: size4, value }) {
|
|
2343
|
-
super(`Number \`${value}\` is not in safe${size4 ? ` ${size4 * 8}-bit` : ""}${signed ? " signed" : " unsigned"} integer range ${max ? `(\`${min}\` to \`${max}\`)` : `(above \`${min}\`)`}`);
|
|
2344
|
-
Object.defineProperty(this, "name", {
|
|
2345
|
-
enumerable: true,
|
|
2346
|
-
configurable: true,
|
|
2347
|
-
writable: true,
|
|
2348
|
-
value: "Hex.IntegerOutOfRangeError"
|
|
2349
|
-
});
|
|
2350
|
-
}
|
|
2351
|
-
};
|
|
2352
|
-
var InvalidHexTypeError = class extends BaseError2 {
|
|
2353
|
-
constructor(value) {
|
|
2354
|
-
super(`Value \`${typeof value === "object" ? stringify2(value) : value}\` of type \`${typeof value}\` is an invalid hex type.`, {
|
|
2355
|
-
metaMessages: ['Hex types must be represented as `"0x${string}"`.']
|
|
2356
|
-
});
|
|
2357
|
-
Object.defineProperty(this, "name", {
|
|
2358
|
-
enumerable: true,
|
|
2359
|
-
configurable: true,
|
|
2360
|
-
writable: true,
|
|
2361
|
-
value: "Hex.InvalidHexTypeError"
|
|
2362
|
-
});
|
|
2363
|
-
}
|
|
2364
|
-
};
|
|
2365
|
-
var InvalidHexValueError2 = class extends BaseError2 {
|
|
2366
|
-
constructor(value) {
|
|
2367
|
-
super(`Value \`${value}\` is an invalid hex value.`, {
|
|
2368
|
-
metaMessages: [
|
|
2369
|
-
'Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).'
|
|
2370
|
-
]
|
|
2371
|
-
});
|
|
2372
|
-
Object.defineProperty(this, "name", {
|
|
2373
|
-
enumerable: true,
|
|
2374
|
-
configurable: true,
|
|
2375
|
-
writable: true,
|
|
2376
|
-
value: "Hex.InvalidHexValueError"
|
|
2377
|
-
});
|
|
2378
|
-
}
|
|
2379
|
-
};
|
|
2380
|
-
var SizeOverflowError3 = class extends BaseError2 {
|
|
2381
|
-
constructor({ givenSize, maxSize }) {
|
|
2382
|
-
super(`Size cannot exceed \`${maxSize}\` bytes. Given size: \`${givenSize}\` bytes.`);
|
|
2383
|
-
Object.defineProperty(this, "name", {
|
|
2384
|
-
enumerable: true,
|
|
2385
|
-
configurable: true,
|
|
2386
|
-
writable: true,
|
|
2387
|
-
value: "Hex.SizeOverflowError"
|
|
2154
|
+
}
|
|
2155
|
+
function assertStartOffset3(value, start) {
|
|
2156
|
+
if (typeof start === "number" && start > 0 && start > size3(value) - 1)
|
|
2157
|
+
throw new SliceOffsetOutOfBoundsError3({
|
|
2158
|
+
offset: start,
|
|
2159
|
+
position: "start",
|
|
2160
|
+
size: size3(value)
|
|
2388
2161
|
});
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
configurable: true,
|
|
2397
|
-
writable: true,
|
|
2398
|
-
value: "Hex.SliceOffsetOutOfBoundsError"
|
|
2162
|
+
}
|
|
2163
|
+
function assertEndOffset3(value, start, end) {
|
|
2164
|
+
if (typeof start === "number" && typeof end === "number" && size3(value) !== end - start) {
|
|
2165
|
+
throw new SliceOffsetOutOfBoundsError3({
|
|
2166
|
+
offset: end,
|
|
2167
|
+
position: "end",
|
|
2168
|
+
size: size3(value)
|
|
2399
2169
|
});
|
|
2400
2170
|
}
|
|
2401
|
-
}
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2171
|
+
}
|
|
2172
|
+
function pad3(hex_, options = {}) {
|
|
2173
|
+
const { dir, size: size4 = 32 } = options;
|
|
2174
|
+
if (size4 === 0)
|
|
2175
|
+
return hex_;
|
|
2176
|
+
const hex = hex_.replace("0x", "");
|
|
2177
|
+
if (hex.length > size4 * 2)
|
|
2178
|
+
throw new SizeExceedsPaddingSizeError3({
|
|
2179
|
+
size: Math.ceil(hex.length / 2),
|
|
2180
|
+
targetSize: size4,
|
|
2181
|
+
type: "Hex"
|
|
2410
2182
|
});
|
|
2183
|
+
return `0x${hex[dir === "right" ? "padEnd" : "padStart"](size4 * 2, "0")}`;
|
|
2184
|
+
}
|
|
2185
|
+
function trim3(value, options = {}) {
|
|
2186
|
+
const { dir = "left" } = options;
|
|
2187
|
+
let data = value.replace("0x", "");
|
|
2188
|
+
let sliceLength = 0;
|
|
2189
|
+
for (let i = 0; i < data.length - 1; i++) {
|
|
2190
|
+
if (data[dir === "left" ? i : data.length - i - 1].toString() === "0")
|
|
2191
|
+
sliceLength++;
|
|
2192
|
+
else
|
|
2193
|
+
break;
|
|
2411
2194
|
}
|
|
2412
|
-
|
|
2195
|
+
data = dir === "left" ? data.slice(sliceLength) : data.slice(0, data.length - sliceLength);
|
|
2196
|
+
if (data === "0")
|
|
2197
|
+
return "0x";
|
|
2198
|
+
if (dir === "right" && data.length % 2 === 1)
|
|
2199
|
+
return `0x${data}0`;
|
|
2200
|
+
return `0x${data}`;
|
|
2201
|
+
}
|
|
2202
|
+
|
|
2203
|
+
// node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.4.3/node_modules/ox/_esm/core/Json.js
|
|
2204
|
+
var bigIntSuffix = "#__bigint";
|
|
2205
|
+
function stringify2(value, replacer, space) {
|
|
2206
|
+
return JSON.stringify(value, (key, value2) => {
|
|
2207
|
+
if (typeof replacer === "function")
|
|
2208
|
+
return replacer(key, value2);
|
|
2209
|
+
if (typeof value2 === "bigint")
|
|
2210
|
+
return value2.toString() + bigIntSuffix;
|
|
2211
|
+
return value2;
|
|
2212
|
+
}, space);
|
|
2213
|
+
}
|
|
2413
2214
|
|
|
2414
2215
|
// node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.4.3/node_modules/ox/_esm/core/Bytes.js
|
|
2415
2216
|
var decoder = /* @__PURE__ */ new TextDecoder();
|
|
2416
|
-
var
|
|
2417
|
-
function
|
|
2217
|
+
var encoder3 = /* @__PURE__ */ new TextEncoder();
|
|
2218
|
+
function assert(value) {
|
|
2418
2219
|
if (value instanceof Uint8Array)
|
|
2419
2220
|
return;
|
|
2420
2221
|
if (!value)
|
|
@@ -2426,7 +2227,7 @@ function assert2(value) {
|
|
|
2426
2227
|
if (value.BYTES_PER_ELEMENT !== 1 || value.constructor.name !== "Uint8Array")
|
|
2427
2228
|
throw new InvalidBytesTypeError(value);
|
|
2428
2229
|
}
|
|
2429
|
-
function
|
|
2230
|
+
function concat2(...values) {
|
|
2430
2231
|
let length = 0;
|
|
2431
2232
|
for (const arr of values) {
|
|
2432
2233
|
length += arr.length;
|
|
@@ -2439,7 +2240,7 @@ function concat3(...values) {
|
|
|
2439
2240
|
}
|
|
2440
2241
|
return result;
|
|
2441
2242
|
}
|
|
2442
|
-
function
|
|
2243
|
+
function from(value) {
|
|
2443
2244
|
if (value instanceof Uint8Array)
|
|
2444
2245
|
return value;
|
|
2445
2246
|
if (typeof value === "string")
|
|
@@ -2471,9 +2272,9 @@ function fromHex2(value, options = {}) {
|
|
|
2471
2272
|
}
|
|
2472
2273
|
return bytes;
|
|
2473
2274
|
}
|
|
2474
|
-
function
|
|
2275
|
+
function fromString(value, options = {}) {
|
|
2475
2276
|
const { size: size4 } = options;
|
|
2476
|
-
const bytes =
|
|
2277
|
+
const bytes = encoder3.encode(value);
|
|
2477
2278
|
if (typeof size4 === "number") {
|
|
2478
2279
|
assertSize2(bytes, size4);
|
|
2479
2280
|
return padRight2(bytes, size4);
|
|
@@ -2492,7 +2293,7 @@ function random(length) {
|
|
|
2492
2293
|
function size2(value) {
|
|
2493
2294
|
return value.length;
|
|
2494
2295
|
}
|
|
2495
|
-
function
|
|
2296
|
+
function slice2(value, start, end, options = {}) {
|
|
2496
2297
|
const { strict } = options;
|
|
2497
2298
|
assertStartOffset2(value, start);
|
|
2498
2299
|
const value_ = value.slice(start, end);
|
|
@@ -2512,7 +2313,7 @@ function toBoolean(bytes, options = {}) {
|
|
|
2512
2313
|
let bytes_ = bytes;
|
|
2513
2314
|
if (typeof size4 !== "undefined") {
|
|
2514
2315
|
assertSize2(bytes_, size4);
|
|
2515
|
-
bytes_ =
|
|
2316
|
+
bytes_ = trimLeft(bytes_);
|
|
2516
2317
|
}
|
|
2517
2318
|
if (bytes_.length > 1 || bytes_[0] > 1)
|
|
2518
2319
|
throw new InvalidBytesBooleanError2(bytes_);
|
|
@@ -2521,136 +2322,300 @@ function toBoolean(bytes, options = {}) {
|
|
|
2521
2322
|
function toHex2(value, options = {}) {
|
|
2522
2323
|
return fromBytes(value, options);
|
|
2523
2324
|
}
|
|
2524
|
-
function toNumber2(bytes, options = {}) {
|
|
2525
|
-
const { size: size4 } = options;
|
|
2526
|
-
if (typeof size4 !== "undefined")
|
|
2527
|
-
assertSize2(bytes, size4);
|
|
2528
|
-
const hex = fromBytes(bytes, options);
|
|
2529
|
-
return toNumber(hex, options);
|
|
2325
|
+
function toNumber2(bytes, options = {}) {
|
|
2326
|
+
const { size: size4 } = options;
|
|
2327
|
+
if (typeof size4 !== "undefined")
|
|
2328
|
+
assertSize2(bytes, size4);
|
|
2329
|
+
const hex = fromBytes(bytes, options);
|
|
2330
|
+
return toNumber(hex, options);
|
|
2331
|
+
}
|
|
2332
|
+
function toString(bytes, options = {}) {
|
|
2333
|
+
const { size: size4 } = options;
|
|
2334
|
+
let bytes_ = bytes;
|
|
2335
|
+
if (typeof size4 !== "undefined") {
|
|
2336
|
+
assertSize2(bytes_, size4);
|
|
2337
|
+
bytes_ = trimRight(bytes_);
|
|
2338
|
+
}
|
|
2339
|
+
return decoder.decode(bytes_);
|
|
2340
|
+
}
|
|
2341
|
+
function trimLeft(value) {
|
|
2342
|
+
return trim2(value, { dir: "left" });
|
|
2343
|
+
}
|
|
2344
|
+
function trimRight(value) {
|
|
2345
|
+
return trim2(value, { dir: "right" });
|
|
2346
|
+
}
|
|
2347
|
+
function validate(value) {
|
|
2348
|
+
try {
|
|
2349
|
+
assert(value);
|
|
2350
|
+
return true;
|
|
2351
|
+
} catch {
|
|
2352
|
+
return false;
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
var InvalidBytesBooleanError2 = class extends BaseError2 {
|
|
2356
|
+
constructor(bytes) {
|
|
2357
|
+
super(`Bytes value \`${bytes}\` is not a valid boolean.`, {
|
|
2358
|
+
metaMessages: [
|
|
2359
|
+
"The bytes array must contain a single byte of either a `0` or `1` value."
|
|
2360
|
+
]
|
|
2361
|
+
});
|
|
2362
|
+
Object.defineProperty(this, "name", {
|
|
2363
|
+
enumerable: true,
|
|
2364
|
+
configurable: true,
|
|
2365
|
+
writable: true,
|
|
2366
|
+
value: "Bytes.InvalidBytesBooleanError"
|
|
2367
|
+
});
|
|
2368
|
+
}
|
|
2369
|
+
};
|
|
2370
|
+
var InvalidBytesTypeError = class extends BaseError2 {
|
|
2371
|
+
constructor(value) {
|
|
2372
|
+
super(`Value \`${typeof value === "object" ? stringify2(value) : value}\` of type \`${typeof value}\` is an invalid Bytes value.`, {
|
|
2373
|
+
metaMessages: ["Bytes values must be of type `Bytes`."]
|
|
2374
|
+
});
|
|
2375
|
+
Object.defineProperty(this, "name", {
|
|
2376
|
+
enumerable: true,
|
|
2377
|
+
configurable: true,
|
|
2378
|
+
writable: true,
|
|
2379
|
+
value: "Bytes.InvalidBytesTypeError"
|
|
2380
|
+
});
|
|
2381
|
+
}
|
|
2382
|
+
};
|
|
2383
|
+
var SizeOverflowError2 = class extends BaseError2 {
|
|
2384
|
+
constructor({ givenSize, maxSize }) {
|
|
2385
|
+
super(`Size cannot exceed \`${maxSize}\` bytes. Given size: \`${givenSize}\` bytes.`);
|
|
2386
|
+
Object.defineProperty(this, "name", {
|
|
2387
|
+
enumerable: true,
|
|
2388
|
+
configurable: true,
|
|
2389
|
+
writable: true,
|
|
2390
|
+
value: "Bytes.SizeOverflowError"
|
|
2391
|
+
});
|
|
2392
|
+
}
|
|
2393
|
+
};
|
|
2394
|
+
var SliceOffsetOutOfBoundsError2 = class extends BaseError2 {
|
|
2395
|
+
constructor({ offset, position, size: size4 }) {
|
|
2396
|
+
super(`Slice ${position === "start" ? "starting" : "ending"} at offset \`${offset}\` is out-of-bounds (size: \`${size4}\`).`);
|
|
2397
|
+
Object.defineProperty(this, "name", {
|
|
2398
|
+
enumerable: true,
|
|
2399
|
+
configurable: true,
|
|
2400
|
+
writable: true,
|
|
2401
|
+
value: "Bytes.SliceOffsetOutOfBoundsError"
|
|
2402
|
+
});
|
|
2403
|
+
}
|
|
2404
|
+
};
|
|
2405
|
+
var SizeExceedsPaddingSizeError2 = class extends BaseError2 {
|
|
2406
|
+
constructor({ size: size4, targetSize, type }) {
|
|
2407
|
+
super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (\`${size4}\`) exceeds padding size (\`${targetSize}\`).`);
|
|
2408
|
+
Object.defineProperty(this, "name", {
|
|
2409
|
+
enumerable: true,
|
|
2410
|
+
configurable: true,
|
|
2411
|
+
writable: true,
|
|
2412
|
+
value: "Bytes.SizeExceedsPaddingSizeError"
|
|
2413
|
+
});
|
|
2414
|
+
}
|
|
2415
|
+
};
|
|
2416
|
+
|
|
2417
|
+
// node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.4.3/node_modules/ox/_esm/core/Hex.js
|
|
2418
|
+
var encoder4 = /* @__PURE__ */ new TextEncoder();
|
|
2419
|
+
var hexes2 = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0"));
|
|
2420
|
+
function assert2(value, options = {}) {
|
|
2421
|
+
const { strict = false } = options;
|
|
2422
|
+
if (!value)
|
|
2423
|
+
throw new InvalidHexTypeError(value);
|
|
2424
|
+
if (typeof value !== "string")
|
|
2425
|
+
throw new InvalidHexTypeError(value);
|
|
2426
|
+
if (strict) {
|
|
2427
|
+
if (!/^0x[0-9a-fA-F]*$/.test(value))
|
|
2428
|
+
throw new InvalidHexValueError2(value);
|
|
2429
|
+
}
|
|
2430
|
+
if (!value.startsWith("0x"))
|
|
2431
|
+
throw new InvalidHexValueError2(value);
|
|
2432
|
+
}
|
|
2433
|
+
function concat3(...values) {
|
|
2434
|
+
return `0x${values.reduce((acc, x) => acc + x.replace("0x", ""), "")}`;
|
|
2435
|
+
}
|
|
2436
|
+
function from2(value) {
|
|
2437
|
+
if (value instanceof Uint8Array)
|
|
2438
|
+
return fromBytes(value);
|
|
2439
|
+
if (Array.isArray(value))
|
|
2440
|
+
return fromBytes(new Uint8Array(value));
|
|
2441
|
+
return value;
|
|
2442
|
+
}
|
|
2443
|
+
function fromBoolean(value, options = {}) {
|
|
2444
|
+
const hex = `0x${Number(value)}`;
|
|
2445
|
+
if (typeof options.size === "number") {
|
|
2446
|
+
assertSize3(hex, options.size);
|
|
2447
|
+
return padLeft(hex, options.size);
|
|
2448
|
+
}
|
|
2449
|
+
return hex;
|
|
2450
|
+
}
|
|
2451
|
+
function fromBytes(value, options = {}) {
|
|
2452
|
+
let string = "";
|
|
2453
|
+
for (let i = 0; i < value.length; i++)
|
|
2454
|
+
string += hexes2[value[i]];
|
|
2455
|
+
const hex = `0x${string}`;
|
|
2456
|
+
if (typeof options.size === "number") {
|
|
2457
|
+
assertSize3(hex, options.size);
|
|
2458
|
+
return padRight(hex, options.size);
|
|
2459
|
+
}
|
|
2460
|
+
return hex;
|
|
2461
|
+
}
|
|
2462
|
+
function fromNumber(value, options = {}) {
|
|
2463
|
+
const { signed, size: size4 } = options;
|
|
2464
|
+
const value_ = BigInt(value);
|
|
2465
|
+
let maxValue;
|
|
2466
|
+
if (size4) {
|
|
2467
|
+
if (signed)
|
|
2468
|
+
maxValue = (1n << BigInt(size4) * 8n - 1n) - 1n;
|
|
2469
|
+
else
|
|
2470
|
+
maxValue = 2n ** (BigInt(size4) * 8n) - 1n;
|
|
2471
|
+
} else if (typeof value === "number") {
|
|
2472
|
+
maxValue = BigInt(Number.MAX_SAFE_INTEGER);
|
|
2473
|
+
}
|
|
2474
|
+
const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
|
|
2475
|
+
if (maxValue && value_ > maxValue || value_ < minValue) {
|
|
2476
|
+
const suffix = typeof value === "bigint" ? "n" : "";
|
|
2477
|
+
throw new IntegerOutOfRangeError2({
|
|
2478
|
+
max: maxValue ? `${maxValue}${suffix}` : void 0,
|
|
2479
|
+
min: `${minValue}${suffix}`,
|
|
2480
|
+
signed,
|
|
2481
|
+
size: size4,
|
|
2482
|
+
value: `${value}${suffix}`
|
|
2483
|
+
});
|
|
2484
|
+
}
|
|
2485
|
+
const stringValue = (signed && value_ < 0 ? BigInt.asUintN(size4 * 8, BigInt(value_)) : value_).toString(16);
|
|
2486
|
+
const hex = `0x${stringValue}`;
|
|
2487
|
+
if (size4)
|
|
2488
|
+
return padLeft(hex, size4);
|
|
2489
|
+
return hex;
|
|
2490
|
+
}
|
|
2491
|
+
function fromString2(value, options = {}) {
|
|
2492
|
+
return fromBytes(encoder4.encode(value), options);
|
|
2493
|
+
}
|
|
2494
|
+
function padLeft(value, size4) {
|
|
2495
|
+
return pad3(value, { dir: "left", size: size4 });
|
|
2496
|
+
}
|
|
2497
|
+
function padRight(value, size4) {
|
|
2498
|
+
return pad3(value, { dir: "right", size: size4 });
|
|
2499
|
+
}
|
|
2500
|
+
function slice3(value, start, end, options = {}) {
|
|
2501
|
+
const { strict } = options;
|
|
2502
|
+
assertStartOffset3(value, start);
|
|
2503
|
+
const value_ = `0x${value.replace("0x", "").slice((start ?? 0) * 2, (end ?? value.length) * 2)}`;
|
|
2504
|
+
if (strict)
|
|
2505
|
+
assertEndOffset3(value_, start, end);
|
|
2506
|
+
return value_;
|
|
2530
2507
|
}
|
|
2531
|
-
function
|
|
2532
|
-
|
|
2533
|
-
let bytes_ = bytes;
|
|
2534
|
-
if (typeof size4 !== "undefined") {
|
|
2535
|
-
assertSize2(bytes_, size4);
|
|
2536
|
-
bytes_ = trimRight(bytes_);
|
|
2537
|
-
}
|
|
2538
|
-
return decoder.decode(bytes_);
|
|
2508
|
+
function size3(value) {
|
|
2509
|
+
return Math.ceil((value.length - 2) / 2);
|
|
2539
2510
|
}
|
|
2540
2511
|
function trimLeft2(value) {
|
|
2541
|
-
return
|
|
2512
|
+
return trim3(value, { dir: "left" });
|
|
2542
2513
|
}
|
|
2543
|
-
function
|
|
2544
|
-
|
|
2514
|
+
function toBigInt(hex, options = {}) {
|
|
2515
|
+
const { signed } = options;
|
|
2516
|
+
if (options.size)
|
|
2517
|
+
assertSize3(hex, options.size);
|
|
2518
|
+
const value = BigInt(hex);
|
|
2519
|
+
if (!signed)
|
|
2520
|
+
return value;
|
|
2521
|
+
const size4 = (hex.length - 2) / 2;
|
|
2522
|
+
const max_unsigned = (1n << BigInt(size4) * 8n) - 1n;
|
|
2523
|
+
const max_signed = max_unsigned >> 1n;
|
|
2524
|
+
if (value <= max_signed)
|
|
2525
|
+
return value;
|
|
2526
|
+
return value - max_unsigned - 1n;
|
|
2545
2527
|
}
|
|
2546
|
-
function
|
|
2528
|
+
function toNumber(hex, options = {}) {
|
|
2529
|
+
const { signed, size: size4 } = options;
|
|
2530
|
+
if (!signed && !size4)
|
|
2531
|
+
return Number(hex);
|
|
2532
|
+
return Number(toBigInt(hex, options));
|
|
2533
|
+
}
|
|
2534
|
+
function validate2(value, options = {}) {
|
|
2535
|
+
const { strict = false } = options;
|
|
2547
2536
|
try {
|
|
2548
|
-
assert2(value);
|
|
2537
|
+
assert2(value, { strict });
|
|
2549
2538
|
return true;
|
|
2550
2539
|
} catch {
|
|
2551
2540
|
return false;
|
|
2552
2541
|
}
|
|
2553
2542
|
}
|
|
2554
|
-
var
|
|
2555
|
-
constructor(
|
|
2556
|
-
super(`
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2543
|
+
var IntegerOutOfRangeError2 = class extends BaseError2 {
|
|
2544
|
+
constructor({ max, min, signed, size: size4, value }) {
|
|
2545
|
+
super(`Number \`${value}\` is not in safe${size4 ? ` ${size4 * 8}-bit` : ""}${signed ? " signed" : " unsigned"} integer range ${max ? `(\`${min}\` to \`${max}\`)` : `(above \`${min}\`)`}`);
|
|
2546
|
+
Object.defineProperty(this, "name", {
|
|
2547
|
+
enumerable: true,
|
|
2548
|
+
configurable: true,
|
|
2549
|
+
writable: true,
|
|
2550
|
+
value: "Hex.IntegerOutOfRangeError"
|
|
2551
|
+
});
|
|
2552
|
+
}
|
|
2553
|
+
};
|
|
2554
|
+
var InvalidHexTypeError = class extends BaseError2 {
|
|
2555
|
+
constructor(value) {
|
|
2556
|
+
super(`Value \`${typeof value === "object" ? stringify2(value) : value}\` of type \`${typeof value}\` is an invalid hex type.`, {
|
|
2557
|
+
metaMessages: ['Hex types must be represented as `"0x${string}"`.']
|
|
2560
2558
|
});
|
|
2561
2559
|
Object.defineProperty(this, "name", {
|
|
2562
2560
|
enumerable: true,
|
|
2563
2561
|
configurable: true,
|
|
2564
2562
|
writable: true,
|
|
2565
|
-
value: "
|
|
2563
|
+
value: "Hex.InvalidHexTypeError"
|
|
2566
2564
|
});
|
|
2567
2565
|
}
|
|
2568
2566
|
};
|
|
2569
|
-
var
|
|
2567
|
+
var InvalidHexValueError2 = class extends BaseError2 {
|
|
2570
2568
|
constructor(value) {
|
|
2571
|
-
super(`Value \`${
|
|
2572
|
-
metaMessages: [
|
|
2569
|
+
super(`Value \`${value}\` is an invalid hex value.`, {
|
|
2570
|
+
metaMessages: [
|
|
2571
|
+
'Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).'
|
|
2572
|
+
]
|
|
2573
2573
|
});
|
|
2574
2574
|
Object.defineProperty(this, "name", {
|
|
2575
2575
|
enumerable: true,
|
|
2576
2576
|
configurable: true,
|
|
2577
2577
|
writable: true,
|
|
2578
|
-
value: "
|
|
2578
|
+
value: "Hex.InvalidHexValueError"
|
|
2579
2579
|
});
|
|
2580
2580
|
}
|
|
2581
2581
|
};
|
|
2582
|
-
var
|
|
2582
|
+
var SizeOverflowError3 = class extends BaseError2 {
|
|
2583
2583
|
constructor({ givenSize, maxSize }) {
|
|
2584
2584
|
super(`Size cannot exceed \`${maxSize}\` bytes. Given size: \`${givenSize}\` bytes.`);
|
|
2585
2585
|
Object.defineProperty(this, "name", {
|
|
2586
2586
|
enumerable: true,
|
|
2587
2587
|
configurable: true,
|
|
2588
2588
|
writable: true,
|
|
2589
|
-
value: "
|
|
2589
|
+
value: "Hex.SizeOverflowError"
|
|
2590
2590
|
});
|
|
2591
2591
|
}
|
|
2592
2592
|
};
|
|
2593
|
-
var
|
|
2593
|
+
var SliceOffsetOutOfBoundsError3 = class extends BaseError2 {
|
|
2594
2594
|
constructor({ offset, position, size: size4 }) {
|
|
2595
2595
|
super(`Slice ${position === "start" ? "starting" : "ending"} at offset \`${offset}\` is out-of-bounds (size: \`${size4}\`).`);
|
|
2596
2596
|
Object.defineProperty(this, "name", {
|
|
2597
2597
|
enumerable: true,
|
|
2598
2598
|
configurable: true,
|
|
2599
2599
|
writable: true,
|
|
2600
|
-
value: "
|
|
2600
|
+
value: "Hex.SliceOffsetOutOfBoundsError"
|
|
2601
2601
|
});
|
|
2602
2602
|
}
|
|
2603
2603
|
};
|
|
2604
|
-
var
|
|
2604
|
+
var SizeExceedsPaddingSizeError3 = class extends BaseError2 {
|
|
2605
2605
|
constructor({ size: size4, targetSize, type }) {
|
|
2606
2606
|
super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (\`${size4}\`) exceeds padding size (\`${targetSize}\`).`);
|
|
2607
2607
|
Object.defineProperty(this, "name", {
|
|
2608
2608
|
enumerable: true,
|
|
2609
2609
|
configurable: true,
|
|
2610
2610
|
writable: true,
|
|
2611
|
-
value: "
|
|
2611
|
+
value: "Hex.SizeExceedsPaddingSizeError"
|
|
2612
2612
|
});
|
|
2613
2613
|
}
|
|
2614
2614
|
};
|
|
2615
2615
|
|
|
2616
2616
|
export {
|
|
2617
|
-
formatAbiItem,
|
|
2618
|
-
isHex,
|
|
2619
|
-
size,
|
|
2620
2617
|
setErrorConfig,
|
|
2621
2618
|
BaseError,
|
|
2622
|
-
AbiConstructorNotFoundError,
|
|
2623
|
-
AbiConstructorParamsNotFoundError,
|
|
2624
|
-
AbiDecodingDataSizeInvalidError,
|
|
2625
|
-
AbiDecodingDataSizeTooSmallError,
|
|
2626
|
-
AbiDecodingZeroDataError,
|
|
2627
|
-
AbiEncodingArrayLengthMismatchError,
|
|
2628
|
-
AbiEncodingBytesSizeMismatchError,
|
|
2629
|
-
AbiEncodingLengthMismatchError,
|
|
2630
|
-
AbiErrorInputsNotFoundError,
|
|
2631
|
-
AbiErrorNotFoundError,
|
|
2632
|
-
AbiErrorSignatureNotFoundError,
|
|
2633
|
-
AbiEventSignatureEmptyTopicsError,
|
|
2634
|
-
AbiEventSignatureNotFoundError,
|
|
2635
|
-
AbiEventNotFoundError,
|
|
2636
|
-
AbiFunctionNotFoundError,
|
|
2637
|
-
AbiFunctionOutputsNotFoundError,
|
|
2638
|
-
AbiFunctionSignatureNotFoundError,
|
|
2639
|
-
AbiItemAmbiguityError,
|
|
2640
|
-
BytesSizeMismatchError,
|
|
2641
|
-
DecodeLogDataMismatch,
|
|
2642
|
-
DecodeLogTopicsMismatch,
|
|
2643
|
-
InvalidAbiEncodingTypeError,
|
|
2644
|
-
InvalidAbiDecodingTypeError,
|
|
2645
|
-
InvalidArrayError,
|
|
2646
|
-
InvalidDefinitionTypeError,
|
|
2647
|
-
UnsupportedPackedAbiType,
|
|
2648
|
-
SliceOffsetOutOfBoundsError,
|
|
2649
|
-
SizeExceedsPaddingSizeError,
|
|
2650
|
-
InvalidBytesLengthError,
|
|
2651
|
-
pad,
|
|
2652
|
-
padHex,
|
|
2653
|
-
padBytes,
|
|
2654
2619
|
IntegerOutOfRangeError,
|
|
2655
2620
|
InvalidBytesBooleanError,
|
|
2656
2621
|
InvalidHexBooleanError,
|
|
@@ -2659,7 +2624,20 @@ export {
|
|
|
2659
2624
|
RlpListBoundaryExceededError,
|
|
2660
2625
|
RlpTrailingBytesError,
|
|
2661
2626
|
SizeOverflowError,
|
|
2627
|
+
SliceOffsetOutOfBoundsError,
|
|
2628
|
+
SizeExceedsPaddingSizeError,
|
|
2629
|
+
InvalidBytesLengthError,
|
|
2630
|
+
pad,
|
|
2631
|
+
padHex,
|
|
2632
|
+
padBytes,
|
|
2633
|
+
isHex,
|
|
2634
|
+
size,
|
|
2662
2635
|
trim,
|
|
2636
|
+
toBytes,
|
|
2637
|
+
boolToBytes,
|
|
2638
|
+
hexToBytes,
|
|
2639
|
+
numberToBytes,
|
|
2640
|
+
stringToBytes,
|
|
2663
2641
|
assertSize,
|
|
2664
2642
|
fromHex,
|
|
2665
2643
|
hexToBigInt,
|
|
@@ -2671,32 +2649,18 @@ export {
|
|
|
2671
2649
|
bytesToHex,
|
|
2672
2650
|
numberToHex,
|
|
2673
2651
|
stringToHex,
|
|
2674
|
-
|
|
2675
|
-
boolToBytes,
|
|
2676
|
-
hexToBytes,
|
|
2677
|
-
numberToBytes,
|
|
2678
|
-
stringToBytes,
|
|
2679
|
-
keccak256,
|
|
2680
|
-
InvalidAddressError,
|
|
2652
|
+
formatBlockParameter,
|
|
2681
2653
|
LruMap,
|
|
2654
|
+
InvalidAddressError,
|
|
2655
|
+
keccak256,
|
|
2682
2656
|
checksumAddress,
|
|
2683
2657
|
getAddress,
|
|
2684
2658
|
isAddress,
|
|
2685
2659
|
concat,
|
|
2686
2660
|
concatBytes,
|
|
2687
2661
|
concatHex,
|
|
2688
|
-
slice,
|
|
2689
|
-
sliceBytes,
|
|
2690
|
-
sliceHex,
|
|
2691
|
-
arrayRegex,
|
|
2692
|
-
bytesRegex,
|
|
2693
|
-
integerRegex,
|
|
2694
|
-
encodeAbiParameters,
|
|
2695
|
-
getArrayComponents,
|
|
2696
|
-
parseAccount,
|
|
2697
2662
|
PositionOutOfBoundsError,
|
|
2698
2663
|
createCursor,
|
|
2699
|
-
stringify,
|
|
2700
2664
|
etherUnits,
|
|
2701
2665
|
gweiUnits,
|
|
2702
2666
|
weiUnits,
|
|
@@ -2716,18 +2680,6 @@ export {
|
|
|
2716
2680
|
TransactionReceiptNotFoundError,
|
|
2717
2681
|
TransactionReceiptRevertedError,
|
|
2718
2682
|
WaitForTransactionReceiptTimeoutError,
|
|
2719
|
-
ExecutionRevertedError,
|
|
2720
|
-
FeeCapTooHighError,
|
|
2721
|
-
FeeCapTooLowError,
|
|
2722
|
-
NonceTooHighError,
|
|
2723
|
-
NonceTooLowError,
|
|
2724
|
-
NonceMaxValueError,
|
|
2725
|
-
InsufficientFundsError,
|
|
2726
|
-
IntrinsicGasTooHighError,
|
|
2727
|
-
IntrinsicGasTooLowError,
|
|
2728
|
-
TransactionTypeNotSupportedError,
|
|
2729
|
-
TipAboveFeeCapError,
|
|
2730
|
-
UnknownNodeError,
|
|
2731
2683
|
maxInt8,
|
|
2732
2684
|
maxInt16,
|
|
2733
2685
|
maxInt24,
|
|
@@ -2824,42 +2776,90 @@ export {
|
|
|
2824
2776
|
maxUint240,
|
|
2825
2777
|
maxUint248,
|
|
2826
2778
|
maxUint256,
|
|
2827
|
-
|
|
2779
|
+
ChainDoesNotSupportContract,
|
|
2780
|
+
ChainMismatchError,
|
|
2781
|
+
ChainNotFoundError,
|
|
2782
|
+
ClientChainNotConfiguredError,
|
|
2783
|
+
InvalidChainIdError,
|
|
2784
|
+
ExecutionRevertedError,
|
|
2785
|
+
FeeCapTooHighError,
|
|
2786
|
+
FeeCapTooLowError,
|
|
2787
|
+
NonceTooHighError,
|
|
2788
|
+
NonceTooLowError,
|
|
2789
|
+
NonceMaxValueError,
|
|
2790
|
+
InsufficientFundsError,
|
|
2791
|
+
IntrinsicGasTooHighError,
|
|
2792
|
+
IntrinsicGasTooLowError,
|
|
2793
|
+
TransactionTypeNotSupportedError,
|
|
2794
|
+
TipAboveFeeCapError,
|
|
2795
|
+
UnknownNodeError,
|
|
2796
|
+
slice,
|
|
2797
|
+
sliceBytes,
|
|
2798
|
+
sliceHex,
|
|
2799
|
+
formatAbiItem,
|
|
2800
|
+
AbiConstructorNotFoundError,
|
|
2801
|
+
AbiConstructorParamsNotFoundError,
|
|
2802
|
+
AbiDecodingDataSizeInvalidError,
|
|
2803
|
+
AbiDecodingDataSizeTooSmallError,
|
|
2804
|
+
AbiDecodingZeroDataError,
|
|
2805
|
+
AbiEncodingArrayLengthMismatchError,
|
|
2806
|
+
AbiEncodingBytesSizeMismatchError,
|
|
2807
|
+
AbiEncodingLengthMismatchError,
|
|
2808
|
+
AbiErrorInputsNotFoundError,
|
|
2809
|
+
AbiErrorNotFoundError,
|
|
2810
|
+
AbiErrorSignatureNotFoundError,
|
|
2811
|
+
AbiEventSignatureEmptyTopicsError,
|
|
2812
|
+
AbiEventSignatureNotFoundError,
|
|
2813
|
+
AbiEventNotFoundError,
|
|
2814
|
+
AbiFunctionNotFoundError,
|
|
2815
|
+
AbiFunctionOutputsNotFoundError,
|
|
2816
|
+
AbiFunctionSignatureNotFoundError,
|
|
2817
|
+
AbiItemAmbiguityError,
|
|
2818
|
+
BytesSizeMismatchError,
|
|
2819
|
+
DecodeLogDataMismatch,
|
|
2820
|
+
DecodeLogTopicsMismatch,
|
|
2821
|
+
InvalidAbiEncodingTypeError,
|
|
2822
|
+
InvalidAbiDecodingTypeError,
|
|
2823
|
+
InvalidArrayError,
|
|
2824
|
+
InvalidDefinitionTypeError,
|
|
2825
|
+
UnsupportedPackedAbiType,
|
|
2826
|
+
arrayRegex,
|
|
2827
|
+
bytesRegex,
|
|
2828
|
+
integerRegex,
|
|
2829
|
+
encodeAbiParameters,
|
|
2830
|
+
getArrayComponents,
|
|
2831
|
+
stringify,
|
|
2832
|
+
parseAccount,
|
|
2828
2833
|
BaseError2,
|
|
2829
2834
|
stringify2,
|
|
2830
2835
|
concat3 as concat2,
|
|
2831
2836
|
from2 as from,
|
|
2832
|
-
|
|
2837
|
+
fromBoolean,
|
|
2838
|
+
fromBytes,
|
|
2839
|
+
fromNumber,
|
|
2833
2840
|
fromString2 as fromString,
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
size2,
|
|
2841
|
+
padLeft,
|
|
2842
|
+
padRight,
|
|
2837
2843
|
slice3 as slice2,
|
|
2838
|
-
|
|
2839
|
-
toBoolean,
|
|
2840
|
-
toHex2,
|
|
2841
|
-
toNumber2 as toNumber,
|
|
2842
|
-
toString,
|
|
2844
|
+
size3 as size2,
|
|
2843
2845
|
trimLeft2 as trimLeft,
|
|
2846
|
+
toNumber,
|
|
2844
2847
|
validate2 as validate,
|
|
2848
|
+
IntegerOutOfRangeError2,
|
|
2845
2849
|
concat2 as concat3,
|
|
2846
2850
|
from as from2,
|
|
2847
|
-
|
|
2848
|
-
fromBytes,
|
|
2849
|
-
fromNumber,
|
|
2851
|
+
fromHex2,
|
|
2850
2852
|
fromString as fromString2,
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
+
isEqual,
|
|
2854
|
+
random,
|
|
2855
|
+
size2 as size3,
|
|
2853
2856
|
slice2 as slice3,
|
|
2854
|
-
|
|
2857
|
+
toBigInt2 as toBigInt,
|
|
2858
|
+
toBoolean,
|
|
2859
|
+
toHex2,
|
|
2860
|
+
toNumber2,
|
|
2861
|
+
toString,
|
|
2855
2862
|
trimLeft as trimLeft2,
|
|
2856
|
-
|
|
2857
|
-
validate as validate2,
|
|
2858
|
-
IntegerOutOfRangeError2,
|
|
2859
|
-
ChainDoesNotSupportContract,
|
|
2860
|
-
ChainMismatchError,
|
|
2861
|
-
ChainNotFoundError,
|
|
2862
|
-
ClientChainNotConfiguredError,
|
|
2863
|
-
InvalidChainIdError
|
|
2863
|
+
validate as validate2
|
|
2864
2864
|
};
|
|
2865
|
-
//# sourceMappingURL=chunk-
|
|
2865
|
+
//# sourceMappingURL=chunk-EGELTSPU.js.map
|