Merge pull request #29 from Routstr/fix/not-enough-proofs-balance-error

fix: surface cocod "Not enough proofs" as InsufficientBalanceError
This commit is contained in:
redshift
2026-05-07 15:29:11 +00:00
committed by GitHub
+5
View File
@@ -1,4 +1,5 @@
import { getDecodedToken } from "@cashu/cashu-ts";
import { InsufficientBalanceError } from "@routstr/sdk";
import { logger } from "../../utils/logger";
import { createCocodClient, type CocodClient } from "./cocod-client";
@@ -79,6 +80,10 @@ export async function createWalletAdapter(
continue;
}
if (errorMessage.includes("Not enough proofs")) {
throw new InsufficientBalanceError(amount, 0);
}
logger.error("Error in walletAdapter sendToken:", error);
throw error;
}