trustwallet-assets/script/generic/tokenlists.ts
Adam R 0f1909110d
[Internal] Adjust binance tokenlist generation, fix array types (#5357)
* Move binance tokenlist generation to BinanceAction.

* Fix array types in tokenlists.ts

Co-authored-by: Catenocrypt <catenocrypt@users.noreply.github.com>
2021-01-23 01:04:56 +01:00

73 lines
1.7 KiB
TypeScript

class Version {
major: number
minor: number
patch: number
constructor(major: number, minor: number, patch: number) {
this.major = major
this.minor = minor
this.patch = patch
}
}
class List {
name: string
logoURI: string
timestamp: string
tokens: TokenItem[]
pairs: Pair[]
version: Version
constructor(name: string, logoURI: string, timestamp: string, tokens: TokenItem[], version: Version) {
this.name = name
this.logoURI = logoURI
this.timestamp = timestamp;
this.tokens = tokens
this.version = version
}
}
export class TokenItem {
asset: string;
type: 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
this.decimals = decimals
this.logoURI = logoURI
this.pairs = pairs
}
}
export class Pair {
base: string;
lotSize: string;
tickSize: string;
constructor(base: string, lotSize: string, tickSize: string) {
this.base = base
this.lotSize = lotSize
this.tickSize = tickSize
}
}
export function generateTokensList(titleCoin: string, tokens: TokenItem[]): List {
return new List(
`Trust Wallet: ${titleCoin}`,
"https://trustwallet.com/assets/images/favicon.png",
"2020-10-03T12:37:57.000+00:00",
tokens,
new Version(0, 1, 0)
)
}