tenjin-cli 0.1.0-alpha.1 → 0.1.0-alpha.2

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.
Files changed (133) hide show
  1. package/NOTICE.md +33 -0
  2. package/README.md +164 -16
  3. package/dist/{_esm-ZH2J4QEH.js → _esm-C5CRWCYU.js} +2 -2
  4. package/dist/_esm-FEASBWRP.js +881 -0
  5. package/dist/buy-U35DQ6XM.js +1598 -0
  6. package/dist/buy-U35DQ6XM.js.map +1 -0
  7. package/dist/candidate-RLYCQMF5.js +127 -0
  8. package/dist/candidate-RLYCQMF5.js.map +1 -0
  9. package/dist/{ccip-UCLT5VOW.js → ccip-NQXCEK2U.js} +6 -5
  10. package/dist/ccip-XR5NE5QK.js +19 -0
  11. package/dist/chunk-27ONARHV.js +171 -0
  12. package/dist/chunk-27ONARHV.js.map +1 -0
  13. package/dist/chunk-2I4QTOLB.js +11 -0
  14. package/dist/chunk-2I4QTOLB.js.map +1 -0
  15. package/dist/chunk-3OV7E5G5.js +18 -0
  16. package/dist/chunk-3OV7E5G5.js.map +1 -0
  17. package/dist/chunk-5CLSD5YN.js +209 -0
  18. package/dist/chunk-5CLSD5YN.js.map +1 -0
  19. package/dist/chunk-7KUW4MJD.js +59 -0
  20. package/dist/chunk-7KUW4MJD.js.map +1 -0
  21. package/dist/{doctor-3QBYN46N.js → chunk-7PHSZKQS.js} +88 -93
  22. package/dist/chunk-7PHSZKQS.js.map +1 -0
  23. package/dist/chunk-CYOF7ROH.js +70 -0
  24. package/dist/chunk-CYOF7ROH.js.map +1 -0
  25. package/dist/chunk-HIVZG55D.js +204 -0
  26. package/dist/chunk-HIVZG55D.js.map +1 -0
  27. package/dist/chunk-HSDCI7OV.js +7806 -0
  28. package/dist/chunk-HSDCI7OV.js.map +1 -0
  29. package/dist/{chunk-EZROUI5U.js → chunk-IYLHQMT5.js} +85 -9
  30. package/dist/chunk-IYLHQMT5.js.map +1 -0
  31. package/dist/chunk-JPHG2JW3.js +96 -0
  32. package/dist/chunk-JPHG2JW3.js.map +1 -0
  33. package/dist/{chunk-ZPZFPVDN.js → chunk-MUBUQVC3.js} +1 -1
  34. package/dist/chunk-MUBUQVC3.js.map +1 -0
  35. package/dist/chunk-N62ROTMC.js +79 -0
  36. package/dist/chunk-N62ROTMC.js.map +1 -0
  37. package/dist/{chunk-T4LKNY7T.js → chunk-NCE5NSN6.js} +166 -11
  38. package/dist/chunk-NCE5NSN6.js.map +1 -0
  39. package/dist/{chunk-YG2DO46P.js → chunk-OYMYCW7J.js} +18 -3
  40. package/dist/{chunk-YG2DO46P.js.map → chunk-OYMYCW7J.js.map} +1 -1
  41. package/dist/chunk-QNP7H47L.js +152 -0
  42. package/dist/chunk-QNP7H47L.js.map +1 -0
  43. package/dist/{chunk-Q53IYV2G.js → chunk-QVX5MWJZ.js} +20 -17
  44. package/dist/{chunk-Q53IYV2G.js.map → chunk-QVX5MWJZ.js.map} +1 -1
  45. package/dist/{chunk-CUWUHTIL.js → chunk-RBJPAZFI.js} +16 -202
  46. package/dist/chunk-RBJPAZFI.js.map +1 -0
  47. package/dist/chunk-RRN3YTK7.js +6199 -0
  48. package/dist/chunk-RRN3YTK7.js.map +1 -0
  49. package/dist/chunk-RY4XKNV3.js +140 -0
  50. package/dist/chunk-RY4XKNV3.js.map +1 -0
  51. package/dist/chunk-S3IGX57D.js +14682 -0
  52. package/dist/chunk-S3IGX57D.js.map +1 -0
  53. package/dist/{config-CEFTL5ZL.js → chunk-TFGSOPWR.js} +115 -18
  54. package/dist/chunk-TFGSOPWR.js.map +1 -0
  55. package/dist/chunk-TLCMMYLY.js +126 -0
  56. package/dist/chunk-TLCMMYLY.js.map +1 -0
  57. package/dist/{chunk-IPOWB3G3.js → chunk-UGX7YPX2.js} +3314 -306
  58. package/dist/chunk-UGX7YPX2.js.map +1 -0
  59. package/dist/chunk-UO22YNY4.js +69 -0
  60. package/dist/chunk-UO22YNY4.js.map +1 -0
  61. package/dist/chunk-UPIEAMGH.js +160 -0
  62. package/dist/chunk-UPIEAMGH.js.map +1 -0
  63. package/dist/chunk-XJIW7USF.js +217 -0
  64. package/dist/chunk-XJIW7USF.js.map +1 -0
  65. package/dist/{chunk-BRJHUQSY.js → chunk-YALGASEU.js} +1548 -1452
  66. package/dist/chunk-YALGASEU.js.map +1 -0
  67. package/dist/chunk-YIYQ2ZNT.js +286 -0
  68. package/dist/chunk-YIYQ2ZNT.js.map +1 -0
  69. package/dist/{chunk-DXPYFVKG.js → chunk-YN5SHIXQ.js} +6 -6
  70. package/dist/chunk-YN5SHIXQ.js.map +1 -0
  71. package/dist/chunk-Z52RA3NC.js +137 -0
  72. package/dist/chunk-Z52RA3NC.js.map +1 -0
  73. package/dist/{chunk-EXBMF5X7.js → chunk-Z6MFJV5Z.js} +151 -19
  74. package/dist/chunk-Z6MFJV5Z.js.map +1 -0
  75. package/dist/chunk-ZABPQJ3M.js +83 -0
  76. package/dist/chunk-ZABPQJ3M.js.map +1 -0
  77. package/dist/{chunk-LPRVHM7P.js → chunk-ZMHYXMO6.js} +1655 -114
  78. package/dist/chunk-ZMHYXMO6.js.map +1 -0
  79. package/dist/{chunk-3IMLRUZE.js → chunk-ZXTAQYNA.js} +6 -2
  80. package/dist/{cli-WA65NP4Y.js → cli-4NNBEQYH.js} +177 -177
  81. package/dist/cli-4NNBEQYH.js.map +1 -0
  82. package/dist/config-2VSXWWHK.js +21 -0
  83. package/dist/doctor-JJPNIBYH.js +20 -0
  84. package/dist/doctor-JJPNIBYH.js.map +1 -0
  85. package/dist/ethersCompat-Df4a6QIZ-3YZIAXDK.js +18 -0
  86. package/dist/ethersCompat-Df4a6QIZ-3YZIAXDK.js.map +1 -0
  87. package/dist/index.js +1 -1
  88. package/dist/inspect-JGYJWFDP.js +96 -0
  89. package/dist/inspect-JGYJWFDP.js.map +1 -0
  90. package/dist/install-ZQRMSRGW.js +378 -0
  91. package/dist/install-ZQRMSRGW.js.map +1 -0
  92. package/dist/lookup-WYVTOMVY.js +113 -0
  93. package/dist/lookup-WYVTOMVY.js.map +1 -0
  94. package/dist/{mine.wasm-GQECMSGN.js → mine.wasm-6PIT3DK6.js} +2 -2
  95. package/dist/outcome-HKKT6QIA.js +66 -0
  96. package/dist/outcome-HKKT6QIA.js.map +1 -0
  97. package/dist/publish-D76B3MBK.js +1480 -0
  98. package/dist/publish-D76B3MBK.js.map +1 -0
  99. package/dist/{secp256k1-BEZS642W.js → secp256k1-N3ZHU7LB.js} +5 -4
  100. package/dist/secp256k1-N3ZHU7LB.js.map +1 -0
  101. package/dist/usdc-JIAJW4SV.js +22 -0
  102. package/dist/usdc-JIAJW4SV.js.map +1 -0
  103. package/dist/viemAdapter-By13KInL-ZZE6UV4Y.js +14 -0
  104. package/dist/viemAdapter-By13KInL-ZZE6UV4Y.js.map +1 -0
  105. package/dist/{wallet-XD576HF3.js → wallet-6QKS6UHW.js} +28 -22
  106. package/dist/{wallet-XD576HF3.js.map → wallet-6QKS6UHW.js.map} +1 -1
  107. package/dist/wallet-PA54CRBL.js +30 -0
  108. package/dist/wallet-PA54CRBL.js.map +1 -0
  109. package/package.json +19 -16
  110. package/skills/tenjin/SKILL.md +199 -0
  111. package/skills/tenjin-publish/SKILL.md +96 -0
  112. package/skills/tenjin-search/SKILL.md +122 -0
  113. package/dist/chunk-BRJHUQSY.js.map +0 -1
  114. package/dist/chunk-CUWUHTIL.js.map +0 -1
  115. package/dist/chunk-DXPYFVKG.js.map +0 -1
  116. package/dist/chunk-EXBMF5X7.js.map +0 -1
  117. package/dist/chunk-EZROUI5U.js.map +0 -1
  118. package/dist/chunk-IPOWB3G3.js.map +0 -1
  119. package/dist/chunk-LPRVHM7P.js.map +0 -1
  120. package/dist/chunk-T4LKNY7T.js.map +0 -1
  121. package/dist/chunk-ZPZFPVDN.js.map +0 -1
  122. package/dist/cli-WA65NP4Y.js.map +0 -1
  123. package/dist/config-CEFTL5ZL.js.map +0 -1
  124. package/dist/doctor-3QBYN46N.js.map +0 -1
  125. package/dist/usdc-44R6XZF2.js +0 -18
  126. package/dist/wallet-ELBTBMXO.js +0 -20
  127. /package/dist/{_esm-ZH2J4QEH.js.map → _esm-C5CRWCYU.js.map} +0 -0
  128. /package/dist/{ccip-UCLT5VOW.js.map → _esm-FEASBWRP.js.map} +0 -0
  129. /package/dist/{chunk-3IMLRUZE.js.map → ccip-NQXCEK2U.js.map} +0 -0
  130. /package/dist/{secp256k1-BEZS642W.js.map → ccip-XR5NE5QK.js.map} +0 -0
  131. /package/dist/{usdc-44R6XZF2.js.map → chunk-ZXTAQYNA.js.map} +0 -0
  132. /package/dist/{wallet-ELBTBMXO.js.map → config-2VSXWWHK.js.map} +0 -0
  133. /package/dist/{mine.wasm-GQECMSGN.js.map → mine.wasm-6PIT3DK6.js.map} +0 -0
@@ -1,79 +1,10 @@
1
1
  import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
2
  import {
3
- Hash,
4
- abytes,
5
- aexists,
6
- anumber,
7
- aoutput,
8
- clean,
9
- createHasher,
10
- equalBytes,
11
- rotlBH,
12
- rotlBL,
13
- rotlSH,
14
- rotlSL,
15
- split,
16
- swap32IfBE,
17
- toBytes,
18
- u32
19
- } from "./chunk-CUWUHTIL.js";
20
-
21
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/data/isHex.js
22
- function isHex(value, { strict = true } = {}) {
23
- if (!value)
24
- return false;
25
- if (typeof value !== "string")
26
- return false;
27
- return strict ? /^0x[0-9a-fA-F]*$/.test(value) : value.startsWith("0x");
28
- }
29
-
30
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/data/concat.js
31
- function concat(values) {
32
- if (typeof values[0] === "string")
33
- return concatHex(values);
34
- return concatBytes(values);
35
- }
36
- function concatBytes(values) {
37
- let length = 0;
38
- for (const arr of values) {
39
- length += arr.length;
40
- }
41
- const result = new Uint8Array(length);
42
- let offset = 0;
43
- for (const arr of values) {
44
- result.set(arr, offset);
45
- offset += arr.length;
46
- }
47
- return result;
48
- }
49
- function concatHex(values) {
50
- return `0x${values.reduce((acc, x) => acc + x.replace("0x", ""), "")}`;
51
- }
52
-
53
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/abi/formatAbiItem.js
54
- function formatAbiItem(abiItem, { includeName = false } = {}) {
55
- if (abiItem.type !== "function" && abiItem.type !== "event" && abiItem.type !== "error")
56
- throw new InvalidDefinitionTypeError(abiItem.type);
57
- return `${abiItem.name}(${formatAbiParams(abiItem.inputs, { includeName })})`;
58
- }
59
- function formatAbiParams(params, { includeName = false } = {}) {
60
- if (!params)
61
- return "";
62
- return params.map((param) => formatAbiParam(param, { includeName })).join(includeName ? ", " : ",");
63
- }
64
- function formatAbiParam(param, { includeName }) {
65
- if (param.type.startsWith("tuple")) {
66
- return `(${formatAbiParams(param.components, { includeName })})${param.type.slice("tuple".length)}`;
67
- }
68
- return param.type + (includeName && param.name ? ` ${param.name}` : "");
69
- }
70
-
71
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/data/size.js
72
- function size(value) {
73
- if (isHex(value, { strict: false }))
74
- return Math.ceil((value.length - 2) / 2);
75
- return value.length;
76
- }
3
+ keccak_256
4
+ } from "./chunk-HIVZG55D.js";
5
+ import {
6
+ equalBytes
7
+ } from "./chunk-RBJPAZFI.js";
77
8
 
78
9
  // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/errors/version.js
79
10
  var version = "2.55.2";
@@ -83,6 +14,9 @@ var errorConfig = {
83
14
  getDocsUrl: ({ docsBaseUrl, docsPath = "", docsSlug }) => docsPath ? `${docsBaseUrl ?? "https://viem.sh"}${docsPath}${docsSlug ? `#${docsSlug}` : ""}` : void 0,
84
15
  version: `viem@${version}`
85
16
  };
