From a22ba2c101c4d3cf020599ff5fd783d79af47760 Mon Sep 17 00:00:00 2001 From: Tuditi Date: Wed, 29 May 2024 16:01:13 +0200 Subject: [PATCH 1/3] feat: flatten EVM contracts --- .../components/ContactAddressCard.svelte | 18 ++++++++++++++++-- .../popup/popups/ReceiveAddressPopup.svelte | 2 +- .../views/AddNetworkAddressDrawer.svelte | 1 + .../send-flow/views/SelectRecipientView.svelte | 4 +++- .../components/avatars/NetworkAvatar.svelte | 2 ++ .../src/components/avatars/TokenAvatar.svelte | 6 ++++++ .../src/components/inputs/NetworkInput.svelte | 16 ++++++++++++++-- .../molecules/NetworkRecipientItem.svelte | 5 +++-- .../molecules/NetworkRecipientSelector.svelte | 6 +++--- .../icon/constants/default-network-icon.ts | 1 + .../icon/constants/default-token-icon.ts | 3 +++ .../contact/classes/contact-manager.class.ts | 9 +++++++-- .../constants/default-base-token.constant.ts | 1 + .../constants/default-coin-type.constant.ts | 1 + .../constants/supported-network-id.constant.ts | 1 + 15 files changed, 63 insertions(+), 13 deletions(-) diff --git a/packages/desktop/components/ContactAddressCard.svelte b/packages/desktop/components/ContactAddressCard.svelte index 19ad9e6a34..624b902521 100644 --- a/packages/desktop/components/ContactAddressCard.svelte +++ b/packages/desktop/components/ContactAddressCard.svelte @@ -3,7 +3,14 @@ import { IContact, IContactAddress, IContactAddressMap, setSelectedContactNetworkAddress } from '@core/contact' import { localize } from '@core/i18n' import { resetLedgerPreparedOutput, resetShowInternalVerificationPopup } from '@core/ledger' - import { ExplorerEndpoint, getExplorerUrl, getNameFromNetworkId, getNetwork, NetworkId } from '@core/network' + import { + ExplorerEndpoint, + getExplorerUrl, + getNameFromNetworkId, + getNetwork, + NetworkId, + NetworkNamespace, + } from '@core/network' import { Router } from '@core/router' import { truncateString } from '@core/utils' import { SendFlowType, setSendFlowParameters, SubjectType } from '@core/wallet' @@ -23,6 +30,13 @@ const hasExplorer = !!getNetwork(networkId)?.explorerUrl + function getTitle(): string { + if (networkId.includes(NetworkNamespace.Evm)) { + return localize('general.evmAddress') + } + return getNameFromNetworkId(networkId) ?? '' + } + function onExplorerClick(address: string): void { const url = getExplorerUrl(networkId, ExplorerEndpoint.Address, address) openUrlInBrowser(url) @@ -55,7 +69,7 @@
- {getNameFromNetworkId(networkId)} + {getTitle()}
diff --git a/packages/desktop/components/popup/popups/ReceiveAddressPopup.svelte b/packages/desktop/components/popup/popups/ReceiveAddressPopup.svelte index 6284d743d1..67a6378db0 100644 --- a/packages/desktop/components/popup/popups/ReceiveAddressPopup.svelte +++ b/packages/desktop/components/popup/popups/ReceiveAddressPopup.svelte @@ -64,7 +64,7 @@ }} >
- + {#if receiveAddress} { + const _networkId = isEvmNetwork(networkId) ? SupportedNetworkId.GenericEvm : networkId + const recipients: Subject[] = ContactManager.listContactAddressesForNetwork(_networkId).map((address) => { const contact = ContactManager.getContact(address.contactId) return { type: SubjectType.Contact, diff --git a/packages/shared/src/components/avatars/NetworkAvatar.svelte b/packages/shared/src/components/avatars/NetworkAvatar.svelte index 517082ac80..c2444b6c7f 100644 --- a/packages/shared/src/components/avatars/NetworkAvatar.svelte +++ b/packages/shared/src/components/avatars/NetworkAvatar.svelte @@ -20,6 +20,7 @@ [SupportedNetworkId.TestnetEvm]: 'shimmer-evm-background/90', [SupportedNetworkId.Ethereum]: '#627eea', [SupportedNetworkId.Sepolia]: 'text-secondary', + [SupportedNetworkId.GenericEvm]: '#627eea', } const AVATAR_TEXT_COLOR: { [id in NetworkId]?: string } = { @@ -33,6 +34,7 @@ [SupportedNetworkId.TestnetEvm]: '#FFFFFF', [SupportedNetworkId.Ethereum]: '#FFFFFF', [SupportedNetworkId.Sepolia]: '#FFFFFF', + [SupportedNetworkId.GenericEvm]: '#FFFFFF', } let anchor: HTMLElement diff --git a/packages/shared/src/components/avatars/TokenAvatar.svelte b/packages/shared/src/components/avatars/TokenAvatar.svelte index 0815412ede..2f412b193e 100644 --- a/packages/shared/src/components/avatars/TokenAvatar.svelte +++ b/packages/shared/src/components/avatars/TokenAvatar.svelte @@ -44,6 +44,9 @@ [SupportedNetworkId.Sepolia]: { [BASE_TOKEN_ID]: 'text-secondary', }, + [SupportedNetworkId.GenericEvm]: { + [BASE_TOKEN_ID]: 'text-secondary', + }, } const AVATAR_TEXT_COLOR: { [networkId: string]: { [tokenId: string]: string } } = { @@ -77,6 +80,9 @@ [SupportedNetworkId.Sepolia]: { [BASE_TOKEN_ID]: '#FFFFFF', }, + [SupportedNetworkId.GenericEvm]: { + [BASE_TOKEN_ID]: 'text-secondary', + }, } const IMAGE_SIZES: Record = { diff --git a/packages/shared/src/components/inputs/NetworkInput.svelte b/packages/shared/src/components/inputs/NetworkInput.svelte index 828f1b2661..753907d0c3 100644 --- a/packages/shared/src/components/inputs/NetworkInput.svelte +++ b/packages/shared/src/components/inputs/NetworkInput.svelte @@ -1,12 +1,14 @@ diff --git a/packages/shared/src/components/molecules/NetworkRecipientItem.svelte b/packages/shared/src/components/molecules/NetworkRecipientItem.svelte index 5e4852ec53..3d7221ae5a 100644 --- a/packages/shared/src/components/molecules/NetworkRecipientItem.svelte +++ b/packages/shared/src/components/molecules/NetworkRecipientItem.svelte @@ -1,6 +1,6 @@