@typus/typus-perp-sdk 1.0.40-fix-history-2 → 1.0.40-fix-history-3
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/api/sentio.d.ts
CHANGED
package/dist/src/api/sentio.js
CHANGED
|
@@ -39,6 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.getFromSentio = getFromSentio;
|
|
40
40
|
exports.getTlpAPRFromSentio = getTlpAPRFromSentio;
|
|
41
41
|
exports.getVolumeFromSentio = getVolumeFromSentio;
|
|
42
|
+
exports.getTlpFeeFromSentio = getTlpFeeFromSentio;
|
|
42
43
|
var src_1 = require("../../src");
|
|
43
44
|
var headers = {
|
|
44
45
|
"api-key": "ffJa6FwxeJNrQP8NZ5doEMXqdSA7XM6mT",
|
|
@@ -71,7 +72,13 @@ function getFromSentio(event, userAddress, startTimestamp) {
|
|
|
71
72
|
case 2:
|
|
72
73
|
data = _a.sent();
|
|
73
74
|
// console.log(data);
|
|
74
|
-
|
|
75
|
+
if (data.result) {
|
|
76
|
+
return [2 /*return*/, data.result.rows];
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
return [2 /*return*/, []];
|
|
80
|
+
}
|
|
81
|
+
return [2 /*return*/];
|
|
75
82
|
}
|
|
76
83
|
});
|
|
77
84
|
});
|
|
@@ -190,3 +197,59 @@ function getVolumeFromSentio() {
|
|
|
190
197
|
});
|
|
191
198
|
});
|
|
192
199
|
}
|
|
200
|
+
function getTlpFeeFromSentio() {
|
|
201
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
202
|
+
var apiUrl, requestData, jsonData, response, data, first, last, fee;
|
|
203
|
+
return __generator(this, function (_a) {
|
|
204
|
+
switch (_a.label) {
|
|
205
|
+
case 0:
|
|
206
|
+
apiUrl = src_1.NETWORK == "MAINNET"
|
|
207
|
+
? "https://app.sentio.xyz/api/v1/insights/typus/typus_perp_mainnet/query"
|
|
208
|
+
: "https://app.sentio.xyz/api/v1/insights/typus/typus_perp/query";
|
|
209
|
+
requestData = {
|
|
210
|
+
timeRange: {
|
|
211
|
+
start: "now-7d",
|
|
212
|
+
end: "now",
|
|
213
|
+
step: 3600,
|
|
214
|
+
},
|
|
215
|
+
limit: 20,
|
|
216
|
+
queries: [
|
|
217
|
+
{
|
|
218
|
+
metricsQuery: {
|
|
219
|
+
query: "tlp_fee_usd",
|
|
220
|
+
alias: "",
|
|
221
|
+
id: "a",
|
|
222
|
+
labelSelector: {},
|
|
223
|
+
aggregate: null,
|
|
224
|
+
functions: [],
|
|
225
|
+
disabled: false,
|
|
226
|
+
},
|
|
227
|
+
dataSource: "METRICS",
|
|
228
|
+
sourceName: "",
|
|
229
|
+
},
|
|
230
|
+
],
|
|
231
|
+
formulas: [],
|
|
232
|
+
};
|
|
233
|
+
jsonData = JSON.stringify(requestData);
|
|
234
|
+
return [4 /*yield*/, fetch(apiUrl, {
|
|
235
|
+
method: "POST",
|
|
236
|
+
headers: headers,
|
|
237
|
+
body: jsonData,
|
|
238
|
+
})];
|
|
239
|
+
case 1:
|
|
240
|
+
response = _a.sent();
|
|
241
|
+
return [4 /*yield*/, response.json()];
|
|
242
|
+
case 2:
|
|
243
|
+
data = _a.sent();
|
|
244
|
+
first = data.results[0].matrix.samples[0].values[0];
|
|
245
|
+
last = data.results[0].matrix.samples[0].values.at(-1);
|
|
246
|
+
fee = last.value - first.value;
|
|
247
|
+
// console.log(fee);
|
|
248
|
+
return [2 /*return*/, fee];
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
// getTlpAPRFromSentio();
|
|
254
|
+
// getVolumeFromSentio();
|
|
255
|
+
// getTlpFeeFromSentio();
|
package/dist/src/user/history.js
CHANGED
|
@@ -333,7 +333,7 @@ function getLiquidateFromSentio(userAddress, startTimestamp, events) {
|
|
|
333
333
|
side: undefined,
|
|
334
334
|
order_type: "Market",
|
|
335
335
|
status: "Filled",
|
|
336
|
-
size:
|
|
336
|
+
size: x.position_size,
|
|
337
337
|
base_token: base_token,
|
|
338
338
|
collateral: collateral,
|
|
339
339
|
collateral_token: x.collateral_token,
|
|
@@ -349,8 +349,7 @@ function getLiquidateFromSentio(userAddress, startTimestamp, events) {
|
|
|
349
349
|
// console.log(x);
|
|
350
350
|
// console.log(related);
|
|
351
351
|
if (related) {
|
|
352
|
-
x.side = related.side
|
|
353
|
-
x.size = related.size;
|
|
352
|
+
x.side = related.side;
|
|
354
353
|
}
|
|
355
354
|
return x;
|
|
356
355
|
});
|