From 9b6fb7d5c69d89cfaee6122cf5be9e31668bac3d Mon Sep 17 00:00:00 2001 From: Aaron Quirk Date: Tue, 3 Sep 2024 15:01:40 -0400 Subject: [PATCH] Support Base chain address record verification --- packages/config/src/env/default.ts | 10 +++++++++- .../src/components/Manage/common/CurrencyInput.tsx | 4 +++- .../src/components/Manage/common/MultiChainInput.tsx | 5 ++++- .../src/components/Manage/common/currencyRecords.ts | 11 ++++++++--- .../Manage/common/verification/provider.tsx | 1 + 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/packages/config/src/env/default.ts b/packages/config/src/env/default.ts index 5bfce004..67d19599 100644 --- a/packages/config/src/env/default.ts +++ b/packages/config/src/env/default.ts @@ -60,7 +60,15 @@ export default function getDefaultConfig(): Config { UNSTOPPABLE_CONTRACT_ADDRESS: '0xa9a6a3626993d487d2dbda3173cf58ca1a9d9e9f', UNSTOPPABLE_METADATA_ENDPOINT: 'https://api.ud-staging.com/metadata', IPFS_BASE_URL: 'https://ipfs.io', - VERIFICATION_SUPPORTED: ['SOL', 'ETH', 'MATIC', 'FTM', 'AVAX', 'BTC'], + VERIFICATION_SUPPORTED: [ + 'SOL', + 'ETH', + 'BASE', + 'MATIC', + 'FTM', + 'AVAX', + 'BTC', + ], LOGIN_WITH_UNSTOPPABLE: { CLIENT_ID: '115148ec-364d-4e19-b7d8-2807e8f1b525', REDIRECT_URI: diff --git a/packages/ui-components/src/components/Manage/common/CurrencyInput.tsx b/packages/ui-components/src/components/Manage/common/CurrencyInput.tsx index 3ab6408c..2ad99b88 100644 --- a/packages/ui-components/src/components/Manage/common/CurrencyInput.tsx +++ b/packages/ui-components/src/components/Manage/common/CurrencyInput.tsx @@ -17,6 +17,7 @@ import type {ResolverKeyName} from '../../../lib/types/resolverKeys'; import {CryptoIcon} from '../../Image'; import ManageInput from './ManageInput'; import { + getParentNetworkSymbol, isTokenDeprecated, isValidMappedResolverKeyValue, } from './currencyRecords'; @@ -247,6 +248,7 @@ const CurrencyInput: React.FC = ({ resolverKeys, ); const currencyName = mappedResolverKey.name || currency; + const currencySymbol = getParentNetworkSymbol(mappedResolverKey) || currency; const placeholder = t('manage.enterYourAddress', {currency: currencyName}); const handleChange = (_key: string, newValue: string) => { @@ -326,7 +328,7 @@ const CurrencyInput: React.FC = ({ domain={domain} ownerAddress={ownerAddress} profileData={profileData} - currency={currency} + currency={currencySymbol} setWeb3Deps={setWeb3Deps} uiDisabled={false} saveClicked={saveClicked} diff --git a/packages/ui-components/src/components/Manage/common/MultiChainInput.tsx b/packages/ui-components/src/components/Manage/common/MultiChainInput.tsx index 8fcf84c3..38a812e7 100644 --- a/packages/ui-components/src/components/Manage/common/MultiChainInput.tsx +++ b/packages/ui-components/src/components/Manage/common/MultiChainInput.tsx @@ -20,6 +20,7 @@ import {CryptoIcon} from '../../Image'; import {useStyles} from './CurrencyInput'; import FormError from './FormError'; import { + getParentNetworkSymbol, isTokenDeprecated, isValidMappedResolverKeyValue, } from './currencyRecords'; @@ -133,6 +134,8 @@ const MultiChainInput: React.FC = ({ } }; + const currencySymbol = + getParentNetworkSymbol(mappedResolverKey) || currency; const placeholder = t('manage.enterYourAddress', { currency: (MultichainKeyToLocaleKey[key] && @@ -165,7 +168,7 @@ const MultiChainInput: React.FC = ({ domain={domain} ownerAddress={ownerAddress} profileData={profileData} - currency={currency} + currency={currencySymbol} setWeb3Deps={setWeb3Deps} uiDisabled={false} saveClicked={saveClicked} diff --git a/packages/ui-components/src/components/Manage/common/currencyRecords.ts b/packages/ui-components/src/components/Manage/common/currencyRecords.ts index 846a9c3c..57d302c6 100644 --- a/packages/ui-components/src/components/Manage/common/currencyRecords.ts +++ b/packages/ui-components/src/components/Manage/common/currencyRecords.ts @@ -167,9 +167,7 @@ export const getMultichainAddressRecords = ( } // find the parent network version type - const version = mappedResolverKey.parents.find( - p => p.subType === 'CRYPTO_NETWORK', - )?.shortName; + const version = getParentNetworkSymbol(mappedResolverKey); if (!version) { return; } @@ -199,6 +197,13 @@ export const getMultichainAddressRecords = ( return result; }; +export const getParentNetworkSymbol = ( + mappedResolverKey: MappedResolverKey, +): string | undefined => { + return mappedResolverKey.parents?.find(p => p.subType === 'CRYPTO_NETWORK') + ?.shortName; +}; + export const getSingleChainAddressRecords = ( records: DomainRawRecords, legacyResolverKeys: ResolverKeys, diff --git a/packages/ui-components/src/components/Manage/common/verification/provider.tsx b/packages/ui-components/src/components/Manage/common/verification/provider.tsx index 7c230c60..86c1c661 100644 --- a/packages/ui-components/src/components/Manage/common/verification/provider.tsx +++ b/packages/ui-components/src/components/Manage/common/verification/provider.tsx @@ -22,6 +22,7 @@ export const getVerificationProvider = ( > ); case 'ETH': + case 'BASE': case 'MATIC': case 'FTM': case 'AVAX':