|
1 | 1 | export class AccountChanges { |
2 | | - nonceChanged!: boolean; |
3 | | - balanceChanged!: boolean; |
4 | | - codeHashChanged!: boolean; |
5 | | - rootHashChanged!: boolean; |
6 | | - developerRewardChanged!: boolean; |
7 | | - ownerAddressChanged!: boolean; |
8 | | - userNameChanged!: boolean; |
9 | | - codeMetadataChanged!: boolean; |
10 | | - |
11 | | - constructor(init?: Partial<AccountChanges>) { |
12 | | - Object.assign(this, init); |
13 | | - } |
| 2 | + nonceChanged!: boolean; |
| 3 | + balanceChanged!: boolean; |
| 4 | + codeHashChanged!: boolean; |
| 5 | + rootHashChanged!: boolean; |
| 6 | + developerRewardChanged!: boolean; |
| 7 | + ownerAddressChanged!: boolean; |
| 8 | + userNameChanged!: boolean; |
| 9 | + codeMetadataChanged!: boolean; |
| 10 | + |
| 11 | + constructor(init?: Partial<AccountChanges>) { |
| 12 | + Object.assign(this, init); |
| 13 | + } |
14 | 14 | } |
15 | 15 |
|
16 | 16 | export class StateAccessPerAccountRaw { |
17 | | - type!: number; |
18 | | - index!: number; |
19 | | - txHash!: string; |
20 | | - mainTrieKey!: string; |
21 | | - mainTrieVal!: string; |
22 | | - operation!: number; |
23 | | - dataTrieChanges?: DataTrieChange[]; |
24 | | - accountChanges?: number; |
25 | | - |
26 | | - constructor(init?: Partial<StateAccessPerAccountRaw>) { |
27 | | - Object.assign(this, init); |
28 | | - } |
| 17 | + type!: number; |
| 18 | + index!: number; |
| 19 | + txHash!: string; |
| 20 | + mainTrieKey!: string; |
| 21 | + mainTrieVal!: string; |
| 22 | + operation!: number; |
| 23 | + dataTrieChanges?: DataTrieChange[]; |
| 24 | + accountChanges?: number; |
| 25 | + |
| 26 | + constructor(init?: Partial<StateAccessPerAccountRaw>) { |
| 27 | + Object.assign(this, init); |
| 28 | + } |
29 | 29 | } |
30 | 30 |
|
31 | 31 | export class DataTrieChange { |
32 | | - type!: number; |
33 | | - key!: string; |
34 | | - val!: any; |
35 | | - version!: number; |
36 | | - operation!: DataTrieChangeOperation; |
| 32 | + type!: number; |
| 33 | + key!: string; |
| 34 | + val!: any; |
| 35 | + version!: number; |
| 36 | + operation!: DataTrieChangeOperation; |
37 | 37 | } |
38 | 38 |
|
39 | 39 | export class BlockWithStateChangesRaw { |
40 | | - hash!: string; |
41 | | - shardID!: number; |
42 | | - nonce!: number; |
43 | | - timestampMs!: number; |
44 | | - stateAccessesPerAccounts!: Record<string, { stateAccess: StateAccessPerAccountRaw[] }>; |
45 | | - |
46 | | - constructor(init?: Partial<BlockWithStateChangesRaw>) { |
47 | | - Object.assign(this, init); |
48 | | - } |
| 40 | + hash!: string; |
| 41 | + shardID!: number; |
| 42 | + nonce!: number; |
| 43 | + timestampMs!: number; |
| 44 | + stateAccessesPerAccounts!: Record<string, { stateAccess: StateAccessPerAccountRaw[] }>; |
| 45 | + |
| 46 | + constructor(init?: Partial<BlockWithStateChangesRaw>) { |
| 47 | + Object.assign(this, init); |
| 48 | + } |
49 | 49 | } |
50 | 50 |
|
51 | 51 | export class AccountState { |
52 | | - nonce!: number; |
53 | | - balance!: string; |
54 | | - developerReward!: string; |
55 | | - address!: string; |
56 | | - codeHash?: string; |
57 | | - rootHash!: string; |
58 | | - ownerAddress?: string; |
59 | | - username?: string; |
60 | | - codeMetadata?: string; |
61 | | - |
62 | | - constructor(init?: Partial<AccountState>) { |
63 | | - Object.assign(this, init); |
64 | | - } |
| 52 | + nonce!: number; |
| 53 | + balance!: string; |
| 54 | + developerReward!: string; |
| 55 | + address!: string; |
| 56 | + codeHash?: string; |
| 57 | + rootHash!: string; |
| 58 | + ownerAddress?: string; |
| 59 | + username?: string; |
| 60 | + codeMetadata?: string; |
| 61 | + |
| 62 | + constructor(init?: Partial<AccountState>) { |
| 63 | + Object.assign(this, init); |
| 64 | + } |
65 | 65 | } |
66 | 66 |
|
67 | 67 | export class EsdtState { |
68 | | - identifier!: string; |
69 | | - nonce!: string; |
70 | | - type!: ESDTType; |
71 | | - value!: string; |
72 | | - propertiesHex!: string; |
73 | | - reservedHex!: string; |
74 | | - tokenMetaData!: any; |
75 | | - |
76 | | - constructor(init?: Partial<EsdtState>) { |
77 | | - Object.assign(this, init); |
78 | | - } |
| 68 | + identifier!: string; |
| 69 | + nonce!: string; |
| 70 | + type!: ESDTType; |
| 71 | + value!: string; |
| 72 | + propertiesHex!: string; |
| 73 | + reservedHex!: string; |
| 74 | + tokenMetaData!: any; |
| 75 | + |
| 76 | + constructor(init?: Partial<EsdtState>) { |
| 77 | + Object.assign(this, init); |
| 78 | + } |
79 | 79 | } |
80 | 80 |
|
81 | 81 | export enum ESDTType { |
82 | | - // 0 |
83 | | - Fungible, |
84 | | - // 1 |
85 | | - NonFungible, |
86 | | - // 2 |
87 | | - NonFungibleV2, |
88 | | - // 3 |
89 | | - SemiFungible, |
90 | | - // 4 |
91 | | - MetaFungible, |
92 | | - // 5 |
93 | | - DynamicNFT, |
94 | | - // 6 |
95 | | - DynamicSFT, |
96 | | - // 7 |
97 | | - DynamicMeta, |
| 82 | + // 0 |
| 83 | + Fungible, |
| 84 | + // 1 |
| 85 | + NonFungible, |
| 86 | + // 2 |
| 87 | + NonFungibleV2, |
| 88 | + // 3 |
| 89 | + SemiFungible, |
| 90 | + // 4 |
| 91 | + MetaFungible, |
| 92 | + // 5 |
| 93 | + DynamicNFT, |
| 94 | + // 6 |
| 95 | + DynamicSFT, |
| 96 | + // 7 |
| 97 | + DynamicMeta, |
98 | 98 | } |
99 | 99 |
|
100 | 100 | export class StateChanges { |
101 | | - accountState!: AccountState | undefined; |
102 | | - esdtState!: { |
103 | | - 'Fungible': EsdtState[], |
104 | | - 'NonFungible': EsdtState[], |
105 | | - 'NonFungibleV2': EsdtState[], |
106 | | - 'SemiFungible': EsdtState[], |
107 | | - 'MetaFungible': EsdtState[], |
108 | | - 'DynamicNFT': EsdtState[], |
109 | | - 'DynamicSFT': EsdtState[], |
110 | | - 'DynamicMeta': EsdtState[], |
111 | | - }; |
112 | | - accountChanges!: AccountChanges; |
113 | | - isNewAccount!: boolean; |
114 | | - |
115 | | - constructor(init?: Partial<StateChanges>) { |
116 | | - Object.assign(this, init); |
117 | | - } |
| 101 | + accountState!: AccountState | undefined; |
| 102 | + esdtState!: { |
| 103 | + 'Fungible': EsdtState[], |
| 104 | + 'NonFungible': EsdtState[], |
| 105 | + 'NonFungibleV2': EsdtState[], |
| 106 | + 'SemiFungible': EsdtState[], |
| 107 | + 'MetaFungible': EsdtState[], |
| 108 | + 'DynamicNFT': EsdtState[], |
| 109 | + 'DynamicSFT': EsdtState[], |
| 110 | + 'DynamicMeta': EsdtState[], |
| 111 | + }; |
| 112 | + accountChanges!: AccountChanges; |
| 113 | + isNewAccount!: boolean; |
| 114 | + |
| 115 | + constructor(init?: Partial<StateChanges>) { |
| 116 | + Object.assign(this, init); |
| 117 | + } |
118 | 118 | } |
119 | 119 |
|
120 | 120 | export enum AccountChangesRaw { |
121 | | - NoChange = 0, |
122 | | - NonceChanged = 1 << 0, // 1 |
123 | | - BalanceChanged = 1 << 1, // 2 |
124 | | - CodeHashChanged = 1 << 2, // 4 |
125 | | - RootHashChanged = 1 << 3, // 8 |
126 | | - DeveloperRewardChanged = 1 << 4, // 16 |
127 | | - OwnerAddressChanged = 1 << 5, // 32 |
128 | | - UserNameChanged = 1 << 6, // 64 |
129 | | - CodeMetadataChanged = 1 << 7 // 128 |
| 121 | + NoChange = 0, |
| 122 | + NonceChanged = 1 << 0, // 1 |
| 123 | + BalanceChanged = 1 << 1, // 2 |
| 124 | + CodeHashChanged = 1 << 2, // 4 |
| 125 | + RootHashChanged = 1 << 3, // 8 |
| 126 | + DeveloperRewardChanged = 1 << 4, // 16 |
| 127 | + OwnerAddressChanged = 1 << 5, // 32 |
| 128 | + UserNameChanged = 1 << 6, // 64 |
| 129 | + CodeMetadataChanged = 1 << 7 // 128 |
130 | 130 | } |
131 | 131 |
|
132 | 132 | export enum StateAccessOperation { |
133 | | - NotSet = 0, |
134 | | - GetCode = 1 << 0, |
135 | | - SaveAccount = 1 << 1, |
136 | | - GetAccount = 1 << 2, |
137 | | - WriteCode = 1 << 3, |
138 | | - RemoveDataTrie = 1 << 4, |
139 | | - GetDataTrieValue = 1 << 5, |
| 133 | + NotSet = 0, |
| 134 | + GetCode = 1 << 0, |
| 135 | + SaveAccount = 1 << 1, |
| 136 | + GetAccount = 1 << 2, |
| 137 | + WriteCode = 1 << 3, |
| 138 | + RemoveDataTrie = 1 << 4, |
| 139 | + GetDataTrieValue = 1 << 5, |
140 | 140 | } |
141 | 141 |
|
142 | 142 | export enum DataTrieChangeOperation { |
143 | | - NotDelete = 0, |
144 | | - Delete = 1, |
| 143 | + NotDelete = 0, |
| 144 | + Delete = 1, |
145 | 145 | } |
0 commit comments