17
+ function setErrorConfig(config) {
18
+ errorConfig = config;
19
+ }
86
20
  var BaseError = class _BaseError extends Error {
87
21
  constructor(shortMessage, args = {}) {
88
22
  const details = (() => {
@@ -162,550 +96,260 @@ function walk(err, fn) {
162
96
  return fn ? null : err;
163
97
  }
164
98
 
165
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/errors/abi.js
166
- var AbiConstructorNotFoundError = class extends BaseError {
167
- constructor({ docsPath }) {
168
- super([
169
- "A constructor was not found on the ABI.",
170
- "Make sure you are using the correct ABI and that the constructor exists on it."
171
- ].join("\n"), {
172
- docsPath,
173
- name: "AbiConstructorNotFoundError"
174
- });
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" });
175
103
  }
176
104
  };
177
- var AbiConstructorParamsNotFoundError = class extends BaseError {
178
- constructor({ docsPath }) {
179
- super([
180
- "Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.",
181
- "Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."
182
- ].join("\n"), {
183
- docsPath,
184
- 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"
185
109
  });
186
110
  }
187
111
  };
188
- var AbiDecodingDataSizeTooSmallError = class extends BaseError {
189
- constructor({ data, params, size: size4 }) {
190
- super([`Data size of ${size4} bytes is too small for given parameters.`].join("\n"), {
191
- metaMessages: [
192
- `Params: (${formatAbiParams(params, { includeName: true })})`,
193
- `Data: ${data} (${size4} bytes)`
194
- ],
195
- name: "AbiDecodingDataSizeTooSmallError"
196
- });
197
- Object.defineProperty(this, "data", {
198
- enumerable: true,
199
- configurable: true,
200
- writable: true,
201
- value: void 0
202
- });
203
- Object.defineProperty(this, "params", {
204
- enumerable: true,
205
- configurable: true,
206
- writable: true,
207
- value: void 0
208
- });
209
- Object.defineProperty(this, "size", {
210
- enumerable: true,
211
- configurable: true,
212
- writable: true,
213
- value: void 0
214
- });
215
- this.data = data;
216
- this.params = params;
217
- this.size = size4;
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" });
218
115
  }
219
116
  };
220
- var AbiDecodingZeroDataError = class extends BaseError {
221
- constructor({ cause } = {}) {
222
- super('Cannot decode zero data ("0x") with ABI parameters.', {
223
- name: "AbiDecodingZeroDataError",
224
- cause
225
- });
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" });
226
120
  }
227
121
  };
228
- var AbiEncodingArrayLengthMismatchError = class extends BaseError {
229
- constructor({ expectedLength, givenLength, type }) {
230
- super([
231
- `ABI encoding array length mismatch for type ${type}.`,
232
- `Expected length: ${expectedLength}`,
233
- `Given length: ${givenLength}`
234
- ].join("\n"), { name: "AbiEncodingArrayLengthMismatchError" });
122
+ var RlpDepthLimitExceededError = class extends BaseError {
123
+ constructor({ limit }) {
124
+ super(`RLP depth limit of \`${limit}\` exceeded.`, {
125
+ name: "RlpDepthLimitExceededError"
126
+ });
235
127
  }
236
128
  };
237
- var AbiEncodingBytesSizeMismatchError = class extends BaseError {
238
- constructor({ expectedSize, value }) {
239
- super(`Size of bytes "${value}" (bytes${size(value)}) does not match expected size (bytes${expectedSize}).`, { name: "AbiEncodingBytesSizeMismatchError" });
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" });
240
132
  }
241
133
  };
242
- var AbiEncodingLengthMismatchError = class extends BaseError {
243
- constructor({ expectedLength, givenLength }) {
244
- super([
245
- "ABI encoding params/values length mismatch.",
246
- `Expected length (params): ${expectedLength}`,
247
- `Given length (values): ${givenLength}`
248
- ].join("\n"), { name: "AbiEncodingLengthMismatchError" });
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" });
249
137
  }
250
138
  };
251
- var AbiErrorInputsNotFoundError = class extends BaseError {
252
- constructor(errorName, { docsPath }) {
253
- super([
254
- `Arguments (\`args\`) were provided to "${errorName}", but "${errorName}" on the ABI does not contain any parameters (\`inputs\`).`,
255
- "Cannot encode error result without knowing what the parameter types are.",
256
- "Make sure you are using the correct ABI and that the inputs exist on it."
257
- ].join("\n"), {
258
- docsPath,
259
- name: "AbiErrorInputsNotFoundError"
260
- });
139
+ var SizeOverflowError = class extends BaseError {
140
+ constructor({ givenSize, maxSize }) {
141
+ super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`, { name: "SizeOverflowError" });
261
142
  }
262
143
  };
263
- var AbiErrorNotFoundError = class extends BaseError {
264
- constructor(errorName, { docsPath } = {}) {
265
- super([
266
- `Error ${errorName ? `"${errorName}" ` : ""}not found on ABI.`,
267
- "Make sure you are using the correct ABI and that the error exists on it."
268
- ].join("\n"), {
269
- docsPath,
270
- name: "AbiErrorNotFoundError"
271
- });
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" });
272
149
  }
273
150
  };
274
- var AbiErrorSignatureNotFoundError = class extends BaseError {
275
- constructor(signature, { docsPath, cause }) {
276
- super([
277
- `Encoded error signature "${signature}" not found on ABI.`,
278
- "Make sure you are using the correct ABI and that the error exists on it.",
279
- `You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${signature}.`
280
- ].join("\n"), {
281
- docsPath,
282
- name: "AbiErrorSignatureNotFoundError",
283
- cause
284
- });
285
- Object.defineProperty(this, "signature", {
286
- enumerable: true,
287
- configurable: true,
288
- writable: true,
289
- value: void 0
290
- });
291
- this.signature = signature;
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" });
292
154
  }
293
155
  };
294
- var AbiEventSignatureEmptyTopicsError = class extends BaseError {
295
- constructor({ docsPath }) {
296
- super("Cannot extract event signature from empty topics.", {
297
- docsPath,
298
- name: "AbiEventSignatureEmptyTopicsError"
299
- });
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" });
300
159
  }
301
160
  };
302
- var AbiEventSignatureNotFoundError = class extends BaseError {
303
- constructor(signature, { docsPath }) {
304
- super([
305
- `Encoded event signature "${signature}" not found on ABI.`,
306
- "Make sure you are using the correct ABI and that the event exists on it.",
307
- `You can look up the signature here: https://4byte.sourcify.dev/?q=${signature}.`
308
- ].join("\n"), {
309
- docsPath,
310
- name: "AbiEventSignatureNotFoundError"
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"
311
177
  });
312
- }
313
- };
314
- var AbiEventNotFoundError = class extends BaseError {
315
- constructor(eventName, { docsPath } = {}) {
316
- super([
317
- `Event ${eventName ? `"${eventName}" ` : ""}not found on ABI.`,
318
- "Make sure you are using the correct ABI and that the event exists on it."
319
- ].join("\n"), {
320
- docsPath,
321
- name: "AbiEventNotFoundError"
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"
322
188
  });
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];
323
193
  }
324
- };
325
- var AbiFunctionNotFoundError = class extends BaseError {
326
- constructor(functionName, { docsPath } = {}) {
327
- super([
328
- `Function ${functionName ? `"${functionName}" ` : ""}not found on ABI.`,
329
- "Make sure you are using the correct ABI and that the function exists on it."
330
- ].join("\n"), {
331
- docsPath,
332
- name: "AbiFunctionNotFoundError"
333
- });
194
+ return paddedBytes;
195
+ }
196
+
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
+ }
212
+
213
+ // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/data/trim.js
214
+ function trim(hexOrBytes, { dir = "left" } = {}) {
215
+ let data = typeof hexOrBytes === "string" ? hexOrBytes.replace("0x", "") : hexOrBytes;
216
+ let sliceLength = 0;
217
+ for (let i = 0; i < data.length - 1; i++) {
218
+ if (data[dir === "left" ? i : data.length - i - 1].toString() === "0")
219
+ sliceLength++;
220
+ else
221
+ break;
334
222
  }
335
- };
336
- var AbiFunctionOutputsNotFoundError = class extends BaseError {
337
- constructor(functionName, { docsPath }) {
338
- super([
339
- `Function "${functionName}" does not contain any \`outputs\` on ABI.`,
340
- "Cannot decode function result without knowing what the parameter types are.",
341
- "Make sure you are using the correct ABI and that the function exists on it."
342
- ].join("\n"), {
343
- docsPath,
344
- name: "AbiFunctionOutputsNotFoundError"
345
- });
223
+ data = dir === "left" ? data.slice(sliceLength) : data.slice(0, data.length - sliceLength);
224
+ if (typeof hexOrBytes === "string") {
225
+ if (data.length === 1 && dir === "right")
226
+ data = `${data}0`;
227
+ return `0x${data.length % 2 === 1 ? `0${data}` : data}`;
346
228
  }
347
- };
348
- var AbiFunctionSignatureNotFoundError = class extends BaseError {
349
- constructor(signature, { docsPath }) {
350
- super([
351
- `Encoded function signature "${signature}" not found on ABI.`,
352
- "Make sure you are using the correct ABI and that the function exists on it.",
353
- `You can look up the signature here: https://4byte.sourcify.dev/?q=${signature}.`
354
- ].join("\n"), {
355
- docsPath,
356
- name: "AbiFunctionSignatureNotFoundError"
229
+ return data;
230
+ }
231
+
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
357
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);
358
271
  }
359
- };
360
- var AbiItemAmbiguityError = class extends BaseError {
361
- constructor(x, y) {
362
- super("Found ambiguous types in overloaded ABI items.", {
363
- metaMessages: [
364
- `\`${x.type}\` in \`${formatAbiItem(x.abiItem)}\`, and`,
365
- `\`${y.type}\` in \`${formatAbiItem(y.abiItem)}\``,
366
- "",
367
- "These types encode differently and cannot be distinguished at runtime.",
368
- "Remove one of the ambiguous items in the ABI."
369
- ],
370
- name: "AbiItemAmbiguityError"
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`
371
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" });
372
296
  }
373
- };
374
- var BytesSizeMismatchError = class extends BaseError {
375
- constructor({ expectedSize, givenSize }) {
376
- super(`Expected bytes${expectedSize}, got bytes${givenSize}.`, {
377
- name: "BytesSizeMismatchError"
378
- });
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);
379
307
  }
380
- };
381
- var DecodeLogDataMismatch = class extends BaseError {
382
- constructor({ abiItem, data, params, size: size4 }) {
383
- super([
384
- `Data size of ${size4} bytes is too small for non-indexed event parameters.`
385
- ].join("\n"), {
386
- metaMessages: [
387
- `Params: (${formatAbiParams(params, { includeName: true })})`,
388
- `Data: ${data} (${size4} bytes)`
389
- ],
390
- name: "DecodeLogDataMismatch"
391
- });
392
- Object.defineProperty(this, "abiItem", {
393
- enumerable: true,
394
- configurable: true,
395
- writable: true,
396
- value: void 0
397
- });
398
- Object.defineProperty(this, "data", {
399
- enumerable: true,
400
- configurable: true,
401
- writable: true,
402
- value: void 0
403
- });
404
- Object.defineProperty(this, "params", {
405
- enumerable: true,
406
- configurable: true,
407
- writable: true,
408
- value: void 0
409
- });
410
- Object.defineProperty(this, "size", {
411
- enumerable: true,
412
- configurable: true,
413
- writable: true,
414
- value: void 0
415
- });
416
- this.abiItem = abiItem;
417
- this.data = data;
418
- this.params = params;
419
- this.size = size4;
308
+ if (typeof value === "boolean")
309
+ return boolToHex(value, opts);
310
+ return bytesToHex(value, opts);
311
+ }
312
+ function boolToHex(value, opts = {}) {
313
+ const hex = `0x${Number(value)}`;
314
+ if (typeof opts.size === "number") {
315
+ assertSize(hex, { size: opts.size });
316
+ return pad(hex, { size: opts.size });
420
317
  }
421
- };
422
- var DecodeLogTopicsMismatch = class extends BaseError {
423
- constructor({ abiItem, param }) {
424
- super([
425
- `Expected a topic for indexed event parameter${param.name ? ` "${param.name}"` : ""} on event "${formatAbiItem(abiItem, { includeName: true })}".`
426
- ].join("\n"), { name: "DecodeLogTopicsMismatch" });
427
- Object.defineProperty(this, "abiItem", {
428
- enumerable: true,
429
- configurable: true,
430
- writable: true,
431
- value: void 0
432
- });
433
- this.abiItem = abiItem;
318
+ return hex;
319
+ }
320
+ function bytesToHex(value, opts = {}) {
321
+ let string = "";
322
+ for (let i = 0; i < value.length; i++) {
323
+ string += hexes[value[i]];
434
324
  }
435
- };
436
- var InvalidAbiEncodingTypeError = class extends BaseError {
437
- constructor(type, { docsPath }) {
438
- super([
439
- `Type "${type}" is not a valid encoding type.`,
440
- "Please provide a valid ABI type."
441
- ].join("\n"), { docsPath, name: "InvalidAbiEncodingType" });
325
+ const hex = `0x${string}`;
326
+ if (typeof opts.size === "number") {
327
+ assertSize(hex, { size: opts.size });
328
+ return pad(hex, { dir: "right", size: opts.size });
442
329
  }
443
- };
444
- var InvalidAbiDecodingTypeError = class extends BaseError {
445
- constructor(type, { docsPath }) {
446
- super([
447
- `Type "${type}" is not a valid decoding type.`,
448
- "Please provide a valid ABI type."
449
- ].join("\n"), { docsPath, name: "InvalidAbiDecodingType" });
330
+ return hex;
331
+ }
332
+ function numberToHex(value_, opts = {}) {
333
+ const { signed, size: size4 } = opts;
334
+ const value = BigInt(value_);
335
+ let maxValue;
336
+ if (size4) {
337
+ if (signed)
338
+ maxValue = (1n << BigInt(size4) * 8n - 1n) - 1n;
339
+ else
340
+ maxValue = 2n ** (BigInt(size4) * 8n) - 1n;
341
+ } else if (typeof value_ === "number") {
342
+ maxValue = BigInt(Number.MAX_SAFE_INTEGER);
450
343
  }
451
- };
452
- var InvalidArrayError = class extends BaseError {
453
- constructor(value) {
454
- super([`Value "${value}" is not a valid array.`].join("\n"), {
455
- name: "InvalidArrayError"
456
- });
457
- }
458
- };
459
- var InvalidDefinitionTypeError = class extends BaseError {
460
- constructor(type) {
461
- super([
462
- `"${type}" is not a valid definition type.`,
463
- 'Valid types: "function", "event", "error"'
464
- ].join("\n"), { name: "InvalidDefinitionTypeError" });
465
- }
466
- };
467
-
468
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/errors/address.js
469
- var InvalidAddressError = class extends BaseError {
470
- constructor({ address }) {
471
- super(`Address "${address}" is invalid.`, {
472
- metaMessages: [
473
- "- Address must be a hex value of 20 bytes (40 hex characters).",
474
- "- Address must match its checksum counterpart."
475
- ],
476
- name: "InvalidAddressError"
477
- });
478
- }
479
- };
480
-
481
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/errors/encoding.js
482
- var IntegerOutOfRangeError = class extends BaseError {
483
- constructor({ max, min, signed, size: size4, value }) {
484
- super(`Number "${value}" is not in safe ${size4 ? `${size4 * 8}-bit ${signed ? "signed" : "unsigned"} ` : ""}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`, { name: "IntegerOutOfRangeError" });
485
- }
486
- };
487
- var InvalidBytesBooleanError = class extends BaseError {
488
- constructor(bytes) {
489
- super(`Bytes value "${bytes}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`, {
490
- name: "InvalidBytesBooleanError"
491
- });
492
- }
493
- };
494
- var InvalidHexBooleanError = class extends BaseError {
495
- constructor(hex) {
496
- super(`Hex value "${hex}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`, { name: "InvalidHexBooleanError" });
497
- }
498
- };
499
- var SizeOverflowError = class extends BaseError {
500
- constructor({ givenSize, maxSize }) {
501
- super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`, { name: "SizeOverflowError" });
502
- }
503
- };
504
-
505
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/lru.js
506
- var LruMap = class extends Map {
507
- constructor(size4) {
508
- super();
509
- Object.defineProperty(this, "maxSize", {
510
- enumerable: true,
511
- configurable: true,
512
- writable: true,
513
- value: void 0
514
- });
515
- this.maxSize = size4;
516
- }
517
- get(key) {
518
- const value = super.get(key);
519
- if (super.has(key)) {
520
- super.delete(key);
521
- super.set(key, value);
522
- }
523
- return value;
524
- }
525
- set(key, value) {
526
- if (super.has(key))
527
- super.delete(key);
528
- super.set(key, value);
529
- if (this.maxSize && this.size > this.maxSize) {
530
- const firstKey = super.keys().next().value;
531
- if (firstKey !== void 0)
532
- super.delete(firstKey);
533
- }
534
- return this;
535
- }
536
- };
537
-
538
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/errors/data.js
539
- var SliceOffsetOutOfBoundsError = class extends BaseError {
540
- constructor({ offset, position, size: size4 }) {
541
- super(`Slice ${position === "start" ? "starting" : "ending"} at offset "${offset}" is out-of-bounds (size: ${size4}).`, { name: "SliceOffsetOutOfBoundsError" });
542
- }
543
- };
544
- var SizeExceedsPaddingSizeError = class extends BaseError {
545
- constructor({ size: size4, targetSize, type }) {
546
- super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (${size4}) exceeds padding size (${targetSize}).`, { name: "SizeExceedsPaddingSizeError" });
547
- }
548
- };
549
- var InvalidBytesLengthError = class extends BaseError {
550
- constructor({ size: size4, targetSize, type }) {
551
- super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} is expected to be ${targetSize} ${type} long, but is ${size4} ${type} long.`, { name: "InvalidBytesLengthError" });
552
- }
553
- };
554
-
555
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/data/pad.js
556
- function pad(hexOrBytes, { dir, size: size4 = 32 } = {}) {
557
- if (typeof hexOrBytes === "string")
558
- return padHex(hexOrBytes, { dir, size: size4 });
559
- return padBytes(hexOrBytes, { dir, size: size4 });
560
- }
561
- function padHex(hex_, { dir, size: size4 = 32 } = {}) {
562
- if (size4 === null)
563
- return hex_;
564
- const hex = hex_.replace("0x", "");
565
- if (hex.length > size4 * 2)
566
- throw new SizeExceedsPaddingSizeError({
567
- size: Math.ceil(hex.length / 2),
568
- targetSize: size4,
569
- type: "hex"
570
- });
571
- return `0x${hex[dir === "right" ? "padEnd" : "padStart"](size4 * 2, "0")}`;
572
- }
573
- function padBytes(bytes, { dir, size: size4 = 32 } = {}) {
574
- if (size4 === null)
575
- return bytes;
576
- if (bytes.length > size4)
577
- throw new SizeExceedsPaddingSizeError({
578
- size: bytes.length,
579
- targetSize: size4,
580
- type: "bytes"
581
- });
582
- const paddedBytes = new Uint8Array(size4);
583
- for (let i = 0; i < size4; i++) {
584
- const padEnd = dir === "right";
585
- paddedBytes[padEnd ? i : size4 - i - 1] = bytes[padEnd ? i : bytes.length - i - 1];
586
- }
587
- return paddedBytes;
588
- }
589
-
590
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/data/trim.js
591
- function trim(hexOrBytes, { dir = "left" } = {}) {
592
- let data = typeof hexOrBytes === "string" ? hexOrBytes.replace("0x", "") : hexOrBytes;
593
- let sliceLength = 0;
594
- for (let i = 0; i < data.length - 1; i++) {
595
- if (data[dir === "left" ? i : data.length - i - 1].toString() === "0")
596
- sliceLength++;
597
- else
598
- break;
599
- }
600
- data = dir === "left" ? data.slice(sliceLength) : data.slice(0, data.length - sliceLength);
601
- if (typeof hexOrBytes === "string") {
602
- if (data.length === 1 && dir === "right")
603
- data = `${data}0`;
604
- return `0x${data.length % 2 === 1 ? `0${data}` : data}`;
605
- }
606
- return data;
607
- }
608
-
609
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/encoding/fromHex.js
610
- function assertSize(hexOrBytes, { size: size4 }) {
611
- if (size(hexOrBytes) > size4)
612
- throw new SizeOverflowError({
613
- givenSize: size(hexOrBytes),
614
- maxSize: size4
615
- });
616
- }
617
- function hexToBigInt(hex, opts = {}) {
618
- const { signed } = opts;
619
- if (opts.size)
620
- assertSize(hex, { size: opts.size });
621
- const value = BigInt(hex);
622
- if (!signed)
623
- return value;
624
- const size4 = (hex.length - 2) / 2;
625
- const max = (1n << BigInt(size4) * 8n - 1n) - 1n;
626
- if (value <= max)
627
- return value;
628
- return value - BigInt(`0x${"f".padStart(size4 * 2, "f")}`) - 1n;
629
- }
630
- function hexToBool(hex_, opts = {}) {
631
- let hex = hex_;
632
- if (opts.size) {
633
- assertSize(hex, { size: opts.size });
634
- hex = trim(hex);
635
- }
636
- if (trim(hex) === "0x00")
637
- return false;
638
- if (trim(hex) === "0x01")
639
- return true;
640
- throw new InvalidHexBooleanError(hex);
641
- }
642
- function hexToNumber(hex, opts = {}) {
643
- const value = hexToBigInt(hex, opts);
644
- const number = Number(value);
645
- if (!Number.isSafeInteger(number))
646
- throw new IntegerOutOfRangeError({
647
- max: `${Number.MAX_SAFE_INTEGER}`,
648
- min: `${Number.MIN_SAFE_INTEGER}`,
649
- signed: opts.signed,
650
- size: opts.size,
651
- value: `${value}n`
652
- });
653
- return number;
654
- }
655
-
656
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/encoding/toHex.js
657
- var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0"));
658
- function toHex(value, opts = {}) {
659
- if (typeof value === "number" || typeof value === "bigint")
660
- return numberToHex(value, opts);
661
- if (typeof value === "string") {
662
- return stringToHex(value, opts);
663
- }
664
- if (typeof value === "boolean")
665
- return boolToHex(value, opts);
666
- return bytesToHex(value, opts);
667
- }
668
- function boolToHex(value, opts = {}) {
669
- const hex = `0x${Number(value)}`;
670
- if (typeof opts.size === "number") {
671
- assertSize(hex, { size: opts.size });
672
- return pad(hex, { size: opts.size });
673
- }
674
- return hex;
675
- }
676
- function bytesToHex(value, opts = {}) {
677
- let string = "";
678
- for (let i = 0; i < value.length; i++) {
679
- string += hexes[value[i]];
680
- }
681
- const hex = `0x${string}`;
682
- if (typeof opts.size === "number") {
683
- assertSize(hex, { size: opts.size });
684
- return pad(hex, { dir: "right", size: opts.size });
685
- }
686
- return hex;
687
- }
688
- function numberToHex(value_, opts = {}) {
689
- const { signed, size: size4 } = opts;
690
- const value = BigInt(value_);
691
- let maxValue;
692
- if (size4) {
693
- if (signed)
694
- maxValue = (1n << BigInt(size4) * 8n - 1n) - 1n;
695
- else
696
- maxValue = 2n ** (BigInt(size4) * 8n) - 1n;
697
- } else if (typeof value_ === "number") {
698
- maxValue = BigInt(Number.MAX_SAFE_INTEGER);
699
- }
700
- const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
701
- if (maxValue && value > maxValue || value < minValue) {
702
- const suffix = typeof value_ === "bigint" ? "n" : "";
703
- throw new IntegerOutOfRangeError({
704
- max: maxValue ? `${maxValue}${suffix}` : void 0,
705
- min: `${minValue}${suffix}`,
706
- signed,
707
- size: size4,
708
- value: `${value_}${suffix}`
344
+ const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
345
+ if (maxValue && value > maxValue || value < minValue) {
346
+ const suffix = typeof value_ === "bigint" ? "n" : "";
347
+ throw new IntegerOutOfRangeError({
348
+ max: maxValue ? `${maxValue}${suffix}` : void 0,
349
+ min: `${minValue}${suffix}`,
350
+ signed,
351
+ size: size4,
352
+ value: `${value_}${suffix}`
709
353
  });
710
354
  }
711
355
  const hex = `0x${(signed && value < 0 ? (1n << BigInt(size4 * 8)) + BigInt(value) : value).toString(16)}`;
@@ -721,7 +365,7 @@ function stringToHex(value_, opts = {}) {
721
365
 
722
366
  // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/encoding/toBytes.js
723
367
  var encoder2 = /* @__PURE__ */ new TextEncoder();
724
- function toBytes2(value, opts = {}) {
368
+ function toBytes(value, opts = {}) {
725
369
  if (typeof value === "number" || typeof value === "bigint")
726
370
  return numberToBytes(value, opts);
727
371
  if (typeof value === "boolean")
@@ -790,221 +434,60 @@ function stringToBytes(value, opts = {}) {
790
434
  return bytes;
791
435
  }
792
436
 
793
- // node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/sha3.js
794
- var _0n = BigInt(0);
795
- var _1n = BigInt(1);
796
- var _2n = BigInt(2);
797
- var _7n = BigInt(7);
798
- var _256n = BigInt(256);
799
- var _0x71n = BigInt(113);
800
- var SHA3_PI = [];
801
- var SHA3_ROTL = [];
802
- var _SHA3_IOTA = [];
803
- for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
804
- [x, y] = [y, (2 * x + 3 * y) % 5];
805
- SHA3_PI.push(2 * (5 * y + x));
806
- SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
807
- let t = _0n;
808
- for (let j = 0; j < 7; j++) {
809
- R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n;
810
- if (R & _2n)
811
- t ^= _1n << (_1n << /* @__PURE__ */ BigInt(j)) - _1n;
812
- }
813
- _SHA3_IOTA.push(t);
814
- }
815
- var IOTAS = split(_SHA3_IOTA, true);
816
- var SHA3_IOTA_H = IOTAS[0];
817
- var SHA3_IOTA_L = IOTAS[1];
818
- var rotlH = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s);
819
- var rotlL = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s);
820
- function keccakP(s, rounds = 24) {
821
- const B = new Uint32Array(5 * 2);
822
- for (let round = 24 - rounds; round < 24; round++) {
823
- for (let x = 0; x < 10; x++)
824
- B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
825
- for (let x = 0; x < 10; x += 2) {
826
- const idx1 = (x + 8) % 10;
827
- const idx0 = (x + 2) % 10;
828
- const B0 = B[idx0];
829
- const B1 = B[idx0 + 1];
830
- const Th = rotlH(B0, B1, 1) ^ B[idx1];
831
- const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
832
- for (let y = 0; y < 50; y += 10) {
833
- s[x + y] ^= Th;
834
- s[x + y + 1] ^= Tl;
835
- }
836
- }
837
- let curH = s[2];
838
- let curL = s[3];
839
- for (let t = 0; t < 24; t++) {
840
- const shift = SHA3_ROTL[t];
841
- const Th = rotlH(curH, curL, shift);
842
- const Tl = rotlL(curH, curL, shift);
843
- const PI = SHA3_PI[t];
844
- curH = s[PI];
845
- curL = s[PI + 1];
846
- s[PI] = Th;
847
- s[PI + 1] = Tl;
848
- }
849
- for (let y = 0; y < 50; y += 10) {
850
- for (let x = 0; x < 10; x++)
851
- B[x] = s[y + x];
852
- for (let x = 0; x < 10; x++)
853
- s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
854
- }
855
- s[0] ^= SHA3_IOTA_H[round];
856
- s[1] ^= SHA3_IOTA_L[round];
857
- }
858
- clean(B);
859
- }
860
- var Keccak = class _Keccak extends Hash {
861
- // NOTE: we accept arguments in bytes instead of bits here.
862
- constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
863
- super();
864
- this.pos = 0;
865
- this.posOut = 0;
866
- this.finished = false;
867
- this.destroyed = false;
868
- this.enableXOF = false;
869
- this.blockLen = blockLen;
870
- this.suffix = suffix;
871
- this.outputLen = outputLen;
872
- this.enableXOF = enableXOF;
873
- this.rounds = rounds;
874
- anumber(outputLen);
875
- if (!(0 < blockLen && blockLen < 200))
876
- throw new Error("only keccak-f1600 function is supported");
877
- this.state = new Uint8Array(200);
878
- this.state32 = u32(this.state);
879
- }
880
- clone() {
881
- return this._cloneInto();
882
- }
883
- keccak() {
884
- swap32IfBE(this.state32);
885
- keccakP(this.state32, this.rounds);
886
- swap32IfBE(this.state32);
887
- this.posOut = 0;
888
- this.pos = 0;
889
- }
890
- update(data) {
891
- aexists(this);
892
- data = toBytes(data);
893
- abytes(data);
894
- const { blockLen, state } = this;
895
- const len = data.length;
896
- for (let pos = 0; pos < len; ) {
897
- const take = Math.min(blockLen - this.pos, len - pos);
898
- for (let i = 0; i < take; i++)
899
- state[this.pos++] ^= data[pos++];
900
- if (this.pos === blockLen)
901
- this.keccak();
902
- }
903
- return this;
904
- }
905
- finish() {
906
- if (this.finished)
907
- return;
908
- this.finished = true;
909
- const { state, suffix, pos, blockLen } = this;
910
- state[pos] ^= suffix;
911
- if ((suffix & 128) !== 0 && pos === blockLen - 1)
912
- this.keccak();
913
- state[blockLen - 1] ^= 128;
914
- this.keccak();
915
- }
916
- writeInto(out) {
917
- aexists(this, false);
918
- abytes(out);
919
- this.finish();
920
- const bufferOut = this.state;
921
- const { blockLen } = this;
922
- for (let pos = 0, len = out.length; pos < len; ) {
923
- if (this.posOut >= blockLen)
924
- this.keccak();
925
- const take = Math.min(blockLen - this.posOut, len - pos);
926
- out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
927
- this.posOut += take;
928
- pos += take;
929
- }
930
- return out;
931
- }
932
- xofInto(out) {
933
- if (!this.enableXOF)
934
- throw new Error("XOF is not possible for this instance");
935
- return this.writeInto(out);
936
- }
937
- xof(bytes) {
938
- anumber(bytes);
939
- return this.xofInto(new Uint8Array(bytes));
940
- }
941
- digestInto(out) {
942
- aoutput(out, this);
943
- if (this.finished)
944
- throw new Error("digest() was already called");
945
- this.writeInto(out);
946
- this.destroy();
947
- return out;
948
- }
949
- digest() {
950
- return this.digestInto(new Uint8Array(this.outputLen));
951
- }
952
- destroy() {
953
- this.destroyed = true;
954
- clean(this.state);
955
- }
956
- _cloneInto(to) {
957
- const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
958
- to || (to = new _Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
959
- to.state32.set(this.state32);
960
- to.pos = this.pos;
961
- to.posOut = this.posOut;
962
- to.finished = this.finished;
963
- to.rounds = rounds;
964
- to.suffix = suffix;
965
- to.outputLen = outputLen;
966
- to.enableXOF = enableXOF;
967
- to.destroyed = this.destroyed;
968
- return to;
969
- }
970
- };
971
- var gen = (suffix, blockLen, outputLen) => createHasher(() => new Keccak(blockLen, suffix, outputLen));
972
- var keccak_256 = /* @__PURE__ */ (() => gen(1, 136, 256 / 8))();
437
+ // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/errors/address.js
438
+ var InvalidAddressError = class extends BaseError {
439
+ constructor({ address }) {
440
+ super(`Address "${address}" is invalid.`, {
441
+ metaMessages: [
442
+ "- Address must be a hex value of 20 bytes (40 hex characters).",
443
+ "- Address must match its checksum counterpart."
444
+ ],
445
+ name: "InvalidAddressError"
446
+ });
447
+ }
448
+ };
973
449
 
974
450
  // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/hash/keccak256.js
975
451
  function keccak256(value, to_) {
976
452
  const to = to_ || "hex";
977
- const bytes = keccak_256(isHex(value, { strict: false }) ? toBytes2(value) : value);
453
+ const bytes = keccak_256(isHex(value, { strict: false }) ? toBytes(value) : value);
978
454
  if (to === "bytes")
979
455
  return bytes;
980
456
  return toHex(bytes);
981
457
  }
982
458
 
983
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/address/getAddress.js
984
- var checksumAddressCache = /* @__PURE__ */ new LruMap(8192);
985
- function checksumAddress(address_, chainId) {
986
- if (checksumAddressCache.has(`${address_}.${chainId}`))
987
- return checksumAddressCache.get(`${address_}.${chainId}`);
988
- const hexAddress = chainId ? `${chainId}${address_.toLowerCase()}` : address_.substring(2).toLowerCase();
989
- const hash = keccak256(stringToBytes(hexAddress), "bytes");
990
- const address = (chainId ? hexAddress.substring(`${chainId}0x`.length) : hexAddress).split("");
991
- for (let i = 0; i < 40; i += 2) {
992
- if (hash[i >> 1] >> 4 >= 8 && address[i]) {
993
- address[i] = address[i].toUpperCase();
459
+ // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/lru.js
460
+ var LruMap = class extends Map {
461
+ constructor(size4) {
462
+ super();
463
+ Object.defineProperty(this, "maxSize", {
464
+ enumerable: true,
465
+ configurable: true,
466
+ writable: true,
467
+ value: void 0
468
+ });
469
+ this.maxSize = size4;
470
+ }
471
+ get(key) {
472
+ const value = super.get(key);
473
+ if (super.has(key)) {
474
+ super.delete(key);
475
+ super.set(key, value);
994
476
  }
995
- if ((hash[i >> 1] & 15) >= 8 && address[i + 1]) {
996
- address[i + 1] = address[i + 1].toUpperCase();
477
+ return value;
478
+ }
479
+ set(key, value) {
480
+ if (super.has(key))
481
+ super.delete(key);
482
+ super.set(key, value);
483
+ if (this.maxSize && this.size > this.maxSize) {
484
+ const firstKey = super.keys().next().value;
485
+ if (firstKey !== void 0)
486
+ super.delete(firstKey);
997
487
  }
488
+ return this;
998
489
  }
999
- const result = `0x${address.join("")}`;
1000
- checksumAddressCache.set(`${address_}.${chainId}`, result);
1001
- return result;
1002
- }
1003
- function getAddress(address, chainId) {
1004
- if (!isAddress(address, { strict: false }))
1005
- throw new InvalidAddressError({ address });
1006
- return checksumAddress(address, chainId);
1007
- }
490
+ };
1008
491
 
1009
492
  // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/address/isAddress.js
1010
493
  var addressRegex = /^0x[a-fA-F0-9]{40}$/;
@@ -1027,759 +510,1233 @@ function isAddress(address, options) {
1027
510
  return result;
1028
511
  }
1029
512
 
1030
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/data/slice.js
1031
- function slice(value, start, end, { strict } = {}) {
1032
- if (isHex(value, { strict: false }))
1033
- return sliceHex(value, start, end, {
1034
- strict
1035
- });
1036
- return sliceBytes(value, start, end, {
1037
- strict
1038
- });
513
+ // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/address/getAddress.js
514
+ var checksumAddressCache = /* @__PURE__ */ new LruMap(8192);
515
+ function checksumAddress(address_, chainId) {
516
+ if (checksumAddressCache.has(`${address_}.${chainId}`))
517
+ return checksumAddressCache.get(`${address_}.${chainId}`);
518
+ const hexAddress = chainId ? `${chainId}${address_.toLowerCase()}` : address_.substring(2).toLowerCase();
519
+ const hash = keccak256(stringToBytes(hexAddress), "bytes");
520
+ const address = (chainId ? hexAddress.substring(`${chainId}0x`.length) : hexAddress).split("");
521
+ for (let i = 0; i < 40; i += 2) {
522
+ if (hash[i >> 1] >> 4 >= 8 && address[i]) {
523
+ address[i] = address[i].toUpperCase();
524
+ }
525
+ if ((hash[i >> 1] & 15) >= 8 && address[i + 1]) {
526
+ address[i + 1] = address[i + 1].toUpperCase();
527
+ }
528
+ }
529
+ const result = `0x${address.join("")}`;
530
+ checksumAddressCache.set(`${address_}.${chainId}`, result);
531
+ return result;
1039
532
  }
1040
- function assertStartOffset(value, start) {
1041
- if (typeof start === "number" && start > 0 && start > size(value) - 1)
1042
- throw new SliceOffsetOutOfBoundsError({
1043
- offset: start,
1044
- position: "start",
1045
- size: size(value)
1046
- });
533
+ function getAddress(address, chainId) {
534
+ if (!isAddress(address, { strict: false }))
535
+ throw new InvalidAddressError({ address });
536
+ return checksumAddress(address, chainId);
1047
537
  }
1048
- function assertEndOffset(value, start, end) {
1049
- if (typeof start === "number" && typeof end === "number" && size(value) !== end - start) {
1050
- throw new SliceOffsetOutOfBoundsError({
1051
- offset: end,
1052
- position: "end",
1053
- size: size(value)
1054
- });
538
+
539
+ // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/data/concat.js
540
+ function concat(values) {
541
+ if (typeof values[0] === "string")
542
+ return concatHex(values);
543
+ return concatBytes(values);
544
+ }
545
+ function concatBytes(values) {
546
+ let length = 0;
547
+ for (const arr of values) {
548
+ length += arr.length;
1055
549
  }
550
+ const result = new Uint8Array(length);
551
+ let offset = 0;
552
+ for (const arr of values) {
553
+ result.set(arr, offset);
554
+ offset += arr.length;
555
+ }
556
+ return result;
1056
557
  }
1057
- function sliceBytes(value_, start, end, { strict } = {}) {
1058
- assertStartOffset(value_, start);
1059
- const value = value_.slice(start, end);
1060
- if (strict)
1061
- assertEndOffset(value, start, end);
1062
- return value;
558
+ function concatHex(values) {
559
+ return `0x${values.reduce((acc, x) => acc + x.replace("0x", ""), "")}`;
1063
560
  }
1064
- function sliceHex(value_, start, end, { strict } = {}) {
1065
- assertStartOffset(value_, start);
1066
- const value = `0x${value_.replace("0x", "").slice((start ?? 0) * 2, (end ?? value_.length) * 2)}`;
1067
- if (strict)
1068
- assertEndOffset(value, start, end);
1069
- return value;
561
+
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}` : ""}`;
1070
589
  }
1071
590
 
1072
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/regex.js
1073
- var bytesRegex = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/;
1074
- 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)?$/;
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
+ }
1075
595
 
1076
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/abi/encodeAbiParameters.js
1077
- function encodeAbiParameters(params, values) {
1078
- if (params.length !== values.length)
1079
- throw new AbiEncodingLengthMismatchError({
1080
- expectedLength: params.length,
1081
- givenLength: values.length
1082
- });
1083
- const preparedParams = prepareParams({
1084
- params,
1085
- values
1086
- });
1087
- return encodeParams(preparedParams);
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]);
1088
599
  }
1089
- function prepareParams({ params, values }) {
1090
- const preparedParams = [];
1091
- for (let i = 0; i < params.length; i++) {
1092
- preparedParams.push(prepareParam({ param: params[i], value: values[i] }));
1093
- }
1094
- return preparedParams;
600
+
601
+ // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/errors/transaction.js
602
+ function prettyPrint(args) {
603
+ const entries = Object.entries(args).map(([key, value]) => {
604
+ if (value === void 0 || value === false)
605
+ return null;
606
+ return [key, value];
607
+ }).filter(Boolean);
608
+ const maxLength = entries.reduce((acc, [key]) => Math.max(acc, key.length), 0);
609
+ return entries.map(([key, value]) => ` ${`${key}:`.padEnd(maxLength + 1)} ${value}`).join("\n");
1095
610
  }
1096
- function prepareParam({ param, value }) {
1097
- const arrayComponents = getArrayComponents(param.type);
1098
- if (arrayComponents) {
1099
- const [length, type] = arrayComponents;
1100
- return encodeArray(value, { length, param: { ...param, type } });
611
+ var FeeConflictError = class extends BaseError {
612
+ constructor() {
613
+ super([
614
+ "Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.",
615
+ "Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."
616
+ ].join("\n"), { name: "FeeConflictError" });
1101
617
  }
1102
- if (param.type === "tuple") {
1103
- return encodeTuple(value, {
1104
- param
618
+ };
619
+ var InvalidLegacyVError = class extends BaseError {
620
+ constructor({ v }) {
621
+ super(`Invalid \`v\` value "${v}". Expected 27 or 28.`, {
622
+ name: "InvalidLegacyVError"
1105
623
  });
1106
624
  }
1107
- if (param.type === "address") {
1108
- return encodeAddress(value);
1109
- }
1110
- if (param.type === "bool") {
1111
- return encodeBool(value);
1112
- }
1113
- if (param.type.startsWith("uint") || param.type.startsWith("int")) {
1114
- const signed = param.type.startsWith("int");
1115
- const [, , size4 = "256"] = integerRegex.exec(param.type) ?? [];
1116
- return encodeNumber(value, {
1117
- signed,
1118
- size: Number(size4)
625
+ };
626
+ var InvalidYParityError = class extends BaseError {
627
+ constructor({ yParity }) {
628
+ super(`Invalid \`yParity\` value "${yParity}". Expected 0 or 1.`, {
629
+ name: "InvalidYParityError"
1119
630
  });
1120
631
  }
1121
- if (param.type.startsWith("bytes")) {
1122
- return encodeBytes(value, { param });
632
+ };
633
+ var InvalidSerializableTransactionError = class extends BaseError {
634
+ constructor({ transaction }) {
635
+ super("Cannot infer a transaction type from provided transaction.", {
636
+ metaMessages: [
637
+ "Provided Transaction:",
638
+ "{",
639
+ prettyPrint(transaction),
640
+ "}",
641
+ "",
642
+ "To infer the type, either provide:",
643
+ "- a `type` to the Transaction, or",
644
+ "- an EIP-1559 Transaction with `maxFeePerGas`, or",
645
+ "- an EIP-2930 Transaction with `gasPrice` & `accessList`, or",
646
+ "- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or",
647
+ "- an EIP-7702 Transaction with `authorizationList`, or",
648
+ "- a Legacy Transaction with `gasPrice`"
649
+ ],
650
+ name: "InvalidSerializableTransactionError"
651
+ });
1123
652
  }
1124
- if (param.type === "string") {
1125
- return encodeString(value);
653
+ };
654
+ var InvalidSerializedTransactionTypeError = class extends BaseError {
655
+ constructor({ serializedType }) {
656
+ super(`Serialized transaction type "${serializedType}" is invalid.`, {
657
+ name: "InvalidSerializedTransactionType"
658
+ });
659
+ Object.defineProperty(this, "serializedType", {
660
+ enumerable: true,
661
+ configurable: true,
662
+ writable: true,
663
+ value: void 0
664
+ });
665
+ this.serializedType = serializedType;
666
+ }
667
+ };
668
+ var InvalidSerializedTransactionError = class extends BaseError {
669
+ constructor({ attributes, serializedTransaction, type }) {
670
+ const missing = Object.entries(attributes).map(([key, value]) => typeof value === "undefined" ? key : void 0).filter(Boolean);
671
+ super(`Invalid serialized transaction of type "${type}" was provided.`, {
672
+ metaMessages: [
673
+ `Serialized Transaction: "${serializedTransaction}"`,
674
+ missing.length > 0 ? `Missing Attributes: ${missing.join(", ")}` : ""
675
+ ].filter(Boolean),
676
+ name: "InvalidSerializedTransactionError"
677
+ });
678
+ Object.defineProperty(this, "serializedTransaction", {
679
+ enumerable: true,
680
+ configurable: true,
681
+ writable: true,
682
+ value: void 0
683
+ });
684
+ Object.defineProperty(this, "type", {
685
+ enumerable: true,
686
+ configurable: true,
687
+ writable: true,
688
+ value: void 0
689
+ });
690
+ this.serializedTransaction = serializedTransaction;
691
+ this.type = type;
692
+ }
693
+ };
694
+ var InvalidStorageKeySizeError = class extends BaseError {
695
+ constructor({ storageKey }) {
696
+ super(`Size for storage key "${storageKey}" is invalid. Expected 32 bytes. Got ${Math.floor((storageKey.length - 2) / 2)} bytes.`, { name: "InvalidStorageKeySizeError" });
697
+ }
698
+ };
699
+ var TransactionExecutionError = class extends BaseError {
700
+ constructor(cause, { account, docsPath, chain, data, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, to, value }) {
701
+ const prettyArgs = prettyPrint({
702
+ chain: chain && `${chain?.name} (id: ${chain?.id})`,
703
+ from: account?.address,
704
+ to,
705
+ value: typeof value !== "undefined" && `${formatEther(value)} ${chain?.nativeCurrency?.symbol || "ETH"}`,
706
+ data,
707
+ gas,
708
+ gasPrice: typeof gasPrice !== "undefined" && `${formatGwei(gasPrice)} gwei`,
709
+ maxFeePerGas: typeof maxFeePerGas !== "undefined" && `${formatGwei(maxFeePerGas)} gwei`,
710
+ maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== "undefined" && `${formatGwei(maxPriorityFeePerGas)} gwei`,
711
+ nonce
712
+ });
713
+ super(cause.shortMessage, {
714
+ cause,
715
+ docsPath,
716
+ metaMessages: [
717
+ ...cause.metaMessages ? [...cause.metaMessages, " "] : [],
718
+ "Request Arguments:",
719
+ prettyArgs
720
+ ].filter(Boolean),
721
+ name: "TransactionExecutionError"
722
+ });
723
+ Object.defineProperty(this, "cause", {
724
+ enumerable: true,
725
+ configurable: true,
726
+ writable: true,
727
+ value: void 0
728
+ });
729
+ this.cause = cause;
730
+ }
731
+ };
732
+ var TransactionNotFoundError = class extends BaseError {
733
+ constructor({ blockHash, blockNumber, blockTag, hash, index }) {
734
+ let identifier = "Transaction";
735
+ if (blockTag && index !== void 0)
736
+ identifier = `Transaction at block time "${blockTag}" at index "${index}"`;
737
+ if (blockHash && index !== void 0)
738
+ identifier = `Transaction at block hash "${blockHash}" at index "${index}"`;
739
+ if (blockNumber && index !== void 0)
740
+ identifier = `Transaction at block number "${blockNumber}" at index "${index}"`;
741
+ if (hash)
742
+ identifier = `Transaction with hash "${hash}"`;
743
+ super(`${identifier} could not be found.`, {
744
+ name: "TransactionNotFoundError"
745
+ });
746
+ }
747
+ };
748
+ var TransactionReceiptNotFoundError = class extends BaseError {
749
+ constructor({ hash }) {
750
+ super(`Transaction receipt with hash "${hash}" could not be found. The Transaction may not be processed on a block yet.`, {
751
+ name: "TransactionReceiptNotFoundError"
752
+ });
753
+ }
754
+ };
755
+ var TransactionReceiptRevertedError = class extends BaseError {
756
+ constructor({ receipt }) {
757
+ super(`Transaction with hash "${receipt.transactionHash}" reverted.`, {
758
+ metaMessages: [
759
+ 'The receipt marked the transaction as "reverted". This could mean that the function on the contract you are trying to call threw an error.',
760
+ " ",
761
+ "You can attempt to extract the revert reason by:",
762
+ "- calling the `simulateContract` or `simulateCalls` Action with the `abi` and `functionName` of the contract",
763
+ "- using the `call` Action with raw `data`"
764
+ ],
765
+ name: "TransactionReceiptRevertedError"
766
+ });
767
+ Object.defineProperty(this, "receipt", {
768
+ enumerable: true,
769
+ configurable: true,
770
+ writable: true,
771
+ value: void 0
772
+ });
773
+ this.receipt = receipt;
774
+ }
775
+ };
776
+ var WaitForTransactionReceiptTimeoutError = class extends BaseError {
777
+ constructor({ hash }) {
778
+ super(`Timed out while waiting for transaction with hash "${hash}" to be confirmed.`, { name: "WaitForTransactionReceiptTimeoutError" });
779
+ }
780
+ };
781
+
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
931
+ var ExecutionRevertedError = class extends BaseError {
932
+ constructor({ cause, message } = {}) {
933
+ const reason = message?.replace("execution reverted: ", "")?.replace("execution reverted", "");
934
+ super(`Execution reverted ${reason ? `with reason: ${reason}` : "for an unknown reason"}.`, {
935
+ cause,
936
+ name: "ExecutionRevertedError"
937
+ });
938
+ }
939
+ };
940
+ Object.defineProperty(ExecutionRevertedError, "code", {
941
+ enumerable: true,
942
+ configurable: true,
943
+ writable: true,
944
+ value: 3
945
+ });
946
+ Object.defineProperty(ExecutionRevertedError, "nodeMessage", {
947
+ enumerable: true,
948
+ configurable: true,
949
+ writable: true,
950
+ value: /execution reverted|gas required exceeds allowance/
951
+ });
952
+ var FeeCapTooHighError = class extends BaseError {
953
+ constructor({ cause, maxFeePerGas } = {}) {
954
+ super(`The fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`, {
955
+ cause,
956
+ name: "FeeCapTooHighError"
957
+ });
1126
958
  }
1127
- throw new InvalidAbiEncodingTypeError(param.type, {
1128
- docsPath: "/docs/contract/encodeAbiParameters"
1129
- });
1130
- }
1131
- function encodeParams(preparedParams) {
1132
- let staticSize = 0;
1133
- for (let i = 0; i < preparedParams.length; i++) {
1134
- const { dynamic, encoded } = preparedParams[i];
1135
- if (dynamic)
1136
- staticSize += 32;
1137
- else
1138
- staticSize += size(encoded);
959
+ };
960
+ Object.defineProperty(FeeCapTooHighError, "nodeMessage", {
961
+ enumerable: true,
962
+ configurable: true,
963
+ writable: true,
964
+ value: /max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/
965
+ });
966
+ var FeeCapTooLowError = class extends BaseError {
967
+ constructor({ cause, maxFeePerGas } = {}) {
968
+ super(`The fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)}` : ""} gwei) cannot be lower than the block base fee.`, {
969
+ cause,
970
+ name: "FeeCapTooLowError"
971
+ });
1139
972
  }
1140
- const staticParams = [];
1141
- const dynamicParams = [];
1142
- let dynamicSize = 0;
1143
- for (let i = 0; i < preparedParams.length; i++) {
1144
- const { dynamic, encoded } = preparedParams[i];
1145
- if (dynamic) {
1146
- staticParams.push(numberToHex(staticSize + dynamicSize, { size: 32 }));
1147
- dynamicParams.push(encoded);
1148
- dynamicSize += size(encoded);
1149
- } else {
1150
- staticParams.push(encoded);
1151
- }
973
+ };
974
+ Object.defineProperty(FeeCapTooLowError, "nodeMessage", {
975
+ enumerable: true,
976
+ configurable: true,
977
+ writable: true,
978
+ value: /max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/
979
+ });
980
+ var NonceTooHighError = class extends BaseError {
981
+ constructor({ cause, nonce } = {}) {
982
+ super(`Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ""}is higher than the next one expected.`, { cause, name: "NonceTooHighError" });
1152
983
  }
1153
- return concatHex([...staticParams, ...dynamicParams]);
1154
- }
1155
- function encodeAddress(value) {
1156
- if (!isAddress(value))
1157
- throw new InvalidAddressError({ address: value });
1158
- return { dynamic: false, encoded: padHex(value.toLowerCase()) };
1159
- }
1160
- function encodeArray(value, { length, param }) {
1161
- const dynamic = length === null;
1162
- if (!Array.isArray(value))
1163
- throw new InvalidArrayError(value);
1164
- if (!dynamic && value.length !== length)
1165
- throw new AbiEncodingArrayLengthMismatchError({
1166
- expectedLength: length,
1167
- givenLength: value.length,
1168
- type: `${param.type}[${length}]`
984
+ };
985
+ Object.defineProperty(NonceTooHighError, "nodeMessage", {
986
+ enumerable: true,
987
+ configurable: true,
988
+ writable: true,
989
+ value: /nonce too high/
990
+ });
991
+ var NonceTooLowError = class extends BaseError {
992
+ constructor({ cause, nonce } = {}) {
993
+ super([
994
+ `Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ""}is lower than the current nonce of the account.`,
995
+ "Try increasing the nonce or find the latest nonce with `getTransactionCount`."
996
+ ].join("\n"), { cause, name: "NonceTooLowError" });
997
+ }
998
+ };
999
+ Object.defineProperty(NonceTooLowError, "nodeMessage", {
1000
+ enumerable: true,
1001
+ configurable: true,
1002
+ writable: true,
1003
+ value: /nonce too low|transaction already imported|already known/
1004
+ });
1005
+ var NonceMaxValueError = class extends BaseError {
1006
+ constructor({ cause, nonce } = {}) {
1007
+ super(`Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ""}exceeds the maximum allowed nonce.`, { cause, name: "NonceMaxValueError" });
1008
+ }
1009
+ };
1010
+ Object.defineProperty(NonceMaxValueError, "nodeMessage", {
1011
+ enumerable: true,
1012
+ configurable: true,
1013
+ writable: true,
1014
+ value: /nonce has max value/
1015
+ });
1016
+ var InsufficientFundsError = class extends BaseError {
1017
+ constructor({ cause } = {}) {
1018
+ super([
1019
+ "The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."
1020
+ ].join("\n"), {
1021
+ cause,
1022
+ metaMessages: [
1023
+ "This error could arise when the account does not have enough funds to:",
1024
+ " - pay for the total gas fee,",
1025
+ " - pay for the value to send.",
1026
+ " ",
1027
+ "The cost of the transaction is calculated as `gas * gas fee + value`, where:",
1028
+ " - `gas` is the amount of gas needed for transaction to execute,",
1029
+ " - `gas fee` is the gas fee,",
1030
+ " - `value` is the amount of ether to send to the recipient."
1031
+ ],
1032
+ name: "InsufficientFundsError"
1169
1033
  });
1170
- let dynamicChild = value.length === 0 && isDynamicType(param);
1171
- const preparedParams = [];
1172
- for (let i = 0; i < value.length; i++) {
1173
- const preparedParam = prepareParam({ param, value: value[i] });
1174
- if (preparedParam.dynamic)
1175
- dynamicChild = true;
1176
- preparedParams.push(preparedParam);
1177
1034
  }
1178
- if (dynamic || dynamicChild) {
1179
- const data = encodeParams(preparedParams);
1180
- if (dynamic) {
1181
- const length2 = numberToHex(preparedParams.length, { size: 32 });
1182
- return {
1183
- dynamic: true,
1184
- encoded: concatHex([length2, data])
1185
- };
1186
- }
1187
- if (dynamicChild)
1188
- return { dynamic: true, encoded: data };
1035
+ };
1036
+ Object.defineProperty(InsufficientFundsError, "nodeMessage", {
1037
+ enumerable: true,
1038
+ configurable: true,
1039
+ writable: true,
1040
+ value: /insufficient funds|exceeds transaction sender account balance/
1041
+ });
1042
+ var IntrinsicGasTooHighError = class extends BaseError {
1043
+ constructor({ cause, gas } = {}) {
1044
+ super(`The amount of gas ${gas ? `(${gas}) ` : ""}provided for the transaction exceeds the limit allowed for the block.`, {
1045
+ cause,
1046
+ name: "IntrinsicGasTooHighError"
1047
+ });
1189
1048
  }
1190
- return {
1191
- dynamic: false,
1192
- encoded: concatHex(preparedParams.map(({ encoded }) => encoded))
1193
- };
1194
- }
1195
- function encodeBytes(value, { param }) {
1196
- const [, paramSize] = param.type.split("bytes");
1197
- const bytesSize = size(value);
1198
- if (!paramSize) {
1199
- let value_ = value;
1200
- if (bytesSize % 32 !== 0)
1201
- value_ = padHex(value_, {
1202
- dir: "right",
1203
- size: Math.ceil((value.length - 2) / 2 / 32) * 32
1204
- });
1205
- return {
1206
- dynamic: true,
1207
- encoded: concatHex([
1208
- padHex(numberToHex(bytesSize, { size: 32 })),
1209
- value_
1210
- ])
1211
- };
1049
+ };
1050
+ Object.defineProperty(IntrinsicGasTooHighError, "nodeMessage", {
1051
+ enumerable: true,
1052
+ configurable: true,
1053
+ writable: true,
1054
+ value: /intrinsic gas too high|gas limit reached/
1055
+ });
1056
+ var IntrinsicGasTooLowError = class extends BaseError {
1057
+ constructor({ cause, gas } = {}) {
1058
+ super(`The amount of gas ${gas ? `(${gas}) ` : ""}provided for the transaction is too low.`, {
1059
+ cause,
1060
+ name: "IntrinsicGasTooLowError"
1061
+ });
1212
1062
  }
1213
- if (bytesSize !== Number.parseInt(paramSize, 10))
1214
- throw new AbiEncodingBytesSizeMismatchError({
1215
- expectedSize: Number.parseInt(paramSize, 10),
1216
- value
1063
+ };
1064
+ Object.defineProperty(IntrinsicGasTooLowError, "nodeMessage", {
1065
+ enumerable: true,
1066
+ configurable: true,
1067
+ writable: true,
1068
+ value: /intrinsic gas too low/
1069
+ });
1070
+ var TransactionTypeNotSupportedError = class extends BaseError {
1071
+ constructor({ cause }) {
1072
+ super("The transaction type is not supported for this chain.", {
1073
+ cause,
1074
+ name: "TransactionTypeNotSupportedError"
1217
1075
  });
1218
- return { dynamic: false, encoded: padHex(value, { dir: "right" }) };
1219
- }
1220
- function encodeBool(value) {
1221
- if (typeof value !== "boolean")
1222
- throw new BaseError(`Invalid boolean value: "${value}" (type: ${typeof value}). Expected: \`true\` or \`false\`.`);
1223
- return { dynamic: false, encoded: padHex(boolToHex(value)) };
1224
- }
1225
- function encodeNumber(value, { signed, size: size4 = 256 }) {
1226
- if (typeof size4 === "number") {
1227
- const max = 2n ** (BigInt(size4) - (signed ? 1n : 0n)) - 1n;
1228
- const min = signed ? -max - 1n : 0n;
1229
- if (value > max || value < min)
1230
- throw new IntegerOutOfRangeError({
1231
- max: max.toString(),
1232
- min: min.toString(),
1233
- signed,
1234
- size: size4 / 8,
1235
- value: value.toString()
1236
- });
1237
1076
  }
1238
- return {
1239
- dynamic: false,
1240
- encoded: numberToHex(value, {
1241
- size: 32,
1242
- signed
1243
- })
1244
- };
1245
- }
1246
- function encodeString(value) {
1247
- const hexValue = stringToHex(value);
1248
- const partsLength = Math.ceil(size(hexValue) / 32);
1249
- const parts = [];
1250
- for (let i = 0; i < partsLength; i++) {
1251
- parts.push(padHex(slice(hexValue, i * 32, (i + 1) * 32), {
1252
- dir: "right"
1253
- }));
1077
+ };
1078
+ Object.defineProperty(TransactionTypeNotSupportedError, "nodeMessage", {
1079
+ enumerable: true,
1080
+ configurable: true,
1081
+ writable: true,
1082
+ value: /transaction type not valid/
1083
+ });
1084
+ var TipAboveFeeCapError = class extends BaseError {
1085
+ constructor({ cause, maxPriorityFeePerGas, maxFeePerGas } = {}) {
1086
+ super([
1087
+ `The provided tip (\`maxPriorityFeePerGas\`${maxPriorityFeePerGas ? ` = ${formatGwei(maxPriorityFeePerGas)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)} gwei` : ""}).`
1088
+ ].join("\n"), {
1089
+ cause,
1090
+ name: "TipAboveFeeCapError"
1091
+ });
1092
+ }
1093
+ };
1094
+ Object.defineProperty(TipAboveFeeCapError, "nodeMessage", {
1095
+ enumerable: true,
1096
+ configurable: true,
1097
+ writable: true,
1098
+ value: /max priority fee per gas higher than max fee per gas|tip higher than fee cap/
1099
+ });
1100
+ var UnknownNodeError = class extends BaseError {
1101
+ constructor({ cause }) {
1102
+ super(`An error occurred while executing: ${cause?.shortMessage}`, {
1103
+ cause,
1104
+ name: "UnknownNodeError"
1105
+ });
1254
1106
  }
1255
- return {
1256
- dynamic: true,
1257
- encoded: concatHex([
1258
- padHex(numberToHex(size(hexValue), { size: 32 })),
1259
- ...parts
1260
- ])
1261
- };
1107
+ };
1108
+
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
+ });
1262
1118
  }
1263
- function encodeTuple(value, { param }) {
1264
- let dynamic = false;
1265
- const preparedParams = [];
1266
- for (let i = 0; i < param.components.length; i++) {
1267
- const param_ = param.components[i];
1268
- const index = Array.isArray(value) ? i : param_.name;
1269
- const preparedParam = prepareParam({
1270
- param: param_,
1271
- value: value[index]
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)
1272
1133
  });
1273
- preparedParams.push(preparedParam);
1274
- if (preparedParam.dynamic)
1275
- dynamic = true;
1276
1134
  }
1277
- return {
1278
- dynamic,
1279
- encoded: dynamic ? encodeParams(preparedParams) : concatHex(preparedParams.map(({ encoded }) => encoded))
1280
- };
1281
1135
  }
