[TokenList] Binance tokens list (#4573)

* Update tokenlist.json

* Update tokenlist.json

* Update tokenlist.json
This commit is contained in:
Viktor Radchenko 2020-10-22 21:10:51 -07:00 committed by GitHub
parent dd91344bbe
commit 410d6c57bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 164 additions and 23 deletions

File diff suppressed because it is too large Load Diff

View File

@ -8,21 +8,21 @@
"tokens":[
{
"chainId":1,
"asset":"c60",
"address":"0x6B175474E89094C44Da98b954EedeAC495271d0F",
"name":"Ethereum",
"symbol":"ETH",
"asset":"c60_t0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"address":"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"name":"Wrapped Ethereum",
"symbol":"WETH",
"decimals":18,
"logoURI":"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/info/logo.png",
"logoURI":"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
"pairs":[
{
"base":"c60_t0x6B175474E89094C44Da98b954EedeAC495271d0F",
"pool":"0xA478c2975Ab1Ea89e8196811F51A7B7Ade33eB11"
"base":"c60_t0x6B175474E89094C44Da98b954EedeAC495271d0F"
}
]
},
{
"chainId":1,
"asset":"c60_t0x6B175474E89094C44Da98b954EedeAC495271d0F",
"address":"0x6B175474E89094C44Da98b954EedeAC495271d0F",
"name":"Dai Stablecoin",
"symbol":"DAI",
@ -33,6 +33,7 @@
},
{
"chainId":1,
"asset":"c60_t0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"address":"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"name":"USDC",
"symbol":"USDC",
@ -40,8 +41,7 @@
"logoURI":"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
"pairs":[
{
"base":"c60_t0x6B175474E89094C44Da98b954EedeAC495271d0F",
"pool":"0xAE461cA67B15dc8dc81CE7615e0320dA1A9aB8D5"
"base":"c60_t0x6B175474E89094C44Da98b954EedeAC495271d0F"
}
]
}

View File

@ -11,6 +11,11 @@ import * as config from "../config";
import { CoinType } from "@trustwallet/wallet-core";
import { toSatoshis } from "./numbers";
enum TokenType {
BEP2 = 'BEP2',
ERC20 = 'ERC20'
}
class BinanceMarket {
base_asset_symbol: string
quote_asset_symbol: string
@ -49,6 +54,7 @@ class List {
class TokenItem {
asset: string;
type: string;
address: string;
name: string;
symbol: string;
@ -56,8 +62,9 @@ class TokenItem {
logoURI: string;
pairs: [Pair];
constructor(asset: string, address: string, name: string, symbol: string, decimals: number, logoURI: string, pairs: [Pair]) {
constructor(asset: string, type: string, address: string, name: string, symbol: string, decimals: number, logoURI: string, pairs: [Pair]) {
this.asset = asset
this.type = type
this.address = address
this.name = name;
this.symbol = symbol
@ -154,11 +161,12 @@ async function generateBinanceTokensList(): Promise<[TokenItem]> {
}
return assetID(CoinType.binance, symbol)
}
const list = <[TokenItem]>Array.from(pairsList.values())
const list = <[string]>Array.from(pairsList.values())
return <[TokenItem]>list.map(item => {
const token = tokensMap[item.symbol]
const token = tokensMap[item]
return new TokenItem (
asset(token.symbol),
TokenType.BEP2,
token.symbol,
token.name,
token.symbol,