Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion modules/bitgo/src/bitgo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ export class BitGo extends BitGoAPI {
const assetEnvironment = ['prod', 'adminProd'].includes(this.getEnv()) ? 'mainnet' : 'testnet';
const url = this.url(`/assets/list/${assetEnvironment}`);
const tokenConfigMap = (await this.executeAssetRequest(url)) as Record<string, TrimmedAmsTokenConfig[]>;
this.initCoinFactory(tokenConfigMap);
try {
this.initCoinFactory(tokenConfigMap);
} catch (e) {
throw new Error(`Failed to initialize coin factory from AMS token metadata: ${(e as Error).message}`);
}
}

/**
Expand Down
16 changes: 13 additions & 3 deletions modules/statics/src/coins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,12 +470,21 @@ export function createTokenMapUsingConfigDetails(tokenConfigMap: Record<string,

// add the tokens not present in the static coin map
for (const tokenConfigs of Object.values(tokenConfigMap)) {
if (!tokenConfigs.length) continue;
const tokenConfig = tokenConfigs[0];

if (!isCoinPresentInCoinMap({ ...tokenConfig }) && !nftAndOtherTokens.has(tokenConfig.name)) {
const token = createToken(tokenConfig);
if (token) {
BaseCoins.set(token.name, token);
try {
const token = createToken(tokenConfig);
if (token) {
BaseCoins.set(token.name, token);
}
} catch (e) {
console.warn(
`Skipping malformed token: name="${tokenConfig.name}" id="${tokenConfig.id}" family="${
tokenConfig.family
}" error=${(e as Error).message}`
);
}
}
}
Expand Down Expand Up @@ -519,6 +528,7 @@ export function createTokenMapUsingTrimmedConfigDetails(
const networkNameMap = getNetworksMap();

for (const tokenConfigs of Object.values(reducedTokenConfigMap)) {
if (!tokenConfigs.length) continue;
const tokenConfig = tokenConfigs[0];
const network = networkNameMap.get(tokenConfig.network.name);

Expand Down
Loading