@typus/typus-sdk 1.4.29 → 1.4.31
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.
- package/dist/config-mainnet.json +20 -4
- package/dist/config-testnet.json +15 -2
- package/dist/src/auto-bid/token-user-entry.d.ts +17 -21
- package/dist/src/auto-bid/token-user-entry.js +21 -21
- package/dist/src/auto-bid/user-entry.d.ts +23 -27
- package/dist/src/auto-bid/user-entry.js +47 -47
- package/dist/src/auto-bid/view-function.d.ts +1 -2
- package/dist/src/auto-bid/view-function.js +6 -6
- package/dist/src/dice/api.d.ts +1 -1
- package/dist/src/dice/api.js +1 -1
- package/dist/src/dice/fetch.js +14 -9
- package/dist/src/dice/user-entry.js +6 -6
- package/dist/src/dice/view-function.js +1 -1
- package/dist/src/typus-dov-single-v2/function/bidding.js +2 -6
- package/dist/src/typus-dov-single-v2/history/user-history.js +1 -1
- package/dist/src/typus-dov-single-v2/user-entry.d.ts +0 -1
- package/dist/src/typus-dov-single-v2/user-entry.js +2 -2
- package/dist/src/typus-perp/user/orderWithBidReceipt.d.ts +1 -1
- package/dist/src/typus-safu/index.d.ts +0 -1
- package/dist/src/typus-safu/index.js +0 -2
- package/dist/src/typus-safu/user-history.d.ts +11 -0
- package/dist/src/typus-safu/user-history.js +256 -194
- package/dist/src/typus-safu/view-function.d.ts +3 -2
- package/dist/src/typus-safu/view-function.js +41 -12
- package/dist/src/utils/api/sentio/leader-board.js +1 -1
- package/dist/src/utils/typusConfig.d.ts +18 -2
- package/dist/src/utils/typusConfig.js +1 -1
- package/package.json +1 -1
|
@@ -35,9 +35,39 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
+
var __values = (this && this.__values) || function(o) {
|
|
39
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
40
|
+
if (m) return m.call(o);
|
|
41
|
+
if (o && typeof o.length === "number") return {
|
|
42
|
+
next: function () {
|
|
43
|
+
if (o && i >= o.length) o = void 0;
|
|
44
|
+
return { value: o && o[i++], done: !o };
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
48
|
+
};
|
|
49
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
50
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
51
|
+
if (!m) return o;
|
|
52
|
+
var i = m.call(o), r, ar = [], e;
|
|
53
|
+
try {
|
|
54
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
55
|
+
}
|
|
56
|
+
catch (error) { e = { error: error }; }
|
|
57
|
+
finally {
|
|
58
|
+
try {
|
|
59
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
60
|
+
}
|
|
61
|
+
finally { if (e) throw e.error; }
|
|
62
|
+
}
|
|
63
|
+
return ar;
|
|
64
|
+
};
|
|
38
65
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
66
|
exports.getUserEvents = getUserEvents;
|
|
40
67
|
exports.parseTxHistory = parseTxHistory;
|
|
68
|
+
exports.getDepositorCashFlows = getDepositorCashFlows;
|
|
69
|
+
var bcs_1 = require("@mysten/bcs");
|
|
70
|
+
var constants_1 = require("../../src/constants");
|
|
41
71
|
function getUserEvents(provider, sender, cursor) {
|
|
42
72
|
return __awaiter(this, void 0, void 0, function () {
|
|
43
73
|
var senderFilter, hasNextPage, datas, result;
|
|
@@ -91,7 +121,7 @@ function parseTxHistory(datas, originPackage // safu package
|
|
|
91
121
|
}
|
|
92
122
|
})
|
|
93
123
|
.reduce(function (promise, event) { return __awaiter(_this, void 0, void 0, function () {
|
|
94
|
-
var txHistory, action, log;
|
|
124
|
+
var txHistory, action, log, reader, Token, asset, decimal;
|
|
95
125
|
return __generator(this, function (_a) {
|
|
96
126
|
switch (_a.label) {
|
|
97
127
|
case 0: return [4 /*yield*/, promise];
|
|
@@ -99,77 +129,91 @@ function parseTxHistory(datas, originPackage // safu package
|
|
|
99
129
|
txHistory = _a.sent();
|
|
100
130
|
action = event.parsedJson.action;
|
|
101
131
|
log = event.parsedJson.log;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
132
|
+
// skip the event without tokenType
|
|
133
|
+
if (event.parsedJson.bcs_padding.length > 0) {
|
|
134
|
+
reader = new bcs_1.BcsReader(new Uint8Array(event.parsedJson.bcs_padding[0]));
|
|
135
|
+
Token = String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8())));
|
|
136
|
+
asset = (0, constants_1.typeArgToAsset)(Token);
|
|
137
|
+
decimal = (0, constants_1.assetToDecimal)(asset);
|
|
138
|
+
// console.log(asset, decimal);
|
|
139
|
+
switch (action) {
|
|
140
|
+
case "raise_fund":
|
|
141
|
+
if (Number(log[2]) + Number(log[3]) + Number(log[4]) > 0) {
|
|
142
|
+
txHistory.push({
|
|
143
|
+
Action: "Deposit",
|
|
144
|
+
Index: log[0],
|
|
145
|
+
Amount: divByDecimal(Number(log[2]) + Number(log[3]) + Number(log[4]), decimal),
|
|
146
|
+
Token: Token,
|
|
147
|
+
Exp: log[6],
|
|
148
|
+
Date: new Date(Number(event.timestampMs)),
|
|
149
|
+
txDigest: event.id.txDigest,
|
|
150
|
+
log: log,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
if (Number(log[5]) > 0) {
|
|
154
|
+
txHistory.push({
|
|
155
|
+
Action: "Compound",
|
|
156
|
+
Index: log[0],
|
|
157
|
+
Amount: divByDecimal(Number(log[5]), decimal),
|
|
158
|
+
Token: Token,
|
|
159
|
+
Exp: log[6],
|
|
160
|
+
Date: new Date(Number(event.timestampMs)),
|
|
161
|
+
txDigest: event.id.txDigest,
|
|
162
|
+
log: log,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
break;
|
|
166
|
+
case "reduce_fund":
|
|
167
|
+
if (Number(log[2]) > 0) {
|
|
168
|
+
txHistory.push({
|
|
169
|
+
Action: "Withdraw",
|
|
170
|
+
Index: log[0],
|
|
171
|
+
Amount: divByDecimal(Number(log[2]), decimal),
|
|
172
|
+
Token: Token,
|
|
173
|
+
Exp: log[5],
|
|
174
|
+
Date: new Date(Number(event.timestampMs)),
|
|
175
|
+
txDigest: event.id.txDigest,
|
|
176
|
+
log: log,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
if (Number(log[3]) > 0) {
|
|
180
|
+
txHistory.push({
|
|
181
|
+
Action: "Unsubscribe",
|
|
182
|
+
Index: log[0],
|
|
183
|
+
Amount: divByDecimal(Number(log[3]), decimal),
|
|
184
|
+
Token: Token,
|
|
185
|
+
Exp: log[5],
|
|
186
|
+
Date: new Date(Number(event.timestampMs)),
|
|
187
|
+
txDigest: event.id.txDigest,
|
|
188
|
+
log: log,
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
if (Number(log[4]) > 0) {
|
|
192
|
+
txHistory.push({
|
|
193
|
+
Action: "Claim",
|
|
194
|
+
Index: log[0],
|
|
195
|
+
Amount: divByDecimal(Number(log[4]), decimal),
|
|
196
|
+
Token: Token,
|
|
197
|
+
Exp: log[5],
|
|
198
|
+
Date: new Date(Number(event.timestampMs)),
|
|
199
|
+
txDigest: event.id.txDigest,
|
|
200
|
+
log: log,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
break;
|
|
204
|
+
case "claim_reward":
|
|
140
205
|
txHistory.push({
|
|
141
|
-
Action: "
|
|
206
|
+
Action: "Harvest Options Profit",
|
|
142
207
|
Index: log[0],
|
|
143
|
-
Amount: Number(log[
|
|
144
|
-
|
|
208
|
+
Amount: divByDecimal(Number(log[2]), decimal),
|
|
209
|
+
Token: Token,
|
|
210
|
+
Exp: undefined,
|
|
145
211
|
Date: new Date(Number(event.timestampMs)),
|
|
146
212
|
txDigest: event.id.txDigest,
|
|
147
213
|
log: log,
|
|
148
214
|
});
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
txHistory.push({
|
|
152
|
-
Action: "Claim",
|
|
153
|
-
Index: log[0],
|
|
154
|
-
Amount: Number(log[4]).toString(),
|
|
155
|
-
Exp: log[5],
|
|
156
|
-
Date: new Date(Number(event.timestampMs)),
|
|
157
|
-
txDigest: event.id.txDigest,
|
|
158
|
-
log: log,
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
break;
|
|
162
|
-
case "claim_reward":
|
|
163
|
-
txHistory.push({
|
|
164
|
-
Action: "Harvest Options Profit",
|
|
165
|
-
Index: log[0],
|
|
166
|
-
Amount: Number(log[2]).toString(),
|
|
167
|
-
Exp: undefined,
|
|
168
|
-
Date: new Date(Number(event.timestampMs)),
|
|
169
|
-
txDigest: event.id.txDigest,
|
|
170
|
-
log: log,
|
|
171
|
-
});
|
|
172
|
-
break;
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
173
217
|
}
|
|
174
218
|
return [2 /*return*/, txHistory];
|
|
175
219
|
}
|
|
@@ -182,131 +226,149 @@ function parseTxHistory(datas, originPackage // safu package
|
|
|
182
226
|
});
|
|
183
227
|
});
|
|
184
228
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
229
|
+
function divByDecimal(numerator, decimal) {
|
|
230
|
+
return (numerator / Math.pow(10, decimal)).toString();
|
|
231
|
+
}
|
|
232
|
+
function getDepositorCashFlows(userHistory) {
|
|
233
|
+
var e_1, _a, e_2, _b;
|
|
234
|
+
var depositorCashFlows = new Map();
|
|
235
|
+
try {
|
|
236
|
+
for (var userHistory_1 = __values(userHistory), userHistory_1_1 = userHistory_1.next(); !userHistory_1_1.done; userHistory_1_1 = userHistory_1.next()) {
|
|
237
|
+
var history_1 = userHistory_1_1.value;
|
|
238
|
+
var index = history_1.Index;
|
|
239
|
+
var _c = __read([history_1.Amount, history_1.Token], 2), amount = _c[0], token = _c[1];
|
|
240
|
+
if (history_1.Action == "Harvest Options Profit") {
|
|
241
|
+
if (depositorCashFlows.has(index)) {
|
|
242
|
+
var depositorCashFlow = depositorCashFlows.get(index);
|
|
243
|
+
var totalHarvest = depositorCashFlow.totalHarvest;
|
|
244
|
+
if (totalHarvest.has(token)) {
|
|
245
|
+
var sum = totalHarvest.get(token);
|
|
246
|
+
totalHarvest.set(token, sum + Number(amount));
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
totalHarvest.set(token, Number(amount));
|
|
250
|
+
}
|
|
251
|
+
depositorCashFlow.totalHarvest = totalHarvest;
|
|
252
|
+
depositorCashFlows.set(index, depositorCashFlow);
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
var totalHarvest = new Map();
|
|
256
|
+
totalHarvest.set(token, Number(amount));
|
|
257
|
+
var depositorCashFlow = {
|
|
258
|
+
D_TOKEN: undefined,
|
|
259
|
+
totalDeposit: 0,
|
|
260
|
+
totalWithdraw: 0,
|
|
261
|
+
totalClaim: 0,
|
|
262
|
+
totalCompound: 0,
|
|
263
|
+
netDeposit: undefined,
|
|
264
|
+
totalHarvest: totalHarvest,
|
|
265
|
+
};
|
|
266
|
+
depositorCashFlows.set(index, depositorCashFlow);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
else if (history_1.Action == "Deposit") {
|
|
270
|
+
if (depositorCashFlows.has(index)) {
|
|
271
|
+
var depositorCashFlow = depositorCashFlows.get(index);
|
|
272
|
+
depositorCashFlow.D_TOKEN = token;
|
|
273
|
+
depositorCashFlow.totalDeposit += Number(amount);
|
|
274
|
+
depositorCashFlows.set(index, depositorCashFlow);
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
var depositorCashFlow = {
|
|
278
|
+
D_TOKEN: token,
|
|
279
|
+
totalDeposit: Number(amount),
|
|
280
|
+
totalWithdraw: 0,
|
|
281
|
+
totalClaim: 0,
|
|
282
|
+
totalCompound: 0,
|
|
283
|
+
netDeposit: undefined,
|
|
284
|
+
totalHarvest: new Map(),
|
|
285
|
+
};
|
|
286
|
+
depositorCashFlows.set(index, depositorCashFlow);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
else if (history_1.Action == "Withdraw") {
|
|
290
|
+
if (depositorCashFlows.has(index)) {
|
|
291
|
+
var depositorCashFlow = depositorCashFlows.get(index);
|
|
292
|
+
depositorCashFlow.D_TOKEN = token;
|
|
293
|
+
depositorCashFlow.totalWithdraw += Number(amount);
|
|
294
|
+
depositorCashFlows.set(index, depositorCashFlow);
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
var depositorCashFlow = {
|
|
298
|
+
D_TOKEN: token,
|
|
299
|
+
totalDeposit: 0,
|
|
300
|
+
totalWithdraw: Number(amount),
|
|
301
|
+
totalClaim: 0,
|
|
302
|
+
totalCompound: 0,
|
|
303
|
+
netDeposit: undefined,
|
|
304
|
+
totalHarvest: new Map(),
|
|
305
|
+
};
|
|
306
|
+
depositorCashFlows.set(index, depositorCashFlow);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
else if (history_1.Action == "Claim") {
|
|
310
|
+
if (depositorCashFlows.has(index)) {
|
|
311
|
+
var depositorCashFlow = depositorCashFlows.get(index);
|
|
312
|
+
depositorCashFlow.D_TOKEN = token;
|
|
313
|
+
depositorCashFlow.totalClaim += Number(amount);
|
|
314
|
+
depositorCashFlows.set(index, depositorCashFlow);
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
var depositorCashFlow = {
|
|
318
|
+
D_TOKEN: token,
|
|
319
|
+
totalDeposit: 0,
|
|
320
|
+
totalWithdraw: 0,
|
|
321
|
+
totalClaim: Number(amount),
|
|
322
|
+
totalCompound: 0,
|
|
323
|
+
netDeposit: undefined,
|
|
324
|
+
totalHarvest: new Map(),
|
|
325
|
+
};
|
|
326
|
+
depositorCashFlows.set(index, depositorCashFlow);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
else if (history_1.Action == "Compound") {
|
|
330
|
+
if (depositorCashFlows.has(index)) {
|
|
331
|
+
var depositorCashFlow = depositorCashFlows.get(index);
|
|
332
|
+
depositorCashFlow.D_TOKEN = token;
|
|
333
|
+
depositorCashFlow.totalCompound += Number(amount);
|
|
334
|
+
depositorCashFlows.set(index, depositorCashFlow);
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
var depositorCashFlow = {
|
|
338
|
+
D_TOKEN: token,
|
|
339
|
+
totalDeposit: 0,
|
|
340
|
+
totalWithdraw: 0,
|
|
341
|
+
totalClaim: 0,
|
|
342
|
+
totalCompound: Number(amount),
|
|
343
|
+
netDeposit: undefined,
|
|
344
|
+
totalHarvest: new Map(),
|
|
345
|
+
};
|
|
346
|
+
depositorCashFlows.set(index, depositorCashFlow);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
352
|
+
finally {
|
|
353
|
+
try {
|
|
354
|
+
if (userHistory_1_1 && !userHistory_1_1.done && (_a = userHistory_1.return)) _a.call(userHistory_1);
|
|
355
|
+
}
|
|
356
|
+
finally { if (e_1) throw e_1.error; }
|
|
357
|
+
}
|
|
358
|
+
try {
|
|
359
|
+
// console.log(depositorCashFlows);
|
|
360
|
+
for (var _d = __values(depositorCashFlows.entries()), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
361
|
+
var _f = __read(_e.value, 2), index = _f[0], share = _f[1];
|
|
362
|
+
share.netDeposit = share.totalDeposit + share.totalCompound - share.totalWithdraw - share.totalClaim;
|
|
363
|
+
depositorCashFlows.set(index, share);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
367
|
+
finally {
|
|
368
|
+
try {
|
|
369
|
+
if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
|
|
370
|
+
}
|
|
371
|
+
finally { if (e_2) throw e_2.error; }
|
|
372
|
+
}
|
|
373
|
+
return depositorCashFlows;
|
|
374
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TypusConfig } from "../../src/utils";
|
|
2
|
+
import { TypusBidReceipt } from "../../src/auto-bid/view-function";
|
|
2
3
|
export interface Vault {
|
|
3
4
|
id: string;
|
|
4
5
|
depositToken: string;
|
|
@@ -12,7 +13,7 @@ export interface Vault {
|
|
|
12
13
|
export interface Info {
|
|
13
14
|
index: string;
|
|
14
15
|
round: string;
|
|
15
|
-
|
|
16
|
+
portfolio_vaultIndex: string;
|
|
16
17
|
refresh_ts_ms: string;
|
|
17
18
|
status: string;
|
|
18
19
|
lending_enabled: string;
|
|
@@ -42,7 +43,7 @@ export interface ShareSupply {
|
|
|
42
43
|
export declare function getVaultData(config: TypusConfig, input: {
|
|
43
44
|
indexes: string[];
|
|
44
45
|
}): Promise<{
|
|
45
|
-
[key: string]: Vault;
|
|
46
|
+
[key: string]: [Vault, TypusBidReceipt | null];
|
|
46
47
|
}>;
|
|
47
48
|
export interface Share {
|
|
48
49
|
user: string;
|
|
@@ -53,7 +53,7 @@ function getVaultData(config, input) {
|
|
|
53
53
|
transactionBlock = new transactions_1.TransactionBlock();
|
|
54
54
|
transactionBlock.moveCall({
|
|
55
55
|
target: "".concat(config.package.safu, "::view_function::get_vault_data_bcs"),
|
|
56
|
-
typeArguments: [],
|
|
56
|
+
typeArguments: ["".concat(config.package.framework, "::vault::TypusBidReceipt")],
|
|
57
57
|
arguments: [transactionBlock.pure(config.registry.safu.safu), transactionBlock.pure(input.indexes)],
|
|
58
58
|
});
|
|
59
59
|
return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transactionBlock })];
|
|
@@ -78,7 +78,7 @@ function getVaultData(config, input) {
|
|
|
78
78
|
var info = {
|
|
79
79
|
index: infoArray[0],
|
|
80
80
|
round: infoArray[1],
|
|
81
|
-
|
|
81
|
+
portfolio_vaultIndex: infoArray[2],
|
|
82
82
|
refresh_ts_ms: infoArray[3],
|
|
83
83
|
status: infoArray[4],
|
|
84
84
|
lending_enabled: infoArray[5],
|
|
@@ -120,16 +120,45 @@ function getVaultData(config, input) {
|
|
|
120
120
|
var bcsPadding = reader.readVec(function (reader) {
|
|
121
121
|
return reader.read8();
|
|
122
122
|
});
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
123
|
+
var has_bid_receipt = reader.read8() > 0;
|
|
124
|
+
if (has_bid_receipt) {
|
|
125
|
+
result[info.index] = [
|
|
126
|
+
{
|
|
127
|
+
id: id,
|
|
128
|
+
depositToken: depositToken,
|
|
129
|
+
rewardToken: rewardToken,
|
|
130
|
+
info: info,
|
|
131
|
+
config: config,
|
|
132
|
+
shareSupply: shareSupply,
|
|
133
|
+
u64Padding: u64Padding,
|
|
134
|
+
bcsPadding: bcsPadding,
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
id: (0, utils_1.AddressFromBytes)(reader.readBytes(32)),
|
|
138
|
+
vid: (0, utils_1.AddressFromBytes)(reader.readBytes(32)),
|
|
139
|
+
index: reader.read64(),
|
|
140
|
+
metadata: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8()))),
|
|
141
|
+
u64_padding: reader.readVec(function (reader) {
|
|
142
|
+
return reader.read64();
|
|
143
|
+
}),
|
|
144
|
+
},
|
|
145
|
+
];
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
result[info.index] = [
|
|
149
|
+
{
|
|
150
|
+
id: id,
|
|
151
|
+
depositToken: depositToken,
|
|
152
|
+
rewardToken: rewardToken,
|
|
153
|
+
info: info,
|
|
154
|
+
config: config,
|
|
155
|
+
shareSupply: shareSupply,
|
|
156
|
+
u64Padding: u64Padding,
|
|
157
|
+
bcsPadding: bcsPadding,
|
|
158
|
+
},
|
|
159
|
+
null,
|
|
160
|
+
];
|
|
161
|
+
}
|
|
133
162
|
});
|
|
134
163
|
return [2 /*return*/, result];
|
|
135
164
|
}
|