From a2cd238492838c50f9a2049d7b1bfd4dcd02652e Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Mon, 22 May 2023 12:04:34 -0500 Subject: [PATCH] wire up fees for onchain --- src/routes/Send.tsx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/routes/Send.tsx b/src/routes/Send.tsx index 4f759a2..ed56ccb 100644 --- a/src/routes/Send.tsx +++ b/src/routes/Send.tsx @@ -134,11 +134,15 @@ export default function Send() { setFieldDestination(""); } - const fakeFee = createMemo(() => { - if (source() === "lightning") return 69n; - if (source() === "onchain") return 420n; - return 0n; - }) + const feeEstimate = () => { + if (source() === "lightning") return undefined; + + if (source() === "onchain" && amountSats() && amountSats() > 0n && address()) { + return state.mutiny_wallet?.estimate_tx_fee(address()!, amountSats(), undefined); + } + + return undefined + } onMount(() => { if (state.scan_result) { @@ -347,7 +351,7 @@ export default function Send() { - +