mirror of
https://github.com/Instadapp/trustwallet-assets.git
synced 2024-07-29 22:37:31 +00:00
[Internal] Change all explorers to standard explorer (#7655)
* In fix, overwrite Explorer to computed version. * Ignore case-only diff * Add VeChain explorer * Revert "Add VeChain explorer" This reverts commit 0a0b22c6beda4648c41cf307bbb9b4f421d7d773. * Add VeChain explorer template * Update thundertoken explorer * Lint fix * Lint fix Co-authored-by: Catenocrypt <catenocrypt@users.noreply.github.com>
This commit is contained in:
parent
f96a9a803b
commit
f905bad945
|
@ -165,11 +165,15 @@ export function explorerUrl(chain: string, contract: string): string {
|
||||||
|
|
||||||
case CoinType.name(CoinType.thundertoken).toLowerCase():
|
case CoinType.name(CoinType.thundertoken).toLowerCase():
|
||||||
case "thundertoken":
|
case "thundertoken":
|
||||||
return `https://scan.thundercore.com/`;
|
return `https://viewblock.io/thundercore/address/${contract}`;
|
||||||
|
|
||||||
case CoinType.name(CoinType.classic).toLowerCase():
|
case CoinType.name(CoinType.classic).toLowerCase():
|
||||||
case "classic":
|
case "classic":
|
||||||
return `https://blockscout.com/etc/mainnet/tokens/${contract}`;
|
return `https://blockscout.com/etc/mainnet/tokens/${contract}`;
|
||||||
|
|
||||||
|
case CoinType.name(CoinType.vechain).toLowerCase():
|
||||||
|
case "vechain":
|
||||||
|
return `https://explore.vechain.org/accounts/${contract}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
|
@ -223,14 +227,16 @@ function isAssetInfoOK(chain: string, address: string, errors: string[], warning
|
||||||
fixedInfo = fixedInfo2;
|
fixedInfo = fixedInfo2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const explorerExpected = explorerUrl(chain, address);
|
||||||
const hasExplorer = Object.prototype.hasOwnProperty.call(info, 'explorer');
|
const hasExplorer = Object.prototype.hasOwnProperty.call(info, 'explorer');
|
||||||
|
const explorerActual = info['explorer'] || '';
|
||||||
|
const explorerActualLower = explorerActual.toLowerCase();
|
||||||
|
const explorerExpectedLower = explorerExpected.toLowerCase();
|
||||||
|
if (checkOnly) {
|
||||||
if (!hasExplorer) {
|
if (!hasExplorer) {
|
||||||
errors.push(`Missing explorer key`);
|
errors.push(`Missing explorer key`);
|
||||||
} else {
|
} else {
|
||||||
const explorerActual = info['explorer'];
|
if (explorerActualLower !== explorerExpectedLower && explorerExpected) {
|
||||||
const explorerActualLower = explorerActual.toLowerCase();
|
|
||||||
const explorerExpected = explorerUrl(chain, address);
|
|
||||||
if (explorerActualLower != explorerExpected.toLowerCase() && explorerExpected) {
|
|
||||||
// doesn't match, check for alternatives
|
// doesn't match, check for alternatives
|
||||||
const explorersAlt = explorerUrlAlternatives(chain, address, info['name']);
|
const explorersAlt = explorerUrlAlternatives(chain, address, info['name']);
|
||||||
if (explorersAlt && explorersAlt.length > 0) {
|
if (explorersAlt && explorersAlt.length > 0) {
|
||||||
|
@ -247,6 +253,13 @@ function isAssetInfoOK(chain: string, address: string, errors: string[], warning
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// fix: simply replace with expected (case-only deviation is accepted)
|
||||||
|
if (explorerActualLower !== explorerExpectedLower) {
|
||||||
|
if (!fixedInfo) { fixedInfo = info; }
|
||||||
|
fixedInfo['explorer'] = explorerExpected;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (fixedInfo && !checkOnly) {
|
if (fixedInfo && !checkOnly) {
|
||||||
writeJsonFile(assetInfoPath, fixedInfo);
|
writeJsonFile(assetInfoPath, fixedInfo);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user