aftermath-ts-sdk 1.3.23-perps.29 → 1.3.23-perps.31
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/general/utils/caller.d.ts +1 -0
- package/dist/general/utils/caller.d.ts.map +1 -1
- package/dist/general/utils/caller.js +12 -10
- package/dist/general/utils/helpers.d.ts.map +1 -1
- package/dist/general/utils/helpers.js +3 -0
- package/dist/packages/perpetuals/perpetuals.d.ts +21 -21
- package/dist/packages/perpetuals/perpetuals.d.ts.map +1 -1
- package/dist/packages/perpetuals/perpetuals.js +21 -21
- package/dist/packages/perpetuals/perpetualsAccount.d.ts +12 -17
- package/dist/packages/perpetuals/perpetualsAccount.d.ts.map +1 -1
- package/dist/packages/perpetuals/perpetualsAccount.js +59 -41
- package/dist/packages/perpetuals/perpetualsMarket.d.ts +11 -11
- package/dist/packages/perpetuals/perpetualsMarket.d.ts.map +1 -1
- package/dist/packages/perpetuals/perpetualsMarket.js +12 -12
- package/dist/packages/perpetuals/perpetualsTypes.d.ts +184 -95
- package/dist/packages/perpetuals/perpetualsTypes.d.ts.map +1 -1
- package/dist/packages/perpetuals/perpetualsVault.d.ts +35 -22
- package/dist/packages/perpetuals/perpetualsVault.d.ts.map +1 -1
- package/dist/packages/perpetuals/perpetualsVault.js +59 -30
- package/package.json +1 -1
|
@@ -123,17 +123,9 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
123
123
|
return __awaiter(this, void 0, void 0, function* () {
|
|
124
124
|
var _a;
|
|
125
125
|
const { tx } = inputs, otherInputs = __rest(inputs, ["tx"]);
|
|
126
|
-
// TODO: add vault support
|
|
127
126
|
if (this.vaultId)
|
|
128
|
-
throw new Error("this
|
|
129
|
-
return this.fetchApiTxObject(
|
|
130
|
-
"transactions/deposit-collateral", Object.assign(Object.assign(Object.assign(Object.assign({}, otherInputs), { walletAddress: this.ownerAddress(), collateralCoinType: this.accountCap.collateralCoinType }), ("vaultId" in this.accountCap
|
|
131
|
-
? {
|
|
132
|
-
vaultId: this.accountCap.vaultId,
|
|
133
|
-
}
|
|
134
|
-
: {
|
|
135
|
-
accountId: this.accountCap.accountId,
|
|
136
|
-
})), { txKind: yield ((_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Transactions().fetchBase64TxKindFromTx({
|
|
127
|
+
throw new Error("this method is not supported for vaults, please use method `getAdminDepositTx` on class `PerpetualsVault` instead");
|
|
128
|
+
return this.fetchApiTxObject("account/transactions/deposit-collateral", Object.assign(Object.assign({}, otherInputs), { walletAddress: this.ownerAddress(), collateralCoinType: this.accountCap.collateralCoinType, accountId: this.accountCap.accountId, txKind: yield ((_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Transactions().fetchBase64TxKindFromTx({
|
|
137
129
|
tx: tx !== null && tx !== void 0 ? tx : new transactions_1.Transaction(),
|
|
138
130
|
})) }), undefined, {
|
|
139
131
|
txKind: true,
|
|
@@ -169,20 +161,17 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
169
161
|
return __awaiter(this, void 0, void 0, function* () {
|
|
170
162
|
var _a;
|
|
171
163
|
const { withdrawAmount, recipientAddress, tx: txFromInputs } = inputs;
|
|
172
|
-
// TODO: add vault support
|
|
173
164
|
if (this.vaultId)
|
|
174
|
-
throw new Error("this
|
|
175
|
-
return this.fetchApiTxObject(
|
|
176
|
-
|
|
177
|
-
recipientAddress,
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
: {
|
|
182
|
-
accountId: this.accountCap.accountId,
|
|
183
|
-
})), { txKind: yield ((_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Transactions().fetchBase64TxKindFromTx({
|
|
165
|
+
throw new Error("this method is not supported for vaults, please use method `getAdminWithdrawTx` on class `PerpetualsVault` instead");
|
|
166
|
+
return this.fetchApiTxObject("account/transactions/withdraw-collateral", {
|
|
167
|
+
withdrawAmount,
|
|
168
|
+
recipientAddress,
|
|
169
|
+
walletAddress: this.ownerAddress(),
|
|
170
|
+
accountId: this.accountCap.accountId,
|
|
171
|
+
txKind: yield ((_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Transactions().fetchBase64TxKindFromTx({
|
|
184
172
|
tx: txFromInputs !== null && txFromInputs !== void 0 ? txFromInputs : new transactions_1.Transaction(),
|
|
185
|
-
}))
|
|
173
|
+
})),
|
|
174
|
+
}, undefined, {
|
|
186
175
|
txKind: true,
|
|
187
176
|
});
|
|
188
177
|
});
|
|
@@ -208,9 +197,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
208
197
|
allocateAmount }, ("vaultId" in this.accountCap
|
|
209
198
|
? {
|
|
210
199
|
vaultId: this.accountCap.vaultId,
|
|
200
|
+
accountId: undefined,
|
|
211
201
|
}
|
|
212
202
|
: {
|
|
213
203
|
accountId: this.accountCap.accountId,
|
|
204
|
+
vaultId: undefined,
|
|
214
205
|
})), { walletAddress: this.ownerAddress(), txKind: yield ((_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Transactions().fetchBase64TxKindFromTx({ tx: tx !== null && tx !== void 0 ? tx : new transactions_1.Transaction() })) }), undefined, {
|
|
215
206
|
txKind: true,
|
|
216
207
|
});
|
|
@@ -237,9 +228,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
237
228
|
deallocateAmount }, ("vaultId" in this.accountCap
|
|
238
229
|
? {
|
|
239
230
|
vaultId: this.accountCap.vaultId,
|
|
231
|
+
accountId: undefined,
|
|
240
232
|
}
|
|
241
233
|
: {
|
|
242
234
|
accountId: this.accountCap.accountId,
|
|
235
|
+
vaultId: undefined,
|
|
243
236
|
})), { walletAddress: this.ownerAddress(), txKind: yield ((_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Transactions().fetchBase64TxKindFromTx({ tx: tx !== null && tx !== void 0 ? tx : new transactions_1.Transaction() })) }), undefined, {
|
|
244
237
|
txKind: true,
|
|
245
238
|
});
|
|
@@ -267,7 +260,6 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
267
260
|
transferAmount,
|
|
268
261
|
toAccountId,
|
|
269
262
|
walletAddress: this.ownerAddress(),
|
|
270
|
-
collateralCoinType: this.accountCap.collateralCoinType,
|
|
271
263
|
fromAccountId: this.accountCap.accountId,
|
|
272
264
|
txKind: yield ((_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Transactions().fetchBase64TxKindFromTx({ tx: tx !== null && tx !== void 0 ? tx : new transactions_1.Transaction() })),
|
|
273
265
|
}, undefined, {
|
|
@@ -318,9 +310,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
318
310
|
? Object.assign({ walletAddress: this.ownerAddress() }, slTp) : undefined, txKind: yield ((_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Transactions().fetchBase64TxKindFromTx({ tx })), walletAddress: this.ownerAddress() }), ("vaultId" in this.accountCap
|
|
319
311
|
? {
|
|
320
312
|
vaultId: this.accountCap.vaultId,
|
|
313
|
+
accountId: undefined,
|
|
321
314
|
}
|
|
322
315
|
: {
|
|
323
316
|
accountId: this.accountCap.accountId,
|
|
317
|
+
vaultId: undefined,
|
|
324
318
|
})), { hasPosition: this.positionForMarketId(otherInputs) !== undefined }), undefined, {
|
|
325
319
|
txKind: true,
|
|
326
320
|
});
|
|
@@ -348,9 +342,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
348
342
|
? Object.assign({ walletAddress: this.ownerAddress() }, slTp) : undefined, txKind: yield ((_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Transactions().fetchBase64TxKindFromTx({ tx })), walletAddress: this.ownerAddress() }), ("vaultId" in this.accountCap
|
|
349
343
|
? {
|
|
350
344
|
vaultId: this.accountCap.vaultId,
|
|
345
|
+
accountId: undefined,
|
|
351
346
|
}
|
|
352
347
|
: {
|
|
353
348
|
accountId: this.accountCap.accountId,
|
|
349
|
+
vaultId: undefined,
|
|
354
350
|
})), { hasPosition: this.positionForMarketId(otherInputs) !== undefined }), undefined, {
|
|
355
351
|
txKind: true,
|
|
356
352
|
});
|
|
@@ -375,9 +371,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
375
371
|
"transactions/cancel-orders", Object.assign(Object.assign(Object.assign({}, otherInputs), { txKind: yield ((_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Transactions().fetchBase64TxKindFromTx({ tx })), walletAddress: this.ownerAddress() }), ("vaultId" in this.accountCap
|
|
376
372
|
? {
|
|
377
373
|
vaultId: this.accountCap.vaultId,
|
|
374
|
+
accountId: undefined,
|
|
378
375
|
}
|
|
379
376
|
: {
|
|
380
377
|
accountId: this.accountCap.accountId,
|
|
378
|
+
vaultId: undefined,
|
|
381
379
|
})), undefined, {
|
|
382
380
|
txKind: true,
|
|
383
381
|
});
|
|
@@ -399,9 +397,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
399
397
|
"transactions/cancel-stop-orders", Object.assign(Object.assign(Object.assign({}, otherInputs), { txKind: yield ((_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Transactions().fetchBase64TxKindFromTx({ tx })), walletAddress: this.ownerAddress() }), ("vaultId" in this.accountCap
|
|
400
398
|
? {
|
|
401
399
|
vaultId: this.accountCap.vaultId,
|
|
400
|
+
accountId: undefined,
|
|
402
401
|
}
|
|
403
402
|
: {
|
|
404
403
|
accountId: this.accountCap.accountId,
|
|
404
|
+
vaultId: undefined,
|
|
405
405
|
})), undefined, {
|
|
406
406
|
txKind: true,
|
|
407
407
|
});
|
|
@@ -429,9 +429,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
429
429
|
isSponsoredTx, txKind: yield ((_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Transactions().fetchBase64TxKindFromTx({ tx })), walletAddress: this.ownerAddress() }, ("vaultId" in this.accountCap
|
|
430
430
|
? {
|
|
431
431
|
vaultId: this.accountCap.vaultId,
|
|
432
|
+
accountId: undefined,
|
|
432
433
|
}
|
|
433
434
|
: {
|
|
434
435
|
accountId: this.accountCap.accountId,
|
|
436
|
+
vaultId: undefined,
|
|
435
437
|
})), undefined, {
|
|
436
438
|
txKind: true,
|
|
437
439
|
});
|
|
@@ -461,9 +463,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
461
463
|
"transactions/place-sl-tp-orders", Object.assign(Object.assign(Object.assign(Object.assign({}, slTpInputs), { marketId, txKind: yield ((_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Transactions().fetchBase64TxKindFromTx({ tx })), walletAddress: this.ownerAddress() }), ("vaultId" in this.accountCap
|
|
462
464
|
? {
|
|
463
465
|
vaultId: this.accountCap.vaultId,
|
|
466
|
+
accountId: undefined,
|
|
464
467
|
}
|
|
465
468
|
: {
|
|
466
469
|
accountId: this.accountCap.accountId,
|
|
470
|
+
vaultId: undefined,
|
|
467
471
|
})), { positionSide: perpetuals_1.Perpetuals.positionSide({
|
|
468
472
|
baseAssetAmount: position.baseAssetAmount,
|
|
469
473
|
}) }), undefined, {
|
|
@@ -491,9 +495,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
491
495
|
"transactions/edit-stop-orders", Object.assign({ stopOrders, txKind: yield ((_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Transactions().fetchBase64TxKindFromTx({ tx })), walletAddress: this.ownerAddress() }, ("vaultId" in this.accountCap
|
|
492
496
|
? {
|
|
493
497
|
vaultId: this.accountCap.vaultId,
|
|
498
|
+
accountId: undefined,
|
|
494
499
|
}
|
|
495
500
|
: {
|
|
496
501
|
accountId: this.accountCap.accountId,
|
|
502
|
+
vaultId: undefined,
|
|
497
503
|
})), undefined, {
|
|
498
504
|
txKind: true,
|
|
499
505
|
});
|
|
@@ -523,9 +529,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
523
529
|
// ...("vaultId" in this.accountCap
|
|
524
530
|
// ? {
|
|
525
531
|
// vaultId: this.accountCap.vaultId,
|
|
532
|
+
// accountId: undefined,
|
|
526
533
|
// }
|
|
527
534
|
// : {
|
|
528
535
|
// accountId: this.accountCap.accountId,
|
|
536
|
+
// vaultId: undefined,
|
|
529
537
|
// }),
|
|
530
538
|
// },
|
|
531
539
|
// undefined,
|
|
@@ -558,9 +566,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
558
566
|
collateralChange, txKind: yield ((_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Transactions().fetchBase64TxKindFromTx({ tx })), walletAddress: this.ownerAddress() }, ("vaultId" in this.accountCap
|
|
559
567
|
? {
|
|
560
568
|
vaultId: this.accountCap.vaultId,
|
|
569
|
+
accountId: undefined,
|
|
561
570
|
}
|
|
562
571
|
: {
|
|
563
572
|
accountId: this.accountCap.accountId,
|
|
573
|
+
vaultId: undefined,
|
|
564
574
|
})), undefined, {
|
|
565
575
|
txKind: true,
|
|
566
576
|
});
|
|
@@ -666,9 +676,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
666
676
|
"previews/place-market-order", Object.assign(Object.assign({}, inputs), ("vaultId" in this.accountCap
|
|
667
677
|
? {
|
|
668
678
|
vaultId: this.accountCap.vaultId,
|
|
679
|
+
accountId: undefined,
|
|
669
680
|
}
|
|
670
681
|
: {
|
|
671
682
|
accountId: this.accountCap.accountId,
|
|
683
|
+
vaultId: undefined,
|
|
672
684
|
})), abortSignal);
|
|
673
685
|
});
|
|
674
686
|
}
|
|
@@ -687,9 +699,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
687
699
|
"previews/place-limit-order", Object.assign(Object.assign({}, inputs), ("vaultId" in this.accountCap
|
|
688
700
|
? {
|
|
689
701
|
vaultId: this.accountCap.vaultId,
|
|
702
|
+
accountId: undefined,
|
|
690
703
|
}
|
|
691
704
|
: {
|
|
692
705
|
accountId: this.accountCap.accountId,
|
|
706
|
+
vaultId: undefined,
|
|
693
707
|
})), abortSignal);
|
|
694
708
|
});
|
|
695
709
|
}
|
|
@@ -712,15 +726,16 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
712
726
|
// NOTE: should this case return an error instead ?
|
|
713
727
|
if (Object.keys(inputs.marketIdsToData).length <= 0)
|
|
714
728
|
return {
|
|
715
|
-
|
|
716
|
-
updatedPositions: [],
|
|
729
|
+
marketIdsToData: {},
|
|
717
730
|
};
|
|
718
731
|
return this.fetchApi(`${this.vaultId ? "vault" : "account"}/` + "previews/cancel-orders", Object.assign(Object.assign({}, inputs), ("vaultId" in this.accountCap
|
|
719
732
|
? {
|
|
720
733
|
vaultId: this.accountCap.vaultId,
|
|
734
|
+
accountId: undefined,
|
|
721
735
|
}
|
|
722
736
|
: {
|
|
723
737
|
accountId: this.accountCap.accountId,
|
|
738
|
+
vaultId: undefined,
|
|
724
739
|
})), abortSignal);
|
|
725
740
|
});
|
|
726
741
|
}
|
|
@@ -751,9 +766,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
751
766
|
// ...("vaultId" in this.accountCap
|
|
752
767
|
// ? {
|
|
753
768
|
// vaultId: this.accountCap.vaultId,
|
|
769
|
+
// accountId: undefined,
|
|
754
770
|
// }
|
|
755
771
|
// : {
|
|
756
772
|
// accountId: this.accountCap.accountId,
|
|
773
|
+
// vaultId: undefined,
|
|
757
774
|
// }),
|
|
758
775
|
// },
|
|
759
776
|
// abortSignal
|
|
@@ -777,9 +794,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
777
794
|
leverage }, ("vaultId" in this.accountCap
|
|
778
795
|
? {
|
|
779
796
|
vaultId: this.accountCap.vaultId,
|
|
797
|
+
accountId: undefined,
|
|
780
798
|
}
|
|
781
799
|
: {
|
|
782
800
|
accountId: this.accountCap.accountId,
|
|
801
|
+
vaultId: undefined,
|
|
783
802
|
})), abortSignal);
|
|
784
803
|
});
|
|
785
804
|
}
|
|
@@ -805,9 +824,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
805
824
|
collateralChange }, ("vaultId" in this.accountCap
|
|
806
825
|
? {
|
|
807
826
|
vaultId: this.accountCap.vaultId,
|
|
827
|
+
accountId: undefined,
|
|
808
828
|
}
|
|
809
829
|
: {
|
|
810
830
|
accountId: this.accountCap.accountId,
|
|
831
|
+
vaultId: undefined,
|
|
811
832
|
})), abortSignal);
|
|
812
833
|
});
|
|
813
834
|
}
|
|
@@ -891,9 +912,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
891
912
|
signature, walletAddress: this.ownerAddress(), marketIds: marketIds !== null && marketIds !== void 0 ? marketIds : [] }, ("vaultId" in this.accountCap
|
|
892
913
|
? {
|
|
893
914
|
vaultId: this.accountCap.vaultId,
|
|
915
|
+
accountId: undefined,
|
|
894
916
|
}
|
|
895
917
|
: {
|
|
896
918
|
accountId: this.accountCap.accountId,
|
|
919
|
+
vaultId: undefined,
|
|
897
920
|
})));
|
|
898
921
|
});
|
|
899
922
|
}
|
|
@@ -901,40 +924,35 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
901
924
|
* Fetch paginated collateral-change history for this account, including
|
|
902
925
|
* deposits, withdrawals, funding settlements, liquidations, etc.
|
|
903
926
|
*
|
|
904
|
-
* @param inputs.
|
|
927
|
+
* @param inputs.beforeTimestampCursor - Optional cursor for pagination.
|
|
905
928
|
* @param inputs.limit - Optional limit per page.
|
|
906
929
|
*
|
|
907
|
-
* @returns {@link
|
|
908
|
-
* an array of changes and a `
|
|
930
|
+
* @returns {@link ApiPerpetualsAccountCollateralHistoryResponse} containing
|
|
931
|
+
* an array of changes and a `nextBeforeTimestampCursor`.
|
|
909
932
|
*/
|
|
910
933
|
getCollateralHistory(inputs) {
|
|
911
934
|
return __awaiter(this, void 0, void 0, function* () {
|
|
912
|
-
return this.fetchApi("account/collateral-history", Object.assign(Object.assign({}, inputs), { accountId: this.accountCap.accountId
|
|
935
|
+
return this.fetchApi("account/collateral-history", Object.assign(Object.assign({}, inputs), { accountId: this.accountCap.accountId }));
|
|
913
936
|
});
|
|
914
937
|
}
|
|
915
938
|
/**
|
|
916
|
-
* Fetch paginated
|
|
939
|
+
* Fetch paginated order history for this account.
|
|
917
940
|
*
|
|
918
|
-
* @param inputs.
|
|
941
|
+
* @param inputs.beforeTimestampCursor - Optional cursor for pagination.
|
|
919
942
|
* @param inputs.limit - Optional limit per page.
|
|
920
943
|
*
|
|
921
|
-
* @returns {@link
|
|
922
|
-
*
|
|
944
|
+
* @returns {@link ApiPerpetualsAccountOrderHistoryResponse} containing a list of
|
|
945
|
+
* orders and a `nextBeforeTimestampCursor`.
|
|
923
946
|
*/
|
|
924
947
|
getOrderHistory(inputs) {
|
|
925
948
|
return __awaiter(this, void 0, void 0, function* () {
|
|
926
|
-
return this.fetchApi("account/
|
|
949
|
+
return this.fetchApi("account/order-history", Object.assign(Object.assign({}, inputs), { accountId: this.accountCap.accountId }));
|
|
927
950
|
});
|
|
928
951
|
}
|
|
929
952
|
// TODO: docs
|
|
930
|
-
|
|
931
|
-
getMarginHistory() {
|
|
953
|
+
getMarginHistory(inputs) {
|
|
932
954
|
return __awaiter(this, void 0, void 0, function* () {
|
|
933
|
-
return this.fetchApi("account/margin-history", {
|
|
934
|
-
// ...inputs,
|
|
935
|
-
accountId: this.accountCap.accountId,
|
|
936
|
-
collateralCoinType: this.accountCap.collateralCoinType,
|
|
937
|
-
});
|
|
955
|
+
return this.fetchApi("account/margin-history", Object.assign(Object.assign({}, inputs), { accountId: this.accountCap.accountId }));
|
|
938
956
|
});
|
|
939
957
|
}
|
|
940
958
|
// public async getOwnedWithdrawRequests() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Caller } from "../../general/utils/caller";
|
|
2
|
-
import { CoinType, PerpetualsMarketId, PerpetualsMarketParams, PerpetualsMarketState, PerpetualsOrderData, PerpetualsOrderSide, PerpetualsOrderbook, PerpetualsPosition, Timestamp, PerpetualsMarketData,
|
|
2
|
+
import { CoinType, PerpetualsMarketId, PerpetualsMarketParams, PerpetualsMarketState, PerpetualsOrderData, PerpetualsOrderSide, PerpetualsOrderbook, PerpetualsPosition, Timestamp, PerpetualsMarketData, ApiPerpetualsMarketOrderHistoryResponse, CallerConfig, Percentage, PerpetualsMarket24hrStats, SdkPerpetualsPlaceLimitOrderPreviewInputs, SdkPerpetualsPlaceMarketOrderPreviewInputs, PerpetualsAccountId, ApiPerpetualsMarketOrderHistoryBody } from "../../types";
|
|
3
3
|
/**
|
|
4
4
|
* High-level wrapper around a single perpetuals market.
|
|
5
5
|
*
|
|
@@ -10,7 +10,7 @@ import { CoinType, PerpetualsMarketId, PerpetualsMarketParams, PerpetualsMarketS
|
|
|
10
10
|
* - `marketParams`, `marketState`
|
|
11
11
|
* - Read endpoints for:
|
|
12
12
|
* - Orderbook snapshots
|
|
13
|
-
* - 24h stats and
|
|
13
|
+
* - 24h stats and order history
|
|
14
14
|
* - Market prices and derived funding metrics
|
|
15
15
|
* - Helpers for:
|
|
16
16
|
* - Order sizing (max size, lot/tick rounding)
|
|
@@ -204,24 +204,24 @@ export declare class PerpetualsMarket extends Caller {
|
|
|
204
204
|
executionPrice: number;
|
|
205
205
|
}>;
|
|
206
206
|
/**
|
|
207
|
-
* Fetch paginated
|
|
207
|
+
* Fetch paginated order history for this market.
|
|
208
208
|
*
|
|
209
|
-
* This returns *market-level*
|
|
210
|
-
* for charting, recent
|
|
209
|
+
* This returns *market-level* order history (not account-specific), useful
|
|
210
|
+
* for charting, recent orders lists, etc.
|
|
211
211
|
*
|
|
212
212
|
* @param inputs.cursor - Optional pagination cursor.
|
|
213
|
-
* @param inputs.limit - Optional number of
|
|
213
|
+
* @param inputs.limit - Optional number of orders per page.
|
|
214
214
|
*
|
|
215
|
-
* @returns {@link
|
|
216
|
-
*
|
|
215
|
+
* @returns {@link ApiPerpetualsMarketOrderHistoryResponse} including a list of
|
|
216
|
+
* orders and a `nextBeforeTimestampCursor`.
|
|
217
217
|
*
|
|
218
218
|
* @example
|
|
219
219
|
* ```ts
|
|
220
|
-
* const result = await market.
|
|
221
|
-
* console.log(result.
|
|
220
|
+
* const result = await market.getOrderHistory({ limit: 100 });
|
|
221
|
+
* console.log(result.orders.length, result.nextBeforeTimestampCursor);
|
|
222
222
|
* ```
|
|
223
223
|
*/
|
|
224
|
-
|
|
224
|
+
getOrderHistory(inputs: Omit<ApiPerpetualsMarketOrderHistoryBody, "marketId">): Promise<ApiPerpetualsMarketOrderHistoryResponse>;
|
|
225
225
|
/**
|
|
226
226
|
* Fetch the current base and collateral prices for this market.
|
|
227
227
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"perpetualsMarket.d.ts","sourceRoot":"","sources":["../../../src/packages/perpetuals/perpetualsMarket.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAGpD,OAAO,EAIN,QAAQ,EAKR,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EAGnB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAElB,SAAS,EAET,oBAAoB,
|
|
1
|
+
{"version":3,"file":"perpetualsMarket.d.ts","sourceRoot":"","sources":["../../../src/packages/perpetuals/perpetualsMarket.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAGpD,OAAO,EAIN,QAAQ,EAKR,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EAGnB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAElB,SAAS,EAET,oBAAoB,EAMpB,uCAAuC,EACvC,YAAY,EACZ,UAAU,EAEV,yBAAyB,EAEzB,yCAAyC,EAEzC,0CAA0C,EAC1C,mBAAmB,EACnB,mCAAmC,EACnC,MAAM,aAAa,CAAC;AAIrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAAa,gBAAiB,SAAQ,MAAM;IAwCnC,UAAU,EAAE,oBAAoB;IAnCxC,yEAAyE;IACzE,SAAgB,QAAQ,EAAE,kBAAkB,CAAC;IAE7C;;;OAGG;IACH,SAAgB,UAAU,EAAE,MAAM,CAAC;IAEnC;;;OAGG;IACH,SAAgB,eAAe,EAAE,MAAM,CAAC;IAExC,gEAAgE;IAChE,SAAgB,k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QAChB,IAAI,CAAC,EAAE,OAAO,CAAC;KACf,YASC;IAEF;;;;;;;;;;;OAWG;IACI,uBAAuB,GAAI,QAAQ;QACzC,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,IAAI,CAAC,EAAE,OAAO,CAAC;KACf,YAcC;IAEF;;;;;;;;OAQG;IACI,gBAAgB,GAAI,QAAQ;QAClC,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,IAAI,CAAC,EAAE,OAAO,CAAC;KACf,YASC;IAEF;;;;;;;;;OASG;IACI,sBAAsB,GAAI,QAAQ;QACxC,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,IAAI,CAAC,EAAE,OAAO,CAAC;KACf,YAcC;IAEF;;;;;;;;OAQG;IACI,aAAa,QAAO,kBAAkB,CAyB3C;CACF"}
|
|
@@ -23,7 +23,7 @@ const perpetuals_1 = require("./perpetuals");
|
|
|
23
23
|
* - `marketParams`, `marketState`
|
|
24
24
|
* - Read endpoints for:
|
|
25
25
|
* - Orderbook snapshots
|
|
26
|
-
* - 24h stats and
|
|
26
|
+
* - 24h stats and order history
|
|
27
27
|
* - Market prices and derived funding metrics
|
|
28
28
|
* - Helpers for:
|
|
29
29
|
* - Order sizing (max size, lot/tick rounding)
|
|
@@ -431,29 +431,29 @@ class PerpetualsMarket extends caller_1.Caller {
|
|
|
431
431
|
});
|
|
432
432
|
}
|
|
433
433
|
// =========================================================================
|
|
434
|
-
//
|
|
434
|
+
// Order History
|
|
435
435
|
// =========================================================================
|
|
436
436
|
/**
|
|
437
|
-
* Fetch paginated
|
|
437
|
+
* Fetch paginated order history for this market.
|
|
438
438
|
*
|
|
439
|
-
* This returns *market-level*
|
|
440
|
-
* for charting, recent
|
|
439
|
+
* This returns *market-level* order history (not account-specific), useful
|
|
440
|
+
* for charting, recent orders lists, etc.
|
|
441
441
|
*
|
|
442
442
|
* @param inputs.cursor - Optional pagination cursor.
|
|
443
|
-
* @param inputs.limit - Optional number of
|
|
443
|
+
* @param inputs.limit - Optional number of orders per page.
|
|
444
444
|
*
|
|
445
|
-
* @returns {@link
|
|
446
|
-
*
|
|
445
|
+
* @returns {@link ApiPerpetualsMarketOrderHistoryResponse} including a list of
|
|
446
|
+
* orders and a `nextBeforeTimestampCursor`.
|
|
447
447
|
*
|
|
448
448
|
* @example
|
|
449
449
|
* ```ts
|
|
450
|
-
* const result = await market.
|
|
451
|
-
* console.log(result.
|
|
450
|
+
* const result = await market.getOrderHistory({ limit: 100 });
|
|
451
|
+
* console.log(result.orders.length, result.nextBeforeTimestampCursor);
|
|
452
452
|
* ```
|
|
453
453
|
*/
|
|
454
|
-
|
|
454
|
+
getOrderHistory(inputs) {
|
|
455
455
|
return __awaiter(this, void 0, void 0, function* () {
|
|
456
|
-
return this.fetchApi("market/
|
|
456
|
+
return this.fetchApi("market/order-history", Object.assign(Object.assign({}, inputs), { marketId: this.marketId }));
|
|
457
457
|
});
|
|
458
458
|
}
|
|
459
459
|
// =========================================================================
|