mirror of
				https://github.com/Instadapp/trustwallet-assets.git
				synced 2024-07-29 22:37:31 +00:00 
			
		
		
		
	[TokenList] Improve tokentype for binance. Add TokenType
This commit is contained in:
		
							parent
							
								
									1cea1a638e
								
							
						
					
					
						commit
						9d02da5cd3
					
				
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| 
						 | 
				
			
			@ -10,11 +10,7 @@ import { assetID } from "./asset";
 | 
			
		|||
import * as config from "../config";
 | 
			
		||||
import { CoinType } from "@trustwallet/wallet-core";
 | 
			
		||||
import { toSatoshis } from "./numbers";
 | 
			
		||||
 | 
			
		||||
enum TokenType {
 | 
			
		||||
    BEP2 = 'BEP2',
 | 
			
		||||
    ERC20 = 'ERC20'
 | 
			
		||||
}
 | 
			
		||||
import { TokenType } from "./tokentype";
 | 
			
		||||
 | 
			
		||||
class BinanceMarket {
 | 
			
		||||
    base_asset_symbol: string
 | 
			
		||||
| 
						 | 
				
			
			@ -161,15 +157,21 @@ async function generateBinanceTokensList(): Promise<[TokenItem]> {
 | 
			
		|||
        }
 | 
			
		||||
        return assetID(CoinType.binance, symbol)
 | 
			
		||||
    }
 | 
			
		||||
    function tokenType(symbol: string): string {
 | 
			
		||||
        if (symbol == BNBSymbol) {
 | 
			
		||||
            return TokenType.COIN
 | 
			
		||||
        }
 | 
			
		||||
        return TokenType.BEP2
 | 
			
		||||
    }
 | 
			
		||||
    const list = <[string]>Array.from(pairsList.values())
 | 
			
		||||
    return <[TokenItem]>list.map(item => {
 | 
			
		||||
        const token = tokensMap[item]
 | 
			
		||||
        return new TokenItem (
 | 
			
		||||
            asset(token.symbol),
 | 
			
		||||
            TokenType.BEP2,
 | 
			
		||||
            tokenType(token.symbol),
 | 
			
		||||
            token.symbol,
 | 
			
		||||
            token.name,
 | 
			
		||||
            token.symbol,
 | 
			
		||||
            token.original_symbol,
 | 
			
		||||
            decimals,
 | 
			
		||||
            logoURI(token.symbol),
 | 
			
		||||
            pairsMap[token.symbol] || []
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										5
									
								
								script/generic/tokentype.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								script/generic/tokentype.ts
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,5 @@
 | 
			
		|||
export enum TokenType {
 | 
			
		||||
    COIN = 'coin',
 | 
			
		||||
    BEP2 = 'BEP2',
 | 
			
		||||
    ERC20 = 'ERC20'
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user