@nightlylabs/dex-sdk 0.0.11 → 0.0.13
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/index.cjs +60 -19
- package/dist/index.d.cts +66 -2
- package/dist/index.d.ts +66 -2
- package/dist/index.js +59 -19
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -32,6 +32,7 @@ var index_exports = {};
|
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
AdminEndpoints: () => AdminEndpoints,
|
|
34
34
|
BaseEndpoints: () => BaseEndpoints,
|
|
35
|
+
ChartInterval: () => ChartInterval,
|
|
35
36
|
Client: () => Client,
|
|
36
37
|
EndpointsV1: () => EndpointsV1,
|
|
37
38
|
ExchangeProxies: () => ExchangeProxies,
|
|
@@ -61,7 +62,7 @@ var import_uuid = require("uuid");
|
|
|
61
62
|
|
|
62
63
|
// generated_types/addApiKey.ts
|
|
63
64
|
var ABI = {
|
|
64
|
-
"address": "
|
|
65
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
65
66
|
"name": "add_api_key",
|
|
66
67
|
"friends": [],
|
|
67
68
|
"exposed_functions": [
|
|
@@ -86,7 +87,7 @@ var addApiKey_default = ABI;
|
|
|
86
87
|
|
|
87
88
|
// generated_types/cancelAllPerpOrders.ts
|
|
88
89
|
var ABI2 = {
|
|
89
|
-
"address": "
|
|
90
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
90
91
|
"name": "cancel_all_perp_orders",
|
|
91
92
|
"friends": [],
|
|
92
93
|
"exposed_functions": [
|
|
@@ -109,7 +110,7 @@ var cancelAllPerpOrders_default = ABI2;
|
|
|
109
110
|
|
|
110
111
|
// generated_types/cancelPerpOrders.ts
|
|
111
112
|
var ABI3 = {
|
|
112
|
-
"address": "
|
|
113
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
113
114
|
"name": "cancel_perp_orders",
|
|
114
115
|
"friends": [],
|
|
115
116
|
"exposed_functions": [
|
|
@@ -134,7 +135,7 @@ var cancelPerpOrders_default = ABI3;
|
|
|
134
135
|
|
|
135
136
|
// generated_types/createUser.ts
|
|
136
137
|
var ABI4 = {
|
|
137
|
-
"address": "
|
|
138
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
138
139
|
"name": "create_user",
|
|
139
140
|
"friends": [],
|
|
140
141
|
"exposed_functions": [
|
|
@@ -159,7 +160,7 @@ var createUser_default = ABI4;
|
|
|
159
160
|
|
|
160
161
|
// generated_types/depositToVault.ts
|
|
161
162
|
var ABI5 = {
|
|
162
|
-
"address": "
|
|
163
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
163
164
|
"name": "deposit_to_vault",
|
|
164
165
|
"friends": [],
|
|
165
166
|
"exposed_functions": [
|
|
@@ -184,7 +185,7 @@ var depositToVault_default = ABI5;
|
|
|
184
185
|
|
|
185
186
|
// generated_types/depositToken.ts
|
|
186
187
|
var ABI6 = {
|
|
187
|
-
"address": "
|
|
188
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
188
189
|
"name": "deposit_token",
|
|
189
190
|
"friends": [],
|
|
190
191
|
"exposed_functions": [
|
|
@@ -209,7 +210,7 @@ var depositToken_default = ABI6;
|
|
|
209
210
|
|
|
210
211
|
// generated_types/lendToken.ts
|
|
211
212
|
var ABI7 = {
|
|
212
|
-
"address": "
|
|
213
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
213
214
|
"name": "lend_token",
|
|
214
215
|
"friends": [],
|
|
215
216
|
"exposed_functions": [
|
|
@@ -235,7 +236,7 @@ var lendToken_default = ABI7;
|
|
|
235
236
|
|
|
236
237
|
// generated_types/placePerpLimitOrder.ts
|
|
237
238
|
var ABI8 = {
|
|
238
|
-
"address": "
|
|
239
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
239
240
|
"name": "place_perp_limit_order",
|
|
240
241
|
"friends": [],
|
|
241
242
|
"exposed_functions": [
|
|
@@ -263,7 +264,7 @@ var placePerpLimitOrder_default = ABI8;
|
|
|
263
264
|
|
|
264
265
|
// generated_types/placePerpMarketOrder.ts
|
|
265
266
|
var ABI9 = {
|
|
266
|
-
"address": "
|
|
267
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
267
268
|
"name": "place_perp_market_order",
|
|
268
269
|
"friends": [],
|
|
269
270
|
"exposed_functions": [
|
|
@@ -290,7 +291,7 @@ var placePerpMarketOrder_default = ABI9;
|
|
|
290
291
|
|
|
291
292
|
// generated_types/redeemToken.ts
|
|
292
293
|
var ABI10 = {
|
|
293
|
-
"address": "
|
|
294
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
294
295
|
"name": "redeem_token",
|
|
295
296
|
"friends": [],
|
|
296
297
|
"exposed_functions": [
|
|
@@ -316,7 +317,7 @@ var redeemToken_default = ABI10;
|
|
|
316
317
|
|
|
317
318
|
// generated_types/removeApiKey.ts
|
|
318
319
|
var ABI11 = {
|
|
319
|
-
"address": "
|
|
320
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
320
321
|
"name": "remove_api_key",
|
|
321
322
|
"friends": [],
|
|
322
323
|
"exposed_functions": [
|
|
@@ -340,7 +341,7 @@ var removeApiKey_default = ABI11;
|
|
|
340
341
|
|
|
341
342
|
// generated_types/setAliasName.ts
|
|
342
343
|
var ABI12 = {
|
|
343
|
-
"address": "
|
|
344
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
344
345
|
"name": "set_alias_name",
|
|
345
346
|
"friends": [],
|
|
346
347
|
"exposed_functions": [
|
|
@@ -364,7 +365,7 @@ var setAliasName_default = ABI12;
|
|
|
364
365
|
|
|
365
366
|
// generated_types/setAutolend.ts
|
|
366
367
|
var ABI13 = {
|
|
367
|
-
"address": "
|
|
368
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
368
369
|
"name": "set_autolend",
|
|
369
370
|
"friends": [],
|
|
370
371
|
"exposed_functions": [
|
|
@@ -387,6 +388,16 @@ var ABI13 = {
|
|
|
387
388
|
var setAutolend_default = ABI13;
|
|
388
389
|
|
|
389
390
|
// generated_types/typeshareTypes.ts
|
|
391
|
+
var ChartInterval = /* @__PURE__ */ ((ChartInterval3) => {
|
|
392
|
+
ChartInterval3["OneMinute"] = "OneMinute";
|
|
393
|
+
ChartInterval3["FiveMinutes"] = "FiveMinutes";
|
|
394
|
+
ChartInterval3["FifteenMinutes"] = "FifteenMinutes";
|
|
395
|
+
ChartInterval3["ThirtyMinutes"] = "ThirtyMinutes";
|
|
396
|
+
ChartInterval3["OneHour"] = "OneHour";
|
|
397
|
+
ChartInterval3["FourHours"] = "FourHours";
|
|
398
|
+
ChartInterval3["OneDay"] = "OneDay";
|
|
399
|
+
return ChartInterval3;
|
|
400
|
+
})(ChartInterval || {});
|
|
390
401
|
var PerpetualMarketStatus = /* @__PURE__ */ ((PerpetualMarketStatus2) => {
|
|
391
402
|
PerpetualMarketStatus2["Halted"] = "halted";
|
|
392
403
|
PerpetualMarketStatus2["ReduceOnly"] = "reduceOnly";
|
|
@@ -410,6 +421,8 @@ var EndpointsV1 = /* @__PURE__ */ ((EndpointsV12) => {
|
|
|
410
421
|
EndpointsV12["GetPerpMarketsData"] = "/v1/get_perp_markets_data";
|
|
411
422
|
EndpointsV12["GetBorrowLendingData"] = "/v1/get_borrow_lending_data";
|
|
412
423
|
EndpointsV12["SubmitSponsoredTransactionRequest"] = "/v1/submit_sponsored_transaction";
|
|
424
|
+
EndpointsV12["GetChartCandlesInRange"] = "/v1/public/chart_candles_in_range";
|
|
425
|
+
EndpointsV12["GetUsersByAddress"] = "/v1/get_users_by_address";
|
|
413
426
|
return EndpointsV12;
|
|
414
427
|
})(EndpointsV1 || {});
|
|
415
428
|
var AdminEndpoints = /* @__PURE__ */ ((AdminEndpoints2) => {
|
|
@@ -448,7 +461,7 @@ var UserStatus = /* @__PURE__ */ ((UserStatus2) => {
|
|
|
448
461
|
|
|
449
462
|
// generated_types/withdrawFromVault.ts
|
|
450
463
|
var ABI14 = {
|
|
451
|
-
"address": "
|
|
464
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
452
465
|
"name": "withdraw_from_vault",
|
|
453
466
|
"friends": [],
|
|
454
467
|
"exposed_functions": [
|
|
@@ -558,6 +571,10 @@ var getTopicFromMessage = (data) => {
|
|
|
558
571
|
return data.content.userId;
|
|
559
572
|
case "SetAlias":
|
|
560
573
|
return data.content.userId;
|
|
574
|
+
case "AddApiKey":
|
|
575
|
+
return data.content.userId;
|
|
576
|
+
case "RemoveApiKey":
|
|
577
|
+
return data.content.userId;
|
|
561
578
|
}
|
|
562
579
|
};
|
|
563
580
|
|
|
@@ -678,10 +695,33 @@ var Client = class _Client {
|
|
|
678
695
|
const response = await this.sendGetJson("/v1/get_borrow_lending_data" /* GetBorrowLendingData */);
|
|
679
696
|
return response;
|
|
680
697
|
};
|
|
698
|
+
this.getChartCandlesInRange = async ({
|
|
699
|
+
interval,
|
|
700
|
+
marketName,
|
|
701
|
+
endTime = Math.round((/* @__PURE__ */ new Date()).getTime() / 1e3),
|
|
702
|
+
startTime = Math.round((/* @__PURE__ */ new Date()).getTime() / 1e3 - 24 * 60 * 60 * 1e3),
|
|
703
|
+
// default 24 back
|
|
704
|
+
cursor
|
|
705
|
+
}) => {
|
|
706
|
+
if (endTime && startTime && endTime < startTime) {
|
|
707
|
+
throw new Error("endTime must be greater than startTime");
|
|
708
|
+
}
|
|
709
|
+
const response = await this.sendGetJson("/v1/public/chart_candles_in_range" /* GetChartCandlesInRange */, {
|
|
710
|
+
marketName,
|
|
711
|
+
interval,
|
|
712
|
+
startTimestamp: startTime.toString(),
|
|
713
|
+
endTimestamp: endTime.toString(),
|
|
714
|
+
paginationCursor: cursor
|
|
715
|
+
});
|
|
716
|
+
};
|
|
681
717
|
this.getPriceIndexes = async () => {
|
|
682
718
|
const response = await this.sendGetJson("/v1/get_price_indexes" /* GetPriceIndexes */);
|
|
683
719
|
return response;
|
|
684
720
|
};
|
|
721
|
+
this.getUsersByAddress = async (payload) => {
|
|
722
|
+
const response = await this.sendGetJson("/v1/get_users_by_address" /* GetUsersByAddress */, payload);
|
|
723
|
+
return response;
|
|
724
|
+
};
|
|
685
725
|
this._aptos = connection;
|
|
686
726
|
this._surf = (0, import_surf.createSurfClient)(this._aptos);
|
|
687
727
|
this._apiKey = apiKey || generateApiKey();
|
|
@@ -1037,7 +1077,7 @@ var import_surf2 = require("@thalalabs/surf");
|
|
|
1037
1077
|
|
|
1038
1078
|
// generated_types/faucetEntrypoints.ts
|
|
1039
1079
|
var ABI15 = {
|
|
1040
|
-
"address": "
|
|
1080
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
1041
1081
|
"name": "faucet_entrypoints",
|
|
1042
1082
|
"friends": [],
|
|
1043
1083
|
"exposed_functions": [
|
|
@@ -1072,7 +1112,7 @@ var faucetEntrypoints_default = ABI15;
|
|
|
1072
1112
|
|
|
1073
1113
|
// generated_types/testFaucet.ts
|
|
1074
1114
|
var ABI16 = {
|
|
1075
|
-
"address": "
|
|
1115
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
1076
1116
|
"name": "test_faucet",
|
|
1077
1117
|
"friends": [],
|
|
1078
1118
|
"exposed_functions": [
|
|
@@ -1109,7 +1149,7 @@ var ABI16 = {
|
|
|
1109
1149
|
],
|
|
1110
1150
|
"return": [
|
|
1111
1151
|
"0x1::object::ConstructorRef",
|
|
1112
|
-
"0x1::object::Object<
|
|
1152
|
+
"0x1::object::Object<0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63::test_faucet::Token>"
|
|
1113
1153
|
]
|
|
1114
1154
|
},
|
|
1115
1155
|
{
|
|
@@ -1248,7 +1288,7 @@ var ABI16 = {
|
|
|
1248
1288
|
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
1249
1289
|
],
|
|
1250
1290
|
"return": [
|
|
1251
|
-
"
|
|
1291
|
+
"0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63::test_faucet::FaucetToken"
|
|
1252
1292
|
]
|
|
1253
1293
|
}
|
|
1254
1294
|
],
|
|
@@ -1280,7 +1320,7 @@ var ABI16 = {
|
|
|
1280
1320
|
"fields": [
|
|
1281
1321
|
{
|
|
1282
1322
|
"name": "tokens",
|
|
1283
|
-
"type": "0x1::smart_table::SmartTable<vector<u8>,
|
|
1323
|
+
"type": "0x1::smart_table::SmartTable<vector<u8>, 0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63::test_faucet::FaucetToken>"
|
|
1284
1324
|
}
|
|
1285
1325
|
]
|
|
1286
1326
|
},
|
|
@@ -1371,6 +1411,7 @@ var TestFaucet = class _TestFaucet extends client_default {
|
|
|
1371
1411
|
0 && (module.exports = {
|
|
1372
1412
|
AdminEndpoints,
|
|
1373
1413
|
BaseEndpoints,
|
|
1414
|
+
ChartInterval,
|
|
1374
1415
|
Client,
|
|
1375
1416
|
EndpointsV1,
|
|
1376
1417
|
ExchangeProxies,
|
package/dist/index.d.cts
CHANGED
|
@@ -4,6 +4,7 @@ import * as _thalalabs_surf_build_types_core from '@thalalabs/surf/build/types/c
|
|
|
4
4
|
import * as _thalalabs_surf from '@thalalabs/surf';
|
|
5
5
|
import WebSocket from 'isomorphic-ws';
|
|
6
6
|
|
|
7
|
+
type PaginationCursor = string;
|
|
7
8
|
interface StatusResponse {
|
|
8
9
|
status: string;
|
|
9
10
|
}
|
|
@@ -29,6 +30,37 @@ interface BorrowLending {
|
|
|
29
30
|
interface GetBorrowLendingDataResponse {
|
|
30
31
|
data: Record<string, BorrowLending>;
|
|
31
32
|
}
|
|
33
|
+
declare enum ChartInterval {
|
|
34
|
+
OneMinute = "OneMinute",
|
|
35
|
+
FiveMinutes = "FiveMinutes",
|
|
36
|
+
FifteenMinutes = "FifteenMinutes",
|
|
37
|
+
ThirtyMinutes = "ThirtyMinutes",
|
|
38
|
+
OneHour = "OneHour",
|
|
39
|
+
FourHours = "FourHours",
|
|
40
|
+
OneDay = "OneDay"
|
|
41
|
+
}
|
|
42
|
+
interface GetChartCandlesInRangeRequest {
|
|
43
|
+
marketName: string;
|
|
44
|
+
interval: ChartInterval;
|
|
45
|
+
startTimestamp: string;
|
|
46
|
+
endTimestamp: string;
|
|
47
|
+
paginationCursor?: PaginationCursor;
|
|
48
|
+
}
|
|
49
|
+
interface ChartCandle {
|
|
50
|
+
marketName: string;
|
|
51
|
+
open: string;
|
|
52
|
+
high: string;
|
|
53
|
+
low: string;
|
|
54
|
+
close: string;
|
|
55
|
+
volumeBase: string;
|
|
56
|
+
volumeQuote: string;
|
|
57
|
+
timestampOpen: string;
|
|
58
|
+
timestampClose: string;
|
|
59
|
+
}
|
|
60
|
+
interface GetChartCandlesInRangeResponse {
|
|
61
|
+
chartCandles: ChartCandle[];
|
|
62
|
+
paginationCursor?: PaginationCursor;
|
|
63
|
+
}
|
|
32
64
|
interface GetPerpMarketsDataRequest {
|
|
33
65
|
markets: string[];
|
|
34
66
|
}
|
|
@@ -152,6 +184,7 @@ interface User {
|
|
|
152
184
|
userId: string;
|
|
153
185
|
alias: string;
|
|
154
186
|
autolendEnabled: boolean;
|
|
187
|
+
ownerAddress: string;
|
|
155
188
|
tokenBalances: Record<string, string>;
|
|
156
189
|
positions: Record<string, PerpPosition>;
|
|
157
190
|
perpOrders: Record<string, Order>;
|
|
@@ -167,6 +200,12 @@ interface GetUserDataResponse {
|
|
|
167
200
|
userData: User;
|
|
168
201
|
perpOrdersCount: string;
|
|
169
202
|
}
|
|
203
|
+
interface GetUsersByAddressRequest {
|
|
204
|
+
userAddress: string;
|
|
205
|
+
}
|
|
206
|
+
interface GetUsersByAddressResponse {
|
|
207
|
+
users: User[];
|
|
208
|
+
}
|
|
170
209
|
interface SubmitSponsoredTransactionRequest {
|
|
171
210
|
sender: string;
|
|
172
211
|
sequenceNumber: string;
|
|
@@ -307,6 +346,14 @@ interface SetAlias {
|
|
|
307
346
|
userId: string;
|
|
308
347
|
newAlias: string;
|
|
309
348
|
}
|
|
349
|
+
interface AddApiKey {
|
|
350
|
+
userId: string;
|
|
351
|
+
apiKey: string;
|
|
352
|
+
}
|
|
353
|
+
interface RemoveApiKey {
|
|
354
|
+
userId: string;
|
|
355
|
+
apiKey: string;
|
|
356
|
+
}
|
|
310
357
|
interface ErrorResponse {
|
|
311
358
|
code: number;
|
|
312
359
|
variant: string;
|
|
@@ -322,7 +369,9 @@ declare enum EndpointsV1 {
|
|
|
322
369
|
GetPerpOrderBookData = "/v1/get_perp_orderbook_data",
|
|
323
370
|
GetPerpMarketsData = "/v1/get_perp_markets_data",
|
|
324
371
|
GetBorrowLendingData = "/v1/get_borrow_lending_data",
|
|
325
|
-
SubmitSponsoredTransactionRequest = "/v1/submit_sponsored_transaction"
|
|
372
|
+
SubmitSponsoredTransactionRequest = "/v1/submit_sponsored_transaction",
|
|
373
|
+
GetChartCandlesInRange = "/v1/public/chart_candles_in_range",
|
|
374
|
+
GetUsersByAddress = "/v1/get_users_by_address"
|
|
326
375
|
}
|
|
327
376
|
declare enum AdminEndpoints {
|
|
328
377
|
Placeholder = "/admin/placeholder"
|
|
@@ -437,6 +486,12 @@ type WsMessage = {
|
|
|
437
486
|
} | {
|
|
438
487
|
type: "SetAlias";
|
|
439
488
|
content: SetAlias;
|
|
489
|
+
} | {
|
|
490
|
+
type: "AddApiKey";
|
|
491
|
+
content: AddApiKey;
|
|
492
|
+
} | {
|
|
493
|
+
type: "RemoveApiKey";
|
|
494
|
+
content: RemoveApiKey;
|
|
440
495
|
};
|
|
441
496
|
declare enum OrderStatus {
|
|
442
497
|
Placed = "Placed",
|
|
@@ -517,7 +572,9 @@ declare class Client {
|
|
|
517
572
|
getPerpOrderBookData: (marketName: string) => Promise<GetPerpOrderBookDataResponse>;
|
|
518
573
|
getPerpMarketsData: (markets: string[]) => Promise<GetPerpMarketsDataResponse>;
|
|
519
574
|
getBorrowLendingData: () => Promise<GetBorrowLendingDataResponse>;
|
|
575
|
+
getChartCandlesInRange: ({ interval, marketName, endTime, startTime, cursor, }: IGetChartCandlesInRange) => Promise<void>;
|
|
520
576
|
getPriceIndexes: () => Promise<GetPriceIndexesResponse>;
|
|
577
|
+
getUsersByAddress: (payload: GetUsersByAddressRequest) => Promise<GetUsersByAddressResponse>;
|
|
521
578
|
}
|
|
522
579
|
interface PlacePerpLimitOrderParams {
|
|
523
580
|
userId: string;
|
|
@@ -592,6 +649,13 @@ interface LendTokenParams {
|
|
|
592
649
|
amount: string;
|
|
593
650
|
max: boolean;
|
|
594
651
|
}
|
|
652
|
+
interface IGetChartCandlesInRange {
|
|
653
|
+
marketName: string;
|
|
654
|
+
interval: ChartInterval;
|
|
655
|
+
startTime?: number;
|
|
656
|
+
endTime?: number;
|
|
657
|
+
cursor?: PaginationCursor;
|
|
658
|
+
}
|
|
595
659
|
|
|
596
660
|
declare const ExchangeProxies: {
|
|
597
661
|
[key in Network]: string[];
|
|
@@ -614,4 +678,4 @@ declare const generateApiKey: () => _aptos_labs_ts_sdk.Ed25519Account;
|
|
|
614
678
|
declare const getTopicFromCommand: (data: WsCommand) => string;
|
|
615
679
|
declare const getTopicFromMessage: (data: WsMessage) => string;
|
|
616
680
|
|
|
617
|
-
export { type AddApiKeyParams, type Address, AdminEndpoints, type BalanceChange, BaseEndpoints, type Borrow, type BorrowLending, type CancelAllPerpOrdersParams, type CancelPerpOrdersParams, type CanceledPerpOrders, Client, type Content, type CreateUserParams, type Deposit, type DepositToVaultParams, type DepositTokenParams, EndpointsV1, type ErrorResponse, type ExchangeConfig, ExchangeProxies, type Fees, type FundingCheckpoint, type FundingRate, GLOBAL_DENOMINATOR, type GetBorrowLendingDataResponse, type GetPerpMarketsDataRequest, type GetPerpMarketsDataResponse, type GetPerpOrderBookDataRequest, type GetPerpOrderBookDataResponse, type GetPerpetualMarketsConfigResponse, type GetPriceIndexesResponse, type GetTokensConfigResponse, type GetUserDataRequest, type GetUserDataResponse, type Lend, type LendTokenParams, type MarginStep, Network, type OracleUpdate, type OracleUpdates, type Order, type OrderFills, OrderSide, OrderStatus, OrderType, type OrderbookUpdate, type PerpMarketData, type PerpOrderBookData, type PerpPosition, type PerpetualMarketConfigEntry, PerpetualMarketStatus, type PlacePerpLimitOrder, type PlacePerpLimitOrderParams, type PlacePerpMarketOrder, type PlacePerpMarketOrderParams, type PriceIndex, type RedeemTokenParams, type Referral, type RemoveApiKeyParams, type RepayBorrow, type SetAlias, type SetAliasNameParams, type SetAutolend, type SetAutolendParams, Status, type StatusResponse, type SubmitSponsoredTransactionRequest, type SubmitSponsoredTransactionResponse, TestFaucet, type TimeResponse, type TokenConfigEntry, type Topic, type Trade, TradeRole, type TradesUpdate, type User, UserStatus, type UtilizationCurve, type VaultInvestment, type Withdraw, type WithdrawFromVaultParams, type WithdrawLend, type WsCommand, type WsFill, type WsMessage, generateApiKey, getRandomId, getTopicFromCommand, getTopicFromMessage, sleep, toSystemValue };
|
|
681
|
+
export { type AddApiKey, type AddApiKeyParams, type Address, AdminEndpoints, type BalanceChange, BaseEndpoints, type Borrow, type BorrowLending, type CancelAllPerpOrdersParams, type CancelPerpOrdersParams, type CanceledPerpOrders, type ChartCandle, ChartInterval, Client, type Content, type CreateUserParams, type Deposit, type DepositToVaultParams, type DepositTokenParams, EndpointsV1, type ErrorResponse, type ExchangeConfig, ExchangeProxies, type Fees, type FundingCheckpoint, type FundingRate, GLOBAL_DENOMINATOR, type GetBorrowLendingDataResponse, type GetChartCandlesInRangeRequest, type GetChartCandlesInRangeResponse, type GetPerpMarketsDataRequest, type GetPerpMarketsDataResponse, type GetPerpOrderBookDataRequest, type GetPerpOrderBookDataResponse, type GetPerpetualMarketsConfigResponse, type GetPriceIndexesResponse, type GetTokensConfigResponse, type GetUserDataRequest, type GetUserDataResponse, type GetUsersByAddressRequest, type GetUsersByAddressResponse, type IGetChartCandlesInRange, type Lend, type LendTokenParams, type MarginStep, Network, type OracleUpdate, type OracleUpdates, type Order, type OrderFills, OrderSide, OrderStatus, OrderType, type OrderbookUpdate, type PaginationCursor, type PerpMarketData, type PerpOrderBookData, type PerpPosition, type PerpetualMarketConfigEntry, PerpetualMarketStatus, type PlacePerpLimitOrder, type PlacePerpLimitOrderParams, type PlacePerpMarketOrder, type PlacePerpMarketOrderParams, type PriceIndex, type RedeemTokenParams, type Referral, type RemoveApiKey, type RemoveApiKeyParams, type RepayBorrow, type SetAlias, type SetAliasNameParams, type SetAutolend, type SetAutolendParams, Status, type StatusResponse, type SubmitSponsoredTransactionRequest, type SubmitSponsoredTransactionResponse, TestFaucet, type TimeResponse, type TokenConfigEntry, type Topic, type Trade, TradeRole, type TradesUpdate, type User, UserStatus, type UtilizationCurve, type VaultInvestment, type Withdraw, type WithdrawFromVaultParams, type WithdrawLend, type WsCommand, type WsFill, type WsMessage, generateApiKey, getRandomId, getTopicFromCommand, getTopicFromMessage, sleep, toSystemValue };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import * as _thalalabs_surf_build_types_core from '@thalalabs/surf/build/types/c
|
|
|
4
4
|
import * as _thalalabs_surf from '@thalalabs/surf';
|
|
5
5
|
import WebSocket from 'isomorphic-ws';
|
|
6
6
|
|
|
7
|
+
type PaginationCursor = string;
|
|
7
8
|
interface StatusResponse {
|
|
8
9
|
status: string;
|
|
9
10
|
}
|
|
@@ -29,6 +30,37 @@ interface BorrowLending {
|
|
|
29
30
|
interface GetBorrowLendingDataResponse {
|
|
30
31
|
data: Record<string, BorrowLending>;
|
|
31
32
|
}
|
|
33
|
+
declare enum ChartInterval {
|
|
34
|
+
OneMinute = "OneMinute",
|
|
35
|
+
FiveMinutes = "FiveMinutes",
|
|
36
|
+
FifteenMinutes = "FifteenMinutes",
|
|
37
|
+
ThirtyMinutes = "ThirtyMinutes",
|
|
38
|
+
OneHour = "OneHour",
|
|
39
|
+
FourHours = "FourHours",
|
|
40
|
+
OneDay = "OneDay"
|
|
41
|
+
}
|
|
42
|
+
interface GetChartCandlesInRangeRequest {
|
|
43
|
+
marketName: string;
|
|
44
|
+
interval: ChartInterval;
|
|
45
|
+
startTimestamp: string;
|
|
46
|
+
endTimestamp: string;
|
|
47
|
+
paginationCursor?: PaginationCursor;
|
|
48
|
+
}
|
|
49
|
+
interface ChartCandle {
|
|
50
|
+
marketName: string;
|
|
51
|
+
open: string;
|
|
52
|
+
high: string;
|
|
53
|
+
low: string;
|
|
54
|
+
close: string;
|
|
55
|
+
volumeBase: string;
|
|
56
|
+
volumeQuote: string;
|
|
57
|
+
timestampOpen: string;
|
|
58
|
+
timestampClose: string;
|
|
59
|
+
}
|
|
60
|
+
interface GetChartCandlesInRangeResponse {
|
|
61
|
+
chartCandles: ChartCandle[];
|
|
62
|
+
paginationCursor?: PaginationCursor;
|
|
63
|
+
}
|
|
32
64
|
interface GetPerpMarketsDataRequest {
|
|
33
65
|
markets: string[];
|
|
34
66
|
}
|
|
@@ -152,6 +184,7 @@ interface User {
|
|
|
152
184
|
userId: string;
|
|
153
185
|
alias: string;
|
|
154
186
|
autolendEnabled: boolean;
|
|
187
|
+
ownerAddress: string;
|
|
155
188
|
tokenBalances: Record<string, string>;
|
|
156
189
|
positions: Record<string, PerpPosition>;
|
|
157
190
|
perpOrders: Record<string, Order>;
|
|
@@ -167,6 +200,12 @@ interface GetUserDataResponse {
|
|
|
167
200
|
userData: User;
|
|
168
201
|
perpOrdersCount: string;
|
|
169
202
|
}
|
|
203
|
+
interface GetUsersByAddressRequest {
|
|
204
|
+
userAddress: string;
|
|
205
|
+
}
|
|
206
|
+
interface GetUsersByAddressResponse {
|
|
207
|
+
users: User[];
|
|
208
|
+
}
|
|
170
209
|
interface SubmitSponsoredTransactionRequest {
|
|
171
210
|
sender: string;
|
|
172
211
|
sequenceNumber: string;
|
|
@@ -307,6 +346,14 @@ interface SetAlias {
|
|
|
307
346
|
userId: string;
|
|
308
347
|
newAlias: string;
|
|
309
348
|
}
|
|
349
|
+
interface AddApiKey {
|
|
350
|
+
userId: string;
|
|
351
|
+
apiKey: string;
|
|
352
|
+
}
|
|
353
|
+
interface RemoveApiKey {
|
|
354
|
+
userId: string;
|
|
355
|
+
apiKey: string;
|
|
356
|
+
}
|
|
310
357
|
interface ErrorResponse {
|
|
311
358
|
code: number;
|
|
312
359
|
variant: string;
|
|
@@ -322,7 +369,9 @@ declare enum EndpointsV1 {
|
|
|
322
369
|
GetPerpOrderBookData = "/v1/get_perp_orderbook_data",
|
|
323
370
|
GetPerpMarketsData = "/v1/get_perp_markets_data",
|
|
324
371
|
GetBorrowLendingData = "/v1/get_borrow_lending_data",
|
|
325
|
-
SubmitSponsoredTransactionRequest = "/v1/submit_sponsored_transaction"
|
|
372
|
+
SubmitSponsoredTransactionRequest = "/v1/submit_sponsored_transaction",
|
|
373
|
+
GetChartCandlesInRange = "/v1/public/chart_candles_in_range",
|
|
374
|
+
GetUsersByAddress = "/v1/get_users_by_address"
|
|
326
375
|
}
|
|
327
376
|
declare enum AdminEndpoints {
|
|
328
377
|
Placeholder = "/admin/placeholder"
|
|
@@ -437,6 +486,12 @@ type WsMessage = {
|
|
|
437
486
|
} | {
|
|
438
487
|
type: "SetAlias";
|
|
439
488
|
content: SetAlias;
|
|
489
|
+
} | {
|
|
490
|
+
type: "AddApiKey";
|
|
491
|
+
content: AddApiKey;
|
|
492
|
+
} | {
|
|
493
|
+
type: "RemoveApiKey";
|
|
494
|
+
content: RemoveApiKey;
|
|
440
495
|
};
|
|
441
496
|
declare enum OrderStatus {
|
|
442
497
|
Placed = "Placed",
|
|
@@ -517,7 +572,9 @@ declare class Client {
|
|
|
517
572
|
getPerpOrderBookData: (marketName: string) => Promise<GetPerpOrderBookDataResponse>;
|
|
518
573
|
getPerpMarketsData: (markets: string[]) => Promise<GetPerpMarketsDataResponse>;
|
|
519
574
|
getBorrowLendingData: () => Promise<GetBorrowLendingDataResponse>;
|
|
575
|
+
getChartCandlesInRange: ({ interval, marketName, endTime, startTime, cursor, }: IGetChartCandlesInRange) => Promise<void>;
|
|
520
576
|
getPriceIndexes: () => Promise<GetPriceIndexesResponse>;
|
|
577
|
+
getUsersByAddress: (payload: GetUsersByAddressRequest) => Promise<GetUsersByAddressResponse>;
|
|
521
578
|
}
|
|
522
579
|
interface PlacePerpLimitOrderParams {
|
|
523
580
|
userId: string;
|
|
@@ -592,6 +649,13 @@ interface LendTokenParams {
|
|
|
592
649
|
amount: string;
|
|
593
650
|
max: boolean;
|
|
594
651
|
}
|
|
652
|
+
interface IGetChartCandlesInRange {
|
|
653
|
+
marketName: string;
|
|
654
|
+
interval: ChartInterval;
|
|
655
|
+
startTime?: number;
|
|
656
|
+
endTime?: number;
|
|
657
|
+
cursor?: PaginationCursor;
|
|
658
|
+
}
|
|
595
659
|
|
|
596
660
|
declare const ExchangeProxies: {
|
|
597
661
|
[key in Network]: string[];
|
|
@@ -614,4 +678,4 @@ declare const generateApiKey: () => _aptos_labs_ts_sdk.Ed25519Account;
|
|
|
614
678
|
declare const getTopicFromCommand: (data: WsCommand) => string;
|
|
615
679
|
declare const getTopicFromMessage: (data: WsMessage) => string;
|
|
616
680
|
|
|
617
|
-
export { type AddApiKeyParams, type Address, AdminEndpoints, type BalanceChange, BaseEndpoints, type Borrow, type BorrowLending, type CancelAllPerpOrdersParams, type CancelPerpOrdersParams, type CanceledPerpOrders, Client, type Content, type CreateUserParams, type Deposit, type DepositToVaultParams, type DepositTokenParams, EndpointsV1, type ErrorResponse, type ExchangeConfig, ExchangeProxies, type Fees, type FundingCheckpoint, type FundingRate, GLOBAL_DENOMINATOR, type GetBorrowLendingDataResponse, type GetPerpMarketsDataRequest, type GetPerpMarketsDataResponse, type GetPerpOrderBookDataRequest, type GetPerpOrderBookDataResponse, type GetPerpetualMarketsConfigResponse, type GetPriceIndexesResponse, type GetTokensConfigResponse, type GetUserDataRequest, type GetUserDataResponse, type Lend, type LendTokenParams, type MarginStep, Network, type OracleUpdate, type OracleUpdates, type Order, type OrderFills, OrderSide, OrderStatus, OrderType, type OrderbookUpdate, type PerpMarketData, type PerpOrderBookData, type PerpPosition, type PerpetualMarketConfigEntry, PerpetualMarketStatus, type PlacePerpLimitOrder, type PlacePerpLimitOrderParams, type PlacePerpMarketOrder, type PlacePerpMarketOrderParams, type PriceIndex, type RedeemTokenParams, type Referral, type RemoveApiKeyParams, type RepayBorrow, type SetAlias, type SetAliasNameParams, type SetAutolend, type SetAutolendParams, Status, type StatusResponse, type SubmitSponsoredTransactionRequest, type SubmitSponsoredTransactionResponse, TestFaucet, type TimeResponse, type TokenConfigEntry, type Topic, type Trade, TradeRole, type TradesUpdate, type User, UserStatus, type UtilizationCurve, type VaultInvestment, type Withdraw, type WithdrawFromVaultParams, type WithdrawLend, type WsCommand, type WsFill, type WsMessage, generateApiKey, getRandomId, getTopicFromCommand, getTopicFromMessage, sleep, toSystemValue };
|
|
681
|
+
export { type AddApiKey, type AddApiKeyParams, type Address, AdminEndpoints, type BalanceChange, BaseEndpoints, type Borrow, type BorrowLending, type CancelAllPerpOrdersParams, type CancelPerpOrdersParams, type CanceledPerpOrders, type ChartCandle, ChartInterval, Client, type Content, type CreateUserParams, type Deposit, type DepositToVaultParams, type DepositTokenParams, EndpointsV1, type ErrorResponse, type ExchangeConfig, ExchangeProxies, type Fees, type FundingCheckpoint, type FundingRate, GLOBAL_DENOMINATOR, type GetBorrowLendingDataResponse, type GetChartCandlesInRangeRequest, type GetChartCandlesInRangeResponse, type GetPerpMarketsDataRequest, type GetPerpMarketsDataResponse, type GetPerpOrderBookDataRequest, type GetPerpOrderBookDataResponse, type GetPerpetualMarketsConfigResponse, type GetPriceIndexesResponse, type GetTokensConfigResponse, type GetUserDataRequest, type GetUserDataResponse, type GetUsersByAddressRequest, type GetUsersByAddressResponse, type IGetChartCandlesInRange, type Lend, type LendTokenParams, type MarginStep, Network, type OracleUpdate, type OracleUpdates, type Order, type OrderFills, OrderSide, OrderStatus, OrderType, type OrderbookUpdate, type PaginationCursor, type PerpMarketData, type PerpOrderBookData, type PerpPosition, type PerpetualMarketConfigEntry, PerpetualMarketStatus, type PlacePerpLimitOrder, type PlacePerpLimitOrderParams, type PlacePerpMarketOrder, type PlacePerpMarketOrderParams, type PriceIndex, type RedeemTokenParams, type Referral, type RemoveApiKey, type RemoveApiKeyParams, type RepayBorrow, type SetAlias, type SetAliasNameParams, type SetAutolend, type SetAutolendParams, Status, type StatusResponse, type SubmitSponsoredTransactionRequest, type SubmitSponsoredTransactionResponse, TestFaucet, type TimeResponse, type TokenConfigEntry, type Topic, type Trade, TradeRole, type TradesUpdate, type User, UserStatus, type UtilizationCurve, type VaultInvestment, type Withdraw, type WithdrawFromVaultParams, type WithdrawLend, type WsCommand, type WsFill, type WsMessage, generateApiKey, getRandomId, getTopicFromCommand, getTopicFromMessage, sleep, toSystemValue };
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { v4 as uuidv4 } from "uuid";
|
|
|
5
5
|
|
|
6
6
|
// generated_types/addApiKey.ts
|
|
7
7
|
var ABI = {
|
|
8
|
-
"address": "
|
|
8
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
9
9
|
"name": "add_api_key",
|
|
10
10
|
"friends": [],
|
|
11
11
|
"exposed_functions": [
|
|
@@ -30,7 +30,7 @@ var addApiKey_default = ABI;
|
|
|
30
30
|
|
|
31
31
|
// generated_types/cancelAllPerpOrders.ts
|
|
32
32
|
var ABI2 = {
|
|
33
|
-
"address": "
|
|
33
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
34
34
|
"name": "cancel_all_perp_orders",
|
|
35
35
|
"friends": [],
|
|
36
36
|
"exposed_functions": [
|
|
@@ -53,7 +53,7 @@ var cancelAllPerpOrders_default = ABI2;
|
|
|
53
53
|
|
|
54
54
|
// generated_types/cancelPerpOrders.ts
|
|
55
55
|
var ABI3 = {
|
|
56
|
-
"address": "
|
|
56
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
57
57
|
"name": "cancel_perp_orders",
|
|
58
58
|
"friends": [],
|
|
59
59
|
"exposed_functions": [
|
|
@@ -78,7 +78,7 @@ var cancelPerpOrders_default = ABI3;
|
|
|
78
78
|
|
|
79
79
|
// generated_types/createUser.ts
|
|
80
80
|
var ABI4 = {
|
|
81
|
-
"address": "
|
|
81
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
82
82
|
"name": "create_user",
|
|
83
83
|
"friends": [],
|
|
84
84
|
"exposed_functions": [
|
|
@@ -103,7 +103,7 @@ var createUser_default = ABI4;
|
|
|
103
103
|
|
|
104
104
|
// generated_types/depositToVault.ts
|
|
105
105
|
var ABI5 = {
|
|
106
|
-
"address": "
|
|
106
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
107
107
|
"name": "deposit_to_vault",
|
|
108
108
|
"friends": [],
|
|
109
109
|
"exposed_functions": [
|
|
@@ -128,7 +128,7 @@ var depositToVault_default = ABI5;
|
|
|
128
128
|
|
|
129
129
|
// generated_types/depositToken.ts
|
|
130
130
|
var ABI6 = {
|
|
131
|
-
"address": "
|
|
131
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
132
132
|
"name": "deposit_token",
|
|
133
133
|
"friends": [],
|
|
134
134
|
"exposed_functions": [
|
|
@@ -153,7 +153,7 @@ var depositToken_default = ABI6;
|
|
|
153
153
|
|
|
154
154
|
// generated_types/lendToken.ts
|
|
155
155
|
var ABI7 = {
|
|
156
|
-
"address": "
|
|
156
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
157
157
|
"name": "lend_token",
|
|
158
158
|
"friends": [],
|
|
159
159
|
"exposed_functions": [
|
|
@@ -179,7 +179,7 @@ var lendToken_default = ABI7;
|
|
|
179
179
|
|
|
180
180
|
// generated_types/placePerpLimitOrder.ts
|
|
181
181
|
var ABI8 = {
|
|
182
|
-
"address": "
|
|
182
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
183
183
|
"name": "place_perp_limit_order",
|
|
184
184
|
"friends": [],
|
|
185
185
|
"exposed_functions": [
|
|
@@ -207,7 +207,7 @@ var placePerpLimitOrder_default = ABI8;
|
|
|
207
207
|
|
|
208
208
|
// generated_types/placePerpMarketOrder.ts
|
|
209
209
|
var ABI9 = {
|
|
210
|
-
"address": "
|
|
210
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
211
211
|
"name": "place_perp_market_order",
|
|
212
212
|
"friends": [],
|
|
213
213
|
"exposed_functions": [
|
|
@@ -234,7 +234,7 @@ var placePerpMarketOrder_default = ABI9;
|
|
|
234
234
|
|
|
235
235
|
// generated_types/redeemToken.ts
|
|
236
236
|
var ABI10 = {
|
|
237
|
-
"address": "
|
|
237
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
238
238
|
"name": "redeem_token",
|
|
239
239
|
"friends": [],
|
|
240
240
|
"exposed_functions": [
|
|
@@ -260,7 +260,7 @@ var redeemToken_default = ABI10;
|
|
|
260
260
|
|
|
261
261
|
// generated_types/removeApiKey.ts
|
|
262
262
|
var ABI11 = {
|
|
263
|
-
"address": "
|
|
263
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
264
264
|
"name": "remove_api_key",
|
|
265
265
|
"friends": [],
|
|
266
266
|
"exposed_functions": [
|
|
@@ -284,7 +284,7 @@ var removeApiKey_default = ABI11;
|
|
|
284
284
|
|
|
285
285
|
// generated_types/setAliasName.ts
|
|
286
286
|
var ABI12 = {
|
|
287
|
-
"address": "
|
|
287
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
288
288
|
"name": "set_alias_name",
|
|
289
289
|
"friends": [],
|
|
290
290
|
"exposed_functions": [
|
|
@@ -308,7 +308,7 @@ var setAliasName_default = ABI12;
|
|
|
308
308
|
|
|
309
309
|
// generated_types/setAutolend.ts
|
|
310
310
|
var ABI13 = {
|
|
311
|
-
"address": "
|
|
311
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
312
312
|
"name": "set_autolend",
|
|
313
313
|
"friends": [],
|
|
314
314
|
"exposed_functions": [
|
|
@@ -331,6 +331,16 @@ var ABI13 = {
|
|
|
331
331
|
var setAutolend_default = ABI13;
|
|
332
332
|
|
|
333
333
|
// generated_types/typeshareTypes.ts
|
|
334
|
+
var ChartInterval = /* @__PURE__ */ ((ChartInterval3) => {
|
|
335
|
+
ChartInterval3["OneMinute"] = "OneMinute";
|
|
336
|
+
ChartInterval3["FiveMinutes"] = "FiveMinutes";
|
|
337
|
+
ChartInterval3["FifteenMinutes"] = "FifteenMinutes";
|
|
338
|
+
ChartInterval3["ThirtyMinutes"] = "ThirtyMinutes";
|
|
339
|
+
ChartInterval3["OneHour"] = "OneHour";
|
|
340
|
+
ChartInterval3["FourHours"] = "FourHours";
|
|
341
|
+
ChartInterval3["OneDay"] = "OneDay";
|
|
342
|
+
return ChartInterval3;
|
|
343
|
+
})(ChartInterval || {});
|
|
334
344
|
var PerpetualMarketStatus = /* @__PURE__ */ ((PerpetualMarketStatus2) => {
|
|
335
345
|
PerpetualMarketStatus2["Halted"] = "halted";
|
|
336
346
|
PerpetualMarketStatus2["ReduceOnly"] = "reduceOnly";
|
|
@@ -354,6 +364,8 @@ var EndpointsV1 = /* @__PURE__ */ ((EndpointsV12) => {
|
|
|
354
364
|
EndpointsV12["GetPerpMarketsData"] = "/v1/get_perp_markets_data";
|
|
355
365
|
EndpointsV12["GetBorrowLendingData"] = "/v1/get_borrow_lending_data";
|
|
356
366
|
EndpointsV12["SubmitSponsoredTransactionRequest"] = "/v1/submit_sponsored_transaction";
|
|
367
|
+
EndpointsV12["GetChartCandlesInRange"] = "/v1/public/chart_candles_in_range";
|
|
368
|
+
EndpointsV12["GetUsersByAddress"] = "/v1/get_users_by_address";
|
|
357
369
|
return EndpointsV12;
|
|
358
370
|
})(EndpointsV1 || {});
|
|
359
371
|
var AdminEndpoints = /* @__PURE__ */ ((AdminEndpoints2) => {
|
|
@@ -392,7 +404,7 @@ var UserStatus = /* @__PURE__ */ ((UserStatus2) => {
|
|
|
392
404
|
|
|
393
405
|
// generated_types/withdrawFromVault.ts
|
|
394
406
|
var ABI14 = {
|
|
395
|
-
"address": "
|
|
407
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
396
408
|
"name": "withdraw_from_vault",
|
|
397
409
|
"friends": [],
|
|
398
410
|
"exposed_functions": [
|
|
@@ -502,6 +514,10 @@ var getTopicFromMessage = (data) => {
|
|
|
502
514
|
return data.content.userId;
|
|
503
515
|
case "SetAlias":
|
|
504
516
|
return data.content.userId;
|
|
517
|
+
case "AddApiKey":
|
|
518
|
+
return data.content.userId;
|
|
519
|
+
case "RemoveApiKey":
|
|
520
|
+
return data.content.userId;
|
|
505
521
|
}
|
|
506
522
|
};
|
|
507
523
|
|
|
@@ -622,10 +638,33 @@ var Client = class _Client {
|
|
|
622
638
|
const response = await this.sendGetJson("/v1/get_borrow_lending_data" /* GetBorrowLendingData */);
|
|
623
639
|
return response;
|
|
624
640
|
};
|
|
641
|
+
this.getChartCandlesInRange = async ({
|
|
642
|
+
interval,
|
|
643
|
+
marketName,
|
|
644
|
+
endTime = Math.round((/* @__PURE__ */ new Date()).getTime() / 1e3),
|
|
645
|
+
startTime = Math.round((/* @__PURE__ */ new Date()).getTime() / 1e3 - 24 * 60 * 60 * 1e3),
|
|
646
|
+
// default 24 back
|
|
647
|
+
cursor
|
|
648
|
+
}) => {
|
|
649
|
+
if (endTime && startTime && endTime < startTime) {
|
|
650
|
+
throw new Error("endTime must be greater than startTime");
|
|
651
|
+
}
|
|
652
|
+
const response = await this.sendGetJson("/v1/public/chart_candles_in_range" /* GetChartCandlesInRange */, {
|
|
653
|
+
marketName,
|
|
654
|
+
interval,
|
|
655
|
+
startTimestamp: startTime.toString(),
|
|
656
|
+
endTimestamp: endTime.toString(),
|
|
657
|
+
paginationCursor: cursor
|
|
658
|
+
});
|
|
659
|
+
};
|
|
625
660
|
this.getPriceIndexes = async () => {
|
|
626
661
|
const response = await this.sendGetJson("/v1/get_price_indexes" /* GetPriceIndexes */);
|
|
627
662
|
return response;
|
|
628
663
|
};
|
|
664
|
+
this.getUsersByAddress = async (payload) => {
|
|
665
|
+
const response = await this.sendGetJson("/v1/get_users_by_address" /* GetUsersByAddress */, payload);
|
|
666
|
+
return response;
|
|
667
|
+
};
|
|
629
668
|
this._aptos = connection;
|
|
630
669
|
this._surf = createSurfClient(this._aptos);
|
|
631
670
|
this._apiKey = apiKey || generateApiKey();
|
|
@@ -981,7 +1020,7 @@ import { createEntryPayload as createEntryPayload2 } from "@thalalabs/surf";
|
|
|
981
1020
|
|
|
982
1021
|
// generated_types/faucetEntrypoints.ts
|
|
983
1022
|
var ABI15 = {
|
|
984
|
-
"address": "
|
|
1023
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
985
1024
|
"name": "faucet_entrypoints",
|
|
986
1025
|
"friends": [],
|
|
987
1026
|
"exposed_functions": [
|
|
@@ -1016,7 +1055,7 @@ var faucetEntrypoints_default = ABI15;
|
|
|
1016
1055
|
|
|
1017
1056
|
// generated_types/testFaucet.ts
|
|
1018
1057
|
var ABI16 = {
|
|
1019
|
-
"address": "
|
|
1058
|
+
"address": "0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63",
|
|
1020
1059
|
"name": "test_faucet",
|
|
1021
1060
|
"friends": [],
|
|
1022
1061
|
"exposed_functions": [
|
|
@@ -1053,7 +1092,7 @@ var ABI16 = {
|
|
|
1053
1092
|
],
|
|
1054
1093
|
"return": [
|
|
1055
1094
|
"0x1::object::ConstructorRef",
|
|
1056
|
-
"0x1::object::Object<
|
|
1095
|
+
"0x1::object::Object<0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63::test_faucet::Token>"
|
|
1057
1096
|
]
|
|
1058
1097
|
},
|
|
1059
1098
|
{
|
|
@@ -1192,7 +1231,7 @@ var ABI16 = {
|
|
|
1192
1231
|
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
1193
1232
|
],
|
|
1194
1233
|
"return": [
|
|
1195
|
-
"
|
|
1234
|
+
"0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63::test_faucet::FaucetToken"
|
|
1196
1235
|
]
|
|
1197
1236
|
}
|
|
1198
1237
|
],
|
|
@@ -1224,7 +1263,7 @@ var ABI16 = {
|
|
|
1224
1263
|
"fields": [
|
|
1225
1264
|
{
|
|
1226
1265
|
"name": "tokens",
|
|
1227
|
-
"type": "0x1::smart_table::SmartTable<vector<u8>,
|
|
1266
|
+
"type": "0x1::smart_table::SmartTable<vector<u8>, 0xfe6358e4a03d5e15e0ad22acfcb7b6edbab97b38e2d5bb5aef278726b5a5cd63::test_faucet::FaucetToken>"
|
|
1228
1267
|
}
|
|
1229
1268
|
]
|
|
1230
1269
|
},
|
|
@@ -1314,6 +1353,7 @@ var TestFaucet = class _TestFaucet extends client_default {
|
|
|
1314
1353
|
export {
|
|
1315
1354
|
AdminEndpoints,
|
|
1316
1355
|
BaseEndpoints,
|
|
1356
|
+
ChartInterval,
|
|
1317
1357
|
Client,
|
|
1318
1358
|
EndpointsV1,
|
|
1319
1359
|
ExchangeProxies,
|