From 25aaa8d80ef25895d56e0e9fb55f3115e0b5d6d5 Mon Sep 17 00:00:00 2001 From: sstefdev Date: Thu, 19 Dec 2024 18:38:35 +0100 Subject: [PATCH 1/2] fix: switch network button disabled --- .../src/lib/dashboard/invoice-view.svelte | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/invoice-dashboard/src/lib/dashboard/invoice-view.svelte b/packages/invoice-dashboard/src/lib/dashboard/invoice-view.svelte index 4c2a583f..b6576322 100644 --- a/packages/invoice-dashboard/src/lib/dashboard/invoice-view.svelte +++ b/packages/invoice-dashboard/src/lib/dashboard/invoice-view.svelte @@ -395,6 +395,7 @@ async function approve() { try { loading = true; + isSigningTransaction = true; const approvers: { [key: string]: () => Promise } = { [Types.Extension.PAYMENT_NETWORK_ID.ERC20_FEE_PROXY_CONTRACT]: @@ -429,6 +430,7 @@ console.error("Something went wrong while approving ERC20: ", err); } finally { loading = false; + isSigningTransaction = false; } } @@ -504,7 +506,6 @@ token: paymentCurrencies[0].address as `0x${string}`, chainId: invoiceNetworkId, }); - ; userBalance = balance.formatted; hasEnoughBalance = balance.value >= BigInt(request.expectedAmount); } else { @@ -849,7 +850,9 @@ : "Pay Now"} padding="px-[12px] py-[6px]" onClick={handlePayment} - disabled={!hasEnoughBalance} + disabled={correctChain + ? !hasEnoughBalance && !isSigningTransaction + : false} /> {/if} From 5ba4d668900ec176ef67da1ff68f33d12fe55353 Mon Sep 17 00:00:00 2001 From: sstefdev Date: Fri, 20 Dec 2024 13:31:31 +0100 Subject: [PATCH 2/2] fix: balance warning and button placeholder logic --- .../invoice-dashboard/src/lib/dashboard/invoice-view.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/invoice-dashboard/src/lib/dashboard/invoice-view.svelte b/packages/invoice-dashboard/src/lib/dashboard/invoice-view.svelte index b6576322..1c109163 100644 --- a/packages/invoice-dashboard/src/lib/dashboard/invoice-view.svelte +++ b/packages/invoice-dashboard/src/lib/dashboard/invoice-view.svelte @@ -834,7 +834,7 @@ {/if}
{#if !isPayee && !unsupportedNetwork && !isPaid && !isRequestPayed && !isSigningTransaction} - {#if !hasEnoughBalance} + {#if !hasEnoughBalance && correctChain}
Insufficient funds: {Number(userBalance).toFixed(4)} {paymentCurrencies[0]?.symbol || "-"} @@ -851,7 +851,7 @@ padding="px-[12px] py-[6px]" onClick={handlePayment} disabled={correctChain - ? !hasEnoughBalance && !isSigningTransaction + ? !hasEnoughBalance || isSigningTransaction : false} /> {/if}