fix(wallet): let coco recover failed operations

This commit is contained in:
redshift
2026-07-13 20:32:02 +08:00
parent 2d7c7e9b24
commit aaafe91a4a
+4 -14
View File
@@ -387,13 +387,8 @@ export async function createCocoClient(
mintUrl: targetMint,
amount,
});
try {
const { token } = await coco.ops.send.execute(prepared.id);
return getEncodedToken(token);
} catch (error) {
await coco.ops.send.cancel(prepared.id);
throw error;
}
const { token } = await coco.ops.send.execute(prepared.id);
return getEncodedToken(token);
},
async sendBolt11(invoice: string, mintUrl?: string): Promise<string> {
@@ -407,13 +402,8 @@ export async function createCocoClient(
method: "bolt11",
methodData: { invoice },
});
try {
await coco.ops.melt.execute(prepared.id);
return "Payment sent successfully";
} catch (error) {
await coco.ops.melt.cancel(prepared.id);
throw error;
}
await coco.ops.melt.execute(prepared.id);
return "Payment sent successfully";
},
async listMints(): Promise<string[]> {