aftermath-ts-sdk 2.1.0-perps.5 → 2.1.0-perps.6
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.d.ts +36 -19
- package/dist/index.js +33 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3466,31 +3466,38 @@ type SdkPerpetualsCreateTwapOrdersInputs = Omit<ApiPerpetualsCreateTwapOrdersBod
|
|
|
3466
3466
|
tx?: Transaction;
|
|
3467
3467
|
};
|
|
3468
3468
|
/**
|
|
3469
|
-
* Request body for creating TWAP orders via the API
|
|
3469
|
+
* Request body for creating TWAP orders via the API, for an
|
|
3470
|
+
* account or vault.
|
|
3470
3471
|
*/
|
|
3471
|
-
|
|
3472
|
-
accountId: PerpetualsAccountId;
|
|
3473
|
-
accountCapId?: ObjectId;
|
|
3472
|
+
type ApiPerpetualsCreateTwapOrdersBody = {
|
|
3474
3473
|
walletAddress: SuiAddress;
|
|
3475
3474
|
twapOrders: PerpetualsTwapOrderDetails[];
|
|
3476
3475
|
gasCoinArg?: TransactionObjectArgument;
|
|
3477
3476
|
txKind?: SerializedTransaction;
|
|
3478
3477
|
isSponsoredTx?: boolean;
|
|
3479
3478
|
sponsor?: PerpetualsSponsorConfig;
|
|
3480
|
-
}
|
|
3479
|
+
} & ({
|
|
3480
|
+
accountId: PerpetualsAccountId;
|
|
3481
|
+
accountCapId?: ObjectId;
|
|
3482
|
+
} | {
|
|
3483
|
+
vaultId: ObjectId;
|
|
3484
|
+
});
|
|
3481
3485
|
/**
|
|
3482
3486
|
* Request body for editing existing TWAP orders via the API.
|
|
3483
3487
|
*
|
|
3484
3488
|
* `newTwapOrders` maps each TWAP order object id to the edit to apply.
|
|
3485
3489
|
*/
|
|
3486
|
-
|
|
3487
|
-
accountId: PerpetualsAccountId;
|
|
3488
|
-
accountCapId?: ObjectId;
|
|
3490
|
+
type ApiPerpetualsEditTwapOrdersBody = {
|
|
3489
3491
|
walletAddress: SuiAddress;
|
|
3490
3492
|
newTwapOrders: Record<ObjectId, PerpetualsTwapOrderEdit>;
|
|
3491
3493
|
txKind?: SerializedTransaction;
|
|
3492
3494
|
sponsor?: PerpetualsSponsorConfig;
|
|
3493
|
-
}
|
|
3495
|
+
} & ({
|
|
3496
|
+
accountId: PerpetualsAccountId;
|
|
3497
|
+
accountCapId?: ObjectId;
|
|
3498
|
+
} | {
|
|
3499
|
+
vaultId: ObjectId;
|
|
3500
|
+
});
|
|
3494
3501
|
/**
|
|
3495
3502
|
* SDK-level inputs for editing existing TWAP orders — the request body without
|
|
3496
3503
|
* the auto-filled fields, plus an optional transaction to extend.
|
|
@@ -3499,16 +3506,20 @@ type SdkPerpetualsEditTwapOrdersInputs = Omit<ApiPerpetualsEditTwapOrdersBody, P
|
|
|
3499
3506
|
tx?: Transaction;
|
|
3500
3507
|
};
|
|
3501
3508
|
/**
|
|
3502
|
-
* Request body for canceling TWAP orders identified by object IDs
|
|
3509
|
+
* Request body for canceling TWAP orders identified by object IDs, for an
|
|
3510
|
+
* account or vault.
|
|
3503
3511
|
*/
|
|
3504
|
-
|
|
3505
|
-
accountId: PerpetualsAccountId;
|
|
3506
|
-
accountCapId?: ObjectId;
|
|
3512
|
+
type ApiPerpetualsCancelTwapOrdersBody = {
|
|
3507
3513
|
walletAddress: SuiAddress;
|
|
3508
3514
|
twapOrderIds: ObjectId[];
|
|
3509
3515
|
txKind?: SerializedTransaction;
|
|
3510
3516
|
sponsor?: PerpetualsSponsorConfig;
|
|
3511
|
-
}
|
|
3517
|
+
} & ({
|
|
3518
|
+
accountId: PerpetualsAccountId;
|
|
3519
|
+
accountCapId?: ObjectId;
|
|
3520
|
+
} | {
|
|
3521
|
+
vaultId: ObjectId;
|
|
3522
|
+
});
|
|
3512
3523
|
/**
|
|
3513
3524
|
* SDK-level inputs for canceling TWAP orders — the request body without the
|
|
3514
3525
|
* auto-filled fields, plus an optional transaction to extend.
|
|
@@ -3520,13 +3531,16 @@ type SdkPerpetualsCancelTwapOrdersInputs = Omit<ApiPerpetualsCancelTwapOrdersBod
|
|
|
3520
3531
|
* Request body for fetching the TWAP orders of an account, validated using a
|
|
3521
3532
|
* wallet signature.
|
|
3522
3533
|
*/
|
|
3523
|
-
|
|
3524
|
-
accountId: PerpetualsAccountId;
|
|
3534
|
+
type ApiPerpetualsTwapOrderDatasBody = {
|
|
3525
3535
|
walletAddress: SuiAddress;
|
|
3526
3536
|
bytes: string;
|
|
3527
3537
|
signature: string;
|
|
3528
3538
|
marketIds?: PerpetualsMarketId[];
|
|
3529
|
-
}
|
|
3539
|
+
} & ({
|
|
3540
|
+
accountId: PerpetualsAccountId;
|
|
3541
|
+
} | {
|
|
3542
|
+
vaultId: ObjectId;
|
|
3543
|
+
});
|
|
3530
3544
|
/**
|
|
3531
3545
|
* Response payload for TWAP-order queries.
|
|
3532
3546
|
*/
|
|
@@ -5176,7 +5190,8 @@ interface PerpetualsWsUpdatesMarketSubscriptionType {
|
|
|
5176
5190
|
}
|
|
5177
5191
|
/**
|
|
5178
5192
|
* Websocket subscription payload for subscribing to user/account updates,
|
|
5179
|
-
* optionally including
|
|
5193
|
+
* optionally including special-order (stop and TWAP order) data (via
|
|
5194
|
+
* signature).
|
|
5180
5195
|
*/
|
|
5181
5196
|
interface PerpetualsWsUpdatesUserSubscriptionType {
|
|
5182
5197
|
user: {
|
|
@@ -5318,11 +5333,13 @@ interface PerpetualsWsUpdatesTopOfOrderbookPayload {
|
|
|
5318
5333
|
maxBidPrice: number | undefined;
|
|
5319
5334
|
}
|
|
5320
5335
|
/**
|
|
5321
|
-
* Websocket payload for user account and
|
|
5336
|
+
* Websocket payload for user account and special-order (stop and TWAP order)
|
|
5337
|
+
* updates.
|
|
5322
5338
|
*/
|
|
5323
5339
|
interface PerpetualsWsUpdatesUserPayload {
|
|
5324
5340
|
account: PerpetualsAccountObject;
|
|
5325
5341
|
stopOrders: PerpetualsStopOrderData[] | undefined;
|
|
5342
|
+
twapOrders: PerpetualsTwapOrderData[] | undefined;
|
|
5326
5343
|
}
|
|
5327
5344
|
/**
|
|
5328
5345
|
* Websocket subscription message format sent by clients to manage
|
package/dist/index.js
CHANGED
|
@@ -9639,18 +9639,21 @@ var init_perpetualsAccount = __esm({
|
|
|
9639
9639
|
* @returns Transaction response containing `tx`.
|
|
9640
9640
|
*/
|
|
9641
9641
|
async getCreateTwapOrdersTx(inputs) {
|
|
9642
|
-
if ("vaultId" in this.accountCap) {
|
|
9643
|
-
throw new Error("TWAP orders are not yet supported for vault accounts");
|
|
9644
|
-
}
|
|
9645
9642
|
const { tx, ...otherInputs } = inputs;
|
|
9646
9643
|
return this.fetchApiTxObject(
|
|
9647
|
-
"account/transactions/create-twap-orders
|
|
9644
|
+
`${this.vaultId ? "vault" : "account"}/transactions/create-twap-orders`,
|
|
9648
9645
|
{
|
|
9649
9646
|
...otherInputs,
|
|
9650
9647
|
txKind: await this.api?.Transactions().fetchBase64TxKindFromTx({ tx }),
|
|
9651
9648
|
walletAddress: this.ownerAddress(),
|
|
9652
|
-
|
|
9653
|
-
|
|
9649
|
+
..."vaultId" in this.accountCap ? {
|
|
9650
|
+
vaultId: this.accountCap.vaultId,
|
|
9651
|
+
accountId: void 0
|
|
9652
|
+
} : {
|
|
9653
|
+
accountId: this.accountCap.accountId,
|
|
9654
|
+
accountCapId: this.accountCap.objectId,
|
|
9655
|
+
vaultId: void 0
|
|
9656
|
+
}
|
|
9654
9657
|
},
|
|
9655
9658
|
void 0,
|
|
9656
9659
|
{
|
|
@@ -9668,18 +9671,21 @@ var init_perpetualsAccount = __esm({
|
|
|
9668
9671
|
* @returns Transaction response containing `tx`.
|
|
9669
9672
|
*/
|
|
9670
9673
|
async getEditTwapOrdersTx(inputs) {
|
|
9671
|
-
if ("vaultId" in this.accountCap) {
|
|
9672
|
-
throw new Error("TWAP orders are not yet supported for vault accounts");
|
|
9673
|
-
}
|
|
9674
9674
|
const { tx, ...otherInputs } = inputs;
|
|
9675
9675
|
return this.fetchApiTxObject(
|
|
9676
|
-
"account/transactions/edit-twap-orders
|
|
9676
|
+
`${this.vaultId ? "vault" : "account"}/transactions/edit-twap-orders`,
|
|
9677
9677
|
{
|
|
9678
9678
|
...otherInputs,
|
|
9679
9679
|
txKind: await this.api?.Transactions().fetchBase64TxKindFromTx({ tx }),
|
|
9680
9680
|
walletAddress: this.ownerAddress(),
|
|
9681
|
-
|
|
9682
|
-
|
|
9681
|
+
..."vaultId" in this.accountCap ? {
|
|
9682
|
+
vaultId: this.accountCap.vaultId,
|
|
9683
|
+
accountId: void 0
|
|
9684
|
+
} : {
|
|
9685
|
+
accountId: this.accountCap.accountId,
|
|
9686
|
+
accountCapId: this.accountCap.objectId,
|
|
9687
|
+
vaultId: void 0
|
|
9688
|
+
}
|
|
9683
9689
|
},
|
|
9684
9690
|
void 0,
|
|
9685
9691
|
{
|
|
@@ -9697,18 +9703,21 @@ var init_perpetualsAccount = __esm({
|
|
|
9697
9703
|
* @returns Transaction response containing `tx`.
|
|
9698
9704
|
*/
|
|
9699
9705
|
async getCancelTwapOrdersTx(inputs) {
|
|
9700
|
-
if ("vaultId" in this.accountCap) {
|
|
9701
|
-
throw new Error("TWAP orders are not yet supported for vault accounts");
|
|
9702
|
-
}
|
|
9703
9706
|
const { tx, ...otherInputs } = inputs;
|
|
9704
9707
|
return this.fetchApiTxObject(
|
|
9705
|
-
"account/transactions/cancel-twap-orders
|
|
9708
|
+
`${this.vaultId ? "vault" : "account"}/transactions/cancel-twap-orders`,
|
|
9706
9709
|
{
|
|
9707
9710
|
...otherInputs,
|
|
9708
9711
|
txKind: await this.api?.Transactions().fetchBase64TxKindFromTx({ tx }),
|
|
9709
9712
|
walletAddress: this.ownerAddress(),
|
|
9710
|
-
|
|
9711
|
-
|
|
9713
|
+
..."vaultId" in this.accountCap ? {
|
|
9714
|
+
vaultId: this.accountCap.vaultId,
|
|
9715
|
+
accountId: void 0
|
|
9716
|
+
} : {
|
|
9717
|
+
accountId: this.accountCap.accountId,
|
|
9718
|
+
accountCapId: this.accountCap.objectId,
|
|
9719
|
+
vaultId: void 0
|
|
9720
|
+
}
|
|
9712
9721
|
},
|
|
9713
9722
|
void 0,
|
|
9714
9723
|
{
|
|
@@ -9726,16 +9735,17 @@ var init_perpetualsAccount = __esm({
|
|
|
9726
9735
|
* @returns {@link ApiPerpetualsTwapOrderDatasResponse} containing `twapOrderDatas`.
|
|
9727
9736
|
*/
|
|
9728
9737
|
async getTwapOrderDatas(inputs) {
|
|
9729
|
-
if ("vaultId" in this.accountCap) {
|
|
9730
|
-
throw new Error("TWAP orders are not yet supported for vault accounts");
|
|
9731
|
-
}
|
|
9732
9738
|
const { bytes, signature, marketIds } = inputs;
|
|
9733
|
-
return await this.fetchApi("account/twap-order-datas
|
|
9739
|
+
return await this.fetchApi(`${this.vaultId ? "vault" : "account"}/twap-order-datas`, {
|
|
9734
9740
|
bytes,
|
|
9735
9741
|
signature,
|
|
9736
9742
|
walletAddress: this.ownerAddress(),
|
|
9737
9743
|
marketIds: marketIds ?? [],
|
|
9738
|
-
|
|
9744
|
+
..."vaultId" in this.accountCap ? {
|
|
9745
|
+
vaultId: this.accountCap.vaultId
|
|
9746
|
+
} : {
|
|
9747
|
+
accountId: this.accountCap.accountId
|
|
9748
|
+
}
|
|
9739
9749
|
});
|
|
9740
9750
|
}
|
|
9741
9751
|
// public async getReduceOrderTx(inputs: {
|