routstrd 0.2.20 → 0.2.22
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/.dockerignore +12 -0
- package/Dockerfile +3 -0
- package/bun.lock +29 -15
- package/dist/daemon/index.js +9555 -3309
- package/dist/index.js +23 -23
- package/docker-compose.yml +14 -0
- package/package.json +3 -3
- package/src/start-daemon.ts +5 -5
- package/src/utils/config.ts +2 -0
- package/src/utils/logger.ts +3 -3
package/dist/index.js
CHANGED
|
@@ -2170,18 +2170,18 @@ var init_logger = __esm(() => {
|
|
|
2170
2170
|
LOGS_DIR = join(LOG_DIR, "logs");
|
|
2171
2171
|
logger = {
|
|
2172
2172
|
log: (...args) => {
|
|
2173
|
-
console.log(...args);
|
|
2174
2173
|
writeLog("INFO", ...args);
|
|
2175
2174
|
},
|
|
2176
2175
|
debug: (...args) => {
|
|
2177
2176
|
writeLog("DEBUG", ...args);
|
|
2178
2177
|
},
|
|
2178
|
+
warn: (...args) => {
|
|
2179
|
+
writeLog("WARN", ...args);
|
|
2180
|
+
},
|
|
2179
2181
|
error: (...args) => {
|
|
2180
|
-
console.error(...args);
|
|
2181
2182
|
writeLog("ERROR", ...args);
|
|
2182
2183
|
},
|
|
2183
2184
|
info: (...args) => {
|
|
2184
|
-
console.log(...args);
|
|
2185
2185
|
writeLog("INFO", ...args);
|
|
2186
2186
|
}
|
|
2187
2187
|
};
|
|
@@ -2322,7 +2322,7 @@ async function startDaemonUnlocked(options) {
|
|
|
2322
2322
|
const pollIntervalMs = 250;
|
|
2323
2323
|
const startupTimeoutMs = 10 * 60 * 1000;
|
|
2324
2324
|
if (await isDaemonHealthy(port)) {
|
|
2325
|
-
|
|
2325
|
+
console.log(`Routstr daemon already running on http://localhost:${port}/v1`);
|
|
2326
2326
|
return;
|
|
2327
2327
|
}
|
|
2328
2328
|
if (options.port) {
|
|
@@ -2334,8 +2334,8 @@ async function startDaemonUnlocked(options) {
|
|
|
2334
2334
|
const daemonScript = new URL("./daemon/index.js", import.meta.url).pathname;
|
|
2335
2335
|
const shellCmd = `bun run "${daemonScript}" ${args.map((a) => `'${a}'`).join(" ")}`;
|
|
2336
2336
|
const proc = Bun.spawn(["sh", "-c", shellCmd], {
|
|
2337
|
-
stdout: "
|
|
2338
|
-
stderr: "
|
|
2337
|
+
stdout: "ignore",
|
|
2338
|
+
stderr: "ignore",
|
|
2339
2339
|
stdin: "ignore",
|
|
2340
2340
|
detached: true
|
|
2341
2341
|
});
|
|
@@ -2351,7 +2351,7 @@ async function startDaemonUnlocked(options) {
|
|
|
2351
2351
|
throw new Error(`Daemon process exited early with code ${exitCode}. Check logs in ${LOGS_DIR2}`);
|
|
2352
2352
|
}
|
|
2353
2353
|
if (await isDaemonHealthy(port)) {
|
|
2354
|
-
|
|
2354
|
+
console.log(`Routstr daemon started (PID: ${proc.pid}).`);
|
|
2355
2355
|
return;
|
|
2356
2356
|
}
|
|
2357
2357
|
}
|
|
@@ -2361,7 +2361,7 @@ async function startDaemon(options = {}) {
|
|
|
2361
2361
|
const port = options.port || "8008";
|
|
2362
2362
|
const startupTimeoutMs = 10 * 60 * 1000;
|
|
2363
2363
|
if (await isDaemonHealthy(port)) {
|
|
2364
|
-
|
|
2364
|
+
console.log(`Routstr daemon already running on http://localhost:${port}/v1`);
|
|
2365
2365
|
return;
|
|
2366
2366
|
}
|
|
2367
2367
|
await withCrossProcessLock(DAEMON_STARTUP_LOCK_PATH, async () => {
|
|
@@ -2380,7 +2380,7 @@ var init_start_daemon = __esm(() => {
|
|
|
2380
2380
|
DAEMON_STARTUP_LOCK_PATH = `${CONFIG_DIR}/routstrd-startup.lock`;
|
|
2381
2381
|
});
|
|
2382
2382
|
|
|
2383
|
-
// node_modules/@noble/hashes/utils.js
|
|
2383
|
+
// node_modules/nostr-tools/node_modules/@noble/hashes/utils.js
|
|
2384
2384
|
function isBytes(a) {
|
|
2385
2385
|
return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
|
|
2386
2386
|
}
|
|
@@ -2512,7 +2512,7 @@ var init_utils = __esm(() => {
|
|
|
2512
2512
|
asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
|
|
2513
2513
|
});
|
|
2514
2514
|
|
|
2515
|
-
// node_modules/@noble/hashes/_md.js
|
|
2515
|
+
// node_modules/nostr-tools/node_modules/@noble/hashes/_md.js
|
|
2516
2516
|
function Chi(a, b, c) {
|
|
2517
2517
|
return a & b ^ ~a & c;
|
|
2518
2518
|
}
|
|
@@ -2675,7 +2675,7 @@ var init__md = __esm(() => {
|
|
|
2675
2675
|
]);
|
|
2676
2676
|
});
|
|
2677
2677
|
|
|
2678
|
-
// node_modules/@noble/hashes/_u64.js
|
|
2678
|
+
// node_modules/nostr-tools/node_modules/@noble/hashes/_u64.js
|
|
2679
2679
|
function fromBig(n, le = false) {
|
|
2680
2680
|
if (le)
|
|
2681
2681
|
return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
|
|
@@ -2701,7 +2701,7 @@ var init__u64 = __esm(() => {
|
|
|
2701
2701
|
_32n = /* @__PURE__ */ BigInt(32);
|
|
2702
2702
|
});
|
|
2703
2703
|
|
|
2704
|
-
// node_modules/@noble/hashes/sha2.js
|
|
2704
|
+
// node_modules/nostr-tools/node_modules/@noble/hashes/sha2.js
|
|
2705
2705
|
var SHA256_K, SHA256_W, SHA2_32B, _SHA256, _SHA224, K512, SHA512_Kh, SHA512_Kl, SHA512_W_H, SHA512_W_L, SHA2_64B, _SHA512, _SHA384, T224_IV, T256_IV, _SHA512_224, _SHA512_256, sha256;
|
|
2706
2706
|
var init_sha2 = __esm(() => {
|
|
2707
2707
|
init__md();
|
|
@@ -3163,7 +3163,7 @@ var init_sha2 = __esm(() => {
|
|
|
3163
3163
|
sha256 = /* @__PURE__ */ createHasher(() => new _SHA256, /* @__PURE__ */ oidNist(1));
|
|
3164
3164
|
});
|
|
3165
3165
|
|
|
3166
|
-
// node_modules/@noble/curves/utils.js
|
|
3166
|
+
// node_modules/nostr-tools/node_modules/@noble/curves/utils.js
|
|
3167
3167
|
function abool(value, title = "") {
|
|
3168
3168
|
if (typeof value !== "boolean") {
|
|
3169
3169
|
const prefix = title && `"${title}" `;
|
|
@@ -3316,7 +3316,7 @@ var init_utils2 = __esm(() => {
|
|
|
3316
3316
|
_1n = /* @__PURE__ */ BigInt(1);
|
|
3317
3317
|
});
|
|
3318
3318
|
|
|
3319
|
-
// node_modules/@noble/curves/abstract/modular.js
|
|
3319
|
+
// node_modules/nostr-tools/node_modules/@noble/curves/abstract/modular.js
|
|
3320
3320
|
function mod(a, b) {
|
|
3321
3321
|
const result = a % b;
|
|
3322
3322
|
return result >= _0n2 ? result : b + result;
|
|
@@ -3702,7 +3702,7 @@ var init_modular = __esm(() => {
|
|
|
3702
3702
|
];
|
|
3703
3703
|
});
|
|
3704
3704
|
|
|
3705
|
-
// node_modules/@noble/curves/abstract/curve.js
|
|
3705
|
+
// node_modules/nostr-tools/node_modules/@noble/curves/abstract/curve.js
|
|
3706
3706
|
function negateCt(condition, item) {
|
|
3707
3707
|
const neg = item.negate();
|
|
3708
3708
|
return condition ? neg : item;
|
|
@@ -3914,7 +3914,7 @@ var init_curve = __esm(() => {
|
|
|
3914
3914
|
pointWindowSizes = new WeakMap;
|
|
3915
3915
|
});
|
|
3916
3916
|
|
|
3917
|
-
// node_modules/@noble/hashes/hmac.js
|
|
3917
|
+
// node_modules/nostr-tools/node_modules/@noble/hashes/hmac.js
|
|
3918
3918
|
class _HMAC {
|
|
3919
3919
|
oHash;
|
|
3920
3920
|
iHash;
|
|
@@ -3988,7 +3988,7 @@ var init_hmac = __esm(() => {
|
|
|
3988
3988
|
hmac.create = (hash, key) => new _HMAC(hash, key);
|
|
3989
3989
|
});
|
|
3990
3990
|
|
|
3991
|
-
// node_modules/@noble/curves/abstract/weierstrass.js
|
|
3991
|
+
// node_modules/nostr-tools/node_modules/@noble/curves/abstract/weierstrass.js
|
|
3992
3992
|
function _splitEndoScalar(k, basis, n) {
|
|
3993
3993
|
const [[a1, b1], [a2, b2]] = basis;
|
|
3994
3994
|
const c1 = divNearest(b2 * k, n);
|
|
@@ -4815,7 +4815,7 @@ var init_weierstrass = __esm(() => {
|
|
|
4815
4815
|
_4n2 = BigInt(4);
|
|
4816
4816
|
});
|
|
4817
4817
|
|
|
4818
|
-
// node_modules/@noble/curves/secp256k1.js
|
|
4818
|
+
// node_modules/nostr-tools/node_modules/@noble/curves/secp256k1.js
|
|
4819
4819
|
function sqrtMod(y) {
|
|
4820
4820
|
const P = secp256k1_CURVE.p;
|
|
4821
4821
|
const _3n3 = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22);
|
|
@@ -4976,7 +4976,7 @@ var init_secp256k1 = __esm(() => {
|
|
|
4976
4976
|
})();
|
|
4977
4977
|
});
|
|
4978
4978
|
|
|
4979
|
-
// node_modules/@scure/base/index.js
|
|
4979
|
+
// node_modules/nostr-tools/node_modules/@scure/base/index.js
|
|
4980
4980
|
function isBytes2(a) {
|
|
4981
4981
|
return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
|
|
4982
4982
|
}
|
|
@@ -6482,7 +6482,7 @@ var init_chacha = __esm(() => {
|
|
|
6482
6482
|
xchacha20poly1305 = /* @__PURE__ */ wrapCipher({ blockSize: 64, nonceLength: 24, tagLength: 16 }, _poly1305_aead(xchacha20));
|
|
6483
6483
|
});
|
|
6484
6484
|
|
|
6485
|
-
// node_modules/@noble/hashes/hkdf.js
|
|
6485
|
+
// node_modules/nostr-tools/node_modules/@noble/hashes/hkdf.js
|
|
6486
6486
|
function extract(hash, ikm, salt) {
|
|
6487
6487
|
ahash(hash);
|
|
6488
6488
|
if (salt === undefined)
|
|
@@ -15629,7 +15629,7 @@ async function isCocodInstalled(cocodPath) {
|
|
|
15629
15629
|
// package.json
|
|
15630
15630
|
var package_default = {
|
|
15631
15631
|
name: "routstrd",
|
|
15632
|
-
version: "0.2.
|
|
15632
|
+
version: "0.2.22",
|
|
15633
15633
|
module: "src/index.ts",
|
|
15634
15634
|
type: "module",
|
|
15635
15635
|
private: false,
|
|
@@ -15652,8 +15652,8 @@ var package_default = {
|
|
|
15652
15652
|
typescript: "^5"
|
|
15653
15653
|
},
|
|
15654
15654
|
dependencies: {
|
|
15655
|
-
"@cashu/cashu-ts": "^3.
|
|
15656
|
-
"@routstr/sdk": "^0.3.
|
|
15655
|
+
"@cashu/cashu-ts": "^4.3.0",
|
|
15656
|
+
"@routstr/sdk": "^0.3.8",
|
|
15657
15657
|
"applesauce-core": "^5.1.0",
|
|
15658
15658
|
"applesauce-relay": "^5.1.0",
|
|
15659
15659
|
commander: "^14.0.2",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "routstrd",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.22",
|
|
4
4
|
"module": "src/index.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"typescript": "^5"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@cashu/cashu-ts": "^3.
|
|
27
|
-
"@routstr/sdk": "^0.3.
|
|
26
|
+
"@cashu/cashu-ts": "^4.3.0",
|
|
27
|
+
"@routstr/sdk": "^0.3.8",
|
|
28
28
|
"applesauce-core": "^5.1.0",
|
|
29
29
|
"applesauce-relay": "^5.1.0",
|
|
30
30
|
"commander": "^14.0.2",
|
package/src/start-daemon.ts
CHANGED
|
@@ -28,7 +28,7 @@ async function startDaemonUnlocked(
|
|
|
28
28
|
const startupTimeoutMs = 10 * 60 * 1000;
|
|
29
29
|
|
|
30
30
|
if (await isDaemonHealthy(port)) {
|
|
31
|
-
|
|
31
|
+
console.log(`Routstr daemon already running on http://localhost:${port}/v1`);
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -43,8 +43,8 @@ async function startDaemonUnlocked(
|
|
|
43
43
|
const shellCmd = `bun run "${daemonScript}" ${args.map((a) => `'${a}'`).join(" ")}`;
|
|
44
44
|
|
|
45
45
|
const proc = Bun.spawn(["sh", "-c", shellCmd], {
|
|
46
|
-
stdout: "
|
|
47
|
-
stderr: "
|
|
46
|
+
stdout: "ignore",
|
|
47
|
+
stderr: "ignore",
|
|
48
48
|
stdin: "ignore",
|
|
49
49
|
detached: true,
|
|
50
50
|
});
|
|
@@ -67,7 +67,7 @@ async function startDaemonUnlocked(
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
if (await isDaemonHealthy(port)) {
|
|
70
|
-
|
|
70
|
+
console.log(`Routstr daemon started (PID: ${proc.pid}).`);
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
@@ -84,7 +84,7 @@ export async function startDaemon(
|
|
|
84
84
|
const startupTimeoutMs = 10 * 60 * 1000;
|
|
85
85
|
|
|
86
86
|
if (await isDaemonHealthy(port)) {
|
|
87
|
-
|
|
87
|
+
console.log(`Routstr daemon already running on http://localhost:${port}/v1`);
|
|
88
88
|
return;
|
|
89
89
|
}
|
|
90
90
|
|
package/src/utils/config.ts
CHANGED
|
@@ -14,6 +14,8 @@ export interface RoutstrdConfig {
|
|
|
14
14
|
mode?: "xcashu" | "apikeys";
|
|
15
15
|
daemonUrl?: string;
|
|
16
16
|
nsec?: string;
|
|
17
|
+
/** Nostr hex pubkey for routstr review/model events (kind 38425/38423). */
|
|
18
|
+
routstrPubkey?: string;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
export const DEFAULT_CONFIG: RoutstrdConfig = {
|
package/src/utils/logger.ts
CHANGED
|
@@ -48,18 +48,18 @@ async function writeLog(level: string, ...args: unknown[]) {
|
|
|
48
48
|
|
|
49
49
|
export const logger = {
|
|
50
50
|
log: (...args: unknown[]) => {
|
|
51
|
-
console.log(...args);
|
|
52
51
|
writeLog("INFO", ...args);
|
|
53
52
|
},
|
|
54
53
|
debug: (...args: unknown[]) => {
|
|
55
54
|
writeLog("DEBUG", ...args);
|
|
56
55
|
},
|
|
56
|
+
warn: (...args: unknown[]) => {
|
|
57
|
+
writeLog("WARN", ...args);
|
|
58
|
+
},
|
|
57
59
|
error: (...args: unknown[]) => {
|
|
58
|
-
console.error(...args);
|
|
59
60
|
writeLog("ERROR", ...args);
|
|
60
61
|
},
|
|
61
62
|
info: (...args: unknown[]) => {
|
|
62
|
-
console.log(...args);
|
|
63
63
|
writeLog("INFO", ...args);
|
|
64
64
|
},
|
|
65
65
|
};
|