Skip to content

Commit 6bc2e26

Browse files
authored
feat(bridge-ui): update config (#17347)
1 parent d62f193 commit 6bc2e26

File tree

11 files changed

+57
-70
lines changed

11 files changed

+57
-70
lines changed

packages/bridge-ui/config/schemas/configuredCustomTokens.schema.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
"stablecoin": {
4343
"type": "boolean"
4444
},
45+
"quotaLimited": {
46+
"type": "boolean"
47+
},
4548
"mintable": {
4649
"type": "boolean"
4750
}

packages/bridge-ui/scripts/exportJsonToEnv.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const isProd = args.includes('--prod');
2525
const isA7 = args.includes('--a7');
2626
const isA6 = args.includes('--a6');
2727
const isA5 = args.includes('--a5');
28+
const isMainnet = args.includes('--mainnet');
2829

2930
// Determine the environment
3031
let environment = '';
@@ -44,6 +45,8 @@ if (isA6) {
4445
version = 'a5';
4546
} else if (isA7) {
4647
version = 'a7';
48+
} else if (isMainnet) {
49+
version = 'mainnet';
4750
}
4851

4952
Logger.info(`Detected ${environment} environment and ${version} version.`);

packages/bridge-ui/src/components/SideNavigation/SideNavigation.svelte

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,24 +103,28 @@
103103
<span>{$t('nav.bridge')}</span>
104104
</LinkButton>
105105
</li>
106-
<li>
107-
<LinkButton href="/faucet" active={isFaucetPage}>
108-
<Icon type="faucet" fillClass={getIconFillClass(isFaucetPage)} />
109-
<span>{$t('nav.faucet')}</span>
110-
</LinkButton>
111-
</li>
106+
{#if testnetName !== ''}
107+
<li>
108+
<LinkButton href="/faucet" active={isFaucetPage}>
109+
<Icon type="faucet" fillClass={getIconFillClass(isFaucetPage)} />
110+
<span>{$t('nav.faucet')}</span>
111+
</LinkButton>
112+
</li>
113+
{/if}
112114
<li>
113115
<LinkButton href="/transactions" active={isTransactionsPage}>
114116
<Icon type="transactions" fillClass={getIconFillClass(isTransactionsPage)} />
115117
<span>{$t('nav.transactions')}</span>
116118
</LinkButton>
117119
</li>
118-
<li class="border-t border-t-divider-border pt-2">
119-
<LinkButton href={PUBLIC_DEFAULT_SWAP_URL} external>
120-
<Icon type="swap" />
121-
<span>{$t('nav.swap')}</span>
122-
</LinkButton>
123-
</li>
120+
{#if PUBLIC_DEFAULT_SWAP_URL && PUBLIC_DEFAULT_SWAP_URL !== ''}
121+
<li class="border-t border-t-divider-border pt-2">
122+
<LinkButton href={PUBLIC_DEFAULT_SWAP_URL} external>
123+
<Icon type="swap" />
124+
<span>{$t('nav.swap')}</span>
125+
</LinkButton>
126+
</li>
127+
{/if}
124128
<li>
125129
<LinkButton
126130
href={$connectedSourceChain

packages/bridge-ui/src/components/WelcomeModal/WelcomeModal.svelte

Lines changed: 0 additions & 45 deletions
This file was deleted.

packages/bridge-ui/src/components/WelcomeModal/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/bridge-ui/src/i18n/en.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,6 @@
199199
"recipient": "Recipient",
200200
"review": "Review"
201201
}
202-
},
203-
"welcome_modal": {
204-
"body": "Welcome to <span class='font-bold text-primary-brand'>Hekla, our final testnet</span>.<br/>Strengthening security may cause some delay in L2→L1 bridging, <span class='font-bold text-primary-brand'>around 24 hours</span> on the testnet. We're striving for shorter delays on the mainnet.",
205-
"confirm": "I understand",
206-
"link": "Find out more",
207-
"title": "Important Update"
208202
}
209203
},
210204
"chain_selector": {
@@ -492,7 +486,7 @@
492486
"title": "What is \"Sufficient funds to claim\"?"
493487
},
494488
"quota": {
495-
"description": "Currently there is a daily limit of how much ETH can be bridged to L1. If the quota is reached, please try again the next day.",
489+
"description": "Currently there is a daily limit of how much of this asset can be bridged to L1. If the quota is reached, please try again the next day.",
496490
"title": "What is \"Sufficient daily quota\"?"
497491
}
498492
}

packages/bridge-ui/src/libs/fee/recommendProcessingFee.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { getPublicClient } from '@wagmi/core';
2+
import { formatGwei } from 'viem';
23

