aftermath-ts-sdk 1.3.23-perps.28 → 1.3.23-perps.30
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/providers/aftermath.d.ts +6 -0
- package/dist/general/providers/aftermath.d.ts.map +1 -1
- package/dist/general/providers/aftermath.js +7 -1
- package/dist/general/types/configTypes.d.ts +6 -0
- package/dist/general/types/configTypes.d.ts.map +1 -1
- 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/coin/coin.d.ts +4 -0
- package/dist/packages/coin/coin.d.ts.map +1 -1
- package/dist/packages/coin/coin.js +4 -0
- package/dist/packages/perpetuals/perpetuals.d.ts +11 -23
- package/dist/packages/perpetuals/perpetuals.d.ts.map +1 -1
- package/dist/packages/perpetuals/perpetuals.js +5 -24
- package/dist/packages/perpetuals/perpetualsAccount.d.ts.map +1 -1
- package/dist/packages/perpetuals/perpetualsAccount.js +48 -24
- package/dist/packages/perpetuals/perpetualsTypes.d.ts +97 -44
- package/dist/packages/perpetuals/perpetualsTypes.d.ts.map +1 -1
- package/dist/packages/perpetuals/perpetualsVault.d.ts +46 -22
- package/dist/packages/perpetuals/perpetualsVault.d.ts.map +1 -1
- package/dist/packages/perpetuals/perpetualsVault.js +67 -28
- package/dist/packages/referralVault/referralVault.d.ts +5 -8
- package/dist/packages/referralVault/referralVault.d.ts.map +1 -1
- package/dist/packages/referralVault/referralVault.js +5 -16
- package/dist/packages/referrals/index.d.ts +2 -0
- package/dist/packages/referrals/index.d.ts.map +1 -0
- package/dist/packages/referrals/index.js +17 -0
- package/dist/packages/referrals/referrals.d.ts +27 -0
- package/dist/packages/referrals/referrals.d.ts.map +1 -0
- package/dist/packages/referrals/referrals.js +95 -0
- package/dist/packages/referrals/referralsTypes.d.ts +166 -0
- package/dist/packages/referrals/referralsTypes.d.ts.map +1 -0
- package/dist/packages/referrals/referralsTypes.js +2 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- 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
|
});
|
|
@@ -318,9 +311,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
318
311
|
? 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
312
|
? {
|
|
320
313
|
vaultId: this.accountCap.vaultId,
|
|
314
|
+
accountId: undefined,
|
|
321
315
|
}
|
|
322
316
|
: {
|
|
323
317
|
accountId: this.accountCap.accountId,
|
|
318
|
+
vaultId: undefined,
|
|
324
319
|
})), { hasPosition: this.positionForMarketId(otherInputs) !== undefined }), undefined, {
|
|
325
320
|
txKind: true,
|
|
326
321
|
});
|
|
@@ -348,9 +343,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
348
343
|
? 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
344
|
? {
|
|
350
345
|
vaultId: this.accountCap.vaultId,
|
|
346
|
+
accountId: undefined,
|
|
351
347
|
}
|
|
352
348
|
: {
|
|
353
349
|
accountId: this.accountCap.accountId,
|
|
350
|
+
vaultId: undefined,
|
|
354
351
|
})), { hasPosition: this.positionForMarketId(otherInputs) !== undefined }), undefined, {
|
|
355
352
|
txKind: true,
|
|
356
353
|
});
|
|
@@ -375,9 +372,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
375
372
|
"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
373
|
? {
|
|
377
374
|
vaultId: this.accountCap.vaultId,
|
|
375
|
+
accountId: undefined,
|
|
378
376
|
}
|
|
379
377
|
: {
|
|
380
378
|
accountId: this.accountCap.accountId,
|
|
379
|
+
vaultId: undefined,
|
|
381
380
|
})), undefined, {
|
|
382
381
|
txKind: true,
|
|
383
382
|
});
|
|
@@ -399,9 +398,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
399
398
|
"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
399
|
? {
|
|
401
400
|
vaultId: this.accountCap.vaultId,
|
|
401
|
+
accountId: undefined,
|
|
402
402
|
}
|
|
403
403
|
: {
|
|
404
404
|
accountId: this.accountCap.accountId,
|
|
405
|
+
vaultId: undefined,
|
|
405
406
|
})), undefined, {
|
|
406
407
|
txKind: true,
|
|
407
408
|
});
|
|
@@ -429,9 +430,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
429
430
|
isSponsoredTx, txKind: yield ((_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Transactions().fetchBase64TxKindFromTx({ tx })), walletAddress: this.ownerAddress() }, ("vaultId" in this.accountCap
|
|
430
431
|
? {
|
|
431
432
|
vaultId: this.accountCap.vaultId,
|
|
433
|
+
accountId: undefined,
|
|
432
434
|
}
|
|
433
435
|
: {
|
|
434
436
|
accountId: this.accountCap.accountId,
|
|
437
|
+
vaultId: undefined,
|
|
435
438
|
})), undefined, {
|
|
436
439
|
txKind: true,
|
|
437
440
|
});
|
|
@@ -461,9 +464,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
461
464
|
"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
465
|
? {
|
|
463
466
|
vaultId: this.accountCap.vaultId,
|
|
467
|
+
accountId: undefined,
|
|
464
468
|
}
|
|
465
469
|
: {
|
|
466
470
|
accountId: this.accountCap.accountId,
|
|
471
|
+
vaultId: undefined,
|
|
467
472
|
})), { positionSide: perpetuals_1.Perpetuals.positionSide({
|
|
468
473
|
baseAssetAmount: position.baseAssetAmount,
|
|
469
474
|
}) }), undefined, {
|
|
@@ -491,9 +496,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
491
496
|
"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
497
|
? {
|
|
493
498
|
vaultId: this.accountCap.vaultId,
|
|
499
|
+
accountId: undefined,
|
|
494
500
|
}
|
|
495
501
|
: {
|
|
496
502
|
accountId: this.accountCap.accountId,
|
|
503
|
+
vaultId: undefined,
|
|
497
504
|
})), undefined, {
|
|
498
505
|
txKind: true,
|
|
499
506
|
});
|
|
@@ -523,9 +530,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
523
530
|
// ...("vaultId" in this.accountCap
|
|
524
531
|
// ? {
|
|
525
532
|
// vaultId: this.accountCap.vaultId,
|
|
533
|
+
// accountId: undefined,
|
|
526
534
|
// }
|
|
527
535
|
// : {
|
|
528
536
|
// accountId: this.accountCap.accountId,
|
|
537
|
+
// vaultId: undefined,
|
|
529
538
|
// }),
|
|
530
539
|
// },
|
|
531
540
|
// undefined,
|
|
@@ -558,9 +567,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
558
567
|
collateralChange, txKind: yield ((_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Transactions().fetchBase64TxKindFromTx({ tx })), walletAddress: this.ownerAddress() }, ("vaultId" in this.accountCap
|
|
559
568
|
? {
|
|
560
569
|
vaultId: this.accountCap.vaultId,
|
|
570
|
+
accountId: undefined,
|
|
561
571
|
}
|
|
562
572
|
: {
|
|
563
573
|
accountId: this.accountCap.accountId,
|
|
574
|
+
vaultId: undefined,
|
|
564
575
|
})), undefined, {
|
|
565
576
|
txKind: true,
|
|
566
577
|
});
|
|
@@ -666,9 +677,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
666
677
|
"previews/place-market-order", Object.assign(Object.assign({}, inputs), ("vaultId" in this.accountCap
|
|
667
678
|
? {
|
|
668
679
|
vaultId: this.accountCap.vaultId,
|
|
680
|
+
accountId: undefined,
|
|
669
681
|
}
|
|
670
682
|
: {
|
|
671
683
|
accountId: this.accountCap.accountId,
|
|
684
|
+
vaultId: undefined,
|
|
672
685
|
})), abortSignal);
|
|
673
686
|
});
|
|
674
687
|
}
|
|
@@ -687,9 +700,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
687
700
|
"previews/place-limit-order", Object.assign(Object.assign({}, inputs), ("vaultId" in this.accountCap
|
|
688
701
|
? {
|
|
689
702
|
vaultId: this.accountCap.vaultId,
|
|
703
|
+
accountId: undefined,
|
|
690
704
|
}
|
|
691
705
|
: {
|
|
692
706
|
accountId: this.accountCap.accountId,
|
|
707
|
+
vaultId: undefined,
|
|
693
708
|
})), abortSignal);
|
|
694
709
|
});
|
|
695
710
|
}
|
|
@@ -718,9 +733,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
718
733
|
return this.fetchApi(`${this.vaultId ? "vault" : "account"}/` + "previews/cancel-orders", Object.assign(Object.assign({}, inputs), ("vaultId" in this.accountCap
|
|
719
734
|
? {
|
|
720
735
|
vaultId: this.accountCap.vaultId,
|
|
736
|
+
accountId: undefined,
|
|
721
737
|
}
|
|
722
738
|
: {
|
|
723
739
|
accountId: this.accountCap.accountId,
|
|
740
|
+
vaultId: undefined,
|
|
724
741
|
})), abortSignal);
|
|
725
742
|
});
|
|
726
743
|
}
|
|
@@ -751,9 +768,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
751
768
|
// ...("vaultId" in this.accountCap
|
|
752
769
|
// ? {
|
|
753
770
|
// vaultId: this.accountCap.vaultId,
|
|
771
|
+
// accountId: undefined,
|
|
754
772
|
// }
|
|
755
773
|
// : {
|
|
756
774
|
// accountId: this.accountCap.accountId,
|
|
775
|
+
// vaultId: undefined,
|
|
757
776
|
// }),
|
|
758
777
|
// },
|
|
759
778
|
// abortSignal
|
|
@@ -777,9 +796,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
777
796
|
leverage }, ("vaultId" in this.accountCap
|
|
778
797
|
? {
|
|
779
798
|
vaultId: this.accountCap.vaultId,
|
|
799
|
+
accountId: undefined,
|
|
780
800
|
}
|
|
781
801
|
: {
|
|
782
802
|
accountId: this.accountCap.accountId,
|
|
803
|
+
vaultId: undefined,
|
|
783
804
|
})), abortSignal);
|
|
784
805
|
});
|
|
785
806
|
}
|
|
@@ -805,9 +826,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
805
826
|
collateralChange }, ("vaultId" in this.accountCap
|
|
806
827
|
? {
|
|
807
828
|
vaultId: this.accountCap.vaultId,
|
|
829
|
+
accountId: undefined,
|
|
808
830
|
}
|
|
809
831
|
: {
|
|
810
832
|
accountId: this.accountCap.accountId,
|
|
833
|
+
vaultId: undefined,
|
|
811
834
|
})), abortSignal);
|
|
812
835
|
});
|
|
813
836
|
}
|
|
@@ -891,9 +914,11 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
891
914
|
signature, walletAddress: this.ownerAddress(), marketIds: marketIds !== null && marketIds !== void 0 ? marketIds : [] }, ("vaultId" in this.accountCap
|
|
892
915
|
? {
|
|
893
916
|
vaultId: this.accountCap.vaultId,
|
|
917
|
+
accountId: undefined,
|
|
894
918
|
}
|
|
895
919
|
: {
|
|
896
920
|
accountId: this.accountCap.accountId,
|
|
921
|
+
vaultId: undefined,
|
|
897
922
|
})));
|
|
898
923
|
});
|
|
899
924
|
}
|
|
@@ -909,7 +934,7 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
909
934
|
*/
|
|
910
935
|
getCollateralHistory(inputs) {
|
|
911
936
|
return __awaiter(this, void 0, void 0, function* () {
|
|
912
|
-
return this.fetchApi("account/collateral-history", Object.assign(Object.assign({}, inputs), { accountId: this.accountCap.accountId
|
|
937
|
+
return this.fetchApi("account/collateral-history", Object.assign(Object.assign({}, inputs), { accountId: this.accountCap.accountId }));
|
|
913
938
|
});
|
|
914
939
|
}
|
|
915
940
|
/**
|
|
@@ -933,7 +958,6 @@ class PerpetualsAccount extends caller_1.Caller {
|
|
|
933
958
|
return this.fetchApi("account/margin-history", {
|
|
934
959
|
// ...inputs,
|
|
935
960
|
accountId: this.accountCap.accountId,
|
|
936
|
-
collateralCoinType: this.accountCap.collateralCoinType,
|
|
937
961
|
});
|
|
938
962
|
});
|
|
939
963
|
}
|
|
@@ -456,6 +456,14 @@ export interface PerpetualsAccountObject {
|
|
|
456
456
|
/** Per-market positions for this account. */
|
|
457
457
|
positions: PerpetualsPosition[];
|
|
458
458
|
}
|
|
459
|
+
export interface PerpetualsVaultMetatada {
|
|
460
|
+
name: string;
|
|
461
|
+
description: string;
|
|
462
|
+
curatorName: string | undefined;
|
|
463
|
+
curatorUrl: string | undefined;
|
|
464
|
+
curatorLogoUrl: string | undefined;
|
|
465
|
+
extraFields: Record<string, string>;
|
|
466
|
+
}
|
|
459
467
|
/**
|
|
460
468
|
* On-chain representation of a vault that manages user collateral and
|
|
461
469
|
* interacts with clearing houses on their behalf.
|
|
@@ -463,7 +471,7 @@ export interface PerpetualsAccountObject {
|
|
|
463
471
|
export interface PerpetualsVaultObject {
|
|
464
472
|
objectId: ObjectId;
|
|
465
473
|
version: bigint;
|
|
466
|
-
|
|
474
|
+
metadata: PerpetualsVaultMetatada;
|
|
467
475
|
lpSupply: Balance;
|
|
468
476
|
idleCollateral: Balance;
|
|
469
477
|
idleCollateralUsd: number;
|
|
@@ -474,7 +482,7 @@ export interface PerpetualsVaultObject {
|
|
|
474
482
|
withdrawQueue: PerpetualsVaultWithdrawRequest[];
|
|
475
483
|
parameters: {
|
|
476
484
|
lockPeriodMs: bigint;
|
|
477
|
-
|
|
485
|
+
performanceFeePercentage: number;
|
|
478
486
|
forceWithdrawDelayMs: bigint;
|
|
479
487
|
collateralPriceFeedStorageId: ObjectId;
|
|
480
488
|
collateralPriceFeedStorageSourceId: ObjectId;
|
|
@@ -498,6 +506,7 @@ export interface PerpetualsVaultObject {
|
|
|
498
506
|
lpCoinType: CoinType;
|
|
499
507
|
/** Decimals for the LP token minted by this vault. */
|
|
500
508
|
lpCoinDecimals: CoinDecimal;
|
|
509
|
+
monthlyAprPercentage: Percentage;
|
|
501
510
|
}
|
|
502
511
|
/**
|
|
503
512
|
* Represents a single pending vault withdrawal request.
|
|
@@ -505,9 +514,11 @@ export interface PerpetualsVaultObject {
|
|
|
505
514
|
export interface PerpetualsVaultWithdrawRequest {
|
|
506
515
|
userAddress: SuiAddress;
|
|
507
516
|
vaultId: SuiAddress;
|
|
508
|
-
|
|
517
|
+
lpAmountIn: Balance;
|
|
518
|
+
lpAmountInUsd: number;
|
|
509
519
|
requestTimestamp: Timestamp;
|
|
510
|
-
|
|
520
|
+
minCollateralAmountOut: Balance;
|
|
521
|
+
minCollateralAmountOutUsd: number;
|
|
511
522
|
}
|
|
512
523
|
/**
|
|
513
524
|
* Event emitted when a clearing house (market) is upgraded to a new version.
|
|
@@ -587,7 +598,7 @@ export interface PerpetualsAccountMarginData {
|
|
|
587
598
|
/** Collateral value in USD at that time. */
|
|
588
599
|
collateralUsd: number;
|
|
589
600
|
/** Unrealized funding PnL in USD at that time. */
|
|
590
|
-
|
|
601
|
+
unrealizedFundingsUsd: number;
|
|
591
602
|
/** Unrealized position PnL in USD at that time. */
|
|
592
603
|
unrealizedPnlUsd: number;
|
|
593
604
|
}
|
|
@@ -990,7 +1001,6 @@ export interface ApiPerpetualsAccountCapsBody {
|
|
|
990
1001
|
}
|
|
991
1002
|
export type ApiPerpetualsAccountMarginHistoryBody = ApiDataWithCursorBody<Timestamp> & {
|
|
992
1003
|
accountId: PerpetualsAccountId;
|
|
993
|
-
collateralCoinType: CoinType;
|
|
994
1004
|
};
|
|
995
1005
|
/**
|
|
996
1006
|
* Request body for fetching account-level order history with a cursor.
|
|
@@ -1003,7 +1013,6 @@ export type ApiPerpetualsAccountOrderHistoryBody = ApiDataWithCursorBody<Timesta
|
|
|
1003
1013
|
*/
|
|
1004
1014
|
export type ApiPerpetualsAccountCollateralHistoryBody = ApiDataWithCursorBody<Timestamp> & {
|
|
1005
1015
|
accountId: PerpetualsAccountId;
|
|
1006
|
-
collateralCoinType: CoinType;
|
|
1007
1016
|
};
|
|
1008
1017
|
/**
|
|
1009
1018
|
* Request body for previewing a market order placement (before sending a tx).
|
|
@@ -1197,6 +1206,16 @@ export type ApiPerpetualsStopOrderDatasBody = {
|
|
|
1197
1206
|
*/
|
|
1198
1207
|
export interface ApiPerpetualsCreateVaultCapBody {
|
|
1199
1208
|
walletAddress: SuiAddress;
|
|
1209
|
+
lpCoinMetadata: {
|
|
1210
|
+
/** Name for the token */
|
|
1211
|
+
name: string;
|
|
1212
|
+
/** Symbol for the token */
|
|
1213
|
+
symbol: string;
|
|
1214
|
+
/** Description of the token */
|
|
1215
|
+
description: string;
|
|
1216
|
+
/** URL for the token logo */
|
|
1217
|
+
iconUrl?: string;
|
|
1218
|
+
};
|
|
1200
1219
|
}
|
|
1201
1220
|
/**
|
|
1202
1221
|
* Request body for creating a new vault with initial deposit.
|
|
@@ -1206,12 +1225,19 @@ export interface ApiPerpetualsCreateVaultCapBody {
|
|
|
1206
1225
|
* - As an existing `depositCoinArg` (coin object).
|
|
1207
1226
|
*/
|
|
1208
1227
|
export type ApiPerpetualsCreateVaultBody = {
|
|
1209
|
-
name: string;
|
|
1210
1228
|
walletAddress: SuiAddress;
|
|
1229
|
+
metadata: {
|
|
1230
|
+
name: string;
|
|
1231
|
+
description: string;
|
|
1232
|
+
curatorName?: string;
|
|
1233
|
+
curatorUrl?: string;
|
|
1234
|
+
curatorLogoUrl?: string;
|
|
1235
|
+
extraFields?: Record<string, string>;
|
|
1236
|
+
};
|
|
1211
1237
|
lpCoinType: CoinType;
|
|
1212
1238
|
collateralCoinType: CoinType;
|
|
1213
1239
|
lockPeriodMs: bigint;
|
|
1214
|
-
|
|
1240
|
+
performanceFeePercentage: Percentage;
|
|
1215
1241
|
forceWithdrawDelayMs: bigint;
|
|
1216
1242
|
txKind?: SerializedTransaction;
|
|
1217
1243
|
isSponsoredTx?: boolean;
|
|
@@ -1230,7 +1256,7 @@ export interface ApiPerpetualsCreateAccountBody {
|
|
|
1230
1256
|
txKind?: SerializedTransaction;
|
|
1231
1257
|
}
|
|
1232
1258
|
/**
|
|
1233
|
-
* Request body for depositing collateral into a perpetuals account
|
|
1259
|
+
* Request body for depositing collateral into a perpetuals account.
|
|
1234
1260
|
*
|
|
1235
1261
|
* The deposit can be provided by:
|
|
1236
1262
|
* - `depositAmount` (numeric amount), or
|
|
@@ -1238,6 +1264,7 @@ export interface ApiPerpetualsCreateAccountBody {
|
|
|
1238
1264
|
*/
|
|
1239
1265
|
export type ApiPerpetualsDepositCollateralBody = {
|
|
1240
1266
|
walletAddress: SuiAddress;
|
|
1267
|
+
accountId: PerpetualsAccountId;
|
|
1241
1268
|
collateralCoinType: CoinType;
|
|
1242
1269
|
txKind?: SerializedTransaction;
|
|
1243
1270
|
isSponsoredTx?: boolean;
|
|
@@ -1245,26 +1272,16 @@ export type ApiPerpetualsDepositCollateralBody = {
|
|
|
1245
1272
|
depositAmount: Balance;
|
|
1246
1273
|
} | {
|
|
1247
1274
|
depositCoinArg: TransactionObjectArgument;
|
|
1248
|
-
}) & ({
|
|
1249
|
-
accountId: PerpetualsAccountId;
|
|
1250
|
-
} | {
|
|
1251
|
-
vaultId: ObjectId;
|
|
1252
1275
|
});
|
|
1253
1276
|
/**
|
|
1254
|
-
* Request body for withdrawing collateral from an account
|
|
1277
|
+
* Request body for withdrawing collateral from an account.
|
|
1255
1278
|
*/
|
|
1256
1279
|
export type ApiPerpetualsWithdrawCollateralBody = {
|
|
1257
|
-
|
|
1258
|
-
collateralCoinType: CoinType;
|
|
1280
|
+
accountId: PerpetualsAccountId;
|
|
1259
1281
|
withdrawAmount: Balance;
|
|
1260
|
-
/** Optional destination wallet address; defaults to owner if omitted. */
|
|
1261
1282
|
recipientAddress?: SuiAddress;
|
|
1262
1283
|
txKind?: SerializedTransaction;
|
|
1263
|
-
}
|
|
1264
|
-
accountId: PerpetualsAccountId;
|
|
1265
|
-
} | {
|
|
1266
|
-
vaultId: ObjectId;
|
|
1267
|
-
});
|
|
1284
|
+
};
|
|
1268
1285
|
/**
|
|
1269
1286
|
* Response body for withdraw-collateral transactions.
|
|
1270
1287
|
*
|
|
@@ -1272,7 +1289,7 @@ export type ApiPerpetualsWithdrawCollateralBody = {
|
|
|
1272
1289
|
*/
|
|
1273
1290
|
export interface ApiPerpetualsWithdrawCollateralResponse {
|
|
1274
1291
|
txKind: SerializedTransaction;
|
|
1275
|
-
coinOutArg: TransactionObjectArgument;
|
|
1292
|
+
coinOutArg: TransactionObjectArgument | undefined;
|
|
1276
1293
|
}
|
|
1277
1294
|
/**
|
|
1278
1295
|
* Request body for transferring collateral between two perpetuals accounts.
|
|
@@ -1531,24 +1548,24 @@ export interface ApiPerpetualsVaultProcessForceWithdrawRequestTxBody {
|
|
|
1531
1548
|
/**
|
|
1532
1549
|
* API body to process regular withdraw requests for a vault.
|
|
1533
1550
|
*/
|
|
1534
|
-
export interface
|
|
1551
|
+
export interface ApiPerpetualsVaultOwnerProcessWithdrawRequestsTxBody {
|
|
1535
1552
|
vaultId: ObjectId;
|
|
1536
1553
|
userAddresses: SuiAddress[];
|
|
1537
1554
|
txKind?: SerializedTransaction;
|
|
1538
1555
|
}
|
|
1539
1556
|
/**
|
|
1540
|
-
* API body to update slippage
|
|
1541
|
-
*
|
|
1557
|
+
* API body to update slippage parameter for pending vault withdraw
|
|
1558
|
+
* request for a specific vault.
|
|
1542
1559
|
*/
|
|
1543
|
-
export interface
|
|
1544
|
-
|
|
1545
|
-
|
|
1560
|
+
export interface ApiPerpetualsVaultUpdateWithdrawRequestSlippageTxBody {
|
|
1561
|
+
vaultId: ObjectId;
|
|
1562
|
+
minCollateralAmountOut: Balance;
|
|
1546
1563
|
txKind?: SerializedTransaction;
|
|
1547
1564
|
}
|
|
1548
1565
|
/**
|
|
1549
1566
|
* API body to update the force-withdrawal delay in a vault.
|
|
1550
1567
|
*/
|
|
1551
|
-
export interface
|
|
1568
|
+
export interface ApiPerpetualsVaultOwnerUpdateForceWithdrawDelayTxBody {
|
|
1552
1569
|
vaultId: ObjectId;
|
|
1553
1570
|
forceWithdrawDelayMs: bigint;
|
|
1554
1571
|
txKind?: SerializedTransaction;
|
|
@@ -1556,7 +1573,7 @@ export interface ApiPerpetualsVaultUpdateForceWithdrawDelayTxBody {
|
|
|
1556
1573
|
/**
|
|
1557
1574
|
* API body to update the lock period on a vault.
|
|
1558
1575
|
*/
|
|
1559
|
-
export interface
|
|
1576
|
+
export interface ApiPerpetualsVaultOwnerUpdateLockPeriodTxBody {
|
|
1560
1577
|
vaultId: ObjectId;
|
|
1561
1578
|
lockPeriodMs: bigint;
|
|
1562
1579
|
txKind?: SerializedTransaction;
|
|
@@ -1564,15 +1581,15 @@ export interface ApiPerpetualsVaultUpdateLockPeriodTxBody {
|
|
|
1564
1581
|
/**
|
|
1565
1582
|
* API body to update the owner's fee percentage on a vault.
|
|
1566
1583
|
*/
|
|
1567
|
-
export interface
|
|
1584
|
+
export interface ApiPerpetualsVaultOwnerUpdatePerformanceFeeTxBody {
|
|
1568
1585
|
vaultId: ObjectId;
|
|
1569
|
-
|
|
1586
|
+
performanceFeePercentage: number;
|
|
1570
1587
|
txKind?: SerializedTransaction;
|
|
1571
1588
|
}
|
|
1572
1589
|
/**
|
|
1573
1590
|
* API body for the vault owner withdrawing collected fees.
|
|
1574
1591
|
*/
|
|
1575
|
-
export interface
|
|
1592
|
+
export interface ApiPerpetualsVaultOwnerWithdrawPerformanceFeesTxBody {
|
|
1576
1593
|
vaultId: ObjectId;
|
|
1577
1594
|
withdrawAmount: Balance;
|
|
1578
1595
|
recipientAddress?: SuiAddress;
|
|
@@ -1581,7 +1598,7 @@ export interface ApiPerpetualsVaultWithdrawOwnerFeesTxBody {
|
|
|
1581
1598
|
/**
|
|
1582
1599
|
* Response for owner-fee withdrawal transactions.
|
|
1583
1600
|
*/
|
|
1584
|
-
export interface
|
|
1601
|
+
export interface ApiPerpetualsVaultOwnerWithdrawPerformanceFeesTxResponse {
|
|
1585
1602
|
txKind: SerializedTransaction;
|
|
1586
1603
|
coinOutArg: TransactionObjectArgument | undefined;
|
|
1587
1604
|
}
|
|
@@ -1605,9 +1622,28 @@ export interface ApiPerpetualsVaultCreateWithdrawRequestTxBody {
|
|
|
1605
1622
|
vaultId: ObjectId;
|
|
1606
1623
|
walletAddress: SuiAddress;
|
|
1607
1624
|
lpWithdrawAmount: Balance;
|
|
1608
|
-
|
|
1625
|
+
minCollateralAmountOut: Balance;
|
|
1609
1626
|
txKind?: SerializedTransaction;
|
|
1610
1627
|
}
|
|
1628
|
+
/**
|
|
1629
|
+
* API body for withdrawing collateral from a vault as owner.
|
|
1630
|
+
*/
|
|
1631
|
+
export interface ApiPerpetualsVaultOwnerWithdrawCollateralTxBody {
|
|
1632
|
+
vaultId: ObjectId;
|
|
1633
|
+
lpWithdrawAmount: Balance;
|
|
1634
|
+
minCollateralAmountOut: Balance;
|
|
1635
|
+
recipientAddress?: SuiAddress;
|
|
1636
|
+
txKind?: SerializedTransaction;
|
|
1637
|
+
}
|
|
1638
|
+
/**
|
|
1639
|
+
* Response body for vault owner withdraw-collateral transactions.
|
|
1640
|
+
*
|
|
1641
|
+
* The SDK typically uses `txKind` to reconstruct a transaction locally.
|
|
1642
|
+
*/
|
|
1643
|
+
export interface ApiPerpetualsVaultOwnerWithdrawCollateralTxResponse {
|
|
1644
|
+
txKind: SerializedTransaction;
|
|
1645
|
+
coinOutArg: TransactionObjectArgument | undefined;
|
|
1646
|
+
}
|
|
1611
1647
|
/**
|
|
1612
1648
|
* API body for canceling withdrawal requests across vaults for a wallet.
|
|
1613
1649
|
*/
|
|
@@ -1638,6 +1674,7 @@ export type ApiPerpetualsVaultDepositTxBody = {
|
|
|
1638
1674
|
*/
|
|
1639
1675
|
export interface ApiPerpetualsVaultPreviewCreateWithdrawRequestBody {
|
|
1640
1676
|
vaultId: ObjectId;
|
|
1677
|
+
walletAddress: SuiAddress;
|
|
1641
1678
|
lpWithdrawAmount: Balance;
|
|
1642
1679
|
}
|
|
1643
1680
|
/**
|
|
@@ -1649,6 +1686,22 @@ export type ApiPerpetualsVaultPreviewCreateWithdrawRequestResponse = {
|
|
|
1649
1686
|
collateralAmountOut: Balance;
|
|
1650
1687
|
collateralPrice: number;
|
|
1651
1688
|
};
|
|
1689
|
+
/**
|
|
1690
|
+
* Request body for previewing a vault owner collateral withdrawal.
|
|
1691
|
+
*/
|
|
1692
|
+
export interface ApiPerpetualsVaultPreviewOwnerWithdrawCollateralBody {
|
|
1693
|
+
vaultId: ObjectId;
|
|
1694
|
+
lpWithdrawAmount: Balance;
|
|
1695
|
+
}
|
|
1696
|
+
/**
|
|
1697
|
+
* Response body for vault owner collateral withdrawal preview.
|
|
1698
|
+
*/
|
|
1699
|
+
export type ApiPerpetualsVaultPreviewOwnerWithdrawCollateralResponse = {
|
|
1700
|
+
error: string;
|
|
1701
|
+
} | {
|
|
1702
|
+
collateralAmountOut: Balance;
|
|
1703
|
+
collateralPrice: number;
|
|
1704
|
+
};
|
|
1652
1705
|
/**
|
|
1653
1706
|
* Request body for previewing a vault deposit.
|
|
1654
1707
|
*/
|
|
@@ -1686,32 +1739,32 @@ export type ApiPerpetualsVaultPreviewProcessForceWithdrawRequestResponse = {
|
|
|
1686
1739
|
/**
|
|
1687
1740
|
* Request body for previewing normal withdraw requests processing for a vault.
|
|
1688
1741
|
*/
|
|
1689
|
-
export interface
|
|
1742
|
+
export interface ApiPerpetualsVaultPreviewOwnerProcessWithdrawRequestsBody {
|
|
1690
1743
|
vaultId: ObjectId;
|
|
1691
1744
|
userAddresses: SuiAddress[];
|
|
1692
1745
|
}
|
|
1693
1746
|
/**
|
|
1694
1747
|
* Response body for previewing normal withdraw requests processing.
|
|
1695
1748
|
*/
|
|
1696
|
-
export type
|
|
1749
|
+
export type ApiPerpetualsVaultPreviewOwnerProcessWithdrawRequestsResponse = {
|
|
1697
1750
|
error: string;
|
|
1698
1751
|
} | {
|
|
1699
1752
|
userPreviews: {
|
|
1700
1753
|
userAddress: SuiAddress;
|
|
1701
|
-
|
|
1754
|
+
collateralAmountOut: Balance;
|
|
1702
1755
|
}[];
|
|
1703
1756
|
collateralPrice: number;
|
|
1704
1757
|
};
|
|
1705
1758
|
/**
|
|
1706
|
-
* Request body for previewing maximum
|
|
1759
|
+
* Request body for previewing maximum performance fees withdrawable from a vault.
|
|
1707
1760
|
*/
|
|
1708
|
-
export interface
|
|
1761
|
+
export interface ApiPerpetualsVaultPreviewOwnerWithdrawPerformanceFeesBody {
|
|
1709
1762
|
vaultId: ObjectId;
|
|
1710
1763
|
}
|
|
1711
1764
|
/**
|
|
1712
|
-
* Response body for previewing vault
|
|
1765
|
+
* Response body for previewing vault performance fee withdrawal.
|
|
1713
1766
|
*/
|
|
1714
|
-
export type
|
|
1767
|
+
export type ApiPerpetualsVaultPreviewOwnerWithdrawPerformanceFeesResponse = {
|
|
1715
1768
|
error: string;
|
|
1716
1769
|
} | {
|
|
1717
1770
|
maxFeesToWithdraw: Balance;
|