Skip to content

Commit 87e0c41

Browse files
committed
chore: remove tokenConfig changes and rename feature flag
TICKET: WIN-6598
1 parent 6a6a205 commit 87e0c41

File tree

4 files changed

+6
-78
lines changed

4 files changed

+6
-78
lines changed

modules/bitgo/src/v2/coinFactory.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -534,12 +534,12 @@ export function registerCoinConstructors(coinFactory: CoinFactory, coinMap: Coin
534534
coinFactory.register(name, coinConstructor)
535535
);
536536

537-
// Generic ERC20 token registration for coins with SUPPORTS_ERC20 feature
537+
// Generic ERC20 token registration for coins with IS_ERC20_TOKEN feature
538538
coins
539-
.filter((coin) => coin.features.includes(CoinFeature.SUPPORTS_ERC20))
539+
.filter((coin) => coin.features.includes(CoinFeature.IS_ERC20_TOKEN))
540540
.forEach((coin) => {
541541
const coinNames = {
542-
[coin.network.type]: coin.name,
542+
[coin.network.type]: coin.network.family,
543543
};
544544

545545
EthLikeErc20Token.createTokenConstructors(coinNames).forEach(({ name, coinConstructor }) => {

modules/sdk-coin-evm/src/register.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const register = (coinFamily: string, sdk: BitGoBase): void => {
2222
sdk.register(coin.name, EvmCoin.createInstance);
2323
});
2424
}
25-
if (coins.get(coinFamily).features.includes(CoinFeature.SUPPORTS_ERC20)) {
25+
if (coins.get(coinFamily).features.includes(CoinFeature.IS_ERC20_TOKEN)) {
2626
coins
2727
.filter((coin) => coin.family === coinFamily && coin.isToken)
2828
.forEach((coin) => {

modules/statics/src/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ export enum CoinFeature {
398398
/**
399399
* This coin supports erc20 tokens
400400
*/
401-
SUPPORTS_ERC20 = 'supports-erc20',
401+
IS_ERC20_TOKEN = 'is-erc20-token',
402402

403403
/**
404404
* This coin is a Cosmos coin and should use shared Cosmos SDK module

modules/statics/src/tokenConfig.ts

Lines changed: 1 addition & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import {
3030
XrpCoin,
3131
ZkethERC20Token,
3232
} from './account';
33-
import { CoinFamily, CoinKind, BaseCoin, CoinFeature } from './base';
33+
import { CoinFamily, CoinKind, BaseCoin } from './base';
3434
import { coins } from './coins';
3535
import { Networks, NetworkType } from './networks';
3636
import { OfcCoin } from './ofc';
@@ -748,23 +748,6 @@ export const getFormattedAlgoTokens = (customCoinMap = coins) =>
748748
return acc;
749749
}, []);
750750

751-
// Get the list of ERC-20 tokens from statics and format it properly
752-
// TODO: use it instead of getFormatteCoredaoTokens
753-
// const getFormattedEthLikeTokens = (customCoinMap = coins) =>
754-
// customCoinMap.reduce((acc: EthLikeTokenConfig[], coin) => {
755-
// if (coin instanceof EthLikeERC20Token && coin.features.includes(CoinFeature.SHARED_EVM_SDK)) {
756-
// acc.push({
757-
// type: coin.name,
758-
// coin: coin.network.type === NetworkType.MAINNET ? coin.coinNames.Mainnet : coin.coinNames.Testnet,
759-
// network: coin.network.type === NetworkType.MAINNET ? 'Mainnet' : 'Testnet',
760-
// name: coin.fullName,
761-
// tokenContractAddress: coin.contractAddress.toString().toLowerCase(),
762-
// decimalPlaces: coin.decimalPlaces,
763-
// });
764-
// }
765-
// return acc;
766-
// }, []);
767-
768751
function getHbarTokenConfig(coin: HederaToken): HbarTokenConfig {
769752
return {
770753
type: coin.name,
@@ -1012,59 +995,6 @@ function getCosmosTokenConfig(coin: CosmosChainToken): CosmosTokenConfig {
1012995
};
1013996
}
1014997

1015-
export interface FormattedTokensByChain {
1016-
bitcoin: {
1017-
[chainName: string]: {
1018-
tokens: EthLikeTokenConfig[];
1019-
nfts?: EthLikeTokenConfig[];
1020-
};
1021-
};
1022-
testnet: {
1023-
[chainName: string]: {
1024-
tokens: EthLikeTokenConfig[];
1025-
nfts?: EthLikeTokenConfig[];
1026-
};
1027-
};
1028-
}
1029-
1030-
/**
1031-
* Dynamically populate tokens by looping through coins once
1032-
*/
1033-
function populateEthLikeTokens(customCoinMap = coins): FormattedTokensByChain {
1034-
const tokensMap: FormattedTokensByChain = {
1035-
bitcoin: {},
1036-
testnet: {},
1037-
};
1038-
1039-
customCoinMap.forEach((coin) => {
1040-
if (coin.features.includes(CoinFeature.SUPPORTS_ERC20)) {
1041-
const isMainnet = coin.network.type === NetworkType.MAINNET;
1042-
const networkKey = isMainnet ? 'bitcoin' : 'testnet';
1043-
const chainKey = isMainnet ? coin.coinNames.Mainnet : coin.coinNames.Testnet;
1044-
1045-
const formattedToken: EthLikeTokenConfig = {
1046-
type: coin.name,
1047-
coin: chainKey,
1048-
network: isMainnet ? 'Mainnet' : 'Testnet',
1049-
name: coin.fullName,
1050-
tokenContractAddress: coin.contractAddress.toString().toLowerCase(),
1051-
decimalPlaces: coin.decimalPlaces,
1052-
};
1053-
1054-
// Initialize chain tokens array if it doesn't exist
1055-
if (!tokensMap[networkKey][chainKey]) {
1056-
tokensMap[networkKey][chainKey] = { tokens: [] };
1057-
}
1058-
1059-
tokensMap[networkKey][chainKey].tokens.push(formattedToken);
1060-
}
1061-
});
1062-
1063-
return tokensMap;
1064-
}
1065-
1066-
const ethLikeTokens = populateEthLikeTokens(coins);
1067-
1068998
export const getFormattedTokens = (coinMap = coins): Tokens => {
1069999
const formattedAptNFTCollections = getFormattedAptNFTCollections(coinMap);
10701000
return {
@@ -1162,7 +1092,6 @@ export const getFormattedTokens = (coinMap = coins): Tokens => {
11621092
cosmos: {
11631093
tokens: getFormattedCosmosChainTokens(coinMap).filter((token) => token.network === 'Mainnet'),
11641094
},
1165-
...ethLikeTokens.bitcoin,
11661095
},
11671096
testnet: {
11681097
eth: {
@@ -1258,7 +1187,6 @@ export const getFormattedTokens = (coinMap = coins): Tokens => {
12581187
cosmos: {
12591188
tokens: getFormattedCosmosChainTokens(coinMap).filter((token) => token.network === 'Testnet'),
12601189
},
1261-
...ethLikeTokens.testnet,
12621190
},
12631191
};
12641192
};

0 commit comments

Comments
 (0)