@meteora-ag/zap-sdk 1.2.0-rc.8 → 1.2.0-rc.9

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
@@ -3567,32 +3567,38 @@ var Zap = class {
3567
3567
  maxTransferAmount = new import_anchor.BN(0);
3568
3568
  swapRoute = "dammV2" /* DammV2 */;
3569
3569
  } else if (singleSidedA && !isInputTokenA || singleSidedB && isInputTokenA) {
3570
- if (jupiterQuote === null) {
3570
+ if (jupiterQuote !== null && (dammV2Quote === null || new import_anchor.BN(jupiterQuote.outAmount).gte(dammV2Quote.swapOutAmount))) {
3571
+ swapInAmount = amountIn;
3572
+ amount = new import_anchor.BN(0);
3573
+ const result = yield buildJupiterSwapTransaction(
3574
+ user,
3575
+ inputTokenMint,
3576
+ outputTokenMint,
3577
+ swapInAmount,
3578
+ maxAccounts,
3579
+ slippageBps,
3580
+ void 0,
3581
+ {
3582
+ jupiterApiUrl: this.jupiterApiUrl,
3583
+ jupiterApiKey: this.jupiterApiKey
3584
+ }
3585
+ );
3586
+ swapTransactions = [result.transaction];
3587
+ maxTransferAmount = getExtendMaxAmountTransfer(
3588
+ result.quoteResponse.outAmount,
3589
+ maxTransferAmountExtendPercentage
3590
+ );
3591
+ swapRoute = "jupiter" /* Jupiter */;
3592
+ } else if (dammV2Quote !== null) {
3593
+ swapInAmount = new import_anchor.BN(0);
3594
+ amount = amountIn;
3595
+ maxTransferAmount = new import_anchor.BN(0);
3596
+ swapRoute = "dammV2" /* DammV2 */;
3597
+ } else {
3571
3598
  throw new Error(
3572
- "No Jupiter quote found for single-sided swap, unable to proceed"
3599
+ "No Jupiter or DAMM v2 quote found for single-sided swap, unable to proceed"
3573
3600
  );
3574
3601
  }
3575
- swapInAmount = amountIn;
3576
- amount = new import_anchor.BN(0);
3577
- const result = yield buildJupiterSwapTransaction(
3578
- user,
3579
- inputTokenMint,
3580
- outputTokenMint,
3581
- swapInAmount,
3582
- maxAccounts,
3583
- slippageBps,
3584
- void 0,
3585
- {
3586
- jupiterApiUrl: this.jupiterApiUrl,
3587
- jupiterApiKey: this.jupiterApiKey
3588
- }
3589
- );
3590
- swapTransactions = [result.transaction];
3591
- maxTransferAmount = getExtendMaxAmountTransfer(
3592
- result.quoteResponse.outAmount,
3593
- maxTransferAmountExtendPercentage
3594
- );
3595
- swapRoute = "jupiter" /* Jupiter */;
3596
3602
  } else if (jupiterQuote !== null && (dammV2Quote === null || new import_anchor.BN(jupiterQuote.outAmount).gte(dammV2Quote.swapOutAmount))) {
3597
3603
  const price = convertLamportsToUiAmount(
3598
3604
  new import_decimal4.default(jupiterQuote.outAmount),
package/dist/index.mjs CHANGED
@@ -3548,32 +3548,38 @@ var Zap = class {
3548
3548
  maxTransferAmount = new BN5(0);
3549
3549
  swapRoute = "dammV2" /* DammV2 */;
3550
3550
  } else if (singleSidedA && !isInputTokenA || singleSidedB && isInputTokenA) {
3551
- if (jupiterQuote === null) {
3551
+ if (jupiterQuote !== null && (dammV2Quote === null || new BN5(jupiterQuote.outAmount).gte(dammV2Quote.swapOutAmount))) {
3552
+ swapInAmount = amountIn;
3553
+ amount = new BN5(0);
3554
+ const result = yield buildJupiterSwapTransaction(
3555
+ user,
3556
+ inputTokenMint,
3557
+ outputTokenMint,
3558
+ swapInAmount,
3559
+ maxAccounts,
3560
+ slippageBps,
3561
+ void 0,
3562
+ {
3563
+ jupiterApiUrl: this.jupiterApiUrl,
3564
+ jupiterApiKey: this.jupiterApiKey
3565
+ }
3566
+ );
3567
+ swapTransactions = [result.transaction];
3568
+ maxTransferAmount = getExtendMaxAmountTransfer(
3569
+ result.quoteResponse.outAmount,
3570
+ maxTransferAmountExtendPercentage
3571
+ );
3572
+ swapRoute = "jupiter" /* Jupiter */;
3573
+ } else if (dammV2Quote !== null) {
3574
+ swapInAmount = new BN5(0);
3575
+ amount = amountIn;
3576
+ maxTransferAmount = new BN5(0);
3577
+ swapRoute = "dammV2" /* DammV2 */;
3578
+ } else {
3552
3579
  throw new Error(
3553
- "No Jupiter quote found for single-sided swap, unable to proceed"
3580
+ "No Jupiter or DAMM v2 quote found for single-sided swap, unable to proceed"
3554
3581
  );
3555
3582
  }
3556
- swapInAmount = amountIn;
3557
- amount = new BN5(0);
3558
- const result = yield buildJupiterSwapTransaction(
3559
- user,
3560
- inputTokenMint,
3561
- outputTokenMint,
3562
- swapInAmount,
3563
- maxAccounts,
3564
- slippageBps,
3565
- void 0,
3566
- {
3567
- jupiterApiUrl: this.jupiterApiUrl,
3568
- jupiterApiKey: this.jupiterApiKey
3569
- }
3570
- );
3571
- swapTransactions = [result.transaction];
3572
- maxTransferAmount = getExtendMaxAmountTransfer(
3573
- result.quoteResponse.outAmount,
3574
- maxTransferAmountExtendPercentage
3575
- );
3576
- swapRoute = "jupiter" /* Jupiter */;
3577
3583
  } else if (jupiterQuote !== null && (dammV2Quote === null || new BN5(jupiterQuote.outAmount).gte(dammV2Quote.swapOutAmount))) {
3578
3584
  const price = convertLamportsToUiAmount(
3579
3585
  new Decimal4(jupiterQuote.outAmount),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meteora-ag/zap-sdk",
3
- "version": "1.2.0-rc.8",
3
+ "version": "1.2.0-rc.9",
4
4
  "description": "A Typescript SDK for interacting with the Zap program on Meteora.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",