Skip to content

Commit

Permalink
Support Base chain address record verification
Browse files Browse the repository at this point in the history
  • Loading branch information
qrtp committed Sep 3, 2024
1 parent 3b11285 commit 9b6fb7d
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
10 changes: 9 additions & 1 deletion packages/config/src/env/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -247,6 +248,7 @@ const CurrencyInput: React.FC<Props> = ({
resolverKeys,
);
const currencyName = mappedResolverKey.name || currency;
const currencySymbol = getParentNetworkSymbol(mappedResolverKey) || currency;
const placeholder = t('manage.enterYourAddress', {currency: currencyName});

const handleChange = (_key: string, newValue: string) => {
Expand Down Expand Up @@ -326,7 +328,7 @@ const CurrencyInput: React.FC<Props> = ({
domain={domain}
ownerAddress={ownerAddress}
profileData={profileData}
currency={currency}
currency={currencySymbol}
setWeb3Deps={setWeb3Deps}
uiDisabled={false}
saveClicked={saveClicked}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {CryptoIcon} from '../../Image';
import {useStyles} from './CurrencyInput';
import FormError from './FormError';
import {
getParentNetworkSymbol,
isTokenDeprecated,
isValidMappedResolverKeyValue,
} from './currencyRecords';
Expand Down Expand Up @@ -133,6 +134,8 @@ const MultiChainInput: React.FC<Props> = ({
}
};

const currencySymbol =
getParentNetworkSymbol(mappedResolverKey) || currency;
const placeholder = t('manage.enterYourAddress', {
currency:
(MultichainKeyToLocaleKey[key] &&
Expand Down Expand Up @@ -165,7 +168,7 @@ const MultiChainInput: React.FC<Props> = ({
domain={domain}
ownerAddress={ownerAddress}
profileData={profileData}
currency={currency}
currency={currencySymbol}
setWeb3Deps={setWeb3Deps}
uiDisabled={false}
saveClicked={saveClicked}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const getVerificationProvider = (
></SolanaVerificationButton>
);
case 'ETH':
case 'BASE':
case 'MATIC':
case 'FTM':
case 'AVAX':
Expand Down

0 comments on commit 9b6fb7d

Please sign in to comment.