tenjin-cli 0.1.0-alpha.14 → 0.1.0-alpha.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE.md +54 -7
- package/README.md +41 -295
- package/dist/{_esm-N4KAVXQR.js → _esm-CE7KNONL.js} +9 -10
- package/dist/{ccip-ZGGWQN4X.js → ccip-7RMRLAGV.js} +4 -4
- package/dist/{ccip-RPPPKTJR.js → ccip-NLCSCHKI.js} +5 -5
- package/dist/chunk-25TJPVBF.js +353 -0
- package/dist/chunk-25TJPVBF.js.map +1 -0
- package/dist/chunk-2BKS2FVE.js +93 -0
- package/dist/chunk-2BKS2FVE.js.map +1 -0
- package/dist/chunk-2QYORQBF.js +55 -0
- package/dist/chunk-2QYORQBF.js.map +1 -0
- package/dist/{chunk-ACBEHJAH.js → chunk-2U5ZVEV3.js} +14 -16
- package/dist/chunk-2U5ZVEV3.js.map +1 -0
- package/dist/{chunk-MJSXP4LW.js → chunk-3AJS6LLN.js} +11 -8
- package/dist/chunk-3AJS6LLN.js.map +1 -0
- package/dist/{chunk-OWVVI4VQ.js → chunk-3AUDA53C.js} +7650 -7361
- package/dist/chunk-3AUDA53C.js.map +1 -0
- package/dist/{chunk-MJZZTKCC.js → chunk-56MOAIP5.js} +5 -10
- package/dist/chunk-56MOAIP5.js.map +1 -0
- package/dist/{chunk-U5S527PP.js → chunk-5IEP5EGE.js} +3 -3
- package/dist/chunk-5X4SZ5BF.js +227 -0
- package/dist/chunk-5X4SZ5BF.js.map +1 -0
- package/dist/chunk-7WEQQJLG.js +68 -0
- package/dist/chunk-7WEQQJLG.js.map +1 -0
- package/dist/{chunk-7FK2UN2T.js → chunk-AWQPGIR6.js} +65 -67
- package/dist/{chunk-7FK2UN2T.js.map → chunk-AWQPGIR6.js.map} +1 -1
- package/dist/{chunk-PAOVPSP6.js → chunk-BBVUVBUO.js} +517 -138
- package/dist/chunk-BBVUVBUO.js.map +1 -0
- package/dist/{chunk-ETKZWJ4B.js → chunk-BFFM2WFK.js} +8 -8
- package/dist/chunk-BFFM2WFK.js.map +1 -0
- package/dist/{chunk-KYQVEKP5.js → chunk-BPMWXTFX.js} +8 -8
- package/dist/chunk-DMZZLPZN.js +205 -0
- package/dist/chunk-DMZZLPZN.js.map +1 -0
- package/dist/{chunk-47PP7TAG.js → chunk-EGELTSPU.js} +1356 -1356
- package/dist/chunk-EGELTSPU.js.map +1 -0
- package/dist/chunk-GULLJQXA.js +698 -0
- package/dist/chunk-GULLJQXA.js.map +1 -0
- package/dist/{chunk-S5RYMCV6.js → chunk-HPWO4O6S.js} +3 -3
- package/dist/chunk-HVRC33OL.js +174 -0
- package/dist/chunk-HVRC33OL.js.map +1 -0
- package/dist/{chunk-W6R3HAAG.js → chunk-JRGFKVAZ.js} +2 -2
- package/dist/{chunk-XJN5WUKL.js → chunk-KG3D7FIF.js} +2 -2
- package/dist/chunk-L3PVMIYQ.js +10328 -0
- package/dist/chunk-L3PVMIYQ.js.map +1 -0
- package/dist/{chunk-QW2Q2KAH.js → chunk-LHHMV4GU.js} +2 -2
- package/dist/{chunk-ZOBNS7CX.js → chunk-MEFB5KHA.js} +4 -18
- package/dist/chunk-MEFB5KHA.js.map +1 -0
- package/dist/{chunk-M2O56UK7.js → chunk-N35E6CM2.js} +293 -163
- package/dist/chunk-N35E6CM2.js.map +1 -0
- package/dist/chunk-OCBHUHWB.js +69 -0
- package/dist/chunk-OCBHUHWB.js.map +1 -0
- package/dist/chunk-OIM4HLN6.js +1405 -0
- package/dist/chunk-OIM4HLN6.js.map +1 -0
- package/dist/{chunk-PKW3H26Z.js → chunk-OJLYNM4Z.js} +56 -33
- package/dist/chunk-OJLYNM4Z.js.map +1 -0
- package/dist/{chunk-POJRB2AE.js → chunk-POUWHWID.js} +2 -2
- package/dist/chunk-PZEN5PHN.js +285 -0
- package/dist/chunk-PZEN5PHN.js.map +1 -0
- package/dist/chunk-SKAHDQH7.js +1785 -0
- package/dist/chunk-SKAHDQH7.js.map +1 -0
- package/dist/{chunk-KZAAWQNP.js → chunk-TTNESUPQ.js} +3 -3
- package/dist/{chunk-QWBUKIP2.js → chunk-U5DXNFJC.js} +23 -94
- package/dist/chunk-U5DXNFJC.js.map +1 -0
- package/dist/chunk-USS336NF.js +165 -0
- package/dist/chunk-USS336NF.js.map +1 -0
- package/dist/{chunk-UO22YNY4.js → chunk-WH7OWT6G.js} +49 -1
- package/dist/chunk-WH7OWT6G.js.map +1 -0
- package/dist/chunk-WXC57XGG.js +29 -0
- package/dist/chunk-WXC57XGG.js.map +1 -0
- package/dist/{chunk-YLYINX2H.js → chunk-XZKD7DIF.js} +3 -3
- package/dist/{chunk-7GJQ5RGA.js → chunk-YEETV6IW.js} +1077 -1039
- package/dist/chunk-YEETV6IW.js.map +1 -0
- package/dist/{chunk-B676GPS2.js → chunk-YJHHCWM3.js} +39 -16
- package/dist/chunk-YJHHCWM3.js.map +1 -0
- package/dist/{cli-U2BEUA55.js → cli-M3XCSOU6.js} +295 -349
- package/dist/cli-M3XCSOU6.js.map +1 -0
- package/dist/config-MXOX7XDR.js +41 -0
- package/dist/{dist-U4M6QCKE.js → dist-3LOO6M4U.js} +10 -10
- package/dist/doctor-LU4YIZWM.js +349 -0
- package/dist/doctor-LU4YIZWM.js.map +1 -0
- package/dist/{ethersCompat-Df4a6QIZ-WHYKB6HA.js → ethersCompat-Df4a6QIZ-THAVUGIJ.js} +5 -5
- package/dist/{chunk-3ZW7HPY5.js → fund-A54P2QFK.js} +81 -22
- package/dist/fund-A54P2QFK.js.map +1 -0
- package/dist/hook-command-U6KWPEDQ.js +377 -0
- package/dist/hook-command-U6KWPEDQ.js.map +1 -0
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/dist/install-XUM2XSHW.js +53 -0
- package/dist/install-wallet-QIOFORTX.js +105 -0
- package/dist/install-wallet-QIOFORTX.js.map +1 -0
- package/dist/{run-CJWPGMIQ.js → mcp-HJC2PLRV.js} +3725 -10661
- package/dist/mcp-HJC2PLRV.js.map +1 -0
- package/dist/paths-P2N4JTDZ.js +49 -0
- package/dist/pay-SBXZEPEP.js +37 -0
- package/dist/redact-46ZHF2NH.js +17 -0
- package/dist/{secp256k1-XRPVBC6V.js → secp256k1-ZZZT2CAX.js} +3 -3
- package/dist/{send-C5EOKXOU.js → send-ASD2ZXJD.js} +28 -30
- package/dist/send-ASD2ZXJD.js.map +1 -0
- package/dist/{chunk-NAAMHWSI.js → skill-placement-NFVHY6A3.js} +159 -12
- package/dist/skill-placement-NFVHY6A3.js.map +1 -0
- package/dist/status-T2SDB57A.js +63 -0
- package/dist/status-T2SDB57A.js.map +1 -0
- package/dist/status-line-CGPUSDMC.js +71 -0
- package/dist/status-line-CGPUSDMC.js.map +1 -0
- package/dist/status-line-wiring-BYPHTYZE.js +30 -0
- package/dist/tenjin-daemon.mjs +20060 -0
- package/dist/tenjin-shim.mjs +251 -0
- package/dist/tenjin-vitest-reporter.mjs +49 -0
- package/dist/uninstall-FKYZHAM3.js +144 -0
- package/dist/uninstall-FKYZHAM3.js.map +1 -0
- package/dist/{update-24Y2CQTT.js → update-ANJ2AOTN.js} +133 -17
- package/dist/update-ANJ2AOTN.js.map +1 -0
- package/dist/{viemAdapter-By13KInL-TUQJBMHM.js → viemAdapter-By13KInL-X2VY6CY3.js} +5 -5
- package/dist/wallet-PWAHVKWW.js +31 -0
- package/dist/wallet-kdf-worker.mjs +980 -0
- package/docs/agent-permissions.md +68 -342
- package/docs/safety-model.md +25 -6
- package/package.json +8 -7
- package/LICENSE +0 -21
- package/dist/buy-2JBYPHAI.js +0 -46
- package/dist/chunk-3P3ES4XU.js +0 -144
- package/dist/chunk-3P3ES4XU.js.map +0 -1
- package/dist/chunk-3ZW7HPY5.js.map +0 -1
- package/dist/chunk-47PP7TAG.js.map +0 -1
- package/dist/chunk-4UHNXY6B.js +0 -786
- package/dist/chunk-4UHNXY6B.js.map +0 -1
- package/dist/chunk-4Y53PDH6.js +0 -213
- package/dist/chunk-4Y53PDH6.js.map +0 -1
- package/dist/chunk-54AJIO3E.js +0 -198
- package/dist/chunk-54AJIO3E.js.map +0 -1
- package/dist/chunk-736DW4V3.js +0 -65
- package/dist/chunk-736DW4V3.js.map +0 -1
- package/dist/chunk-7GJQ5RGA.js.map +0 -1
- package/dist/chunk-7NADDA2V.js +0 -161
- package/dist/chunk-7NADDA2V.js.map +0 -1
- package/dist/chunk-ACBEHJAH.js.map +0 -1
- package/dist/chunk-B676GPS2.js.map +0 -1
- package/dist/chunk-DAZAXFSF.js +0 -1357
- package/dist/chunk-DAZAXFSF.js.map +0 -1
- package/dist/chunk-DTCXO7HS.js +0 -791
- package/dist/chunk-DTCXO7HS.js.map +0 -1
- package/dist/chunk-ETKZWJ4B.js.map +0 -1
- package/dist/chunk-FDUD3W5V.js +0 -317
- package/dist/chunk-FDUD3W5V.js.map +0 -1
- package/dist/chunk-GEHL43VE.js +0 -711
- package/dist/chunk-GEHL43VE.js.map +0 -1
- package/dist/chunk-IU2HVT3Y.js +0 -313
- package/dist/chunk-IU2HVT3Y.js.map +0 -1
- package/dist/chunk-IUQZ4Z7M.js +0 -162
- package/dist/chunk-IUQZ4Z7M.js.map +0 -1
- package/dist/chunk-IXZJ3JOO.js +0 -614
- package/dist/chunk-IXZJ3JOO.js.map +0 -1
- package/dist/chunk-J6FUAIRR.js +0 -205
- package/dist/chunk-J6FUAIRR.js.map +0 -1
- package/dist/chunk-L6G35FU5.js +0 -105
- package/dist/chunk-L6G35FU5.js.map +0 -1
- package/dist/chunk-LSWP7MU2.js +0 -290
- package/dist/chunk-LSWP7MU2.js.map +0 -1
- package/dist/chunk-M2O56UK7.js.map +0 -1
- package/dist/chunk-MJSXP4LW.js.map +0 -1
- package/dist/chunk-MJZZTKCC.js.map +0 -1
- package/dist/chunk-NAAMHWSI.js.map +0 -1
- package/dist/chunk-O75FOHXS.js +0 -372
- package/dist/chunk-O75FOHXS.js.map +0 -1
- package/dist/chunk-OWVVI4VQ.js.map +0 -1
- package/dist/chunk-PAOVPSP6.js.map +0 -1
- package/dist/chunk-PCX2JQ2J.js +0 -233
- package/dist/chunk-PCX2JQ2J.js.map +0 -1
- package/dist/chunk-PKW3H26Z.js.map +0 -1
- package/dist/chunk-PQZVDCCA.js +0 -125
- package/dist/chunk-PQZVDCCA.js.map +0 -1
- package/dist/chunk-QWBUKIP2.js.map +0 -1
- package/dist/chunk-SGK2B724.js +0 -67
- package/dist/chunk-SGK2B724.js.map +0 -1
- package/dist/chunk-UHTVXQ2O.js +0 -140
- package/dist/chunk-UHTVXQ2O.js.map +0 -1
- package/dist/chunk-UO22YNY4.js.map +0 -1
- package/dist/chunk-VEAERJVJ.js +0 -43
- package/dist/chunk-VEAERJVJ.js.map +0 -1
- package/dist/chunk-VRPLZERE.js +0 -1421
- package/dist/chunk-VRPLZERE.js.map +0 -1
- package/dist/chunk-W4VW5XYB.js +0 -149
- package/dist/chunk-W4VW5XYB.js.map +0 -1
- package/dist/chunk-WU5CZPLD.js +0 -145
- package/dist/chunk-WU5CZPLD.js.map +0 -1
- package/dist/chunk-WYLMJQVH.js +0 -240
- package/dist/chunk-WYLMJQVH.js.map +0 -1
- package/dist/chunk-XGZ5EVMB.js +0 -35
- package/dist/chunk-XGZ5EVMB.js.map +0 -1
- package/dist/chunk-XVPQGCH4.js +0 -176
- package/dist/chunk-XVPQGCH4.js.map +0 -1
- package/dist/chunk-ZOBNS7CX.js.map +0 -1
- package/dist/chunk-ZQIQ55KK.js +0 -51
- package/dist/chunk-ZQIQ55KK.js.map +0 -1
- package/dist/cli-U2BEUA55.js.map +0 -1
- package/dist/config-CNUIX23Q.js +0 -32
- package/dist/doctor-QJJXRWTO.js +0 -31
- package/dist/edit-HJ44P44P.js +0 -40
- package/dist/fund-Y5IAHZ5D.js +0 -40
- package/dist/inspect-NFQ6SQQQ.js +0 -37
- package/dist/install-DXX7PVUP.js +0 -854
- package/dist/install-DXX7PVUP.js.map +0 -1
- package/dist/outcome-ANV4QIED.js +0 -24
- package/dist/publish-PCBTCXCZ.js +0 -42
- package/dist/read-W7QVRBVD.js +0 -160
- package/dist/read-W7QVRBVD.js.map +0 -1
- package/dist/run-CJWPGMIQ.js.map +0 -1
- package/dist/search-JGAVKTYJ.js +0 -25
- package/dist/secp256k1-XRPVBC6V.js.map +0 -1
- package/dist/send-C5EOKXOU.js.map +0 -1
- package/dist/session-OBCUUIFX.js +0 -89
- package/dist/session-OBCUUIFX.js.map +0 -1
- package/dist/skill-heal-D6EPLPS6.js +0 -84
- package/dist/skill-heal-D6EPLPS6.js.map +0 -1
- package/dist/uninstall-OWJNJ5LI.js +0 -73
- package/dist/uninstall-OWJNJ5LI.js.map +0 -1
- package/dist/update-24Y2CQTT.js.map +0 -1
- package/dist/usdc-4VCDHFWX.js +0 -38
- package/dist/usdc-4VCDHFWX.js.map +0 -1
- package/dist/viemAdapter-By13KInL-TUQJBMHM.js.map +0 -1
- package/dist/wallet-OFXDIIGP.js +0 -33
- package/dist/wallet-OFXDIIGP.js.map +0 -1
- package/dist/wallet-SLRIYJ2U.js +0 -42
- package/dist/wallet-SLRIYJ2U.js.map +0 -1
- package/docs/command-reference.md +0 -261
- package/skills/tenjin/SKILL.md +0 -364
- package/skills/tenjin-publish/SKILL.md +0 -224
- package/skills/tenjin-publish/references/maintain.md +0 -39
- package/skills/tenjin-search/SKILL.md +0 -149
- package/skills/tenjin-search/references/permissions.md +0 -106
- /package/dist/{_esm-N4KAVXQR.js.map → _esm-CE7KNONL.js.map} +0 -0
- /package/dist/{buy-2JBYPHAI.js.map → ccip-7RMRLAGV.js.map} +0 -0
- /package/dist/{ccip-RPPPKTJR.js.map → ccip-NLCSCHKI.js.map} +0 -0
- /package/dist/{chunk-U5S527PP.js.map → chunk-5IEP5EGE.js.map} +0 -0
- /package/dist/{chunk-KYQVEKP5.js.map → chunk-BPMWXTFX.js.map} +0 -0
- /package/dist/{chunk-S5RYMCV6.js.map → chunk-HPWO4O6S.js.map} +0 -0
- /package/dist/{chunk-W6R3HAAG.js.map → chunk-JRGFKVAZ.js.map} +0 -0
- /package/dist/{chunk-XJN5WUKL.js.map → chunk-KG3D7FIF.js.map} +0 -0
- /package/dist/{chunk-QW2Q2KAH.js.map → chunk-LHHMV4GU.js.map} +0 -0
- /package/dist/{chunk-POJRB2AE.js.map → chunk-POUWHWID.js.map} +0 -0
- /package/dist/{chunk-KZAAWQNP.js.map → chunk-TTNESUPQ.js.map} +0 -0
- /package/dist/{chunk-YLYINX2H.js.map → chunk-XZKD7DIF.js.map} +0 -0
- /package/dist/{ccip-ZGGWQN4X.js.map → config-MXOX7XDR.js.map} +0 -0
- /package/dist/{dist-U4M6QCKE.js.map → dist-3LOO6M4U.js.map} +0 -0
- /package/dist/{config-CNUIX23Q.js.map → ethersCompat-Df4a6QIZ-THAVUGIJ.js.map} +0 -0
- /package/dist/{doctor-QJJXRWTO.js.map → install-XUM2XSHW.js.map} +0 -0
- /package/dist/{edit-HJ44P44P.js.map → paths-P2N4JTDZ.js.map} +0 -0
- /package/dist/{ethersCompat-Df4a6QIZ-WHYKB6HA.js.map → pay-SBXZEPEP.js.map} +0 -0
- /package/dist/{fund-Y5IAHZ5D.js.map → redact-46ZHF2NH.js.map} +0 -0
- /package/dist/{inspect-NFQ6SQQQ.js.map → secp256k1-ZZZT2CAX.js.map} +0 -0
- /package/dist/{outcome-ANV4QIED.js.map → status-line-wiring-BYPHTYZE.js.map} +0 -0
- /package/dist/{publish-PCBTCXCZ.js.map → viemAdapter-By13KInL-X2VY6CY3.js.map} +0 -0
- /package/dist/{search-JGAVKTYJ.js.map → wallet-PWAHVKWW.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
|
|
3
3
|
// src/lib/prompt.ts
|
|
4
|
-
import { createInterface } from "readline";
|
|
4
|
+
import { createInterface } from "node:readline";
|
|
5
5
|
function promptYesNo(prompt, opts = {}) {
|
|
6
6
|
const { defaultYes = false, input = process.stdin, output = process.stderr } = opts;
|
|
7
7
|
return new Promise((resolve) => {
|
|
@@ -24,4 +24,4 @@ function promptYesNo(prompt, opts = {}) {
|
|
|
24
24
|
export {
|
|
25
25
|
promptYesNo
|
|
26
26
|
};
|
|
27
|
-
//# sourceMappingURL=chunk-
|
|
27
|
+
//# sourceMappingURL=chunk-LHHMV4GU.js.map
|
|
@@ -1,22 +1,10 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
|
|
3
3
|
// src/lib/lock.ts
|
|
4
|
-
import { mkdirSync, rmSync } from "fs";
|
|
5
|
-
import { writeFile } from "fs/promises";
|
|
6
|
-
import { join } from "path";
|
|
4
|
+
import { mkdirSync, rmSync } from "node:fs";
|
|
5
|
+
import { writeFile } from "node:fs/promises";
|
|
6
|
+
import { join } from "node:path";
|
|
7
7
|
var owned = /* @__PURE__ */ new Set();
|
|
8
|
-
function ownsAnyLock() {
|
|
9
|
-
return owned.size > 0;
|
|
10
|
-
}
|
|
11
|
-
function releaseOwnedLocks() {
|
|
12
|
-
for (const path of owned) {
|
|
13
|
-
try {
|
|
14
|
-
rmSync(path, { recursive: true, force: true });
|
|
15
|
-
} catch {
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
owned.clear();
|
|
19
|
-
}
|
|
20
8
|
var DEFAULTS = { timeoutMs: 5e3, retryMs: 25 };
|
|
21
9
|
var LockTimeoutError = class extends Error {
|
|
22
10
|
lockPath;
|
|
@@ -65,9 +53,7 @@ function delay(ms) {
|
|
|
65
53
|
}
|
|
66
54
|
|
|
67
55
|
export {
|
|
68
|
-
ownsAnyLock,
|
|
69
|
-
releaseOwnedLocks,
|
|
70
56
|
LockTimeoutError,
|
|
71
57
|
withFileLock
|
|
72
58
|
};
|
|
73
|
-
//# sourceMappingURL=chunk-
|
|
59
|
+
//# sourceMappingURL=chunk-MEFB5KHA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/lock.ts"],"sourcesContent":["import { mkdirSync, rmSync } from 'node:fs';\nimport { writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\n\n/**\n * Locks this process currently holds. Ownership starts the instant `mkdir`\n * succeeds and ends when the release has removed the directory, so there is no\n * window where a lock is on disk and unaccounted for. A removal that FAILS keeps\n * the lock owned: the directory is still on disk, no successor can claim the path\n * while it exists, and a signal-time release gets another attempt. The one place\n * ownership is dropped without a successful removal is `releaseOwnedLocks`, which\n * runs only as the process exits, where a claim held by a dying process helps\n * nobody.\n *\n * It exists because the default signal action terminates WITHOUT running\n * `finally`: without this, one Ctrl-C leaves a lock nothing will ever clean and\n * every later run of the same command times out on it.\n */\nconst owned = new Set<string>();\n\n/** Does this process hold any lock right now? */\nexport function ownsAnyLock(): boolean {\n return owned.size > 0;\n}\n\n/**\n * Synchronously attempt to release every lock this process holds. BEST EFFORT: a\n * path that refuses to be removed is left on disk and the next run's timeout names\n * it. Safe to call from a signal handler, and a no-op when this process holds\n * none, so a run merely QUEUED behind another cannot remove that other run's lock.\n */\nexport function releaseOwnedLocks(): void {\n for (const path of owned) {\n // NEVER throws. This runs inside a signal handler, and a throw there is an\n // uncaught exception: the process dies with code 1 and a stack trace instead\n // of the diagnostic and exit 130 the handler promises. One lock we could not\n // remove must not cost the report, or the exit code, or the other locks.\n try {\n rmSync(path, { recursive: true, force: true });\n } catch {\n // Left behind; the next run's timeout names the path.\n }\n }\n owned.clear();\n}\n\nexport interface FileLockOptions {\n /** Give up acquiring after this long (ms). */\n timeoutMs?: number;\n /** Poll interval between acquisition attempts (ms). */\n retryMs?: number;\n /**\n * Called when the lock could not be removed on release. The protected work\n * succeeded, so this is not a failure of the command; it is a leftover that will\n * block later runs, and the caller is the only one able to say so.\n */\n onReleaseError?: (lockPath: string, err: unknown) => void;\n}\n\nconst DEFAULTS = { timeoutMs: 5000, retryMs: 25 };\n\n/** Thrown when the lock cannot be acquired within `timeoutMs`. Carries the lock\n * path so a caller can surface the manual-recovery step in its own error contract. */\nexport class LockTimeoutError extends Error {\n readonly lockPath: string;\n constructor(lockPath: string, timeoutMs: number) {\n super(\n `Timed out waiting for lock at ${lockPath} after ${timeoutMs}ms; if no other tenjin process is running, remove that directory and retry.`,\n );\n this.name = 'LockTimeoutError';\n this.lockPath = lockPath;\n }\n}\n\n/**\n * Minimal cross-process mutex: the lock IS a directory, and mkdir is atomic, so a\n * second holder gets EEXIST and retries with backoff until `timeoutMs`, then\n * throws LockTimeoutError. There is deliberately NO auto-steal of a \"stale\" lock:\n * concurrent waiters each judging a lock stale could remove a fresh holder's\n * directory and lose its update. A crashed holder's lock is recovered by hand (the\n * timeout error names the path); the pid+acquiredAt meta exists only to make that\n * manual call diagnosable. Always released in the finally.\n *\n * NO LONGER MIRRORED IN THE HOOKS. The generated scripts used to reimplement\n * this protocol byte for byte — they run as standalone .mjs files outside the\n * CLI and cannot import this module, yet wrote the same searches.json, and two\n * writers of one file that disagree about the mutex have no mutex. That file is\n * gone (tenjin-agent#209): hook state is one SQLite database and WAL serializes\n * the writers, so nothing outside this module implements this protocol any more.\n */\nexport async function withFileLock<T>(\n lockPath: string,\n fn: () => Promise<T>,\n opts: FileLockOptions = {},\n): Promise<T> {\n const { timeoutMs, retryMs } = { ...DEFAULTS, ...opts };\n const metaPath = join(lockPath, 'meta');\n const deadline = Date.now() + timeoutMs;\n for (;;) {\n try {\n // SYNCHRONOUS, for the same reason the release is: `await mkdir` finishes the\n // syscall before the continuation records ownership, so between the two the\n // directory is on disk and unclaimed. A signal there exits without removing\n // it and, with no stale recovery, nothing ever will. mkdirSync and the add\n // are one uninterruptible step.\n mkdirSync(lockPath);\n owned.add(lockPath); // owned from here, released only in the finally below\n break; // acquired\n } catch (err) {\n if (!isEexist(err)) throw err;\n if (Date.now() >= deadline) throw new LockTimeoutError(lockPath, timeoutMs);\n await delay(retryMs);\n }\n }\n await writeFile(metaPath, JSON.stringify({ pid: process.pid, acquiredAt: Date.now() })).catch(\n () => undefined,\n );\n try {\n return await fn();\n } finally {\n // SYNCHRONOUS, and in this order, because both are load-bearing. A signal\n // handler cannot run between two synchronous statements, so there is no instant\n // where the lock is on disk but unclaimed (a signal would exit without removing\n // it, and with no stale recovery nothing ever would) nor one where it is\n // claimed after release (a signal would remove whatever SUCCESSOR had since\n // acquired the path). An `await` here reopens the first window: `rm` yields, the\n // handler runs, sees no ownership, and leaves the directory behind.\n //\n // With no stealing, nothing else ever removes or replaces this directory, so\n // the lock here is provably the one we created — the unconditional rm is sound.\n try {\n rmSync(lockPath, { recursive: true, force: true });\n owned.delete(lockPath);\n } catch (err) {\n // KEEP ownership when the removal fails: the successor-steal risk only\n // exists once the directory is gone and someone else can take the path, so a\n // removal that failed leaves it on disk and still ours, and a signal-time\n // release gets another attempt. That only helps while THIS process lives,\n // though; once it exits normally the leftover blocks every later run, so the\n // caller is told rather than left to discover it as a timeout.\n opts.onReleaseError?.(lockPath, err);\n }\n }\n}\n\nfunction isEexist(err: unknown): boolean {\n return typeof err === 'object' && err !== null && (err as { code?: unknown }).code === 'EEXIST';\n}\n\nfunction delay(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n"],"mappings":";;;AAAA,SAAS,WAAW,cAAc;AAClC,SAAS,iBAAiB;AAC1B,SAAS,YAAY;AAgBrB,IAAM,QAAQ,oBAAI,IAAY;AAyC9B,IAAM,WAAW,EAAE,WAAW,KAAM,SAAS,GAAG;AAIzC,IAAM,mBAAN,cAA+B,MAAM;AAAA,EACjC;AAAA,EACT,YAAY,UAAkB,WAAmB;AAC/C;AAAA,MACE,iCAAiC,QAAQ,UAAU,SAAS;AAAA,IAC9D;AACA,SAAK,OAAO;AACZ,SAAK,WAAW;AAAA,EAClB;AACF;AAkBA,eAAsB,aACpB,UACA,IACA,OAAwB,CAAC,GACb;AACZ,QAAM,EAAE,WAAW,QAAQ,IAAI,EAAE,GAAG,UAAU,GAAG,KAAK;AACtD,QAAM,WAAW,KAAK,UAAU,MAAM;AACtC,QAAM,WAAW,KAAK,IAAI,IAAI;AAC9B,aAAS;AACP,QAAI;AAMF,gBAAU,QAAQ;AAClB,YAAM,IAAI,QAAQ;AAClB;AAAA,IACF,SAAS,KAAK;AACZ,UAAI,CAAC,SAAS,GAAG,EAAG,OAAM;AAC1B,UAAI,KAAK,IAAI,KAAK,SAAU,OAAM,IAAI,iBAAiB,UAAU,SAAS;AAC1E,YAAM,MAAM,OAAO;AAAA,IACrB;AAAA,EACF;AACA,QAAM,UAAU,UAAU,KAAK,UAAU,EAAE,KAAK,QAAQ,KAAK,YAAY,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE;AAAA,IACtF,MAAM;AAAA,EACR;AACA,MAAI;AACF,WAAO,MAAM,GAAG;AAAA,EAClB,UAAE;AAWA,QAAI;AACF,aAAO,UAAU,EAAE,WAAW,MAAM,OAAO,KAAK,CAAC;AACjD,YAAM,OAAO,QAAQ;AAAA,IACvB,SAAS,KAAK;AAOZ,WAAK,iBAAiB,UAAU,GAAG;AAAA,IACrC;AAAA,EACF;AACF;AAEA,SAAS,SAAS,KAAuB;AACvC,SAAO,OAAO,QAAQ,YAAY,QAAQ,QAAS,IAA2B,SAAS;AACzF;AAEA,SAAS,MAAM,IAA2B;AACxC,SAAO,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,EAAE,CAAC;AACzD;","names":[]}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
+
HashMD,
|
|
4
|
+
secp256k1,
|
|
3
5
|
sha256
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import {
|
|
6
|
-
secp256k1
|
|
7
|
-
} from "./chunk-W6R3HAAG.js";
|
|
6
|
+
} from "./chunk-JRGFKVAZ.js";
|
|
8
7
|
import {
|
|
9
8
|
BaseError,
|
|
10
9
|
BytesSizeMismatchError,
|
|
@@ -24,7 +23,7 @@ import {
|
|
|
24
23
|
createCursor,
|
|
25
24
|
encodeAbiParameters,
|
|
26
25
|
formatBlockParameter,
|
|
27
|
-
from,
|
|
26
|
+
from2 as from,
|
|
28
27
|
fromBytes,
|
|
29
28
|
hexToBigInt,
|
|
30
29
|
hexToBytes,
|
|
@@ -42,10 +41,118 @@ import {
|
|
|
42
41
|
toBytes,
|
|
43
42
|
toHex,
|
|
44
43
|
trim
|
|
45
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-EGELTSPU.js";
|
|
46
45
|
import {
|
|
47
46
|
keccak_256
|
|
48
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-KG3D7FIF.js";
|
|
48
|
+
import {
|
|
49
|
+
clean,
|
|
50
|
+
createHasher,
|
|
51
|
+
rotl
|
|
52
|
+
} from "./chunk-BPMWXTFX.js";
|
|
53
|
+
|
|
54
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/actions/public/getTransactionCount.js
|
|
55
|
+
async function getTransactionCount(client, { address, blockHash, blockNumber, blockTag = "latest", requireCanonical }) {
|
|
56
|
+
const block = formatBlockParameter({
|
|
57
|
+
blockHash,
|
|
58
|
+
blockNumber,
|
|
59
|
+
blockTag,
|
|
60
|
+
requireCanonical
|
|
61
|
+
});
|
|
62
|
+
const count = await client.request({
|
|
63
|
+
method: "eth_getTransactionCount",
|
|
64
|
+
params: [address, block]
|
|
65
|
+
}, {
|
|
66
|
+
dedupe: typeof blockNumber === "bigint" || blockHash !== void 0
|
|
67
|
+
});
|
|
68
|
+
return hexToNumber(count);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/nonceManager.js
|
|
72
|
+
function createNonceManager(parameters) {
|
|
73
|
+
const { source } = parameters;
|
|
74
|
+
const deltaMap = /* @__PURE__ */ new Map();
|
|
75
|
+
const nonceMap = new LruMap(8192);
|
|
76
|
+
const promiseMap = /* @__PURE__ */ new Map();
|
|
77
|
+
const getKey = ({ address, chainId }) => `${address}.${chainId}`;
|
|
78
|
+
const resetCache = (key) => {
|
|
79
|
+
deltaMap.delete(key);
|
|
80
|
+
promiseMap.delete(key);
|
|
81
|
+
};
|
|
82
|
+
return {
|
|
83
|
+
async consume({ address, chainId, client }) {
|
|
84
|
+
const key = getKey({ address, chainId });
|
|
85
|
+
const promise = this.get({ address, chainId, client });
|
|
86
|
+
this.increment({ address, chainId });
|
|
87
|
+
const nonce = await promise;
|
|
88
|
+
await source.set({ address, chainId }, nonce);
|
|
89
|
+
nonceMap.set(key, nonce);
|
|
90
|
+
return nonce;
|
|
91
|
+
},
|
|
92
|
+
async increment({ address, chainId }) {
|
|
93
|
+
const key = getKey({ address, chainId });
|
|
94
|
+
const delta = deltaMap.get(key) ?? 0;
|
|
95
|
+
deltaMap.set(key, delta + 1);
|
|
96
|
+
},
|
|
97
|
+
async get({ address, chainId, client }) {
|
|
98
|
+
const key = getKey({ address, chainId });
|
|
99
|
+
let promise = promiseMap.get(key);
|
|
100
|
+
if (!promise) {
|
|
101
|
+
promise = (async () => {
|
|
102
|
+
try {
|
|
103
|
+
const nonce = await source.get({ address, chainId, client });
|
|
104
|
+
const previousNonce = nonceMap.get(key) ?? 0;
|
|
105
|
+
if (previousNonce > 0 && nonce <= previousNonce)
|
|
106
|
+
return previousNonce + 1;
|
|
107
|
+
nonceMap.delete(key);
|
|
108
|
+
return nonce;
|
|
109
|
+
} finally {
|
|
110
|
+
resetCache(key);
|
|
111
|
+
}
|
|
112
|
+
})();
|
|
113
|
+
promiseMap.set(key, promise);
|
|
114
|
+
}
|
|
115
|
+
const delta = deltaMap.get(key) ?? 0;
|
|
116
|
+
return delta + await promise;
|
|
117
|
+
},
|
|
118
|
+
reset({ address, chainId }) {
|
|
119
|
+
const key = getKey({ address, chainId });
|
|
120
|
+
nonceMap.delete(key);
|
|
121
|
+
resetCache(key);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function jsonRpc() {
|
|
126
|
+
return {
|
|
127
|
+
async get(parameters) {
|
|
128
|
+
const { address, client } = parameters;
|
|
129
|
+
return getTransactionCount(client, {
|
|
130
|
+
address,
|
|
131
|
+
blockTag: "pending"
|
|
132
|
+
});
|
|
133
|
+
},
|
|
134
|
+
set() {
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
var nonceManager = /* @__PURE__ */ createNonceManager({
|
|
139
|
+
source: jsonRpc()
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/signature/serializeSignature.js
|
|
143
|
+
function serializeSignature({ r, s, to = "hex", v, yParity }) {
|
|
144
|
+
const yParity_ = (() => {
|
|
145
|
+
if (yParity === 0 || yParity === 1)
|
|
146
|
+
return yParity;
|
|
147
|
+
if (v && (v === 27n || v === 28n || v >= 35n))
|
|
148
|
+
return v % 2n === 0n ? 1 : 0;
|
|
149
|
+
throw new Error("Invalid `v` or `yParity` value");
|
|
150
|
+
})();
|
|
151
|
+
const signature = `0x${new secp256k1.Signature(hexToBigInt(r), hexToBigInt(s)).toCompactHex()}${yParity_ === 0 ? "1b" : "1c"}`;
|
|
152
|
+
if (to === "hex")
|
|
153
|
+
return signature;
|
|
154
|
+
return hexToBytes(signature);
|
|
155
|
+
}
|
|
49
156
|
|
|
50
157
|
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/encoding/toRlp.js
|
|
51
158
|
function toRlp(bytes, to = "hex") {
|
|
@@ -142,6 +249,27 @@ function getSizeOfLength(length) {
|
|
|
142
249
|
throw new BaseError("Length is too large.");
|
|
143
250
|
}
|
|
144
251
|
|
|
252
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/constants/strings.js
|
|
253
|
+
var presignMessagePrefix = "Ethereum Signed Message:\n";
|
|
254
|
+
|
|
255
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/signature/toPrefixedMessage.js
|
|
256
|
+
function toPrefixedMessage(message_) {
|
|
257
|
+
const message = (() => {
|
|
258
|
+
if (typeof message_ === "string")
|
|
259
|
+
return stringToHex(message_);
|
|
260
|
+
if (typeof message_.raw === "string")
|
|
261
|
+
return message_.raw;
|
|
262
|
+
return bytesToHex(message_.raw);
|
|
263
|
+
})();
|
|
264
|
+
const prefix = stringToHex(`${presignMessagePrefix}${size(message)}`);
|
|
265
|
+
return concat([prefix, message]);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/signature/hashMessage.js
|
|
269
|
+
function hashMessage(message, to_) {
|
|
270
|
+
return keccak256(toPrefixedMessage(message), to_);
|
|
271
|
+
}
|
|
272
|
+
|
|
145
273
|
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/blob/blobsToCommitments.js
|
|
146
274
|
function blobsToCommitments(parameters) {
|
|
147
275
|
const { kzg } = parameters;
|
|
@@ -168,10 +296,13 @@ function blobsToProofs(parameters) {
|
|
|
168
296
|
return to === "bytes" ? proofs : proofs.map((x) => bytesToHex(x));
|
|
169
297
|
}
|
|
170
298
|
|
|
299
|
+
// node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/sha256.js
|
|
300
|
+
var sha2562 = sha256;
|
|
301
|
+
|
|
171
302
|
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/hash/sha256.js
|
|
172
|
-
function
|
|
303
|
+
function sha2563(value, to_) {
|
|
173
304
|
const to = to_ || "hex";
|
|
174
|
-
const bytes =
|
|
305
|
+
const bytes = sha2562(isHex(value, { strict: false }) ? toBytes(value) : value);
|
|
175
306
|
if (to === "bytes")
|
|
176
307
|
return bytes;
|
|
177
308
|
return toHex(bytes);
|
|
@@ -181,7 +312,7 @@ function sha2562(value, to_) {
|
|
|
181
312
|
function commitmentToVersionedHash(parameters) {
|
|
182
313
|
const { commitment, version = 1 } = parameters;
|
|
183
314
|
const to = parameters.to ?? (typeof commitment === "string" ? "hex" : "bytes");
|
|
184
|
-
const versionedHash =
|
|
315
|
+
const versionedHash = sha2563(commitment, "bytes");
|
|
185
316
|
versionedHash.set([version], 0);
|
|
186
317
|
return to === "bytes" ? versionedHash : bytesToHex(versionedHash);
|
|
187
318
|
}
|
|
@@ -298,25 +429,6 @@ function toBlobSidecars(parameters) {
|
|
|
298
429
|
return sidecars;
|
|
299
430
|
}
|
|
300
431
|
|
|
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
|
-
|
|
320
432
|
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/transaction/assertTransaction.js
|
|
321
433
|
function assertTransactionEIP7702(transaction) {
|
|
322
434
|
const { authorizationList } = transaction;
|
|
@@ -385,6 +497,25 @@ function assertTransactionLegacy(transaction) {
|
|
|
385
497
|
throw new FeeCapTooHighError({ maxFeePerGas: gasPrice });
|
|
386
498
|
}
|
|
387
499
|
|
|
500
|
+
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/transaction/getTransactionType.js
|
|
501
|
+
function getTransactionType(transaction) {
|
|
502
|
+
if (transaction.type)
|
|
503
|
+
return transaction.type;
|
|
504
|
+
if (typeof transaction.authorizationList !== "undefined")
|
|
505
|
+
return "eip7702";
|
|
506
|
+
if (typeof transaction.blobs !== "undefined" || typeof transaction.blobVersionedHashes !== "undefined" || typeof transaction.maxFeePerBlobGas !== "undefined" || typeof transaction.sidecars !== "undefined")
|
|
507
|
+
return "eip4844";
|
|
508
|
+
if (typeof transaction.maxFeePerGas !== "undefined" || typeof transaction.maxPriorityFeePerGas !== "undefined") {
|
|
509
|
+
return "eip1559";
|
|
510
|
+
}
|
|
511
|
+
if (typeof transaction.gasPrice !== "undefined") {
|
|
512
|
+
if (typeof transaction.accessList !== "undefined")
|
|
513
|
+
return "eip2930";
|
|
514
|
+
return "legacy";
|
|
515
|
+
}
|
|
516
|
+
throw new InvalidSerializableTransactionError({ transaction });
|
|
517
|
+
}
|
|
518
|
+
|
|
388
519
|
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/utils/transaction/serializeAccessList.js
|
|
389
520
|
function serializeAccessList(accessList) {
|
|
390
521
|
if (!accessList || accessList.length === 0)
|
|
@@ -623,115 +754,6 @@ function toYParitySignatureArray(transaction, signature_) {
|
|
|
623
754
|
return [yParity_, r === "0x00" ? "0x" : r, s === "0x00" ? "0x" : s];
|
|
624
755
|
}
|
|
625
756
|
|
|
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
|
-
|
|
735
757
|
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/errors/typedData.js
|
|
736
758
|
var InvalidDomainError = class extends BaseError {
|
|
737
759
|
constructor({ domain }) {
|
|
@@ -965,27 +987,133 @@ function validateReference(type) {
|
|
|
965
987
|
throw new InvalidStructTypeError({ type });
|
|
966
988
|
}
|
|
967
989
|
|
|
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
|
-
|
|
983
990
|
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/accounts/utils/publicKeyToAddress.js
|
|
984
991
|
function publicKeyToAddress(publicKey) {
|
|
985
992
|
const address = keccak256(`0x${publicKey.substring(4)}`).substring(26);
|
|
986
993
|
return checksumAddress(`0x${address}`);
|
|
987
994
|
}
|
|
988
995
|
|
|
996
|
+
// node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/legacy.js
|
|
997
|
+
var Rho160 = /* @__PURE__ */ Uint8Array.from([
|
|
998
|
+
7,
|
|
999
|
+
4,
|
|
1000
|
+
13,
|
|
1001
|
+
1,
|
|
1002
|
+
10,
|
|
1003
|
+
6,
|
|
1004
|
+
15,
|
|
1005
|
+
3,
|
|
1006
|
+
12,
|
|
1007
|
+
0,
|
|
1008
|
+
9,
|
|
1009
|
+
5,
|
|
1010
|
+
2,
|
|
1011
|
+
14,
|
|
1012
|
+
11,
|
|
1013
|
+
8
|
|
1014
|
+
]);
|
|
1015
|
+
var Id160 = /* @__PURE__ */ (() => Uint8Array.from(new Array(16).fill(0).map((_, i) => i)))();
|
|
1016
|
+
var Pi160 = /* @__PURE__ */ (() => Id160.map((i) => (9 * i + 5) % 16))();
|
|
1017
|
+
var idxLR = /* @__PURE__ */ (() => {
|
|
1018
|
+
const L = [Id160];
|
|
1019
|
+
const R = [Pi160];
|
|
1020
|
+
const res = [L, R];
|
|
1021
|
+
for (let i = 0; i < 4; i++)
|
|
1022
|
+
for (let j of res)
|
|
1023
|
+
j.push(j[i].map((k) => Rho160[k]));
|
|
1024
|
+
return res;
|
|
1025
|
+
})();
|
|
1026
|
+
var idxL = /* @__PURE__ */ (() => idxLR[0])();
|
|
1027
|
+
var idxR = /* @__PURE__ */ (() => idxLR[1])();
|
|
1028
|
+
var shifts160 = /* @__PURE__ */ [
|
|
1029
|
+
[11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],
|
|
1030
|
+
[12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],
|
|
1031
|
+
[13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],
|
|
1032
|
+
[14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],
|
|
1033
|
+
[15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5]
|
|
1034
|
+
].map((i) => Uint8Array.from(i));
|
|
1035
|
+
var shiftsL160 = /* @__PURE__ */ idxL.map((idx, i) => idx.map((j) => shifts160[i][j]));
|
|
1036
|
+
var shiftsR160 = /* @__PURE__ */ idxR.map((idx, i) => idx.map((j) => shifts160[i][j]));
|
|
1037
|
+
var Kl160 = /* @__PURE__ */ Uint32Array.from([
|
|
1038
|
+
0,
|
|
1039
|
+
1518500249,
|
|
1040
|
+
1859775393,
|
|
1041
|
+
2400959708,
|
|
1042
|
+
2840853838
|
|
1043
|
+
]);
|
|
1044
|
+
var Kr160 = /* @__PURE__ */ Uint32Array.from([
|
|
1045
|
+
1352829926,
|
|
1046
|
+
1548603684,
|
|
1047
|
+
1836072691,
|
|
1048
|
+
2053994217,
|
|
1049
|
+
0
|
|
1050
|
+
]);
|
|
1051
|
+
function ripemd_f(group, x, y, z) {
|
|
1052
|
+
if (group === 0)
|
|
1053
|
+
return x ^ y ^ z;
|
|
1054
|
+
if (group === 1)
|
|
1055
|
+
return x & y | ~x & z;
|
|
1056
|
+
if (group === 2)
|
|
1057
|
+
return (x | ~y) ^ z;
|
|
1058
|
+
if (group === 3)
|
|
1059
|
+
return x & z | y & ~z;
|
|
1060
|
+
return x ^ (y | ~z);
|
|
1061
|
+
}
|
|
1062
|
+
var BUF_160 = /* @__PURE__ */ new Uint32Array(16);
|
|
1063
|
+
var RIPEMD160 = class extends HashMD {
|
|
1064
|
+
constructor() {
|
|
1065
|
+
super(64, 20, 8, true);
|
|
1066
|
+
this.h0 = 1732584193 | 0;
|
|
1067
|
+
this.h1 = 4023233417 | 0;
|
|
1068
|
+
this.h2 = 2562383102 | 0;
|
|
1069
|
+
this.h3 = 271733878 | 0;
|
|
1070
|
+
this.h4 = 3285377520 | 0;
|
|
1071
|
+
}
|
|
1072
|
+
get() {
|
|
1073
|
+
const { h0, h1, h2, h3, h4 } = this;
|
|
1074
|
+
return [h0, h1, h2, h3, h4];
|
|
1075
|
+
}
|
|
1076
|
+
set(h0, h1, h2, h3, h4) {
|
|
1077
|
+
this.h0 = h0 | 0;
|
|
1078
|
+
this.h1 = h1 | 0;
|
|
1079
|
+
this.h2 = h2 | 0;
|
|
1080
|
+
this.h3 = h3 | 0;
|
|
1081
|
+
this.h4 = h4 | 0;
|
|
1082
|
+
}
|
|
1083
|
+
process(view, offset) {
|
|
1084
|
+
for (let i = 0; i < 16; i++, offset += 4)
|
|
1085
|
+
BUF_160[i] = view.getUint32(offset, true);
|
|
1086
|
+
let al = this.h0 | 0, ar = al, bl = this.h1 | 0, br = bl, cl = this.h2 | 0, cr = cl, dl = this.h3 | 0, dr = dl, el = this.h4 | 0, er = el;
|
|
1087
|
+
for (let group = 0; group < 5; group++) {
|
|
1088
|
+
const rGroup = 4 - group;
|
|
1089
|
+
const hbl = Kl160[group], hbr = Kr160[group];
|
|
1090
|
+
const rl = idxL[group], rr = idxR[group];
|
|
1091
|
+
const sl = shiftsL160[group], sr = shiftsR160[group];
|
|
1092
|
+
for (let i = 0; i < 16; i++) {
|
|
1093
|
+
const tl = rotl(al + ripemd_f(group, bl, cl, dl) + BUF_160[rl[i]] + hbl, sl[i]) + el | 0;
|
|
1094
|
+
al = el, el = dl, dl = rotl(cl, 10) | 0, cl = bl, bl = tl;
|
|
1095
|
+
}
|
|
1096
|
+
for (let i = 0; i < 16; i++) {
|
|
1097
|
+
const tr = rotl(ar + ripemd_f(rGroup, br, cr, dr) + BUF_160[rr[i]] + hbr, sr[i]) + er | 0;
|
|
1098
|
+
ar = er, er = dr, dr = rotl(cr, 10) | 0, cr = br, br = tr;
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
this.set(this.h1 + cl + dr | 0, this.h2 + dl + er | 0, this.h3 + el + ar | 0, this.h4 + al + br | 0, this.h0 + bl + cr | 0);
|
|
1102
|
+
}
|
|
1103
|
+
roundClean() {
|
|
1104
|
+
clean(BUF_160);
|
|
1105
|
+
}
|
|
1106
|
+
destroy() {
|
|
1107
|
+
this.destroyed = true;
|
|
1108
|
+
clean(this.buffer);
|
|
1109
|
+
this.set(0, 0, 0, 0, 0);
|
|
1110
|
+
}
|
|
1111
|
+
};
|
|
1112
|
+
var ripemd160 = /* @__PURE__ */ createHasher(() => new RIPEMD160());
|
|
1113
|
+
|
|
1114
|
+
// node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/ripemd160.js
|
|
1115
|
+
var ripemd1602 = ripemd160;
|
|
1116
|
+
|
|
989
1117
|
// node_modules/.pnpm/ox@0.14.30_typescript@6.0.3_zod@4.4.3/node_modules/ox/_esm/core/Hash.js
|
|
990
1118
|
function keccak2562(value, options = {}) {
|
|
991
1119
|
const { as = typeof value === "string" ? "Hex" : "Bytes" } = options;
|
|
@@ -1013,32 +1141,34 @@ function hashAuthorization(parameters) {
|
|
|
1013
1141
|
}
|
|
1014
1142
|
|
|
1015
1143
|
export {
|
|
1144
|
+
getTransactionCount,
|
|
1145
|
+
createNonceManager,
|
|
1146
|
+
nonceManager,
|
|
1147
|
+
serializeSignature,
|
|
1016
1148
|
publicKeyToAddress,
|
|
1017
1149
|
toRlp,
|
|
1018
1150
|
bytesToRlp,
|
|
1019
1151
|
hexToRlp,
|
|
1020
1152
|
hashAuthorization,
|
|
1021
|
-
|
|
1153
|
+
presignMessagePrefix,
|
|
1154
|
+
toPrefixedMessage,
|
|
1155
|
+
hashMessage,
|
|
1022
1156
|
blobsToCommitments,
|
|
1023
1157
|
blobsToProofs,
|
|
1024
1158
|
sha2562 as sha256,
|
|
1159
|
+
sha2563 as sha2562,
|
|
1025
1160
|
commitmentToVersionedHash,
|
|
1026
1161
|
commitmentsToVersionedHashes,
|
|
1027
1162
|
toBlobs,
|
|
1028
1163
|
toBlobSidecars,
|
|
1029
|
-
getTransactionType,
|
|
1030
1164
|
assertTransactionEIP7702,
|
|
1031
1165
|
assertTransactionEIP4844,
|
|
1032
1166
|
assertTransactionEIP1559,
|
|
1033
1167
|
assertTransactionEIP2930,
|
|
1034
1168
|
assertTransactionLegacy,
|
|
1169
|
+
getTransactionType,
|
|
1035
1170
|
serializeAccessList,
|
|
1036
1171
|
serializeTransaction,
|
|
1037
|
-
createNonceManager,
|
|
1038
|
-
nonceManager,
|
|
1039
|
-
presignMessagePrefix,
|
|
1040
|
-
toPrefixedMessage,
|
|
1041
|
-
hashMessage,
|
|
1042
1172
|
InvalidDomainError,
|
|
1043
1173
|
InvalidPrimaryTypeError,
|
|
1044
1174
|
InvalidStructTypeError,
|
|
@@ -1049,7 +1179,7 @@ export {
|
|
|
1049
1179
|
hashTypedData,
|
|
1050
1180
|
hashDomain,
|
|
1051
1181
|
hashStruct,
|
|
1052
|
-
|
|
1053
|
-
|
|
1182
|
+
ripemd1602 as ripemd160,
|
|
1183
|
+
keccak2562 as keccak256
|
|
1054
1184
|
};
|
|
1055
|
-
//# sourceMappingURL=chunk-
|
|
1185
|
+
//# sourceMappingURL=chunk-N35E6CM2.js.map
|