From cdda2d34d26bd8fb310867022130e4a59f67d13c Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 14 Sep 2026 08:50:31 -0700 Subject: ecash: make claims work against the v1 keyset mint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cashu-ts 2.9.0 only derives v0 keyset ids, so CashuWallet rejected the mint's current keyset and receive() could never run. Build the wallet from keys preloaded off our own mint instead of verifying, decode tokens with the keysets (2.9.0 shortens v1 ids in the tokens it encodes, and won't expand them otherwise), and treat an unreadable house-pool value as empty rather than throwing — the pool key had been found holding a bare integer, which surfaced as "n.startsWith is not a function" on every redeem. The pool write is awaited so a dropped set can't strand freshly swapped proofs. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_0166Ci2XdCair1B9ych7w8dq --- routes/info.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'routes') diff --git a/routes/info.ts b/routes/info.ts index a0ac7693..aae130bf 100644 --- a/routes/info.ts +++ b/routes/info.ts @@ -1,8 +1,8 @@ import { archive } from "$lib/db"; -import { db, g } from "$lib/db"; +import { db } from "$lib/db"; import { getHealthStatus } from "$lib/health"; import ln from "$lib/ln"; -import { getDecodedToken } from "@cashu/cashu-ts"; +import { pool } from "$lib/ecash"; export default { async health(_, res) { @@ -28,10 +28,7 @@ export default { ); const lnwallet = parseInt(funds.outputs.reduce((a, b) => a + b.value, 0)); - const cash = getDecodedToken(await g("cash")).proofs.reduce( - (a, b) => a + b.amount, - 0, - ); + const cash = (await pool()).reduce((a, b) => a + b.amount, 0); const info = { cash, -- cgit v1.2.3