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}
-
- {#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}
-
diff --git a/packages/bridge-ui-v2/src/components/Bridge/IDInput/state.ts b/packages/bridge-ui-v2/src/components/Bridge/IDInput/state.ts
new file mode 100644
index 0000000000..175037ca78
--- /dev/null
+++ b/packages/bridge-ui-v2/src/components/Bridge/IDInput/state.ts
@@ -0,0 +1,7 @@
+export enum IDInputState {
+ DEFAULT,
+ VALID,
+ INVALID,
+ VALIDATING,
+ LIMIT_REACHED,
+}
diff --git a/packages/bridge-ui-v2/src/components/Bridge/state.ts b/packages/bridge-ui-v2/src/components/Bridge/state.ts
index 7b9c406ee7..0a3df3e0b4 100644
--- a/packages/bridge-ui-v2/src/components/Bridge/state.ts
+++ b/packages/bridge-ui-v2/src/components/Bridge/state.ts
@@ -3,7 +3,7 @@ import { derived, writable } from 'svelte/store';
import { bridges } from '$libs/bridge';
import { chains } from '$libs/chain';
-import type { Token } from '$libs/token';
+import type { NFT, Token } from '$libs/token';
import { type BridgeType, BridgeTypes } from './types';
@@ -17,7 +17,7 @@ import { type BridgeType, BridgeTypes } from './types';
// prevent other components outside the Bridge from accessing this store.
export const activeBridge = writable(BridgeTypes.FUNGIBLE);
-export const selectedToken = writable>(null);
+export const selectedToken = writable>(null);
export const tokenBalance = writable>(null);
export const enteredAmount = writable(BigInt(0));
export const destNetwork = writable>(null);
@@ -43,5 +43,8 @@ export const errorComputingBalance = writable(false);
export const insufficientBalance = writable(false);
export const insufficientAllowance = writable(false);
+// ERC721 needs a tokenID to be approved before bridging
+export const notApproved = writable(new Map());
+
// Derived state
export const bridgeService = derived(selectedToken, (token) => (token ? bridges[token.type] : null));
diff --git a/packages/bridge-ui-v2/src/components/NFTList/NFTList.svelte b/packages/bridge-ui-v2/src/components/NFTList/NFTList.svelte
index 1c1e7aa100..45e78b32ef 100644
--- a/packages/bridge-ui-v2/src/components/NFTList/NFTList.svelte
+++ b/packages/bridge-ui-v2/src/components/NFTList/NFTList.svelte
@@ -83,8 +83,6 @@
{#each nftsGroup as nft}
{@const collectionAddress = nft.addresses[chainId]}
-
-
{#if collectionAddress === undefined}
TODO: Address for {nft.name} is undefined
{:else}
@@ -98,14 +96,10 @@
{selectNFT} />
{/if}
{/each}
- {#if nftsGroup.length > 2}
-
- {/if}
{/if}
-
-
+
{/each}
{/if}
diff --git a/packages/bridge-ui-v2/src/components/Transactions/Transaction.svelte b/packages/bridge-ui-v2/src/components/Transactions/Transaction.svelte
index 18c0fc1520..63eef4127b 100644
--- a/packages/bridge-ui-v2/src/components/Transactions/Transaction.svelte
+++ b/packages/bridge-ui-v2/src/components/Transactions/Transaction.svelte
@@ -1,12 +1,13 @@