@typus/typus-sdk 1.4.13 → 1.4.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,12 +4,41 @@ export interface Vault {
|
|
|
4
4
|
id: string;
|
|
5
5
|
depositToken: string;
|
|
6
6
|
rewardToken: string[];
|
|
7
|
-
info:
|
|
8
|
-
config:
|
|
9
|
-
shareSupply:
|
|
7
|
+
info: Info;
|
|
8
|
+
config: Config;
|
|
9
|
+
shareSupply: ShareSupply;
|
|
10
10
|
u64Padding: string[];
|
|
11
11
|
bcsPadding: string[];
|
|
12
12
|
}
|
|
13
|
+
export interface Info {
|
|
14
|
+
index: string;
|
|
15
|
+
round: string;
|
|
16
|
+
portfolio_vault_index: string;
|
|
17
|
+
refresh_ts_ms: string;
|
|
18
|
+
status: string;
|
|
19
|
+
lending_enabled: string;
|
|
20
|
+
price_bp: string;
|
|
21
|
+
bp_incentivised: string;
|
|
22
|
+
fixed_incentivised: string;
|
|
23
|
+
token_decimal: string;
|
|
24
|
+
}
|
|
25
|
+
export interface Config {
|
|
26
|
+
capacity: string;
|
|
27
|
+
lot_size: string;
|
|
28
|
+
min_size: string;
|
|
29
|
+
fee_bp: string;
|
|
30
|
+
utilization_rate_bp: string;
|
|
31
|
+
point_per_hour_bp: string;
|
|
32
|
+
incentive_bp: string;
|
|
33
|
+
incentive_fixed: string;
|
|
34
|
+
}
|
|
35
|
+
export interface ShareSupply {
|
|
36
|
+
active_share: string;
|
|
37
|
+
deactivating_share: string;
|
|
38
|
+
inactive_share: string;
|
|
39
|
+
warmup_share: string;
|
|
40
|
+
snapshot_share: string;
|
|
41
|
+
}
|
|
13
42
|
export declare function getVaultData(config: TypusConfig, input: {
|
|
14
43
|
provider: SuiClient;
|
|
15
44
|
indexes: string[];
|
|
@@ -18,7 +47,7 @@ export declare function getVaultData(config: TypusConfig, input: {
|
|
|
18
47
|
}>;
|
|
19
48
|
export interface Share {
|
|
20
49
|
user: string;
|
|
21
|
-
share:
|
|
50
|
+
share: ShareSupply;
|
|
22
51
|
u64Padding: string[];
|
|
23
52
|
bcsPadding: string[];
|
|
24
53
|
}
|
|
@@ -27,5 +56,5 @@ export declare function getShareData(config: TypusConfig, input: {
|
|
|
27
56
|
user: string;
|
|
28
57
|
indexes: string[];
|
|
29
58
|
}): Promise<{
|
|
30
|
-
[key: string]: Share;
|
|
59
|
+
[key: string]: Share[];
|
|
31
60
|
}>;
|
|
@@ -67,28 +67,57 @@ function getVaultData(config, input) {
|
|
|
67
67
|
var rewardToken = reader.readVec(function (reader) {
|
|
68
68
|
return String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8())));
|
|
69
69
|
});
|
|
70
|
-
var
|
|
70
|
+
var infoArray = reader.readVec(function (reader) {
|
|
71
71
|
return reader.read64();
|
|
72
72
|
});
|
|
73
|
-
var
|
|
73
|
+
var configArray = reader.readVec(function (reader) {
|
|
74
74
|
return reader.read64();
|
|
75
75
|
});
|
|
76
|
+
var info = {
|
|
77
|
+
index: infoArray[0],
|
|
78
|
+
round: infoArray[1],
|
|
79
|
+
portfolio_vault_index: infoArray[2],
|
|
80
|
+
refresh_ts_ms: infoArray[3],
|
|
81
|
+
status: infoArray[4],
|
|
82
|
+
lending_enabled: infoArray[5],
|
|
83
|
+
price_bp: infoArray[6],
|
|
84
|
+
bp_incentivised: infoArray[7],
|
|
85
|
+
fixed_incentivised: infoArray[8],
|
|
86
|
+
token_decimal: infoArray[9],
|
|
87
|
+
};
|
|
88
|
+
var config = {
|
|
89
|
+
capacity: configArray[0],
|
|
90
|
+
lot_size: configArray[1],
|
|
91
|
+
min_size: configArray[2],
|
|
92
|
+
fee_bp: configArray[3],
|
|
93
|
+
utilization_rate_bp: configArray[4],
|
|
94
|
+
point_per_hour_bp: configArray[5],
|
|
95
|
+
incentive_bp: configArray[6],
|
|
96
|
+
incentive_fixed: configArray[7],
|
|
97
|
+
};
|
|
76
98
|
// skip BigVector
|
|
77
99
|
reader.readBytes(32); // id
|
|
78
100
|
reader.readBytes(reader.read8()); // element_type
|
|
79
101
|
reader.read64(); // slice_idx
|
|
80
102
|
reader.read32(); // slice_size
|
|
81
103
|
reader.read64(); // length
|
|
82
|
-
var
|
|
104
|
+
var shareSupplyArray = reader.readVec(function (reader) {
|
|
83
105
|
return reader.read64();
|
|
84
106
|
});
|
|
107
|
+
var shareSupply = {
|
|
108
|
+
active_share: shareSupplyArray[0],
|
|
109
|
+
deactivating_share: shareSupplyArray[1],
|
|
110
|
+
inactive_share: shareSupplyArray[2],
|
|
111
|
+
warmup_share: shareSupplyArray[3],
|
|
112
|
+
snapshot_share: shareSupplyArray[4],
|
|
113
|
+
};
|
|
85
114
|
var u64Padding = reader.readVec(function (reader) {
|
|
86
115
|
return reader.read64();
|
|
87
116
|
});
|
|
88
117
|
var bcsPadding = reader.readVec(function (reader) {
|
|
89
118
|
return reader.read8();
|
|
90
119
|
});
|
|
91
|
-
result[info
|
|
120
|
+
result[info.index] = {
|
|
92
121
|
id: id,
|
|
93
122
|
depositToken: depositToken,
|
|
94
123
|
rewardToken: rewardToken,
|
|
@@ -129,11 +158,20 @@ function getShareData(config, input) {
|
|
|
129
158
|
reader.readVec(function (reader, i) {
|
|
130
159
|
reader.read8();
|
|
131
160
|
var share = reader.readVec(function (reader) {
|
|
161
|
+
var user = (0, utils_1.AddressFromBytes)(reader.readBytes(32));
|
|
162
|
+
var shareSupplyArray = reader.readVec(function (reader) {
|
|
163
|
+
return reader.read64();
|
|
164
|
+
});
|
|
165
|
+
var shareSupply = {
|
|
166
|
+
active_share: shareSupplyArray[0],
|
|
167
|
+
deactivating_share: shareSupplyArray[1],
|
|
168
|
+
inactive_share: shareSupplyArray[2],
|
|
169
|
+
warmup_share: shareSupplyArray[3],
|
|
170
|
+
snapshot_share: shareSupplyArray[4],
|
|
171
|
+
};
|
|
132
172
|
return {
|
|
133
|
-
user:
|
|
134
|
-
share:
|
|
135
|
-
return reader.read64();
|
|
136
|
-
}),
|
|
173
|
+
user: user,
|
|
174
|
+
share: shareSupply,
|
|
137
175
|
u64Padding: reader.readVec(function (reader) {
|
|
138
176
|
return reader.read64();
|
|
139
177
|
}),
|
|
@@ -142,7 +180,8 @@ function getShareData(config, input) {
|
|
|
142
180
|
}),
|
|
143
181
|
};
|
|
144
182
|
});
|
|
145
|
-
|
|
183
|
+
var index = input.indexes.pop();
|
|
184
|
+
result[index] = share;
|
|
146
185
|
});
|
|
147
186
|
return [2 /*return*/, result];
|
|
148
187
|
}
|