@nightlylabs/dex-sdk 0.0.14 → 0.0.16
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 +83 -45
- package/dist/index.d.cts +92 -24
- package/dist/index.d.ts +92 -24
- package/dist/index.js +83 -45
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -62,7 +62,7 @@ var import_uuid = require("uuid");
|
|
|
62
62
|
|
|
63
63
|
// generated_types/addApiKey.ts
|
|
64
64
|
var ABI = {
|
|
65
|
-
"address": "
|
|
65
|
+
"address": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
66
66
|
"name": "add_api_key",
|
|
67
67
|
"friends": [],
|
|
68
68
|
"exposed_functions": [
|
|
@@ -87,7 +87,7 @@ var addApiKey_default = ABI;
|
|
|
87
87
|
|
|
88
88
|
// generated_types/cancelAllPerpOrders.ts
|
|
89
89
|
var ABI2 = {
|
|
90
|
-
"address": "
|
|
90
|
+
"address": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
91
91
|
"name": "cancel_all_perp_orders",
|
|
92
92
|
"friends": [],
|
|
93
93
|
"exposed_functions": [
|
|
@@ -110,7 +110,7 @@ var cancelAllPerpOrders_default = ABI2;
|
|
|
110
110
|
|
|
111
111
|
// generated_types/cancelPerpOrders.ts
|
|
112
112
|
var ABI3 = {
|
|
113
|
-
"address": "
|
|
113
|
+
"address": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
114
114
|
"name": "cancel_perp_orders",
|
|
115
115
|
"friends": [],
|
|
116
116
|
"exposed_functions": [
|
|
@@ -135,7 +135,7 @@ var cancelPerpOrders_default = ABI3;
|
|
|
135
135
|
|
|
136
136
|
// generated_types/createUser.ts
|
|
137
137
|
var ABI4 = {
|
|
138
|
-
"address": "
|
|
138
|
+
"address": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
139
139
|
"name": "create_user",
|
|
140
140
|
"friends": [],
|
|
141
141
|
"exposed_functions": [
|
|
@@ -160,7 +160,7 @@ var createUser_default = ABI4;
|
|
|
160
160
|
|
|
161
161
|
// generated_types/depositToVault.ts
|
|
162
162
|
var ABI5 = {
|
|
163
|
-
"address": "
|
|
163
|
+
"address": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
164
164
|
"name": "deposit_to_vault",
|
|
165
165
|
"friends": [],
|
|
166
166
|
"exposed_functions": [
|
|
@@ -185,7 +185,7 @@ var depositToVault_default = ABI5;
|
|
|
185
185
|
|
|
186
186
|
// generated_types/depositToken.ts
|
|
187
187
|
var ABI6 = {
|
|
188
|
-
"address": "
|
|
188
|
+
"address": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
189
189
|
"name": "deposit_token",
|
|
190
190
|
"friends": [],
|
|
191
191
|
"exposed_functions": [
|
|
@@ -210,7 +210,7 @@ var depositToken_default = ABI6;
|
|
|
210
210
|
|
|
211
211
|
// generated_types/lendToken.ts
|
|
212
212
|
var ABI7 = {
|
|
213
|
-
"address": "
|
|
213
|
+
"address": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
214
214
|
"name": "lend_token",
|
|
215
215
|
"friends": [],
|
|
216
216
|
"exposed_functions": [
|
|
@@ -236,7 +236,7 @@ var lendToken_default = ABI7;
|
|
|
236
236
|
|
|
237
237
|
// generated_types/placePerpLimitOrder.ts
|
|
238
238
|
var ABI8 = {
|
|
239
|
-
"address": "
|
|
239
|
+
"address": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
240
240
|
"name": "place_perp_limit_order",
|
|
241
241
|
"friends": [],
|
|
242
242
|
"exposed_functions": [
|
|
@@ -264,7 +264,7 @@ var placePerpLimitOrder_default = ABI8;
|
|
|
264
264
|
|
|
265
265
|
// generated_types/placePerpMarketOrder.ts
|
|
266
266
|
var ABI9 = {
|
|
267
|
-
"address": "
|
|
267
|
+
"address": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
268
268
|
"name": "place_perp_market_order",
|
|
269
269
|
"friends": [],
|
|
270
270
|
"exposed_functions": [
|
|
@@ -291,7 +291,7 @@ var placePerpMarketOrder_default = ABI9;
|
|
|
291
291
|
|
|
292
292
|
// generated_types/redeemToken.ts
|
|
293
293
|
var ABI10 = {
|
|
294
|
-
"address": "
|
|
294
|
+
"address": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
295
295
|
"name": "redeem_token",
|
|
296
296
|
"friends": [],
|
|
297
297
|
"exposed_functions": [
|
|
@@ -317,7 +317,7 @@ var redeemToken_default = ABI10;
|
|
|
317
317
|
|
|
318
318
|
// generated_types/removeApiKey.ts
|
|
319
319
|
var ABI11 = {
|
|
320
|
-
"address": "
|
|
320
|
+
"address": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
321
321
|
"name": "remove_api_key",
|
|
322
322
|
"friends": [],
|
|
323
323
|
"exposed_functions": [
|
|
@@ -341,7 +341,7 @@ var removeApiKey_default = ABI11;
|
|
|
341
341
|
|
|
342
342
|
// generated_types/setAliasName.ts
|
|
343
343
|
var ABI12 = {
|
|
344
|
-
"address": "
|
|
344
|
+
"address": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
345
345
|
"name": "set_alias_name",
|
|
346
346
|
"friends": [],
|
|
347
347
|
"exposed_functions": [
|
|
@@ -365,7 +365,7 @@ var setAliasName_default = ABI12;
|
|
|
365
365
|
|
|
366
366
|
// generated_types/setAutolend.ts
|
|
367
367
|
var ABI13 = {
|
|
368
|
-
"address": "
|
|
368
|
+
"address": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
369
369
|
"name": "set_autolend",
|
|
370
370
|
"friends": [],
|
|
371
371
|
"exposed_functions": [
|
|
@@ -398,6 +398,11 @@ var ChartInterval = /* @__PURE__ */ ((ChartInterval3) => {
|
|
|
398
398
|
ChartInterval3["OneDay"] = "OneDay";
|
|
399
399
|
return ChartInterval3;
|
|
400
400
|
})(ChartInterval || {});
|
|
401
|
+
var OrderSide = /* @__PURE__ */ ((OrderSide2) => {
|
|
402
|
+
OrderSide2["Bid"] = "Bid";
|
|
403
|
+
OrderSide2["Ask"] = "Ask";
|
|
404
|
+
return OrderSide2;
|
|
405
|
+
})(OrderSide || {});
|
|
401
406
|
var PerpetualMarketStatus = /* @__PURE__ */ ((PerpetualMarketStatus2) => {
|
|
402
407
|
PerpetualMarketStatus2["Halted"] = "halted";
|
|
403
408
|
PerpetualMarketStatus2["ReduceOnly"] = "reduceOnly";
|
|
@@ -405,11 +410,24 @@ var PerpetualMarketStatus = /* @__PURE__ */ ((PerpetualMarketStatus2) => {
|
|
|
405
410
|
PerpetualMarketStatus2["Live"] = "live";
|
|
406
411
|
return PerpetualMarketStatus2;
|
|
407
412
|
})(PerpetualMarketStatus || {});
|
|
408
|
-
var
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
return
|
|
412
|
-
})(
|
|
413
|
+
var TradeRole = /* @__PURE__ */ ((TradeRole2) => {
|
|
414
|
+
TradeRole2["Maker"] = "Maker";
|
|
415
|
+
TradeRole2["Taker"] = "Taker";
|
|
416
|
+
return TradeRole2;
|
|
417
|
+
})(TradeRole || {});
|
|
418
|
+
var OrderType = /* @__PURE__ */ ((OrderType2) => {
|
|
419
|
+
OrderType2["Limit"] = "Limit";
|
|
420
|
+
OrderType2["Market"] = "Market";
|
|
421
|
+
return OrderType2;
|
|
422
|
+
})(OrderType || {});
|
|
423
|
+
var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
|
|
424
|
+
OrderStatus2["Placed"] = "Placed";
|
|
425
|
+
OrderStatus2["Cancelled"] = "Cancelled";
|
|
426
|
+
OrderStatus2["Filled"] = "Filled";
|
|
427
|
+
OrderStatus2["PartiallyFilled"] = "PartiallyFilled";
|
|
428
|
+
OrderStatus2["Executed"] = "Executed";
|
|
429
|
+
return OrderStatus2;
|
|
430
|
+
})(OrderStatus || {});
|
|
413
431
|
var EndpointsV1 = /* @__PURE__ */ ((EndpointsV12) => {
|
|
414
432
|
EndpointsV12["Ws"] = "/v1/ws";
|
|
415
433
|
EndpointsV12["GetConfig"] = "/v1/get_config";
|
|
@@ -423,6 +441,9 @@ var EndpointsV1 = /* @__PURE__ */ ((EndpointsV12) => {
|
|
|
423
441
|
EndpointsV12["SubmitSponsoredTransactionRequest"] = "/v1/submit_sponsored_transaction";
|
|
424
442
|
EndpointsV12["GetChartCandlesInRange"] = "/v1/public/chart_candles_in_range";
|
|
425
443
|
EndpointsV12["GetUsersByAddress"] = "/v1/get_users_by_address";
|
|
444
|
+
EndpointsV12["GetUserPerpOrders"] = "/v1/get_user_perp_orders";
|
|
445
|
+
EndpointsV12["GetUserPerpFills"] = "/v1/get_user_perp_fills";
|
|
446
|
+
EndpointsV12["GetPerpRecentTrades"] = "/v1/get_perp_recent_trades";
|
|
426
447
|
return EndpointsV12;
|
|
427
448
|
})(EndpointsV1 || {});
|
|
428
449
|
var AdminEndpoints = /* @__PURE__ */ ((AdminEndpoints2) => {
|
|
@@ -434,25 +455,6 @@ var BaseEndpoints = /* @__PURE__ */ ((BaseEndpoints2) => {
|
|
|
434
455
|
BaseEndpoints2["Status"] = "/app_status";
|
|
435
456
|
return BaseEndpoints2;
|
|
436
457
|
})(BaseEndpoints || {});
|
|
437
|
-
var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
|
|
438
|
-
OrderStatus2["Placed"] = "Placed";
|
|
439
|
-
OrderStatus2["Cancelled"] = "Cancelled";
|
|
440
|
-
OrderStatus2["Filled"] = "Filled";
|
|
441
|
-
OrderStatus2["PartiallyFilled"] = "PartiallyFilled";
|
|
442
|
-
OrderStatus2["Rejected"] = "Rejected";
|
|
443
|
-
OrderStatus2["Executed"] = "Executed";
|
|
444
|
-
return OrderStatus2;
|
|
445
|
-
})(OrderStatus || {});
|
|
446
|
-
var OrderType = /* @__PURE__ */ ((OrderType2) => {
|
|
447
|
-
OrderType2["Limit"] = "Limit";
|
|
448
|
-
OrderType2["Market"] = "Market";
|
|
449
|
-
return OrderType2;
|
|
450
|
-
})(OrderType || {});
|
|
451
|
-
var TradeRole = /* @__PURE__ */ ((TradeRole2) => {
|
|
452
|
-
TradeRole2["Maker"] = "Maker";
|
|
453
|
-
TradeRole2["Taker"] = "Taker";
|
|
454
|
-
return TradeRole2;
|
|
455
|
-
})(TradeRole || {});
|
|
456
458
|
var UserStatus = /* @__PURE__ */ ((UserStatus2) => {
|
|
457
459
|
UserStatus2["Active"] = "Active";
|
|
458
460
|
UserStatus2["Locked"] = "Locked";
|
|
@@ -461,7 +463,7 @@ var UserStatus = /* @__PURE__ */ ((UserStatus2) => {
|
|
|
461
463
|
|
|
462
464
|
// generated_types/withdrawFromVault.ts
|
|
463
465
|
var ABI14 = {
|
|
464
|
-
"address": "
|
|
466
|
+
"address": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
465
467
|
"name": "withdraw_from_vault",
|
|
466
468
|
"friends": [],
|
|
467
469
|
"exposed_functions": [
|
|
@@ -722,6 +724,24 @@ var Client = class _Client {
|
|
|
722
724
|
const response = await this.sendGetJson("/v1/get_users_by_address" /* GetUsersByAddress */, payload);
|
|
723
725
|
return response;
|
|
724
726
|
};
|
|
727
|
+
this.getPerpRecentTrades = async (request) => {
|
|
728
|
+
const response = await this.sendGetJson("/v1/get_perp_recent_trades" /* GetPerpRecentTrades */, request);
|
|
729
|
+
return response;
|
|
730
|
+
};
|
|
731
|
+
this.getUserPerpFills = async (request) => {
|
|
732
|
+
if (request.timestampEndMs && request.timestampStartMs && request.timestampEndMs < request.timestampStartMs) {
|
|
733
|
+
throw new Error("timestampEndMs must be greater than timestampStartMs");
|
|
734
|
+
}
|
|
735
|
+
const response = await this.sendGetJson("/v1/get_user_perp_fills" /* GetUserPerpFills */, request);
|
|
736
|
+
return response;
|
|
737
|
+
};
|
|
738
|
+
this.getUserPerpOrders = async (request) => {
|
|
739
|
+
if (request.timestampEndMs && request.timestampStartMs && request.timestampEndMs < request.timestampStartMs) {
|
|
740
|
+
throw new Error("timestampEndMs must be greater than timestampStartMs");
|
|
741
|
+
}
|
|
742
|
+
const response = await this.sendGetJson("/v1/get_user_perp_orders" /* GetUserPerpOrders */, request);
|
|
743
|
+
return response;
|
|
744
|
+
};
|
|
725
745
|
this._aptos = connection;
|
|
726
746
|
this._surf = (0, import_surf.createSurfClient)(this._aptos);
|
|
727
747
|
this._apiKey = apiKey || generateApiKey();
|
|
@@ -820,7 +840,25 @@ var Client = class _Client {
|
|
|
820
840
|
apiKey
|
|
821
841
|
};
|
|
822
842
|
}
|
|
823
|
-
async
|
|
843
|
+
async subscribeIndexPricesUpdates(callback) {
|
|
844
|
+
const command = {
|
|
845
|
+
type: "SubscribeOracle",
|
|
846
|
+
content: { id: getRandomId() }
|
|
847
|
+
};
|
|
848
|
+
await this.sendWsMessage(command);
|
|
849
|
+
const topic = getTopicFromCommand(command);
|
|
850
|
+
this._subscriptions.set(topic, callback);
|
|
851
|
+
}
|
|
852
|
+
async unsubscribeIndexPricesUpdates(userId) {
|
|
853
|
+
const command = {
|
|
854
|
+
type: "SubscribeOracle",
|
|
855
|
+
content: { id: getRandomId() }
|
|
856
|
+
};
|
|
857
|
+
await this.sendWsMessage(command);
|
|
858
|
+
const topic = getTopicFromCommand(command);
|
|
859
|
+
this._subscriptions.delete(topic);
|
|
860
|
+
}
|
|
861
|
+
async subscribeUserUpdates(userId, callback) {
|
|
824
862
|
const command = {
|
|
825
863
|
type: "SubscribeUser",
|
|
826
864
|
content: { id: getRandomId(), user_id: userId }
|
|
@@ -829,7 +867,7 @@ var Client = class _Client {
|
|
|
829
867
|
const topic = getTopicFromCommand(command);
|
|
830
868
|
this._subscriptions.set(topic, callback);
|
|
831
869
|
}
|
|
832
|
-
async
|
|
870
|
+
async unsubscribeUserUpdates(userId) {
|
|
833
871
|
const command = {
|
|
834
872
|
type: "UnsubscribeUser",
|
|
835
873
|
content: { id: getRandomId(), user_id: userId }
|
|
@@ -1077,7 +1115,7 @@ var import_surf2 = require("@thalalabs/surf");
|
|
|
1077
1115
|
|
|
1078
1116
|
// generated_types/faucetEntrypoints.ts
|
|
1079
1117
|
var ABI15 = {
|
|
1080
|
-
"address": "
|
|
1118
|
+
"address": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
1081
1119
|
"name": "faucet_entrypoints",
|
|
1082
1120
|
"friends": [],
|
|
1083
1121
|
"exposed_functions": [
|
|
@@ -1112,7 +1150,7 @@ var faucetEntrypoints_default = ABI15;
|
|
|
1112
1150
|
|
|
1113
1151
|
// generated_types/testFaucet.ts
|
|
1114
1152
|
var ABI16 = {
|
|
1115
|
-
"address": "
|
|
1153
|
+
"address": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
1116
1154
|
"name": "test_faucet",
|
|
1117
1155
|
"friends": [],
|
|
1118
1156
|
"exposed_functions": [
|
|
@@ -1149,7 +1187,7 @@ var ABI16 = {
|
|
|
1149
1187
|
],
|
|
1150
1188
|
"return": [
|
|
1151
1189
|
"0x1::object::ConstructorRef",
|
|
1152
|
-
"0x1::object::Object<
|
|
1190
|
+
"0x1::object::Object<0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd::test_faucet::Token>"
|
|
1153
1191
|
]
|
|
1154
1192
|
},
|
|
1155
1193
|
{
|
|
@@ -1288,7 +1326,7 @@ var ABI16 = {
|
|
|
1288
1326
|
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
1289
1327
|
],
|
|
1290
1328
|
"return": [
|
|
1291
|
-
"
|
|
1329
|
+
"0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd::test_faucet::FaucetToken"
|
|
1292
1330
|
]
|
|
1293
1331
|
}
|
|
1294
1332
|
],
|
|
@@ -1320,7 +1358,7 @@ var ABI16 = {
|
|
|
1320
1358
|
"fields": [
|
|
1321
1359
|
{
|
|
1322
1360
|
"name": "tokens",
|
|
1323
|
-
"type": "0x1::smart_table::SmartTable<vector<u8>,
|
|
1361
|
+
"type": "0x1::smart_table::SmartTable<vector<u8>, 0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd::test_faucet::FaucetToken>"
|
|
1324
1362
|
}
|
|
1325
1363
|
]
|
|
1326
1364
|
},
|
package/dist/index.d.cts
CHANGED
|
@@ -94,6 +94,24 @@ interface GetPerpOrderBookDataRequest {
|
|
|
94
94
|
interface GetPerpOrderBookDataResponse {
|
|
95
95
|
data: PerpOrderBookData;
|
|
96
96
|
}
|
|
97
|
+
interface GetPerpRecentTradesRequest {
|
|
98
|
+
marketName: string;
|
|
99
|
+
paginationCursor?: PaginationCursor;
|
|
100
|
+
}
|
|
101
|
+
declare enum OrderSide {
|
|
102
|
+
Bid = "Bid",
|
|
103
|
+
Ask = "Ask"
|
|
104
|
+
}
|
|
105
|
+
interface PerpTrade {
|
|
106
|
+
timestamp: string;
|
|
107
|
+
size: string;
|
|
108
|
+
price: string;
|
|
109
|
+
side: OrderSide;
|
|
110
|
+
}
|
|
111
|
+
interface GetPerpRecentTradesResponse {
|
|
112
|
+
trades: PerpTrade[];
|
|
113
|
+
pagination_cursor?: PaginationCursor;
|
|
114
|
+
}
|
|
97
115
|
interface MarginStep {
|
|
98
116
|
initialMarginRatio: string;
|
|
99
117
|
initialAmount: string;
|
|
@@ -200,6 +218,68 @@ interface GetUserDataResponse {
|
|
|
200
218
|
userData: User;
|
|
201
219
|
perpOrdersCount: string;
|
|
202
220
|
}
|
|
221
|
+
interface GetPerpUserFillsRequest {
|
|
222
|
+
userId: string;
|
|
223
|
+
marketName?: string;
|
|
224
|
+
timestampStartMs?: string;
|
|
225
|
+
timestampEndMs?: string;
|
|
226
|
+
paginationCursor?: PaginationCursor;
|
|
227
|
+
}
|
|
228
|
+
declare enum TradeRole {
|
|
229
|
+
Maker = "Maker",
|
|
230
|
+
Taker = "Taker"
|
|
231
|
+
}
|
|
232
|
+
interface PerpFill {
|
|
233
|
+
fillId: string;
|
|
234
|
+
orderId: string;
|
|
235
|
+
timestamp: string;
|
|
236
|
+
marketName: string;
|
|
237
|
+
size: string;
|
|
238
|
+
price: string;
|
|
239
|
+
fee: string;
|
|
240
|
+
side: OrderSide;
|
|
241
|
+
tradeRole: TradeRole;
|
|
242
|
+
}
|
|
243
|
+
interface GetPerpUserFillsResponse {
|
|
244
|
+
fills: PerpFill[];
|
|
245
|
+
pagination_cursor?: PaginationCursor;
|
|
246
|
+
}
|
|
247
|
+
interface GetPerpUserOrdersRequest {
|
|
248
|
+
userId: string;
|
|
249
|
+
marketName?: string;
|
|
250
|
+
timestampStartMs?: string;
|
|
251
|
+
timestampEndMs?: string;
|
|
252
|
+
paginationCursor?: PaginationCursor;
|
|
253
|
+
}
|
|
254
|
+
declare enum OrderType {
|
|
255
|
+
Limit = "Limit",
|
|
256
|
+
Market = "Market"
|
|
257
|
+
}
|
|
258
|
+
declare enum OrderStatus {
|
|
259
|
+
Placed = "Placed",
|
|
260
|
+
Cancelled = "Cancelled",
|
|
261
|
+
Filled = "Filled",
|
|
262
|
+
PartiallyFilled = "PartiallyFilled",
|
|
263
|
+
Executed = "Executed"
|
|
264
|
+
}
|
|
265
|
+
interface PerpOrder {
|
|
266
|
+
orderId: string;
|
|
267
|
+
userId: string;
|
|
268
|
+
creationTimestamp: string;
|
|
269
|
+
marketName: string;
|
|
270
|
+
size: string;
|
|
271
|
+
price: string;
|
|
272
|
+
filledSize: string;
|
|
273
|
+
side: OrderSide;
|
|
274
|
+
reduceOnly: boolean;
|
|
275
|
+
postOnly: boolean;
|
|
276
|
+
orderType: OrderType;
|
|
277
|
+
orderStatus: OrderStatus;
|
|
278
|
+
}
|
|
279
|
+
interface GetPerpUserOrdersResponse {
|
|
280
|
+
orders: PerpOrder[];
|
|
281
|
+
pagination_cursor?: PaginationCursor;
|
|
282
|
+
}
|
|
203
283
|
interface GetUsersByAddressRequest {
|
|
204
284
|
userAddress: string;
|
|
205
285
|
}
|
|
@@ -224,10 +304,6 @@ interface ExchangeConfig {
|
|
|
224
304
|
usdcAddress?: string;
|
|
225
305
|
perpetualsMarkets: Record<string, PerpetualMarketConfigEntry>;
|
|
226
306
|
}
|
|
227
|
-
declare enum OrderSide {
|
|
228
|
-
Bid = "Bid",
|
|
229
|
-
Ask = "Ask"
|
|
230
|
-
}
|
|
231
307
|
interface Order {
|
|
232
308
|
id: string;
|
|
233
309
|
size: string;
|
|
@@ -371,7 +447,10 @@ declare enum EndpointsV1 {
|
|
|
371
447
|
GetBorrowLendingData = "/v1/get_borrow_lending_data",
|
|
372
448
|
SubmitSponsoredTransactionRequest = "/v1/submit_sponsored_transaction",
|
|
373
449
|
GetChartCandlesInRange = "/v1/public/chart_candles_in_range",
|
|
374
|
-
GetUsersByAddress = "/v1/get_users_by_address"
|
|
450
|
+
GetUsersByAddress = "/v1/get_users_by_address",
|
|
451
|
+
GetUserPerpOrders = "/v1/get_user_perp_orders",
|
|
452
|
+
GetUserPerpFills = "/v1/get_user_perp_fills",
|
|
453
|
+
GetPerpRecentTrades = "/v1/get_perp_recent_trades"
|
|
375
454
|
}
|
|
376
455
|
declare enum AdminEndpoints {
|
|
377
456
|
Placeholder = "/admin/placeholder"
|
|
@@ -493,22 +572,6 @@ type WsMessage = {
|
|
|
493
572
|
type: "RemoveApiKey";
|
|
494
573
|
content: RemoveApiKey;
|
|
495
574
|
};
|
|
496
|
-
declare enum OrderStatus {
|
|
497
|
-
Placed = "Placed",
|
|
498
|
-
Cancelled = "Cancelled",
|
|
499
|
-
Filled = "Filled",
|
|
500
|
-
PartiallyFilled = "PartiallyFilled",
|
|
501
|
-
Rejected = "Rejected",
|
|
502
|
-
Executed = "Executed"
|
|
503
|
-
}
|
|
504
|
-
declare enum OrderType {
|
|
505
|
-
Limit = "Limit",
|
|
506
|
-
Market = "Market"
|
|
507
|
-
}
|
|
508
|
-
declare enum TradeRole {
|
|
509
|
-
Maker = "Maker",
|
|
510
|
-
Taker = "Taker"
|
|
511
|
-
}
|
|
512
575
|
declare enum UserStatus {
|
|
513
576
|
Active = "Active",
|
|
514
577
|
Locked = "Locked"
|
|
@@ -545,8 +608,10 @@ declare class Client {
|
|
|
545
608
|
signature: AccountAuthenticator;
|
|
546
609
|
apiKey: _aptos_labs_ts_sdk.Ed25519Account;
|
|
547
610
|
}>;
|
|
548
|
-
|
|
549
|
-
|
|
611
|
+
subscribeIndexPricesUpdates(callback: (data: WsMessage) => void): Promise<void>;
|
|
612
|
+
unsubscribeIndexPricesUpdates(userId: string): Promise<void>;
|
|
613
|
+
subscribeUserUpdates(userId: string, callback: (data: WsMessage) => void): Promise<void>;
|
|
614
|
+
unsubscribeUserUpdates(userId: string): Promise<void>;
|
|
550
615
|
addApiKey(params: AddApiKeyParams): Promise<_thalalabs_surf.EntryPayload>;
|
|
551
616
|
removeApiKey(params: RemoveApiKeyParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
552
617
|
setAliasName(params: SetAliasNameParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
@@ -575,6 +640,9 @@ declare class Client {
|
|
|
575
640
|
getChartCandlesInRange: ({ interval, marketName, endTime, startTime, cursor, }: IGetChartCandlesInRange) => Promise<void>;
|
|
576
641
|
getPriceIndexes: () => Promise<GetPriceIndexesResponse>;
|
|
577
642
|
getUsersByAddress: (payload: GetUsersByAddressRequest) => Promise<GetUsersByAddressResponse>;
|
|
643
|
+
getPerpRecentTrades: (request: GetPerpRecentTradesRequest) => Promise<any>;
|
|
644
|
+
getUserPerpFills: (request: GetPerpUserFillsRequest) => Promise<any>;
|
|
645
|
+
getUserPerpOrders: (request: GetPerpUserOrdersRequest) => Promise<any>;
|
|
578
646
|
}
|
|
579
647
|
interface PlacePerpLimitOrderParams {
|
|
580
648
|
userId: string;
|
|
@@ -678,4 +746,4 @@ declare const generateApiKey: () => _aptos_labs_ts_sdk.Ed25519Account;
|
|
|
678
746
|
declare const getTopicFromCommand: (data: WsCommand) => string;
|
|
679
747
|
declare const getTopicFromMessage: (data: WsMessage) => string;
|
|
680
748
|
|
|
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 };
|
|
749
|
+
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 GetPerpRecentTradesRequest, type GetPerpRecentTradesResponse, type GetPerpUserFillsRequest, type GetPerpUserFillsResponse, type GetPerpUserOrdersRequest, type GetPerpUserOrdersResponse, 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 PerpFill, type PerpMarketData, type PerpOrder, type PerpOrderBookData, type PerpPosition, type PerpTrade, 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
|
@@ -94,6 +94,24 @@ interface GetPerpOrderBookDataRequest {
|
|
|
94
94
|
interface GetPerpOrderBookDataResponse {
|
|
95
95
|
data: PerpOrderBookData;
|
|
96
96
|
}
|
|
97
|
+
interface GetPerpRecentTradesRequest {
|
|
98
|
+
marketName: string;
|
|
99
|
+
paginationCursor?: PaginationCursor;
|
|
100
|
+
}
|
|
101
|
+
declare enum OrderSide {
|
|
102
|
+
Bid = "Bid",
|
|
103
|
+
Ask = "Ask"
|
|
104
|
+
}
|
|
105
|
+
interface PerpTrade {
|
|
106
|
+
timestamp: string;
|
|
107
|
+
size: string;
|
|
108
|
+
price: string;
|
|
109
|
+
side: OrderSide;
|
|
110
|
+
}
|
|
111
|
+
interface GetPerpRecentTradesResponse {
|
|
112
|
+
trades: PerpTrade[];
|
|
113
|
+
pagination_cursor?: PaginationCursor;
|
|
114
|
+
}
|
|
97
115
|
interface MarginStep {
|
|
98
116
|
initialMarginRatio: string;
|
|
99
117
|
initialAmount: string;
|
|
@@ -200,6 +218,68 @@ interface GetUserDataResponse {
|
|
|
200
218
|
userData: User;
|
|
201
219
|
perpOrdersCount: string;
|
|
202
220
|
}
|
|
221
|
+
interface GetPerpUserFillsRequest {
|
|
222
|
+
userId: string;
|
|
223
|
+
marketName?: string;
|
|
224
|
+
timestampStartMs?: string;
|
|
225
|
+
timestampEndMs?: string;
|
|
226
|
+
paginationCursor?: PaginationCursor;
|
|
227
|
+
}
|
|
228
|
+
declare enum TradeRole {
|
|
229
|
+
Maker = "Maker",
|
|
230
|
+
Taker = "Taker"
|
|
231
|
+
}
|
|
232
|
+
interface PerpFill {
|
|
233
|
+
fillId: string;
|
|
234
|
+
orderId: string;
|
|
235
|
+
timestamp: string;
|
|
236
|
+
marketName: string;
|
|
237
|
+
size: string;
|
|
238
|
+
price: string;
|
|
239
|
+
fee: string;
|
|
240
|
+
side: OrderSide;
|
|
241
|
+
tradeRole: TradeRole;
|
|
242
|
+
}
|
|
243
|
+
interface GetPerpUserFillsResponse {
|
|
244
|
+
fills: PerpFill[];
|
|
245
|
+
pagination_cursor?: PaginationCursor;
|
|
246
|
+
}
|
|
247
|
+
interface GetPerpUserOrdersRequest {
|
|
248
|
+
userId: string;
|
|
249
|
+
marketName?: string;
|
|
250
|
+
timestampStartMs?: string;
|
|
251
|
+
timestampEndMs?: string;
|
|
252
|
+
paginationCursor?: PaginationCursor;
|
|
253
|
+
}
|
|
254
|
+
declare enum OrderType {
|
|
255
|
+
Limit = "Limit",
|
|
256
|
+
Market = "Market"
|
|
257
|
+
}
|
|
258
|
+
declare enum OrderStatus {
|
|
259
|
+
Placed = "Placed",
|
|
260
|
+
Cancelled = "Cancelled",
|
|
261
|
+
Filled = "Filled",
|
|
262
|
+
PartiallyFilled = "PartiallyFilled",
|
|
263
|
+
Executed = "Executed"
|
|
264
|
+
}
|
|
265
|
+
interface PerpOrder {
|
|
266
|
+
orderId: string;
|
|
267
|
+
userId: string;
|
|
268
|
+
creationTimestamp: string;
|
|
269
|
+
marketName: string;
|
|
270
|
+
size: string;
|
|
271
|
+
price: string;
|
|
272
|
+
filledSize: string;
|
|
273
|
+
side: OrderSide;
|
|
274
|
+
reduceOnly: boolean;
|
|
275
|
+
postOnly: boolean;
|
|
276
|
+
orderType: OrderType;
|
|
277
|
+
orderStatus: OrderStatus;
|
|
278
|
+
}
|
|
279
|
+
interface GetPerpUserOrdersResponse {
|
|
280
|
+
orders: PerpOrder[];
|
|
281
|
+
pagination_cursor?: PaginationCursor;
|
|
282
|
+
}
|
|
203
283
|
interface GetUsersByAddressRequest {
|
|
204
284
|
userAddress: string;
|
|
205
285
|
}
|
|
@@ -224,10 +304,6 @@ interface ExchangeConfig {
|
|
|
224
304
|
usdcAddress?: string;
|
|
225
305
|
perpetualsMarkets: Record<string, PerpetualMarketConfigEntry>;
|
|
226
306
|
}
|
|
227
|
-
declare enum OrderSide {
|
|
228
|
-
Bid = "Bid",
|
|
229
|
-
Ask = "Ask"
|
|
230
|
-
}
|
|
231
307
|
interface Order {
|
|
232
308
|
id: string;
|
|
233
309
|
size: string;
|
|
@@ -371,7 +447,10 @@ declare enum EndpointsV1 {
|
|
|
371
447
|
GetBorrowLendingData = "/v1/get_borrow_lending_data",
|
|
372
448
|
SubmitSponsoredTransactionRequest = "/v1/submit_sponsored_transaction",
|
|
373
449
|
GetChartCandlesInRange = "/v1/public/chart_candles_in_range",
|
|
374
|
-
GetUsersByAddress = "/v1/get_users_by_address"
|
|
450
|
+
GetUsersByAddress = "/v1/get_users_by_address",
|
|
451
|
+
GetUserPerpOrders = "/v1/get_user_perp_orders",
|
|
452
|
+
GetUserPerpFills = "/v1/get_user_perp_fills",
|
|
453
|
+
GetPerpRecentTrades = "/v1/get_perp_recent_trades"
|
|
375
454
|
}
|
|
376
455
|
declare enum AdminEndpoints {
|
|
377
456
|
Placeholder = "/admin/placeholder"
|
|
@@ -493,22 +572,6 @@ type WsMessage = {
|
|
|
493
572
|
type: "RemoveApiKey";
|
|
494
573
|
content: RemoveApiKey;
|
|
495
574
|
};
|
|
496
|
-
declare enum OrderStatus {
|
|
497
|
-
Placed = "Placed",
|
|
498
|
-
Cancelled = "Cancelled",
|
|
499
|
-
Filled = "Filled",
|
|
500
|
-
PartiallyFilled = "PartiallyFilled",
|
|
501
|
-
Rejected = "Rejected",
|
|
502
|
-
Executed = "Executed"
|
|
503
|
-
}
|
|
504
|
-
declare enum OrderType {
|
|
505
|
-
Limit = "Limit",
|
|
506
|
-
Market = "Market"
|
|
507
|
-
}
|
|
508
|
-
declare enum TradeRole {
|
|
509
|
-
Maker = "Maker",
|
|
510
|
-
Taker = "Taker"
|
|
511
|
-
}
|
|
512
575
|
declare enum UserStatus {
|
|
513
576
|
Active = "Active",
|
|
514
577
|
Locked = "Locked"
|
|
@@ -545,8 +608,10 @@ declare class Client {
|
|
|
545
608
|
signature: AccountAuthenticator;
|
|
546
609
|
apiKey: _aptos_labs_ts_sdk.Ed25519Account;
|
|
547
610
|
}>;
|
|
548
|
-
|
|
549
|
-
|
|
611
|
+
subscribeIndexPricesUpdates(callback: (data: WsMessage) => void): Promise<void>;
|
|
612
|
+
unsubscribeIndexPricesUpdates(userId: string): Promise<void>;
|
|
613
|
+
subscribeUserUpdates(userId: string, callback: (data: WsMessage) => void): Promise<void>;
|
|
614
|
+
unsubscribeUserUpdates(userId: string): Promise<void>;
|
|
550
615
|
addApiKey(params: AddApiKeyParams): Promise<_thalalabs_surf.EntryPayload>;
|
|
551
616
|
removeApiKey(params: RemoveApiKeyParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
552
617
|
setAliasName(params: SetAliasNameParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
@@ -575,6 +640,9 @@ declare class Client {
|
|
|
575
640
|
getChartCandlesInRange: ({ interval, marketName, endTime, startTime, cursor, }: IGetChartCandlesInRange) => Promise<void>;
|
|
576
641
|
getPriceIndexes: () => Promise<GetPriceIndexesResponse>;
|
|
577
642
|
getUsersByAddress: (payload: GetUsersByAddressRequest) => Promise<GetUsersByAddressResponse>;
|
|
643
|
+
getPerpRecentTrades: (request: GetPerpRecentTradesRequest) => Promise<any>;
|
|
644
|
+
getUserPerpFills: (request: GetPerpUserFillsRequest) => Promise<any>;
|
|
645
|
+
getUserPerpOrders: (request: GetPerpUserOrdersRequest) => Promise<any>;
|
|
578
646
|
}
|
|
579
647
|
interface PlacePerpLimitOrderParams {
|
|
580
648
|
userId: string;
|
|
@@ -678,4 +746,4 @@ declare const generateApiKey: () => _aptos_labs_ts_sdk.Ed25519Account;
|
|
|
678
746
|
declare const getTopicFromCommand: (data: WsCommand) => string;
|
|
679
747
|
declare const getTopicFromMessage: (data: WsMessage) => string;
|
|
680
748
|
|
|
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 };
|
|
749
|
+
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 GetPerpRecentTradesRequest, type GetPerpRecentTradesResponse, type GetPerpUserFillsRequest, type GetPerpUserFillsResponse, type GetPerpUserOrdersRequest, type GetPerpUserOrdersResponse, 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 PerpFill, type PerpMarketData, type PerpOrder, type PerpOrderBookData, type PerpPosition, type PerpTrade, 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": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
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": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
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": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
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": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
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": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
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": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
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": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
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": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
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": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
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": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
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": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
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": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
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": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
312
312
|
"name": "set_autolend",
|
|
313
313
|
"friends": [],
|
|
314
314
|
"exposed_functions": [
|
|
@@ -341,6 +341,11 @@ var ChartInterval = /* @__PURE__ */ ((ChartInterval3) => {
|
|
|
341
341
|
ChartInterval3["OneDay"] = "OneDay";
|
|
342
342
|
return ChartInterval3;
|
|
343
343
|
})(ChartInterval || {});
|
|
344
|
+
var OrderSide = /* @__PURE__ */ ((OrderSide2) => {
|
|
345
|
+
OrderSide2["Bid"] = "Bid";
|
|
346
|
+
OrderSide2["Ask"] = "Ask";
|
|
347
|
+
return OrderSide2;
|
|
348
|
+
})(OrderSide || {});
|
|
344
349
|
var PerpetualMarketStatus = /* @__PURE__ */ ((PerpetualMarketStatus2) => {
|
|
345
350
|
PerpetualMarketStatus2["Halted"] = "halted";
|
|
346
351
|
PerpetualMarketStatus2["ReduceOnly"] = "reduceOnly";
|
|
@@ -348,11 +353,24 @@ var PerpetualMarketStatus = /* @__PURE__ */ ((PerpetualMarketStatus2) => {
|
|
|
348
353
|
PerpetualMarketStatus2["Live"] = "live";
|
|
349
354
|
return PerpetualMarketStatus2;
|
|
350
355
|
})(PerpetualMarketStatus || {});
|
|
351
|
-
var
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
return
|
|
355
|
-
})(
|
|
356
|
+
var TradeRole = /* @__PURE__ */ ((TradeRole2) => {
|
|
357
|
+
TradeRole2["Maker"] = "Maker";
|
|
358
|
+
TradeRole2["Taker"] = "Taker";
|
|
359
|
+
return TradeRole2;
|
|
360
|
+
})(TradeRole || {});
|
|
361
|
+
var OrderType = /* @__PURE__ */ ((OrderType2) => {
|
|
362
|
+
OrderType2["Limit"] = "Limit";
|
|
363
|
+
OrderType2["Market"] = "Market";
|
|
364
|
+
return OrderType2;
|
|
365
|
+
})(OrderType || {});
|
|
366
|
+
var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
|
|
367
|
+
OrderStatus2["Placed"] = "Placed";
|
|
368
|
+
OrderStatus2["Cancelled"] = "Cancelled";
|
|
369
|
+
OrderStatus2["Filled"] = "Filled";
|
|
370
|
+
OrderStatus2["PartiallyFilled"] = "PartiallyFilled";
|
|
371
|
+
OrderStatus2["Executed"] = "Executed";
|
|
372
|
+
return OrderStatus2;
|
|
373
|
+
})(OrderStatus || {});
|
|
356
374
|
var EndpointsV1 = /* @__PURE__ */ ((EndpointsV12) => {
|
|
357
375
|
EndpointsV12["Ws"] = "/v1/ws";
|
|
358
376
|
EndpointsV12["GetConfig"] = "/v1/get_config";
|
|
@@ -366,6 +384,9 @@ var EndpointsV1 = /* @__PURE__ */ ((EndpointsV12) => {
|
|
|
366
384
|
EndpointsV12["SubmitSponsoredTransactionRequest"] = "/v1/submit_sponsored_transaction";
|
|
367
385
|
EndpointsV12["GetChartCandlesInRange"] = "/v1/public/chart_candles_in_range";
|
|
368
386
|
EndpointsV12["GetUsersByAddress"] = "/v1/get_users_by_address";
|
|
387
|
+
EndpointsV12["GetUserPerpOrders"] = "/v1/get_user_perp_orders";
|
|
388
|
+
EndpointsV12["GetUserPerpFills"] = "/v1/get_user_perp_fills";
|
|
389
|
+
EndpointsV12["GetPerpRecentTrades"] = "/v1/get_perp_recent_trades";
|
|
369
390
|
return EndpointsV12;
|
|
370
391
|
})(EndpointsV1 || {});
|
|
371
392
|
var AdminEndpoints = /* @__PURE__ */ ((AdminEndpoints2) => {
|
|
@@ -377,25 +398,6 @@ var BaseEndpoints = /* @__PURE__ */ ((BaseEndpoints2) => {
|
|
|
377
398
|
BaseEndpoints2["Status"] = "/app_status";
|
|
378
399
|
return BaseEndpoints2;
|
|
379
400
|
})(BaseEndpoints || {});
|
|
380
|
-
var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
|
|
381
|
-
OrderStatus2["Placed"] = "Placed";
|
|
382
|
-
OrderStatus2["Cancelled"] = "Cancelled";
|
|
383
|
-
OrderStatus2["Filled"] = "Filled";
|
|
384
|
-
OrderStatus2["PartiallyFilled"] = "PartiallyFilled";
|
|
385
|
-
OrderStatus2["Rejected"] = "Rejected";
|
|
386
|
-
OrderStatus2["Executed"] = "Executed";
|
|
387
|
-
return OrderStatus2;
|
|
388
|
-
})(OrderStatus || {});
|
|
389
|
-
var OrderType = /* @__PURE__ */ ((OrderType2) => {
|
|
390
|
-
OrderType2["Limit"] = "Limit";
|
|
391
|
-
OrderType2["Market"] = "Market";
|
|
392
|
-
return OrderType2;
|
|
393
|
-
})(OrderType || {});
|
|
394
|
-
var TradeRole = /* @__PURE__ */ ((TradeRole2) => {
|
|
395
|
-
TradeRole2["Maker"] = "Maker";
|
|
396
|
-
TradeRole2["Taker"] = "Taker";
|
|
397
|
-
return TradeRole2;
|
|
398
|
-
})(TradeRole || {});
|
|
399
401
|
var UserStatus = /* @__PURE__ */ ((UserStatus2) => {
|
|
400
402
|
UserStatus2["Active"] = "Active";
|
|
401
403
|
UserStatus2["Locked"] = "Locked";
|
|
@@ -404,7 +406,7 @@ var UserStatus = /* @__PURE__ */ ((UserStatus2) => {
|
|
|
404
406
|
|
|
405
407
|
// generated_types/withdrawFromVault.ts
|
|
406
408
|
var ABI14 = {
|
|
407
|
-
"address": "
|
|
409
|
+
"address": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
408
410
|
"name": "withdraw_from_vault",
|
|
409
411
|
"friends": [],
|
|
410
412
|
"exposed_functions": [
|
|
@@ -665,6 +667,24 @@ var Client = class _Client {
|
|
|
665
667
|
const response = await this.sendGetJson("/v1/get_users_by_address" /* GetUsersByAddress */, payload);
|
|
666
668
|
return response;
|
|
667
669
|
};
|
|
670
|
+
this.getPerpRecentTrades = async (request) => {
|
|
671
|
+
const response = await this.sendGetJson("/v1/get_perp_recent_trades" /* GetPerpRecentTrades */, request);
|
|
672
|
+
return response;
|
|
673
|
+
};
|
|
674
|
+
this.getUserPerpFills = async (request) => {
|
|
675
|
+
if (request.timestampEndMs && request.timestampStartMs && request.timestampEndMs < request.timestampStartMs) {
|
|
676
|
+
throw new Error("timestampEndMs must be greater than timestampStartMs");
|
|
677
|
+
}
|
|
678
|
+
const response = await this.sendGetJson("/v1/get_user_perp_fills" /* GetUserPerpFills */, request);
|
|
679
|
+
return response;
|
|
680
|
+
};
|
|
681
|
+
this.getUserPerpOrders = async (request) => {
|
|
682
|
+
if (request.timestampEndMs && request.timestampStartMs && request.timestampEndMs < request.timestampStartMs) {
|
|
683
|
+
throw new Error("timestampEndMs must be greater than timestampStartMs");
|
|
684
|
+
}
|
|
685
|
+
const response = await this.sendGetJson("/v1/get_user_perp_orders" /* GetUserPerpOrders */, request);
|
|
686
|
+
return response;
|
|
687
|
+
};
|
|
668
688
|
this._aptos = connection;
|
|
669
689
|
this._surf = createSurfClient(this._aptos);
|
|
670
690
|
this._apiKey = apiKey || generateApiKey();
|
|
@@ -763,7 +783,25 @@ var Client = class _Client {
|
|
|
763
783
|
apiKey
|
|
764
784
|
};
|
|
765
785
|
}
|
|
766
|
-
async
|
|
786
|
+
async subscribeIndexPricesUpdates(callback) {
|
|
787
|
+
const command = {
|
|
788
|
+
type: "SubscribeOracle",
|
|
789
|
+
content: { id: getRandomId() }
|
|
790
|
+
};
|
|
791
|
+
await this.sendWsMessage(command);
|
|
792
|
+
const topic = getTopicFromCommand(command);
|
|
793
|
+
this._subscriptions.set(topic, callback);
|
|
794
|
+
}
|
|
795
|
+
async unsubscribeIndexPricesUpdates(userId) {
|
|
796
|
+
const command = {
|
|
797
|
+
type: "SubscribeOracle",
|
|
798
|
+
content: { id: getRandomId() }
|
|
799
|
+
};
|
|
800
|
+
await this.sendWsMessage(command);
|
|
801
|
+
const topic = getTopicFromCommand(command);
|
|
802
|
+
this._subscriptions.delete(topic);
|
|
803
|
+
}
|
|
804
|
+
async subscribeUserUpdates(userId, callback) {
|
|
767
805
|
const command = {
|
|
768
806
|
type: "SubscribeUser",
|
|
769
807
|
content: { id: getRandomId(), user_id: userId }
|
|
@@ -772,7 +810,7 @@ var Client = class _Client {
|
|
|
772
810
|
const topic = getTopicFromCommand(command);
|
|
773
811
|
this._subscriptions.set(topic, callback);
|
|
774
812
|
}
|
|
775
|
-
async
|
|
813
|
+
async unsubscribeUserUpdates(userId) {
|
|
776
814
|
const command = {
|
|
777
815
|
type: "UnsubscribeUser",
|
|
778
816
|
content: { id: getRandomId(), user_id: userId }
|
|
@@ -1020,7 +1058,7 @@ import { createEntryPayload as createEntryPayload2 } from "@thalalabs/surf";
|
|
|
1020
1058
|
|
|
1021
1059
|
// generated_types/faucetEntrypoints.ts
|
|
1022
1060
|
var ABI15 = {
|
|
1023
|
-
"address": "
|
|
1061
|
+
"address": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
1024
1062
|
"name": "faucet_entrypoints",
|
|
1025
1063
|
"friends": [],
|
|
1026
1064
|
"exposed_functions": [
|
|
@@ -1055,7 +1093,7 @@ var faucetEntrypoints_default = ABI15;
|
|
|
1055
1093
|
|
|
1056
1094
|
// generated_types/testFaucet.ts
|
|
1057
1095
|
var ABI16 = {
|
|
1058
|
-
"address": "
|
|
1096
|
+
"address": "0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd",
|
|
1059
1097
|
"name": "test_faucet",
|
|
1060
1098
|
"friends": [],
|
|
1061
1099
|
"exposed_functions": [
|
|
@@ -1092,7 +1130,7 @@ var ABI16 = {
|
|
|
1092
1130
|
],
|
|
1093
1131
|
"return": [
|
|
1094
1132
|
"0x1::object::ConstructorRef",
|
|
1095
|
-
"0x1::object::Object<
|
|
1133
|
+
"0x1::object::Object<0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd::test_faucet::Token>"
|
|
1096
1134
|
]
|
|
1097
1135
|
},
|
|
1098
1136
|
{
|
|
@@ -1231,7 +1269,7 @@ var ABI16 = {
|
|
|
1231
1269
|
"0x1::object::Object<0x1::fungible_asset::Metadata>"
|
|
1232
1270
|
],
|
|
1233
1271
|
"return": [
|
|
1234
|
-
"
|
|
1272
|
+
"0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd::test_faucet::FaucetToken"
|
|
1235
1273
|
]
|
|
1236
1274
|
}
|
|
1237
1275
|
],
|
|
@@ -1263,7 +1301,7 @@ var ABI16 = {
|
|
|
1263
1301
|
"fields": [
|
|
1264
1302
|
{
|
|
1265
1303
|
"name": "tokens",
|
|
1266
|
-
"type": "0x1::smart_table::SmartTable<vector<u8>,
|
|
1304
|
+
"type": "0x1::smart_table::SmartTable<vector<u8>, 0x95e2f3f228c5f438d93e268856da292e10afbf246f7b711c06f1033daac1c6bd::test_faucet::FaucetToken>"
|
|
1267
1305
|
}
|
|
1268
1306
|
]
|
|
1269
1307
|
},
|