Update dependencies and assets.config.yaml (#16512)

This commit is contained in:
Daniel 2021-12-10 16:58:39 +03:00 committed by GitHub
parent 37eb5ba49e
commit 998c7d1722
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 52 deletions

View File

@ -3,8 +3,8 @@ app:
client_urls:
binance:
dex: https://dex.binance.org
explorer: https://explorer.binance.org
dex: https://dex-atlantic.binance.org/api
urls:
tw_assets_app: https://assets.trustwalletapp.com

View File

@ -2,7 +2,7 @@
"name": "Pangolin",
"website": "https://pangolin.exchange/",
"description": "A community-driven decentralized exchange for Avalanche and Ethereum assets with fast settlement, low transaction fees, and a democratic distributionpowered by Avalanche",
"explorer": "https://cchain.explorer.avax.network/address/0x60781C2586D68229fde47564546784ab3fACA982",
"explorer": "https://snowtrace.io/address/0x60781C2586D68229fde47564546784ab3fACA982",
"research": "https://research.binance.com/en/projects/avalanche",
"type": "AVALANCHE",
"symbol": "PNG",

View File

@ -2,7 +2,7 @@
"name": "Ape-X",
"website": "https://ape-x.io/",
"description": "Liquidity Generating, Frictionless Yield, and Self Sustaining Smart Contract",
"explorer": "https://cchain.explorer.avax.network/address/0xd039C9079ca7F2a87D632A9C0d7cEa0137bAcFB5",
"explorer": "https://snowtrace.io/address/0xd039C9079ca7F2a87D632A9C0d7cEa0137bAcFB5",
"research": "https://research.binance.com/en/projects/avalanche",
"type": "AVALANCHE",
"symbol": "APE-X",

6
go.mod
View File

@ -4,7 +4,7 @@ go 1.17
require (
github.com/sirupsen/logrus v1.8.1
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209191823-41a485d34f94
github.com/trustwallet/assets-go-libs v0.0.11
)
require (
@ -22,8 +22,8 @@ require (
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.8.1 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/trustwallet/go-libs v0.2.19 // indirect
github.com/trustwallet/go-primitives v0.0.16 // indirect
github.com/trustwallet/go-libs v0.2.20 // indirect
github.com/trustwallet/go-primitives v0.0.17 // indirect
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912 // indirect
golang.org/x/text v0.3.5 // indirect

34
go.sum
View File

@ -272,34 +272,12 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209133216-bfeb25c00fe5 h1:aR5Is4rsq4i4vd5WZQNSql7XWAsFF7/oqqRN9+yVM3Y=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209133216-bfeb25c00fe5/go.mod h1:1TRY/wFNy7fV+avwpMpvA20rn5F8elip4UBE5HkQmgI=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209140210-dcc2c3db3dd1 h1:SSEqBFVEDAWcObPipYJc+eXWc6vmdCwkYs5tTfEeul8=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209140210-dcc2c3db3dd1/go.mod h1:1TRY/wFNy7fV+avwpMpvA20rn5F8elip4UBE5HkQmgI=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209140813-6a8cedf0c6a2 h1:PB6A2AeSH79JTJ4hgyPkkLl8/I3TN7G1jX+18SFrnfM=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209140813-6a8cedf0c6a2/go.mod h1:1TRY/wFNy7fV+avwpMpvA20rn5F8elip4UBE5HkQmgI=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209141303-a7c3afb83543 h1:K2YFKEnGRAUAqOMOU2Mw/+MQ51siKuJZLyeAES3CZZw=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209141303-a7c3afb83543/go.mod h1:1TRY/wFNy7fV+avwpMpvA20rn5F8elip4UBE5HkQmgI=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209142051-534b35c0638b h1:JTvv59KJFq1XCKATInRkGk3FUSXTvQZMyTWVi6Y/4Rw=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209142051-534b35c0638b/go.mod h1:1TRY/wFNy7fV+avwpMpvA20rn5F8elip4UBE5HkQmgI=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209144340-c1f0962f72df h1:KpRBbgPBswjSGr4AyRSOHa1SCuWHk4FJaQVwyiMChEk=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209144340-c1f0962f72df/go.mod h1:1TRY/wFNy7fV+avwpMpvA20rn5F8elip4UBE5HkQmgI=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209144715-a6ecbfaa9b0e h1:B5HP2h0k8Gw5GxG9aomlAtD0vj3JDldgY7OcbJ+IJVk=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209144715-a6ecbfaa9b0e/go.mod h1:1TRY/wFNy7fV+avwpMpvA20rn5F8elip4UBE5HkQmgI=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209145401-967c8a8f5143 h1:IvBJsNqVxNx3GWpKhqe/ANGLzASDAZBh9sNNvPnRi3c=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209145401-967c8a8f5143/go.mod h1:1TRY/wFNy7fV+avwpMpvA20rn5F8elip4UBE5HkQmgI=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209145549-b38b58e9c6c5 h1:ulDhK4LX6Nh6EsQ/lozjgFTwXwmhweJ3+CS5ooiV8P4=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209145549-b38b58e9c6c5/go.mod h1:1TRY/wFNy7fV+avwpMpvA20rn5F8elip4UBE5HkQmgI=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209150306-4e27adeaa175 h1:ZphbKSMWEvMZ/DQcAHtGLqnoGZi3pECK0LZ0Fj9rGPg=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209150306-4e27adeaa175/go.mod h1:1TRY/wFNy7fV+avwpMpvA20rn5F8elip4UBE5HkQmgI=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209184253-ba34649a8816 h1:DjbGqBvE8HQNMbk9IzoGDFggoXjDu9W5WfvBVwc0kZQ=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209184253-ba34649a8816/go.mod h1:1TRY/wFNy7fV+avwpMpvA20rn5F8elip4UBE5HkQmgI=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209191823-41a485d34f94 h1:MkQenzY62ATKjPEON/N9HuDIqKMSxFzXJeJ2wUEaZ90=
github.com/trustwallet/assets-go-libs v0.0.11-0.20211209191823-41a485d34f94/go.mod h1:1TRY/wFNy7fV+avwpMpvA20rn5F8elip4UBE5HkQmgI=
github.com/trustwallet/go-libs v0.2.19 h1:GTdMWYGJpTiWy7XOitveeviQIUYazU4PVxnjUBruT3g=
github.com/trustwallet/go-libs v0.2.19/go.mod h1:7QdAp1lcteKKI0DYqGoaO8KO4eTNYjGmg8vHy0YXkKc=
github.com/trustwallet/go-primitives v0.0.16 h1:RoivfOFmMx8C4felrwWHuIWtWLm7Gd9Fj0mLIBZ8qEY=
github.com/trustwallet/go-primitives v0.0.16/go.mod h1:jLqd7rm+4EYG5JdpxhngM9HwbqfEXzKy/wK4vUB7STs=
github.com/trustwallet/assets-go-libs v0.0.11 h1:r1fLiHTYrzA38xCPmcW3PU0Mr2wRgSl/E/NKXIlHhfE=
github.com/trustwallet/assets-go-libs v0.0.11/go.mod h1:ap6mIFsVjpRI8lXS1UX9/xAwJgaXGm9BHDxAxkQHkFc=
github.com/trustwallet/go-libs v0.2.20 h1:pYstFNgsc7CVyVeYt5GHsMa0JNQHJVRvPQqMvXMpCtY=
github.com/trustwallet/go-libs v0.2.20/go.mod h1:7QdAp1lcteKKI0DYqGoaO8KO4eTNYjGmg8vHy0YXkKc=
github.com/trustwallet/go-primitives v0.0.17 h1:1fBxZMKGCHdHtgdUzsqdFlD21+1GneIk/sxN6jxYBds=
github.com/trustwallet/go-primitives v0.0.17/go.mod h1:jLqd7rm+4EYG5JdpxhngM9HwbqfEXzKy/wK4vUB7STs=
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=

View File

@ -52,8 +52,8 @@ function isAssetInfoHasAllKeys(info: unknown, path: string, isCoin: boolean): [b
// return error, warning, and fixed into if applicable
function isAssetInfoValid(info: unknown, path: string, address: string, chain: string, isCoin: boolean, checkOnly: boolean): [string, string, unknown?] {
let fixedInfo: unknown|null = null;
const isKeys1CorrectType =
let fixedInfo: unknown | null = null;
const isKeys1CorrectType =
typeof info['name'] === "string" && info['name'] !== "" &&
typeof info['type'] === "string" && info['type'] !== "" &&
typeof info['symbol'] === "string" && info['symbol'] !== "" &&
@ -72,7 +72,7 @@ function isAssetInfoValid(info: unknown, path: string, address: string, chain: s
// type
if (!isCoin) { // token
if (chainFromAssetType(info['type'].toUpperCase()) !== chain ) {
if (chainFromAssetType(info['type'].toUpperCase()) !== chain) {
return [`Incorrect value for type '${info['type']}' '${chain}' ${path}`, "", fixedInfo];
}
if (info['type'] !== info['type'].toUpperCase()) {
@ -85,7 +85,7 @@ function isAssetInfoValid(info: unknown, path: string, address: string, chain: s
fixedInfo['type'] = info['type'].toUpperCase();
}
} else { // coin
const expectedType = 'coin';
const expectedType = 'coin';
if (info['type'] !== expectedType) {
if (checkOnly) {
return [`Incorrect value for type '${info['type']}', expected '${expectedType}' '${chain}' ${path}`, "", fixedInfo];
@ -95,19 +95,19 @@ function isAssetInfoValid(info: unknown, path: string, address: string, chain: s
fixedInfo['type'] = expectedType;
}
}
if (!isCoin) {
// id, should match address
if (info['id'] != address) {
if (checkOnly) {
if (checkOnly) {
if (info['id'].toUpperCase() != address.toUpperCase()) {
return [`Incorrect value for id '${info['id']}' '${chain}' ${path}`, "", fixedInfo];
}
// is is correct value, but casing is wrong
return [`Wrong casing for id '${info['id']}' '${chain}' ${path}`, "", fixedInfo];
}
// fix
if (!fixedInfo) { fixedInfo = info; }
}
// fix
if (!fixedInfo) { fixedInfo = info; }
fixedInfo['id'] = address;
}
}
@ -132,7 +132,7 @@ function isAssetInfoValid(info: unknown, path: string, address: string, chain: s
}
}
const isKeys2CorrectType =
const isKeys2CorrectType =
typeof info['description'] === "string" && info['description'] !== "" &&
// website should be set (exception description='-' marks empty infos)
typeof info['website'] === "string" && (info['description'] === "-" || info['website'] !== "") &&
@ -308,7 +308,7 @@ export function explorerUrl(chain: string, contract: string): string {
case "optimism":
return `https://optimistic.etherscan.io/address/${contract}`;
case "avalanchec":
return `https://cchain.explorer.avax.network/address/${contract}`
return `https://snowtrace.io/address/${contract}`
case "arbitrum":
return `https://arbiscan.io/token/${contract}`
case "fantom":
@ -353,7 +353,7 @@ function isAssetInfoOK(chain: string, isCoin: boolean, address: string, errors:
}
let info: unknown = readJsonFile(assetInfoPath);
let fixedInfo: unknown|null = null;
let fixedInfo: unknown | null = null;
const [hasAllKeys, msg1] = isAssetInfoHasAllKeys(info, assetInfoPath, isCoin);
if (!hasAllKeys) {
@ -404,7 +404,7 @@ function isAssetInfoOK(chain: string, isCoin: boolean, address: string, errors:
const explorersAlt = explorerUrlAlternatives(chain, address, info['name']);
if (explorersAlt && explorersAlt.length > 0) {
let matchCount = 0;
explorersAlt.forEach(exp => { if (exp.toLowerCase() == explorerActualLower) { ++matchCount; }});
explorersAlt.forEach(exp => { if (exp.toLowerCase() == explorerActualLower) { ++matchCount; } });
if (matchCount == 0) {
// none matches, this is error
errors.push(`Incorrect explorer, ${explorerActual} instead of ${explorerExpected} (${explorersAlt.join(', ')})`);
@ -424,12 +424,12 @@ function isAssetInfoOK(chain: string, isCoin: boolean, address: string, errors:
if (fixedInfo && !checkOnly) {
writeJsonFile(assetInfoPath, fixedInfo);
console.log(`Done fixes to info.json, ${assetInfoPath}`);
}
}
}
export class AssetInfos implements ActionInterface {
getName(): string { return "Asset Infos"; }
getSanityChecks(): CheckStepInterface[] {
const steps: CheckStepInterface[] = [];
// tokens info.json's
@ -437,7 +437,7 @@ export class AssetInfos implements ActionInterface {
if (isPathExistsSync(getChainAssetsPath(chain))) {
steps.push(
{
getName: () => { return `Token info.json's for chain ${chain}`;},
getName: () => { return `Token info.json's for chain ${chain}`; },
check: async () => {
const errors: string[] = [];
const warnings: string[] = [];
@ -447,7 +447,7 @@ export class AssetInfos implements ActionInterface {
isAssetInfoOK(chain, false, address, errors, warnings, true);
});
return [errors, warnings];
}
}
}
);
}
@ -455,7 +455,7 @@ export class AssetInfos implements ActionInterface {
// coin info.json
steps.push(
{
getName: () => { return `Coin info.json's`;},
getName: () => { return `Coin info.json's`; },
check: async () => {
const errors: string[] = [];
const warnings: string[] = [];