Skip to content

Commit 9aae88f

Browse files
committed
merge main
1 parent 49e872a commit 9aae88f

File tree

21 files changed

+409
-17408
lines changed

21 files changed

+409
-17408
lines changed

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

+3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
},
3131
"mintable": {
3232
"type": "boolean"
33+
},
34+
"wrapped": {
35+
"type": "boolean"
3336
}
3437
},
3538
"required": ["name", "addresses", "symbol", "decimals", "type", "logoURI"]

packages/bridge-ui/src/components/Alert/FlatAlert.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
info: {
3131
textClass: 'text-secondary-content',
3232
iconType: 'info-circle',
33-
iconFillClass: 'fill-info-content',
33+
iconFillClass: 'fill-secondary-content',
3434
},
3535
};
3636

packages/bridge-ui/src/components/Bridge/FungibleBridgeComponents/ReviewStep/ReviewStep.svelte

+10
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import { destNetwork as destChain, enteredAmount, selectedToken } from '$components/Bridge/state';
1010
import { PUBLIC_SLOW_L1_BRIDGING_WARNING } from '$env/static/public';
1111
import { LayerType } from '$libs/chain';
12+
import { isWrapped, type Token } from '$libs/token';
1213
import { connectedSourceChain } from '$stores/network';
1314
1415
export let hasEnoughEth: boolean = false;
@@ -21,6 +22,10 @@
2122
2223
$: displayL1Warning = slowL1Warning && $destChain?.id && chainConfig[$destChain.id].type === LayerType.L1;
2324
25+
$: wrapped = $selectedToken !== null && isWrapped($selectedToken as Token);
26+
27+
$: wrappedAssetWarning = $t('bridge.alerts.wrapped_eth');
28+
2429
const dispatch = createEventDispatcher();
2530
2631
const editTransactionDetails = () => {
@@ -64,6 +69,11 @@
6469
<Alert type="warning">{$t('bridge.alerts.slow_bridging')}</Alert>
6570
{/if}
6671

72+
{#if wrapped}
73+
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
74+
<Alert type="warning">{@html wrappedAssetWarning}</Alert>
75+
{/if}
76+
6777
<div class="h-sep" />
6878
<!--
6979
Recipient & Processing Fee

packages/bridge-ui/src/components/Bridge/SharedBridgeComponents/AddressInput/AddressInput.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999

100100
<!-- Conditional alerts -->
101101
{#if !quiet}
102-
<div class="">
102+
<div class="pt-[8px]">
103103
{#if state === State.INVALID && ethereumAddress}
104104
<FlatAlert type="error" forceColumnFlow message={$t('inputs.address_input.errors.invalid')} />
105105
{:else if state === State.TOO_SHORT && ethereumAddress}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<script lang="ts">
2+
import { createEventDispatcher } from 'svelte';
3+
4+
import { classNames } from '$libs/util/classNames';
5+
6+
const dispatch = createEventDispatcher();
7+
8+
export let active: boolean;
9+
10+
function onClick() {
11+
dispatch('click');
12+
}
13+
</script>
14+
15+
<button
16+
role="tab"
17+
aria-selected={active}
18+
class:tab-active={active}
19+
class={classNames('tab !border-color-red', active ? 'tab-active ' : '')}
20+
on:click={onClick}>
21+
<slot></slot>
22+
</button>
23+
24+
<style>
25+
.tab {
26+
box-sizing: border-box !important;
27+
padding-bottom: 6px;
28+
}
29+
.tab:not(.tab-active) {
30+
border-color: var(--tertiary-content) !important;
31+
border-bottom: 1px solid;
32+
margin-bottom: 2px;
33+
padding-top: 2px;
34+
}
35+
.tab-active {
36+
border-bottom: 4px solid;
37+
border-color: var(--primary-brand) !important;
38+
padding-bottom: 4px;
39+
}
40+
</style>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<script lang="ts">
2+
import { createEventDispatcher } from 'svelte';
3+
4+
import DialogTab from './DialogTab.svelte';
5+
6+
export let tabs: { id: string; title: string }[];
7+
export let activeTab: string;
8+
const dispatch = createEventDispatcher();
9+
10+
function setActiveTab(tabId: string) {
11+
if (activeTab !== tabId) {
12+
activeTab = tabId;
13+
dispatch('change', { tabId });
14+
}
15+
}
16+
</script>
17+
18+
<div role="tablist" class="tabs">
19+
{#each tabs as tab}
20+
<DialogTab active={tab.id === activeTab} on:click={() => setActiveTab(tab.id)}>
21+
{tab.title}
22+
</DialogTab>
23+
{/each}
24+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { default as DialogTab } from './DialogTab.svelte';
2+
export { default as DialogTabs } from './DialogTabs.svelte';

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@
202202
class={fillClass}
203203
fill-rule="evenodd"
204204
clip-rule="evenodd"
205-
d="M20,6H16V5a3,3,0,0,0-3-3H11A3,3,0,0,0,8,5V6H4A1,1,0,0,0,4,8H5V19a3,3,0,0,0,3,3h8a3,3,0,0,0,3-3V8h1a1,1,0,0,0,0-2ZM10,5a1,1,0,0,1,1-1h2a1,1,0,0,1,1,1V6H10Zm7,14a1,1,0,0,1-1,1H8a1,1,0,0,1-1-1V8H17Z" />
205+
d="M6.12461 0.699951C5.06146 0.699951 4.19961 1.5618 4.19961 2.62495V2.93484C3.64291 2.98875 3.09083 3.05858 2.54381 3.14386C2.25733 3.18852 2.06129 3.45697 2.10595 3.74346C2.15061 4.02995 2.41907 4.22599 2.70556 4.18132L2.80909 4.16538L3.39814 11.5285C3.47817 12.5289 4.31339 13.2999 5.31701 13.2999H8.68206C9.68568 13.2999 10.5209 12.5289 10.6009 11.5285L11.19 4.16534L11.2938 4.18132C11.5803 4.22599 11.8488 4.02995 11.8934 3.74346C11.9381 3.45697 11.742 3.18852 11.4556 3.14386C10.9085 3.05857 10.3564 2.98874 9.79961 2.93482V2.62495C9.79961 1.5618 8.93776 0.699951 7.87461 0.699951H6.12461ZM6.99968 2.79995C7.58723 2.79995 8.17071 2.81761 8.74961 2.85244V2.62495C8.74961 2.1417 8.35786 1.74995 7.87461 1.74995H6.12461C5.64136 1.74995 5.24961 2.1417 5.24961 2.62495V2.85245C5.82856 2.81762 6.41208 2.79995 6.99968 2.79995ZM5.94903 5.40625C5.93868 5.14758 5.72059 4.94626 5.46192 4.95661C5.20324 4.96696 5.00193 5.18505 5.01228 5.44372L5.22229 10.6937C5.23263 10.9524 5.45072 11.1537 5.7094 11.1434C5.96807 11.133 6.16938 10.9149 6.15904 10.6563L5.94903 5.40625ZM8.98704 5.44372C8.99738 5.18505 8.79607 4.96696 8.5374 4.95661C8.27872 4.94627 8.06063 5.14758 8.05029 5.40625L7.84029 10.6563C7.82994 10.9149 8.03125 11.133 8.28993 11.1434C8.5486 11.1537 8.76669 10.9524 8.77704 10.6937L8.98704 5.44372Z" />
206206
{:else if type === 'adjustments'}
207207
<path
208208
class={fillClass}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
$: disabled = $$props.disabled || false;
1010
1111
let classes = classNames(
12-
'w-full input-box bg-neutral-background shadow-none placeholder:text-tertiary-content font-bold shadow-none outline-none ',
12+
'w-full input-box bg-neutral-background placeholder:text-tertiary-content font-bold',
1313
disabled ? 'cursor-not-allowed ' : 'cursor-pointer',
1414
$$props.class,
1515
);

packages/bridge-ui/src/components/TokenDropdown/AddCustomERC20.svelte

+11-16
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
3232
export let modalOpen = false;
3333
export let loadingTokenDetails = false;
34+
export let customTokens: Token[] = [];
3435
3536
let addressInputComponent: AddressInput;
3637
let tokenAddress: Address | string = '';
37-
let customTokens: Token[] = [];
3838
let customToken: Token | null = null;
3939
let customTokenWithDetails: Token | null = null;
4040
let disabled = true;
@@ -88,10 +88,6 @@
8888
};
8989
9090
const remove = async (token: Token) => {
91-
log('remove token', token);
92-
const address = $account.address;
93-
tokenService.removeToken(token, address as Address);
94-
customTokens = tokenService.getTokens(address as Address);
9591
dispatch('tokenRemoved', { token });
9692
};
9793
@@ -155,8 +151,6 @@
155151
? formatUnits(customTokenWithDetails.balance, customTokenWithDetails.decimals)
156152
: 0;
157153
158-
$: customTokens = tokenService.getTokens($account?.address as Address);
159-
160154
$: disabled = state !== AddressInputState.VALID || tokenAddress === '' || tokenAddress.length !== 42;
161155
162156
const closeModalIfClickedOutside = (e: MouseEvent) => {
@@ -186,24 +180,20 @@
186180
on:addressvalidation={onAddressValidation}
187181
bind:state
188182
onDialog />
189-
<div class="w-full flex items-center justify-between mt-4">
183+
<div class="w-full flex items-center justify-between">
190184
{#if customTokenWithDetails}
191185
<span>{$t('common.name')}: {customTokenWithDetails.symbol}</span>
192186
<span>{$t('common.balance')}: {formattedBalance}</span>
193187
{:else if state === AddressInputState.INVALID && tokenAddress !== '' && isValidEthereumAddress && !loadingTokenDetails}
194188
<FlatAlert type="error" message={$t('bridge.errors.custom_token.not_found.message')} />
195189
{:else if loadingTokenDetails}
196190
<Spinner />
197-
{:else}
198-
<div class="min-h-[25px]" />
191+
{:else if state === AddressInputState.DEFAULT}
192+
<FlatAlert type="info" message={$t('token_dropdown.custom_token.default_message')} />
199193
{/if}
200194
</div>
201195
</div>
202-
203-
<ActionButton priority="primary" {disabled} on:click={addCustomErc20Token} onPopup>
204-
{$t('token_dropdown.custom_token.button')}
205-
</ActionButton>
206-
196+
<div class="h-sep" />
207197
{#if customTokens.length > 0}
208198
<div class="flex h-full w-full flex-col justify-between mt-6">
209199
<h3 class="title-body-bold mb-7">{$t('token_dropdown.imported_tokens')}</h3>
@@ -217,10 +207,15 @@
217207
<Icon type="trash" fillClass="fill-primary-icon" size={24} />
218208
</button>
219209
</div>
220-
<div class="h-sep" />
221210
{/each}
222211
</div>
212+
{:else}
213+
<span>{$t('token_dropdown.no_imported_token')}</span>
223214
{/if}
215+
<div class="h-sep" />
216+
<ActionButton priority="primary" {disabled} on:click={addCustomErc20Token} onPopup>
217+
{$t('token_dropdown.custom_token.button')}
218+
</ActionButton>
224219
</div>
225220
<!-- We catch key events above -->
226221
<!-- svelte-ignore a11y-click-events-have-key-events -->

0 commit comments

Comments
 (0)