tenjin-cli 0.1.0-alpha.0 → 0.1.0-alpha.10

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 (191) hide show
  1. package/NOTICE.md +33 -0
  2. package/README.md +575 -50
  3. package/dist/{_esm-ZH2J4QEH.js → _esm-C5CRWCYU.js} +2 -2
  4. package/dist/_esm-N4KAVXQR.js +881 -0
  5. package/dist/buy-FMDBZ4NY.js +44 -0
  6. package/dist/candidate-7LAELUQD.js +23 -0
  7. package/dist/ccip-RPPPKTJR.js +19 -0
  8. package/dist/{ccip-FXWZDDF5.js → ccip-ZGGWQN4X.js} +6 -5
  9. package/dist/chunk-2GSRYTZS.js +127 -0
  10. package/dist/chunk-2GSRYTZS.js.map +1 -0
  11. package/dist/chunk-2I4QTOLB.js +11 -0
  12. package/dist/chunk-2I4QTOLB.js.map +1 -0
  13. package/dist/chunk-36X2CA3N.js +311 -0
  14. package/dist/chunk-36X2CA3N.js.map +1 -0
  15. package/dist/{chunk-F5DZJLU3.js → chunk-47PP7TAG.js} +1441 -634
  16. package/dist/chunk-47PP7TAG.js.map +1 -0
  17. package/dist/chunk-5JMKIDMM.js +316 -0
  18. package/dist/chunk-5JMKIDMM.js.map +1 -0
  19. package/dist/chunk-5JXAZP7H.js +206 -0
  20. package/dist/chunk-5JXAZP7H.js.map +1 -0
  21. package/dist/chunk-5SE6BJRP.js +135 -0
  22. package/dist/chunk-5SE6BJRP.js.map +1 -0
  23. package/dist/chunk-6BZLSRNU.js +149 -0
  24. package/dist/chunk-6BZLSRNU.js.map +1 -0
  25. package/dist/{chunk-PAAL45FJ.js → chunk-7FK2UN2T.js} +3410 -412
  26. package/dist/chunk-7FK2UN2T.js.map +1 -0
  27. package/dist/chunk-7WDY4AXV.js +14620 -0
  28. package/dist/chunk-7WDY4AXV.js.map +1 -0
  29. package/dist/chunk-A6KCZPNQ.js +83 -0
  30. package/dist/chunk-A6KCZPNQ.js.map +1 -0
  31. package/dist/chunk-AWQ6A4CI.js +341 -0
  32. package/dist/chunk-AWQ6A4CI.js.map +1 -0
  33. package/dist/chunk-BJJ5BQO6.js +162 -0
  34. package/dist/chunk-BJJ5BQO6.js.map +1 -0
  35. package/dist/chunk-BUDHTDKL.js +612 -0
  36. package/dist/chunk-BUDHTDKL.js.map +1 -0
  37. package/dist/chunk-DKQMJTG7.js +188 -0
  38. package/dist/chunk-DKQMJTG7.js.map +1 -0
  39. package/dist/chunk-FKSAUOJU.js +137 -0
  40. package/dist/chunk-FKSAUOJU.js.map +1 -0
  41. package/dist/chunk-GECSWJ7O.js +1645 -0
  42. package/dist/chunk-GECSWJ7O.js.map +1 -0
  43. package/dist/chunk-GSDZRCGF.js +105 -0
  44. package/dist/chunk-GSDZRCGF.js.map +1 -0
  45. package/dist/chunk-JSSIMGQT.js +174 -0
  46. package/dist/chunk-JSSIMGQT.js.map +1 -0
  47. package/dist/chunk-KYH4KPE5.js +1357 -0
  48. package/dist/chunk-KYH4KPE5.js.map +1 -0
  49. package/dist/chunk-KYQVEKP5.js +209 -0
  50. package/dist/chunk-KYQVEKP5.js.map +1 -0
  51. package/dist/chunk-KZAAWQNP.js +6199 -0
  52. package/dist/chunk-KZAAWQNP.js.map +1 -0
  53. package/dist/{chunk-SXQQ2ZSR.js → chunk-M2O56UK7.js} +243 -75
  54. package/dist/chunk-M2O56UK7.js.map +1 -0
  55. package/dist/chunk-MD7WGYYI.js +125 -0
  56. package/dist/chunk-MD7WGYYI.js.map +1 -0
  57. package/dist/chunk-MJZZTKCC.js +323 -0
  58. package/dist/chunk-MJZZTKCC.js.map +1 -0
  59. package/dist/chunk-O6CAUZGY.js +317 -0
  60. package/dist/chunk-O6CAUZGY.js.map +1 -0
  61. package/dist/chunk-P74I3WH4.js +204 -0
  62. package/dist/chunk-P74I3WH4.js.map +1 -0
  63. package/dist/chunk-POF7HPRV.js +145 -0
  64. package/dist/chunk-POF7HPRV.js.map +1 -0
  65. package/dist/chunk-POJRB2AE.js +83 -0
  66. package/dist/chunk-POJRB2AE.js.map +1 -0
  67. package/dist/{chunk-FIYZLITH.js → chunk-PZRAAAY2.js} +107 -18
  68. package/dist/chunk-PZRAAAY2.js.map +1 -0
  69. package/dist/chunk-PZSUWDF2.js +35 -0
  70. package/dist/chunk-PZSUWDF2.js.map +1 -0
  71. package/dist/chunk-QW2Q2KAH.js +27 -0
  72. package/dist/chunk-QW2Q2KAH.js.map +1 -0
  73. package/dist/chunk-R2VLGNFD.js +181 -0
  74. package/dist/chunk-R2VLGNFD.js.map +1 -0
  75. package/dist/{chunk-CPUZRZ2A.js → chunk-RBJPAZFI.js} +25 -170
  76. package/dist/chunk-RBJPAZFI.js.map +1 -0
  77. package/dist/chunk-S5RYMCV6.js +70 -0
  78. package/dist/chunk-S5RYMCV6.js.map +1 -0
  79. package/dist/chunk-SGK2B724.js +67 -0
  80. package/dist/chunk-SGK2B724.js.map +1 -0
  81. package/dist/chunk-STND72DS.js +242 -0
  82. package/dist/chunk-STND72DS.js.map +1 -0
  83. package/dist/chunk-TEL27PR5.js +124 -0
  84. package/dist/chunk-TEL27PR5.js.map +1 -0
  85. package/dist/chunk-TWRYSGAW.js +134 -0
  86. package/dist/chunk-TWRYSGAW.js.map +1 -0
  87. package/dist/{chunk-WOHCAMDQ.js → chunk-U5S527PP.js} +1887 -1029
  88. package/dist/chunk-U5S527PP.js.map +1 -0
  89. package/dist/chunk-UHTVXQ2O.js +140 -0
  90. package/dist/chunk-UHTVXQ2O.js.map +1 -0
  91. package/dist/chunk-UOJRKQTZ.js +213 -0
  92. package/dist/chunk-UOJRKQTZ.js.map +1 -0
  93. package/dist/chunk-V4WWTZHZ.js +233 -0
  94. package/dist/chunk-V4WWTZHZ.js.map +1 -0
  95. package/dist/chunk-VRRLTZ2Q.js +651 -0
  96. package/dist/chunk-VRRLTZ2Q.js.map +1 -0
  97. package/dist/{chunk-TX5T3LKJ.js → chunk-W6R3HAAG.js} +21 -17
  98. package/dist/{chunk-TX5T3LKJ.js.map → chunk-W6R3HAAG.js.map} +1 -1
  99. package/dist/chunk-X3OOVSPX.js +154 -0
  100. package/dist/chunk-X3OOVSPX.js.map +1 -0
  101. package/dist/chunk-XJN5WUKL.js +204 -0
  102. package/dist/chunk-XJN5WUKL.js.map +1 -0
  103. package/dist/chunk-Y7ERTA7D.js +146 -0
  104. package/dist/chunk-Y7ERTA7D.js.map +1 -0
  105. package/dist/chunk-YLYINX2H.js +7806 -0
  106. package/dist/chunk-YLYINX2H.js.map +1 -0
  107. package/dist/chunk-ZQIQ55KK.js +51 -0
  108. package/dist/chunk-ZQIQ55KK.js.map +1 -0
  109. package/dist/chunk-ZUAQRIVP.js +1369 -0
  110. package/dist/chunk-ZUAQRIVP.js.map +1 -0
  111. package/dist/{chunk-3IMLRUZE.js → chunk-ZXTAQYNA.js} +6 -2
  112. package/dist/chunk-ZXTAQYNA.js.map +1 -0
  113. package/dist/{cli-LMHGCZ5S.js → cli-HK2XAWNW.js} +438 -177
  114. package/dist/cli-HK2XAWNW.js.map +1 -0
  115. package/dist/config-LYCHHNAJ.js +26 -0
  116. package/dist/config-LYCHHNAJ.js.map +1 -0
  117. package/dist/dist-U4M6QCKE.js +2842 -0
  118. package/dist/dist-U4M6QCKE.js.map +1 -0
  119. package/dist/doctor-2KPUQURC.js +27 -0
  120. package/dist/doctor-2KPUQURC.js.map +1 -0
  121. package/dist/edit-TST3OCKQ.js +38 -0
  122. package/dist/edit-TST3OCKQ.js.map +1 -0
  123. package/dist/ethersCompat-Df4a6QIZ-WHYKB6HA.js +18 -0
  124. package/dist/ethersCompat-Df4a6QIZ-WHYKB6HA.js.map +1 -0
  125. package/dist/index.js +1 -1
  126. package/dist/inspect-TPTHVPBB.js +35 -0
  127. package/dist/inspect-TPTHVPBB.js.map +1 -0
  128. package/dist/install-PT3XEDJ6.js +1869 -0
  129. package/dist/install-PT3XEDJ6.js.map +1 -0
  130. package/dist/{mine.wasm-GQECMSGN.js → mine.wasm-6PIT3DK6.js} +2 -2
  131. package/dist/outcome-NPNSF2Q7.js +22 -0
  132. package/dist/outcome-NPNSF2Q7.js.map +1 -0
  133. package/dist/publish-XP5SEWST.js +41 -0
  134. package/dist/publish-XP5SEWST.js.map +1 -0
  135. package/dist/read-D4VXRWOG.js +158 -0
  136. package/dist/read-D4VXRWOG.js.map +1 -0
  137. package/dist/run-3IPGEXW7.js +16902 -0
  138. package/dist/run-3IPGEXW7.js.map +1 -0
  139. package/dist/search-YOBD6VDI.js +24 -0
  140. package/dist/search-YOBD6VDI.js.map +1 -0
  141. package/dist/{secp256k1-35YNNB6F.js → secp256k1-XRPVBC6V.js} +5 -4
  142. package/dist/secp256k1-XRPVBC6V.js.map +1 -0
  143. package/dist/send-BWNP6WN4.js +223 -0
  144. package/dist/send-BWNP6WN4.js.map +1 -0
  145. package/dist/session-GZEZBOMI.js +88 -0
  146. package/dist/session-GZEZBOMI.js.map +1 -0
  147. package/dist/skill-heal-OK6YALW6.js +85 -0
  148. package/dist/skill-heal-OK6YALW6.js.map +1 -0
  149. package/dist/usdc-4VCDHFWX.js +38 -0
  150. package/dist/usdc-4VCDHFWX.js.map +1 -0
  151. package/dist/viemAdapter-By13KInL-TUQJBMHM.js +14 -0
  152. package/dist/viemAdapter-By13KInL-TUQJBMHM.js.map +1 -0
  153. package/dist/wallet-5RHDFPN2.js +32 -0
  154. package/dist/wallet-5RHDFPN2.js.map +1 -0
  155. package/dist/wallet-YEGQBWWL.js +42 -0
  156. package/dist/wallet-YEGQBWWL.js.map +1 -0
  157. package/docs/agent-permissions.md +281 -0
  158. package/package.json +26 -17
  159. package/skills/tenjin/SKILL.md +364 -0
  160. package/skills/tenjin-publish/SKILL.md +219 -0
  161. package/skills/tenjin-search/SKILL.md +335 -0
  162. package/dist/chunk-376LHMK2.js +0 -100
  163. package/dist/chunk-376LHMK2.js.map +0 -1
  164. package/dist/chunk-CPUZRZ2A.js.map +0 -1
  165. package/dist/chunk-F5DZJLU3.js.map +0 -1
  166. package/dist/chunk-FIYZLITH.js.map +0 -1
  167. package/dist/chunk-LTTRND4A.js +0 -135
  168. package/dist/chunk-LTTRND4A.js.map +0 -1
  169. package/dist/chunk-PAAL45FJ.js.map +0 -1
  170. package/dist/chunk-QHIEYBLV.js +0 -320
  171. package/dist/chunk-QHIEYBLV.js.map +0 -1
  172. package/dist/chunk-SXQQ2ZSR.js.map +0 -1
  173. package/dist/chunk-WOHCAMDQ.js.map +0 -1
  174. package/dist/chunk-ZPZFPVDN.js +0 -67
  175. package/dist/chunk-ZPZFPVDN.js.map +0 -1
  176. package/dist/cli-LMHGCZ5S.js.map +0 -1
  177. package/dist/config-XVXZ3V2Q.js +0 -206
  178. package/dist/config-XVXZ3V2Q.js.map +0 -1
  179. package/dist/doctor-MVLZRVPU.js +0 -338
  180. package/dist/doctor-MVLZRVPU.js.map +0 -1
  181. package/dist/usdc-OQUOFF6R.js +0 -18
  182. package/dist/wallet-NRKWLKHX.js +0 -153
  183. package/dist/wallet-NRKWLKHX.js.map +0 -1
  184. package/dist/wallet-QUWK2PA4.js +0 -22
  185. /package/dist/{_esm-ZH2J4QEH.js.map → _esm-C5CRWCYU.js.map} +0 -0
  186. /package/dist/{ccip-FXWZDDF5.js.map → _esm-N4KAVXQR.js.map} +0 -0
  187. /package/dist/{chunk-3IMLRUZE.js.map → buy-FMDBZ4NY.js.map} +0 -0
  188. /package/dist/{secp256k1-35YNNB6F.js.map → candidate-7LAELUQD.js.map} +0 -0
  189. /package/dist/{usdc-OQUOFF6R.js.map → ccip-RPPPKTJR.js.map} +0 -0
  190. /package/dist/{wallet-QUWK2PA4.js.map → ccip-ZGGWQN4X.js.map} +0 -0
  191. /package/dist/{mine.wasm-GQECMSGN.js.map → mine.wasm-6PIT3DK6.js.map} +0 -0
