-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathesdtToken.model.ts
More file actions
96 lines (90 loc) · 2.51 KB
/
esdtToken.model.ts
File metadata and controls
96 lines (90 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import { Field, ObjectType } from '@nestjs/graphql';
import { AssetsModel } from './assets.model';
import { IEsdtToken } from './esdtToken.interface';
import { RolesModel } from './roles.model';
import { nestedFieldComplexity } from 'src/helpers/complexity/field.estimators';
export enum EsdtTokenType {
FungibleToken = 'FungibleESDT',
FungibleLpToken = 'FungibleESDT-LP',
}
export class BaseEsdtToken {
identifier: string;
decimals: number;
constructor(init?: Partial<BaseEsdtToken>) {
Object.assign(this, init);
}
static toEsdtToken(baseEsdtToken: BaseEsdtToken): EsdtToken {
return new EsdtToken(baseEsdtToken);
}
}
@ObjectType({
implements: () => [IEsdtToken],
})
export class EsdtToken extends BaseEsdtToken implements IEsdtToken {
name: string;
ticker: string;
owner: string;
minted?: string;
burnt?: string;
initialMinted?: string;
@Field()
derivedEGLD: string;
price?: string;
@Field({ nullable: true })
previous24hPrice?: string;
@Field({ nullable: true })
previous7dPrice?: string;
@Field({ nullable: true })
volumeUSD24h?: string;
@Field({ nullable: true })
previous24hVolume?: string;
@Field({ nullable: true })
liquidityUSD?: string;
@Field({ nullable: true })
swapCount24h?: number;
@Field({ nullable: true })
previous24hSwapCount?: number;
@Field({ nullable: true })
trendingScore?: string;
supply?: string;
circulatingSupply?: string;
@Field(() => AssetsModel, {
nullable: true,
complexity: nestedFieldComplexity,
})
assets?: AssetsModel;
transactions: number;
accounts: number;
isPaused: boolean;
canUpgrade: boolean;
canMint: boolean;
canBurn: boolean;
canChangeOwner: boolean;
canPause: boolean;
canFreeze: boolean;
canWipe: boolean;
@Field(() => [RolesModel], {
nullable: true,
complexity: nestedFieldComplexity,
})
roles?: RolesModel[];
type?: string;
balance?: string;
@Field({ nullable: true })
createdAt?: string;
pairAddress?: string;
priceChange24h?: number;
priceChange7d?: number;
tradeChange24h?: number;
volumeUSDChange24h?: number;
constructor(init?: Partial<EsdtToken>) {
super(init);
Object.assign(this, init);
if (init.assets) {
this.assets = new AssetsModel(init.assets);
}
if (init.roles) {
this.roles = init.roles.map((role) => new RolesModel(role));
}
}
}