@typus/typus-sdk 1.9.2 → 1.9.4
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.js +1 -1
- package/dist/src/dice/fetch.js +2 -2
- package/dist/src/typus/airdrop/view-function.js +2 -0
- package/dist/src/typus/leaderboard/view-function.js +2 -0
- package/dist/src/typus/tails-staking/view-function.js +4 -0
- package/dist/src/typus-dov-single-v2/function/index.d.ts +0 -1
- package/dist/src/typus-dov-single-v2/function/index.js +0 -1
- package/dist/src/typus-dov-single-v2/view-function.d.ts +3 -0
- package/dist/src/typus-dov-single-v2/view-function.js +45 -1
- package/dist/src/typus-hedge/user-history.d.ts +2 -1
- package/dist/src/typus-hedge/user-history.js +22 -17
- package/dist/src/typus-launch/airdrop/view-function.js +5 -1
- package/dist/src/typus-launch/funding-vault/view-function.js +1 -1
- package/dist/src/typus-launch/improvement-proposal/view-function.js +20 -4
- package/dist/src/typus-launch/ve-typus/view-function.js +5 -1
- package/dist/src/typus-nft/fetch.d.ts +36 -0
- package/dist/src/typus-nft/fetch.js +269 -0
- package/dist/src/typus-nft/index.d.ts +1 -0
- package/dist/src/typus-nft/index.js +17 -0
- package/dist/src/typus-safu/user-history.d.ts +2 -1
- package/dist/src/typus-safu/user-history.js +176 -158
- package/dist/src/utils/api/price.js +5 -57
- package/dist/src/utils/api/sentio/events.js +4 -4
- package/dist/src/utils/api/sentio/leader-board.js +1 -1
- package/dist/src/utils/api/sentio/reward-generated.js +16 -16
- package/dist/src/utils/api/sentio/vault-history.js +1 -1
- package/dist/src/utils/graphQl.d.ts +1 -0
- package/dist/src/utils/graphQl.js +1 -1
- package/package.json +1 -1
- package/dist/src/typus-dov-single-v2/function/bidding.d.ts +0 -88
- package/dist/src/typus-dov-single-v2/function/bidding.js +0 -652
|
@@ -69,6 +69,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
69
69
|
exports.parseTxHistory = parseTxHistory;
|
|
70
70
|
exports.getDepositorCashFlows = getDepositorCashFlows;
|
|
71
71
|
var bcs_1 = require("@mysten/bcs");
|
|
72
|
+
var bcs_2 = require("@mysten/sui/bcs");
|
|
72
73
|
var constants_1 = require("../../src/constants");
|
|
73
74
|
var bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
74
75
|
function parseTxHistory(datas) {
|
|
@@ -77,173 +78,190 @@ function parseTxHistory(datas) {
|
|
|
77
78
|
var _this = this;
|
|
78
79
|
return __generator(this, function (_a) {
|
|
79
80
|
switch (_a.label) {
|
|
80
|
-
case 0:
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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
|
-
|
|
81
|
+
case 0:
|
|
82
|
+
console.log(datas[0]);
|
|
83
|
+
return [4 /*yield*/, datas
|
|
84
|
+
.filter(function (event) {
|
|
85
|
+
var _a, _b, _c, _d;
|
|
86
|
+
return (((_b = (_a = event.contents) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.repr.includes("safu")) ||
|
|
87
|
+
((_d = (_c = event.contents) === null || _c === void 0 ? void 0 : _c.type) === null || _d === void 0 ? void 0 : _d.repr) == "0x7dab89563066afa000ee154738aac2cc8e7d3e26cd0b470183db63630ee9f965::funding_vault::RaiseFundEvent");
|
|
88
|
+
})
|
|
89
|
+
.sort(function (a, b) {
|
|
90
|
+
// From Old to New!
|
|
91
|
+
if (a.timestamp == b.timestamp) {
|
|
92
|
+
return Number(a.sequenceNumber) - Number(b.sequenceNumber);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
return Number(a.timestamp) - Number(b.timestamp);
|
|
96
|
+
}
|
|
97
|
+
})
|
|
98
|
+
.reduce(function (promise, event) { return __awaiter(_this, void 0, void 0, function () {
|
|
99
|
+
var txHistory, log_1, action, log, reader, Token, asset, decimal, totalWithdrawAmount;
|
|
100
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
101
|
+
return __generator(this, function (_u) {
|
|
102
|
+
switch (_u.label) {
|
|
103
|
+
case 0: return [4 /*yield*/, promise];
|
|
104
|
+
case 1:
|
|
105
|
+
txHistory = _u.sent();
|
|
106
|
+
// console.log(event);
|
|
107
|
+
if (((_b = (_a = event.contents) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.repr) == "0x7dab89563066afa000ee154738aac2cc8e7d3e26cd0b470183db63630ee9f965::funding_vault::RaiseFundEvent") {
|
|
108
|
+
log_1 = (_d = (_c = event.contents) === null || _c === void 0 ? void 0 : _c.json) === null || _d === void 0 ? void 0 : _d.log;
|
|
109
|
+
if (log_1.length > 1) {
|
|
110
|
+
txHistory.push({
|
|
111
|
+
Action: "Deposit",
|
|
112
|
+
Index: "deepbook/".concat(log_1[0]),
|
|
113
|
+
Amount: divByDecimal(Number(log_1[1]), 9),
|
|
114
|
+
//@ts-ignore
|
|
115
|
+
Token: (_f = (_e = event.contents) === null || _e === void 0 ? void 0 : _e.json) === null || _f === void 0 ? void 0 : _f.token,
|
|
116
|
+
Exp: undefined,
|
|
117
|
+
Date: new Date(Number(event.timestamp)),
|
|
118
|
+
//@ts-ignore
|
|
119
|
+
txDigest: (_g = event.transaction) === null || _g === void 0 ? void 0 : _g.digest,
|
|
120
|
+
log: log_1,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
txHistory.push({
|
|
125
|
+
Action: "Deposit",
|
|
126
|
+
Index: "deepbook/0",
|
|
127
|
+
Amount: divByDecimal(Number(log_1[0]), 9),
|
|
128
|
+
//@ts-ignore
|
|
129
|
+
Token: (_j = (_h = event.contents) === null || _h === void 0 ? void 0 : _h.json) === null || _j === void 0 ? void 0 : _j.token,
|
|
130
|
+
Exp: undefined,
|
|
131
|
+
Date: new Date(Number(event.timestamp)),
|
|
132
|
+
//@ts-ignore
|
|
133
|
+
txDigest: (_k = event.transaction) === null || _k === void 0 ? void 0 : _k.digest,
|
|
134
|
+
log: log_1,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
return [2 /*return*/, txHistory];
|
|
127
138
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
139
|
+
action = event.contents.json.action;
|
|
140
|
+
log = event.contents.json.log;
|
|
141
|
+
// skip the event without tokenType
|
|
142
|
+
//@ts-ignore
|
|
143
|
+
if (event.contents.json.bcs_padding.length > 0) {
|
|
144
|
+
reader = (0, bcs_1.fromBase64)(event.contents.json.bcs_padding[0]);
|
|
145
|
+
Token = bcs_2.bcs.string().parse(reader);
|
|
146
|
+
asset = (0, constants_1.typeArgToAsset)(Token);
|
|
147
|
+
decimal = (0, constants_1.assetToDecimal)(asset);
|
|
148
|
+
// console.log(asset, decimal);
|
|
149
|
+
switch (action) {
|
|
150
|
+
case "raise_fund":
|
|
151
|
+
// balance_value, deactivating_value, inactive_value,
|
|
152
|
+
// Number(log[2]) + Number(log[3]) + Number(log[4])
|
|
153
|
+
if (Number(log[2]) > 0) {
|
|
154
|
+
txHistory.push({
|
|
155
|
+
Action: "Deposit",
|
|
156
|
+
Index: log[0],
|
|
157
|
+
Amount: divByDecimal(Number(log[2]), decimal),
|
|
158
|
+
Token: Token,
|
|
159
|
+
Exp: log[6],
|
|
160
|
+
Date: new Date(Number(event.timestamp)),
|
|
161
|
+
//@ts-ignore
|
|
162
|
+
txDigest: (_l = event.transaction) === null || _l === void 0 ? void 0 : _l.digest,
|
|
163
|
+
log: log,
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
if (Number(log[3]) > 0) {
|
|
167
|
+
txHistory.push({
|
|
168
|
+
Action: "Subscribe",
|
|
169
|
+
Index: log[0],
|
|
170
|
+
Amount: divByDecimal(Number(log[3]), decimal),
|
|
171
|
+
Token: Token,
|
|
172
|
+
Exp: log[6],
|
|
173
|
+
Date: new Date(Number(event.timestamp)),
|
|
174
|
+
//@ts-ignore
|
|
175
|
+
txDigest: (_m = event.transaction) === null || _m === void 0 ? void 0 : _m.digest,
|
|
176
|
+
log: log,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
if (Number(log[4]) > 0) {
|
|
180
|
+
txHistory.push({
|
|
181
|
+
Action: "Withdraw",
|
|
182
|
+
Index: log[0],
|
|
183
|
+
Amount: divByDecimal(Number(log[4]), decimal),
|
|
184
|
+
Token: Token,
|
|
185
|
+
Exp: log[6],
|
|
186
|
+
Date: new Date(Number(event.timestamp)),
|
|
187
|
+
//@ts-ignore
|
|
188
|
+
txDigest: (_o = event.transaction) === null || _o === void 0 ? void 0 : _o.digest,
|
|
189
|
+
log: log,
|
|
190
|
+
});
|
|
191
|
+
txHistory.push({
|
|
192
|
+
Action: "Deposit",
|
|
193
|
+
Index: log[0],
|
|
194
|
+
Amount: divByDecimal(Number(log[4]), decimal),
|
|
195
|
+
Token: Token,
|
|
196
|
+
Exp: undefined,
|
|
197
|
+
Date: new Date(Number(event.timestamp)),
|
|
198
|
+
//@ts-ignore
|
|
199
|
+
txDigest: (_p = event.transaction) === null || _p === void 0 ? void 0 : _p.digest,
|
|
200
|
+
log: log,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
if (Number(log[5]) > 0) {
|
|
204
|
+
txHistory.push({
|
|
205
|
+
Action: "Compound",
|
|
206
|
+
Index: log[0],
|
|
207
|
+
Amount: divByDecimal(Number(log[5]), decimal),
|
|
208
|
+
Token: Token,
|
|
209
|
+
Exp: log[6],
|
|
210
|
+
Date: new Date(Number(event.timestamp)),
|
|
211
|
+
//@ts-ignore
|
|
212
|
+
txDigest: (_q = event.transaction) === null || _q === void 0 ? void 0 : _q.digest,
|
|
213
|
+
log: log,
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
break;
|
|
217
|
+
case "reduce_fund":
|
|
218
|
+
totalWithdrawAmount = (0, bignumber_js_1.default)(log[2]).plus(log[4]);
|
|
219
|
+
if (totalWithdrawAmount.gt(0)) {
|
|
220
|
+
txHistory.push({
|
|
221
|
+
Action: "Withdraw",
|
|
222
|
+
Index: log[0],
|
|
223
|
+
Amount: divByDecimal(totalWithdrawAmount.toNumber(), decimal),
|
|
224
|
+
Token: Token,
|
|
225
|
+
Exp: log[5],
|
|
226
|
+
Date: new Date(Number(event.timestamp)),
|
|
227
|
+
//@ts-ignore
|
|
228
|
+
txDigest: (_r = event.transaction) === null || _r === void 0 ? void 0 : _r.digest,
|
|
229
|
+
log: log,
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
if (Number(log[3]) > 0) {
|
|
233
|
+
txHistory.push({
|
|
234
|
+
Action: "Unsubscribe",
|
|
235
|
+
Index: log[0],
|
|
236
|
+
Amount: divByDecimal(Number(log[3]), decimal),
|
|
237
|
+
Token: Token,
|
|
238
|
+
Exp: log[5],
|
|
239
|
+
Date: new Date(Number(event.timestamp)),
|
|
240
|
+
//@ts-ignore
|
|
241
|
+
txDigest: (_s = event.transaction) === null || _s === void 0 ? void 0 : _s.digest,
|
|
242
|
+
log: log,
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
break;
|
|
246
|
+
case "claim_reward":
|
|
144
247
|
txHistory.push({
|
|
145
|
-
Action: "
|
|
248
|
+
Action: "Harvest Options Profit",
|
|
146
249
|
Index: log[0],
|
|
147
250
|
Amount: divByDecimal(Number(log[2]), decimal),
|
|
148
251
|
Token: Token,
|
|
149
|
-
Exp: log[6],
|
|
150
|
-
Date: new Date(Number(event.timestampMs)),
|
|
151
|
-
txDigest: event.id.txDigest,
|
|
152
|
-
log: log,
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
if (Number(log[3]) > 0) {
|
|
156
|
-
txHistory.push({
|
|
157
|
-
Action: "Subscribe",
|
|
158
|
-
Index: log[0],
|
|
159
|
-
Amount: divByDecimal(Number(log[3]), decimal),
|
|
160
|
-
Token: Token,
|
|
161
|
-
Exp: log[6],
|
|
162
|
-
Date: new Date(Number(event.timestampMs)),
|
|
163
|
-
txDigest: event.id.txDigest,
|
|
164
|
-
log: log,
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
if (Number(log[4]) > 0) {
|
|
168
|
-
txHistory.push({
|
|
169
|
-
Action: "Withdraw",
|
|
170
|
-
Index: log[0],
|
|
171
|
-
Amount: divByDecimal(Number(log[4]), decimal),
|
|
172
|
-
Token: Token,
|
|
173
|
-
Exp: log[6],
|
|
174
|
-
Date: new Date(Number(event.timestampMs)),
|
|
175
|
-
txDigest: event.id.txDigest,
|
|
176
|
-
log: log,
|
|
177
|
-
});
|
|
178
|
-
txHistory.push({
|
|
179
|
-
Action: "Deposit",
|
|
180
|
-
Index: log[0],
|
|
181
|
-
Amount: divByDecimal(Number(log[4]), decimal),
|
|
182
|
-
Token: Token,
|
|
183
252
|
Exp: undefined,
|
|
184
|
-
Date: new Date(Number(event.
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
if (Number(log[5]) > 0) {
|
|
190
|
-
txHistory.push({
|
|
191
|
-
Action: "Compound",
|
|
192
|
-
Index: log[0],
|
|
193
|
-
Amount: divByDecimal(Number(log[5]), decimal),
|
|
194
|
-
Token: Token,
|
|
195
|
-
Exp: log[6],
|
|
196
|
-
Date: new Date(Number(event.timestampMs)),
|
|
197
|
-
txDigest: event.id.txDigest,
|
|
198
|
-
log: log,
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
break;
|
|
202
|
-
case "reduce_fund":
|
|
203
|
-
totalWithdrawAmount = (0, bignumber_js_1.default)(log[2]).plus(log[4]);
|
|
204
|
-
if (totalWithdrawAmount.gt(0)) {
|
|
205
|
-
txHistory.push({
|
|
206
|
-
Action: "Withdraw",
|
|
207
|
-
Index: log[0],
|
|
208
|
-
Amount: divByDecimal(totalWithdrawAmount.toNumber(), decimal),
|
|
209
|
-
Token: Token,
|
|
210
|
-
Exp: log[5],
|
|
211
|
-
Date: new Date(Number(event.timestampMs)),
|
|
212
|
-
txDigest: event.id.txDigest,
|
|
213
|
-
log: log,
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
if (Number(log[3]) > 0) {
|
|
217
|
-
txHistory.push({
|
|
218
|
-
Action: "Unsubscribe",
|
|
219
|
-
Index: log[0],
|
|
220
|
-
Amount: divByDecimal(Number(log[3]), decimal),
|
|
221
|
-
Token: Token,
|
|
222
|
-
Exp: log[5],
|
|
223
|
-
Date: new Date(Number(event.timestampMs)),
|
|
224
|
-
txDigest: event.id.txDigest,
|
|
253
|
+
Date: new Date(Number(event.timestamp)),
|
|
254
|
+
//@ts-ignore
|
|
255
|
+
txDigest: (_t = event.transaction) === null || _t === void 0 ? void 0 : _t.digest,
|
|
225
256
|
log: log,
|
|
226
257
|
});
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
case "claim_reward":
|
|
230
|
-
txHistory.push({
|
|
231
|
-
Action: "Harvest Options Profit",
|
|
232
|
-
Index: log[0],
|
|
233
|
-
Amount: divByDecimal(Number(log[2]), decimal),
|
|
234
|
-
Token: Token,
|
|
235
|
-
Exp: undefined,
|
|
236
|
-
Date: new Date(Number(event.timestampMs)),
|
|
237
|
-
txDigest: event.id.txDigest,
|
|
238
|
-
log: log,
|
|
239
|
-
});
|
|
240
|
-
break;
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
241
260
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
}); }, Promise.resolve(new Array()))];
|
|
261
|
+
return [2 /*return*/, txHistory];
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
}); }, Promise.resolve(new Array()))];
|
|
247
265
|
case 1:
|
|
248
266
|
results = _a.sent();
|
|
249
267
|
return [2 /*return*/, results];
|
|
@@ -51,17 +51,6 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
51
51
|
}
|
|
52
52
|
return ar;
|
|
53
53
|
};
|
|
54
|
-
var __values = (this && this.__values) || function(o) {
|
|
55
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
56
|
-
if (m) return m.call(o);
|
|
57
|
-
if (o && typeof o.length === "number") return {
|
|
58
|
-
next: function () {
|
|
59
|
-
if (o && i >= o.length) o = void 0;
|
|
60
|
-
return { value: o && o[i++], done: !o };
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
64
|
-
};
|
|
65
54
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
66
55
|
exports.getPairPrices = getPairPrices;
|
|
67
56
|
exports.getLatestPrice = getLatestPrice;
|
|
@@ -208,54 +197,13 @@ function getPythLatestPriceBySymbols(symbols) {
|
|
|
208
197
|
}
|
|
209
198
|
function getLatestPriceUSD() {
|
|
210
199
|
return __awaiter(this, void 0, void 0, function () {
|
|
211
|
-
var prices
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
switch (_d.label) {
|
|
200
|
+
var prices;
|
|
201
|
+
return __generator(this, function (_a) {
|
|
202
|
+
switch (_a.label) {
|
|
215
203
|
case 0: return [4 /*yield*/, getPythLatestPrice()];
|
|
216
204
|
case 1:
|
|
217
|
-
prices = (
|
|
218
|
-
|
|
219
|
-
case 2:
|
|
220
|
-
_d.trys.push([2, 7, 8, 9]);
|
|
221
|
-
_a = __values(["SUIFUD", "SUIBUCK", "SUIAFSUI", "SCASUI", "USDYUSDC"]), _b = _a.next();
|
|
222
|
-
_d.label = 3;
|
|
223
|
-
case 3:
|
|
224
|
-
if (!!_b.done) return [3 /*break*/, 6];
|
|
225
|
-
pair = _b.value;
|
|
226
|
-
currentTimestampInSeconds = Math.floor(new Date().getTime() / 1000);
|
|
227
|
-
minuteAgo = currentTimestampInSeconds - 300;
|
|
228
|
-
return [4 /*yield*/, getPairPrices(pair, minuteAgo.toString(), currentTimestampInSeconds.toString())];
|
|
229
|
-
case 4:
|
|
230
|
-
res = _d.sent();
|
|
231
|
-
price = res.at(-1).price;
|
|
232
|
-
result = void 0;
|
|
233
|
-
if (pair.startsWith("SUI")) {
|
|
234
|
-
result = prices.get("SUI") / Number(price);
|
|
235
|
-
}
|
|
236
|
-
else if (pair.endsWith("SUI")) {
|
|
237
|
-
result = prices.get("SUI") * Number(price);
|
|
238
|
-
}
|
|
239
|
-
else {
|
|
240
|
-
result = Number(price);
|
|
241
|
-
}
|
|
242
|
-
prices.set(pair.replace("SUI", ""), result);
|
|
243
|
-
_d.label = 5;
|
|
244
|
-
case 5:
|
|
245
|
-
_b = _a.next();
|
|
246
|
-
return [3 /*break*/, 3];
|
|
247
|
-
case 6: return [3 /*break*/, 9];
|
|
248
|
-
case 7:
|
|
249
|
-
e_2_1 = _d.sent();
|
|
250
|
-
e_2 = { error: e_2_1 };
|
|
251
|
-
return [3 /*break*/, 9];
|
|
252
|
-
case 8:
|
|
253
|
-
try {
|
|
254
|
-
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
255
|
-
}
|
|
256
|
-
finally { if (e_2) throw e_2.error; }
|
|
257
|
-
return [7 /*endfinally*/];
|
|
258
|
-
case 9: return [2 /*return*/, prices];
|
|
205
|
+
prices = (_a.sent());
|
|
206
|
+
return [2 /*return*/, prices];
|
|
259
207
|
}
|
|
260
208
|
});
|
|
261
209
|
});
|
|
@@ -59,7 +59,7 @@ exports.getExerciseFromSentio = getExerciseFromSentio;
|
|
|
59
59
|
var typus_dov_single_v2_1 = require("../../../../src/typus-dov-single-v2");
|
|
60
60
|
var constants_1 = require("../../../../src/constants");
|
|
61
61
|
var headers = {
|
|
62
|
-
"api-key": "
|
|
62
|
+
"api-key": "g8vRPVCM3CScaTVGVT5X9Eh4fyEJDbmAE",
|
|
63
63
|
"Content-Type": "application/json",
|
|
64
64
|
};
|
|
65
65
|
function getFromSentio(event, userAddress, startTimestamp) {
|
|
@@ -71,7 +71,7 @@ function getFromSentio(event, userAddress, startTimestamp) {
|
|
|
71
71
|
apiUrl = "https://app.sentio.xyz/api/v1/analytics/typus/typus_v2/sql/execute";
|
|
72
72
|
requestData = {
|
|
73
73
|
sqlQuery: {
|
|
74
|
-
sql: "\n SELECT *\n FROM ".concat(event, "\n WHERE
|
|
74
|
+
sql: "\n SELECT *\n FROM ".concat(event, "\n WHERE distinctId = '").concat(userAddress, "' AND timestamp >= ").concat(startTimestamp, "\n ORDER BY timestamp DESC;\n "),
|
|
75
75
|
size: 1000,
|
|
76
76
|
},
|
|
77
77
|
};
|
|
@@ -86,7 +86,7 @@ function getFromSentio(event, userAddress, startTimestamp) {
|
|
|
86
86
|
return [4 /*yield*/, response.json()];
|
|
87
87
|
case 2:
|
|
88
88
|
data = _a.sent();
|
|
89
|
-
|
|
89
|
+
console.log(data);
|
|
90
90
|
return [2 /*return*/, data.result.rows];
|
|
91
91
|
}
|
|
92
92
|
});
|
|
@@ -101,7 +101,7 @@ function getFromSentioWithExpUp(event, userAddress, startTimestamp) {
|
|
|
101
101
|
apiUrl = "https://app.sentio.xyz/api/v1/analytics/typus/typus_v2/sql/execute";
|
|
102
102
|
requestData = {
|
|
103
103
|
sqlQuery: {
|
|
104
|
-
sql: "\n SELECT *\n FROM ".concat(event, " N\n LEFT JOIN (\n SELECT number,
|
|
104
|
+
sql: "\n SELECT *\n FROM ".concat(event, " N\n LEFT JOIN (\n SELECT number, distinctId, exp_earn, transaction_hash, log_index\n FROM ExpUp\n ) S ON N.transaction_hash = S.transaction_hash AND N.log_index + 1 = S.log_index\n WHERE N.distinctId = '").concat(userAddress, "' AND N.timestamp >= ").concat(startTimestamp, "\n ORDER BY N.timestamp DESC;\n "),
|
|
105
105
|
size: 1000,
|
|
106
106
|
},
|
|
107
107
|
};
|
|
@@ -50,7 +50,7 @@ function getExpLeaderBoardWithOwner(expLeaderBoard, ownerMap) {
|
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
var headers = {
|
|
53
|
-
"api-key": "
|
|
53
|
+
"api-key": "g8vRPVCM3CScaTVGVT5X9Eh4fyEJDbmAE",
|
|
54
54
|
"Content-Type": "application/json",
|
|
55
55
|
};
|
|
56
56
|
function getExpLeaderBoard(startTimestamp, endTimestamp) {
|
|
@@ -55,7 +55,7 @@ exports.getAccumulatedUser = getAccumulatedUser;
|
|
|
55
55
|
exports.getAccumulatedNotionalVolumeUSD = getAccumulatedNotionalVolumeUSD;
|
|
56
56
|
exports.getSafuAccumulatedRewardGeneratedUSD = getSafuAccumulatedRewardGeneratedUSD;
|
|
57
57
|
var headers = {
|
|
58
|
-
"api-key": "
|
|
58
|
+
"api-key": "g8vRPVCM3CScaTVGVT5X9Eh4fyEJDbmAE",
|
|
59
59
|
"Content-Type": "application/json",
|
|
60
60
|
};
|
|
61
61
|
function getTotalDepositorIncentive() {
|
|
@@ -96,7 +96,7 @@ function getTotalPremium() {
|
|
|
96
96
|
apiUrl = "https://app.sentio.xyz/api/v1/insights/typus/typus_v2/query";
|
|
97
97
|
requestData = {
|
|
98
98
|
timeRange: {
|
|
99
|
-
start: "now",
|
|
99
|
+
start: "now-1h",
|
|
100
100
|
end: "now",
|
|
101
101
|
step: 3600,
|
|
102
102
|
timezone: "Europe/Paris",
|
|
@@ -148,7 +148,7 @@ function getAccumulatedRewardGeneratedUSD() {
|
|
|
148
148
|
apiUrlV1 = "https://app.sentio.xyz/api/v1/insights/typus/typus_v1/query";
|
|
149
149
|
requestDataV1 = {
|
|
150
150
|
timeRange: {
|
|
151
|
-
start: "now",
|
|
151
|
+
start: "now-1h",
|
|
152
152
|
end: "now",
|
|
153
153
|
step: 3600,
|
|
154
154
|
timezone: "Asia/Taipei",
|
|
@@ -188,7 +188,7 @@ function getAccumulatedRewardGeneratedUSD() {
|
|
|
188
188
|
apiUrl = "https://app.sentio.xyz/api/v1/insights/typus/typus_v2/query";
|
|
189
189
|
requestData = {
|
|
190
190
|
timeRange: {
|
|
191
|
-
start: "now",
|
|
191
|
+
start: "now-1h",
|
|
192
192
|
end: "now",
|
|
193
193
|
step: 3600,
|
|
194
194
|
timezone: "Asia/Taipei",
|
|
@@ -283,12 +283,10 @@ function getAccumulatedUser() {
|
|
|
283
283
|
apiUrl = apiUrls_1_1.value;
|
|
284
284
|
requestData = {
|
|
285
285
|
timeRange: {
|
|
286
|
-
start: "now-
|
|
286
|
+
start: "now-3d",
|
|
287
287
|
end: "now",
|
|
288
|
-
step:
|
|
289
|
-
timezone: "Asia/Taipei",
|
|
288
|
+
step: 86400,
|
|
290
289
|
},
|
|
291
|
-
limit: 1,
|
|
292
290
|
queries: [
|
|
293
291
|
{
|
|
294
292
|
eventsQuery: {
|
|
@@ -307,7 +305,7 @@ function getAccumulatedUser() {
|
|
|
307
305
|
},
|
|
308
306
|
},
|
|
309
307
|
groupBy: [],
|
|
310
|
-
limit:
|
|
308
|
+
limit: 0,
|
|
311
309
|
functions: [],
|
|
312
310
|
disabled: false,
|
|
313
311
|
},
|
|
@@ -328,8 +326,8 @@ function getAccumulatedUser() {
|
|
|
328
326
|
return [4 /*yield*/, response.json()];
|
|
329
327
|
case 4:
|
|
330
328
|
data = _b.sent();
|
|
331
|
-
// console.
|
|
332
|
-
result.push(data.results[0].matrix.samples[0].values
|
|
329
|
+
// console.dir(data.results[0].matrix, { depth: null });
|
|
330
|
+
result.push(data.results[0].matrix.samples[0].values.at(-1).value);
|
|
333
331
|
_b.label = 5;
|
|
334
332
|
case 5:
|
|
335
333
|
apiUrls_1_1 = apiUrls_1.next();
|
|
@@ -375,10 +373,9 @@ function getAccumulatedNotionalVolumeUSD() {
|
|
|
375
373
|
apiUrl = apiUrls_2_1.value;
|
|
376
374
|
requestData = {
|
|
377
375
|
timeRange: {
|
|
378
|
-
start: "now",
|
|
376
|
+
start: "now-1h",
|
|
379
377
|
end: "now",
|
|
380
378
|
step: 3600,
|
|
381
|
-
timezone: "Asia/Taipei",
|
|
382
379
|
},
|
|
383
380
|
limit: 1,
|
|
384
381
|
queries: [
|
|
@@ -446,7 +443,7 @@ function getSafuAccumulatedRewardGeneratedUSD() {
|
|
|
446
443
|
apiUrl = "https://app.sentio.xyz/api/v1/insights/typus/typus_v2/query";
|
|
447
444
|
requestData = {
|
|
448
445
|
timeRange: {
|
|
449
|
-
start: "now",
|
|
446
|
+
start: "now-1h",
|
|
450
447
|
end: "now",
|
|
451
448
|
step: 3600,
|
|
452
449
|
timezone: "Asia/Taipei",
|
|
@@ -489,5 +486,8 @@ function getSafuAccumulatedRewardGeneratedUSD() {
|
|
|
489
486
|
});
|
|
490
487
|
});
|
|
491
488
|
}
|
|
492
|
-
//
|
|
493
|
-
//
|
|
489
|
+
// getTotalDepositorIncentive().then((res) => console.log(res));
|
|
490
|
+
// getTotalPremium().then((res) => console.log(res));
|
|
491
|
+
// getAccumulatedNotionalVolumeUSD().then((res) => console.log(res));
|
|
492
|
+
// getAccumulatedUser().then((res) => console.log(res));
|
|
493
|
+
// getAccumulatedRewardGeneratedUSD().then((res) => console.log(res));
|
|
@@ -40,7 +40,7 @@ exports.getVaultHistorySummary = getVaultHistorySummary;
|
|
|
40
40
|
exports.getFilledSummary = getFilledSummary;
|
|
41
41
|
exports.getVaultHistory = getVaultHistory;
|
|
42
42
|
var headers = {
|
|
43
|
-
"api-key": "
|
|
43
|
+
"api-key": "g8vRPVCM3CScaTVGVT5X9Eh4fyEJDbmAE",
|
|
44
44
|
"Content-Type": "application/json",
|
|
45
45
|
};
|
|
46
46
|
function getVaultHistorySummary(startTimestamp) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SuiGraphQLClient } from "@mysten/sui/graphql";
|
|
2
2
|
export declare function getDynamicObjectFields(graphQlClient: SuiGraphQLClient, parent: string, typeFilter?: string): Promise<any[] | undefined>;
|
|
3
3
|
export interface Event {
|
|
4
|
+
sequenceNumber: number;
|
|
4
5
|
transaction: {
|
|
5
6
|
digest: string;
|
|
6
7
|
} | null;
|
|
@@ -92,7 +92,7 @@ function getDynamicObjectFields(graphQlClient_1, parent_1) {
|
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
94
|
var dynamicFieldsQuery = (0, schema_1.graphql)("\n query ($id: SuiAddress!) {\n address(address: $id) {\n dynamicFields {\n nodes {\n name {\n ...Value\n }\n value {\n ... on MoveValue {\n ...Value\n }\n ... on MoveObject {\n contents {\n ...Value\n }\n }\n }\n }\n }\n }\n }\n\n fragment Value on MoveValue {\n type {\n repr\n }\n json\n }\n");
|
|
95
|
-
var eventsQuery = (0, schema_1.graphql)("\n query QueryEvents($type: String, $before: String, $sender: SuiAddress) {\n events(last: 50, before: $before, filter: { type: $type, sender: $sender }) {\n pageInfo {\n hasPreviousPage\n hasNextPage\n startCursor\n endCursor\n }\n edges {\n cursor\n }\n nodes {\n transaction {\n digest\n }\n transactionModule {\n name\n package {\n digest\n }\n }\n sender {\n address\n }\n timestamp\n contents {\n type {\n repr\n }\n json\n }\n }\n }\n }\n");
|
|
95
|
+
var eventsQuery = (0, schema_1.graphql)("\n query QueryEvents($type: String, $before: String, $sender: SuiAddress) {\n events(last: 50, before: $before, filter: { type: $type, sender: $sender }) {\n pageInfo {\n hasPreviousPage\n hasNextPage\n startCursor\n endCursor\n }\n edges {\n cursor\n }\n nodes {\n sequenceNumber\n transaction {\n digest\n }\n transactionModule {\n name\n package {\n digest\n }\n }\n sender {\n address\n }\n timestamp\n contents {\n type {\n repr\n }\n json\n }\n }\n }\n }\n");
|
|
96
96
|
function getEvents(graphQlClient_1, module_1, sender_1) {
|
|
97
97
|
return __awaiter(this, arguments, void 0, function (graphQlClient, module, sender, beforeCursor, getAll) {
|
|
98
98
|
var hasPreviousPage, events, x;
|