1282
- function getArrayComponents(type) {
1283
- const matches = type.match(/^(.*)\[(\d+)?\]$/);
1284
- return matches ? (
1285
- // Return `null` if the array is dynamic.
1286
- [matches[2] ? Number(matches[2]) : null, matches[1]]
1287
- ) : void 0;
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;
1288
1142
  }
1289
- function isDynamicType(param) {
1290
- const { type } = param;
1291
- if (type === "string")
1292
- return true;
1293
- if (type === "bytes")
1294
- return true;
1295
- if (type.endsWith("[]"))
1296
- return true;
1297
- if (type === "tuple")
1298
- return param.components.some(isDynamicType);
1299
- const arrayComponents = getArrayComponents(type);
1300
- if (arrayComponents)
1301
- return isDynamicType({ ...param, type: arrayComponents[1] });
1302
- return false;
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;
1303
1149
  }
1304
1150
 
1305
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/stringify.js
1306
- var stringify = (value, replacer, space) => JSON.stringify(value, (key, value_) => {
1307
- const value2 = typeof value_ === "bigint" ? value_.toString() : value_;
1308
- return typeof replacer === "function" ? replacer(key, value2) : value2;
1309
- }, space);
1310
-
1311
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/constants/unit.js
1312
- var etherUnits = {
1313
- gwei: 9,
1314
- wei: 18
1315
- };
1316
- var gweiUnits = {
1317
- ether: -9,
1318
- wei: 9
1319
- };
1320
-
1321
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/unit/formatUnits.js
1322
- function formatUnits(value, decimals) {
1323
- let display = value.toString();
1324
- const negative = display.startsWith("-");
1325
- if (negative)
1326
- display = display.slice(1);
1327
- display = display.padStart(decimals, "0");
1328
- let [integer, fraction] = [
1329
- display.slice(0, display.length - decimals),
1330
- display.slice(display.length - decimals)
1331
- ];
1332
- fraction = fraction.replace(/(0+)$/, "");
1333
- return `${negative ? "-" : ""}${integer || "0"}${fraction ? `.${fraction}` : ""}`;
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 })})`;
1334
1156
  }
1335
-
1336
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/unit/formatEther.js
1337
- function formatEther(wei, unit = "wei") {
1338
- return formatUnits(wei, etherUnits[unit]);
1157
+ function formatAbiParams(params, { includeName = false } = {}) {
1158
+ if (!params)
1159
+ return "";
1160
+ return params.map((param) => formatAbiParam(param, { includeName })).join(includeName ? ", " : ",");
1339
1161
  }
1340
-
1341
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/unit/formatGwei.js
1342
- function formatGwei(wei, unit = "wei") {
1343
- return formatUnits(wei, gweiUnits[unit]);
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}` : "");
1344
1167
  }
