@drift-labs/sdk 2.97.0-beta.17 → 2.97.0-beta.18
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 -2
- package/lib/driftClient.js +17 -4
- package/package.json +1 -1
- package/src/driftClient.ts +22 -3
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.97.0-beta.
|
|
1
|
+
2.97.0-beta.18
|
package/lib/driftClient.d.ts
CHANGED
|
@@ -791,8 +791,8 @@ export declare class DriftClient {
|
|
|
791
791
|
private getBuildEncodedVaaIxs;
|
|
792
792
|
enableUserHighLeverageMode(subAccountId: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
793
793
|
getEnableHighLeverageModeIx(subAccountId: number): Promise<anchor.web3.TransactionInstruction>;
|
|
794
|
-
disableUserHighLeverageMode(user: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
|
|
795
|
-
getDisableHighLeverageModeIx(user: PublicKey): Promise<anchor.web3.TransactionInstruction>;
|
|
794
|
+
disableUserHighLeverageMode(user: PublicKey, userAccount?: UserAccount, txParams?: TxParams): Promise<TransactionSignature>;
|
|
795
|
+
getDisableHighLeverageModeIx(user: PublicKey, userAccount?: UserAccount): Promise<anchor.web3.TransactionInstruction>;
|
|
796
796
|
fetchHighLeverageModeConfig(): Promise<HighLeverageModeConfig>;
|
|
797
797
|
private handleSignedTransaction;
|
|
798
798
|
private handlePreSignedTransaction;
|
package/lib/driftClient.js
CHANGED
|
@@ -3451,7 +3451,10 @@ class DriftClient {
|
|
|
3451
3451
|
const liquidator = await this.getUserAccountPublicKey(liquidatorSubAccountId);
|
|
3452
3452
|
const liquidatorStatsPublicKey = this.getUserStatsAccountPublicKey();
|
|
3453
3453
|
const remainingAccounts = this.getRemainingAccounts({
|
|
3454
|
-
userAccounts: [
|
|
3454
|
+
userAccounts: [
|
|
3455
|
+
userAccount,
|
|
3456
|
+
...makerInfos.map((makerInfo) => makerInfo.makerUserAccount),
|
|
3457
|
+
],
|
|
3455
3458
|
useMarketLastSlotCache: true,
|
|
3456
3459
|
writablePerpMarketIndexes: [marketIndex],
|
|
3457
3460
|
});
|
|
@@ -4259,6 +4262,9 @@ class DriftClient {
|
|
|
4259
4262
|
return txSig;
|
|
4260
4263
|
}
|
|
4261
4264
|
async getEnableHighLeverageModeIx(subAccountId) {
|
|
4265
|
+
const remainingAccounts = this.getRemainingAccounts({
|
|
4266
|
+
userAccounts: [this.getUserAccount(subAccountId)],
|
|
4267
|
+
});
|
|
4262
4268
|
const ix = await this.program.instruction.enableUserHighLeverageMode(subAccountId, {
|
|
4263
4269
|
accounts: {
|
|
4264
4270
|
state: await this.getStatePublicKey(),
|
|
@@ -4266,14 +4272,20 @@ class DriftClient {
|
|
|
4266
4272
|
authority: this.wallet.publicKey,
|
|
4267
4273
|
highLeverageModeConfig: (0, pda_1.getHighLeverageModeConfigPublicKey)(this.program.programId),
|
|
4268
4274
|
},
|
|
4275
|
+
remainingAccounts,
|
|
4269
4276
|
});
|
|
4270
4277
|
return ix;
|
|
4271
4278
|
}
|
|
4272
|
-
async disableUserHighLeverageMode(user, txParams) {
|
|
4273
|
-
const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getDisableHighLeverageModeIx(user), txParams), [], this.opts);
|
|
4279
|
+
async disableUserHighLeverageMode(user, userAccount, txParams) {
|
|
4280
|
+
const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getDisableHighLeverageModeIx(user, userAccount), txParams), [], this.opts);
|
|
4274
4281
|
return txSig;
|
|
4275
4282
|
}
|
|
4276
|
-
async getDisableHighLeverageModeIx(user) {
|
|
4283
|
+
async getDisableHighLeverageModeIx(user, userAccount) {
|
|
4284
|
+
const remainingAccounts = userAccount
|
|
4285
|
+
? this.getRemainingAccounts({
|
|
4286
|
+
userAccounts: [userAccount],
|
|
4287
|
+
})
|
|
4288
|
+
: undefined;
|
|
4277
4289
|
const ix = await this.program.instruction.disableUserHighLeverageMode({
|
|
4278
4290
|
accounts: {
|
|
4279
4291
|
state: await this.getStatePublicKey(),
|
|
@@ -4281,6 +4293,7 @@ class DriftClient {
|
|
|
4281
4293
|
authority: this.wallet.publicKey,
|
|
4282
4294
|
highLeverageModeConfig: (0, pda_1.getHighLeverageModeConfigPublicKey)(this.program.programId),
|
|
4283
4295
|
},
|
|
4296
|
+
remainingAccounts,
|
|
4284
4297
|
});
|
|
4285
4298
|
return ix;
|
|
4286
4299
|
}
|
package/package.json
CHANGED
package/src/driftClient.ts
CHANGED
|
@@ -6547,7 +6547,10 @@ export class DriftClient {
|
|
|
6547
6547
|
const liquidatorStatsPublicKey = this.getUserStatsAccountPublicKey();
|
|
6548
6548
|
|
|
6549
6549
|
const remainingAccounts = this.getRemainingAccounts({
|
|
6550
|
-
userAccounts: [
|
|
6550
|
+
userAccounts: [
|
|
6551
|
+
userAccount,
|
|
6552
|
+
...makerInfos.map((makerInfo) => makerInfo.makerUserAccount),
|
|
6553
|
+
],
|
|
6551
6554
|
useMarketLastSlotCache: true,
|
|
6552
6555
|
writablePerpMarketIndexes: [marketIndex],
|
|
6553
6556
|
});
|
|
@@ -8120,6 +8123,10 @@ export class DriftClient {
|
|
|
8120
8123
|
}
|
|
8121
8124
|
|
|
8122
8125
|
public async getEnableHighLeverageModeIx(subAccountId: number) {
|
|
8126
|
+
const remainingAccounts = this.getRemainingAccounts({
|
|
8127
|
+
userAccounts: [this.getUserAccount(subAccountId)],
|
|
8128
|
+
});
|
|
8129
|
+
|
|
8123
8130
|
const ix = await this.program.instruction.enableUserHighLeverageMode(
|
|
8124
8131
|
subAccountId,
|
|
8125
8132
|
{
|
|
@@ -8135,6 +8142,7 @@ export class DriftClient {
|
|
|
8135
8142
|
this.program.programId
|
|
8136
8143
|
),
|
|
8137
8144
|
},
|
|
8145
|
+
remainingAccounts,
|
|
8138
8146
|
}
|
|
8139
8147
|
);
|
|
8140
8148
|
|
|
@@ -8143,11 +8151,12 @@ export class DriftClient {
|
|
|
8143
8151
|
|
|
8144
8152
|
public async disableUserHighLeverageMode(
|
|
8145
8153
|
user: PublicKey,
|
|
8154
|
+
userAccount?: UserAccount,
|
|
8146
8155
|
txParams?: TxParams
|
|
8147
8156
|
): Promise<TransactionSignature> {
|
|
8148
8157
|
const { txSig } = await this.sendTransaction(
|
|
8149
8158
|
await this.buildTransaction(
|
|
8150
|
-
await this.getDisableHighLeverageModeIx(user),
|
|
8159
|
+
await this.getDisableHighLeverageModeIx(user, userAccount),
|
|
8151
8160
|
txParams
|
|
8152
8161
|
),
|
|
8153
8162
|
[],
|
|
@@ -8156,7 +8165,16 @@ export class DriftClient {
|
|
|
8156
8165
|
return txSig;
|
|
8157
8166
|
}
|
|
8158
8167
|
|
|
8159
|
-
public async getDisableHighLeverageModeIx(
|
|
8168
|
+
public async getDisableHighLeverageModeIx(
|
|
8169
|
+
user: PublicKey,
|
|
8170
|
+
userAccount?: UserAccount
|
|
8171
|
+
) {
|
|
8172
|
+
const remainingAccounts = userAccount
|
|
8173
|
+
? this.getRemainingAccounts({
|
|
8174
|
+
userAccounts: [userAccount],
|
|
8175
|
+
})
|
|
8176
|
+
: undefined;
|
|
8177
|
+
|
|
8160
8178
|
const ix = await this.program.instruction.disableUserHighLeverageMode({
|
|
8161
8179
|
accounts: {
|
|
8162
8180
|
state: await this.getStatePublicKey(),
|
|
@@ -8166,6 +8184,7 @@ export class DriftClient {
|
|
|
8166
8184
|
this.program.programId
|
|
8167
8185
|
),
|
|
8168
8186
|
},
|
|
8187
|
+
remainingAccounts,
|
|
8169
8188
|
});
|
|
8170
8189
|
|
|
8171
8190
|
return ix;
|