@0dotxyz/p0-ts-sdk 2.5.5-alpha.5 → 2.5.5-alpha.6

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
@@ -69262,7 +69262,7 @@ async function tryBridgedLoop(params, bridgeOpts) {
69262
69262
  });
69263
69263
  const oraclePriceOf = (bank) => params.oraclePrices.get(bank.address.toBase58())?.priceRealtime.price.toNumber() ?? 0;
69264
69264
  const borrowBankPrice = oraclePriceOf(borrowBank);
69265
- if (borrowBankPrice) return null;
69265
+ if (borrowBankPrice <= 0) return null;
69266
69266
  const tokenProgramCache = new Map(bridgeOpts?.tokenProgramByMint);
69267
69267
  return tryBridgeCandidates({
69268
69268
  usableBridgeBanks,
@@ -69270,9 +69270,9 @@ async function tryBridgedLoop(params, bridgeOpts) {
69270
69270
  bridgeTokenSide: "borrow",
69271
69271
  abortSignal: bridgeOpts?.abortSignal,
69272
69272
  buildBundleThroughBridge: async (bridgeBank) => {
69273
- const birdgeBankPrice = oraclePriceOf(bridgeBank);
69274
- if (birdgeBankPrice <= 0) return null;
69275
- const bridgeBorrowUi = params.borrowOpts.borrowAmount * borrowBankPrice / birdgeBankPrice;
69273
+ const bridgeBankPrice = oraclePriceOf(bridgeBank);
69274
+ if (bridgeBankPrice <= 0) return null;
69275
+ const bridgeBorrowUi = params.borrowOpts.borrowAmount * borrowBankPrice / bridgeBankPrice;
69276
69276
  if (bridgeBorrowUi <= 0) return null;
69277
69277
  const bridgeTokenProgram = await resolveTokenProgramForMint(
69278
69278
  bridgeBank.mint,
@@ -69289,7 +69289,7 @@ async function tryBridgedLoop(params, bridgeOpts) {
69289
69289
  borrowAmount: bridgeBorrowUi,
69290
69290
  borrowBank: bridgeBank,
69291
69291
  tokenProgram: bridgeTokenProgram,
69292
- marketPrice: birdgeBankPrice
69292
+ marketPrice: bridgeBankPrice
69293
69293
  }
69294
69294
  });
69295
69295
  if (!firstLeg.quoteResponse) return null;
@@ -69305,7 +69305,7 @@ async function tryBridgedLoop(params, bridgeOpts) {
69305
69305
  repayAmount: bridgeBorrowUi,
69306
69306
  repayBank: bridgeBank,
69307
69307
  tokenProgram: bridgeTokenProgram,
69308
- marketPrice: birdgeBankPrice
69308
+ marketPrice: bridgeBankPrice
69309
69309
  },
69310
69310
  borrowOpts: {
69311
69311
  borrowBank,
@@ -71746,6 +71746,10 @@ async function tryBridgeCandidates(args) {
71746
71746
  if (result) return result;
71747
71747
  } catch (e) {
71748
71748
  if (isAbortError(e)) throw e;
71749
+ console.warn(
71750
+ `[bridge-routing] candidate ${bridgeBank.tokenSymbol ?? bridgeBank.mint.toBase58()} failed:`,
71751
+ e instanceof Error ? e.message : e
71752
+ );
71749
71753
  }
71750
71754
  }
71751
71755
  if (args.usableBridgeBanks.length === 0 && args.conflictingBridgeBanks.length > 0) {