1345
1168
 
1346
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/errors/transaction.js
1347
- function prettyPrint(args) {
1348
- const entries = Object.entries(args).map(([key, value]) => {
1349
- if (value === void 0 || value === false)
1350
- return null;
1351
- return [key, value];
1352
- }).filter(Boolean);
1353
- const maxLength = entries.reduce((acc, [key]) => Math.max(acc, key.length), 0);
1354
- return entries.map(([key, value]) => ` ${`${key}:`.padEnd(maxLength + 1)} ${value}`).join("\n");
1355
- }
1356
- var InvalidLegacyVError = class extends BaseError {
1357
- constructor({ v }) {
1358
- super(`Invalid \`v\` value "${v}". Expected 27 or 28.`, {
1359
- name: "InvalidLegacyVError"
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"
1178
+ });
1179
+ }
1180
+ };
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"), {
1206
+ metaMessages: [
1207
+ `Params: (${formatAbiParams(params, { includeName: true })})`,
1208
+ `Data: ${data} (${size4} bytes)`
1209
+ ],
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
1240
+ });
1241
+ }
1242
+ };
1243
+ var AbiEncodingArrayLengthMismatchError = class extends BaseError {
1244
+ constructor({ expectedLength, givenLength, type }) {
1245
+ super([
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."
1272
+ ].join("\n"), {
1273
+ docsPath,
1274
+ name: "AbiErrorInputsNotFoundError"
1360
1275
  });
1361
1276
  }
1362
1277
  };
