@meteora-ag/zap-sdk 1.2.0-rc.0 → 1.2.0-rc.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/dist/index.js CHANGED
@@ -3863,16 +3863,12 @@ var Zap = class {
3863
3863
  )
3864
3864
  );
3865
3865
  const swapAmountToB = amountIn.sub(swapAmountToA);
3866
- const MIN_SWAP_AMOUNT = new import_anchor.BN(1e3);
3867
- if (swapAmountToB.lt(MIN_SWAP_AMOUNT)) {
3868
- const {
3869
- transaction: swapTransaction,
3870
- quoteResponse: swapToAQuote2
3871
- } = yield buildJupiterSwapTransaction(
3866
+ if (swapAmountToA.isZero()) {
3867
+ const { transaction: swapToBTransaction2, quoteResponse: swapToBQuote2 } = yield buildJupiterSwapTransaction(
3872
3868
  user,
3873
3869
  inputTokenMint,
3874
- tokenAMint,
3875
- amountIn,
3870
+ tokenBMint,
3871
+ swapAmountToB,
3876
3872
  maxAccounts,
3877
3873
  slippageBps,
3878
3874
  void 0,
@@ -3895,33 +3891,30 @@ var Zap = class {
3895
3891
  tokenBVault,
3896
3892
  tokenAProgram,
3897
3893
  tokenBProgram,
3898
- maxTransferAmountA: getExtendMaxAmountTransfer(
3899
- swapToAQuote2.outAmount,
3894
+ maxTransferAmountA: new import_anchor.BN(0),
3895
+ maxTransferAmountB: getExtendMaxAmountTransfer(
3896
+ swapToBQuote2.outAmount,
3900
3897
  maxTransferAmountExtendPercentage
3901
3898
  ),
3902
- swapType: 0 /* swapToA */,
3903
- maxTransferAmountB: new import_anchor.BN(0),
3899
+ swapType: 1 /* swapToB */,
3904
3900
  preSqrtPrice: poolState.sqrtPrice,
3905
3901
  preInstructions,
3906
- swapTransactions: [swapTransaction],
3902
+ swapTransactions: [swapToBTransaction2],
3907
3903
  cleanUpInstructions,
3908
3904
  swapInEstimate: {
3909
- inAmountA: amountIn,
3910
- inAmountB: new import_anchor.BN(0),
3911
- routeA: "jupiter" /* Jupiter */,
3912
- routeB: "dammV2" /* DammV2 */
3905
+ inAmountA: new import_anchor.BN(0),
3906
+ inAmountB: swapAmountToB,
3907
+ routeA: "dammV2" /* DammV2 */,
3908
+ routeB: "jupiter" /* Jupiter */
3913
3909
  }
3914
3910
  };
3915
3911
  }
3916
- if (swapAmountToA.lt(MIN_SWAP_AMOUNT)) {
3917
- const {
3918
- transaction: swapTransaction,
3919
- quoteResponse: swapToBQuote2
3920
- } = yield buildJupiterSwapTransaction(
3912
+ if (swapAmountToB.isZero()) {
3913
+ const { transaction: swapToATransaction2, quoteResponse: swapToAQuote2 } = yield buildJupiterSwapTransaction(
3921
3914
  user,
3922
3915
  inputTokenMint,
3923
- tokenBMint,
3924
- amountIn,
3916
+ tokenAMint,
3917
+ swapAmountToA,
3925
3918
  maxAccounts,
3926
3919
  slippageBps,
3927
3920
  void 0,
@@ -3944,21 +3937,21 @@ var Zap = class {
3944
3937
  tokenBVault,
3945
3938
  tokenAProgram,
3946
3939
  tokenBProgram,
3947
- maxTransferAmountA: new import_anchor.BN(0),
3948
- maxTransferAmountB: getExtendMaxAmountTransfer(
3949
- swapToBQuote2.outAmount,
3940
+ maxTransferAmountA: getExtendMaxAmountTransfer(
3941
+ swapToAQuote2.outAmount,
3950
3942
  maxTransferAmountExtendPercentage
3951
3943
  ),
3952
- swapType: 1 /* swapToB */,
3944
+ maxTransferAmountB: new import_anchor.BN(0),
3945
+ swapType: 0 /* swapToA */,
3953
3946
  preSqrtPrice: poolState.sqrtPrice,
3954
3947
  preInstructions,
3955
- swapTransactions: [swapTransaction],
3948
+ swapTransactions: [swapToATransaction2],
3956
3949
  cleanUpInstructions,
3957
3950
  swapInEstimate: {
3958
- inAmountA: new import_anchor.BN(0),
3959
- inAmountB: amountIn,
3960
- routeA: "dammV2" /* DammV2 */,
3961
- routeB: "jupiter" /* Jupiter */
3951
+ inAmountA: swapAmountToA,
3952
+ inAmountB: new import_anchor.BN(0),
3953
+ routeA: "jupiter" /* Jupiter */,
3954
+ routeB: "dammV2" /* DammV2 */
3962
3955
  }
3963
3956
  };
3964
3957
  }
package/dist/index.mjs CHANGED
@@ -3842,16 +3842,12 @@ var Zap = class {
3842
3842
  )
3843
3843
  );
3844
3844
  const swapAmountToB = amountIn.sub(swapAmountToA);
3845
- const MIN_SWAP_AMOUNT = new BN5(1e3);
3846
- if (swapAmountToB.lt(MIN_SWAP_AMOUNT)) {
3847
- const {
3848
- transaction: swapTransaction,
3849
- quoteResponse: swapToAQuote2
3850
- } = yield buildJupiterSwapTransaction(
3845
+ if (swapAmountToA.isZero()) {
3846
+ const { transaction: swapToBTransaction2, quoteResponse: swapToBQuote2 } = yield buildJupiterSwapTransaction(
3851
3847
  user,
3852
3848
  inputTokenMint,
3853
- tokenAMint,
3854
- amountIn,
3849
+ tokenBMint,
3850
+ swapAmountToB,
3855
3851
  maxAccounts,
3856
3852
  slippageBps,
3857
3853
  void 0,
@@ -3874,33 +3870,30 @@ var Zap = class {
3874
3870
  tokenBVault,
3875
3871
  tokenAProgram,
3876
3872
  tokenBProgram,
3877
- maxTransferAmountA: getExtendMaxAmountTransfer(
3878
- swapToAQuote2.outAmount,
3873
+ maxTransferAmountA: new BN5(0),
3874
+ maxTransferAmountB: getExtendMaxAmountTransfer(
3875
+ swapToBQuote2.outAmount,
3879
3876
  maxTransferAmountExtendPercentage
3880
3877
  ),
3881
- swapType: 0 /* swapToA */,
3882
- maxTransferAmountB: new BN5(0),
3878
+ swapType: 1 /* swapToB */,
3883
3879
  preSqrtPrice: poolState.sqrtPrice,
3884
3880
  preInstructions,
3885
- swapTransactions: [swapTransaction],
3881
+ swapTransactions: [swapToBTransaction2],
3886
3882
  cleanUpInstructions,
3887
3883
  swapInEstimate: {
3888
- inAmountA: amountIn,
3889
- inAmountB: new BN5(0),
3890
- routeA: "jupiter" /* Jupiter */,
3891
- routeB: "dammV2" /* DammV2 */
3884
+ inAmountA: new BN5(0),
3885
+ inAmountB: swapAmountToB,
3886
+ routeA: "dammV2" /* DammV2 */,
3887
+ routeB: "jupiter" /* Jupiter */
3892
3888
  }
3893
3889
  };
3894
3890
  }
3895
- if (swapAmountToA.lt(MIN_SWAP_AMOUNT)) {
3896
- const {
3897
- transaction: swapTransaction,
3898
- quoteResponse: swapToBQuote2
3899
- } = yield buildJupiterSwapTransaction(
3891
+ if (swapAmountToB.isZero()) {
3892
+ const { transaction: swapToATransaction2, quoteResponse: swapToAQuote2 } = yield buildJupiterSwapTransaction(
3900
3893
  user,
3901
3894
  inputTokenMint,
3902
- tokenBMint,
3903
- amountIn,
3895
+ tokenAMint,
3896
+ swapAmountToA,
3904
3897
  maxAccounts,
3905
3898
  slippageBps,
3906
3899
  void 0,
@@ -3923,21 +3916,21 @@ var Zap = class {
3923
3916
  tokenBVault,
3924
3917
  tokenAProgram,
3925
3918
  tokenBProgram,
3926
- maxTransferAmountA: new BN5(0),
3927
- maxTransferAmountB: getExtendMaxAmountTransfer(
3928
- swapToBQuote2.outAmount,
3919
+ maxTransferAmountA: getExtendMaxAmountTransfer(
3920
+ swapToAQuote2.outAmount,
3929
3921
  maxTransferAmountExtendPercentage
3930
3922
  ),
3931
- swapType: 1 /* swapToB */,
3923
+ maxTransferAmountB: new BN5(0),
3924
+ swapType: 0 /* swapToA */,
3932
3925
  preSqrtPrice: poolState.sqrtPrice,
3933
3926
  preInstructions,
3934
- swapTransactions: [swapTransaction],
3927
+ swapTransactions: [swapToATransaction2],
3935
3928
  cleanUpInstructions,
3936
3929
  swapInEstimate: {
3937
- inAmountA: new BN5(0),
3938
- inAmountB: amountIn,
3939
- routeA: "dammV2" /* DammV2 */,
3940
- routeB: "jupiter" /* Jupiter */
3930
+ inAmountA: swapAmountToA,
3931
+ inAmountB: new BN5(0),
3932
+ routeA: "jupiter" /* Jupiter */,
3933
+ routeB: "dammV2" /* DammV2 */
3941
3934
  }
3942
3935
  };
3943
3936
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meteora-ag/zap-sdk",
3
- "version": "1.2.0-rc.0",
3
+ "version": "1.2.0-rc.2",
4
4
  "description": "A Typescript SDK for interacting with the Zap program on Meteora.",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -32,17 +32,17 @@
32
32
  "@types/bn.js": "^5.1.0",
33
33
  "@types/bun": "latest",
34
34
  "@types/invariant": "^2.2.37",
35
- "bip39": "^3.1.0",
36
- "ed25519-hd-key": "^1.3.0",
37
35
  "tsup": "^8.4.0",
38
- "tsx": "^4.20.3"
36
+ "tsx": "^4.20.3",
37
+ "bip39": "^3.1.0",
38
+ "ed25519-hd-key": "^1.3.0"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "typescript": "^5"
42
42
  },
43
43
  "dependencies": {
44
44
  "@coral-xyz/anchor": "^0.31.1",
45
- "@meteora-ag/cp-amm-sdk": "^1.3.6",
45
+ "@meteora-ag/cp-amm-sdk": "^1.2.3",
46
46
  "@meteora-ag/dlmm": "^1.9.0",
47
47
  "@solana/spl-token": "^0.4.13",
48
48
  "@solana/web3.js": "^1.98.2",