@nadohq/indexer-client 0.15.0 → 0.17.0
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/CandlestickPeriod-1DtcEiOb.d.ts +15 -0
- package/dist/CandlestickPeriod-1DtcEiOb.d.ts.map +1 -0
- package/dist/CandlestickPeriod-D3_IoSev.d.cts +15 -0
- package/dist/CandlestickPeriod-D3_IoSev.d.cts.map +1 -0
- package/dist/IndexerBaseClient-3KfzA2ph.cjs +639 -0
- package/dist/IndexerBaseClient-3KfzA2ph.cjs.map +1 -0
- package/dist/IndexerBaseClient.cjs +3 -788
- package/dist/IndexerBaseClient.d.cts +223 -229
- package/dist/IndexerBaseClient.d.cts.map +1 -0
- package/dist/IndexerBaseClient.d.ts +223 -229
- package/dist/IndexerBaseClient.d.ts.map +1 -0
- package/dist/IndexerBaseClient.js +601 -783
- package/dist/IndexerBaseClient.js.map +1 -1
- package/dist/IndexerClient.cjs +275 -381
- package/dist/IndexerClient.cjs.map +1 -1
- package/dist/IndexerClient.d.cts +32 -43
- package/dist/IndexerClient.d.cts.map +1 -0
- package/dist/IndexerClient.d.ts +32 -43
- package/dist/IndexerClient.d.ts.map +1 -0
- package/dist/IndexerClient.js +273 -362
- package/dist/IndexerClient.js.map +1 -1
- package/dist/IndexerEventType-B-uXsf-a.d.cts +5 -0
- package/dist/IndexerEventType-B-uXsf-a.d.cts.map +1 -0
- package/dist/IndexerEventType-DCLkSlgR.d.ts +5 -0
- package/dist/IndexerEventType-DCLkSlgR.d.ts.map +1 -0
- package/dist/IndexerLeaderboardType-Ck12QVWR.d.cts +13 -0
- package/dist/IndexerLeaderboardType-Ck12QVWR.d.cts.map +1 -0
- package/dist/IndexerLeaderboardType-DAKw2tfI.d.ts +13 -0
- package/dist/IndexerLeaderboardType-DAKw2tfI.d.ts.map +1 -0
- package/dist/NadoTx-CWCklgY4.d.ts +50 -0
- package/dist/NadoTx-CWCklgY4.d.ts.map +1 -0
- package/dist/NadoTx-MYNIlXyq.d.cts +50 -0
- package/dist/NadoTx-MYNIlXyq.d.cts.map +1 -0
- package/dist/clientTypes-BpxOUu1q.d.ts +709 -0
- package/dist/clientTypes-BpxOUu1q.d.ts.map +1 -0
- package/dist/clientTypes-BsJ2yIC4.d.cts +709 -0
- package/dist/clientTypes-BsJ2yIC4.d.cts.map +1 -0
- package/dist/collateralEventType-CzH_2iTV.d.ts +5 -0
- package/dist/collateralEventType-CzH_2iTV.d.ts.map +1 -0
- package/dist/collateralEventType-DIm6Te7F.d.cts +5 -0
- package/dist/collateralEventType-DIm6Te7F.d.cts.map +1 -0
- package/dist/dataMappers.cjs +269 -346
- package/dist/dataMappers.cjs.map +1 -1
- package/dist/dataMappers.d.cts +7 -12
- package/dist/dataMappers.d.cts.map +1 -0
- package/dist/dataMappers.d.ts +7 -12
- package/dist/dataMappers.d.ts.map +1 -0
- package/dist/dataMappers.js +248 -314
- package/dist/dataMappers.js.map +1 -1
- package/dist/endpoints.cjs +8 -32
- package/dist/endpoints.cjs.map +1 -1
- package/dist/endpoints.d.cts +4 -2
- package/dist/endpoints.d.cts.map +1 -0
- package/dist/endpoints.d.ts +4 -2
- package/dist/endpoints.d.ts.map +1 -0
- package/dist/endpoints.js +8 -8
- package/dist/endpoints.js.map +1 -1
- package/dist/index-D6CnpA_r.d.cts +1 -0
- package/dist/index-DhI2LvVQ.d.ts +1 -0
- package/dist/index.cjs +15 -33
- package/dist/index.d.cts +14 -18
- package/dist/index.d.ts +14 -18
- package/dist/index.js +8 -7
- package/dist/indexerBalanceValue-4AuNuTAc.d.cts +32 -0
- package/dist/indexerBalanceValue-4AuNuTAc.d.cts.map +1 -0
- package/dist/indexerBalanceValue-B0OggI67.d.ts +32 -0
- package/dist/indexerBalanceValue-B0OggI67.d.ts.map +1 -0
- package/dist/paginatedEventsTypes-DtGDU-kI.d.cts +110 -0
- package/dist/paginatedEventsTypes-DtGDU-kI.d.cts.map +1 -0
- package/dist/paginatedEventsTypes-RwXoQrEa.d.ts +110 -0
- package/dist/paginatedEventsTypes-RwXoQrEa.d.ts.map +1 -0
- package/dist/serverModelTypes-CM2g040o.d.cts +262 -0
- package/dist/serverModelTypes-CM2g040o.d.cts.map +1 -0
- package/dist/serverModelTypes-DPHMUSZe.d.ts +262 -0
- package/dist/serverModelTypes-DPHMUSZe.d.ts.map +1 -0
- package/dist/serverTypes-BMSNh2GK.d.cts +452 -0
- package/dist/serverTypes-BMSNh2GK.d.cts.map +1 -0
- package/dist/serverTypes-c8IABU73.d.ts +452 -0
- package/dist/serverTypes-c8IABU73.d.ts.map +1 -0
- package/dist/types/CandlestickPeriod.cjs +16 -40
- package/dist/types/CandlestickPeriod.cjs.map +1 -1
- package/dist/types/CandlestickPeriod.d.cts +2 -13
- package/dist/types/CandlestickPeriod.d.ts +2 -13
- package/dist/types/CandlestickPeriod.js +16 -16
- package/dist/types/CandlestickPeriod.js.map +1 -1
- package/dist/types/IndexerEventType.cjs +0 -19
- package/dist/types/IndexerEventType.d.cts +2 -3
- package/dist/types/IndexerEventType.d.ts +2 -3
- package/dist/types/IndexerEventType.js +1 -1
- package/dist/types/IndexerLeaderboardType.cjs +0 -19
- package/dist/types/IndexerLeaderboardType.d.cts +2 -11
- package/dist/types/IndexerLeaderboardType.d.ts +2 -11
- package/dist/types/IndexerLeaderboardType.js +1 -1
- package/dist/types/NadoTx.cjs +0 -19
- package/dist/types/NadoTx.d.cts +2 -48
- package/dist/types/NadoTx.d.ts +2 -48
- package/dist/types/NadoTx.js +1 -1
- package/dist/types/clientTypes.cjs +0 -19
- package/dist/types/clientTypes.d.cts +2 -709
- package/dist/types/clientTypes.d.ts +2 -709
- package/dist/types/clientTypes.js +1 -1
- package/dist/types/collateralEventType.cjs +0 -19
- package/dist/types/collateralEventType.d.cts +2 -3
- package/dist/types/collateralEventType.d.ts +2 -3
- package/dist/types/collateralEventType.js +1 -1
- package/dist/types/index.cjs +3 -41
- package/dist/types/index.d.cts +10 -13
- package/dist/types/index.d.ts +10 -13
- package/dist/types/index.js +2 -11
- package/dist/types/paginatedEventsTypes.cjs +0 -19
- package/dist/types/paginatedEventsTypes.d.cts +2 -115
- package/dist/types/paginatedEventsTypes.d.ts +2 -115
- package/dist/types/paginatedEventsTypes.js +1 -1
- package/dist/types/serverModelTypes.cjs +0 -19
- package/dist/types/serverModelTypes.d.cts +2 -260
- package/dist/types/serverModelTypes.d.ts +2 -260
- package/dist/types/serverModelTypes.js +1 -1
- package/dist/types/serverTypes.cjs +0 -19
- package/dist/types/serverTypes.d.cts +2 -451
- package/dist/types/serverTypes.d.ts +2 -451
- package/dist/types/serverTypes.js +1 -1
- package/dist/utils/index.cjs +5 -25
- package/dist/utils/index.d.cts +2 -12
- package/dist/utils/index.d.ts +2 -12
- package/dist/utils/index.js +2 -3
- package/dist/utils/indexerBalanceValue.cjs +32 -36
- package/dist/utils/indexerBalanceValue.cjs.map +1 -1
- package/dist/utils/indexerBalanceValue.d.cts +2 -39
- package/dist/utils/indexerBalanceValue.d.ts +2 -39
- package/dist/utils/indexerBalanceValue.js +29 -9
- package/dist/utils/indexerBalanceValue.js.map +1 -1
- package/package.json +10 -10
- package/dist/IndexerBaseClient.cjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/types/IndexerEventType.cjs.map +0 -1
- package/dist/types/IndexerEventType.js.map +0 -1
- package/dist/types/IndexerLeaderboardType.cjs.map +0 -1
- package/dist/types/IndexerLeaderboardType.js.map +0 -1
- package/dist/types/NadoTx.cjs.map +0 -1
- package/dist/types/NadoTx.js.map +0 -1
- package/dist/types/clientTypes.cjs.map +0 -1
- package/dist/types/clientTypes.js.map +0 -1
- package/dist/types/collateralEventType.cjs.map +0 -1
- package/dist/types/collateralEventType.js.map +0 -1
- package/dist/types/index.cjs.map +0 -1
- package/dist/types/index.js.map +0 -1
- package/dist/types/paginatedEventsTypes.cjs.map +0 -1
- package/dist/types/paginatedEventsTypes.js.map +0 -1
- package/dist/types/serverModelTypes.cjs.map +0 -1
- package/dist/types/serverModelTypes.js.map +0 -1
- package/dist/types/serverTypes.cjs.map +0 -1
- package/dist/types/serverTypes.js.map +0 -1
- package/dist/utils/index.cjs.map +0 -1
- package/dist/utils/index.js.map +0 -1
|
@@ -1,788 +1,3 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/IndexerBaseClient.ts
|
|
31
|
-
var IndexerBaseClient_exports = {};
|
|
32
|
-
__export(IndexerBaseClient_exports, {
|
|
33
|
-
IndexerBaseClient: () => IndexerBaseClient
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(IndexerBaseClient_exports);
|
|
36
|
-
var import_shared = require("@nadohq/shared");
|
|
37
|
-
var import_axios = __toESM(require("axios"), 1);
|
|
38
|
-
var import_dataMappers = require("./dataMappers.cjs");
|
|
39
|
-
var IndexerBaseClient = class {
|
|
40
|
-
constructor(opts) {
|
|
41
|
-
this.opts = opts;
|
|
42
|
-
this.axiosInstance = import_axios.default.create({
|
|
43
|
-
withCredentials: true,
|
|
44
|
-
// We have custom logic to validate response status and create an appropriate error
|
|
45
|
-
validateStatus: () => true
|
|
46
|
-
});
|
|
47
|
-
this.v2Url = opts.v2Url ? opts.v2Url : opts.url.replace("v1", "v2");
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Sets the linked signer for execute requests
|
|
51
|
-
*
|
|
52
|
-
* @param linkedSignerWalletClient The linkedSigner to use for all signatures. Set to null to revert to the chain signer
|
|
53
|
-
*/
|
|
54
|
-
setLinkedSigner(linkedSignerWalletClient) {
|
|
55
|
-
this.opts.linkedSignerWalletClient = linkedSignerWalletClient ?? void 0;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* List all subaccounts
|
|
59
|
-
*
|
|
60
|
-
* @param params
|
|
61
|
-
*/
|
|
62
|
-
async listSubaccounts(params) {
|
|
63
|
-
const baseResponse = await this.query("subaccounts", params);
|
|
64
|
-
return baseResponse.subaccounts.map((item) => {
|
|
65
|
-
const subaccount = (0, import_shared.subaccountFromHex)(item.subaccount);
|
|
66
|
-
return {
|
|
67
|
-
hexId: item.subaccount,
|
|
68
|
-
createdAt: Number(item.created_at),
|
|
69
|
-
isolated: item.isolated,
|
|
70
|
-
...subaccount
|
|
71
|
-
};
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Retrieve snapshots of multiple subaccounts at multiple points in time.
|
|
76
|
-
* Each snapshot is a view of the subaccount's balances at this point in time, with tracked variables for interest, funding, etc.
|
|
77
|
-
*
|
|
78
|
-
* @param params
|
|
79
|
-
*/
|
|
80
|
-
async getMultiSubaccountSnapshots(params) {
|
|
81
|
-
const subaccountHexIds = params.subaccounts.map(
|
|
82
|
-
({ subaccountOwner, subaccountName }) => (0, import_shared.subaccountToHex)({
|
|
83
|
-
subaccountOwner,
|
|
84
|
-
subaccountName
|
|
85
|
-
})
|
|
86
|
-
);
|
|
87
|
-
const baseResponse = await this.query("account_snapshots", {
|
|
88
|
-
subaccounts: subaccountHexIds,
|
|
89
|
-
timestamps: params.timestamps,
|
|
90
|
-
isolated: params.isolated
|
|
91
|
-
});
|
|
92
|
-
const snapshotsBySubaccount = (0, import_shared.mapValues)(
|
|
93
|
-
baseResponse.snapshots,
|
|
94
|
-
(balanceSnapshots) => {
|
|
95
|
-
const snapshotByTimestamp = {};
|
|
96
|
-
Object.entries(balanceSnapshots).forEach(([timestamp, events]) => {
|
|
97
|
-
const balances = events.map(import_dataMappers.mapIndexerEvent);
|
|
98
|
-
snapshotByTimestamp[timestamp] = {
|
|
99
|
-
timestamp: (0, import_shared.toBigNumber)(timestamp),
|
|
100
|
-
balances
|
|
101
|
-
};
|
|
102
|
-
});
|
|
103
|
-
return snapshotByTimestamp;
|
|
104
|
-
}
|
|
105
|
-
);
|
|
106
|
-
return {
|
|
107
|
-
subaccountHexIds,
|
|
108
|
-
snapshots: snapshotsBySubaccount
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Retrieves referral code for an address
|
|
113
|
-
*
|
|
114
|
-
* @param params
|
|
115
|
-
*/
|
|
116
|
-
async getReferralCode(params) {
|
|
117
|
-
const baseResponse = await this.query("referral_code", {
|
|
118
|
-
subaccount: (0, import_shared.subaccountToHex)({
|
|
119
|
-
subaccountOwner: params.subaccount.subaccountOwner,
|
|
120
|
-
subaccountName: params.subaccount.subaccountName
|
|
121
|
-
})
|
|
122
|
-
});
|
|
123
|
-
return {
|
|
124
|
-
referralCode: baseResponse.referral_code
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Retrieves funding rate for a product, where 1 = 100%
|
|
129
|
-
* @param params
|
|
130
|
-
*/
|
|
131
|
-
async getFundingRate(params) {
|
|
132
|
-
const baseResponse = await this.query("funding_rate", {
|
|
133
|
-
product_id: params.productId
|
|
134
|
-
});
|
|
135
|
-
return (0, import_dataMappers.mapIndexerFundingRate)(baseResponse);
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Retrieves funding rate for multiple products, where 1 = 100%
|
|
139
|
-
* @param params
|
|
140
|
-
*/
|
|
141
|
-
async getMultiProductFundingRates(params) {
|
|
142
|
-
const baseResponse = await this.query("funding_rates", {
|
|
143
|
-
product_ids: params.productIds
|
|
144
|
-
});
|
|
145
|
-
return (0, import_shared.mapValues)(baseResponse, import_dataMappers.mapIndexerFundingRate);
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Retrieves latest mark/index price for a perp product
|
|
149
|
-
* @param params
|
|
150
|
-
*/
|
|
151
|
-
async getPerpPrices(params) {
|
|
152
|
-
const baseResponse = await this.query("price", {
|
|
153
|
-
product_id: params.productId
|
|
154
|
-
});
|
|
155
|
-
return (0, import_dataMappers.mapIndexerPerpPrices)(baseResponse);
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Retrieves latest mark/index price for multiple perp products
|
|
159
|
-
* @param params
|
|
160
|
-
*/
|
|
161
|
-
async getMultiProductPerpPrices(params) {
|
|
162
|
-
const baseResponse = await this.query("perp_prices", {
|
|
163
|
-
product_ids: params.productIds
|
|
164
|
-
});
|
|
165
|
-
return (0, import_shared.mapValues)(baseResponse, import_dataMappers.mapIndexerPerpPrices);
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Retrieves latest oracle prices for provided products
|
|
169
|
-
* @param params
|
|
170
|
-
*/
|
|
171
|
-
async getOraclePrices(params) {
|
|
172
|
-
const baseResponse = await this.query("oracle_price", {
|
|
173
|
-
product_ids: params.productIds
|
|
174
|
-
});
|
|
175
|
-
return baseResponse.prices.map((price) => {
|
|
176
|
-
return {
|
|
177
|
-
oraclePrice: (0, import_shared.removeDecimals)(price.oracle_price_x18),
|
|
178
|
-
updateTime: (0, import_shared.toBigNumber)(price.update_time),
|
|
179
|
-
productId: price.product_id
|
|
180
|
-
};
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Retrieves candlesticks for a product
|
|
185
|
-
* @param params
|
|
186
|
-
*/
|
|
187
|
-
async getCandlesticks(params) {
|
|
188
|
-
const baseResponse = await this.query("candlesticks", {
|
|
189
|
-
product_id: params.productId,
|
|
190
|
-
max_time: params.maxTimeInclusive,
|
|
191
|
-
limit: params.limit,
|
|
192
|
-
granularity: params.period
|
|
193
|
-
});
|
|
194
|
-
return baseResponse.candlesticks.map(import_dataMappers.mapIndexerCandlesticks);
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Retrieves candlesticks for a product from Edge
|
|
198
|
-
* @param params
|
|
199
|
-
*/
|
|
200
|
-
async getEdgeCandlesticks(params) {
|
|
201
|
-
const baseResponse = await this.query("edge_candlesticks", {
|
|
202
|
-
product_id: params.productId,
|
|
203
|
-
max_time: params.maxTimeInclusive,
|
|
204
|
-
limit: params.limit,
|
|
205
|
-
granularity: params.period
|
|
206
|
-
});
|
|
207
|
-
return baseResponse.candlesticks.map(import_dataMappers.mapIndexerCandlesticks);
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Retrieves historical snapshots for a product
|
|
211
|
-
* @param params
|
|
212
|
-
*/
|
|
213
|
-
async getProductSnapshots(params) {
|
|
214
|
-
const baseResponse = await this.query("products", {
|
|
215
|
-
product_id: params.productId,
|
|
216
|
-
max_time: params.maxTimestampInclusive,
|
|
217
|
-
limit: params.limit,
|
|
218
|
-
idx: params.startCursor
|
|
219
|
-
});
|
|
220
|
-
return baseResponse.products.map((product) => {
|
|
221
|
-
return {
|
|
222
|
-
...(0, import_dataMappers.mapIndexerServerProduct)(product.product),
|
|
223
|
-
submissionIndex: product.submission_idx
|
|
224
|
-
};
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Retrieves historical snapshots for multiple products
|
|
229
|
-
* @param params
|
|
230
|
-
*/
|
|
231
|
-
async getMultiProductSnapshots(params) {
|
|
232
|
-
const timestampToProductsMap = await this.query("product_snapshots", {
|
|
233
|
-
product_ids: params.productIds,
|
|
234
|
-
max_time: params.maxTimestampInclusive ?? [(0, import_shared.nowInSeconds)()]
|
|
235
|
-
});
|
|
236
|
-
return (0, import_shared.mapValues)(timestampToProductsMap, (productIdToProduct) => {
|
|
237
|
-
return (0, import_shared.mapValues)(productIdToProduct, (indexerProduct) => {
|
|
238
|
-
return {
|
|
239
|
-
...(0, import_dataMappers.mapIndexerServerProduct)(indexerProduct.product),
|
|
240
|
-
submissionIndex: indexerProduct.submission_idx
|
|
241
|
-
};
|
|
242
|
-
});
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* Retrieves historical events
|
|
247
|
-
*
|
|
248
|
-
* @param params
|
|
249
|
-
*/
|
|
250
|
-
async getEvents(params) {
|
|
251
|
-
const serverLimit = (() => {
|
|
252
|
-
if (!params.limit) {
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
if (params.limit.type === "events") {
|
|
256
|
-
return {
|
|
257
|
-
raw: params.limit.value
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
return {
|
|
261
|
-
txs: params.limit.value
|
|
262
|
-
};
|
|
263
|
-
})();
|
|
264
|
-
const baseResponse = await this.query("events", {
|
|
265
|
-
subaccounts: params.subaccounts?.map(
|
|
266
|
-
(subaccount) => (0, import_shared.subaccountToHex)({
|
|
267
|
-
subaccountOwner: subaccount.subaccountOwner,
|
|
268
|
-
subaccountName: subaccount.subaccountName
|
|
269
|
-
})
|
|
270
|
-
),
|
|
271
|
-
product_ids: params.productIds,
|
|
272
|
-
isolated: params.isolated,
|
|
273
|
-
event_types: params.eventTypes,
|
|
274
|
-
max_time: params.maxTimestampInclusive,
|
|
275
|
-
desc: params.desc,
|
|
276
|
-
limit: serverLimit,
|
|
277
|
-
idx: params.startCursor
|
|
278
|
-
});
|
|
279
|
-
let lastTxIdx = 0;
|
|
280
|
-
return baseResponse.events.map((event) => {
|
|
281
|
-
if (baseResponse.txs[lastTxIdx].submission_idx !== event.submission_idx) {
|
|
282
|
-
lastTxIdx += 1;
|
|
283
|
-
}
|
|
284
|
-
const tx = baseResponse.txs[lastTxIdx];
|
|
285
|
-
return (0, import_dataMappers.mapIndexerEventWithTx)(event, tx);
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* Retrieves historical orders
|
|
290
|
-
* @param params
|
|
291
|
-
*/
|
|
292
|
-
async getOrders(params) {
|
|
293
|
-
const baseResponse = await this.query("orders", {
|
|
294
|
-
subaccounts: params?.subaccounts?.map(
|
|
295
|
-
(subaccount) => (0, import_shared.subaccountToHex)({
|
|
296
|
-
subaccountOwner: subaccount.subaccountOwner,
|
|
297
|
-
subaccountName: subaccount.subaccountName
|
|
298
|
-
})
|
|
299
|
-
),
|
|
300
|
-
product_ids: params.productIds,
|
|
301
|
-
trigger_types: params.triggerTypes,
|
|
302
|
-
isolated: params.isolated,
|
|
303
|
-
digests: params.digests,
|
|
304
|
-
max_time: params.maxTimestampInclusive,
|
|
305
|
-
limit: params.limit,
|
|
306
|
-
idx: params.startCursor
|
|
307
|
-
});
|
|
308
|
-
return baseResponse.orders.map(import_dataMappers.mapIndexerOrder);
|
|
309
|
-
}
|
|
310
|
-
/**
|
|
311
|
-
* Gets match order events, this will return the same events as the events query, but with additional information
|
|
312
|
-
* to identify the order that was matched
|
|
313
|
-
*
|
|
314
|
-
* @param params
|
|
315
|
-
*/
|
|
316
|
-
async getMatchEvents(params) {
|
|
317
|
-
const baseResponse = await this.query("matches", {
|
|
318
|
-
subaccounts: params?.subaccounts?.map(
|
|
319
|
-
(subaccount) => (0, import_shared.subaccountToHex)({
|
|
320
|
-
subaccountOwner: subaccount.subaccountOwner,
|
|
321
|
-
subaccountName: subaccount.subaccountName
|
|
322
|
-
})
|
|
323
|
-
),
|
|
324
|
-
product_ids: params.productIds,
|
|
325
|
-
isolated: params.isolated,
|
|
326
|
-
max_time: params.maxTimestampInclusive,
|
|
327
|
-
limit: params.limit,
|
|
328
|
-
idx: params.startCursor
|
|
329
|
-
});
|
|
330
|
-
let lastTxIdx = 0;
|
|
331
|
-
return baseResponse.matches.map((matchEvent) => {
|
|
332
|
-
if (baseResponse.txs[lastTxIdx].submission_idx !== matchEvent.submission_idx) {
|
|
333
|
-
lastTxIdx += 1;
|
|
334
|
-
}
|
|
335
|
-
const { tx, timestamp } = baseResponse.txs[lastTxIdx];
|
|
336
|
-
const postBalances = (0, import_dataMappers.mapIndexerMatchEventBalances)(
|
|
337
|
-
matchEvent.post_balance
|
|
338
|
-
);
|
|
339
|
-
return {
|
|
340
|
-
productId: postBalances.base.productId,
|
|
341
|
-
isolated: matchEvent.isolated,
|
|
342
|
-
totalFee: (0, import_shared.toBigNumber)(matchEvent.fee),
|
|
343
|
-
sequencerFee: (0, import_shared.toBigNumber)(matchEvent.sequencer_fee),
|
|
344
|
-
builderFee: (0, import_shared.toBigNumber)(matchEvent.builder_fee),
|
|
345
|
-
baseFilled: (0, import_shared.toBigNumber)(matchEvent.base_filled),
|
|
346
|
-
quoteFilled: (0, import_shared.toBigNumber)(matchEvent.quote_filled),
|
|
347
|
-
cumulativeFee: (0, import_shared.toBigNumber)(matchEvent.cumulative_fee),
|
|
348
|
-
cumulativeBaseFilled: (0, import_shared.toBigNumber)(matchEvent.cumulative_base_filled),
|
|
349
|
-
cumulativeQuoteFilled: (0, import_shared.toBigNumber)(matchEvent.cumulative_quote_filled),
|
|
350
|
-
digest: matchEvent.digest,
|
|
351
|
-
order: matchEvent.order,
|
|
352
|
-
submissionIndex: matchEvent.submission_idx,
|
|
353
|
-
timestamp: (0, import_shared.toBigNumber)(timestamp),
|
|
354
|
-
preEventTrackedVars: {
|
|
355
|
-
netEntryUnrealized: (0, import_shared.toBigNumber)(matchEvent.net_entry_unrealized),
|
|
356
|
-
netEntryCumulative: (0, import_shared.toBigNumber)(matchEvent.net_entry_cumulative)
|
|
357
|
-
},
|
|
358
|
-
preBalances: (0, import_dataMappers.mapIndexerMatchEventBalances)(matchEvent.pre_balance),
|
|
359
|
-
postBalances,
|
|
360
|
-
tx,
|
|
361
|
-
isTaker: matchEvent.is_taker,
|
|
362
|
-
realizedPnl: (0, import_shared.toBigNumber)(matchEvent.realized_pnl),
|
|
363
|
-
closedAmount: (0, import_shared.toBigNumber)(matchEvent.closed_amount),
|
|
364
|
-
closedNetEntry: (0, import_shared.toBigNumber)(matchEvent.closed_net_entry),
|
|
365
|
-
margin: matchEvent.margin ? (0, import_shared.toBigNumber)(matchEvent.margin) : null,
|
|
366
|
-
...(0, import_shared.subaccountFromHex)(matchEvent.order.sender)
|
|
367
|
-
};
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
/**
|
|
371
|
-
* Retrieves historical funding & interest payments.
|
|
372
|
-
* NOTE: `limit` is an upperbound. If a user changes position size such that his position is 0 during each funding/interest tick,
|
|
373
|
-
* then the indexer will return fewer than `limit` results per page. However, more events can be present. This means that
|
|
374
|
-
* there isn't a reliable way to determine whether there is a next page. We just need to keep paginating until the next cursor is null.
|
|
375
|
-
*
|
|
376
|
-
* @param params
|
|
377
|
-
*/
|
|
378
|
-
async getInterestFundingPayments(params) {
|
|
379
|
-
const baseResponse = await this.query("interest_and_funding", {
|
|
380
|
-
subaccount: (0, import_shared.subaccountToHex)({
|
|
381
|
-
subaccountOwner: params.subaccount.subaccountOwner,
|
|
382
|
-
subaccountName: params.subaccount.subaccountName
|
|
383
|
-
}),
|
|
384
|
-
product_ids: params.productIds,
|
|
385
|
-
max_time: params.maxTimestampInclusive,
|
|
386
|
-
limit: params.limit,
|
|
387
|
-
max_idx: params.startCursor
|
|
388
|
-
});
|
|
389
|
-
return {
|
|
390
|
-
fundingPayments: baseResponse.funding_payments.map(
|
|
391
|
-
import_dataMappers.mapIndexerProductPayment
|
|
392
|
-
),
|
|
393
|
-
interestPayments: baseResponse.interest_payments.map(
|
|
394
|
-
import_dataMappers.mapIndexerProductPayment
|
|
395
|
-
),
|
|
396
|
-
nextCursor: baseResponse.next_idx
|
|
397
|
-
};
|
|
398
|
-
}
|
|
399
|
-
/**
|
|
400
|
-
* Gets quote (USDT) price in terms of USD
|
|
401
|
-
*/
|
|
402
|
-
async getQuotePrice() {
|
|
403
|
-
const baseResponse = await this.query("quote_price", {});
|
|
404
|
-
return {
|
|
405
|
-
price: (0, import_shared.removeDecimals)(baseResponse.price_x18)
|
|
406
|
-
};
|
|
407
|
-
}
|
|
408
|
-
/**
|
|
409
|
-
* Fetches currently registered linked signer with the remaining txs allowed for the subaccount
|
|
410
|
-
*/
|
|
411
|
-
async getLinkedSignerWithRateLimit(params) {
|
|
412
|
-
const baseResponse = await this.query("linked_signer_rate_limit", {
|
|
413
|
-
subaccount: (0, import_shared.subaccountToHex)(params.subaccount)
|
|
414
|
-
});
|
|
415
|
-
return {
|
|
416
|
-
totalTxLimit: (0, import_shared.toBigNumber)(baseResponse.total_tx_limit),
|
|
417
|
-
remainingTxs: (0, import_shared.toBigNumber)(baseResponse.remaining_tx),
|
|
418
|
-
signer: baseResponse.signer,
|
|
419
|
-
waitTimeUntilNextTx: (0, import_shared.toBigNumber)(baseResponse.wait_time)
|
|
420
|
-
};
|
|
421
|
-
}
|
|
422
|
-
/**
|
|
423
|
-
* Retrieve historical market snapshots
|
|
424
|
-
* @param params
|
|
425
|
-
*/
|
|
426
|
-
async getMarketSnapshots(params) {
|
|
427
|
-
const baseResponse = await this.query("market_snapshots", {
|
|
428
|
-
interval: (0, import_dataMappers.mapSnapshotsIntervalToServerParams)(params),
|
|
429
|
-
product_ids: params.productIds
|
|
430
|
-
});
|
|
431
|
-
return baseResponse.snapshots.map(import_dataMappers.mapIndexerMarketSnapshot);
|
|
432
|
-
}
|
|
433
|
-
/**
|
|
434
|
-
* Retrieve historical market snapshots from Edge
|
|
435
|
-
* @param params
|
|
436
|
-
*/
|
|
437
|
-
async getEdgeMarketSnapshots(params) {
|
|
438
|
-
const baseResponse = await this.query("edge_market_snapshots", {
|
|
439
|
-
interval: (0, import_dataMappers.mapSnapshotsIntervalToServerParams)(params)
|
|
440
|
-
});
|
|
441
|
-
return (0, import_shared.mapValues)(
|
|
442
|
-
baseResponse.snapshots,
|
|
443
|
-
(snapshots) => snapshots.map(import_dataMappers.mapIndexerMarketSnapshot)
|
|
444
|
-
);
|
|
445
|
-
}
|
|
446
|
-
/**
|
|
447
|
-
* Retrieve maker statistics for a given epoch
|
|
448
|
-
*
|
|
449
|
-
* @param params
|
|
450
|
-
*/
|
|
451
|
-
async getMakerStatistics(params) {
|
|
452
|
-
const baseResponse = await this.query("maker_statistics", {
|
|
453
|
-
product_id: params.productId,
|
|
454
|
-
epoch: params.epoch,
|
|
455
|
-
interval: params.interval
|
|
456
|
-
});
|
|
457
|
-
return {
|
|
458
|
-
rewardCoefficient: (0, import_shared.toBigNumber)(baseResponse.reward_coefficient),
|
|
459
|
-
makers: baseResponse.makers.map(import_dataMappers.mapIndexerMakerStatistics)
|
|
460
|
-
};
|
|
461
|
-
}
|
|
462
|
-
/**
|
|
463
|
-
* Retrieve leaderboard stats for a given contest
|
|
464
|
-
*
|
|
465
|
-
* @param params
|
|
466
|
-
*/
|
|
467
|
-
async getLeaderboard(params) {
|
|
468
|
-
const baseResponse = await this.query("leaderboard", {
|
|
469
|
-
contest_id: params.contestId,
|
|
470
|
-
rank_type: params.rankType,
|
|
471
|
-
start: params.startCursor,
|
|
472
|
-
limit: params.limit,
|
|
473
|
-
order: params.order
|
|
474
|
-
});
|
|
475
|
-
return {
|
|
476
|
-
participants: baseResponse.positions.map(import_dataMappers.mapIndexerLeaderboardPosition)
|
|
477
|
-
};
|
|
478
|
-
}
|
|
479
|
-
/**
|
|
480
|
-
* Retrieve leaderboard ranking of a subaccount on a given contest
|
|
481
|
-
*
|
|
482
|
-
* @param params
|
|
483
|
-
*/
|
|
484
|
-
async getLeaderboardParticipant(params) {
|
|
485
|
-
const baseResponse = await this.query("leaderboard_rank", {
|
|
486
|
-
subaccount: (0, import_shared.subaccountToHex)(params.subaccount),
|
|
487
|
-
contest_ids: params.contestIds
|
|
488
|
-
});
|
|
489
|
-
return {
|
|
490
|
-
participant: (0, import_shared.mapValues)(
|
|
491
|
-
baseResponse.positions,
|
|
492
|
-
(position) => (0, import_dataMappers.mapIndexerLeaderboardPosition)(position)
|
|
493
|
-
)
|
|
494
|
-
};
|
|
495
|
-
}
|
|
496
|
-
/**
|
|
497
|
-
* Registers a subaccount for one or more contests. Requires EIP-712 signing.
|
|
498
|
-
*
|
|
499
|
-
* @param params - Registration parameters including contest IDs and signing config.
|
|
500
|
-
*/
|
|
501
|
-
async registerLeaderboard(params) {
|
|
502
|
-
const signatureParams = {
|
|
503
|
-
expiration: (0, import_shared.toIntegerString)(params.recvTime ?? (0, import_shared.getDefaultRecvTime)()),
|
|
504
|
-
subaccountName: params.subaccountName,
|
|
505
|
-
subaccountOwner: params.subaccountOwner,
|
|
506
|
-
contestIds: params.contestIds
|
|
507
|
-
};
|
|
508
|
-
const tx = (0, import_shared.getNadoEIP712Values)(
|
|
509
|
-
"leaderboard_authentication",
|
|
510
|
-
signatureParams
|
|
511
|
-
);
|
|
512
|
-
const signature = await this.sign(
|
|
513
|
-
"leaderboard_authentication",
|
|
514
|
-
params.verifyingAddr,
|
|
515
|
-
params.chainId,
|
|
516
|
-
signatureParams
|
|
517
|
-
);
|
|
518
|
-
const updateRegistrationTx = {
|
|
519
|
-
tx,
|
|
520
|
-
signature
|
|
521
|
-
};
|
|
522
|
-
const baseResponse = await this.query("leaderboard_register", {
|
|
523
|
-
update_registration: updateRegistrationTx
|
|
524
|
-
});
|
|
525
|
-
return {
|
|
526
|
-
registrations: baseResponse.registrations.map(
|
|
527
|
-
import_dataMappers.mapIndexerLeaderboardRegistration
|
|
528
|
-
)
|
|
529
|
-
};
|
|
530
|
-
}
|
|
531
|
-
/**
|
|
532
|
-
* Retrieves contest registrations for a subaccount. Supports batch lookup
|
|
533
|
-
* across multiple contests with an optional active filter.
|
|
534
|
-
*
|
|
535
|
-
* @param params - Query parameters including subaccount and contest IDs.
|
|
536
|
-
*/
|
|
537
|
-
async getLeaderboardRegistrations(params) {
|
|
538
|
-
const baseResponse = await this.query("leaderboard_registrations", {
|
|
539
|
-
subaccount: (0, import_shared.subaccountToHex)(params.subaccount),
|
|
540
|
-
contest_ids: params.contestIds,
|
|
541
|
-
active: params.active
|
|
542
|
-
});
|
|
543
|
-
return {
|
|
544
|
-
registrations: baseResponse.registrations.map(
|
|
545
|
-
import_dataMappers.mapIndexerLeaderboardRegistration
|
|
546
|
-
)
|
|
547
|
-
};
|
|
548
|
-
}
|
|
549
|
-
/**
|
|
550
|
-
* Retrieve metadata of provided leaderboard contests
|
|
551
|
-
*
|
|
552
|
-
* @param params
|
|
553
|
-
*/
|
|
554
|
-
async getLeaderboardContests(params) {
|
|
555
|
-
const baseResponse = await this.query("leaderboard_contests", {
|
|
556
|
-
contest_ids: params.contestIds,
|
|
557
|
-
active: params.active
|
|
558
|
-
});
|
|
559
|
-
return {
|
|
560
|
-
contests: baseResponse.contests.map(import_dataMappers.mapIndexerLeaderboardContest)
|
|
561
|
-
};
|
|
562
|
-
}
|
|
563
|
-
/**
|
|
564
|
-
* Retrieve signature and tx to submit a fast withdrawal
|
|
565
|
-
*
|
|
566
|
-
* @param params
|
|
567
|
-
*/
|
|
568
|
-
async getFastWithdrawalSignature(params) {
|
|
569
|
-
const baseResponse = await this.query("fast_withdrawal_signature", params);
|
|
570
|
-
return {
|
|
571
|
-
idx: (0, import_shared.toBigInt)(baseResponse.idx),
|
|
572
|
-
tx: baseResponse.tx,
|
|
573
|
-
txBytes: (0, import_shared.getValidatedHex)(baseResponse.tx_bytes),
|
|
574
|
-
signatures: baseResponse.signatures.map(import_shared.getValidatedHex)
|
|
575
|
-
};
|
|
576
|
-
}
|
|
577
|
-
async getNlpSnapshots(params) {
|
|
578
|
-
const baseResponse = await this.query("nlp_snapshots", {
|
|
579
|
-
interval: {
|
|
580
|
-
count: params.limit,
|
|
581
|
-
max_time: params.maxTimeInclusive ? (0, import_shared.toIntegerString)(params.maxTimeInclusive) : void 0,
|
|
582
|
-
granularity: params.granularity
|
|
583
|
-
}
|
|
584
|
-
});
|
|
585
|
-
return {
|
|
586
|
-
snapshots: baseResponse.snapshots.map(import_dataMappers.mapIndexerNlpSnapshot)
|
|
587
|
-
};
|
|
588
|
-
}
|
|
589
|
-
/**
|
|
590
|
-
* Retrieves the subaccount's DDA (Direct Deposit Address)
|
|
591
|
-
* @param params
|
|
592
|
-
*/
|
|
593
|
-
async getSubaccountDDA(params) {
|
|
594
|
-
const baseResponse = await this.query("direct_deposit_address", {
|
|
595
|
-
subaccount: (0, import_shared.subaccountToHex)(params.subaccount)
|
|
596
|
-
});
|
|
597
|
-
return {
|
|
598
|
-
address: (0, import_shared.getValidatedAddress)(baseResponse.v1_address)
|
|
599
|
-
};
|
|
600
|
-
}
|
|
601
|
-
async getSequencerBacklog() {
|
|
602
|
-
const baseResponse = await this.query("backlog", {});
|
|
603
|
-
return {
|
|
604
|
-
totalTxs: (0, import_shared.toBigNumber)(baseResponse.total_txs),
|
|
605
|
-
totalSubmissions: (0, import_shared.toBigNumber)(baseResponse.total_submissions),
|
|
606
|
-
backlogSize: (0, import_shared.toBigNumber)(baseResponse.backlog_size),
|
|
607
|
-
updatedAt: (0, import_shared.toBigNumber)(baseResponse.updated_at),
|
|
608
|
-
backlogEtaInSeconds: baseResponse.backlog_eta_in_seconds ? (0, import_shared.toBigNumber)(baseResponse.backlog_eta_in_seconds) : null,
|
|
609
|
-
txsPerSecond: baseResponse.txs_per_second ? (0, import_shared.toBigNumber)(baseResponse.txs_per_second) : null
|
|
610
|
-
};
|
|
611
|
-
}
|
|
612
|
-
/**
|
|
613
|
-
* Retrieves private alpha choice information for a given address
|
|
614
|
-
* @param params
|
|
615
|
-
*/
|
|
616
|
-
async getPrivateAlphaChoice(params) {
|
|
617
|
-
const baseResponse = await this.query("private_alpha_choice", {
|
|
618
|
-
address: params.address
|
|
619
|
-
});
|
|
620
|
-
return {
|
|
621
|
-
points: (0, import_shared.toBigNumber)(baseResponse.points),
|
|
622
|
-
feeRefund: (0, import_shared.toBigNumber)(baseResponse.fee_refund),
|
|
623
|
-
nftEligibility: baseResponse.nft_eligibility
|
|
624
|
-
};
|
|
625
|
-
}
|
|
626
|
-
/**
|
|
627
|
-
* Retrieves points information for a given address, including points per epoch and all-time points
|
|
628
|
-
* @param params
|
|
629
|
-
*/
|
|
630
|
-
async getPoints(params) {
|
|
631
|
-
const baseResponse = await this.query("nado_points", {
|
|
632
|
-
address: params.address
|
|
633
|
-
});
|
|
634
|
-
return {
|
|
635
|
-
pointsPerEpoch: baseResponse.points_per_epoch.map((epoch) => ({
|
|
636
|
-
epoch: epoch.epoch,
|
|
637
|
-
description: epoch.description,
|
|
638
|
-
startTime: (0, import_shared.toBigNumber)(epoch.start_time),
|
|
639
|
-
endTime: (0, import_shared.toBigNumber)(epoch.end_time),
|
|
640
|
-
totalPoints: (0, import_shared.toBigNumber)(epoch.total_points),
|
|
641
|
-
points: (0, import_shared.toBigNumber)(epoch.points),
|
|
642
|
-
rank: epoch.rank,
|
|
643
|
-
tier: epoch.tier
|
|
644
|
-
})),
|
|
645
|
-
allTimePoints: {
|
|
646
|
-
points: (0, import_shared.toBigNumber)(baseResponse.all_time_points.points),
|
|
647
|
-
rank: baseResponse.all_time_points.rank,
|
|
648
|
-
tier: baseResponse.all_time_points.tier
|
|
649
|
-
}
|
|
650
|
-
};
|
|
651
|
-
}
|
|
652
|
-
/**
|
|
653
|
-
* Initiates a social account connection flow. Returns a URL the user must visit to complete the OAuth flow.
|
|
654
|
-
* Requires EIP-712 signing.
|
|
655
|
-
*
|
|
656
|
-
* @param params - Connection parameters including provider and signing config.
|
|
657
|
-
*/
|
|
658
|
-
async connectSocialAccount(params) {
|
|
659
|
-
const signatureParams = {
|
|
660
|
-
expiration: (0, import_shared.toIntegerString)(params.recvTime ?? (0, import_shared.getDefaultRecvTime)()),
|
|
661
|
-
subaccountName: params.subaccountName,
|
|
662
|
-
subaccountOwner: params.subaccountOwner,
|
|
663
|
-
provider: params.provider
|
|
664
|
-
};
|
|
665
|
-
const tx = (0, import_shared.getNadoEIP712Values)("social_authentication", signatureParams);
|
|
666
|
-
const signature = await this.sign(
|
|
667
|
-
"social_authentication",
|
|
668
|
-
params.verifyingAddr,
|
|
669
|
-
params.chainId,
|
|
670
|
-
signatureParams
|
|
671
|
-
);
|
|
672
|
-
const baseResponse = await this.query("social_connect", {
|
|
673
|
-
update_social_account: { tx, signature }
|
|
674
|
-
});
|
|
675
|
-
return { url: baseResponse.url };
|
|
676
|
-
}
|
|
677
|
-
/**
|
|
678
|
-
* Lists linked social accounts for a given address.
|
|
679
|
-
*
|
|
680
|
-
* @param params - Query parameters including the wallet address.
|
|
681
|
-
*/
|
|
682
|
-
async listSocialAccounts(params) {
|
|
683
|
-
const baseResponse = await this.query("list_social_accounts", {
|
|
684
|
-
address: params.address
|
|
685
|
-
});
|
|
686
|
-
return {
|
|
687
|
-
accounts: baseResponse.accounts.map((a) => ({
|
|
688
|
-
provider: a.provider,
|
|
689
|
-
username: a.username,
|
|
690
|
-
displayName: a.display_name,
|
|
691
|
-
profileImageUrl: a.profile_image_url
|
|
692
|
-
}))
|
|
693
|
-
};
|
|
694
|
-
}
|
|
695
|
-
/**
|
|
696
|
-
* Revokes a linked social account. Requires EIP-712 signing.
|
|
697
|
-
*
|
|
698
|
-
* @param params - Revocation parameters including provider and signing config.
|
|
699
|
-
*/
|
|
700
|
-
async revokeSocialAccount(params) {
|
|
701
|
-
const signatureParams = {
|
|
702
|
-
expiration: (0, import_shared.toIntegerString)(params.recvTime ?? (0, import_shared.getDefaultRecvTime)()),
|
|
703
|
-
subaccountName: params.subaccountName,
|
|
704
|
-
subaccountOwner: params.subaccountOwner,
|
|
705
|
-
provider: params.provider
|
|
706
|
-
};
|
|
707
|
-
const tx = (0, import_shared.getNadoEIP712Values)("social_authentication", signatureParams);
|
|
708
|
-
const signature = await this.sign(
|
|
709
|
-
"social_authentication",
|
|
710
|
-
params.verifyingAddr,
|
|
711
|
-
params.chainId,
|
|
712
|
-
signatureParams
|
|
713
|
-
);
|
|
714
|
-
const baseResponse = await this.query("revoke_social_account", {
|
|
715
|
-
update_social_account: { tx, signature }
|
|
716
|
-
});
|
|
717
|
-
return {
|
|
718
|
-
accounts: baseResponse.accounts.map((a) => ({
|
|
719
|
-
provider: a.provider,
|
|
720
|
-
username: a.username,
|
|
721
|
-
displayName: a.display_name,
|
|
722
|
-
profileImageUrl: a.profile_image_url
|
|
723
|
-
}))
|
|
724
|
-
};
|
|
725
|
-
}
|
|
726
|
-
/**
|
|
727
|
-
* Get tickers from the v2 indexer endpoint
|
|
728
|
-
* @param params
|
|
729
|
-
*/
|
|
730
|
-
async getV2Tickers(params) {
|
|
731
|
-
const response = await this.axiosInstance.get(
|
|
732
|
-
`${this.v2Url}/tickers`,
|
|
733
|
-
{ params }
|
|
734
|
-
);
|
|
735
|
-
this.checkResponseStatus(response);
|
|
736
|
-
return (0, import_shared.mapValues)(response.data, import_dataMappers.mapIndexerV2Ticker);
|
|
737
|
-
}
|
|
738
|
-
/**
|
|
739
|
-
* Get symbols with market hours from the v2 indexer endpoint
|
|
740
|
-
* @param params
|
|
741
|
-
*/
|
|
742
|
-
async getV2Symbols(params) {
|
|
743
|
-
const response = await this.axiosInstance.get(
|
|
744
|
-
`${this.v2Url}/symbols`,
|
|
745
|
-
{
|
|
746
|
-
params: {
|
|
747
|
-
product_type: params?.productType,
|
|
748
|
-
product_ids: params?.productIds
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
);
|
|
752
|
-
this.checkResponseStatus(response);
|
|
753
|
-
return (0, import_shared.mapValues)(response.data, import_dataMappers.mapIndexerV2Symbols);
|
|
754
|
-
}
|
|
755
|
-
async query(requestType, params) {
|
|
756
|
-
const reqBody = {
|
|
757
|
-
[requestType]: params
|
|
758
|
-
};
|
|
759
|
-
const response = await this.axiosInstance.post(this.opts.url, reqBody);
|
|
760
|
-
this.checkResponseStatus(response);
|
|
761
|
-
return response.data;
|
|
762
|
-
}
|
|
763
|
-
async sign(requestType, verifyingContract, chainId, params) {
|
|
764
|
-
const walletClient = this.opts.linkedSignerWalletClient ?? this.opts.walletClient;
|
|
765
|
-
if (!walletClient) {
|
|
766
|
-
throw new import_shared.WalletNotProvidedError();
|
|
767
|
-
}
|
|
768
|
-
return (0, import_shared.getSignedTransactionRequest)({
|
|
769
|
-
chainId,
|
|
770
|
-
requestParams: params,
|
|
771
|
-
requestType,
|
|
772
|
-
walletClient,
|
|
773
|
-
verifyingContract
|
|
774
|
-
});
|
|
775
|
-
}
|
|
776
|
-
checkResponseStatus(response) {
|
|
777
|
-
if (response.status !== 200 || !response.data) {
|
|
778
|
-
throw Error(
|
|
779
|
-
`Unexpected response from server: ${response.status} ${response.statusText}`
|
|
780
|
-
);
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
};
|
|
784
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
785
|
-
0 && (module.exports = {
|
|
786
|
-
IndexerBaseClient
|
|
787
|
-
});
|
|
788
|
-
//# sourceMappingURL=IndexerBaseClient.cjs.map
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_IndexerBaseClient = require("./IndexerBaseClient-3KfzA2ph.cjs");
|
|
3
|
+
exports.IndexerBaseClient = require_IndexerBaseClient.IndexerBaseClient;
|