1363
- var InvalidSerializableTransactionError = class extends BaseError {
1364
- constructor({ transaction }) {
1365
- super("Cannot infer a transaction type from provided transaction.", {
1366
- metaMessages: [
1367
- "Provided Transaction:",
1368
- "{",
1369
- prettyPrint(transaction),
1370
- "}",
1371
- "",
1372
- "To infer the type, either provide:",
1373
- "- a `type` to the Transaction, or",
1374
- "- an EIP-1559 Transaction with `maxFeePerGas`, or",
1375
- "- an EIP-2930 Transaction with `gasPrice` & `accessList`, or",
1376
- "- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or",
1377
- "- an EIP-7702 Transaction with `authorizationList`, or",
1378
- "- a Legacy Transaction with `gasPrice`"
1379
- ],
1380
- name: "InvalidSerializableTransactionError"
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"
1381
1286
  });
1382
1287
  }
1383
1288
  };
1384
- var InvalidStorageKeySizeError = class extends BaseError {
1385
- constructor({ storageKey }) {
1386
- super(`Size for storage key "${storageKey}" is invalid. Expected 32 bytes. Got ${Math.floor((storageKey.length - 2) / 2)} bytes.`, { name: "InvalidStorageKeySizeError" });
1387
- }
1388
- };
1389
- var TransactionExecutionError = class extends BaseError {
1390
- constructor(cause, { account, docsPath, chain, data, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, to, value }) {
1391
- const prettyArgs = prettyPrint({
1392
- chain: chain && `${chain?.name} (id: ${chain?.id})`,
1393
- from: account?.address,
1394
- to,
1395
- value: typeof value !== "undefined" && `${formatEther(value)} ${chain?.nativeCurrency?.symbol || "ETH"}`,
1396
- data,
1397
- gas,
1398
- gasPrice: typeof gasPrice !== "undefined" && `${formatGwei(gasPrice)} gwei`,
1399
- maxFeePerGas: typeof maxFeePerGas !== "undefined" && `${formatGwei(maxFeePerGas)} gwei`,
1400
- maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== "undefined" && `${formatGwei(maxPriorityFeePerGas)} gwei`,
1401
- nonce
1402
- });
1403
- super(cause.shortMessage, {
1404
- cause,
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"), {
1405
1296
  docsPath,
1406
- metaMessages: [
1407
- ...cause.metaMessages ? [...cause.metaMessages, " "] : [],
1408
- "Request Arguments:",
1409
- prettyArgs
1410
- ].filter(Boolean),
1411
- name: "TransactionExecutionError"
1297
+ name: "AbiErrorSignatureNotFoundError",
1298
+ cause
1412
1299
  });
1413
- Object.defineProperty(this, "cause", {
1300
+ Object.defineProperty(this, "signature", {
1414
1301
  enumerable: true,
1415
1302
  configurable: true,
1416
1303
  writable: true,
1417
1304
  value: void 0
1418
1305
  });
1419
- this.cause = cause;
1306
+ this.signature = signature;
1420
1307
  }
1421
1308
  };
1422
- var TransactionNotFoundError = class extends BaseError {
1423
- constructor({ blockHash, blockNumber, blockTag, hash, index }) {
1424
- let identifier = "Transaction";
1425
- if (blockTag && index !== void 0)
1426
- identifier = `Transaction at block time "${blockTag}" at index "${index}"`;
1427
- if (blockHash && index !== void 0)
1428
- identifier = `Transaction at block hash "${blockHash}" at index "${index}"`;
1429
- if (blockNumber && index !== void 0)
1430
- identifier = `Transaction at block number "${blockNumber}" at index "${index}"`;
1431
- if (hash)
1432
- identifier = `Transaction with hash "${hash}"`;
1433
- super(`${identifier} could not be found.`, {
1434
- name: "TransactionNotFoundError"
1309
+ var AbiEventSignatureEmptyTopicsError = class extends BaseError {
1310
+ constructor({ docsPath }) {
1311
+ super("Cannot extract event signature from empty topics.", {
1312
+ docsPath,
1313
+ name: "AbiEventSignatureEmptyTopicsError"
1435
1314
  });
1436
1315
  }
1437
1316
  };
1438
- var TransactionReceiptNotFoundError = class extends BaseError {
1439
- constructor({ hash }) {
1440
- super(`Transaction receipt with hash "${hash}" could not be found. The Transaction may not be processed on a block yet.`, {
1441
- name: "TransactionReceiptNotFoundError"
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"
1442
1326
  });
1443
1327
  }
1444
1328
  };
1445
- var TransactionReceiptRevertedError = class extends BaseError {
1446
- constructor({ receipt }) {
1447
- super(`Transaction with hash "${receipt.transactionHash}" reverted.`, {
1448
- metaMessages: [
1449
- 'The receipt marked the transaction as "reverted". This could mean that the function on the contract you are trying to call threw an error.',
1450
- " ",
1451
- "You can attempt to extract the revert reason by:",
1452
- "- calling the `simulateContract` or `simulateCalls` Action with the `abi` and `functionName` of the contract",
1453
- "- using the `call` Action with raw `data`"
1454
- ],
1455
- name: "TransactionReceiptRevertedError"
1456
- });
1457
- Object.defineProperty(this, "receipt", {
1458
- enumerable: true,
1459
- configurable: true,
1460
- writable: true,
1461
- value: void 0
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"
1462
1337
  });
1463
- this.receipt = receipt;
1464
1338
  }
1465
1339
  };
1466
- var WaitForTransactionReceiptTimeoutError = class extends BaseError {
1467
- constructor({ hash }) {
1468
- super(`Timed out while waiting for transaction with hash "${hash}" to be confirmed.`, { name: "WaitForTransactionReceiptTimeoutError" });
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
+ });
1469
1349
  }
1470
1350
  };
1471
-
1472
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/constants/number.js
1473
- var maxInt8 = 2n ** (8n - 1n) - 1n;
1474
- var maxInt16 = 2n ** (16n - 1n) - 1n;
1475
- var maxInt24 = 2n ** (24n - 1n) - 1n;
1476
- var maxInt32 = 2n ** (32n - 1n) - 1n;
1477
- var maxInt40 = 2n ** (40n - 1n) - 1n;
1478
- var maxInt48 = 2n ** (48n - 1n) - 1n;
1479
- var maxInt56 = 2n ** (56n - 1n) - 1n;
1480
- var maxInt64 = 2n ** (64n - 1n) - 1n;
1481
- var maxInt72 = 2n ** (72n - 1n) - 1n;
1482
- var maxInt80 = 2n ** (80n - 1n) - 1n;
1483
- var maxInt88 = 2n ** (88n - 1n) - 1n;
1484
- var maxInt96 = 2n ** (96n - 1n) - 1n;
1485
- var maxInt104 = 2n ** (104n - 1n) - 1n;
1486
- var maxInt112 = 2n ** (112n - 1n) - 1n;
1487
- var maxInt120 = 2n ** (120n - 1n) - 1n;
1488
- var maxInt128 = 2n ** (128n - 1n) - 1n;
1489
- var maxInt136 = 2n ** (136n - 1n) - 1n;
1490
- var maxInt144 = 2n ** (144n - 1n) - 1n;
1491
- var maxInt152 = 2n ** (152n - 1n) - 1n;
1492
- var maxInt160 = 2n ** (160n - 1n) - 1n;
1493
- var maxInt168 = 2n ** (168n - 1n) - 1n;
1494
- var maxInt176 = 2n ** (176n - 1n) - 1n;
1495
- var maxInt184 = 2n ** (184n - 1n) - 1n;
1496
- var maxInt192 = 2n ** (192n - 1n) - 1n;
1497
- var maxInt200 = 2n ** (200n - 1n) - 1n;
1498
- var maxInt208 = 2n ** (208n - 1n) - 1n;
1499
- var maxInt216 = 2n ** (216n - 1n) - 1n;
1500
- var maxInt224 = 2n ** (224n - 1n) - 1n;
1501
- var maxInt232 = 2n ** (232n - 1n) - 1n;
1502
- var maxInt240 = 2n ** (240n - 1n) - 1n;
1503
- var maxInt248 = 2n ** (248n - 1n) - 1n;
1504
- var maxInt256 = 2n ** (256n - 1n) - 1n;
1505
- var minInt8 = -(2n ** (8n - 1n));
1506
- var minInt16 = -(2n ** (16n - 1n));
1507
- var minInt24 = -(2n ** (24n - 1n));
1508
- var minInt32 = -(2n ** (32n - 1n));
1509
- var minInt40 = -(2n ** (40n - 1n));
1510
- var minInt48 = -(2n ** (48n - 1n));
1511
- var minInt56 = -(2n ** (56n - 1n));
1512
- var minInt64 = -(2n ** (64n - 1n));
1513
- var minInt72 = -(2n ** (72n - 1n));
1514
- var minInt80 = -(2n ** (80n - 1n));
1515
- var minInt88 = -(2n ** (88n - 1n));
1516
- var minInt96 = -(2n ** (96n - 1n));
1517
- var minInt104 = -(2n ** (104n - 1n));
1518
- var minInt112 = -(2n ** (112n - 1n));
1519
- var minInt120 = -(2n ** (120n - 1n));
1520
- var minInt128 = -(2n ** (128n - 1n));
1521
- var minInt136 = -(2n ** (136n - 1n));
1522
- var minInt144 = -(2n ** (144n - 1n));
1523
- var minInt152 = -(2n ** (152n - 1n));
1524
- var minInt160 = -(2n ** (160n - 1n));
1525
- var minInt168 = -(2n ** (168n - 1n));
1526
- var minInt176 = -(2n ** (176n - 1n));
1527
- var minInt184 = -(2n ** (184n - 1n));
1528
- var minInt192 = -(2n ** (192n - 1n));
1529
- var minInt200 = -(2n ** (200n - 1n));
1530
- var minInt208 = -(2n ** (208n - 1n));
1531
- var minInt216 = -(2n ** (216n - 1n));
1532
- var minInt224 = -(2n ** (224n - 1n));
1533
- var minInt232 = -(2n ** (232n - 1n));
1534
- var minInt240 = -(2n ** (240n - 1n));
1535
- var minInt248 = -(2n ** (248n - 1n));
1536
- var minInt256 = -(2n ** (256n - 1n));
1537
- var maxUint8 = 2n ** 8n - 1n;
1538
- var maxUint16 = 2n ** 16n - 1n;
1539
- var maxUint24 = 2n ** 24n - 1n;
1540
- var maxUint32 = 2n ** 32n - 1n;
1541
- var maxUint40 = 2n ** 40n - 1n;
1542
- var maxUint48 = 2n ** 48n - 1n;
1543
- var maxUint56 = 2n ** 56n - 1n;
1544
- var maxUint64 = 2n ** 64n - 1n;
1545
- var maxUint72 = 2n ** 72n - 1n;
1546
- var maxUint80 = 2n ** 80n - 1n;
1547
- var maxUint88 = 2n ** 88n - 1n;
1548
- var maxUint96 = 2n ** 96n - 1n;
1549
- var maxUint104 = 2n ** 104n - 1n;
1550
- var maxUint112 = 2n ** 112n - 1n;
1551
- var maxUint120 = 2n ** 120n - 1n;
1552
- var maxUint128 = 2n ** 128n - 1n;
1553
- var maxUint136 = 2n ** 136n - 1n;
1554
- var maxUint144 = 2n ** 144n - 1n;
1555
- var maxUint152 = 2n ** 152n - 1n;
1556
- var maxUint160 = 2n ** 160n - 1n;
1557
- var maxUint168 = 2n ** 168n - 1n;
1558
- var maxUint176 = 2n ** 176n - 1n;
1559
- var maxUint184 = 2n ** 184n - 1n;
1560
- var maxUint192 = 2n ** 192n - 1n;
1561
- var maxUint200 = 2n ** 200n - 1n;
1562
- var maxUint208 = 2n ** 208n - 1n;
1563
- var maxUint216 = 2n ** 216n - 1n;
1564
- var maxUint224 = 2n ** 224n - 1n;
1565
- var maxUint232 = 2n ** 232n - 1n;
1566
- var maxUint240 = 2n ** 240n - 1n;
1567
- var maxUint248 = 2n ** 248n - 1n;
1568
- var maxUint256 = 2n ** 256n - 1n;
1569
-
1570
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/errors/chain.js
1571
- var ChainDoesNotSupportContract = class extends BaseError {
1572
- constructor({ blockNumber, chain, contract }) {
1573
- super(`Chain "${chain.name}" does not support contract "${contract.name}".`, {
1574
- metaMessages: [
1575
- "This could be due to any of the following:",
1576
- ...blockNumber && contract.blockCreated && contract.blockCreated > blockNumber ? [
1577
- `- The contract "${contract.name}" was not deployed until block ${contract.blockCreated} (current block ${blockNumber}).`
1578
- ] : [
1579
- `- The chain does not have the contract "${contract.name}" configured.`
1580
- ]
1581
- ],
1582
- name: "ChainDoesNotSupportContract"
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"
1583
1360
  });
1584
1361
  }
1585
1362
  };
1586
- var ClientChainNotConfiguredError = class extends BaseError {
1587
- constructor() {
1588
- super("No chain was provided to the Client.", {
1589
- name: "ClientChainNotConfiguredError"
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"
1590
1372
  });
1591
1373
  }
1592
1374
  };
1593
- var InvalidChainIdError = class extends BaseError {
1594
- constructor({ chainId }) {
1595
- super(typeof chainId === "number" ? `Chain ID "${chainId}" is invalid.` : "Chain ID is invalid.", { name: "InvalidChainIdError" });
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
+ });
1596
1387
  }
1597
1388
  };
1598
-
1599
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/errors/node.js
1600
- var ExecutionRevertedError = class extends BaseError {
1601
- constructor({ cause, message } = {}) {
1602
- const reason = message?.replace("execution reverted: ", "")?.replace("execution reverted", "");
1603
- super(`Execution reverted ${reason ? `with reason: ${reason}` : "for an unknown reason"}.`, {
1604
- cause,
1605
- name: "ExecutionRevertedError"
1389
+ var BytesSizeMismatchError = class extends BaseError {
1390
+ constructor({ expectedSize, givenSize }) {
1391
+ super(`Expected bytes${expectedSize}, got bytes${givenSize}.`, {
1392
+ name: "BytesSizeMismatchError"
1606
1393
  });
1607
1394
  }
1608
1395
  };
1609
- Object.defineProperty(ExecutionRevertedError, "code", {
1610
- enumerable: true,
1611
- configurable: true,
1612
- writable: true,
1613
- value: 3
1614
- });
1615
- Object.defineProperty(ExecutionRevertedError, "nodeMessage", {
1616
- enumerable: true,
1617
- configurable: true,
1618
- writable: true,
1619
- value: /execution reverted|gas required exceeds allowance/
1620
- });
1621
- var FeeCapTooHighError = class extends BaseError {
1622
- constructor({ cause, maxFeePerGas } = {}) {
1623
- super(`The fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`, {
1624
- cause,
1625
- name: "FeeCapTooHighError"
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
1626
1430
  });
1431
+ this.abiItem = abiItem;
1432
+ this.data = data;
1433
+ this.params = params;
1434
+ this.size = size4;
1627
1435
  }
1628
1436
  };
1629
- Object.defineProperty(FeeCapTooHighError, "nodeMessage", {
1630
- enumerable: true,
1631
- configurable: true,
1632
- writable: true,
1633
- value: /max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/
1634
- });
1635
- var FeeCapTooLowError = class extends BaseError {
1636
- constructor({ cause, maxFeePerGas } = {}) {
1637
- super(`The fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)}` : ""} gwei) cannot be lower than the block base fee.`, {
1638
- cause,
1639
- name: "FeeCapTooLowError"
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
1640
1447
  });
1448
+ this.abiItem = abiItem;
1641
1449
  }
1642
1450
  };
1643
- Object.defineProperty(FeeCapTooLowError, "nodeMessage", {
1644
- enumerable: true,
1645
- configurable: true,
1646
- writable: true,
1647
- value: /max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/
1648
- });
1649
- var NonceTooHighError = class extends BaseError {
1650
- constructor({ cause, nonce } = {}) {
1651
- super(`Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ""}is higher than the next one expected.`, { cause, name: "NonceTooHighError" });
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" });
1652
1457
  }
1653
1458
  };
1654
- Object.defineProperty(NonceTooHighError, "nodeMessage", {
1655
- enumerable: true,
1656
- configurable: true,
1657
- writable: true,
1658
- value: /nonce too high/
1659
- });
1660
- var NonceTooLowError = class extends BaseError {
1661
- constructor({ cause, nonce } = {}) {
1459
+ var InvalidAbiDecodingTypeError = class extends BaseError {
1460
+ constructor(type, { docsPath }) {
1662
1461
  super([
1663
- `Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ""}is lower than the current nonce of the account.`,
1664
- "Try increasing the nonce or find the latest nonce with `getTransactionCount`."
1665
- ].join("\n"), { cause, name: "NonceTooLowError" });
1462
+ `Type "${type}" is not a valid decoding type.`,
1463
+ "Please provide a valid ABI type."
1464
+ ].join("\n"), { docsPath, name: "InvalidAbiDecodingType" });
1666
1465
  }
1667
1466
  };
1668
- Object.defineProperty(NonceTooLowError, "nodeMessage", {
1669
- enumerable: true,
1670
- configurable: true,
1671
- writable: true,
1672
- value: /nonce too low|transaction already imported|already known/
1673
- });
1674
- var NonceMaxValueError = class extends BaseError {
1675
- constructor({ cause, nonce } = {}) {
1676
- super(`Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ""}exceeds the maximum allowed nonce.`, { cause, name: "NonceMaxValueError" });
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
+ }
1677
1571
  }
1678
- };
1679
- Object.defineProperty(NonceMaxValueError, "nodeMessage", {
1680
- enumerable: true,
1681
- configurable: true,
1682
- writable: true,
1683
- value: /nonce has max value/
1684
- });
1685
- var InsufficientFundsError = class extends BaseError {
1686
- constructor({ cause } = {}) {
1687
- super([
1688
- "The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."
1689
- ].join("\n"), {
1690
- cause,
1691
- metaMessages: [
1692
- "This error could arise when the account does not have enough funds to:",
1693
- " - pay for the total gas fee,",
1694
- " - pay for the value to send.",
1695
- " ",
1696
- "The cost of the transaction is calculated as `gas * gas fee + value`, where:",
1697
- " - `gas` is the amount of gas needed for transaction to execute,",
1698
- " - `gas fee` is the gas fee,",
1699
- " - `value` is the amount of ether to send to the recipient."
1700
- ],
1701
- name: "InsufficientFundsError"
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}]`
1702
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);
1703
1596
  }
1704
- };
1705
- Object.defineProperty(InsufficientFundsError, "nodeMessage", {
1706
- enumerable: true,
1707
- configurable: true,
1708
- writable: true,
1709
- value: /insufficient funds|exceeds transaction sender account balance/
1710
- });
1711
- var IntrinsicGasTooHighError = class extends BaseError {
1712
- constructor({ cause, gas } = {}) {
1713
- super(`The amount of gas ${gas ? `(${gas}) ` : ""}provided for the transaction exceeds the limit allowed for the block.`, {
1714
- cause,
1715
- name: "IntrinsicGasTooHighError"
1716
- });
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 };
1717
1608
  }
1718
- };
1719
- Object.defineProperty(IntrinsicGasTooHighError, "nodeMessage", {
1720
- enumerable: true,
1721
- configurable: true,
1722
- writable: true,
1723
- value: /intrinsic gas too high|gas limit reached/
1724
- });
1725
- var IntrinsicGasTooLowError = class extends BaseError {
1726
- constructor({ cause, gas } = {}) {
1727
- super(`The amount of gas ${gas ? `(${gas}) ` : ""}provided for the transaction is too low.`, {
1728
- cause,
1729
- name: "IntrinsicGasTooLowError"
1730
- });
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
+ };
1731
1631
  }
