diff --git a/packages/bridge-ui-v2/src/components/Bridge/Amount.svelte b/packages/bridge-ui-v2/src/components/Bridge/Amount.svelte index 852970f401a..3f12dd87e9c 100644 --- a/packages/bridge-ui-v2/src/components/Bridge/Amount.svelte +++ b/packages/bridge-ui-v2/src/components/Bridge/Amount.svelte @@ -1,5 +1,4 @@ diff --git a/packages/bridge-ui-v2/src/components/Icon/ERC20.svelte b/packages/bridge-ui-v2/src/components/Icon/ERC20.svelte index 752e06e83ad..959e7f0ab17 100644 --- a/packages/bridge-ui-v2/src/components/Icon/ERC20.svelte +++ b/packages/bridge-ui-v2/src/components/Icon/ERC20.svelte @@ -1,6 +1,7 @@ - export let width = 32; - export let height = 32; + export let size = 32; + export let width = size; + export let height = size; diff --git a/packages/bridge-ui-v2/src/components/TokenDropdown/TokenDropdown.svelte b/packages/bridge-ui-v2/src/components/TokenDropdown/TokenDropdown.svelte index aa80a765cc4..e8892c8fbe8 100644 --- a/packages/bridge-ui-v2/src/components/TokenDropdown/TokenDropdown.svelte +++ b/packages/bridge-ui-v2/src/components/TokenDropdown/TokenDropdown.svelte @@ -110,11 +110,11 @@ {#if symbolToIconMap[value.symbol]} - + {:else} - + {/if} {value.symbol} diff --git a/packages/bridge-ui-v2/src/libs/util/renderBalance.ts b/packages/bridge-ui-v2/src/libs/util/renderBalance.ts new file mode 100644 index 00000000000..deae0261f7a --- /dev/null +++ b/packages/bridge-ui-v2/src/libs/util/renderBalance.ts @@ -0,0 +1,10 @@ +import type { FetchBalanceResult } from '@wagmi/core'; + +import { truncateString } from '$libs/util/truncateString'; + +export function renderBalance(balance: Maybe) { + if (!balance) return '0.00'; + + const maxlength = Number(balance.formatted) < 0.000001 ? balance.decimals : 6; + return `${truncateString(balance.formatted, maxlength, '')} ${balance.symbol}`; +} diff --git a/packages/bridge-ui-v2/src/stores/balance.ts b/packages/bridge-ui-v2/src/stores/balance.ts new file mode 100644 index 00000000000..7aac3f64bec --- /dev/null +++ b/packages/bridge-ui-v2/src/stores/balance.ts @@ -0,0 +1,4 @@ +import type { FetchBalanceResult } from '@wagmi/core'; +import { writable } from 'svelte/store'; + +export const ethBalance = writable>(null);