@drift-labs/sdk 2.98.0-beta.2 → 2.98.0-beta.3
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 +6 -2
- package/lib/browser/driftClient.js +10 -2
- package/lib/node/driftClient.d.ts +6 -2
- package/lib/node/driftClient.js +10 -2
- package/package.json +1 -1
- package/src/driftClient.ts +19 -3
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.98.0-beta.
|
|
1
|
+
2.98.0-beta.3
|
|
@@ -798,9 +798,13 @@ export declare class DriftClient {
|
|
|
798
798
|
postSwitchboardOnDemandUpdate(feed: PublicKey, numSignatures?: number): Promise<TransactionSignature>;
|
|
799
799
|
private getBuildEncodedVaaIxs;
|
|
800
800
|
enableUserHighLeverageMode(subAccountId: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
801
|
-
getEnableHighLeverageModeIx(subAccountId: number
|
|
801
|
+
getEnableHighLeverageModeIx(subAccountId: number, depositToTradeArgs?: {
|
|
802
|
+
isMakingNewAccount: boolean;
|
|
803
|
+
depositMarketIndex: number;
|
|
804
|
+
orderMarketIndex: number;
|
|
805
|
+
}): Promise<TransactionInstruction>;
|
|
802
806
|
disableUserHighLeverageMode(user: PublicKey, userAccount?: UserAccount, txParams?: TxParams): Promise<TransactionSignature>;
|
|
803
|
-
getDisableHighLeverageModeIx(user: PublicKey, userAccount?: UserAccount): Promise<
|
|
807
|
+
getDisableHighLeverageModeIx(user: PublicKey, userAccount?: UserAccount): Promise<TransactionInstruction>;
|
|
804
808
|
fetchHighLeverageModeConfig(): Promise<HighLeverageModeConfig>;
|
|
805
809
|
private handleSignedTransaction;
|
|
806
810
|
private handlePreSignedTransaction;
|
|
@@ -4372,9 +4372,17 @@ class DriftClient {
|
|
|
4372
4372
|
const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getEnableHighLeverageModeIx(subAccountId), txParams), [], this.opts);
|
|
4373
4373
|
return txSig;
|
|
4374
4374
|
}
|
|
4375
|
-
async getEnableHighLeverageModeIx(subAccountId) {
|
|
4375
|
+
async getEnableHighLeverageModeIx(subAccountId, depositToTradeArgs) {
|
|
4376
|
+
const isDepositToTradeTx = depositToTradeArgs !== undefined;
|
|
4376
4377
|
const remainingAccounts = this.getRemainingAccounts({
|
|
4377
|
-
userAccounts:
|
|
4378
|
+
userAccounts: (depositToTradeArgs === null || depositToTradeArgs === void 0 ? void 0 : depositToTradeArgs.isMakingNewAccount)
|
|
4379
|
+
? []
|
|
4380
|
+
: [this.getUserAccount(subAccountId)],
|
|
4381
|
+
useMarketLastSlotCache: false,
|
|
4382
|
+
readablePerpMarketIndex: depositToTradeArgs === null || depositToTradeArgs === void 0 ? void 0 : depositToTradeArgs.orderMarketIndex,
|
|
4383
|
+
readableSpotMarketIndexes: isDepositToTradeTx
|
|
4384
|
+
? [depositToTradeArgs === null || depositToTradeArgs === void 0 ? void 0 : depositToTradeArgs.depositMarketIndex]
|
|
4385
|
+
: undefined,
|
|
4378
4386
|
});
|
|
4379
4387
|
const ix = await this.program.instruction.enableUserHighLeverageMode(subAccountId, {
|
|
4380
4388
|
accounts: {
|
|
@@ -798,9 +798,13 @@ export declare class DriftClient {
|
|
|
798
798
|
postSwitchboardOnDemandUpdate(feed: PublicKey, numSignatures?: number): Promise<TransactionSignature>;
|
|
799
799
|
private getBuildEncodedVaaIxs;
|
|
800
800
|
enableUserHighLeverageMode(subAccountId: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
801
|
-
getEnableHighLeverageModeIx(subAccountId: number
|
|
801
|
+
getEnableHighLeverageModeIx(subAccountId: number, depositToTradeArgs?: {
|
|
802
|
+
isMakingNewAccount: boolean;
|
|
803
|
+
depositMarketIndex: number;
|
|
804
|
+
orderMarketIndex: number;
|
|
805
|
+
}): Promise<TransactionInstruction>;
|
|
802
806
|
disableUserHighLeverageMode(user: PublicKey, userAccount?: UserAccount, txParams?: TxParams): Promise<TransactionSignature>;
|
|
803
|
-
getDisableHighLeverageModeIx(user: PublicKey, userAccount?: UserAccount): Promise<
|
|
807
|
+
getDisableHighLeverageModeIx(user: PublicKey, userAccount?: UserAccount): Promise<TransactionInstruction>;
|
|
804
808
|
fetchHighLeverageModeConfig(): Promise<HighLeverageModeConfig>;
|
|
805
809
|
private handleSignedTransaction;
|
|
806
810
|
private handlePreSignedTransaction;
|
package/lib/node/driftClient.js
CHANGED
|
@@ -4372,9 +4372,17 @@ class DriftClient {
|
|
|
4372
4372
|
const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getEnableHighLeverageModeIx(subAccountId), txParams), [], this.opts);
|
|
4373
4373
|
return txSig;
|
|
4374
4374
|
}
|
|
4375
|
-
async getEnableHighLeverageModeIx(subAccountId) {
|
|
4375
|
+
async getEnableHighLeverageModeIx(subAccountId, depositToTradeArgs) {
|
|
4376
|
+
const isDepositToTradeTx = depositToTradeArgs !== undefined;
|
|
4376
4377
|
const remainingAccounts = this.getRemainingAccounts({
|
|
4377
|
-
userAccounts:
|
|
4378
|
+
userAccounts: (depositToTradeArgs === null || depositToTradeArgs === void 0 ? void 0 : depositToTradeArgs.isMakingNewAccount)
|
|
4379
|
+
? []
|
|
4380
|
+
: [this.getUserAccount(subAccountId)],
|
|
4381
|
+
useMarketLastSlotCache: false,
|
|
4382
|
+
readablePerpMarketIndex: depositToTradeArgs === null || depositToTradeArgs === void 0 ? void 0 : depositToTradeArgs.orderMarketIndex,
|
|
4383
|
+
readableSpotMarketIndexes: isDepositToTradeTx
|
|
4384
|
+
? [depositToTradeArgs === null || depositToTradeArgs === void 0 ? void 0 : depositToTradeArgs.depositMarketIndex]
|
|
4385
|
+
: undefined,
|
|
4378
4386
|
});
|
|
4379
4387
|
const ix = await this.program.instruction.enableUserHighLeverageMode(subAccountId, {
|
|
4380
4388
|
accounts: {
|
package/package.json
CHANGED
package/src/driftClient.ts
CHANGED
|
@@ -8300,9 +8300,25 @@ export class DriftClient {
|
|
|
8300
8300
|
return txSig;
|
|
8301
8301
|
}
|
|
8302
8302
|
|
|
8303
|
-
public async getEnableHighLeverageModeIx(
|
|
8303
|
+
public async getEnableHighLeverageModeIx(
|
|
8304
|
+
subAccountId: number,
|
|
8305
|
+
depositToTradeArgs?: {
|
|
8306
|
+
isMakingNewAccount: boolean;
|
|
8307
|
+
depositMarketIndex: number;
|
|
8308
|
+
orderMarketIndex: number;
|
|
8309
|
+
}
|
|
8310
|
+
): Promise<TransactionInstruction> {
|
|
8311
|
+
const isDepositToTradeTx = depositToTradeArgs !== undefined;
|
|
8312
|
+
|
|
8304
8313
|
const remainingAccounts = this.getRemainingAccounts({
|
|
8305
|
-
userAccounts:
|
|
8314
|
+
userAccounts: depositToTradeArgs?.isMakingNewAccount
|
|
8315
|
+
? []
|
|
8316
|
+
: [this.getUserAccount(subAccountId)],
|
|
8317
|
+
useMarketLastSlotCache: false,
|
|
8318
|
+
readablePerpMarketIndex: depositToTradeArgs?.orderMarketIndex,
|
|
8319
|
+
readableSpotMarketIndexes: isDepositToTradeTx
|
|
8320
|
+
? [depositToTradeArgs?.depositMarketIndex]
|
|
8321
|
+
: undefined,
|
|
8306
8322
|
});
|
|
8307
8323
|
|
|
8308
8324
|
const ix = await this.program.instruction.enableUserHighLeverageMode(
|
|
@@ -8346,7 +8362,7 @@ export class DriftClient {
|
|
|
8346
8362
|
public async getDisableHighLeverageModeIx(
|
|
8347
8363
|
user: PublicKey,
|
|
8348
8364
|
userAccount?: UserAccount
|
|
8349
|
-
) {
|
|
8365
|
+
): Promise<TransactionInstruction> {
|
|
8350
8366
|
const remainingAccounts = userAccount
|
|
8351
8367
|
? this.getRemainingAccounts({
|
|
8352
8368
|
userAccounts: [userAccount],
|