34
import { gasLimitConfig } from '$config';
45
import { PUBLIC_FEE_MULTIPLIER } from '$env/static/public';
@@ -35,8 +36,13 @@ export async function recommendProcessingFee({
3536
if (!destPublicClient) throw new Error('Could not get public client');
3637

3738
const maxPriorityFee = await destPublicClient.estimateMaxPriorityFeePerGas();
39+
log(`maxPriorityFee: ${formatGwei(maxPriorityFee)} gwei`);
40+
41+
const gasPrice = await destPublicClient.getGasPrice();
42+
log(`gasPrice: ${formatGwei(gasPrice)} gwei`);
3843

3944
if (!baseFee) throw new Error('Unable to get base fee');
45+
log(`baseFee: ${formatGwei(baseFee)} gwei`);
4046

4147
if (token.type !== TokenType.ETH) {
4248
const tokenInfo = await getTokenAddresses({ token, srcChainId, destChainId });
@@ -82,7 +88,23 @@ export async function recommendProcessingFee({
8288
}
8389
if (!estimatedMsgGaslimit) throw new Error('Unable to calculate fee');
8490

85-
const fee = estimatedMsgGaslimit * (BigInt(PUBLIC_FEE_MULTIPLIER) * (baseFee + maxPriorityFee));
91+
// Initial fee multiplicator and add fallback
92+
let feeMultiplicator: number = parseInt(PUBLIC_FEE_MULTIPLIER);
93+
94+
if (gasPrice <= 50000000n) {
95+
feeMultiplicator = 4;
96+
log(`gasPrice ${formatGwei(gasPrice)} is less than 0.5 gwei, setting feeMultiplicator to 4`);
97+
} else if (gasPrice <= 100000000n && gasPrice > 50000000n) {
98+
feeMultiplicator = 3;
99+
log(
100+
`gasPrice ${formatGwei(gasPrice)} is less than 0.1 gwei and more than 0.05 gwei, setting feeMultiplicator to 3`,
101+
);
102+
} else {
103+
feeMultiplicator = 2;
104+
log(`gasPrice ${formatGwei(gasPrice)} is more than 0.1 gwei, setting feeMultiplicator to 2`);
105+
}
106+
107+
const fee = estimatedMsgGaslimit * gasPrice * BigInt(feeMultiplicator);
86108
return roundWeiTo6DecimalPlaces(fee);
87109
}
88110

packages/bridge-ui/src/libs/token/tokens.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ const hasAttribute = (token: Token, attribute: TokenAttributeKey): boolean => {
3535
export const isWrapped = (token: Token): boolean => hasAttribute(token, TokenAttributeKey.Wrapped);
3636
export const isSupported = (token: Token): boolean => hasAttribute(token, TokenAttributeKey.Supported);
3737
export const isStablecoin = (token: Token): boolean => hasAttribute(token, TokenAttributeKey.Stablecoin);
38+
export const isQuotaLimited = (token: Token): boolean => hasAttribute(token, TokenAttributeKey.QuotaLimited);
3839
export const isMintable = (token: Token): boolean => hasAttribute(token, TokenAttributeKey.Mintable);

packages/bridge-ui/src/libs/token/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@ export enum TokenAttributeKey {
1818
Wrapped = 'wrapped',
1919
Stablecoin = 'stablecoin',
2020
Supported = 'supported',
21+
QuotaLimited = 'quotaLimited',
2122
}
2223

2324
export type TokenAttributes = {
2425
[TokenAttributeKey.Mintable]?: boolean;
2526
[TokenAttributeKey.Wrapped]?: boolean;
2627
[TokenAttributeKey.Stablecoin]?: boolean;
2728
[TokenAttributeKey.Supported]?: boolean;
29+
[TokenAttributeKey.QuotaLimited]?: boolean;
2830
};
2931

3032
export type Token = {

packages/bridge-ui/src/libs/wagmi/watcher.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,14 @@ export async function startWatching() {
2828
const { chainId, address } = data;
2929

3030
if (chainId && address) {
31-
connectedSmartContractWallet.set(await isSmartContractWallet(address, Number(chainId)));
31+
let smartWallet = false;
32+
try {
33+
smartWallet = (await isSmartContractWallet(address, Number(chainId))) || false;
34+
} catch (error) {
35+
console.error('Error checking for smart contract wallet', error);
36+
} finally {
37+
connectedSmartContractWallet.set(smartWallet);
38+
}
3239
}
3340

3441
// We need to check if the chain is supported, and if not

0 commit comments

Comments
 (0)