Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(bridge-ui): add WETH warning #17051

Merged
merged 1 commit into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -360,10 +361,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