@typus/typus-sdk 1.8.41 → 1.8.43-upgrade
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/src/auto-bid/view-function.d.ts +0 -2
- package/dist/src/auto-bid/view-function.js +7 -76
- package/dist/src/constants/constant.d.ts +0 -3
- package/dist/src/constants/constant.js +1 -8
- package/dist/src/constants/token.d.ts +1 -1
- package/dist/src/constants/token.js +12 -0
- package/dist/src/dice/fetch.d.ts +0 -4
- package/dist/src/dice/fetch.js +59 -116
- package/dist/src/typus/airdrop/view-function.js +5 -8
- package/dist/src/typus/leaderboard/view-function.js +5 -8
- package/dist/src/typus/tails-staking/view-function.js +10 -14
- package/dist/src/typus/user/view-function.js +5 -6
- package/dist/src/typus-dov-single-v2/function/bidding.d.ts +4 -3
- package/dist/src/typus-dov-single-v2/function/bidding.js +10 -11
- package/dist/src/typus-dov-single-v2/function/token.js +1 -1
- package/dist/src/typus-dov-single-v2/history/index.d.ts +0 -1
- package/dist/src/typus-dov-single-v2/history/index.js +0 -1
- package/dist/src/typus-dov-single-v2/history/user-history.d.ts +2 -3
- package/dist/src/typus-dov-single-v2/history/user-history.js +122 -184
- package/dist/src/typus-dov-single-v2/otc-entry.js +5 -6
- package/dist/src/typus-dov-single-v2/user-entry.d.ts +1 -1
- package/dist/src/typus-dov-single-v2/view-function.js +29 -27
- package/dist/src/typus-hedge/view-function.js +10 -10
- package/dist/src/typus-launch/airdrop/view-function.js +3 -5
- package/dist/src/typus-launch/auction/view-function.js +17 -16
- package/dist/src/typus-launch/funding-vault/view-function.js +20 -18
- package/dist/src/typus-launch/improvement-proposal/view-function.js +17 -18
- package/dist/src/typus-launch/ve-typus/view-function.js +15 -15
- package/dist/src/typus-safu/view-function.js +13 -13
- package/dist/src/utils/api/price.js +1 -1
- package/dist/src/utils/graphQl.d.ts +24 -0
- package/dist/src/utils/graphQl.js +129 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/index.js +1 -0
- package/dist/src/utils/oracle.js +13 -14
- package/dist/src/utils/pyth/constant.js +4 -0
- package/dist/src/utils/sponsoredTx.d.ts +2 -2
- package/dist/src/utils/typusConfig.d.ts +4 -0
- package/dist/src/utils/typusConfig.js +33 -31
- package/package.json +9 -10
- package/dist/src/dice/view-function.d.ts +0 -1
- package/dist/src/dice/view-function.js +0 -20
- package/dist/src/typus-dov-single-v2/history/vault-history.d.ts +0 -123
- package/dist/src/typus-dov-single-v2/history/vault-history.js +0 -307
- package/dist/src/typus-nft/fetch.d.ts +0 -70
- package/dist/src/typus-nft/fetch.js +0 -631
- package/dist/src/typus-nft/index.d.ts +0 -2
- package/dist/src/typus-nft/index.js +0 -18
- package/dist/src/typus-nft/user-entry.d.ts +0 -57
- package/dist/src/typus-nft/user-entry.js +0 -161
|
@@ -68,7 +68,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
68
68
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
69
69
|
exports.getExerciseFromSentio = exports.getNewBidFromSentio = void 0;
|
|
70
70
|
exports.getUserEvents = getUserEvents;
|
|
71
|
-
exports.getAutoBidEvents = getAutoBidEvents;
|
|
72
71
|
exports.parseTxHistory = parseTxHistory;
|
|
73
72
|
exports.parseVaultInfo = parseVaultInfo;
|
|
74
73
|
exports.getDepositorCashFlows = getDepositorCashFlows;
|
|
@@ -79,70 +78,17 @@ var events_1 = require("../../../src/utils/api/sentio/events");
|
|
|
79
78
|
Object.defineProperty(exports, "getNewBidFromSentio", { enumerable: true, get: function () { return events_1.getNewBidFromSentio; } });
|
|
80
79
|
Object.defineProperty(exports, "getExerciseFromSentio", { enumerable: true, get: function () { return events_1.getExerciseFromSentio; } });
|
|
81
80
|
var valut_1 = require("../../../src/constants/valut");
|
|
82
|
-
|
|
81
|
+
var graphQl_1 = require("../../../src/utils/graphQl");
|
|
82
|
+
function getUserEvents(graphQlClient, sender, cursor) {
|
|
83
83
|
return __awaiter(this, void 0, void 0, function () {
|
|
84
|
-
var
|
|
84
|
+
var events;
|
|
85
85
|
return __generator(this, function (_a) {
|
|
86
86
|
switch (_a.label) {
|
|
87
|
-
case 0:
|
|
88
|
-
senderFilter = {
|
|
89
|
-
Sender: sender,
|
|
90
|
-
};
|
|
91
|
-
hasNextPage = true;
|
|
92
|
-
datas = [];
|
|
93
|
-
_a.label = 1;
|
|
87
|
+
case 0: return [4 /*yield*/, (0, graphQl_1.getEvents)(graphQlClient, null, sender, cursor)];
|
|
94
88
|
case 1:
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
order: "ascending",
|
|
99
|
-
cursor: cursor,
|
|
100
|
-
})];
|
|
101
|
-
case 2:
|
|
102
|
-
result = _a.sent();
|
|
103
|
-
// console.log(result);
|
|
104
|
-
hasNextPage = result.hasNextPage;
|
|
105
|
-
cursor = result.nextCursor;
|
|
106
|
-
// @ts-ignore
|
|
107
|
-
datas = datas.concat(result.data);
|
|
108
|
-
return [3 /*break*/, 1];
|
|
109
|
-
case 3: return [2 /*return*/, [datas, cursor]];
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
function getAutoBidEvents(provider, originPackage, startTimeMs) {
|
|
115
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
116
|
-
var moduleFilter, hasNextPage, cursor, datas, result;
|
|
117
|
-
return __generator(this, function (_a) {
|
|
118
|
-
switch (_a.label) {
|
|
119
|
-
case 0:
|
|
120
|
-
moduleFilter = {
|
|
121
|
-
MoveModule: { package: originPackage, module: "auto_bid" },
|
|
122
|
-
};
|
|
123
|
-
hasNextPage = true;
|
|
124
|
-
cursor = undefined;
|
|
125
|
-
datas = [];
|
|
126
|
-
_a.label = 1;
|
|
127
|
-
case 1:
|
|
128
|
-
if (!hasNextPage) return [3 /*break*/, 3];
|
|
129
|
-
return [4 /*yield*/, provider.queryEvents({
|
|
130
|
-
query: moduleFilter,
|
|
131
|
-
order: "descending",
|
|
132
|
-
cursor: cursor,
|
|
133
|
-
})];
|
|
134
|
-
case 2:
|
|
135
|
-
result = _a.sent();
|
|
136
|
-
// console.log(result);
|
|
137
|
-
hasNextPage = result.hasNextPage;
|
|
138
|
-
cursor = result.nextCursor;
|
|
139
|
-
// @ts-ignore
|
|
140
|
-
datas = datas.concat(result.data);
|
|
141
|
-
if (hasNextPage && Number(result.data[result.data.length - 1].timestampMs) < startTimeMs) {
|
|
142
|
-
return [3 /*break*/, 3];
|
|
143
|
-
}
|
|
144
|
-
return [3 /*break*/, 1];
|
|
145
|
-
case 3: return [2 /*return*/, datas];
|
|
89
|
+
events = _a.sent();
|
|
90
|
+
// console.log(events.map(x => x.timestamp))
|
|
91
|
+
return [2 /*return*/, events.reverse()];
|
|
146
92
|
}
|
|
147
93
|
});
|
|
148
94
|
});
|
|
@@ -155,25 +101,16 @@ function parseTxHistory(datas, vaults) {
|
|
|
155
101
|
switch (_a.label) {
|
|
156
102
|
case 0: return [4 /*yield*/, datas
|
|
157
103
|
.filter(function (event) {
|
|
158
|
-
var type = event.type;
|
|
159
|
-
return (event.
|
|
104
|
+
var type = event.contents.type.repr;
|
|
105
|
+
return (event.transactionModule == "tds_user_entry" ||
|
|
160
106
|
type.includes("typus_dov_single") ||
|
|
161
107
|
type.includes("auto_bid") ||
|
|
162
108
|
type.includes("typus_nft::First") ||
|
|
163
109
|
type.includes("typus_nft::ExpUpEvent") ||
|
|
164
110
|
type.includes("tails_staking"));
|
|
165
|
-
})
|
|
166
|
-
.sort(function (a, b) {
|
|
167
|
-
// From Old to New!
|
|
168
|
-
if (a.timestampMs == b.timestampMs) {
|
|
169
|
-
return Number(a.id.eventSeq) - Number(b.id.eventSeq);
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
return Number(a.timestampMs) - Number(b.timestampMs);
|
|
173
|
-
}
|
|
174
111
|
})
|
|
175
112
|
.reduce(function (promise, event) { return __awaiter(_this, void 0, void 0, function () {
|
|
176
|
-
var txHistory, functionType, action, Action, Amount, Index, Period, Vault, RiskLevel, Tails, Exp, d_token, b_token, o_token, token, amount, i, i, i, token, amount, token, amount, amount, token, amount, token, amount, token, amount, b_token_name, b_token_amount, i_token_name, i_token_amount, token, amount, token, amount, deposit_amount, deposit_amount, balance, balance, profit, profit, token, amount, amount, token, amount, size, token, amount, token, amount, size, bidder_balance;
|
|
113
|
+
var txHistory, functionType, action, json, Action, Amount, Index, Period, Vault, RiskLevel, Tails, Exp, d_token, b_token, o_token, token, amount, i, i, i, token, amount, token, amount, amount, token, amount, token, amount, token, amount, b_token_name, b_token_amount, i_token_name, i_token_amount, token, amount, token, amount, deposit_amount, deposit_amount, balance, balance, profit, profit, token, amount, amount, token, amount, size, token, amount, token, amount, size, bidder_balance;
|
|
177
114
|
var _a, _b, _c;
|
|
178
115
|
var _d;
|
|
179
116
|
return __generator(this, function (_e) {
|
|
@@ -181,10 +118,11 @@ function parseTxHistory(datas, vaults) {
|
|
|
181
118
|
case 0: return [4 /*yield*/, promise];
|
|
182
119
|
case 1:
|
|
183
120
|
txHistory = _e.sent();
|
|
184
|
-
functionType = (_d = new RegExp("^([^::]+)::([^::]+)::([^<]+)").exec(event.type)) === null || _d === void 0 ? void 0 : _d.slice(1, 4);
|
|
121
|
+
functionType = (_d = new RegExp("^([^::]+)::([^::]+)::([^<]+)").exec(event.contents.type.repr)) === null || _d === void 0 ? void 0 : _d.slice(1, 4);
|
|
185
122
|
action = functionType[2];
|
|
123
|
+
json = event.contents.json;
|
|
186
124
|
Tails = undefined;
|
|
187
|
-
Index =
|
|
125
|
+
Index = json.index || json.vault_index;
|
|
188
126
|
if (Index) {
|
|
189
127
|
_a = __read(parseVaultInfo(vaults, Index, action), 6), Period = _a[0], Vault = _a[1], RiskLevel = _a[2], d_token = _a[3], b_token = _a[4], o_token = _a[5];
|
|
190
128
|
}
|
|
@@ -193,30 +131,30 @@ function parseTxHistory(datas, vaults) {
|
|
|
193
131
|
case "StakeTailsEvent":
|
|
194
132
|
Action = "Stake";
|
|
195
133
|
Amount = "0.05 SUI";
|
|
196
|
-
Tails = "#".concat(
|
|
134
|
+
Tails = "#".concat(json.log[0]);
|
|
197
135
|
break;
|
|
198
136
|
case "UnstakeTailsEvent":
|
|
199
137
|
Action = "Unstake";
|
|
200
|
-
Tails = "#".concat(
|
|
138
|
+
Tails = "#".concat(json.log[0]);
|
|
201
139
|
break;
|
|
202
140
|
case "DailySignUpEvent":
|
|
203
141
|
Action = "Check In";
|
|
204
|
-
if (
|
|
205
|
-
Amount = "".concat(Number(
|
|
142
|
+
if (json.log[1]) {
|
|
143
|
+
Amount = "".concat(Number(json.log[1]) / Math.pow(10, 9), " SUI");
|
|
206
144
|
}
|
|
207
|
-
Tails =
|
|
208
|
-
Exp =
|
|
145
|
+
Tails = json.tails.map(function (num) { return "#".concat(num); }).join(" ");
|
|
146
|
+
Exp = json.log[0];
|
|
209
147
|
break;
|
|
210
148
|
case "TransferTailsEvent":
|
|
211
149
|
Action = "Transfer";
|
|
212
150
|
Amount = "0.01 SUI";
|
|
213
|
-
Tails = "#".concat(
|
|
151
|
+
Tails = "#".concat(json.log[0]);
|
|
214
152
|
break;
|
|
215
153
|
case "ExpUpEvent":
|
|
216
|
-
if (
|
|
154
|
+
if (json.log) {
|
|
217
155
|
Action = "Train Tail";
|
|
218
|
-
Tails = "#".concat(
|
|
219
|
-
Exp =
|
|
156
|
+
Tails = "#".concat(json.log[0]);
|
|
157
|
+
Exp = json.log[1];
|
|
220
158
|
if (Number(Exp) == 0) {
|
|
221
159
|
return [2 /*return*/, txHistory];
|
|
222
160
|
}
|
|
@@ -224,21 +162,21 @@ function parseTxHistory(datas, vaults) {
|
|
|
224
162
|
break;
|
|
225
163
|
case "ExpDownEvent":
|
|
226
164
|
Action = "Extract Exp";
|
|
227
|
-
Tails = "#".concat(
|
|
228
|
-
Exp =
|
|
165
|
+
Tails = "#".concat(json.log[0]);
|
|
166
|
+
Exp = json.log[1];
|
|
229
167
|
break;
|
|
230
168
|
case "LevelUpEvent":
|
|
231
|
-
if (
|
|
232
|
-
Action = "Level Up to Level ".concat(
|
|
233
|
-
Tails = "#".concat(
|
|
169
|
+
if (json.log) {
|
|
170
|
+
Action = "Level Up to Level ".concat(json.log[1]);
|
|
171
|
+
Tails = "#".concat(json.log[0]);
|
|
234
172
|
}
|
|
235
173
|
break;
|
|
236
174
|
case "ClaimProfitSharingEvent":
|
|
237
|
-
if (
|
|
238
|
-
token = (0, constants_1.typeArgToAsset)("0x" +
|
|
239
|
-
amount = Number(
|
|
175
|
+
if (json.profit_asset) {
|
|
176
|
+
token = (0, constants_1.typeArgToAsset)("0x" + json.profit_asset);
|
|
177
|
+
amount = Number(json.log[0]) / Math.pow(10, (0, constants_1.assetToDecimal)(token));
|
|
240
178
|
Action = "Harvest Dice Profit";
|
|
241
|
-
Tails =
|
|
179
|
+
Tails = json.tails.map(function (num) { return "#".concat(num); }).join(" ");
|
|
242
180
|
Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
|
|
243
181
|
}
|
|
244
182
|
break;
|
|
@@ -246,23 +184,23 @@ function parseTxHistory(datas, vaults) {
|
|
|
246
184
|
case "StakeNftEvent":
|
|
247
185
|
Action = "Stake";
|
|
248
186
|
Amount = "0.05 SUI";
|
|
249
|
-
Tails = "#".concat(
|
|
187
|
+
Tails = "#".concat(json.number);
|
|
250
188
|
break;
|
|
251
189
|
case "UnstakeNftEvent":
|
|
252
190
|
Action = "Unstake";
|
|
253
|
-
Tails = "#".concat(
|
|
191
|
+
Tails = "#".concat(json.number);
|
|
254
192
|
break;
|
|
255
193
|
case "ExpUpEvent":
|
|
256
|
-
i = txHistory.findIndex(function (x) { return x.txDigest == event.
|
|
194
|
+
i = txHistory.findIndex(function (x) { return x.txDigest == event.transaction.digest && x.Action != "First Deposit" && x.Action != "Stake"; });
|
|
257
195
|
if (i != -1 && txHistory[i].Tails == undefined) {
|
|
258
|
-
txHistory[i].Tails = "#".concat(
|
|
259
|
-
txHistory[i].Exp =
|
|
196
|
+
txHistory[i].Tails = "#".concat(json.number);
|
|
197
|
+
txHistory[i].Exp = json.exp_earn;
|
|
260
198
|
return [2 /*return*/, txHistory];
|
|
261
199
|
}
|
|
262
200
|
else if (event.id.eventSeq == 0) {
|
|
263
201
|
Action = "Collect EXP";
|
|
264
|
-
Tails = "#".concat(
|
|
265
|
-
Exp =
|
|
202
|
+
Tails = "#".concat(json.number);
|
|
203
|
+
Exp = json.exp_earn;
|
|
266
204
|
}
|
|
267
205
|
else {
|
|
268
206
|
return [2 /*return*/, txHistory];
|
|
@@ -271,10 +209,10 @@ function parseTxHistory(datas, vaults) {
|
|
|
271
209
|
case "TransferNftEvent":
|
|
272
210
|
Action = "Transfer";
|
|
273
211
|
Amount = "0.01 SUI";
|
|
274
|
-
Tails = "#".concat(
|
|
212
|
+
Tails = "#".concat(json.number);
|
|
275
213
|
break;
|
|
276
214
|
case "DailyAttendEvent":
|
|
277
|
-
i = txHistory.findIndex(function (x) { return x.txDigest == event.
|
|
215
|
+
i = txHistory.findIndex(function (x) { return x.txDigest == event.transaction.digest && x.Action == "Collect EXP"; });
|
|
278
216
|
if (i != -1) {
|
|
279
217
|
txHistory[i].Action = "Check In";
|
|
280
218
|
return [2 /*return*/, txHistory];
|
|
@@ -282,18 +220,18 @@ function parseTxHistory(datas, vaults) {
|
|
|
282
220
|
break;
|
|
283
221
|
case "FirstDepositEvent":
|
|
284
222
|
Action = "First Deposit";
|
|
285
|
-
Tails = "#".concat(
|
|
286
|
-
Exp =
|
|
223
|
+
Tails = "#".concat(json.number);
|
|
224
|
+
Exp = json.exp_earn;
|
|
287
225
|
break;
|
|
288
226
|
case "FirstBidEvent":
|
|
289
227
|
Action = "First Bid";
|
|
290
|
-
Tails = "#".concat(
|
|
291
|
-
Exp =
|
|
228
|
+
Tails = "#".concat(json.number);
|
|
229
|
+
Exp = json.exp_earn;
|
|
292
230
|
break;
|
|
293
231
|
case "LevelUpEvent":
|
|
294
|
-
Action = "Level Up to Level ".concat(
|
|
295
|
-
if (
|
|
296
|
-
Tails = "#".concat(
|
|
232
|
+
Action = "Level Up to Level ".concat(json.level);
|
|
233
|
+
if (json.number) {
|
|
234
|
+
Tails = "#".concat(json.number);
|
|
297
235
|
break;
|
|
298
236
|
}
|
|
299
237
|
else {
|
|
@@ -305,9 +243,9 @@ function parseTxHistory(datas, vaults) {
|
|
|
305
243
|
case "ClaimEvent":
|
|
306
244
|
case "CompoundEvent":
|
|
307
245
|
case "HarvestEvent":
|
|
308
|
-
i = txHistory.findIndex(function (x) { return x.txDigest == event.
|
|
309
|
-
token = (0, constants_1.typeArgToAsset)("0x" +
|
|
310
|
-
amount = Number(
|
|
246
|
+
i = txHistory.findIndex(function (x) { return x.txDigest == event.transaction.digest && x.Action == "Collect EXP"; });
|
|
247
|
+
token = (0, constants_1.typeArgToAsset)("0x" + json.token);
|
|
248
|
+
amount = Number(json.amount) / Math.pow(10, Number(json.decimal));
|
|
311
249
|
Action = action.slice(0, action.length - 5);
|
|
312
250
|
if (Action == "Harvest") {
|
|
313
251
|
Action = "Harvest Reward";
|
|
@@ -324,30 +262,30 @@ function parseTxHistory(datas, vaults) {
|
|
|
324
262
|
}
|
|
325
263
|
break;
|
|
326
264
|
case "RaiseFundEvent":
|
|
327
|
-
Index =
|
|
265
|
+
Index = json.log[0];
|
|
328
266
|
_b = __read(parseVaultInfo(vaults, Index, action), 6), Period = _b[0], Vault = _b[1], RiskLevel = _b[2], d_token = _b[3], b_token = _b[4], o_token = _b[5];
|
|
329
|
-
token = (0, constants_1.typeArgToAsset)("0x" +
|
|
330
|
-
if (
|
|
267
|
+
token = (0, constants_1.typeArgToAsset)("0x" + json.token);
|
|
268
|
+
if (json.log[4] > 0) {
|
|
331
269
|
// deposit
|
|
332
270
|
Action = "Deposit";
|
|
333
|
-
amount = Number(
|
|
271
|
+
amount = Number(json.log[4]) / Math.pow(10, (0, constants_1.assetToDecimal)(token));
|
|
334
272
|
Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
|
|
335
273
|
}
|
|
336
|
-
else if (
|
|
274
|
+
else if (json.log[5] > 0) {
|
|
337
275
|
// compound
|
|
338
276
|
Action = "Compound";
|
|
339
|
-
amount = Number(
|
|
277
|
+
amount = Number(json.log[5]) / Math.pow(10, (0, constants_1.assetToDecimal)(token));
|
|
340
278
|
Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
|
|
341
279
|
}
|
|
342
280
|
break;
|
|
343
281
|
case "ReduceFundEvent":
|
|
344
|
-
Index =
|
|
282
|
+
Index = json.log[0];
|
|
345
283
|
_c = __read(parseVaultInfo(vaults, Index, action), 6), Period = _c[0], Vault = _c[1], RiskLevel = _c[2], d_token = _c[3], b_token = _c[4], o_token = _c[5];
|
|
346
|
-
if (
|
|
284
|
+
if (json.log[4] > 0) {
|
|
347
285
|
// withdraw
|
|
348
286
|
Action = "Withdraw";
|
|
349
|
-
token = (0, constants_1.typeArgToAsset)("0x" +
|
|
350
|
-
amount = Number(
|
|
287
|
+
token = (0, constants_1.typeArgToAsset)("0x" + json.d_token);
|
|
288
|
+
amount = Number(json.log[4]) / Math.pow(10, (0, constants_1.assetToDecimal)(token));
|
|
351
289
|
Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
|
|
352
290
|
txHistory.push({
|
|
353
291
|
Index: Index,
|
|
@@ -358,15 +296,15 @@ function parseTxHistory(datas, vaults) {
|
|
|
358
296
|
RiskLevel: RiskLevel,
|
|
359
297
|
Tails: Tails,
|
|
360
298
|
Exp: Exp,
|
|
361
|
-
Date: new Date(
|
|
362
|
-
txDigest: event.
|
|
299
|
+
Date: new Date(event.timestamp),
|
|
300
|
+
txDigest: event.transaction.digest,
|
|
363
301
|
});
|
|
364
302
|
}
|
|
365
|
-
if (
|
|
303
|
+
if (json.log[5] > 0) {
|
|
366
304
|
// unsubscribe
|
|
367
305
|
Action = "Unsubscribe";
|
|
368
|
-
token = (0, constants_1.typeArgToAsset)("0x" +
|
|
369
|
-
amount = Number(
|
|
306
|
+
token = (0, constants_1.typeArgToAsset)("0x" + json.d_token);
|
|
307
|
+
amount = Number(json.log[5]) / Math.pow(10, (0, constants_1.assetToDecimal)(token));
|
|
370
308
|
Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
|
|
371
309
|
txHistory.push({
|
|
372
310
|
Index: Index,
|
|
@@ -377,15 +315,15 @@ function parseTxHistory(datas, vaults) {
|
|
|
377
315
|
RiskLevel: RiskLevel,
|
|
378
316
|
Tails: Tails,
|
|
379
317
|
Exp: Exp,
|
|
380
|
-
Date: new Date(
|
|
381
|
-
txDigest: event.
|
|
318
|
+
Date: new Date(event.timestamp),
|
|
319
|
+
txDigest: event.transaction.digest,
|
|
382
320
|
});
|
|
383
321
|
}
|
|
384
|
-
if (
|
|
322
|
+
if (json.log[9] > 0) {
|
|
385
323
|
// claim
|
|
386
324
|
Action = "Claim";
|
|
387
|
-
token = (0, constants_1.typeArgToAsset)("0x" +
|
|
388
|
-
amount = Number(
|
|
325
|
+
token = (0, constants_1.typeArgToAsset)("0x" + json.d_token);
|
|
326
|
+
amount = Number(json.log[9]) / Math.pow(10, (0, constants_1.assetToDecimal)(token));
|
|
389
327
|
Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
|
|
390
328
|
txHistory.push({
|
|
391
329
|
Index: Index,
|
|
@@ -396,21 +334,21 @@ function parseTxHistory(datas, vaults) {
|
|
|
396
334
|
RiskLevel: RiskLevel,
|
|
397
335
|
Tails: Tails,
|
|
398
336
|
Exp: Exp,
|
|
399
|
-
Date: new Date(
|
|
400
|
-
txDigest: event.
|
|
337
|
+
Date: new Date(event.timestamp),
|
|
338
|
+
txDigest: event.transaction.digest,
|
|
401
339
|
});
|
|
402
340
|
}
|
|
403
|
-
if (
|
|
341
|
+
if (json.log[6] > 0 && json.log[10] > 0) {
|
|
404
342
|
// Harvest d token and i token
|
|
405
343
|
Action = "Harvest Reward";
|
|
406
|
-
b_token_name = (0, constants_1.typeArgToAsset)("0x" +
|
|
407
|
-
b_token_amount = Number(
|
|
408
|
-
i_token_name = (0, constants_1.typeArgToAsset)("0x" +
|
|
409
|
-
i_token_amount = Number(
|
|
344
|
+
b_token_name = (0, constants_1.typeArgToAsset)("0x" + json.b_token);
|
|
345
|
+
b_token_amount = Number(json.log[6]) / Math.pow(10, (0, constants_1.assetToDecimal)(b_token_name));
|
|
346
|
+
i_token_name = (0, constants_1.typeArgToAsset)("0x" + json.i_token);
|
|
347
|
+
i_token_amount = Number(json.log[10]) / Math.pow(10, (0, constants_1.assetToDecimal)(i_token_name));
|
|
410
348
|
Amount = "".concat((0, bignumber_js_1.default)(b_token_amount).toFixed(), " ").concat(b_token_name, "\n").concat((0, bignumber_js_1.default)(i_token_amount).toFixed(), " ").concat(i_token_name);
|
|
411
349
|
// var amount =
|
|
412
|
-
// Number(
|
|
413
|
-
// Number(
|
|
350
|
+
// Number(json.log[6]) / 10 ** assetToDecimal(token)!
|
|
351
|
+
// Number(json.log[10]) / 10 ** assetToDecimal(token)!;
|
|
414
352
|
// Amount = `${BigNumber(amount).toFixed()} ${token}`;
|
|
415
353
|
txHistory.push({
|
|
416
354
|
Index: Index,
|
|
@@ -421,16 +359,16 @@ function parseTxHistory(datas, vaults) {
|
|
|
421
359
|
RiskLevel: RiskLevel,
|
|
422
360
|
Tails: Tails,
|
|
423
361
|
Exp: Exp,
|
|
424
|
-
Date: new Date(
|
|
425
|
-
txDigest: event.
|
|
362
|
+
Date: new Date(event.timestamp),
|
|
363
|
+
txDigest: event.transaction.digest,
|
|
426
364
|
});
|
|
427
365
|
}
|
|
428
366
|
else {
|
|
429
|
-
if (
|
|
367
|
+
if (json.log[6] > 0) {
|
|
430
368
|
// harvest
|
|
431
369
|
Action = "Harvest Reward";
|
|
432
|
-
token = (0, constants_1.typeArgToAsset)("0x" +
|
|
433
|
-
amount = Number(
|
|
370
|
+
token = (0, constants_1.typeArgToAsset)("0x" + json.b_token);
|
|
371
|
+
amount = Number(json.log[6]) / Math.pow(10, (0, constants_1.assetToDecimal)(token));
|
|
434
372
|
Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
|
|
435
373
|
txHistory.push({
|
|
436
374
|
Index: Index,
|
|
@@ -441,15 +379,15 @@ function parseTxHistory(datas, vaults) {
|
|
|
441
379
|
RiskLevel: RiskLevel,
|
|
442
380
|
Tails: Tails,
|
|
443
381
|
Exp: Exp,
|
|
444
|
-
Date: new Date(
|
|
445
|
-
txDigest: event.
|
|
382
|
+
Date: new Date(event.timestamp),
|
|
383
|
+
txDigest: event.transaction.digest,
|
|
446
384
|
});
|
|
447
385
|
}
|
|
448
|
-
if (
|
|
386
|
+
if (json.log[10] > 0) {
|
|
449
387
|
// redeem
|
|
450
388
|
Action = "Harvest Reward";
|
|
451
|
-
token = (0, constants_1.typeArgToAsset)("0x" +
|
|
452
|
-
amount = Number(
|
|
389
|
+
token = (0, constants_1.typeArgToAsset)("0x" + json.i_token);
|
|
390
|
+
amount = Number(json.log[10]) / Math.pow(10, (0, constants_1.assetToDecimal)(token));
|
|
453
391
|
Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
|
|
454
392
|
txHistory.push({
|
|
455
393
|
Index: Index,
|
|
@@ -460,87 +398,87 @@ function parseTxHistory(datas, vaults) {
|
|
|
460
398
|
RiskLevel: RiskLevel,
|
|
461
399
|
Tails: Tails,
|
|
462
400
|
Exp: Exp,
|
|
463
|
-
Date: new Date(
|
|
464
|
-
txDigest: event.
|
|
401
|
+
Date: new Date(event.timestamp),
|
|
402
|
+
txDigest: event.transaction.digest,
|
|
465
403
|
});
|
|
466
404
|
}
|
|
467
405
|
}
|
|
468
406
|
return [2 /*return*/, txHistory];
|
|
469
407
|
case "NewStrategyEventV2":
|
|
470
408
|
Action = "Create Strategy";
|
|
471
|
-
deposit_amount = Number(
|
|
409
|
+
deposit_amount = Number(json.deposit_amount) / Math.pow(10, (0, constants_1.assetToDecimal)(b_token));
|
|
472
410
|
Amount = "".concat((0, bignumber_js_1.default)(deposit_amount).toFixed(), " ").concat(b_token);
|
|
473
411
|
break;
|
|
474
412
|
case "UpdateStrategyEvent":
|
|
475
413
|
Action = "Update Strategy";
|
|
476
|
-
deposit_amount = Number(
|
|
414
|
+
deposit_amount = Number(json.deposit_amount) / Math.pow(10, (0, constants_1.assetToDecimal)(b_token));
|
|
477
415
|
Amount = "".concat((0, bignumber_js_1.default)(deposit_amount).toFixed(), " ").concat(b_token);
|
|
478
416
|
break;
|
|
479
417
|
case "CloseStrategyEventV2":
|
|
480
418
|
Action = "Close Strategy";
|
|
481
419
|
if (b_token == d_token) {
|
|
482
|
-
balance = (Number(
|
|
420
|
+
balance = (Number(json.u64_padding[0]) + Number(json.u64_padding[1])) /
|
|
483
421
|
Math.pow(10, (0, constants_1.assetToDecimal)(b_token));
|
|
484
422
|
Amount = "".concat((0, bignumber_js_1.default)(balance).toFixed(), " ").concat(b_token);
|
|
485
423
|
}
|
|
486
424
|
else {
|
|
487
|
-
balance = Number(
|
|
488
|
-
profit = Number(
|
|
425
|
+
balance = Number(json.u64_padding[0]) / Math.pow(10, (0, constants_1.assetToDecimal)(b_token));
|
|
426
|
+
profit = Number(json.u64_padding[1]) / Math.pow(10, (0, constants_1.assetToDecimal)(d_token));
|
|
489
427
|
Amount = "".concat((0, bignumber_js_1.default)(balance).toFixed(), " ").concat(b_token, "\n").concat((0, bignumber_js_1.default)(profit).toFixed(), " ").concat(d_token);
|
|
490
428
|
}
|
|
491
429
|
break;
|
|
492
430
|
case "WithdrawProfitEvent":
|
|
493
431
|
Action = "Harvest Gain";
|
|
494
|
-
profit = Number(
|
|
432
|
+
profit = Number(json.profit) / Math.pow(10, (0, constants_1.assetToDecimal)(d_token));
|
|
495
433
|
Amount = "".concat((0, bignumber_js_1.default)(profit).toFixed(), " ").concat(d_token);
|
|
496
434
|
break;
|
|
497
435
|
case "RedeemEvent":
|
|
498
436
|
if (event.type == "0xc654c3634a10567b329de1226c2629cae39cdc16ec5d594897d87b250d46e958::typus_dov_single::RedeemEvent") {
|
|
499
437
|
break;
|
|
500
438
|
}
|
|
501
|
-
token = (0, constants_1.typeArgToAsset)("0x" +
|
|
502
|
-
amount = Number(
|
|
439
|
+
token = (0, constants_1.typeArgToAsset)("0x" + json.token);
|
|
440
|
+
amount = Number(json.amount) / Math.pow(10, (0, constants_1.assetToDecimal)(token));
|
|
503
441
|
Action = "Harvest Reward";
|
|
504
442
|
Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
|
|
505
443
|
Index = Index;
|
|
506
444
|
break;
|
|
507
445
|
case "TransferBidReceiptEvent":
|
|
508
|
-
amount = Number(
|
|
446
|
+
amount = Number(json.amount) / Math.pow(10, Number(json.decimal));
|
|
509
447
|
Action = "Transfer Receipt";
|
|
510
448
|
Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(o_token);
|
|
511
449
|
break;
|
|
512
450
|
case "ExerciseEvent":
|
|
513
|
-
token = (0, constants_1.typeArgToAsset)("0x" +
|
|
514
|
-
amount = Number(
|
|
451
|
+
token = (0, constants_1.typeArgToAsset)("0x" + json.token);
|
|
452
|
+
amount = Number(json.amount) / Math.pow(10, (0, constants_1.assetToDecimal)(token));
|
|
515
453
|
Action = "Exercise";
|
|
516
454
|
Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
|
|
517
|
-
if (
|
|
518
|
-
size = Number(
|
|
455
|
+
if (json.u64_padding[0]) {
|
|
456
|
+
size = Number(json.u64_padding[0]) / Math.pow(10, (0, constants_1.assetToDecimal)(o_token));
|
|
519
457
|
Action = "Exercise ".concat(size, " ").concat(o_token);
|
|
520
458
|
}
|
|
521
|
-
if (event.sender !=
|
|
459
|
+
if (event.sender != json.signer) {
|
|
522
460
|
Action = "Auto " + Action;
|
|
523
461
|
}
|
|
524
462
|
break;
|
|
525
463
|
case "RefundEvent":
|
|
526
|
-
token = (0, constants_1.typeArgToAsset)("0x" +
|
|
527
|
-
amount = Number(
|
|
464
|
+
token = (0, constants_1.typeArgToAsset)("0x" + json.token);
|
|
465
|
+
amount = Number(json.amount) / Math.pow(10, (0, constants_1.assetToDecimal)(token));
|
|
528
466
|
Action = "Rebate";
|
|
529
467
|
Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
|
|
530
468
|
break;
|
|
531
469
|
// case "ClaimProfitSharingEvent":
|
|
532
|
-
// var token = typeArgToAsset("0x" +
|
|
533
|
-
// var amount = Number(
|
|
470
|
+
// var token = typeArgToAsset("0x" + json.token);
|
|
471
|
+
// var amount = Number(json.value) / 10 ** assetToDecimal(token)!;
|
|
534
472
|
// Action = "Claim Profit Sharing";
|
|
535
473
|
// Amount = `${BigNumber(amount).toFixed()} ${token}`;
|
|
536
|
-
// Tails = `#${
|
|
474
|
+
// Tails = `#${json.number}`;
|
|
537
475
|
// break;
|
|
538
476
|
case "ClaimProfitSharingEventV2":
|
|
539
|
-
token = (0, constants_1.typeArgToAsset)("0x" +
|
|
540
|
-
amount = Number(
|
|
477
|
+
token = (0, constants_1.typeArgToAsset)("0x" + json.token);
|
|
478
|
+
amount = Number(json.value) / Math.pow(10, (0, constants_1.assetToDecimal)(token));
|
|
541
479
|
// dice_profit, exp_profit
|
|
542
480
|
// TODO: filter amount != 0
|
|
543
|
-
switch (
|
|
481
|
+
switch (json) {
|
|
544
482
|
case "dice_profit":
|
|
545
483
|
Action = "Harvest Dice Profit";
|
|
546
484
|
break;
|
|
@@ -549,16 +487,16 @@ function parseTxHistory(datas, vaults) {
|
|
|
549
487
|
break;
|
|
550
488
|
}
|
|
551
489
|
Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
|
|
552
|
-
Tails = "#".concat(
|
|
490
|
+
Tails = "#".concat(json.number);
|
|
553
491
|
break;
|
|
554
492
|
case "NewBidEvent":
|
|
555
|
-
o_token = (0, constants_1.typeArgToAsset)("0x" +
|
|
556
|
-
b_token = (0, constants_1.typeArgToAsset)("0x" +
|
|
557
|
-
size = Number(
|
|
558
|
-
bidder_balance = Number(
|
|
493
|
+
o_token = (0, constants_1.typeArgToAsset)("0x" + json.o_token);
|
|
494
|
+
b_token = (0, constants_1.typeArgToAsset)("0x" + json.b_token);
|
|
495
|
+
size = Number(json.size) / Math.pow(10, (0, constants_1.assetToDecimal)(o_token));
|
|
496
|
+
bidder_balance = Number(json.bidder_balance) / Math.pow(10, (0, constants_1.assetToDecimal)(b_token));
|
|
559
497
|
Action = action.slice(0, action.length - 5) + " ".concat(size, " ").concat(o_token);
|
|
560
498
|
Amount = "".concat((0, bignumber_js_1.default)(bidder_balance).toFixed(), " ").concat(b_token);
|
|
561
|
-
if (event.sender !=
|
|
499
|
+
if (event.sender != json.signer) {
|
|
562
500
|
Action = "Auto " + Action;
|
|
563
501
|
}
|
|
564
502
|
break;
|
|
@@ -574,8 +512,8 @@ function parseTxHistory(datas, vaults) {
|
|
|
574
512
|
RiskLevel: RiskLevel,
|
|
575
513
|
Tails: Tails,
|
|
576
514
|
Exp: Exp,
|
|
577
|
-
Date: new Date(
|
|
578
|
-
txDigest: event.
|
|
515
|
+
Date: new Date(event.timestamp),
|
|
516
|
+
txDigest: event.transaction.digest,
|
|
579
517
|
});
|
|
580
518
|
return [2 /*return*/, txHistory];
|
|
581
519
|
}
|