From a688af16e1c16e2f00f4d9a1e6baf05a87588877 Mon Sep 17 00:00:00 2001 From: Daniel Fugere Date: Fri, 13 Oct 2023 18:49:30 -0700 Subject: [PATCH 1/2] fix: fixed send button url on home page (#173) closes issue #172 --- src/pages/dashboard/row.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/dashboard/row.svelte b/src/pages/dashboard/row.svelte index 651f0afb..dabd8d96 100644 --- a/src/pages/dashboard/row.svelte +++ b/src/pages/dashboard/row.svelte @@ -26,7 +26,7 @@ const url = derived(token, ($token) => { if ($token) { - return `/transfer/${String($token.contract).toLowerCase()}/${String( + return `/send/${String($token.contract).toLowerCase()}/${String( $token.name ).toLowerCase()}` } From 0dc20a7520652ad1815b702564a6dd7d68bf3cb1 Mon Sep 17 00:00:00 2001 From: Daniel Fugere Date: Mon, 16 Oct 2023 15:07:20 -0700 Subject: [PATCH 2/2] fix: only displaying tokens with balance on send/receive page (#176) --- .../elements/input/token/selector.svelte | 21 ++++++++++++++++++- src/pages/transfer/form.svelte | 2 ++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/components/elements/input/token/selector.svelte b/src/components/elements/input/token/selector.svelte index 2380c5f3..4f9c9cc7 100644 --- a/src/components/elements/input/token/selector.svelte +++ b/src/components/elements/input/token/selector.svelte @@ -4,6 +4,7 @@ import {activeBlockchain} from '~/store' import type {Token} from '~/stores/tokens' import {tokens} from '~/stores/tokens' + import {balances} from '~/stores/balances' import Form from '~/components/elements/form.svelte' import Input from '~/components/elements/input.svelte' @@ -16,6 +17,13 @@ export let selectedToken: Token | undefined = undefined export let tokenOptions: Token[] | undefined = undefined export let onTokenSelect: (token: Token) => void + export let showTokensWithoutBalance: boolean = false + + $: { + if (defaultToken) { + selectedToken = defaultToken + } + } let displayModal = writable(false) let query: string = '' @@ -42,11 +50,22 @@ ($tokens && $tokens.filter((token) => { const blockchainMatches = token.chainId.equals($activeBlockchain.chainId) + let balanceExists + if (!showTokensWithoutBalance) { + balanceExists = !!( + token.balance || + $balances.find((balance) => balance.tokenKey === token.key) + ) + } const queryExists = query.length === 0 const queryMatches = String(token.name) .toLowerCase() .includes(query.toLowerCase()) - return blockchainMatches && (queryExists || queryMatches) + return ( + blockchainMatches && + (queryExists || queryMatches) && + (showTokensWithoutBalance || balanceExists) + ) })) || [] } diff --git a/src/pages/transfer/form.svelte b/src/pages/transfer/form.svelte index cf8a9b78..48f2b9c8 100644 --- a/src/pages/transfer/form.svelte +++ b/src/pages/transfer/form.svelte @@ -234,6 +234,7 @@ onTokenSelect={handleFromChange} selectedToken={from} tokenOptions={fromOptions} + showTokensWithoutBalance /> @@ -257,6 +258,7 @@ onTokenSelect={handleToChange} selectedToken={to} tokenOptions={toOptions} + showTokensWithoutBalance /> {#if receivedAmount && receivedAmount.value > 0 && feeAmount && feeAmount.value > 0}