@drift-labs/sdk 2.99.0-beta.2 → 2.100.0-beta.1
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 -0
- package/lib/browser/driftClient.js +21 -0
- package/lib/browser/idl/drift.json +27 -1
- package/lib/node/driftClient.d.ts +2 -0
- package/lib/node/driftClient.js +21 -0
- package/lib/node/idl/drift.json +27 -1
- package/package.json +1 -1
- package/src/driftClient.ts +41 -0
- package/src/idl/drift.json +27 -1
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.100.0-beta.1
|
|
@@ -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;
|
|
@@ -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);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.
|
|
2
|
+
"version": "2.99.0",
|
|
3
3
|
"name": "drift",
|
|
4
4
|
"instructions": [
|
|
5
5
|
{
|
|
@@ -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;
|
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);
|
package/lib/node/idl/drift.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.
|
|
2
|
+
"version": "2.99.0",
|
|
3
3
|
"name": "drift",
|
|
4
4
|
"instructions": [
|
|
5
5
|
{
|
|
@@ -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
|
package/src/idl/drift.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.
|
|
2
|
+
"version": "2.99.0",
|
|
3
3
|
"name": "drift",
|
|
4
4
|
"instructions": [
|
|
5
5
|
{
|
|
@@ -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": [
|