Skip to content

Commit

Permalink
Add check tokenList.length > 0
Browse files Browse the repository at this point in the history
  • Loading branch information
vikmeup committed May 7, 2021
1 parent afcf28e commit 80221e5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions script/blockchain/binance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ export class BinanceAction implements ActionInterface {
const list = createTokensList("BNB", tokenList,
"2020-10-03T12:37:57.000+00:00", // use constants here to prevent changing time every time
0, 1, 0);
writeToFileWithUpdate(getChainTokenlistPath(Binance), list);
if (tokenList.length > 0) {
writeToFileWithUpdate(getChainTokenlistPath(Binance), list);
}
}
}

Expand All @@ -157,7 +159,7 @@ class BinanceMarket {
async function generateBinanceTokensList(): Promise<TokenItem[]> {
const decimals = CoinType.decimals(CoinType.binance)
const BNBSymbol = CoinType.symbol(CoinType.binance)
const markets: [BinanceMarket] = await axios.get(`${config.binanceDexURL}/v1/markets?limit=500`).then(r => r.data);
const markets: [BinanceMarket] = await axios.get(`${config.binanceDexURL}/v1/markets?limit=10000`).then(r => r.data);
const tokens = await axios.get(`${config.binanceDexURL}/v1/tokens?limit=10000`).then(r => r.data);
const tokensMap = Object.assign({}, ...tokens.map(s => ({[s.symbol]: s})));
const pairsMap = {}
Expand Down

0 comments on commit 80221e5

Please sign in to comment.