diff --git a/packages/bridge-ui-v2/src/app.config.ts b/packages/bridge-ui-v2/src/app.config.ts index 6f833e2df8..7af1819cea 100644 --- a/packages/bridge-ui-v2/src/app.config.ts +++ b/packages/bridge-ui-v2/src/app.config.ts @@ -2,9 +2,9 @@ export const recommentProcessingFee = { ethGasLimit: BigInt(900_000), erc20NotDeployedGasLimit: BigInt(3_100_000), erc20DeployedGasLimit: BigInt(1_100_000), - erc721NotDeployedGasLimit: BigInt(3_400_000), + erc721NotDeployedGasLimit: BigInt(2_400_000), erc721DeployedGasLimit: BigInt(1_100_000), - erc1155NotDeployedGasLimit: BigInt(4_000_000), + erc1155NotDeployedGasLimit: BigInt(2_600_000), erc1155DeployedGasLimit: BigInt(1_100_000), }; @@ -15,9 +15,14 @@ export const processingFeeComponent = { export const bridgeService = { noOwnerGasLimit: BigInt(140_000), - noTokenDeployedGasLimit: BigInt(3_000_000), + noERC20TokenDeployedGasLimit: BigInt(3_000_000), erc20GasLimitThreshold: BigInt(2_500_000), - unpredictableGasLimit: BigInt(1_000_000), + + noERC721TokenDeployedGasLimit: BigInt(2_400_000), + erc721GasLimitThreshold: BigInt(3_000_000), + + noERC1155TokenDeployedGasLimit: BigInt(2_600_000), + erc1155GasLimitThreshold: BigInt(3_000_000), }; export const pendingTransaction = { diff --git a/packages/bridge-ui-v2/src/components/Bridge/Actions.svelte b/packages/bridge-ui-v2/src/components/Bridge/Actions.svelte index 3b286a8659..548b555d7a 100644 --- a/packages/bridge-ui-v2/src/components/Bridge/Actions.svelte +++ b/packages/bridge-ui-v2/src/components/Bridge/Actions.svelte @@ -3,7 +3,7 @@ import { Button } from '$components/Button'; import { Icon } from '$components/Icon'; - import { TokenType } from '$libs/token'; + import { type NFT, TokenType } from '$libs/token'; import { account, network } from '$stores'; import { @@ -13,6 +13,7 @@ errorComputingBalance, insufficientAllowance, insufficientBalance, + notApproved, recipientAddress, selectedToken, tokenBalance, @@ -50,18 +51,40 @@ // Conditions for approve/bridge steps $: isSelectedERC20 = $selectedToken && $selectedToken.type === TokenType.ERC20; - $: isTokenApproved = isSelectedERC20 && $enteredAmount && !$insufficientAllowance && !$validatingAmount; + + $: isTokenApproved = + $selectedToken?.type === TokenType.ERC20 + ? isSelectedERC20 && $enteredAmount && !$insufficientAllowance && !$validatingAmount + : $selectedToken?.type === TokenType.ERC721 || $selectedToken?.type === TokenType.ERC1155 + ? allTokensApproved + : false; + + // Check if all NFTs are approved + $: allTokensApproved = + $selectedToken?.type === TokenType.ERC721 || $selectedToken?.type === TokenType.ERC1155 + ? $notApproved.get(($selectedToken as NFT).tokenId) + : false; // Conditions to disable/enable buttons - $: disableApprove = canDoNothing || !$insufficientAllowance || $validatingAmount || approving; - $: disableBridge = canDoNothing || $insufficientAllowance || $insufficientBalance || $validatingAmount || bridging; + $: disableApprove = + $selectedToken?.type === TokenType.ERC20 + ? canDoNothing || $insufficientBalance || $validatingAmount || approving || isTokenApproved + : $selectedToken?.type === TokenType.ERC721 + ? allTokensApproved || approving + : $selectedToken?.type === TokenType.ERC1155 + ? allTokensApproved || approving + : approving; - // General loading state - // $: loading = approving || bridging; + $: disableBridge = + $selectedToken?.type === TokenType.ERC20 + ? canDoNothing || $insufficientAllowance || $insufficientBalance || $validatingAmount || bridging + : $selectedToken?.type === TokenType.ERC721 || $selectedToken?.type === TokenType.ERC1155 + ? !allTokensApproved + : bridging || !hasAddress || !hasNetworks || !hasBalance || !$selectedToken || !$enteredAmount;
- {#if isSelectedERC20} + {#if $selectedToken && $selectedToken.type !== TokenType.ETH} - {:else} - - {/if} +
- +
{#if scanned}

{$t('bridge.nft.step.import.scan_screen.title')}

@@ -622,7 +859,6 @@
{$t('common.destination')}
-
{$t('common.contract_address')}
@@ -656,6 +892,7 @@
+
-
- - {#if nftView === NFTView.LIST} - - {:else if nftView === NFTView.CARDS} -
- {#each selectedNFT as nft} - - {/each} + +
+
+
+ {$t('bridge.nft.step.review.your_tokens')} + +
+
+ + + +
- {/if} + {#if nftView === NFTView.LIST} + + {:else if nftView === NFTView.CARDS} +
+ {#each selectedNFT as nft} + + {/each} +
+ {/if} +
{:else if activeStep === NFTSteps.CONFIRM}
{/if} -