Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 49d3185
Author: Korbinian <korbiniank@outlook.de>
Date:   Mon Oct 30 13:38:31 2023 +0100

    Squashed commit of the following:

    commit 25156d1
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Mon Oct 30 11:56:44 2023 +0100

        mock wagmi

    commit 4c6218e
    Merge: f597f2f 2f885aa
    Author: Korbinian <KorbinianK@users.noreply.github.com>
    Date:   Mon Oct 30 11:50:55 2023 +0100

        Merge branch 'main' into feat/bridge-ui-v2--amount-for-1155

    commit f597f2f
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Mon Oct 30 11:49:55 2023 +0100

        add unit test

    commit 8b0554a
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Mon Oct 30 11:03:20 2023 +0100

        Squashed commit of the following:

        commit 2f885aa
        Author: Korbinian <KorbinianK@users.noreply.github.com>
        Date:   Mon Oct 30 05:35:16 2023 +0100

            chore(bridge-ui-v2): revert walletconnect tests (#15077)

        commit e622686
        Author: xiaodino <ruby@taiko.xyz>
        Date:   Sun Oct 29 17:39:36 2023 -0700

            chore(bridge-ui-v2): fix switchNetwork argument in Faucet (#15070)

            Co-authored-by: Korbinian <KorbinianK@users.noreply.github.com>

        commit e8f3e67
        Author: Korbinian <KorbinianK@users.noreply.github.com>
        Date:   Sun Oct 29 02:58:28 2023 +0200

            chore(bridge-ui-v2): revert walletconnect upgrade (#15069)

    commit 80311cd
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Mon Oct 30 11:02:50 2023 +0100

        refactor actions token approve, small improvements

    commit 2f885aa
    Author: Korbinian <KorbinianK@users.noreply.github.com>
    Date:   Mon Oct 30 05:35:16 2023 +0100

        chore(bridge-ui-v2): revert walletconnect tests (#15077)

    commit e622686
    Author: xiaodino <ruby@taiko.xyz>
    Date:   Sun Oct 29 17:39:36 2023 -0700

        chore(bridge-ui-v2): fix switchNetwork argument in Faucet (#15070)

        Co-authored-by: Korbinian <KorbinianK@users.noreply.github.com>

    commit f29cb7d
    Author: Korbinian <KorbinianK@users.noreply.github.com>
    Date:   Sun Oct 29 02:58:28 2023 +0200

        chore(bridge-ui-v2): revert walletconnect upgrade (#15069)

    commit e8f3e67
    Author: Korbinian <KorbinianK@users.noreply.github.com>
    Date:   Sun Oct 29 02:58:28 2023 +0200

        chore(bridge-ui-v2): revert walletconnect upgrade (#15069)

    commit 4ebd7e7
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Sat Oct 28 21:13:52 2023 +0200

        fix conditions

    commit 38b6f51
    Merge: dc456b0 c22b1b9
    Author: Korbinian <KorbinianK@users.noreply.github.com>
    Date:   Sat Oct 28 20:58:45 2023 +0200

        Merge branch 'main' into feat/bridge-ui-v2--amount-for-1155

    commit dc456b0
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Sat Oct 28 16:34:13 2023 +0200

        fix padding

    commit b658f1b
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Sat Oct 28 16:33:51 2023 +0200

        add amount to import step, validations

    commit 8cfc8da
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Fri Oct 27 16:36:53 2023 +0200

        cleanup

    commit 6db4be0
    Merge: 72b5e8d 2d52e86
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Fri Oct 27 16:30:43 2023 +0200

        Merge branch 'main' into chore/bridge-ui-v2--nft-review-step-design-pass

    commit 72b5e8d
    Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    Date:   Fri Oct 27 22:15:46 2023 +0800

        chore(deps): bump google.golang.org/grpc from 1.53.0 to 1.56.3 (#15038)

        Signed-off-by: dependabot[bot] <support@github.com>
        Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

    commit 15ade8a
    Author: FINE <101636126+finedao@users.noreply.github.com>
    Date:   Fri Oct 27 01:00:33 2023 +0530

        Update node-troubleshooting.mdx (#15017)

        Co-authored-by: Roger <50648015+RogerLamTd@users.noreply.github.com>

    commit 7ca3532
    Author: Korbinian <KorbinianK@users.noreply.github.com>
    Date:   Thu Oct 26 19:33:51 2023 +0200

        feat(bridge-ui-v2): Import step refinement (#15020)

    commit 241e23a
    Author: Kenk <kenghin_lim@hotmail.com>
    Date:   Thu Oct 26 12:12:55 2023 +0700

        feat(website): add rhino.fi, Hotpot and DotTaiko to ecosystem (#15024)

        Co-authored-by: dave <13951458+d1onys1us@users.noreply.github.com>

    commit 391e06f
    Author: Roger <50648015+RogerLamTd@users.noreply.github.com>
    Date:   Wed Oct 25 21:49:32 2023 -0700

        docs(website): add hint to remove old testnet volumes (#15039)

    commit 13ddffc
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Fri Oct 27 16:17:49 2023 +0200

        merge main

    commit 03ea9ff
    Author: xiaodino <ruby@taiko.xyz>
    Date:   Wed Oct 25 19:14:51 2023 -0700

        feat(bridge-ui-v2): upgrade walletconnect from v2 to v3 (#14999)

    commit f71c7b7
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Fri Oct 27 15:44:11 2023 +0200

        add recipient flow

    commit 16c455d
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Thu Oct 26 12:33:01 2023 +0200

        paddings, explorer links, fix crosschainaddress for 1155

    commit 6eb5987
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Wed Oct 25 17:06:11 2023 +0200

        fix selectedToken store, updated design

    commit 7409a28
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Wed Oct 25 16:17:55 2023 +0200

        fix separator for nft lists

    commit ab7759e
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Wed Oct 25 16:17:38 2023 +0200

        i18n

    commit 00cd52d
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Wed Oct 25 16:17:22 2023 +0200

        dynamic nft display size

    commit 83bd7ca
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Wed Oct 25 16:14:52 2023 +0200

        small recipient and processing fee

    commit c4863b8
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Wed Oct 25 14:51:35 2023 +0200

        cleanup

    commit c0ab921
    Merge: 8a2c54a 02664a7
    Author: Korbinian <KorbinianK@users.noreply.github.com>
    Date:   Wed Oct 25 14:53:34 2023 +0200

        Merge branch 'main' into chore/brige-ui-v2--nft-import-design-pass

    commit 8a2c54a
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Wed Oct 25 14:46:36 2023 +0200

        fix selection for listitem

    commit b7bd97e
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Wed Oct 25 12:23:02 2023 +0200

        moved nft components to folder,  fixed selection issues

    commit 4b4339e
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Tue Oct 24 15:24:07 2023 +0200

        moved selectedNFTs to store for state sync

    commit 68517f0
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Tue Oct 24 14:52:07 2023 +0200

        nft card grid view and selection

    commit 61b194f
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Tue Oct 24 14:51:27 2023 +0200

        update icons

    commit ad16ed8
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Tue Oct 24 12:15:05 2023 +0200

        update design and some refactoring

commit 305d9bc
Author: Korbinian <korbiniank@outlook.de>
Date:   Mon Oct 30 12:55:47 2023 +0100

    Squashed commit of the following:

    commit 3dbbafb
    Author: oktay Aslan <43525005+flechemano@users.noreply.github.com>
    Date:   Mon Oct 30 14:33:35 2023 +0300

        feat(website): update `prover-market-page.mdx` (#15063)

    commit aeaeb27
    Author: amis13 <119992979+amis13@users.noreply.github.com>
    Date:   Mon Oct 30 12:29:52 2023 +0100

        Update prover-market-page.mdx (#15068)

    commit 2f885aa
    Author: Korbinian <KorbinianK@users.noreply.github.com>
    Date:   Mon Oct 30 05:35:16 2023 +0100

        chore(bridge-ui-v2): revert walletconnect tests (#15077)

    commit e622686
    Author: xiaodino <ruby@taiko.xyz>
    Date:   Sun Oct 29 17:39:36 2023 -0700

        chore(bridge-ui-v2): fix switchNetwork argument in Faucet (#15070)

        Co-authored-by: Korbinian <KorbinianK@users.noreply.github.com>

    commit e8f3e67
    Author: Korbinian <KorbinianK@users.noreply.github.com>
    Date:   Sun Oct 29 02:58:28 2023 +0200

        chore(bridge-ui-v2): revert walletconnect upgrade (#15069)

commit b82bf8f
Author: Korbinian <korbiniank@outlook.de>
Date:   Sun Oct 29 13:33:40 2023 +0100

    pending status fixed, cleanup

commit 23af720
Author: Korbinian <KorbinianK@users.noreply.github.com>
Date:   Sun Oct 29 02:58:28 2023 +0200

    chore(bridge-ui-v2): revert walletconnect upgrade (#15069)

commit 371b8a7
Author: Korbinian <korbiniank@outlook.de>
Date:   Sun Oct 29 00:24:36 2023 +0200

    initial confirmation step, move bridge and approve logic

commit d7d96f0
Author: Korbinian <korbiniank@outlook.de>
Date:   Sat Oct 28 21:15:53 2023 +0200

    Squashed commit of the following:

    commit 4ebd7e7
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Sat Oct 28 21:13:52 2023 +0200

        fix conditions

    commit 38b6f51
    Merge: dc456b0 c22b1b9
    Author: Korbinian <KorbinianK@users.noreply.github.com>
    Date:   Sat Oct 28 20:58:45 2023 +0200

        Merge branch 'main' into feat/bridge-ui-v2--amount-for-1155

    commit dc456b0
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Sat Oct 28 16:34:13 2023 +0200

        fix padding

    commit b658f1b
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Sat Oct 28 16:33:51 2023 +0200

        add amount to import step, validations

    commit 8cfc8da
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Fri Oct 27 16:36:53 2023 +0200

        cleanup

    commit 6db4be0
    Merge: 72b5e8d 2d52e86
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Fri Oct 27 16:30:43 2023 +0200

        Merge branch 'main' into chore/bridge-ui-v2--nft-review-step-design-pass

    commit 72b5e8d
    Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    Date:   Fri Oct 27 22:15:46 2023 +0800

        chore(deps): bump google.golang.org/grpc from 1.53.0 to 1.56.3 (#15038)

        Signed-off-by: dependabot[bot] <support@github.com>
        Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

    commit 15ade8a
    Author: FINE <101636126+finedao@users.noreply.github.com>
    Date:   Fri Oct 27 01:00:33 2023 +0530

        Update node-troubleshooting.mdx (#15017)

        Co-authored-by: Roger <50648015+RogerLamTd@users.noreply.github.com>

    commit 7ca3532
    Author: Korbinian <KorbinianK@users.noreply.github.com>
    Date:   Thu Oct 26 19:33:51 2023 +0200

        feat(bridge-ui-v2): Import step refinement (#15020)

    commit 241e23a
    Author: Kenk <kenghin_lim@hotmail.com>
    Date:   Thu Oct 26 12:12:55 2023 +0700

        feat(website): add rhino.fi, Hotpot and DotTaiko to ecosystem (#15024)

        Co-authored-by: dave <13951458+d1onys1us@users.noreply.github.com>

    commit 391e06f
    Author: Roger <50648015+RogerLamTd@users.noreply.github.com>
    Date:   Wed Oct 25 21:49:32 2023 -0700

        docs(website): add hint to remove old testnet volumes (#15039)

    commit 13ddffc
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Fri Oct 27 16:17:49 2023 +0200

        merge main

    commit 03ea9ff
    Author: xiaodino <ruby@taiko.xyz>
    Date:   Wed Oct 25 19:14:51 2023 -0700

        feat(bridge-ui-v2): upgrade walletconnect from v2 to v3 (#14999)

    commit f71c7b7
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Fri Oct 27 15:44:11 2023 +0200

        add recipient flow

    commit 16c455d
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Thu Oct 26 12:33:01 2023 +0200

        paddings, explorer links, fix crosschainaddress for 1155

    commit 6eb5987
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Wed Oct 25 17:06:11 2023 +0200

        fix selectedToken store, updated design

    commit 7409a28
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Wed Oct 25 16:17:55 2023 +0200

        fix separator for nft lists

    commit ab7759e
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Wed Oct 25 16:17:38 2023 +0200

        i18n

    commit 00cd52d
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Wed Oct 25 16:17:22 2023 +0200

        dynamic nft display size

    commit 83bd7ca
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Wed Oct 25 16:14:52 2023 +0200

        small recipient and processing fee

    commit c4863b8
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Wed Oct 25 14:51:35 2023 +0200

        cleanup

    commit c0ab921
    Merge: 8a2c54a 02664a7
    Author: Korbinian <KorbinianK@users.noreply.github.com>
    Date:   Wed Oct 25 14:53:34 2023 +0200

        Merge branch 'main' into chore/brige-ui-v2--nft-import-design-pass

    commit 8a2c54a
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Wed Oct 25 14:46:36 2023 +0200

        fix selection for listitem

    commit b7bd97e
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Wed Oct 25 12:23:02 2023 +0200

        moved nft components to folder,  fixed selection issues

    commit 4b4339e
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Tue Oct 24 15:24:07 2023 +0200

        moved selectedNFTs to store for state sync

    commit 68517f0
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Tue Oct 24 14:52:07 2023 +0200

        nft card grid view and selection

    commit 61b194f
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Tue Oct 24 14:51:27 2023 +0200

        update icons

    commit ad16ed8
    Author: Korbinian <korbiniank@outlook.de>
    Date:   Tue Oct 24 12:15:05 2023 +0200

        update design and some refactoring
  • Loading branch information
KorbinianK committed Oct 30, 2023
1 parent 3dbbafb commit 3ddb108
Show file tree
Hide file tree
Showing 23 changed files with 806 additions and 343 deletions.
204 changes: 143 additions & 61 deletions packages/bridge-ui-v2/src/components/Bridge/Actions.svelte
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<script lang="ts">
import { t } from 'svelte-i18n';
import { routingContractsMap } from '$bridgeConfig';
import { Button } from '$components/Button';
import { Icon } from '$components/Icon';
import { bridges } from '$libs/bridge';
import { bridges, ContractType, type RequireApprovalArgs } from '$libs/bridge';
import type { ERC721Bridge } from '$libs/bridge/ERC721Bridge';
import type { ERC1155Bridge } from '$libs/bridge/ERC1155Bridge';
import { getContractAddressByType } from '$libs/bridge/getContractAddressByType';
import { type NFT, TokenType } from '$libs/token';
import { checkOwnershipOfNFT } from '$libs/token/checkOwnership';
import { getConnectedWallet } from '$libs/util/getConnectedWallet';
Expand All @@ -28,10 +28,12 @@
export let approve: () => Promise<void>;
export let bridge: () => Promise<void>;
let approving = false;
let bridging = false;
export let oldStyle = true; //TODO: remove this
let allTokensApproved = false;
export let approving = false;
export let bridging = false;
export let allTokensApproved = false;
function onApproveClick() {
approving = true;
Expand All @@ -42,13 +44,12 @@
function onBridgeClick() {
bridging = true;
bridge().finally(() => {
bridging = false;
});
bridge();
}
//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;
Expand All @@ -62,20 +63,32 @@
}
const wallet = await getConnectedWallet();
const { erc1155VaultAddress, erc721VaultAddress } = routingContractsMap[currentChainId][destinationChainId];
const spenderAddress = getContractAddressByType({
srcChainId: currentChainId,
destChainId: destinationChainId,
tokenType: token.type,
contractType: ContractType.VAULT,
});
if (!spenderAddress) {
throw new Error('No spender address found');
}
const args: RequireApprovalArgs = {
tokenAddress: token.addresses[currentChainId],
owner: wallet.account.address,
spenderAddress,
tokenId: BigInt(token.tokenId),
chainId: currentChainId,
};
if (token.type === TokenType.ERC1155) {
try {
const bridge = bridges[token.type] as ERC1155Bridge;
// Let's check if the vault is approved for all ERC1155
const result = await bridge.isApprovedForAll({
tokenAddress: token.addresses[currentChainId],
owner: wallet.account.address,
spenderAddress: erc1155VaultAddress,
tokenId: BigInt(token.tokenId),
chainId: currentChainId,
});
const result = await bridge.isApprovedForAll(args);
allTokensApproved = result;
} catch (error) {
console.error('isApprovedForAll error');
Expand All @@ -85,27 +98,24 @@
// Let's check if the vault is approved for all ERC721
try {
const requiresApproval = await bridge.requiresApproval({
tokenAddress: token.addresses[currentChainId],
owner: wallet.account.address,
spenderAddress: erc721VaultAddress,
tokenId: BigInt(token.tokenId),
chainId: currentChainId,
});
const requiresApproval = await bridge.requiresApproval(args);
allTokensApproved = !requiresApproval;
} catch (error) {
console.error('isApprovedForAll error');
}
}
}
}
$validatingAmount = false;
}
// TODO: feels like we need a state machine here
// Basic conditions so we can even start the bridging process
$: hasAddress = $recipientAddress || $account?.address;
$: hasNetworks = $network?.id && $destNetwork?.id;
$: hasBalance =
!$insufficientBalance &&
!$computingBalance &&
!$errorComputingBalance &&
($tokenBalance
Expand All @@ -115,7 +125,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;
Expand All @@ -136,54 +146,126 @@
// 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
? allTokensApproved || approving
: approving;
$: disableBridge =
$selectedToken?.type === TokenType.ERC20
? canDoNothing || $insufficientAllowance || $insufficientBalance || $validatingAmount || bridging
: $selectedToken?.type === TokenType.ERC721
? !allTokensApproved
: $selectedToken?.type === TokenType.ERC1155
? !allTokensApproved
: bridging || !hasAddress || !hasNetworks || !hasBalance || !$selectedToken || !$enteredAmount;
$: isERC20 = $selectedToken?.type === TokenType.ERC20;
$: isERC721 = $selectedToken?.type === TokenType.ERC721;
$: isERC1155 = $selectedToken?.type === TokenType.ERC1155;
$: isETH = $selectedToken?.type === TokenType.ETH;
$: commonConditions =
!bridging &&
hasAddress &&
hasNetworks &&
hasBalance &&
$selectedToken &&
!$validatingAmount &&
!$insufficientBalance;
$: erc20ConditionsSatisfied =
!canDoNothing && !$insufficientAllowance && commonConditions && $tokenBalance && $enteredAmount;
$: erc721ConditionsSatisfied = allTokensApproved && commonConditions;
$: erc1155ConditionsSatisfied = allTokensApproved && $enteredAmount && $enteredAmount > 0 && commonConditions;
$: ethConditionsSatisfied = commonConditions && $enteredAmount && $enteredAmount > 0;
$: disableBridge = isERC20
? !erc20ConditionsSatisfied
: isERC721
? !erc721ConditionsSatisfied
: isERC1155
? !erc1155ConditionsSatisfied
: isETH
? !ethConditionsSatisfied
: commonConditions;
</script>

<div class="f-between-center w-full gap-4">
{#if $selectedToken && $selectedToken.type !== TokenType.ETH}
<!-- bridging {bridging}<br />
balance {hasBalance}<br />
validating {$validatingAmount}<br />
insufficientAllowance {$insufficientAllowance}<br /><br />
canDoNothing {canDoNothing} <br />
$insufficientAllowance {insufficientAllowance} <br />
commonConditions {commonConditions}
enteredAmount {$enteredAmount}<br />
tokenBalance {$tokenBalance}<br />
enteredAmount {#if $enteredAmount}test
{/if}<br /> -->

{#if oldStyle}
<!-- TODO: temporary enable two styles, remove for UI v2.1 -->

<div class="f-between-center w-full gap-4">
{#if $selectedToken && $selectedToken.type !== TokenType.ETH}
<Button
type="primary"
class="px-[28px] py-[14px] rounded-full flex-1"
disabled={disableApprove}
loading={approving}
on:click={onApproveClick}>
{#if approving}
<span class="body-bold">{$t('bridge.button.approving')}</span>
{:else if isTokenApproved}
<div class="f-items-center">
<Icon type="check" />
<span class="body-bold">{$t('bridge.button.approved')}</span>
</div>
{:else}
<span class="body-bold">{$t('bridge.button.approve')}</span>
{/if}
</Button>
<Icon type="arrow-right" />
{/if}
<Button
type="primary"
class="px-[28px] py-[14px] rounded-full flex-1"
disabled={disableApprove}
loading={approving}
on:click={onApproveClick}>
{#if approving}
<span class="body-bold">{$t('bridge.button.approving')}</span>
{:else if isTokenApproved}
<div class="f-items-center">
<Icon type="check" />
<span class="body-bold">{$t('bridge.button.approved')}</span>
</div>
class="px-[28px] py-[14px] rounded-full flex-1 text-white"
disabled={disableBridge}
loading={bridging}
on:click={onBridgeClick}>
{#if bridging}
<span class="body-bold">{$t('bridge.button.bridging')}</span>
{:else}
<span class="body-bold">{$t('bridge.button.approve')}</span>
<span class="body-bold">{$t('bridge.button.bridge')}</span>
{/if}
</Button>
<Icon type="arrow-right" />
{/if}
<Button
type="primary"
class="px-[28px] py-[14px] rounded-full flex-1 text-white"
disabled={disableBridge}
loading={bridging}
on:click={onBridgeClick}>
{#if bridging}
<span class="body-bold">{$t('bridge.button.bridging')}</span>
{:else}
<span class="body-bold">{$t('bridge.button.bridge')}</span>
</div>
{:else}
<div class="f-col w-full gap-4">
{#if $selectedToken && $selectedToken.type !== TokenType.ETH}
<Button
type="primary"
class="px-[28px] py-[14px] rounded-full flex-1"
disabled={disableApprove}
loading={approving}
on:click={onApproveClick}>
{#if approving}
<span class="body-bold">{$t('bridge.button.approving')}</span>
{:else if isTokenApproved}
<div class="f-items-center">
<Icon type="check" />
<span class="body-bold">{$t('bridge.button.approved')}</span>
</div>
{:else}
<span class="body-bold">{$t('bridge.button.approve')}</span>
{/if}
</Button>
{/if}
</Button>
</div>
<Button
type="primary"
class="px-[28px] py-[14px] rounded-full flex-1 text-white"
disabled={disableBridge}
loading={bridging}
on:click={onBridgeClick}>
{#if bridging}
<span class="body-bold">{$t('bridge.button.bridging')}</span>
{:else}
<span class="body-bold">{$t('bridge.button.bridge')}</span>
{/if}
</Button>
</div>
{/if}
Loading

0 comments on commit 3ddb108

Please sign in to comment.