Skip to content

Commit

Permalink
feat(bridge-ui): add WETH warning (#17051)
Browse files Browse the repository at this point in the history
  • Loading branch information
KorbinianK committed May 8, 2024
1 parent e47ff54 commit a77221a
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
},
"mintable": {
"type": "boolean"
},
"wrapped": {
"type": "boolean"
}
},
"required": ["name", "addresses", "symbol", "decimals", "type", "logoURI"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { destNetwork as destChain, enteredAmount, selectedToken } from '$components/Bridge/state';
import { PUBLIC_SLOW_L1_BRIDGING_WARNING } from '$env/static/public';
import { LayerType } from '$libs/chain';
import { isWrapped, type Token } from '$libs/token';
import { connectedSourceChain } from '$stores/network';
export let hasEnoughEth: boolean = false;
Expand All @@ -21,6 +22,10 @@
$: displayL1Warning = slowL1Warning && $destChain?.id && chainConfig[$destChain.id].type === LayerType.L1;
$: wrapped = $selectedToken !== null && isWrapped($selectedToken as Token);
$: wrappedAssetWarning = $t('bridge.alerts.wrapped_eth');
const dispatch = createEventDispatcher();
const editTransactionDetails = () => {
Expand Down Expand Up @@ -64,6 +69,11 @@
<Alert type="warning">{$t('bridge.alerts.slow_bridging')}</Alert>
{/if}

{#if wrapped}
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
<Alert type="warning">{@html wrappedAssetWarning}</Alert>
{/if}

<div class="h-sep" />
<!--
Recipient & Processing Fee
Expand Down
9 changes: 5 additions & 4 deletions packages/bridge-ui/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"nft_scan_again": "Scan again"
},
"alerts": {
"slow_bridging": "Please note: Bridging to L1 will take around 24hrs!"
"slow_bridging": "Please note: Bridging to L1 will take around 24hrs!",
"wrapped_eth": "You are bridging wrapped ETH. Please be aware that un-wrapping will only work on the original chain of the token, <span class=\"font-bold\">NOT</span> on the destination."
},
"button": {
"approve": "Approve",
Expand Down Expand Up @@ -361,10 +362,10 @@
"transactions": "Transactions"
},
"paginator": {
"of": "of",
"page": "Page",
"everything_loaded": "Everything loaded",
"more": "Fetch more...",
"everything_loaded": "Everything loaded"
"of": "of",
"page": "Page"
},
"paused_modal": {
"description": "The bridge is currently not available. Follow our official communication channels for more information. ",
Expand Down
4 changes: 4 additions & 0 deletions packages/bridge-ui/src/libs/token/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ export const testNFT: Token[] = customToken.filter(
);

export const tokens = [ETHToken, ...testERC20Tokens];

export const getTokensByType = (type: TokenType): Token[] => tokens.filter((token) => token.type === type);

export const isWrapped = (token: Token): boolean => tokens.find((token) => token.wrapped === true) === token;
1 change: 1 addition & 0 deletions packages/bridge-ui/src/libs/token/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export type Token = {
imported?: boolean;
mintable?: boolean;
balance?: bigint;
wrapped?: boolean;
};

export type NFT = Token & {
Expand Down

0 comments on commit a77221a

Please sign in to comment.