diff --git a/packages/bridge-ui-v2/src/app.config.ts b/packages/bridge-ui-v2/src/app.config.ts index 5584560c844..0c49606a95c 100644 --- a/packages/bridge-ui-v2/src/app.config.ts +++ b/packages/bridge-ui-v2/src/app.config.ts @@ -8,3 +8,8 @@ export const processingFeeComponent = { closingDelayOptionClick: 300, intervalComputeRecommendedFee: 20000, }; + +export const bridge = { + noOwnerGasLimit: BigInt(140000), + noTokenDeployedGasLimit: BigInt(3000000), +}; diff --git a/packages/bridge-ui-v2/src/components/Bridge/Amount/Amount.svelte b/packages/bridge-ui-v2/src/components/Bridge/Amount/Amount.svelte new file mode 100644 index 00000000000..9775ac28559 --- /dev/null +++ b/packages/bridge-ui-v2/src/components/Bridge/Amount/Amount.svelte @@ -0,0 +1,180 @@ + + +
+
+ + +
+ +
+ + + +
+ + {#if insufficientBalance} + +
+ +
+ {$t('amount_input.error.insufficient_balance')} +
+
+ {/if} + + {#if insufficientAllowance} +
+ +
+ {$t('amount_input.error.insufficient_allowance')} +
+
+ {/if} +
diff --git a/packages/bridge-ui-v2/src/components/Bridge/AmountInput/Balance.svelte b/packages/bridge-ui-v2/src/components/Bridge/Amount/Balance.svelte similarity index 84% rename from packages/bridge-ui-v2/src/components/Bridge/AmountInput/Balance.svelte rename to packages/bridge-ui-v2/src/components/Bridge/Amount/Balance.svelte index 18000188fa6..ca4c24ccce4 100644 --- a/packages/bridge-ui-v2/src/components/Bridge/AmountInput/Balance.svelte +++ b/packages/bridge-ui-v2/src/components/Bridge/Amount/Balance.svelte @@ -10,25 +10,26 @@ import { destNetwork, selectedToken } from '../state'; - let tokenBalance: Maybe; + export let value: Maybe; + let computingTokenBalance = false; let errorComputingTokenBalance = false; async function updateTokenBalance(token: Maybe, account?: Account, srcChainId?: number, destChainId?: number) { - if (!token || !account || !account.address) return; + if (!token || !srcChainId || !account?.address) return; computingTokenBalance = true; errorComputingTokenBalance = false; try { - tokenBalance = await getTokenBalance({ + value = await getTokenBalance({ token, + srcChainId, destChainId, userAddress: account.address, - chainId: srcChainId, }); - } catch (error) { - console.error(error); + } catch (err) { + console.error(err); errorComputingTokenBalance = true; } finally { computingTokenBalance = false; @@ -50,7 +51,7 @@ {:else} - {renderTokenBalance(tokenBalance)} + {renderTokenBalance(value)} {/if} diff --git a/packages/bridge-ui-v2/src/components/Bridge/Amount/index.ts b/packages/bridge-ui-v2/src/components/Bridge/Amount/index.ts new file mode 100644 index 00000000000..e8c536613eb --- /dev/null +++ b/packages/bridge-ui-v2/src/components/Bridge/Amount/index.ts @@ -0,0 +1 @@ +export { default as Amount } from './Amount.svelte'; diff --git a/packages/bridge-ui-v2/src/components/Bridge/AmountInput/AmountInput.svelte b/packages/bridge-ui-v2/src/components/Bridge/AmountInput/AmountInput.svelte deleted file mode 100644 index d2cd50a02cc..00000000000 --- a/packages/bridge-ui-v2/src/components/Bridge/AmountInput/AmountInput.svelte +++ /dev/null @@ -1,26 +0,0 @@ - - -
-
- - -
-
- - -
-
diff --git a/packages/bridge-ui-v2/src/components/Bridge/AmountInput/index.ts b/packages/bridge-ui-v2/src/components/Bridge/AmountInput/index.ts deleted file mode 100644 index ff5cf90c7ce..00000000000 --- a/packages/bridge-ui-v2/src/components/Bridge/AmountInput/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default as AmountInput } from './AmountInput.svelte'; diff --git a/packages/bridge-ui-v2/src/components/Bridge/Bridge.svelte b/packages/bridge-ui-v2/src/components/Bridge/Bridge.svelte index 770e2c091a4..86a1baa5d1a 100644 --- a/packages/bridge-ui-v2/src/components/Bridge/Bridge.svelte +++ b/packages/bridge-ui-v2/src/components/Bridge/Bridge.svelte @@ -12,9 +12,9 @@ import type { Account } from '$stores/account'; import { type Network, network } from '$stores/network'; - import { AmountInput } from './AmountInput'; + import { Amount } from './Amount'; import { ProcessingFee } from './ProcessingFee'; - import { RecipientInput } from './RecipientInput'; + import { Recipient } from './Recipient'; import { destNetwork, selectedToken } from './state'; import SwitchChainsButton from './SwitchChainsButton.svelte'; @@ -45,7 +45,7 @@ - +
@@ -53,7 +53,7 @@
- +
@@ -61,7 +61,7 @@
-
diff --git a/packages/bridge-ui-v2/src/components/Bridge/ProcessingFee/NoneOption.svelte b/packages/bridge-ui-v2/src/components/Bridge/ProcessingFee/NoneOption.svelte index fb5dbd614f8..d9034180e4a 100644 --- a/packages/bridge-ui-v2/src/components/Bridge/ProcessingFee/NoneOption.svelte +++ b/packages/bridge-ui-v2/src/components/Bridge/ProcessingFee/NoneOption.svelte @@ -1,5 +1,5 @@ diff --git a/packages/bridge-ui-v2/src/components/Bridge/state.ts b/packages/bridge-ui-v2/src/components/Bridge/state.ts index 834e1045738..63435098002 100644 --- a/packages/bridge-ui-v2/src/components/Bridge/state.ts +++ b/packages/bridge-ui-v2/src/components/Bridge/state.ts @@ -12,6 +12,7 @@ import type { Token } from '$libs/token'; // but once again, we don't need such level of security that we have to // prevent other components outside the Bridge from accessing this store. -export const selectedToken = writable>(); -export const destNetwork = writable>(); -export const processingFee = writable(); +export const selectedToken = writable>(null); +export const enteredAmount = writable(BigInt(0)); +export const destNetwork = writable>(null); +export const processingFee = writable(BigInt(0)); diff --git a/packages/bridge-ui-v2/src/components/Button/Button.svelte b/packages/bridge-ui-v2/src/components/Button/Button.svelte index 0bcab9c66ff..b93c011bb4e 100644 --- a/packages/bridge-ui-v2/src/components/Button/Button.svelte +++ b/packages/bridge-ui-v2/src/components/Button/Button.svelte @@ -45,7 +45,7 @@ }; $: classes = classNames( - 'btn w-full h-auto min-h-fit border-0', + 'btn h-auto min-h-fit border-0', type === 'primary' ? 'body-bold' : 'body-regular', diff --git a/packages/bridge-ui-v2/src/components/ChainSelector/ChainSelector.svelte b/packages/bridge-ui-v2/src/components/ChainSelector/ChainSelector.svelte index a95f2fcb20f..ae34f6184bd 100644 --- a/packages/bridge-ui-v2/src/components/ChainSelector/ChainSelector.svelte +++ b/packages/bridge-ui-v2/src/components/ChainSelector/ChainSelector.svelte @@ -56,10 +56,10 @@ try { await switchNetwork({ chainId: chain.id }); closeModal(); - } catch (error) { - console.error(error); + } catch (err) { + console.error(err); - if (error instanceof UserRejectedRequestError) { + if (err instanceof UserRejectedRequestError) { warningToast($t('messages.network.rejected')); } } finally { diff --git a/packages/bridge-ui-v2/src/components/ClickMask/ClickMask.svelte b/packages/bridge-ui-v2/src/components/ClickMask/ClickMask.svelte new file mode 100644 index 00000000000..1ca5de0b2b9 --- /dev/null +++ b/packages/bridge-ui-v2/src/components/ClickMask/ClickMask.svelte @@ -0,0 +1,21 @@ + + +
diff --git a/packages/bridge-ui-v2/src/components/ClickMask/index.ts b/packages/bridge-ui-v2/src/components/ClickMask/index.ts new file mode 100644 index 00000000000..cee59e6af90 --- /dev/null +++ b/packages/bridge-ui-v2/src/components/ClickMask/index.ts @@ -0,0 +1 @@ +export { default as ClickMask } from './ClickMask.svelte'; diff --git a/packages/bridge-ui-v2/src/components/Faucet/Faucet.svelte b/packages/bridge-ui-v2/src/components/Faucet/Faucet.svelte index c1348c80eb3..95216792d9d 100644 --- a/packages/bridge-ui-v2/src/components/Faucet/Faucet.svelte +++ b/packages/bridge-ui-v2/src/components/Faucet/Faucet.svelte @@ -1,5 +1,5 @@ - + diff --git a/packages/bridge-ui-v2/src/components/NotificationToast/ItemToast.svelte b/packages/bridge-ui-v2/src/components/NotificationToast/ItemToast.svelte index 3b2659a8efa..582f88f9559 100644 --- a/packages/bridge-ui-v2/src/components/NotificationToast/ItemToast.svelte +++ b/packages/bridge-ui-v2/src/components/NotificationToast/ItemToast.svelte @@ -59,7 +59,7 @@