1732
- };
1733
- Object.defineProperty(IntrinsicGasTooLowError, "nodeMessage", {
1734
- enumerable: true,
1735
- configurable: true,
1736
- writable: true,
1737
- value: /intrinsic gas too low/
1738
- });
1739
- var TransactionTypeNotSupportedError = class extends BaseError {
1740
- constructor({ cause }) {
1741
- super("The transaction type is not supported for this chain.", {
1742
- cause,
1743
- name: "TransactionTypeNotSupportedError"
1632
+ if (bytesSize !== Number.parseInt(paramSize, 10))
1633
+ throw new AbiEncodingBytesSizeMismatchError({
1634
+ expectedSize: Number.parseInt(paramSize, 10),
1635
+ value
1744
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
+ });
1745
1656
  }
1746
- };
1747
- Object.defineProperty(TransactionTypeNotSupportedError, "nodeMessage", {
1748
- enumerable: true,
1749
- configurable: true,
1750
- writable: true,
1751
- value: /transaction type not valid/
1752
- });
1753
- var TipAboveFeeCapError = class extends BaseError {
1754
- constructor({ cause, maxPriorityFeePerGas, maxFeePerGas } = {}) {
1755
- super([
1756
- `The provided tip (\`maxPriorityFeePerGas\`${maxPriorityFeePerGas ? ` = ${formatGwei(maxPriorityFeePerGas)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)} gwei` : ""}).`
1757
- ].join("\n"), {
1758
- cause,
1759
- name: "TipAboveFeeCapError"
1760
- });
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
+ }));
1761
1673
  }
