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