@@ -1,8 +1,10 @@
1
1
  import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
2
  import {
3
- secp256k1,
4
3
  sha256
5
- } from "./chunk-TX5T3LKJ.js";
4
+ } from "./chunk-UHTVXQ2O.js";
5
+ import {
6
+ secp256k1
7
+ } from "./chunk-W6R3HAAG.js";
6
8
  import {
7
9
  BaseError,
8
10
  BytesSizeMismatchError,
@@ -12,6 +14,7 @@ import {
12
14
  InvalidLegacyVError,
13
15
  InvalidSerializableTransactionError,
14
16
  InvalidStorageKeySizeError,
17
+ LruMap,
15
18
  TipAboveFeeCapError,
16
19
  bytesRegex,
17
20
  bytesToHex,
@@ -20,6 +23,9 @@ import {
20
23
  concatHex,
21
24
  createCursor,
22
25
  encodeAbiParameters,
26
+ formatBlockParameter,
27
+ from,
28
+ fromBytes,
23
29
  hexToBigInt,
24
30
  hexToBytes,
25
31
  hexToNumber,
@@ -36,22 +42,10 @@ import {
36
42
  toBytes,
37
43
  toHex,
38
44
  trim
39
- } from "./chunk-F5DZJLU3.js";
40
-
41
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/signature/serializeSignature.js
42
- function serializeSignature({ r, s, to = "hex", v, yParity }) {
43
- const yParity_ = (() => {
44
- if (yParity === 0 || yParity === 1)
45
- return yParity;
46
- if (v && (v === 27n || v === 28n || v >= 35n))
47
- return v % 2n === 0n ? 1 : 0;
48
- throw new Error("Invalid `v` or `yParity` value");
49
- })();
50
- const signature = `0x${new secp256k1.Signature(hexToBigInt(r), hexToBigInt(s)).toCompactHex()}${yParity_ === 0 ? "1b" : "1c"}`;
51
- if (to === "hex")
52
- return signature;
53
- return hexToBytes(signature);
54
- }
45
+ } from "./chunk-47PP7TAG.js";
46
+ import {
47
+ keccak_256
48
+ } from "./chunk-XJN5WUKL.js";
55
49
 
56
50
  // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/encoding/toRlp.js
57
51
  function toRlp(bytes, to = "hex") {
@@ -62,6 +56,12 @@ function toRlp(bytes, to = "hex") {
62
56
  return bytesToHex(cursor.bytes);
63
57
  return cursor.bytes;
64
58
  }
59
+ function bytesToRlp(bytes, to = "bytes") {
60
+ return toRlp(bytes, to);
61
+ }
62
+ function hexToRlp(hex, to = "hex") {
63
+ return toRlp(hex, to);
64
+ }
65
65
  function getEncodable(bytes) {
66
66
  if (Array.isArray(bytes))
67
67
  return getEncodableList(bytes.map((x) => getEncodable(x)));
@@ -142,27 +142,6 @@ function getSizeOfLength(length) {
142
142
  throw new BaseError("Length is too large.");
143
143
  }
144
144
 
145
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/constants/strings.js
146
- var presignMessagePrefix = "Ethereum Signed Message:\n";
147
-
148
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/signature/toPrefixedMessage.js
149
- function toPrefixedMessage(message_) {
150
- const message = (() => {
151
- if (typeof message_ === "string")
152
- return stringToHex(message_);
153
- if (typeof message_.raw === "string")
154
- return message_.raw;
155
- return bytesToHex(message_.raw);
156
- })();
157
- const prefix = stringToHex(`${presignMessagePrefix}${size(message)}`);
158
- return concat([prefix, message]);
159
- }
160
-
161
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/signature/hashMessage.js
162
- function hashMessage(message, to_) {
163
- return keccak256(toPrefixedMessage(message), to_);
164
- }
165
-
166
145
  // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/blob/blobsToCommitments.js
167
146
  function blobsToCommitments(parameters) {
168
147
  const { kzg } = parameters;
@@ -189,13 +168,10 @@ function blobsToProofs(parameters) {
189
168
  return to === "bytes" ? proofs : proofs.map((x) => bytesToHex(x));
190
169
  }
191
170
 
192
- // node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/sha256.js
193
- var sha2562 = sha256;
194
-
195
171
  // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/hash/sha256.js
196
- function sha2563(value, to_) {
172
+ function sha2562(value, to_) {
197
173
  const to = to_ || "hex";
198
- const bytes = sha2562(isHex(value, { strict: false }) ? toBytes(value) : value);
174
+ const bytes = sha256(isHex(value, { strict: false }) ? toBytes(value) : value);
199
175
  if (to === "bytes")
200
176
  return bytes;
201
177
  return toHex(bytes);
@@ -205,7 +181,7 @@ function sha2563(value, to_) {
205
181
  function commitmentToVersionedHash(parameters) {
206
182
  const { commitment, version = 1 } = parameters;
207
183
  const to = parameters.to ?? (typeof commitment === "string" ? "hex" : "bytes");
208
- const versionedHash = sha2563(commitment, "bytes");
184
+ const versionedHash = sha2562(commitment, "bytes");
209
185
  versionedHash.set([version], 0);
210
186
  return to === "bytes" ? versionedHash : bytesToHex(versionedHash);
211
187
  }
@@ -239,9 +215,9 @@ var versionedHashVersionKzg = 1;
239
215
 
240
216
  // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/errors/blob.js
241
217
  var BlobSizeTooLargeError = class extends BaseError {
242
- constructor({ maxSize, size: size2 }) {
218
+ constructor({ maxSize, size: size3 }) {
243
219
  super("Blob size is too large.", {
244
- metaMessages: [`Max: ${maxSize} bytes`, `Given: ${size2} bytes`],
220
+ metaMessages: [`Max: ${maxSize} bytes`, `Given: ${size3} bytes`],
245
221
  name: "BlobSizeTooLargeError"
246
222
  });
247
223
  }
@@ -252,9 +228,9 @@ var EmptyBlobError = class extends BaseError {
252
228
  }
253
229
  };
254
230
  var InvalidVersionedHashSizeError = class extends BaseError {
255
- constructor({ hash, size: size2 }) {
231
+ constructor({ hash, size: size3 }) {
256
232
  super(`Versioned hash "${hash}" size is invalid.`, {
257
- metaMessages: ["Expected: 32", `Received: ${size2}`],
233
+ metaMessages: ["Expected: 32", `Received: ${size3}`],
258
234
  name: "InvalidVersionedHashSizeError"
259
235
  });
260
236
  }
@@ -288,8 +264,8 @@ function toBlobs(parameters) {
288
264
  let position = 0;
289
265
  while (active) {
290
266
  const blob = createCursor(new Uint8Array(bytesPerBlob));
291
- let size2 = 0;
292
- while (size2 < fieldElementsPerBlob) {
267
+ let size3 = 0;
268
+ while (size3 < fieldElementsPerBlob) {
293
269
  const bytes = data.slice(position, position + (bytesPerFieldElement - 1));
294
270
  blob.pushByte(0);
295
271
  blob.pushBytes(bytes);
@@ -298,7 +274,7 @@ function toBlobs(parameters) {
298
274
  active = false;
299
275
  break;
300
276
  }
301
- size2++;
277
+ size3++;
302
278
  position += 31;
303
279
  }
304
280
  blobs.push(blob);
@@ -322,6 +298,25 @@ function toBlobSidecars(parameters) {
322
298
  return sidecars;
323
299
  }
324
300
 
301
+ // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/transaction/getTransactionType.js
302
+ function getTransactionType(transaction) {
303
+ if (transaction.type)
304
+ return transaction.type;
305
+ if (typeof transaction.authorizationList !== "undefined")
306
+ return "eip7702";
307
+ if (typeof transaction.blobs !== "undefined" || typeof transaction.blobVersionedHashes !== "undefined" || typeof transaction.maxFeePerBlobGas !== "undefined" || typeof transaction.sidecars !== "undefined")
308
+ return "eip4844";
309
+ if (typeof transaction.maxFeePerGas !== "undefined" || typeof transaction.maxPriorityFeePerGas !== "undefined") {
310
+ return "eip1559";
311
+ }
312
+ if (typeof transaction.gasPrice !== "undefined") {
313
+ if (typeof transaction.accessList !== "undefined")
314
+ return "eip2930";
315
+ return "legacy";
316
+ }
317
+ throw new InvalidSerializableTransactionError({ transaction });
318
+ }
319
+
325
320
  // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/transaction/assertTransaction.js
326
321
  function assertTransactionEIP7702(transaction) {
327
322
  const { authorizationList } = transaction;
@@ -390,25 +385,6 @@ function assertTransactionLegacy(transaction) {
390
385
  throw new FeeCapTooHighError({ maxFeePerGas: gasPrice });
391
386
  }
392
387
 
393
- // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/transaction/getTransactionType.js
394
- function getTransactionType(transaction) {
395
- if (transaction.type)
396
- return transaction.type;
397
- if (typeof transaction.authorizationList !== "undefined")
398
- return "eip7702";
399
- if (typeof transaction.blobs !== "undefined" || typeof transaction.blobVersionedHashes !== "undefined" || typeof transaction.maxFeePerBlobGas !== "undefined" || typeof transaction.sidecars !== "undefined")
400
- return "eip4844";
401
- if (typeof transaction.maxFeePerGas !== "undefined" || typeof transaction.maxPriorityFeePerGas !== "undefined") {
402
- return "eip1559";
403
- }
404
- if (typeof transaction.gasPrice !== "undefined") {
405
- if (typeof transaction.accessList !== "undefined")
406
- return "eip2930";
407
- return "legacy";
408
- }
409
- throw new InvalidSerializableTransactionError({ transaction });
410
- }
411
-
412
388
  // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/transaction/serializeAccessList.js
413
389
  function serializeAccessList(accessList) {
414
390
  if (!accessList || accessList.length === 0)
@@ -647,6 +623,115 @@ function toYParitySignatureArray(transaction, signature_) {
647
623
  return [yParity_, r === "0x00" ? "0x" : r, s === "0x00" ? "0x" : s];
648
624
  }
649
625
 
626
+ // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/actions/public/getTransactionCount.js
627
+ async function getTransactionCount(client, { address, blockHash, blockNumber, blockTag = "latest", requireCanonical }) {
628
+ const block = formatBlockParameter({
629
+ blockHash,
630
+ blockNumber,
631
+ blockTag,
632
+ requireCanonical
633
+ });
634
+ const count = await client.request({
635
+ method: "eth_getTransactionCount",
636
+ params: [address, block]
637
+ }, {
638
+ dedupe: typeof blockNumber === "bigint" || blockHash !== void 0
639
+ });
640
+ return hexToNumber(count);
641
+ }
642
+
643
+ // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/nonceManager.js
644
+ function createNonceManager(parameters) {
645
+ const { source } = parameters;
646
+ const deltaMap = /* @__PURE__ */ new Map();
647
+ const nonceMap = new LruMap(8192);
648
+ const promiseMap = /* @__PURE__ */ new Map();
649
+ const getKey = ({ address, chainId }) => `${address}.${chainId}`;
650
+ const resetCache = (key) => {
651
+ deltaMap.delete(key);
652
+ promiseMap.delete(key);
653
+ };
654
+ return {
655
+ async consume({ address, chainId, client }) {
656
+ const key = getKey({ address, chainId });
657
+ const promise = this.get({ address, chainId, client });
658
+ this.increment({ address, chainId });
659
+ const nonce = await promise;
660
+ await source.set({ address, chainId }, nonce);
661
+ nonceMap.set(key, nonce);
662
+ return nonce;
663
+ },
664
+ async increment({ address, chainId }) {
665
+ const key = getKey({ address, chainId });
666
+ const delta = deltaMap.get(key) ?? 0;
667
+ deltaMap.set(key, delta + 1);
668
+ },
669
+ async get({ address, chainId, client }) {
670
+ const key = getKey({ address, chainId });
671
+ let promise = promiseMap.get(key);
672
+ if (!promise) {
673
+ promise = (async () => {
674
+ try {
675
+ const nonce = await source.get({ address, chainId, client });
676
+ const previousNonce = nonceMap.get(key) ?? 0;
677
+ if (previousNonce > 0 && nonce <= previousNonce)
678
+ return previousNonce + 1;
679
+ nonceMap.delete(key);
680
+ return nonce;
681
+ } finally {
682
+ resetCache(key);
683
+ }
684
+ })();
685
+ promiseMap.set(key, promise);
686
+ }
687
+ const delta = deltaMap.get(key) ?? 0;
688
+ return delta + await promise;
689
+ },
690
+ reset({ address, chainId }) {
691
+ const key = getKey({ address, chainId });
692
+ nonceMap.delete(key);
693
+ resetCache(key);
694
+ }
695
+ };
696
+ }
697
+ function jsonRpc() {
698
+ return {
699
+ async get(parameters) {
700
+ const { address, client } = parameters;
701
+ return getTransactionCount(client, {
702
+ address,
703
+ blockTag: "pending"
704
+ });
705
+ },
706
+ set() {
707
+ }
708
+ };
709
+ }
710
+ var nonceManager = /* @__PURE__ */ createNonceManager({
711
+ source: jsonRpc()
712
+ });
713
+
714
+ // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/constants/strings.js
715
+ var presignMessagePrefix = "Ethereum Signed Message:\n";
716
+
717
+ // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/signature/toPrefixedMessage.js
718
+ function toPrefixedMessage(message_) {
719
+ const message = (() => {
720
+ if (typeof message_ === "string")
721
+ return stringToHex(message_);
722
+ if (typeof message_.raw === "string")
723
+ return message_.raw;
724
+ return bytesToHex(message_.raw);
725
+ })();
726
+ const prefix = stringToHex(`${presignMessagePrefix}${size(message)}`);
727
+ return concat([prefix, message]);
728
+ }
729
+
730
+ // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/signature/hashMessage.js
731
+ function hashMessage(message, to_) {
732
+ return keccak256(toPrefixedMessage(message), to_);
733
+ }
734
+
650
735
  // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/errors/typedData.js
651
736
  var InvalidDomainError = class extends BaseError {
652
737
  constructor({ domain }) {
@@ -783,6 +868,31 @@ function encodeField({ types, name, type, value }) {
783
868
  }
784
869
 
785
870
  // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/typedData.js
871
+ function serializeTypedData(parameters) {
872
+ const { domain: domain_, message: message_, primaryType, types } = parameters;
873
+ const normalizeData = (struct, data_) => {
874
+ const data = { ...data_ };
875
+ for (const param of struct) {
876
+ const { name, type } = param;
877
+ if (type === "address")
878
+ data[name] = data[name].toLowerCase();
879
+ }
880
+ return data;
881
+ };
882
+ const domain = (() => {
883
+ if (!types.EIP712Domain)
884
+ return {};
885
+ if (!domain_)
886
+ return {};
887
+ return normalizeData(types.EIP712Domain, domain_);
888
+ })();
889
+ const message = (() => {
890
+ if (primaryType === "EIP712Domain")
891
+ return void 0;
892
+ return normalizeData(types[primaryType], message_);
893
+ })();
894
+ return stringify({ domain, message, primaryType, types });
895
+ }
786
896
  function validateTypedData(parameters) {
787
897
  const { domain, message, primaryType, types } = parameters;
788
898
  const validateData = (struct, data) => {
@@ -842,17 +952,49 @@ function getTypesForEIP712Domain({ domain }) {
842
952
  domain?.salt && { name: "salt", type: "bytes32" }
843
953
  ].filter(Boolean);
844
954
  }
955
+ function domainSeparator({ domain }) {
956
+ return hashDomain({
957
+ domain,
958
+ types: {
959
+ EIP712Domain: getTypesForEIP712Domain({ domain })
960
+ }
961
+ });
962
+ }
845
963
  function validateReference(type) {
846
964
  if (type === "address" || type === "bool" || type === "string" || type.startsWith("bytes") || type.startsWith("uint") || type.startsWith("int"))
847
965
  throw new InvalidStructTypeError({ type });
848
966
  }
849
967
 
968
+ // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/signature/serializeSignature.js
969
+ function serializeSignature({ r, s, to = "hex", v, yParity }) {
970
+ const yParity_ = (() => {
971
+ if (yParity === 0 || yParity === 1)
972
+ return yParity;
973
+ if (v && (v === 27n || v === 28n || v >= 35n))
974
+ return v % 2n === 0n ? 1 : 0;
975
+ throw new Error("Invalid `v` or `yParity` value");
976
+ })();
977
+ const signature = `0x${new secp256k1.Signature(hexToBigInt(r), hexToBigInt(s)).toCompactHex()}${yParity_ === 0 ? "1b" : "1c"}`;
978
+ if (to === "hex")
979
+ return signature;
980
+ return hexToBytes(signature);
981
+ }
982
+
850
983
  // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/accounts/utils/publicKeyToAddress.js
851
984
  function publicKeyToAddress(publicKey) {
852
985
  const address = keccak256(`0x${publicKey.substring(4)}`).substring(26);
853
986
  return checksumAddress(`0x${address}`);
854
987
  }
855
988
 
989
+ // node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.4.3/node_modules/ox/_esm/core/Hash.js
990
+ function keccak2562(value, options = {}) {
991
+ const { as = typeof value === "string" ? "Hex" : "Bytes" } = options;
992
+ const bytes = keccak_256(from(value));
993
+ if (as === "Bytes")
994
+ return bytes;
995
+ return fromBytes(bytes);
996
+ }
997
+
856
998
  // node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/authorization/hashAuthorization.js
857
999
  function hashAuthorization(parameters) {
858
1000
  const { chainId, nonce, to } = parameters;
@@ -871,17 +1013,43 @@ function hashAuthorization(parameters) {
871
1013
  }
872
1014
 
873
1015
  export {
874
- serializeSignature,
875
1016
  publicKeyToAddress,
876
1017
  toRlp,
1018
+ bytesToRlp,
1019
+ hexToRlp,
877
1020
  hashAuthorization,
878
- hashMessage,
1021
+ getTransactionCount,
879
1022
  blobsToCommitments,
880
1023
  blobsToProofs,
1024
+ sha2562 as sha256,
1025
+ commitmentToVersionedHash,
881
1026
  commitmentsToVersionedHashes,
1027
+ toBlobs,
882
1028
  toBlobSidecars,
883
1029
  getTransactionType,
1030
+ assertTransactionEIP7702,
1031
+ assertTransactionEIP4844,
1032
+ assertTransactionEIP1559,
1033
+ assertTransactionEIP2930,
1034
+ assertTransactionLegacy,
1035
+ serializeAccessList,
884
1036
  serializeTransaction,
885
- hashTypedData
1037
+ createNonceManager,
1038
+ nonceManager,
1039
+ presignMessagePrefix,
1040
+ toPrefixedMessage,
1041
+ hashMessage,
1042
+ InvalidDomainError,
1043
+ InvalidPrimaryTypeError,
1044
+ InvalidStructTypeError,
1045
+ serializeTypedData,
1046
+ validateTypedData,
1047
+ getTypesForEIP712Domain,
1048
+ domainSeparator,
1049
+ hashTypedData,
1050
+ hashDomain,
1051
+ hashStruct,
1052
+ keccak2562 as keccak256,
1053
+ serializeSignature
886
1054
  };
887
- //# sourceMappingURL=chunk-SXQQ2ZSR.js.map
1055
+ //# sourceMappingURL=chunk-M2O56UK7.js.map