Delete use of @trustwallet/types (#2693)

* Delete use of @trustwallet/types

* Add wallet-core support

* Remove cleanup option
This commit is contained in:
Viktor Radchenko 2020-07-11 01:10:28 -07:00 committed by GitHub
parent b82b22261e
commit 4c3b6b1699
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 113 additions and 30 deletions

115
package-lock.json generated
View File

@ -872,6 +872,70 @@
} }
} }
}, },
"@protobufjs/aspromise": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
"integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78=",
"dev": true
},
"@protobufjs/base64": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz",
"integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==",
"dev": true
},
"@protobufjs/codegen": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz",
"integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==",
"dev": true
},
"@protobufjs/eventemitter": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz",
"integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A=",
"dev": true
},
"@protobufjs/fetch": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz",
"integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=",
"dev": true,
"requires": {
"@protobufjs/aspromise": "^1.1.1",
"@protobufjs/inquire": "^1.1.0"
}
},
"@protobufjs/float": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz",
"integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=",
"dev": true
},
"@protobufjs/inquire": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz",
"integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=",
"dev": true
},
"@protobufjs/path": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz",
"integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=",
"dev": true
},
"@protobufjs/pool": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz",
"integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=",
"dev": true
},
"@protobufjs/utf8": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz",
"integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=",
"dev": true
},
"@sindresorhus/is": { "@sindresorhus/is": {
"version": "0.14.0", "version": "0.14.0",
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz",
@ -896,21 +960,13 @@
"defer-to-connect": "^1.0.1" "defer-to-connect": "^1.0.1"
} }
}, },
"@trustwallet/types": { "@trustwallet/wallet-core": {
"version": "0.1.37", "version": "0.0.6",
"resolved": "https://registry.npmjs.org/@trustwallet/types/-/types-0.1.37.tgz", "resolved": "https://registry.npmjs.org/@trustwallet/wallet-core/-/wallet-core-0.0.6.tgz",
"integrity": "sha512-suLzGJJiDyxhhg7HvRkbzsaME6H4AztCuPLdkXSl8eCnadN5E3+FAnAhLFYNaQgNrytTc/qGvGDzihbFqDZVBA==", "integrity": "sha512-8drwuyhFQcgHAEWq8+Gro5X0NZ7TKwNGVmuh5VDUy08fMlYGvw8eIpL6leoNVbS+WDcCDjyGsPuAl0WtHMylzg==",
"dev": true, "dev": true,
"requires": { "requires": {
"bignumber.js": "^9.0.0" "protobufjs": "^6.9.0"
},
"dependencies": {
"bignumber.js": {
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz",
"integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A==",
"dev": true
}
} }
}, },
"@types/babel__core": { "@types/babel__core": {
@ -1013,6 +1069,12 @@
"@types/jest": "*" "@types/jest": "*"
} }
}, },
"@types/long": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz",
"integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==",
"dev": true
},
"@types/node": { "@types/node": {
"version": "13.13.4", "version": "13.13.4",
"resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.4.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.4.tgz",
@ -5912,6 +5974,12 @@
"@sinonjs/commons": "^1.7.0" "@sinonjs/commons": "^1.7.0"
} }
}, },
"long": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz",
"integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==",
"dev": true
},
"loud-rejection": { "loud-rejection": {
"version": "1.6.0", "version": "1.6.0",
"resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz",
@ -6881,6 +6949,27 @@
"sisteransi": "^1.0.4" "sisteransi": "^1.0.4"
} }
}, },
"protobufjs": {
"version": "6.9.0",
"resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.9.0.tgz",
"integrity": "sha512-LlGVfEWDXoI/STstRDdZZKb/qusoAWUnmLg9R8OLSO473mBLWHowx8clbX5/+mKDEI+v7GzjoK9tRPZMMcoTrg==",
"dev": true,
"requires": {
"@protobufjs/aspromise": "^1.1.2",
"@protobufjs/base64": "^1.1.2",
"@protobufjs/codegen": "^2.0.4",
"@protobufjs/eventemitter": "^1.1.0",
"@protobufjs/fetch": "^1.1.0",
"@protobufjs/float": "^1.0.2",
"@protobufjs/inquire": "^1.1.0",
"@protobufjs/path": "^1.1.2",
"@protobufjs/pool": "^1.1.0",
"@protobufjs/utf8": "^1.1.0",
"@types/long": "^4.0.1",
"@types/node": "^13.7.0",
"long": "^4.0.0"
}
},
"proxy-addr": { "proxy-addr": {
"version": "2.0.6", "version": "2.0.6",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz",

View File

@ -4,17 +4,15 @@
"description": "Assets consumed by Trust Wallet", "description": "Assets consumed by Trust Wallet",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"pre-test": "npm run cleanup", "test": "jest",
"test": "npm run pre-test && jest", "update:bep2": "node ./script/updateBEP2",
"cleanup": "find ./.. -iname '.DS_Store' -type f -delete", "checksum": "ts-node ./script/erc20_to_checksum",
"update:bep2": "npm run cleanup && node ./script/updateBEP2", "format:all": "ts-node ./script/format_files_name",
"checksum": "npm run cleanup && ts-node ./script/erc20_to_checksum", "arrange:all": "ts-node ./script/arrange_files",
"format:all": "npm run cleanup && ts-node ./script/format_files_name", "gen:list": "ts-node ./script/gen_list",
"arrange:all": "npm run cleanup && ts-node ./script/arrange_files", "gen:info": "ts-node ./script/gen_info",
"gen:list": "npm run cleanup && ts-node ./script/gen_list",
"gen:info": "npm run cleanup && ts-node ./script/gen_info",
"gen:validators:tezos": "ts-node ./script/gen_validators_tezos", "gen:validators:tezos": "ts-node ./script/gen_validators_tezos",
"resize": "npm run cleanup && ts-node ./script/resize_images", "resize": "ts-node ./script/resize_images",
"map:cmc": "ts-node ./pricing/coinmarketcap/script", "map:cmc": "ts-node ./pricing/coinmarketcap/script",
"magic": "npm run update:bep2 && npm run checksum && npm run resize && npm run gen:list && npm t" "magic": "npm run update:bep2 && npm run checksum && npm run resize && npm run gen:list && npm t"
}, },
@ -38,7 +36,7 @@
}, },
"homepage": "https://github.com/trustwallet/assets#readme", "homepage": "https://github.com/trustwallet/assets#readme",
"devDependencies": { "devDependencies": {
"@trustwallet/types": "^0.1.37", "@trustwallet/wallet-core": "^0.0.6",
"@types/jest": "^25.2.1", "@types/jest": "^25.2.1",
"@types/jest-expect-message": "^1.0.1", "@types/jest-expect-message": "^1.0.1",
"@types/node": "^13.13.4", "@types/node": "^13.13.4",

View File

@ -9,7 +9,6 @@ import {
readFileSync, readFileSync,
getChainAssetLogoPath, getChainAssetLogoPath,
isPathExistsSync, isPathExistsSync,
getChainName,
makeDirSync, makeDirSync,
getChainAssetPath, getChainAssetPath,
ethSidechains, ethSidechains,
@ -17,7 +16,6 @@ import {
getChainWhitelist, getChainWhitelist,
} from "../../src/test/helpers"; } from "../../src/test/helpers";
import { TickerType, mapTiker, PlatformType } from "../../src/test/models"; import { TickerType, mapTiker, PlatformType } from "../../src/test/models";
import { CoinType } from "@trustwallet/types";
// Steps required to run this: // Steps required to run this:
// 1. (Optional) CMC API key already setup, use yours if needed. Install script deps "npm i" if hasn't been run before. // 1. (Optional) CMC API key already setup, use yours if needed. Install script deps "npm i" if hasn't been run before.
@ -56,7 +54,6 @@ const custom: mapTiker[] = [
] ]
const allContracts: mapTiker[] = [] // Temp storage for mapped assets const allContracts: mapTiker[] = [] // Temp storage for mapped assets
let bip44Constants = {}
let bnbOwnerToSymbol = {} // e.g: bnb1tawge8u97slduhhtumm03l4xl4c46dwv5m9yzk: WISH-2D5 let bnbOwnerToSymbol = {} // e.g: bnb1tawge8u97slduhhtumm03l4xl4c46dwv5m9yzk: WISH-2D5
let bnbOriginalSymbolToSymbol = {} // e.g: WISH: WISH-2D5 let bnbOriginalSymbolToSymbol = {} // e.g: WISH: WISH-2D5
@ -96,7 +93,6 @@ async function processCoin(coin) {
id id
}) })
} }
// await getImageIfMissing(getChainName(CoinType.ethereum), checksum, id)
} catch (error) { } catch (error) {
console.log(`Etheruem platform error`, error) console.log(`Etheruem platform error`, error)
break break

View File

@ -4,11 +4,11 @@ import { ValidatorModel } from "./models";
const axios = require('axios') const axios = require('axios')
const Web3 = require('web3') const Web3 = require('web3')
const web3 = new Web3('ws://localhost:8546'); const web3 = new Web3('ws://localhost:8546');
import { CoinTypeUtils, CoinType } from "@trustwallet/types"; import { CoinType } from "@trustwallet/wallet-core";
const sizeOf = require("image-size"); const sizeOf = require("image-size");
const { execSync } = require('child_process'); const { execSync } = require('child_process');
export const getChainName = (id: CoinType): string => CoinTypeUtils.id(id) // 60 => ethereum export const getChainName = (id: CoinType): string => CoinType.id(id) // 60 => ethereum
export const Binance = getChainName(CoinType.binance) export const Binance = getChainName(CoinType.binance)
export const Classic = getChainName(CoinType.classic) export const Classic = getChainName(CoinType.classic)
export const Cosmos = getChainName(CoinType.cosmos) export const Cosmos = getChainName(CoinType.cosmos)