diff --git a/src/lib/cashu.svelte.ts b/src/lib/cashu.svelte.ts index 4dca9b4..dd4408e 100644 --- a/src/lib/cashu.svelte.ts +++ b/src/lib/cashu.svelte.ts @@ -1,6 +1,7 @@ import { CashuMint, CashuWallet, + getDecodedToken, MintQuoteState, type Proof, } from "@cashu/cashu-ts"; @@ -225,7 +226,9 @@ function updateBalance() { export async function redeemToken(token: string): Promise { if (!token.trim()) throw new Error("Token is empty"); - const wallet = await walletReady; + const parsedToken = getDecodedToken(token); + const mint = new CashuMint(parsedToken.mint); + const wallet = new CashuWallet(mint); const received = await wallet.receive(token.trim()); proofs.push(...received); const amountReceived = received.reduce((sum, p) => sum + p.amount, 0);