From 96f3e1927d37a81d47f8683b4c135bfd30eaceaa Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 11 Mar 2026 22:30:21 -0700 Subject: simplify bumping --- src/routes/(app)/payment/[id]/+page.svelte | 91 ++-------------------- .../(app)/payment/[id]/bump-estimate/+server.ts | 12 --- 2 files changed, 7 insertions(+), 96 deletions(-) delete mode 100644 src/routes/(app)/payment/[id]/bump-estimate/+server.ts (limited to 'src') diff --git a/src/routes/(app)/payment/[id]/+page.svelte b/src/routes/(app)/payment/[id]/+page.svelte index 8ba33c02..b8642338 100644 --- a/src/routes/(app)/payment/[id]/+page.svelte +++ b/src/routes/(app)/payment/[id]/+page.svelte @@ -55,48 +55,20 @@ success("Printing!"); }; - let showBump = $state(false); let bumpLoading = $state(false); - let bumpEstimate: any = $state(null); - let bumpTargetRate = $state(0); let bumpError = $state(""); let canBump = $derived( type === "bitcoin" && !confirmed && amount < 0 && p.bumpReserve > 0 && !p.childTxid, ); - let fetchEstimate = async (targetRate: number) => { - bumpTargetRate = targetRate; - bumpError = ""; - try { - bumpEstimate = await post("/bump/estimate", { id, targetFeeRate: targetRate }); - } catch (e: any) { - bumpError = e.message; - } - }; - - let openBump = async () => { - showBump = true; - bumpEstimate = null; - bumpError = ""; - try { - const est = await post("/bump/estimate", { id, targetFeeRate: 10 }); - bumpEstimate = est; - bumpTargetRate = est.fees?.fastestFee || 10; - await fetchEstimate(bumpTargetRate); - } catch (e: any) { - bumpError = e.message; - } - }; - let bump = async () => { bumpLoading = true; bumpError = ""; try { - const res = await post("/bump", { id, targetFeeRate: bumpTargetRate }); + const res = await post("/bump", { id }); p.childTxid = res.txid; p.bumpedFee = res.childFee; - showBump = false; success("Transaction bumped!"); } catch (e: any) { bumpError = e.message; @@ -278,61 +250,12 @@ {/if} {#if canBump} -
- {#if !showBump} - - {:else} -
-

Speed up transaction

- - {#if bumpEstimate?.fees} -
- - -
- - {#if bumpEstimate.cost !== undefined} -
- Cost: - {bumpEstimate.cost} sats from your {p.bumpReserve} sat reserve -
- {/if} - {/if} - - {#if bumpError} -
{bumpError}
- {/if} - -
- - -
-
+
+ + {#if bumpError} +
{bumpError}
{/if}
{/if} diff --git a/src/routes/(app)/payment/[id]/bump-estimate/+server.ts b/src/routes/(app)/payment/[id]/bump-estimate/+server.ts deleted file mode 100644 index dc5a8642..00000000 --- a/src/routes/(app)/payment/[id]/bump-estimate/+server.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { auth, post } from "$lib/utils"; -import { json, error } from "@sveltejs/kit"; - -export async function POST({ cookies, request }) { - const body = await request.json(); - try { - const res = await post("/bump/estimate", body, auth(cookies)); - return json(res); - } catch (e: any) { - error(400, e.message); - } -} -- cgit v1.2.3