diff --git a/packages/bridge-ui-v2/src/components/Bridge/Actions.svelte b/packages/bridge-ui-v2/src/components/Bridge/Actions.svelte
index 4e603fe8d50..97aa45b0057 100644
--- a/packages/bridge-ui-v2/src/components/Bridge/Actions.svelte
+++ b/packages/bridge-ui-v2/src/components/Bridge/Actions.svelte
@@ -49,6 +49,7 @@
//TODO: this should probably be checked somewhere else?
export async function checkTokensApproved() {
+ $validatingAmount = true;
if ($selectedToken?.type === TokenType.ERC721 || $selectedToken?.type === TokenType.ERC1155) {
if ($account?.address && $network?.id && $destNetwork?.id) {
const currentChainId = $network?.id;
@@ -102,6 +103,7 @@
}
}
}
+ $validatingAmount = false;
}
// TODO: feels like we need a state machine here
@@ -119,7 +121,7 @@
? $tokenBalance.value > BigInt(0)
: false // ERC20
: false);
- $: canDoNothing = !hasAddress || !hasNetworks || !hasBalance || !$selectedToken || !$enteredAmount;
+ $: canDoNothing = !hasAddress || !hasNetworks || !hasBalance || !$selectedToken;
// Conditions for approve/bridge steps
$: isSelectedERC20 = $selectedToken && $selectedToken.type === TokenType.ERC20;
@@ -140,7 +142,7 @@
// Conditions to disable/enable buttons
$: disableApprove =
$selectedToken?.type === TokenType.ERC20
- ? canDoNothing || $insufficientBalance || $validatingAmount || approving || isTokenApproved
+ ? canDoNothing || $insufficientBalance || $validatingAmount || approving || isTokenApproved || !$enteredAmount
: $selectedToken?.type === TokenType.ERC721
? allTokensApproved || approving
: $selectedToken?.type === TokenType.ERC1155
@@ -161,10 +163,10 @@
!$validatingAmount &&
!$insufficientBalance;
- $: erc20ConditionsSatisfied = !canDoNothing && !$insufficientAllowance && commonConditions && $tokenBalance;
- $: erc721ConditionsSatisfied =
- allTokensApproved && commonConditions && typeof $tokenBalance === 'bigint' && $tokenBalance && $tokenBalance > 0;
- $: erc1155ConditionsSatisfied = allTokensApproved && commonConditions;
+ $: erc20ConditionsSatisfied =
+ !canDoNothing && !$insufficientAllowance && commonConditions && $tokenBalance && $enteredAmount;
+ $: erc721ConditionsSatisfied = allTokensApproved && commonConditions;
+ $: erc1155ConditionsSatisfied = allTokensApproved && $enteredAmount && $enteredAmount > 0 && commonConditions;
$: ethConditionsSatisfied = commonConditions && $enteredAmount && $enteredAmount > 0;
$: disableBridge = isERC20
@@ -178,7 +180,6 @@
: commonConditions;
-
+tokenBalance {$tokenBalance}
+enteredAmount {#if $enteredAmount}test
+{/if}