diff --git a/packages/bridge-ui/src/components/AddTokenToWallet.svelte b/packages/bridge-ui/src/components/AddTokenToWallet.svelte
new file mode 100644
index 00000000000..e0d409e072f
--- /dev/null
+++ b/packages/bridge-ui/src/components/AddTokenToWallet.svelte
@@ -0,0 +1,42 @@
+
+
+ addTokenToWallet($token)}>
+
diff --git a/packages/bridge-ui/src/components/BridgeForm/BridgeForm.svelte b/packages/bridge-ui/src/components/BridgeForm/BridgeForm.svelte
index d86894d0679..8deabf54c9a 100644
--- a/packages/bridge-ui/src/components/BridgeForm/BridgeForm.svelte
+++ b/packages/bridge-ui/src/components/BridgeForm/BridgeForm.svelte
@@ -28,6 +28,7 @@
import { getLogger } from '../../utils/logger';
import { truncateString } from '../../utils/truncateString';
import { tokenVaults } from '../../vault/tokenVaults';
+ import AddTokenToWallet from '../AddTokenToWallet.svelte';
import {
errorToast,
successToast,
@@ -61,8 +62,7 @@
let feeMethod: ProcessingFeeMethod = ProcessingFeeMethod.RECOMMENDED;
let feeAmount: string = '0';
- // TODO: too much going on here. We need to extract
- // logic and unit test the hell out of all this.
+ let showAddToWallet: boolean = false;
async function updateTokenBalance(signer: Signer, token: Token) {
if (signer && token) {
@@ -513,6 +513,10 @@
amount = target.value;
}
+ function toggleShowAddTokenToWallet(token: Token) {
+ showAddToWallet = token.symbol !== 'ETH';
+ }
+
$: updateTokenBalance($signer, $token).finally(() => {
computingTokenBalance = false;
});
@@ -539,6 +543,8 @@
});
$: amountEntered = Boolean(amount);
+
+ $: toggleShowAddTokenToWallet($token);
@@ -561,6 +567,10 @@
on:click={useFullAmount}>
{$_('bridgeForm.maxLabel')}
+
+ {#if showAddToWallet}
+
+ {/if}
{/if}
diff --git a/packages/bridge-ui/src/constants/__mocks__/envVars.ts b/packages/bridge-ui/src/constants/__mocks__/envVars.ts
index b598c65236b..3649f0f4c4c 100644
--- a/packages/bridge-ui/src/constants/__mocks__/envVars.ts
+++ b/packages/bridge-ui/src/constants/__mocks__/envVars.ts
@@ -45,10 +45,12 @@ export const TEST_ERC20 = [
address: '0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1',
symbol: 'BLL',
name: 'Bull Token',
+ logoUrl: 'https://internet.com/bll',
},
{
address: '0x0B306BF915C4d645ff596e518fAf3F9669b97016',
symbol: 'HORSE',
name: 'Horse Token',
+ logoUrl: 'https://internet.com/horse',
},
];
diff --git a/packages/bridge-ui/src/constants/envVars.ts b/packages/bridge-ui/src/constants/envVars.ts
index a105b65fabb..839642f6482 100644
--- a/packages/bridge-ui/src/constants/envVars.ts
+++ b/packages/bridge-ui/src/constants/envVars.ts
@@ -51,4 +51,5 @@ export const TEST_ERC20: {
address: Address;
symbol: string;
name: string;
+ logoUrl?: string;
}[] = JSON.parse(import.meta.env?.VITE_TEST_ERC20);
diff --git a/packages/bridge-ui/src/token/tokens.ts b/packages/bridge-ui/src/token/tokens.ts
index 4cee9f0d8fa..c5b3c1e94e2 100644
--- a/packages/bridge-ui/src/token/tokens.ts
+++ b/packages/bridge-ui/src/token/tokens.ts
@@ -25,6 +25,8 @@ export const TKOToken: Token = {
},
decimals: 18,
symbol: 'TKO',
+ logoUrl:
+ 'https://github.com/taikoxyz/taiko-mono/tree/main/packages/branding/testnet-token-images/ttko.svg',
logoComponent: Tko,
};
@@ -35,7 +37,7 @@ const symbolToLogoComponent = {
};
export const testERC20Tokens: Token[] = TEST_ERC20.map(
- ({ name, address, symbol }) => ({
+ ({ name, address, symbol, logoUrl }) => ({
name,
symbol,
@@ -45,6 +47,7 @@ export const testERC20Tokens: Token[] = TEST_ERC20.map(
},
decimals: 18,
logoComponent: symbolToLogoComponent[symbol] || Unknown,
+ logoUrl: logoUrl,
}),
);