@meteora-ag/zap-sdk 1.2.0-rc.6 → 1.2.0-rc.7

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
@@ -3390,9 +3390,45 @@ var Zap = class {
3390
3390
  if (!maxAmountQuoteable) {
3391
3391
  return null;
3392
3392
  }
3393
- let left = new import_anchor.BN(1);
3393
+ const defaultLowerBound = inputMint.equals(import_spl_token6.NATIVE_MINT) ? new import_anchor.BN(100) : new import_anchor.BN(1);
3394
+ let left = defaultLowerBound.gt(maxAmount) ? maxAmount : defaultLowerBound;
3394
3395
  let right = maxAmount;
3395
3396
  let best = maxAmount;
3397
+ const leftIsQuoteable = yield this.isJupiterQuoteableAmount(
3398
+ inputMint,
3399
+ outputMint,
3400
+ left,
3401
+ maxAccounts,
3402
+ slippageBps
3403
+ );
3404
+ if (!leftIsQuoteable) {
3405
+ let probe = left;
3406
+ let found = false;
3407
+ while (probe.lt(maxAmount)) {
3408
+ const nextProbe = import_anchor.BN.min(probe.mul(new import_anchor.BN(2)), maxAmount);
3409
+ const nextIsQuoteable = yield this.isJupiterQuoteableAmount(
3410
+ inputMint,
3411
+ outputMint,
3412
+ nextProbe,
3413
+ maxAccounts,
3414
+ slippageBps
3415
+ );
3416
+ if (nextIsQuoteable) {
3417
+ left = probe.add(new import_anchor.BN(1));
3418
+ right = nextProbe;
3419
+ best = nextProbe;
3420
+ found = true;
3421
+ break;
3422
+ }
3423
+ probe = nextProbe;
3424
+ }
3425
+ if (!found) {
3426
+ return null;
3427
+ }
3428
+ } else {
3429
+ best = left;
3430
+ right = left;
3431
+ }
3396
3432
  while (left.lte(right)) {
3397
3433
  const mid = left.add(right).div(new import_anchor.BN(2));
3398
3434
  const isQuoteable = yield this.isJupiterQuoteableAmount(
package/dist/index.mjs CHANGED
@@ -3369,9 +3369,45 @@ var Zap = class {
3369
3369
  if (!maxAmountQuoteable) {
3370
3370
  return null;
3371
3371
  }
3372
- let left = new BN5(1);
3372
+ const defaultLowerBound = inputMint.equals(NATIVE_MINT3) ? new BN5(100) : new BN5(1);
3373
+ let left = defaultLowerBound.gt(maxAmount) ? maxAmount : defaultLowerBound;
3373
3374
  let right = maxAmount;
3374
3375
  let best = maxAmount;
3376
+ const leftIsQuoteable = yield this.isJupiterQuoteableAmount(
3377
+ inputMint,
3378
+ outputMint,
3379
+ left,
3380
+ maxAccounts,
3381
+ slippageBps
3382
+ );
3383
+ if (!leftIsQuoteable) {
3384
+ let probe = left;
3385
+ let found = false;
3386
+ while (probe.lt(maxAmount)) {
3387
+ const nextProbe = BN5.min(probe.mul(new BN5(2)), maxAmount);
3388
+ const nextIsQuoteable = yield this.isJupiterQuoteableAmount(
3389
+ inputMint,
3390
+ outputMint,
3391
+ nextProbe,
3392
+ maxAccounts,
3393
+ slippageBps
3394
+ );
3395
+ if (nextIsQuoteable) {
3396
+ left = probe.add(new BN5(1));
3397
+ right = nextProbe;
3398
+ best = nextProbe;
3399
+ found = true;
3400
+ break;
3401
+ }
3402
+ probe = nextProbe;
3403
+ }
3404
+ if (!found) {
3405
+ return null;
3406
+ }
3407
+ } else {
3408
+ best = left;
3409
+ right = left;
3410
+ }
3375
3411
  while (left.lte(right)) {
3376
3412
  const mid = left.add(right).div(new BN5(2));
3377
3413
  const isQuoteable = yield this.isJupiterQuoteableAmount(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meteora-ag/zap-sdk",
3
- "version": "1.2.0-rc.6",
3
+ "version": "1.2.0-rc.7",
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",