@drift-labs/sdk 2.100.0-beta.0 → 2.100.0-beta.2
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/browser/driftClient.d.ts +2 -2
- package/lib/browser/driftClient.js +22 -14
- package/lib/browser/idl/drift.json +26 -0
- package/lib/node/driftClient.d.ts +2 -2
- package/lib/node/driftClient.js +22 -14
- package/lib/node/idl/drift.json +26 -0
- package/package.json +1 -1
- package/src/driftClient.ts +42 -28
- package/src/idl/drift.json +26 -0
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.100.0-beta.
|
|
1
|
+
2.100.0-beta.2
|
|
@@ -176,6 +176,8 @@ export declare class DriftClient {
|
|
|
176
176
|
getReferrerNameAccountsForAuthority(authority: PublicKey): Promise<ReferrerNameAccount[]>;
|
|
177
177
|
deleteUser(subAccountId?: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
178
178
|
getUserDeletionIx(userAccountPublicKey: PublicKey): Promise<anchor.web3.TransactionInstruction>;
|
|
179
|
+
deleteSwiftUserOrders(subAccountId?: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
180
|
+
getSwiftUserOrdersDeletionIx(userAccountPublicKey: PublicKey): Promise<anchor.web3.TransactionInstruction>;
|
|
179
181
|
reclaimRent(subAccountId?: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
180
182
|
getReclaimRentIx(userAccountPublicKey: PublicKey): Promise<anchor.web3.TransactionInstruction>;
|
|
181
183
|
getUser(subAccountId?: number, authority?: PublicKey): User;
|
|
@@ -501,8 +503,6 @@ export declare class DriftClient {
|
|
|
501
503
|
getUpdateUserFuelBonusIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, userAuthority: PublicKey): Promise<TransactionInstruction>;
|
|
502
504
|
updateUserStatsReferrerStatus(userAuthority: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
|
|
503
505
|
getUpdateUserStatsReferrerStatusIx(userAuthority: PublicKey): Promise<TransactionInstruction>;
|
|
504
|
-
updateUserStatsReferrerInfo(userStatsAccountPublicKey: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
|
|
505
|
-
getUpdateUserStatsReferrerInfoIx(userStatsAccountPublicKey: PublicKey): Promise<TransactionInstruction>;
|
|
506
506
|
updateUserOpenOrdersCount(userAccountPublicKey: PublicKey, user: UserAccount, txParams?: TxParams, fillerPublicKey?: PublicKey): Promise<TransactionSignature>;
|
|
507
507
|
getUpdateUserOpenOrdersCountIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
|
|
508
508
|
placeAndTakePerpOrder(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, successCondition?: PlaceAndTakeOrderSuccessCondition, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
|
|
@@ -895,6 +895,27 @@ class DriftClient {
|
|
|
895
895
|
});
|
|
896
896
|
return ix;
|
|
897
897
|
}
|
|
898
|
+
async deleteSwiftUserOrders(subAccountId = 0, txParams) {
|
|
899
|
+
var _a;
|
|
900
|
+
const userAccountPublicKey = (0, pda_1.getUserAccountPublicKeySync)(this.program.programId, this.wallet.publicKey, subAccountId);
|
|
901
|
+
const ix = await this.getSwiftUserOrdersDeletionIx(userAccountPublicKey);
|
|
902
|
+
const { txSig } = await this.sendTransaction(await this.buildTransaction(ix, txParams), [], this.opts);
|
|
903
|
+
const userMapKey = this.getUserMapKey(subAccountId, this.wallet.publicKey);
|
|
904
|
+
await ((_a = this.users.get(userMapKey)) === null || _a === void 0 ? void 0 : _a.unsubscribe());
|
|
905
|
+
this.users.delete(userMapKey);
|
|
906
|
+
return txSig;
|
|
907
|
+
}
|
|
908
|
+
async getSwiftUserOrdersDeletionIx(userAccountPublicKey) {
|
|
909
|
+
const ix = await this.program.instruction.deleteSwiftUserOrders({
|
|
910
|
+
accounts: {
|
|
911
|
+
user: userAccountPublicKey,
|
|
912
|
+
swiftUserOrders: (0, pda_1.getSwiftUserAccountPublicKey)(this.program.programId, userAccountPublicKey),
|
|
913
|
+
authority: this.wallet.publicKey,
|
|
914
|
+
state: await this.getStatePublicKey(),
|
|
915
|
+
},
|
|
916
|
+
});
|
|
917
|
+
return ix;
|
|
918
|
+
}
|
|
898
919
|
async reclaimRent(subAccountId = 0, txParams) {
|
|
899
920
|
const userAccountPublicKey = (0, pda_1.getUserAccountPublicKeySync)(this.program.programId, this.wallet.publicKey, subAccountId);
|
|
900
921
|
const ix = await this.getReclaimRentIx(userAccountPublicKey);
|
|
@@ -2803,20 +2824,7 @@ class DriftClient {
|
|
|
2803
2824
|
}
|
|
2804
2825
|
async getUpdateUserStatsReferrerStatusIx(userAuthority) {
|
|
2805
2826
|
const userStatsAccountPublicKey = (0, pda_1.getUserStatsAccountPublicKey)(this.program.programId, userAuthority);
|
|
2806
|
-
return await this.program.instruction.
|
|
2807
|
-
accounts: {
|
|
2808
|
-
state: await this.getStatePublicKey(),
|
|
2809
|
-
userStats: userStatsAccountPublicKey,
|
|
2810
|
-
authority: this.wallet.publicKey,
|
|
2811
|
-
},
|
|
2812
|
-
});
|
|
2813
|
-
}
|
|
2814
|
-
async updateUserStatsReferrerInfo(userStatsAccountPublicKey, txParams) {
|
|
2815
|
-
const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getUpdateUserStatsReferrerInfoIx(userStatsAccountPublicKey), txParams), [], this.opts);
|
|
2816
|
-
return txSig;
|
|
2817
|
-
}
|
|
2818
|
-
async getUpdateUserStatsReferrerInfoIx(userStatsAccountPublicKey) {
|
|
2819
|
-
return await this.program.instruction.updateUserStatsReferrerInfo({
|
|
2827
|
+
return await this.program.instruction.updateUserStatsReferrerStatus({
|
|
2820
2828
|
accounts: {
|
|
2821
2829
|
state: await this.getStatePublicKey(),
|
|
2822
2830
|
userStats: userStatsAccountPublicKey,
|
|
@@ -1422,6 +1422,32 @@
|
|
|
1422
1422
|
],
|
|
1423
1423
|
"args": []
|
|
1424
1424
|
},
|
|
1425
|
+
{
|
|
1426
|
+
"name": "deleteSwiftUserOrders",
|
|
1427
|
+
"accounts": [
|
|
1428
|
+
{
|
|
1429
|
+
"name": "user",
|
|
1430
|
+
"isMut": true,
|
|
1431
|
+
"isSigner": false
|
|
1432
|
+
},
|
|
1433
|
+
{
|
|
1434
|
+
"name": "swiftUserOrders",
|
|
1435
|
+
"isMut": true,
|
|
1436
|
+
"isSigner": false
|
|
1437
|
+
},
|
|
1438
|
+
{
|
|
1439
|
+
"name": "state",
|
|
1440
|
+
"isMut": true,
|
|
1441
|
+
"isSigner": false
|
|
1442
|
+
},
|
|
1443
|
+
{
|
|
1444
|
+
"name": "authority",
|
|
1445
|
+
"isMut": false,
|
|
1446
|
+
"isSigner": true
|
|
1447
|
+
}
|
|
1448
|
+
],
|
|
1449
|
+
"args": []
|
|
1450
|
+
},
|
|
1425
1451
|
{
|
|
1426
1452
|
"name": "reclaimRent",
|
|
1427
1453
|
"accounts": [
|
|
@@ -176,6 +176,8 @@ export declare class DriftClient {
|
|
|
176
176
|
getReferrerNameAccountsForAuthority(authority: PublicKey): Promise<ReferrerNameAccount[]>;
|
|
177
177
|
deleteUser(subAccountId?: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
178
178
|
getUserDeletionIx(userAccountPublicKey: PublicKey): Promise<anchor.web3.TransactionInstruction>;
|
|
179
|
+
deleteSwiftUserOrders(subAccountId?: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
180
|
+
getSwiftUserOrdersDeletionIx(userAccountPublicKey: PublicKey): Promise<anchor.web3.TransactionInstruction>;
|
|
179
181
|
reclaimRent(subAccountId?: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
180
182
|
getReclaimRentIx(userAccountPublicKey: PublicKey): Promise<anchor.web3.TransactionInstruction>;
|
|
181
183
|
getUser(subAccountId?: number, authority?: PublicKey): User;
|
|
@@ -501,8 +503,6 @@ export declare class DriftClient {
|
|
|
501
503
|
getUpdateUserFuelBonusIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, userAuthority: PublicKey): Promise<TransactionInstruction>;
|
|
502
504
|
updateUserStatsReferrerStatus(userAuthority: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
|
|
503
505
|
getUpdateUserStatsReferrerStatusIx(userAuthority: PublicKey): Promise<TransactionInstruction>;
|
|
504
|
-
updateUserStatsReferrerInfo(userStatsAccountPublicKey: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
|
|
505
|
-
getUpdateUserStatsReferrerInfoIx(userStatsAccountPublicKey: PublicKey): Promise<TransactionInstruction>;
|
|
506
506
|
updateUserOpenOrdersCount(userAccountPublicKey: PublicKey, user: UserAccount, txParams?: TxParams, fillerPublicKey?: PublicKey): Promise<TransactionSignature>;
|
|
507
507
|
getUpdateUserOpenOrdersCountIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, fillerPublicKey?: PublicKey): Promise<TransactionInstruction>;
|
|
508
508
|
placeAndTakePerpOrder(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, successCondition?: PlaceAndTakeOrderSuccessCondition, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
|
package/lib/node/driftClient.js
CHANGED
|
@@ -895,6 +895,27 @@ class DriftClient {
|
|
|
895
895
|
});
|
|
896
896
|
return ix;
|
|
897
897
|
}
|
|
898
|
+
async deleteSwiftUserOrders(subAccountId = 0, txParams) {
|
|
899
|
+
var _a;
|
|
900
|
+
const userAccountPublicKey = (0, pda_1.getUserAccountPublicKeySync)(this.program.programId, this.wallet.publicKey, subAccountId);
|
|
901
|
+
const ix = await this.getSwiftUserOrdersDeletionIx(userAccountPublicKey);
|
|
902
|
+
const { txSig } = await this.sendTransaction(await this.buildTransaction(ix, txParams), [], this.opts);
|
|
903
|
+
const userMapKey = this.getUserMapKey(subAccountId, this.wallet.publicKey);
|
|
904
|
+
await ((_a = this.users.get(userMapKey)) === null || _a === void 0 ? void 0 : _a.unsubscribe());
|
|
905
|
+
this.users.delete(userMapKey);
|
|
906
|
+
return txSig;
|
|
907
|
+
}
|
|
908
|
+
async getSwiftUserOrdersDeletionIx(userAccountPublicKey) {
|
|
909
|
+
const ix = await this.program.instruction.deleteSwiftUserOrders({
|
|
910
|
+
accounts: {
|
|
911
|
+
user: userAccountPublicKey,
|
|
912
|
+
swiftUserOrders: (0, pda_1.getSwiftUserAccountPublicKey)(this.program.programId, userAccountPublicKey),
|
|
913
|
+
authority: this.wallet.publicKey,
|
|
914
|
+
state: await this.getStatePublicKey(),
|
|
915
|
+
},
|
|
916
|
+
});
|
|
917
|
+
return ix;
|
|
918
|
+
}
|
|
898
919
|
async reclaimRent(subAccountId = 0, txParams) {
|
|
899
920
|
const userAccountPublicKey = (0, pda_1.getUserAccountPublicKeySync)(this.program.programId, this.wallet.publicKey, subAccountId);
|
|
900
921
|
const ix = await this.getReclaimRentIx(userAccountPublicKey);
|
|
@@ -2803,20 +2824,7 @@ class DriftClient {
|
|
|
2803
2824
|
}
|
|
2804
2825
|
async getUpdateUserStatsReferrerStatusIx(userAuthority) {
|
|
2805
2826
|
const userStatsAccountPublicKey = (0, pda_1.getUserStatsAccountPublicKey)(this.program.programId, userAuthority);
|
|
2806
|
-
return await this.program.instruction.
|
|
2807
|
-
accounts: {
|
|
2808
|
-
state: await this.getStatePublicKey(),
|
|
2809
|
-
userStats: userStatsAccountPublicKey,
|
|
2810
|
-
authority: this.wallet.publicKey,
|
|
2811
|
-
},
|
|
2812
|
-
});
|
|
2813
|
-
}
|
|
2814
|
-
async updateUserStatsReferrerInfo(userStatsAccountPublicKey, txParams) {
|
|
2815
|
-
const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getUpdateUserStatsReferrerInfoIx(userStatsAccountPublicKey), txParams), [], this.opts);
|
|
2816
|
-
return txSig;
|
|
2817
|
-
}
|
|
2818
|
-
async getUpdateUserStatsReferrerInfoIx(userStatsAccountPublicKey) {
|
|
2819
|
-
return await this.program.instruction.updateUserStatsReferrerInfo({
|
|
2827
|
+
return await this.program.instruction.updateUserStatsReferrerStatus({
|
|
2820
2828
|
accounts: {
|
|
2821
2829
|
state: await this.getStatePublicKey(),
|
|
2822
2830
|
userStats: userStatsAccountPublicKey,
|
package/lib/node/idl/drift.json
CHANGED
|
@@ -1422,6 +1422,32 @@
|
|
|
1422
1422
|
],
|
|
1423
1423
|
"args": []
|
|
1424
1424
|
},
|
|
1425
|
+
{
|
|
1426
|
+
"name": "deleteSwiftUserOrders",
|
|
1427
|
+
"accounts": [
|
|
1428
|
+
{
|
|
1429
|
+
"name": "user",
|
|
1430
|
+
"isMut": true,
|
|
1431
|
+
"isSigner": false
|
|
1432
|
+
},
|
|
1433
|
+
{
|
|
1434
|
+
"name": "swiftUserOrders",
|
|
1435
|
+
"isMut": true,
|
|
1436
|
+
"isSigner": false
|
|
1437
|
+
},
|
|
1438
|
+
{
|
|
1439
|
+
"name": "state",
|
|
1440
|
+
"isMut": true,
|
|
1441
|
+
"isSigner": false
|
|
1442
|
+
},
|
|
1443
|
+
{
|
|
1444
|
+
"name": "authority",
|
|
1445
|
+
"isMut": false,
|
|
1446
|
+
"isSigner": true
|
|
1447
|
+
}
|
|
1448
|
+
],
|
|
1449
|
+
"args": []
|
|
1450
|
+
},
|
|
1425
1451
|
{
|
|
1426
1452
|
"name": "reclaimRent",
|
|
1427
1453
|
"accounts": [
|
package/package.json
CHANGED
package/src/driftClient.ts
CHANGED
|
@@ -1537,6 +1537,47 @@ export class DriftClient {
|
|
|
1537
1537
|
return ix;
|
|
1538
1538
|
}
|
|
1539
1539
|
|
|
1540
|
+
public async deleteSwiftUserOrders(
|
|
1541
|
+
subAccountId = 0,
|
|
1542
|
+
txParams?: TxParams
|
|
1543
|
+
): Promise<TransactionSignature> {
|
|
1544
|
+
const userAccountPublicKey = getUserAccountPublicKeySync(
|
|
1545
|
+
this.program.programId,
|
|
1546
|
+
this.wallet.publicKey,
|
|
1547
|
+
subAccountId
|
|
1548
|
+
);
|
|
1549
|
+
|
|
1550
|
+
const ix = await this.getSwiftUserOrdersDeletionIx(userAccountPublicKey);
|
|
1551
|
+
|
|
1552
|
+
const { txSig } = await this.sendTransaction(
|
|
1553
|
+
await this.buildTransaction(ix, txParams),
|
|
1554
|
+
[],
|
|
1555
|
+
this.opts
|
|
1556
|
+
);
|
|
1557
|
+
|
|
1558
|
+
const userMapKey = this.getUserMapKey(subAccountId, this.wallet.publicKey);
|
|
1559
|
+
await this.users.get(userMapKey)?.unsubscribe();
|
|
1560
|
+
this.users.delete(userMapKey);
|
|
1561
|
+
|
|
1562
|
+
return txSig;
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
public async getSwiftUserOrdersDeletionIx(userAccountPublicKey: PublicKey) {
|
|
1566
|
+
const ix = await this.program.instruction.deleteSwiftUserOrders({
|
|
1567
|
+
accounts: {
|
|
1568
|
+
user: userAccountPublicKey,
|
|
1569
|
+
swiftUserOrders: getSwiftUserAccountPublicKey(
|
|
1570
|
+
this.program.programId,
|
|
1571
|
+
userAccountPublicKey
|
|
1572
|
+
),
|
|
1573
|
+
authority: this.wallet.publicKey,
|
|
1574
|
+
state: await this.getStatePublicKey(),
|
|
1575
|
+
},
|
|
1576
|
+
});
|
|
1577
|
+
|
|
1578
|
+
return ix;
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1540
1581
|
public async reclaimRent(
|
|
1541
1582
|
subAccountId = 0,
|
|
1542
1583
|
txParams?: TxParams
|
|
@@ -5119,34 +5160,7 @@ export class DriftClient {
|
|
|
5119
5160
|
userAuthority
|
|
5120
5161
|
);
|
|
5121
5162
|
|
|
5122
|
-
return await this.program.instruction.
|
|
5123
|
-
accounts: {
|
|
5124
|
-
state: await this.getStatePublicKey(),
|
|
5125
|
-
userStats: userStatsAccountPublicKey,
|
|
5126
|
-
authority: this.wallet.publicKey,
|
|
5127
|
-
},
|
|
5128
|
-
});
|
|
5129
|
-
}
|
|
5130
|
-
|
|
5131
|
-
public async updateUserStatsReferrerInfo(
|
|
5132
|
-
userStatsAccountPublicKey: PublicKey,
|
|
5133
|
-
txParams?: TxParams
|
|
5134
|
-
): Promise<TransactionSignature> {
|
|
5135
|
-
const { txSig } = await this.sendTransaction(
|
|
5136
|
-
await this.buildTransaction(
|
|
5137
|
-
await this.getUpdateUserStatsReferrerInfoIx(userStatsAccountPublicKey),
|
|
5138
|
-
txParams
|
|
5139
|
-
),
|
|
5140
|
-
[],
|
|
5141
|
-
this.opts
|
|
5142
|
-
);
|
|
5143
|
-
return txSig;
|
|
5144
|
-
}
|
|
5145
|
-
|
|
5146
|
-
public async getUpdateUserStatsReferrerInfoIx(
|
|
5147
|
-
userStatsAccountPublicKey: PublicKey
|
|
5148
|
-
): Promise<TransactionInstruction> {
|
|
5149
|
-
return await this.program.instruction.updateUserStatsReferrerInfo({
|
|
5163
|
+
return await this.program.instruction.updateUserStatsReferrerStatus({
|
|
5150
5164
|
accounts: {
|
|
5151
5165
|
state: await this.getStatePublicKey(),
|
|
5152
5166
|
userStats: userStatsAccountPublicKey,
|
package/src/idl/drift.json
CHANGED
|
@@ -1422,6 +1422,32 @@
|
|
|
1422
1422
|
],
|
|
1423
1423
|
"args": []
|
|
1424
1424
|
},
|
|
1425
|
+
{
|
|
1426
|
+
"name": "deleteSwiftUserOrders",
|
|
1427
|
+
"accounts": [
|
|
1428
|
+
{
|
|
1429
|
+
"name": "user",
|
|
1430
|
+
"isMut": true,
|
|
1431
|
+
"isSigner": false
|
|
1432
|
+
},
|
|
1433
|
+
{
|
|
1434
|
+
"name": "swiftUserOrders",
|
|
1435
|
+
"isMut": true,
|
|
1436
|
+
"isSigner": false
|
|
1437
|
+
},
|
|
1438
|
+
{
|
|
1439
|
+
"name": "state",
|
|
1440
|
+
"isMut": true,
|
|
1441
|
+
"isSigner": false
|
|
1442
|
+
},
|
|
1443
|
+
{
|
|
1444
|
+
"name": "authority",
|
|
1445
|
+
"isMut": false,
|
|
1446
|
+
"isSigner": true
|
|
1447
|
+
}
|
|
1448
|
+
],
|
|
1449
|
+
"args": []
|
|
1450
|
+
},
|
|
1425
1451
|
{
|
|
1426
1452
|
"name": "reclaimRent",
|
|
1427
1453
|
"accounts": [
|