@typus/typus-sdk 1.4.77 → 1.4.79
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/typus-launch/ve-typus/view-function.d.ts +12 -0
- package/dist/src/typus-launch/ve-typus/view-function.js +74 -0
- package/dist/src/utils/api/sentio/index.d.ts +1 -0
- package/dist/src/utils/api/sentio/index.js +1 -0
- package/dist/src/utils/api/sentio/vault-history.d.ts +49 -0
- package/dist/src/utils/api/sentio/vault-history.js +109 -0
- package/package.json +1 -1
|
@@ -4,7 +4,19 @@ export interface VeTypus {
|
|
|
4
4
|
balance: string;
|
|
5
5
|
lockUpPeriod: string;
|
|
6
6
|
createTsMs: string;
|
|
7
|
+
updateTsMs: string;
|
|
7
8
|
}
|
|
8
9
|
export declare function getVeTypus(config: TypusConfig, input: {
|
|
9
10
|
user: string;
|
|
10
11
|
}): Promise<VeTypus[]>;
|
|
12
|
+
export interface VeTypusInfo {
|
|
13
|
+
totalVeTypusAmount: string;
|
|
14
|
+
totalStakedTypusAmount: string;
|
|
15
|
+
averageLockUpTime: string;
|
|
16
|
+
veTypusAmount: string;
|
|
17
|
+
veTypus: VeTypus[];
|
|
18
|
+
}
|
|
19
|
+
export declare function fetchVeTypusInfo(config: TypusConfig, input: {
|
|
20
|
+
tsMs: string;
|
|
21
|
+
user?: string;
|
|
22
|
+
}): Promise<VeTypusInfo>;
|
|
@@ -37,6 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.getVeTypus = getVeTypus;
|
|
40
|
+
exports.fetchVeTypusInfo = fetchVeTypusInfo;
|
|
40
41
|
var transactions_1 = require("@mysten/sui.js/transactions");
|
|
41
42
|
var client_1 = require("@mysten/sui.js/client");
|
|
42
43
|
var bcs_1 = require("@mysten/bcs");
|
|
@@ -66,9 +67,82 @@ function getVeTypus(config, input) {
|
|
|
66
67
|
balance: reader.read64(),
|
|
67
68
|
lockUpPeriod: reader.read64(),
|
|
68
69
|
createTsMs: reader.read64(),
|
|
70
|
+
updateTsMs: reader.read64(),
|
|
69
71
|
};
|
|
70
72
|
})];
|
|
71
73
|
}
|
|
72
74
|
});
|
|
73
75
|
});
|
|
74
76
|
}
|
|
77
|
+
function fetchVeTypusInfo(config, input) {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
79
|
+
var provider, transactionBlock, results, reader, totalVeTypusAmount, totalStakedTypusAmount, averageLockUpTime, reader_1, veTypus, veTypusAmount;
|
|
80
|
+
return __generator(this, function (_a) {
|
|
81
|
+
switch (_a.label) {
|
|
82
|
+
case 0:
|
|
83
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
84
|
+
transactionBlock = new transactions_1.TransactionBlock();
|
|
85
|
+
transactionBlock.moveCall({
|
|
86
|
+
target: "".concat(config.package.launch.veTypus, "::ve_typus::get_report"),
|
|
87
|
+
arguments: [transactionBlock.object(config.registry.launch.veTypus), transactionBlock.pure(input.tsMs)],
|
|
88
|
+
});
|
|
89
|
+
if (input.user) {
|
|
90
|
+
transactionBlock.moveCall({
|
|
91
|
+
target: "".concat(config.package.launch.veTypus, "::ve_typus::get_ve_typus_bcs"),
|
|
92
|
+
arguments: [transactionBlock.object(config.registry.launch.veTypus), transactionBlock.pure(input.user)],
|
|
93
|
+
});
|
|
94
|
+
transactionBlock.moveCall({
|
|
95
|
+
target: "".concat(config.package.launch.veTypus, "::ve_typus::get_ve_typus"),
|
|
96
|
+
arguments: [
|
|
97
|
+
transactionBlock.object(config.registry.launch.veTypus),
|
|
98
|
+
transactionBlock.pure(input.user),
|
|
99
|
+
transactionBlock.pure(input.tsMs),
|
|
100
|
+
],
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transactionBlock })];
|
|
104
|
+
case 1:
|
|
105
|
+
results = (_a.sent()).results;
|
|
106
|
+
reader = new bcs_1.BcsReader(new Uint8Array(results[0].returnValues[0][0]));
|
|
107
|
+
reader.readULEB();
|
|
108
|
+
totalVeTypusAmount = reader.read64();
|
|
109
|
+
totalStakedTypusAmount = reader.read64();
|
|
110
|
+
averageLockUpTime = ((BigInt(totalVeTypusAmount) * BigInt(4 * 365 * 24 * 60 * 60 * 1000)) /
|
|
111
|
+
BigInt(totalStakedTypusAmount)).toString();
|
|
112
|
+
if (input.user) {
|
|
113
|
+
reader_1 = new bcs_1.BcsReader(new Uint8Array(results[1].returnValues[0][0]));
|
|
114
|
+
reader_1.readULEB();
|
|
115
|
+
veTypus = reader_1.readVec(function (reader) {
|
|
116
|
+
reader.readULEB();
|
|
117
|
+
return {
|
|
118
|
+
id: (0, utils_1.AddressFromBytes)(reader.readBytes(32)),
|
|
119
|
+
balance: reader.read64(),
|
|
120
|
+
lockUpPeriod: reader.read64(),
|
|
121
|
+
createTsMs: reader.read64(),
|
|
122
|
+
updateTsMs: reader.read64(),
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
// @ts-ignore
|
|
126
|
+
reader_1 = new bcs_1.BcsReader(new Uint8Array(results[2].returnValues[0][0]));
|
|
127
|
+
veTypusAmount = reader_1.read64();
|
|
128
|
+
return [2 /*return*/, {
|
|
129
|
+
totalVeTypusAmount: totalVeTypusAmount,
|
|
130
|
+
totalStakedTypusAmount: totalStakedTypusAmount,
|
|
131
|
+
averageLockUpTime: averageLockUpTime,
|
|
132
|
+
veTypusAmount: veTypusAmount,
|
|
133
|
+
veTypus: veTypus,
|
|
134
|
+
}];
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
// @ts-ignore
|
|
138
|
+
return [2 /*return*/, {
|
|
139
|
+
totalVeTypusAmount: totalVeTypusAmount,
|
|
140
|
+
totalStakedTypusAmount: totalStakedTypusAmount,
|
|
141
|
+
averageLockUpTime: averageLockUpTime,
|
|
142
|
+
}];
|
|
143
|
+
}
|
|
144
|
+
return [2 /*return*/];
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
}
|
|
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./leader-board"), exports);
|
|
18
18
|
__exportStar(require("./reward-generated"), exports);
|
|
19
19
|
__exportStar(require("./events"), exports);
|
|
20
|
+
__exportStar(require("./vault-history"), exports);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export declare function getVaultHistorySummary(): Promise<VaultHistorySummary[]>;
|
|
2
|
+
interface VaultHistorySummary {
|
|
3
|
+
AverageDrawdown: number;
|
|
4
|
+
AverageFilled: number;
|
|
5
|
+
AverageLoss: number;
|
|
6
|
+
BidderWinRate: number;
|
|
7
|
+
DepositorWinRate: number;
|
|
8
|
+
Index: string;
|
|
9
|
+
TotalOptionProfit: number;
|
|
10
|
+
TotalSell: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function getVaultHistory(index: string, limit?: number): Promise<VaultHistory[]>;
|
|
13
|
+
interface VaultHistory {
|
|
14
|
+
ActivationDate: string;
|
|
15
|
+
BidderPNL: string;
|
|
16
|
+
BidderPremium: string;
|
|
17
|
+
BidderPremiumUSD: string;
|
|
18
|
+
BidderROI: string;
|
|
19
|
+
BpIncentive: string;
|
|
20
|
+
BpIncentiveUSD: string;
|
|
21
|
+
DeliveryPrice: string;
|
|
22
|
+
DeliverySize: string;
|
|
23
|
+
DepositAmount: string;
|
|
24
|
+
DepositAmountUSD: string;
|
|
25
|
+
DepositorPNL: number;
|
|
26
|
+
Filled: string;
|
|
27
|
+
FixedIncentive: string;
|
|
28
|
+
FixedIncentiveUSD: number;
|
|
29
|
+
IncentivePremium: string;
|
|
30
|
+
Index: string;
|
|
31
|
+
LossPecentage: string;
|
|
32
|
+
MaxSize: string;
|
|
33
|
+
OptionProfit: string;
|
|
34
|
+
OptionProfitUSD: string;
|
|
35
|
+
OtcPremium: string;
|
|
36
|
+
OtcPrice: string;
|
|
37
|
+
OtcSize: string;
|
|
38
|
+
Premium: string;
|
|
39
|
+
PremiumUSD: string;
|
|
40
|
+
Round: string;
|
|
41
|
+
SettlePrice: string;
|
|
42
|
+
Strikes: string;
|
|
43
|
+
TotalSell: string;
|
|
44
|
+
b_token: string;
|
|
45
|
+
d_token: string;
|
|
46
|
+
o_token: string;
|
|
47
|
+
timestamp: string;
|
|
48
|
+
}
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.getVaultHistorySummary = getVaultHistorySummary;
|
|
40
|
+
exports.getVaultHistory = getVaultHistory;
|
|
41
|
+
var headers = {
|
|
42
|
+
"api-key": "tz3JJ6stG7Fux6ueRSRA5mdpC9U0lozI3",
|
|
43
|
+
"Content-Type": "application/json",
|
|
44
|
+
};
|
|
45
|
+
function getVaultHistorySummary() {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
47
|
+
var apiUrl, requestData, jsonData, response, data, result;
|
|
48
|
+
return __generator(this, function (_a) {
|
|
49
|
+
switch (_a.label) {
|
|
50
|
+
case 0:
|
|
51
|
+
apiUrl = "https://app.sentio.xyz/api/v1/analytics/typus/typus_v2/sql/execute";
|
|
52
|
+
requestData = {
|
|
53
|
+
sqlQuery: {
|
|
54
|
+
sql: "\n WITH hourly_price_table AS (\n SELECT\n symbol,\n toStartOfHour(time) AS hour,\n argMax(price, time) AS hourly_price\n FROM\n __prices__\n GROUP BY\n symbol, hour\n ),\n\n vault_history AS (\n SELECT\n Settle.timestamp as timestamp,\n Settle.index as Index,\n Settle.round as Round,\n NewAuction.start_ts_ms as ActivationDate,\n COALESCE(NULLIF(UpdateStrike.strikes, ''), NewAuction.strikes) AS Strikes, -- \u5982\u679C UpdateStrike.strikes \u662F\u7A7A\u5B57\u7B26\u4E32\uFF0C\u5C31\u4F7F\u7528 NewAuction.strikes\n Settle.oracle_price as SettlePrice,\n -- Settle.share_price as share_price,\n -- Settle.settle_balance as SettleBalance,\n CAST(Activate.deposit_balance as Float64) as DepositAmount,\n DepositAmount * Settle.price_d_token as DepositAmountUSD,\n Delivery.max_size as MaxSize,\n (SafuOtc.delivery_size + Delivery.delivery_size) as TotalSell,\n CASE WHEN MaxSize != 0 THEN TotalSell / MaxSize ELSE 0 END AS Filled,\n Delivery.delivery_size as DeliverySize,\n Delivery.delivery_price as DeliveryPrice,\n SafuOtc.delivery_size as OtcSize,\n SafuOtc.delivery_price as OtcPrice,\n Delivery.bidder_bid_value as BidderPremium,\n BidderPremium * Delivery.price_b_token as BidderPremiumUSD,\n Delivery.incentive_bid_value as IncentivePremium,\n SafuOtc.bidder_bid_value as OtcPremium,\n (Delivery.bidder_bid_value + Delivery.incentive_bid_value + SafuOtc.bidder_bid_value) AS Premium, -- Total Premium b_token\n Premium * Delivery.price_b_token AS PremiumUSD,\n Delivery.depositor_incentive_value as BpIncentive, -- SUI or SCA based on o_token\n BpIncentive * Delivery.price_o_token as BpIncentiveUSD,\n Delivery.fixed_incentive_amount as FixedIncentive, -- SUI\n FixedIncentive * hourly_price_table.hourly_price as FixedIncentiveUSD,\n (1 - Settle.share_price) as LossPecentage,\n CAST((Settle.settle_balance - Settle.settled_balance) AS Float64) as OptionProfit, -- d_token\n OptionProfit * Settle.price_d_token as OptionProfitUSD,\n PremiumUSD + BpIncentiveUSD + FixedIncentiveUSD - OptionProfitUSD as DepositorPNL,\n -- CASE WHEN DepositAmountUSD != 0 THEN DepositorPNL / DepositAmountUSD ELSE 0 END AS DepositorROI,\n OptionProfitUSD - BidderPremiumUSD as BidderPNL,\n CASE WHEN BidderPremiumUSD != 0 THEN BidderPNL / BidderPremiumUSD ELSE 0 END AS BidderROI,\n Settle.d_token as d_token,\n Delivery.b_token as b_token,\n Delivery.o_token as o_token\n FROM Settle\n JOIN Activate ON Settle.index = Activate.index AND Settle.round = Activate.round\n JOIN NewAuction ON Settle.index = NewAuction.index AND Settle.round = NewAuction.round\n LEFT JOIN UpdateStrike ON Settle.index = UpdateStrike.index AND Settle.round = UpdateStrike.round\n JOIN Delivery ON Settle.index = Delivery.index AND Settle.round = Delivery.round\n LEFT JOIN SafuOtc ON Settle.index = SafuOtc.index AND Settle.round = SafuOtc.round\n LEFT JOIN hourly_price_table ON 'sui' = hourly_price_table.symbol AND toStartOfHour(Settle.timestamp) = hourly_price_table.hour\n ORDER BY ActivationDate DESC\n )\n\n SELECT\n vault_history.Index AS Index,\n SUM(vault_history.TotalSell) AS TotalSell, -- Total Sell Size\n AVG(vault_history.Filled) AS AverageFilled, -- Average Filled Rate\n AVG(vault_history.OptionProfit) AS AverageLoss, -- Average Option Profit\n SUM(vault_history.OptionProfit) AS TotalOptionProfit, -- Total Option Profit\n AVG(CASE -- Calculating Average Drawdown, ignoring DepositAmount == 0\n WHEN vault_history.DepositAmount > 0 THEN vault_history.OptionProfit / vault_history.DepositAmount ELSE NULL\n END) AS AverageDrawdown, -- Average Drawdown (based on Option Profit and TVL)\n SUM(CASE WHEN vault_history.BidderPNL > 0 THEN 1 ELSE 0 END) / COUNT(*) AS BidderWinRate, -- Calculating Bidder Win Rate (probability BidderPNL > 0)\n SUM(CASE WHEN vault_history.DepositorPNL > 0 THEN 1 ELSE 0 END) / COUNT(*) AS DepositorWinRate -- Calculating Depositor Win Rate (probability DepositorPNL > 0)\n FROM vault_history\n GROUP BY vault_history.Index\n ORDER BY Index ASC\n ",
|
|
55
|
+
size: 1000,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
jsonData = JSON.stringify(requestData);
|
|
59
|
+
return [4 /*yield*/, fetch(apiUrl, {
|
|
60
|
+
method: "POST",
|
|
61
|
+
headers: headers,
|
|
62
|
+
body: jsonData,
|
|
63
|
+
})];
|
|
64
|
+
case 1:
|
|
65
|
+
response = _a.sent();
|
|
66
|
+
return [4 /*yield*/, response.json()];
|
|
67
|
+
case 2:
|
|
68
|
+
data = _a.sent();
|
|
69
|
+
result = data.result.rows;
|
|
70
|
+
console.log(data.result.rows.length);
|
|
71
|
+
return [2 /*return*/, result];
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function getVaultHistory(index_1) {
|
|
77
|
+
return __awaiter(this, arguments, void 0, function (index, limit) {
|
|
78
|
+
var apiUrl, requestData, jsonData, response, data, result;
|
|
79
|
+
if (limit === void 0) { limit = 100; }
|
|
80
|
+
return __generator(this, function (_a) {
|
|
81
|
+
switch (_a.label) {
|
|
82
|
+
case 0:
|
|
83
|
+
apiUrl = "https://app.sentio.xyz/api/v1/analytics/typus/typus_v2/sql/execute";
|
|
84
|
+
requestData = {
|
|
85
|
+
sqlQuery: {
|
|
86
|
+
sql: "\n WITH hourly_price_table AS (\n SELECT\n symbol,\n toStartOfHour(time) AS hour,\n argMax(price, time) AS hourly_price -- Get the most recent price before or at the hour\n FROM\n __prices__\n GROUP BY\n symbol, hour\n )\n\n SELECT\n Settle.timestamp as timestamp,\n Settle.index as Index,\n Settle.round as Round,\n NewAuction.start_ts_ms as ActivationDate,\n COALESCE(NULLIF(UpdateStrike.strikes, ''), NewAuction.strikes) AS Strikes, -- \u5982\u679C UpdateStrike.strikes \u662F\u7A7A\u5B57\u7B26\u4E32\uFF0C\u5C31\u4F7F\u7528 NewAuction.strikes\n Settle.oracle_price as SettlePrice,\n -- Settle.share_price as share_price,\n -- Settle.settle_balance as SettleBalance,\n Activate.deposit_balance as DepositAmount,\n DepositAmount * Settle.price_d_token as DepositAmountUSD,\n Delivery.max_size as MaxSize,\n (SafuOtc.delivery_size + Delivery.delivery_size) as TotalSell,\n CASE WHEN MaxSize != 0 THEN TotalSell / MaxSize ELSE 0 END AS Filled,\n Delivery.delivery_size as DeliverySize,\n Delivery.delivery_price as DeliveryPrice,\n SafuOtc.delivery_size as OtcSize,\n SafuOtc.delivery_price as OtcPrice,\n Delivery.bidder_bid_value as BidderPremium,\n BidderPremium * Delivery.price_b_token as BidderPremiumUSD,\n Delivery.incentive_bid_value as IncentivePremium,\n SafuOtc.bidder_bid_value as OtcPremium,\n (Delivery.bidder_bid_value + Delivery.incentive_bid_value + SafuOtc.bidder_bid_value) AS Premium, -- Total Premium b_token\n Premium * Delivery.price_b_token AS PremiumUSD,\n Delivery.depositor_incentive_value as BpIncentive, -- SUI or SCA based on o_token\n BpIncentive * Delivery.price_o_token as BpIncentiveUSD,\n Delivery.fixed_incentive_amount as FixedIncentive, -- SUI\n FixedIncentive * hourly_price_table.hourly_price as FixedIncentiveUSD,\n (1 - Settle.share_price) as LossPecentage,\n (Settle.settle_balance - Settle.settled_balance) as OptionProfit, -- d_token\n OptionProfit * Settle.price_d_token as OptionProfitUSD,\n PremiumUSD + BpIncentiveUSD + FixedIncentiveUSD - OptionProfitUSD as DepositorPNL,\n -- CASE WHEN DepositAmountUSD != 0 THEN DepositorPNL / DepositAmountUSD ELSE 0 END AS DepositorROI,\n OptionProfitUSD - BidderPremiumUSD as BidderPNL,\n CASE WHEN BidderPremiumUSD != 0 THEN BidderPNL / BidderPremiumUSD ELSE 0 END AS BidderROI,\n Settle.d_token as d_token,\n Delivery.b_token as b_token,\n Delivery.o_token as o_token\n FROM Settle\n JOIN Activate ON Settle.index = Activate.index AND Settle.round = Activate.round\n JOIN NewAuction ON Settle.index = NewAuction.index AND Settle.round = NewAuction.round\n LEFT JOIN UpdateStrike ON Settle.index = UpdateStrike.index AND Settle.round = UpdateStrike.round\n JOIN Delivery ON Settle.index = Delivery.index AND Settle.round = Delivery.round\n LEFT JOIN SafuOtc ON Settle.index = SafuOtc.index AND Settle.round = SafuOtc.round\n -- LEFT JOIN hourly_price_table ON LOWER(Settle.d_token) = hourly_price_table.symbol AND toStartOfHour(Settle.timestamp) = hourly_price_table.hour\n LEFT JOIN hourly_price_table ON 'sui' = hourly_price_table.symbol AND toStartOfHour(Settle.timestamp) = hourly_price_table.hour\n WHERE Settle.index = ".concat(index, "\n ORDER BY ActivationDate DESC;\n "),
|
|
87
|
+
size: limit,
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
jsonData = JSON.stringify(requestData);
|
|
91
|
+
return [4 /*yield*/, fetch(apiUrl, {
|
|
92
|
+
method: "POST",
|
|
93
|
+
headers: headers,
|
|
94
|
+
body: jsonData,
|
|
95
|
+
})];
|
|
96
|
+
case 1:
|
|
97
|
+
response = _a.sent();
|
|
98
|
+
return [4 /*yield*/, response.json()];
|
|
99
|
+
case 2:
|
|
100
|
+
data = _a.sent();
|
|
101
|
+
result = data.result.rows;
|
|
102
|
+
console.log(result);
|
|
103
|
+
return [2 /*return*/, result];
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
// getVaultHistorySummary();
|
|
109
|
+
// getVaultHistory("0");
|