diff --git a/packages/bridge-ui/src/components/InsufficientBalanceTooltip.svelte b/packages/bridge-ui/src/components/Transactions/InsufficientBalanceTooltip.svelte
similarity index 87%
rename from packages/bridge-ui/src/components/InsufficientBalanceTooltip.svelte
rename to packages/bridge-ui/src/components/Transactions/InsufficientBalanceTooltip.svelte
index f5a5dc6064b..68415e8460e 100644
--- a/packages/bridge-ui/src/components/InsufficientBalanceTooltip.svelte
+++ b/packages/bridge-ui/src/components/Transactions/InsufficientBalanceTooltip.svelte
@@ -1,5 +1,5 @@
diff --git a/packages/bridge-ui/src/components/MessageStatusTooltip.svelte b/packages/bridge-ui/src/components/Transactions/MessageStatusTooltip.svelte
similarity index 72%
rename from packages/bridge-ui/src/components/MessageStatusTooltip.svelte
rename to packages/bridge-ui/src/components/Transactions/MessageStatusTooltip.svelte
index e98c856b45c..e6a9df8181d 100644
--- a/packages/bridge-ui/src/components/MessageStatusTooltip.svelte
+++ b/packages/bridge-ui/src/components/Transactions/MessageStatusTooltip.svelte
@@ -1,5 +1,6 @@
@@ -12,14 +13,9 @@
Pending: Your asset is not ready to be bridged. Taiko
- A2 => {import.meta.env
- ? import.meta.env.VITE_MAINNET_CHAIN_NAME
- : 'Ethereum A2'} bridging can take several hours before being ready.
- {import.meta.env
- ? import.meta.env.VITE_MAINNET_CHAIN_NAME
- : 'Ethereum A2'} => {import.meta.env
- ? import.meta.env.VITE_TAIKO_CHAIN_NAME
- : 'Taiko A2'} should be available to claim within minutes.
+ A2 => {L2_CHAIN_NAME} bridging can take several hours before being ready.
+ {L1_CHAIN_NAME} => {L2_CHAIN_NAME} should be available to claim within
+ minutes.
Claim: Your asset is ready to be claimed on the
diff --git a/packages/bridge-ui/src/components/Transaction.svelte b/packages/bridge-ui/src/components/Transactions/Transaction.svelte
similarity index 68%
rename from packages/bridge-ui/src/components/Transaction.svelte
rename to packages/bridge-ui/src/components/Transactions/Transaction.svelte
index 749cfc1ab5c..a83ec3d1b06 100644
--- a/packages/bridge-ui/src/components/Transaction.svelte
+++ b/packages/bridge-ui/src/components/Transactions/Transaction.svelte
@@ -1,43 +1,45 @@
+
+
+ {#if $transactions.length}
+
+
+
+
From
+
To
+
Amount
+
Status
+
Details
+
+
+
+ {#each $transactions as transaction}
+ (showMessageStatusTooltip = true)}
+ on:insufficientBalance={() => (showInsufficientBalance = true)}
+ on:relayerAutoClaim={({ detail }) => {
+ // We're passing the claiming of the transaction here, which
+ // will be called after confirming the notice.
+ confirmNotice = detail;
+ showRelayerAutoclaimTooltip = true;
+ }}
+ on:transactionDetailsClick={() => {
+ selectedTransaction = transaction;
+ }}
+ {transaction} />
+ {/each}
+
+
+ When bridging, you selected the Recommended or
+ Custom amount for the Processing Fee. You can wait for the
+ relayer to auto-claim the bridged token or manually claim it now.
+
+
+
diff --git a/packages/bridge-ui/src/components/Transactions/index.ts b/packages/bridge-ui/src/components/Transactions/index.ts
new file mode 100644
index 00000000000..5c914036b27
--- /dev/null
+++ b/packages/bridge-ui/src/components/Transactions/index.ts
@@ -0,0 +1 @@
+export { default } from './Transactions.svelte';
diff --git a/packages/bridge-ui/src/components/buttons/Button.svelte b/packages/bridge-ui/src/components/buttons/Button.svelte
new file mode 100644
index 00000000000..5c994c9d590
--- /dev/null
+++ b/packages/bridge-ui/src/components/buttons/Button.svelte
@@ -0,0 +1,16 @@
+
+
+
+
diff --git a/packages/bridge-ui/src/components/form/BridgeForm.svelte b/packages/bridge-ui/src/components/form/BridgeForm.svelte
index 256ebd02baf..a485da08382 100644
--- a/packages/bridge-ui/src/components/form/BridgeForm.svelte
+++ b/packages/bridge-ui/src/components/form/BridgeForm.svelte
@@ -3,12 +3,11 @@
import { LottiePlayer } from '@lottiefiles/svelte-lottie-player';
import { token } from '../../store/token';
- import { processingFee } from '../../store/fee';
import { fromChain, toChain } from '../../store/chain';
import { activeBridge, bridgeType } from '../../store/bridge';
import { signer } from '../../store/signer';
import { BigNumber, Contract, ethers, Signer } from 'ethers';
- import ProcessingFee from './ProcessingFee.svelte';
+ import ProcessingFee from './ProcessingFee';
import SelectToken from '../buttons/SelectToken.svelte';
import type { Token } from '../../domain/token';
@@ -21,7 +20,6 @@
transactioner,
transactions as transactionsStore,
} from '../../store/transactions';
- import { ProcessingFeeMethod } from '../../domain/fee';
import Memo from './Memo.svelte';
import ERC20_ABI from '../../constants/abi/ERC20';
import TokenVaultABI from '../../constants/abi/TokenVault';
@@ -39,20 +37,22 @@
import { providers } from '../../provider/providers';
import { tokenVaults } from '../../vault/tokenVaults';
import { isOnCorrectChain } from '../../utils/isOnCorrectChain';
+ import { ProcessingFeeMethod } from '../../domain/fee';
+ import Button from '../buttons/Button.svelte';
let amount: string;
let amountInput: HTMLInputElement;
let requiresAllowance: boolean = false;
let btnDisabled: boolean = true;
let tokenBalance: string;
- let customFee: string = '0';
- let recommendedFee: string = '0';
let memo: string = '';
let loading: boolean = false;
let isFaucetModalOpen: boolean = false;
let memoError: string;
let to: string = '';
let showTo: boolean = false;
+ let feeMethod: ProcessingFeeMethod = ProcessingFeeMethod.RECOMMENDED;
+ let feeAmount: string = '0';
// TODO: too much going on here. We need to extract
// logic and unit test the hell out of all this.
@@ -333,10 +333,12 @@
memo: memo,
to: showTo && to ? to : await $signer.getAddress(),
});
+
const requiredGas = gasEstimate.mul(feeData.gasPrice);
const userBalance = await $signer.getBalance('latest');
const processingFee = getProcessingFee();
let balanceAvailableForTx = userBalance.sub(requiredGas);
+
if (processingFee) {
balanceAvailableForTx = balanceAvailableForTx.sub(processingFee);
}
@@ -362,17 +364,11 @@
}
function getProcessingFee() {
- if ($processingFee === ProcessingFeeMethod.NONE) {
+ if (feeMethod === ProcessingFeeMethod.NONE) {
return undefined;
}
- if ($processingFee === ProcessingFeeMethod.CUSTOM) {
- return BigNumber.from(ethers.utils.parseEther(customFee));
- }
-
- if ($processingFee === ProcessingFeeMethod.RECOMMENDED) {
- return BigNumber.from(ethers.utils.parseEther(recommendedFee));
- }
+ return BigNumber.from(ethers.utils.parseEther(feeAmount));
}
$: getUserBalance($signer, $token, $fromChain);
@@ -458,12 +454,12 @@
-
+
{#if loading}
-
{:else if !requiresAllowance}
-
{$_('home.bridge')}
-
+
{:else}
-
{$_('home.approve')}
-
+
{/if}
diff --git a/packages/bridge-ui/src/components/form/ProcessingFee/ProcessingFee.svelte b/packages/bridge-ui/src/components/form/ProcessingFee/ProcessingFee.svelte
new file mode 100644
index 00000000000..3d3dded0985
--- /dev/null
+++ b/packages/bridge-ui/src/components/form/ProcessingFee/ProcessingFee.svelte
@@ -0,0 +1,107 @@
+
+
+
+ Selecting None means that you'll require ETH on the receiving
+ chain in otder to claim the bridged token. Pleas, come back later to manually
+ claim.
+
+ The amount you pay the relayer to process your bridge message on the
+ destination chain.
+
+
+
+ Recommended: The recommended fee is the lowest fee
+ that will get your transaction processed in a reasonable amount of
+ time.
+
+
+ Custom: You can set a custom fee for the relayer to
+ incentivize them to prioritize your request. A lower fee may result in
+ longer processing time.
+
+
+ None: You can select no fee if you want to come back
+ here and claim the bridged asset yourself.
+