1762
- };
1763
- Object.defineProperty(TipAboveFeeCapError, "nodeMessage", {
1764
- enumerable: true,
1765
- configurable: true,
1766
- writable: true,
1767
- value: /max priority fee per gas higher than max fee per gas|tip higher than fee cap/
1768
- });
1769
- var UnknownNodeError = class extends BaseError {
1770
- constructor({ cause }) {
1771
- super(`An error occurred while executing: ${cause?.shortMessage}`, {
1772
- cause,
1773
- name: "UnknownNodeError"
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]
1774
1691
  });
1692
+ preparedParams.push(preparedParam);
1693
+ if (preparedParam.dynamic)
1694
+ dynamic = true;
1775
1695
  }
1776
- };
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
+ }
1777
1723
 
1778
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/accounts/utils/parseAccount.js
1779
- function parseAccount(account) {
1780
- if (typeof account === "string")
1781
- return { address: account, type: "json-rpc" };
1782
- return account;
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";
1783
1740
  }
1784
1741
 
1785
1742
  // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/errors/cursor.js
@@ -1970,6 +1927,13 @@ function createCursor(bytes, { recursiveReadLimit = 8192 } = {}) {
1970
1927
  return cursor;
1971
1928
  }
1972
1929
 
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
+ }
1936
+
1973
1937
  // node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.4.3/node_modules/ox/_esm/core/version.js
