@drift-labs/sdk 2.48.0-beta.0 → 2.48.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 CHANGED
@@ -1 +1 @@
1
- 2.48.0-beta.0
1
+ 2.48.0-beta.2
@@ -2647,9 +2647,9 @@ class DriftClient {
2647
2647
  auctionDuration: auctionDuration || 0,
2648
2648
  auctionStartPrice: auctionStartPrice || numericConstants_1.ZERO,
2649
2649
  auctionEndPrice: auctionEndPrice || numericConstants_1.ZERO,
2650
- reduceOnly: reduceOnly || false,
2651
- postOnly: postOnly || null,
2652
- immediateOrCancel: immediateOrCancel || false,
2650
+ reduceOnly: reduceOnly != undefined ? reduceOnly : null,
2651
+ postOnly: postOnly != undefined ? postOnly : null,
2652
+ immediateOrCancel: immediateOrCancel != undefined ? immediateOrCancel : null,
2653
2653
  policy: policy || null,
2654
2654
  maxTs: maxTs || null,
2655
2655
  };
@@ -2698,9 +2698,9 @@ class DriftClient {
2698
2698
  oraclePriceOffset: newOraclePriceOffset || null,
2699
2699
  triggerPrice: newTriggerPrice || null,
2700
2700
  triggerCondition: newTriggerCondition || null,
2701
- auctionDuration: auctionDuration || 0,
2702
- auctionStartPrice: auctionStartPrice || numericConstants_1.ZERO,
2703
- auctionEndPrice: auctionEndPrice || numericConstants_1.ZERO,
2701
+ auctionDuration: auctionDuration || null,
2702
+ auctionStartPrice: auctionStartPrice || null,
2703
+ auctionEndPrice: auctionEndPrice || null,
2704
2704
  reduceOnly: reduceOnly || false,
2705
2705
  postOnly: postOnly || null,
2706
2706
  immediateOrCancel: immediateOrCancel || false,
@@ -3143,6 +3143,11 @@ class DriftClient {
3143
3143
  }
3144
3144
  else {
3145
3145
  tokenAccount = collateralAccountPublicKey;
3146
+ const tokenAccountExists = await this.checkIfAccountExists(tokenAccount);
3147
+ if (!tokenAccountExists) {
3148
+ const createTokenAccountIx = await this.createAssociatedTokenAccountIdempotentInstruction(tokenAccount, this.wallet.publicKey, this.wallet.publicKey, spotMarketAccount.mint);
3149
+ removeIfStakeIxs.push(createTokenAccountIx);
3150
+ }
3146
3151
  }
3147
3152
  const remainingAccounts = this.getRemainingAccounts({
3148
3153
  userAccounts: [this.getUserAccount()],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.48.0-beta.0",
3
+ "version": "2.48.0-beta.2",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -4654,9 +4654,10 @@ export class DriftClient {
4654
4654
  auctionDuration: auctionDuration || 0,
4655
4655
  auctionStartPrice: auctionStartPrice || ZERO,
4656
4656
  auctionEndPrice: auctionEndPrice || ZERO,
4657
- reduceOnly: reduceOnly || false,
4658
- postOnly: postOnly || null,
4659
- immediateOrCancel: immediateOrCancel || false,
4657
+ reduceOnly: reduceOnly != undefined ? reduceOnly : null,
4658
+ postOnly: postOnly != undefined ? postOnly : null,
4659
+ immediateOrCancel:
4660
+ immediateOrCancel != undefined ? immediateOrCancel : null,
4660
4661
  policy: policy || null,
4661
4662
  maxTs: maxTs || null,
4662
4663
  };
@@ -4769,9 +4770,9 @@ export class DriftClient {
4769
4770
  oraclePriceOffset: newOraclePriceOffset || null,
4770
4771
  triggerPrice: newTriggerPrice || null,
4771
4772
  triggerCondition: newTriggerCondition || null,
4772
- auctionDuration: auctionDuration || 0,
4773
- auctionStartPrice: auctionStartPrice || ZERO,
4774
- auctionEndPrice: auctionEndPrice || ZERO,
4773
+ auctionDuration: auctionDuration || null,
4774
+ auctionStartPrice: auctionStartPrice || null,
4775
+ auctionEndPrice: auctionEndPrice || null,
4775
4776
  reduceOnly: reduceOnly || false,
4776
4777
  postOnly: postOnly || null,
4777
4778
  immediateOrCancel: immediateOrCancel || false,
@@ -5699,6 +5700,17 @@ export class DriftClient {
5699
5700
  });
5700
5701
  } else {
5701
5702
  tokenAccount = collateralAccountPublicKey;
5703
+ const tokenAccountExists = await this.checkIfAccountExists(tokenAccount);
5704
+ if (!tokenAccountExists) {
5705
+ const createTokenAccountIx =
5706
+ await this.createAssociatedTokenAccountIdempotentInstruction(
5707
+ tokenAccount,
5708
+ this.wallet.publicKey,
5709
+ this.wallet.publicKey,
5710
+ spotMarketAccount.mint
5711
+ );
5712
+ removeIfStakeIxs.push(createTokenAccountIx);
5713
+ }
5702
5714
  }
5703
5715
 
5704
5716
  const remainingAccounts = this.getRemainingAccounts({