@drift-labs/sdk 2.34.1-beta.8 → 2.35.0
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/VERSION +1 -1
- package/lib/driftClient.d.ts +2 -0
- package/lib/driftClient.js +19 -0
- package/lib/idl/drift.json +29 -1
- package/package.json +1 -1
- package/src/driftClient.ts +35 -0
- package/src/idl/drift.json +29 -1
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.34.1-beta.
|
|
1
|
+
2.34.1-beta.9
|
package/lib/driftClient.d.ts
CHANGED
|
@@ -283,6 +283,8 @@ export declare class DriftClient {
|
|
|
283
283
|
getCancelOrderIx(orderId?: number): Promise<TransactionInstruction>;
|
|
284
284
|
cancelOrderByUserId(userOrderId: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
285
285
|
getCancelOrderByUserIdIx(userOrderId: number): Promise<TransactionInstruction>;
|
|
286
|
+
cancelOrdersByIds(orderIds?: number[], txParams?: TxParams): Promise<TransactionSignature>;
|
|
287
|
+
getCancelOrdersByIdsIx(orderIds?: number[]): Promise<TransactionInstruction>;
|
|
286
288
|
cancelOrders(marketType?: MarketType, marketIndex?: number, direction?: PositionDirection, txParams?: TxParams): Promise<TransactionSignature>;
|
|
287
289
|
getCancelOrdersIx(marketType: MarketType | null, marketIndex: number | null, direction: PositionDirection | null): Promise<TransactionInstruction>;
|
|
288
290
|
cancelAndPlaceOrders(cancelOrderParams: {
|
package/lib/driftClient.js
CHANGED
|
@@ -1540,6 +1540,25 @@ class DriftClient {
|
|
|
1540
1540
|
remainingAccounts,
|
|
1541
1541
|
});
|
|
1542
1542
|
}
|
|
1543
|
+
async cancelOrdersByIds(orderIds, txParams) {
|
|
1544
|
+
const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getCancelOrdersByIdsIx(orderIds), txParams), [], this.opts);
|
|
1545
|
+
return txSig;
|
|
1546
|
+
}
|
|
1547
|
+
async getCancelOrdersByIdsIx(orderIds) {
|
|
1548
|
+
const userAccountPublicKey = await this.getUserAccountPublicKey();
|
|
1549
|
+
const remainingAccounts = this.getRemainingAccounts({
|
|
1550
|
+
userAccounts: [this.getUserAccount()],
|
|
1551
|
+
useMarketLastSlotCache: true,
|
|
1552
|
+
});
|
|
1553
|
+
return await this.program.instruction.cancelOrdersByIds(orderIds, {
|
|
1554
|
+
accounts: {
|
|
1555
|
+
state: await this.getStatePublicKey(),
|
|
1556
|
+
user: userAccountPublicKey,
|
|
1557
|
+
authority: this.wallet.publicKey,
|
|
1558
|
+
},
|
|
1559
|
+
remainingAccounts,
|
|
1560
|
+
});
|
|
1561
|
+
}
|
|
1543
1562
|
async cancelOrders(marketType, marketIndex, direction, txParams) {
|
|
1544
1563
|
const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getCancelOrdersIx(marketType, marketIndex, direction), txParams), [], this.opts);
|
|
1545
1564
|
return txSig;
|
package/lib/idl/drift.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.
|
|
2
|
+
"version": "2.35.0",
|
|
3
3
|
"name": "drift",
|
|
4
4
|
"instructions": [
|
|
5
5
|
{
|
|
@@ -428,6 +428,34 @@
|
|
|
428
428
|
}
|
|
429
429
|
]
|
|
430
430
|
},
|
|
431
|
+
{
|
|
432
|
+
"name": "cancelOrdersByIds",
|
|
433
|
+
"accounts": [
|
|
434
|
+
{
|
|
435
|
+
"name": "state",
|
|
436
|
+
"isMut": false,
|
|
437
|
+
"isSigner": false
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
"name": "user",
|
|
441
|
+
"isMut": true,
|
|
442
|
+
"isSigner": false
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
"name": "authority",
|
|
446
|
+
"isMut": false,
|
|
447
|
+
"isSigner": true
|
|
448
|
+
}
|
|
449
|
+
],
|
|
450
|
+
"args": [
|
|
451
|
+
{
|
|
452
|
+
"name": "orderIds",
|
|
453
|
+
"type": {
|
|
454
|
+
"vec": "u32"
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
]
|
|
458
|
+
},
|
|
431
459
|
{
|
|
432
460
|
"name": "modifyOrder",
|
|
433
461
|
"accounts": [
|
package/package.json
CHANGED
package/src/driftClient.ts
CHANGED
|
@@ -2758,6 +2758,41 @@ export class DriftClient {
|
|
|
2758
2758
|
});
|
|
2759
2759
|
}
|
|
2760
2760
|
|
|
2761
|
+
public async cancelOrdersByIds(
|
|
2762
|
+
orderIds?: number[],
|
|
2763
|
+
txParams?: TxParams
|
|
2764
|
+
): Promise<TransactionSignature> {
|
|
2765
|
+
const { txSig } = await this.sendTransaction(
|
|
2766
|
+
await this.buildTransaction(
|
|
2767
|
+
await this.getCancelOrdersByIdsIx(orderIds),
|
|
2768
|
+
txParams
|
|
2769
|
+
),
|
|
2770
|
+
[],
|
|
2771
|
+
this.opts
|
|
2772
|
+
);
|
|
2773
|
+
return txSig;
|
|
2774
|
+
}
|
|
2775
|
+
|
|
2776
|
+
public async getCancelOrdersByIdsIx(
|
|
2777
|
+
orderIds?: number[]
|
|
2778
|
+
): Promise<TransactionInstruction> {
|
|
2779
|
+
const userAccountPublicKey = await this.getUserAccountPublicKey();
|
|
2780
|
+
|
|
2781
|
+
const remainingAccounts = this.getRemainingAccounts({
|
|
2782
|
+
userAccounts: [this.getUserAccount()],
|
|
2783
|
+
useMarketLastSlotCache: true,
|
|
2784
|
+
});
|
|
2785
|
+
|
|
2786
|
+
return await this.program.instruction.cancelOrdersByIds(orderIds, {
|
|
2787
|
+
accounts: {
|
|
2788
|
+
state: await this.getStatePublicKey(),
|
|
2789
|
+
user: userAccountPublicKey,
|
|
2790
|
+
authority: this.wallet.publicKey,
|
|
2791
|
+
},
|
|
2792
|
+
remainingAccounts,
|
|
2793
|
+
});
|
|
2794
|
+
}
|
|
2795
|
+
|
|
2761
2796
|
public async cancelOrders(
|
|
2762
2797
|
marketType?: MarketType,
|
|
2763
2798
|
marketIndex?: number,
|
package/src/idl/drift.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.
|
|
2
|
+
"version": "2.35.0",
|
|
3
3
|
"name": "drift",
|
|
4
4
|
"instructions": [
|
|
5
5
|
{
|
|
@@ -428,6 +428,34 @@
|
|
|
428
428
|
}
|
|
429
429
|
]
|
|
430
430
|
},
|
|
431
|
+
{
|
|
432
|
+
"name": "cancelOrdersByIds",
|
|
433
|
+
"accounts": [
|
|
434
|
+
{
|
|
435
|
+
"name": "state",
|
|
436
|
+
"isMut": false,
|
|
437
|
+
"isSigner": false
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
"name": "user",
|
|
441
|
+
"isMut": true,
|
|
442
|
+
"isSigner": false
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
"name": "authority",
|
|
446
|
+
"isMut": false,
|
|
447
|
+
"isSigner": true
|
|
448
|
+
}
|
|
449
|
+
],
|
|
450
|
+
"args": [
|
|
451
|
+
{
|
|
452
|
+
"name": "orderIds",
|
|
453
|
+
"type": {
|
|
454
|
+
"vec": "u32"
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
]
|
|
458
|
+
},
|
|
431
459
|
{
|
|
432
460
|
"name": "modifyOrder",
|
|
433
461
|
"accounts": [
|