1974
1938
  var version2 = "0.1.1";
1975
1939
 
@@ -2280,13 +2244,13 @@ function from(value) {
2280
2244
  if (value instanceof Uint8Array)
2281
2245
  return value;
2282
2246
  if (typeof value === "string")
2283
- return fromHex(value);
2247
+ return fromHex2(value);
2284
2248
  return fromArray(value);
2285
2249
  }
2286
2250
  function fromArray(value) {
2287
2251
  return value instanceof Uint8Array ? value : new Uint8Array(value);
2288
2252
  }
2289
- function fromHex(value, options = {}) {
2253
+ function fromHex2(value, options = {}) {
2290
2254
  const { size: size4 } = options;
2291
2255
  let hex = value;
2292
2256
  if (size4) {
@@ -2461,10 +2425,10 @@ function assert2(value, options = {}) {
2461
2425
  throw new InvalidHexTypeError(value);
2462
2426
  if (strict) {
2463
2427
  if (!/^0x[0-9a-fA-F]*$/.test(value))
2464
- throw new InvalidHexValueError(value);
2428
+ throw new InvalidHexValueError2(value);
2465
2429
  }
2466
2430
  if (!value.startsWith("0x"))
2467
- throw new InvalidHexValueError(value);
2431
+ throw new InvalidHexValueError2(value);
2468
2432
  }
2469
2433
  function concat3(...values) {
2470
2434
  return `0x${values.reduce((acc, x) => acc + x.replace("0x", ""), "")}`;
@@ -2600,7 +2564,7 @@ var InvalidHexTypeError = class extends BaseError2 {
2600
2564
  });
2601
2565
  }
2602
2566
  };
2603
- var InvalidHexValueError = class extends BaseError2 {
2567
+ var InvalidHexValueError2 = class extends BaseError2 {
2604
2568
  constructor(value) {
2605
2569
  super(`Value \`${value}\` is an invalid hex value.`, {
2606
2570
  metaMessages: [
@@ -2650,48 +2614,171 @@ var SizeExceedsPaddingSizeError3 = class extends BaseError2 {
2650
2614
  };
2651
2615
 
2652
2616
  export {
2617
+ setErrorConfig,
2653
2618
  BaseError,
2619
+ IntegerOutOfRangeError,
2654
2620
  InvalidBytesBooleanError,
2621
+ InvalidHexBooleanError,
2622
+ InvalidHexValueError,
2623
+ RlpDepthLimitExceededError,
2624
+ RlpListBoundaryExceededError,
2625
+ RlpTrailingBytesError,
2626
+ SizeOverflowError,
2627
+ SliceOffsetOutOfBoundsError,
2628
+ SizeExceedsPaddingSizeError,
2655
2629
  InvalidBytesLengthError,
2630
+ pad,
2631
+ padHex,
2632
+ padBytes,
2656
2633
  isHex,
2657
2634
  size,
2658
2635
  trim,
2659
- toBytes2 as toBytes,
2636
+ toBytes,
2637
+ boolToBytes,
2660
2638
  hexToBytes,
2639
+ numberToBytes,
2661
2640
  stringToBytes,
2662
2641
  assertSize,
2642
+ fromHex,
2663
2643
  hexToBigInt,
2664
2644
  hexToBool,
2665
2645
  hexToNumber,
2646
+ hexToString,
2666
2647
  toHex,
2648
+ boolToHex,
2667
2649
  bytesToHex,
2668
2650
  numberToHex,
2669
2651
  stringToHex,
2652
+ formatBlockParameter,
2670
2653
  LruMap,
2671
2654
  InvalidAddressError,
2672
- keccak_256,
2673
2655
  keccak256,
2674
2656
  checksumAddress,
2675
2657
  getAddress,
2676
2658
  isAddress,
2677
2659
  concat,
2660
+ concatBytes,
2678
2661
  concatHex,
2679
2662
  PositionOutOfBoundsError,
2680
2663
  createCursor,
2664
+ etherUnits,
2665
+ gweiUnits,
2666
+ weiUnits,
2681
2667
  formatUnits,
2682
2668
  formatEther,
2683
2669
  formatGwei,
2684
2670
  prettyPrint,
2671
+ FeeConflictError,
2685
2672
  InvalidLegacyVError,
2673
+ InvalidYParityError,
2686
2674
  InvalidSerializableTransactionError,
2675
+ InvalidSerializedTransactionTypeError,
2676
+ InvalidSerializedTransactionError,
2687
2677
  InvalidStorageKeySizeError,
2688
2678
  TransactionExecutionError,
2689
2679
  TransactionNotFoundError,
2690
2680
  TransactionReceiptNotFoundError,
2691
2681
  TransactionReceiptRevertedError,
2692
2682
  WaitForTransactionReceiptTimeoutError,
2683
+ maxInt8,
2684
+ maxInt16,
2685
+ maxInt24,
2686
+ maxInt32,
2687
+ maxInt40,
2688
+ maxInt48,
2689
+ maxInt56,
2690
+ maxInt64,
2691
+ maxInt72,
2692
+ maxInt80,
2693
+ maxInt88,
2694
+ maxInt96,
2695
+ maxInt104,
2696
+ maxInt112,
2697
+ maxInt120,
2698
+ maxInt128,
2699
+ maxInt136,
2700
+ maxInt144,
2701
+ maxInt152,
2702
+ maxInt160,
2703
+ maxInt168,
2704
+ maxInt176,
2705
+ maxInt184,
2706
+ maxInt192,
2707
+ maxInt200,
2708
+ maxInt208,
2709
+ maxInt216,
2710
+ maxInt224,
2711
+ maxInt232,
2712
+ maxInt240,
2713
+ maxInt248,
2714
+ maxInt256,
2715
+ minInt8,
2716
+ minInt16,
2717
+ minInt24,
2718
+ minInt32,
2719
+ minInt40,
2720
+ minInt48,
2721
+ minInt56,
2722
+ minInt64,
2723
+ minInt72,
2724
+ minInt80,
2725
+ minInt88,
2726
+ minInt96,
2727
+ minInt104,
2728
+ minInt112,
2729
+ minInt120,
2730
+ minInt128,
2731
+ minInt136,
2732
+ minInt144,
2733
+ minInt152,
2734
+ minInt160,
2735
+ minInt168,
2736
+ minInt176,
2737
+ minInt184,
2738
+ minInt192,
2739
+ minInt200,
2740
+ minInt208,
2741
+ minInt216,
2742
+ minInt224,
2743
+ minInt232,
2744
+ minInt240,
2745
+ minInt248,
2746
+ minInt256,
2747
+ maxUint8,
2748
+ maxUint16,
2749
+ maxUint24,
2750
+ maxUint32,
2751
+ maxUint40,
2752
+ maxUint48,
2753
+ maxUint56,
2754
+ maxUint64,
2755
+ maxUint72,
2756
+ maxUint80,
2757
+ maxUint88,
2758
+ maxUint96,
2759
+ maxUint104,
2760
+ maxUint112,
2761
+ maxUint120,
2762
+ maxUint128,
2763
+ maxUint136,
2764
+ maxUint144,
2765
+ maxUint152,
2766
+ maxUint160,
2767
+ maxUint168,
2768
+ maxUint176,
2769
+ maxUint184,
2770
+ maxUint192,
2771
+ maxUint200,
2772
+ maxUint208,
2773
+ maxUint216,
2774
+ maxUint224,
2775
+ maxUint232,
2776
+ maxUint240,
2777
+ maxUint248,
2693
2778
  maxUint256,
2694
2779
  ChainDoesNotSupportContract,
2780
+ ChainMismatchError,
2781
+ ChainNotFoundError,
2695
2782
  ClientChainNotConfiguredError,
2696
2783
  InvalidChainIdError,
2697
2784
  ExecutionRevertedError,
@@ -2708,11 +2795,16 @@ export {
2708
2795
  UnknownNodeError,
2709
2796
  slice,
2710
2797
  sliceBytes,
2798
+ sliceHex,
2711
2799
  formatAbiItem,
2712
2800
  AbiConstructorNotFoundError,
2713
2801
  AbiConstructorParamsNotFoundError,
2802
+ AbiDecodingDataSizeInvalidError,
2714
2803
  AbiDecodingDataSizeTooSmallError,
2715
2804
  AbiDecodingZeroDataError,
2805
+ AbiEncodingArrayLengthMismatchError,
2806
+ AbiEncodingBytesSizeMismatchError,
2807
+ AbiEncodingLengthMismatchError,
2716
2808
  AbiErrorInputsNotFoundError,
2717
2809
  AbiErrorNotFoundError,
2718
2810
  AbiErrorSignatureNotFoundError,
@@ -2726,8 +2818,12 @@ export {
2726
2818
  BytesSizeMismatchError,
2727
2819
  DecodeLogDataMismatch,
2728
2820
  DecodeLogTopicsMismatch,
2821
+ InvalidAbiEncodingTypeError,
2729
2822
  InvalidAbiDecodingTypeError,
2730
2823
  InvalidArrayError,
2824
+ InvalidDefinitionTypeError,
2825
+ UnsupportedPackedAbiType,
2826
+ arrayRegex,
2731
2827
  bytesRegex,
2732
2828
  integerRegex,
2733
2829
  encodeAbiParameters,
@@ -2749,10 +2845,10 @@ export {
2749
2845
  trimLeft2 as trimLeft,
2750
2846
  toNumber,
2751
2847
  validate2 as validate,
2752
- IntegerOutOfRangeError2 as IntegerOutOfRangeError,
2848
+ IntegerOutOfRangeError2,
2753
2849
  concat2 as concat3,
2754
2850
  from as from2,
2755
- fromHex,
2851
+ fromHex2,
2756
2852
  fromString as fromString2,
2757
2853
  isEqual,
2758
2854
  random,
@@ -2766,4 +2862,4 @@ export {
2766
2862
  trimLeft as trimLeft2,
2767
2863
  validate as validate2
2768
2864
  };
2769
- //# sourceMappingURL=chunk-BRJHUQSY.js.map
2865
+ //# sourceMappingURL=chunk-YALGASEU.js.map