@drift-labs/sdk 2.70.0-beta.0 → 2.70.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/driftClient.d.ts +5 -4
- package/lib/driftClient.js +8 -8
- package/package.json +1 -1
- package/src/driftClient.ts +12 -7
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.70.0-beta.
|
|
1
|
+
2.70.0-beta.1
|
package/lib/driftClient.d.ts
CHANGED
|
@@ -613,7 +613,7 @@ export declare class DriftClient {
|
|
|
613
613
|
/**
|
|
614
614
|
* Add to an insurance fund stake and optionally initialize the account
|
|
615
615
|
*/
|
|
616
|
-
addInsuranceFundStake({ marketIndex, amount, collateralAccountPublicKey, initializeStakeAccount, fromSubaccount, }: {
|
|
616
|
+
addInsuranceFundStake({ marketIndex, amount, collateralAccountPublicKey, initializeStakeAccount, fromSubaccount, txParams, }: {
|
|
617
617
|
/**
|
|
618
618
|
* Spot market index
|
|
619
619
|
*/
|
|
@@ -631,10 +631,11 @@ export declare class DriftClient {
|
|
|
631
631
|
* Optional -- withdraw from current subaccount to fund stake amount, instead of wallet balance
|
|
632
632
|
*/
|
|
633
633
|
fromSubaccount?: boolean;
|
|
634
|
+
txParams?: TxParams;
|
|
634
635
|
}): Promise<TransactionSignature>;
|
|
635
|
-
requestRemoveInsuranceFundStake(marketIndex: number, amount: BN): Promise<TransactionSignature>;
|
|
636
|
-
cancelRequestRemoveInsuranceFundStake(marketIndex: number): Promise<TransactionSignature>;
|
|
637
|
-
removeInsuranceFundStake(marketIndex: number, collateralAccountPublicKey: PublicKey): Promise<TransactionSignature>;
|
|
636
|
+
requestRemoveInsuranceFundStake(marketIndex: number, amount: BN, txParams?: TxParams): Promise<TransactionSignature>;
|
|
637
|
+
cancelRequestRemoveInsuranceFundStake(marketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
638
|
+
removeInsuranceFundStake(marketIndex: number, collateralAccountPublicKey: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
|
|
638
639
|
settleRevenueToInsuranceFund(marketIndex: number): Promise<TransactionSignature>;
|
|
639
640
|
resolvePerpPnlDeficit(spotMarketIndex: number, perpMarketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
640
641
|
getResolvePerpPnlDeficitIx(spotMarketIndex: number, perpMarketIndex: number): Promise<TransactionInstruction>;
|
package/lib/driftClient.js
CHANGED
|
@@ -3227,7 +3227,7 @@ class DriftClient {
|
|
|
3227
3227
|
/**
|
|
3228
3228
|
* Add to an insurance fund stake and optionally initialize the account
|
|
3229
3229
|
*/
|
|
3230
|
-
async addInsuranceFundStake({ marketIndex, amount, collateralAccountPublicKey, initializeStakeAccount, fromSubaccount, }) {
|
|
3230
|
+
async addInsuranceFundStake({ marketIndex, amount, collateralAccountPublicKey, initializeStakeAccount, fromSubaccount, txParams, }) {
|
|
3231
3231
|
const addIfStakeIxs = [];
|
|
3232
3232
|
const additionalSigners = [];
|
|
3233
3233
|
const spotMarketAccount = this.getSpotMarketAccount(marketIndex);
|
|
@@ -3257,11 +3257,11 @@ class DriftClient {
|
|
|
3257
3257
|
if (createWSOLTokenAccount) {
|
|
3258
3258
|
addIfStakeIxs.push((0, spl_token_1.createCloseAccountInstruction)(tokenAccount, this.wallet.publicKey, this.wallet.publicKey, []));
|
|
3259
3259
|
}
|
|
3260
|
-
const tx = await this.buildTransaction(addIfStakeIxs);
|
|
3260
|
+
const tx = await this.buildTransaction(addIfStakeIxs, txParams);
|
|
3261
3261
|
const { txSig } = await this.sendTransaction(tx, additionalSigners, this.opts);
|
|
3262
3262
|
return txSig;
|
|
3263
3263
|
}
|
|
3264
|
-
async requestRemoveInsuranceFundStake(marketIndex, amount) {
|
|
3264
|
+
async requestRemoveInsuranceFundStake(marketIndex, amount, txParams) {
|
|
3265
3265
|
const spotMarketAccount = this.getSpotMarketAccount(marketIndex);
|
|
3266
3266
|
const ifStakeAccountPublicKey = (0, pda_1.getInsuranceFundStakeAccountPublicKey)(this.program.programId, this.wallet.publicKey, marketIndex);
|
|
3267
3267
|
const remainingAccounts = this.getRemainingAccounts({
|
|
@@ -3280,11 +3280,11 @@ class DriftClient {
|
|
|
3280
3280
|
},
|
|
3281
3281
|
remainingAccounts,
|
|
3282
3282
|
});
|
|
3283
|
-
const tx = await this.buildTransaction(ix);
|
|
3283
|
+
const tx = await this.buildTransaction(ix, txParams);
|
|
3284
3284
|
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
3285
3285
|
return txSig;
|
|
3286
3286
|
}
|
|
3287
|
-
async cancelRequestRemoveInsuranceFundStake(marketIndex) {
|
|
3287
|
+
async cancelRequestRemoveInsuranceFundStake(marketIndex, txParams) {
|
|
3288
3288
|
const spotMarketAccount = this.getSpotMarketAccount(marketIndex);
|
|
3289
3289
|
const ifStakeAccountPublicKey = (0, pda_1.getInsuranceFundStakeAccountPublicKey)(this.program.programId, this.wallet.publicKey, marketIndex);
|
|
3290
3290
|
const remainingAccounts = this.getRemainingAccounts({
|
|
@@ -3303,11 +3303,11 @@ class DriftClient {
|
|
|
3303
3303
|
},
|
|
3304
3304
|
remainingAccounts,
|
|
3305
3305
|
});
|
|
3306
|
-
const tx = await this.buildTransaction(ix);
|
|
3306
|
+
const tx = await this.buildTransaction(ix, txParams);
|
|
3307
3307
|
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
3308
3308
|
return txSig;
|
|
3309
3309
|
}
|
|
3310
|
-
async removeInsuranceFundStake(marketIndex, collateralAccountPublicKey) {
|
|
3310
|
+
async removeInsuranceFundStake(marketIndex, collateralAccountPublicKey, txParams) {
|
|
3311
3311
|
var _a, _b;
|
|
3312
3312
|
const removeIfStakeIxs = [];
|
|
3313
3313
|
const spotMarketAccount = this.getSpotMarketAccount(marketIndex);
|
|
@@ -3357,7 +3357,7 @@ class DriftClient {
|
|
|
3357
3357
|
if (createWSOLTokenAccount) {
|
|
3358
3358
|
removeIfStakeIxs.push((0, spl_token_1.createCloseAccountInstruction)(tokenAccount, this.wallet.publicKey, this.wallet.publicKey, []));
|
|
3359
3359
|
}
|
|
3360
|
-
const tx = await this.buildTransaction(removeIfStakeIxs);
|
|
3360
|
+
const tx = await this.buildTransaction(removeIfStakeIxs, txParams);
|
|
3361
3361
|
const { txSig } = await this.sendTransaction(tx, additionalSigners, this.opts);
|
|
3362
3362
|
return txSig;
|
|
3363
3363
|
}
|
package/package.json
CHANGED
package/src/driftClient.ts
CHANGED
|
@@ -5985,6 +5985,7 @@ export class DriftClient {
|
|
|
5985
5985
|
collateralAccountPublicKey,
|
|
5986
5986
|
initializeStakeAccount,
|
|
5987
5987
|
fromSubaccount,
|
|
5988
|
+
txParams,
|
|
5988
5989
|
}: {
|
|
5989
5990
|
/**
|
|
5990
5991
|
* Spot market index
|
|
@@ -6003,6 +6004,7 @@ export class DriftClient {
|
|
|
6003
6004
|
* Optional -- withdraw from current subaccount to fund stake amount, instead of wallet balance
|
|
6004
6005
|
*/
|
|
6005
6006
|
fromSubaccount?: boolean;
|
|
6007
|
+
txParams?: TxParams;
|
|
6006
6008
|
}): Promise<TransactionSignature> {
|
|
6007
6009
|
const addIfStakeIxs = [];
|
|
6008
6010
|
|
|
@@ -6062,7 +6064,7 @@ export class DriftClient {
|
|
|
6062
6064
|
);
|
|
6063
6065
|
}
|
|
6064
6066
|
|
|
6065
|
-
const tx = await this.buildTransaction(addIfStakeIxs);
|
|
6067
|
+
const tx = await this.buildTransaction(addIfStakeIxs, txParams);
|
|
6066
6068
|
|
|
6067
6069
|
const { txSig } = await this.sendTransaction(
|
|
6068
6070
|
tx,
|
|
@@ -6075,7 +6077,8 @@ export class DriftClient {
|
|
|
6075
6077
|
|
|
6076
6078
|
public async requestRemoveInsuranceFundStake(
|
|
6077
6079
|
marketIndex: number,
|
|
6078
|
-
amount: BN
|
|
6080
|
+
amount: BN,
|
|
6081
|
+
txParams?: TxParams
|
|
6079
6082
|
): Promise<TransactionSignature> {
|
|
6080
6083
|
const spotMarketAccount = this.getSpotMarketAccount(marketIndex);
|
|
6081
6084
|
const ifStakeAccountPublicKey = getInsuranceFundStakeAccountPublicKey(
|
|
@@ -6106,14 +6109,15 @@ export class DriftClient {
|
|
|
6106
6109
|
}
|
|
6107
6110
|
);
|
|
6108
6111
|
|
|
6109
|
-
const tx = await this.buildTransaction(ix);
|
|
6112
|
+
const tx = await this.buildTransaction(ix, txParams);
|
|
6110
6113
|
|
|
6111
6114
|
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
6112
6115
|
return txSig;
|
|
6113
6116
|
}
|
|
6114
6117
|
|
|
6115
6118
|
public async cancelRequestRemoveInsuranceFundStake(
|
|
6116
|
-
marketIndex: number
|
|
6119
|
+
marketIndex: number,
|
|
6120
|
+
txParams?: TxParams
|
|
6117
6121
|
): Promise<TransactionSignature> {
|
|
6118
6122
|
const spotMarketAccount = this.getSpotMarketAccount(marketIndex);
|
|
6119
6123
|
const ifStakeAccountPublicKey = getInsuranceFundStakeAccountPublicKey(
|
|
@@ -6144,7 +6148,7 @@ export class DriftClient {
|
|
|
6144
6148
|
}
|
|
6145
6149
|
);
|
|
6146
6150
|
|
|
6147
|
-
const tx = await this.buildTransaction(ix);
|
|
6151
|
+
const tx = await this.buildTransaction(ix, txParams);
|
|
6148
6152
|
|
|
6149
6153
|
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
6150
6154
|
return txSig;
|
|
@@ -6152,7 +6156,8 @@ export class DriftClient {
|
|
|
6152
6156
|
|
|
6153
6157
|
public async removeInsuranceFundStake(
|
|
6154
6158
|
marketIndex: number,
|
|
6155
|
-
collateralAccountPublicKey: PublicKey
|
|
6159
|
+
collateralAccountPublicKey: PublicKey,
|
|
6160
|
+
txParams?: TxParams
|
|
6156
6161
|
): Promise<TransactionSignature> {
|
|
6157
6162
|
const removeIfStakeIxs = [];
|
|
6158
6163
|
const spotMarketAccount = this.getSpotMarketAccount(marketIndex);
|
|
@@ -6233,7 +6238,7 @@ export class DriftClient {
|
|
|
6233
6238
|
);
|
|
6234
6239
|
}
|
|
6235
6240
|
|
|
6236
|
-
const tx = await this.buildTransaction(removeIfStakeIxs);
|
|
6241
|
+
const tx = await this.buildTransaction(removeIfStakeIxs, txParams);
|
|
6237
6242
|
|
|
6238
6243
|
const { txSig } = await this.sendTransaction(
|
|
6239
6244
|
tx,
|