@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.cjs +10 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -69290,7 +69290,7 @@ async function tryBridgedLoop(params, bridgeOpts) {
|
|
|
69290
69290
|
});
|
|
69291
69291
|
const oraclePriceOf = (bank) => params.oraclePrices.get(bank.address.toBase58())?.priceRealtime.price.toNumber() ?? 0;
|
|
69292
69292
|
const borrowBankPrice = oraclePriceOf(borrowBank);
|
|
69293
|
-
if (borrowBankPrice) return null;
|
|
69293
|
+
if (borrowBankPrice <= 0) return null;
|
|
69294
69294
|
const tokenProgramCache = new Map(bridgeOpts?.tokenProgramByMint);
|
|
69295
69295
|
return tryBridgeCandidates({
|
|
69296
69296
|
usableBridgeBanks,
|
|
@@ -69298,9 +69298,9 @@ async function tryBridgedLoop(params, bridgeOpts) {
|
|
|
69298
69298
|
bridgeTokenSide: "borrow",
|
|
69299
69299
|
abortSignal: bridgeOpts?.abortSignal,
|
|
69300
69300
|
buildBundleThroughBridge: async (bridgeBank) => {
|
|
69301
|
-
const
|
|
69302
|
-
if (
|
|
69303
|
-
const bridgeBorrowUi = params.borrowOpts.borrowAmount * borrowBankPrice /
|
|
69301
|
+
const bridgeBankPrice = oraclePriceOf(bridgeBank);
|
|
69302
|
+
if (bridgeBankPrice <= 0) return null;
|
|
69303
|
+
const bridgeBorrowUi = params.borrowOpts.borrowAmount * borrowBankPrice / bridgeBankPrice;
|
|
69304
69304
|
if (bridgeBorrowUi <= 0) return null;
|
|
69305
69305
|
const bridgeTokenProgram = await resolveTokenProgramForMint(
|
|
69306
69306
|
bridgeBank.mint,
|
|
@@ -69317,7 +69317,7 @@ async function tryBridgedLoop(params, bridgeOpts) {
|
|
|
69317
69317
|
borrowAmount: bridgeBorrowUi,
|
|
69318
69318
|
borrowBank: bridgeBank,
|
|
69319
69319
|
tokenProgram: bridgeTokenProgram,
|
|
69320
|
-
marketPrice:
|
|
69320
|
+
marketPrice: bridgeBankPrice
|
|
69321
69321
|
}
|
|
69322
69322
|
});
|
|
69323
69323
|
if (!firstLeg.quoteResponse) return null;
|
|
@@ -69333,7 +69333,7 @@ async function tryBridgedLoop(params, bridgeOpts) {
|
|
|
69333
69333
|
repayAmount: bridgeBorrowUi,
|
|
69334
69334
|
repayBank: bridgeBank,
|
|
69335
69335
|
tokenProgram: bridgeTokenProgram,
|
|
69336
|
-
marketPrice:
|
|
69336
|
+
marketPrice: bridgeBankPrice
|
|
69337
69337
|
},
|
|
69338
69338
|
borrowOpts: {
|
|
69339
69339
|
borrowBank,
|
|
@@ -71774,6 +71774,10 @@ async function tryBridgeCandidates(args) {
|
|
|
71774
71774
|
if (result) return result;
|
|
71775
71775
|
} catch (e) {
|
|
71776
71776
|
if (isAbortError(e)) throw e;
|
|
71777
|
+
console.warn(
|
|
71778
|
+
`[bridge-routing] candidate ${bridgeBank.tokenSymbol ?? bridgeBank.mint.toBase58()} failed:`,
|
|
71779
|
+
e instanceof Error ? e.message : e
|
|
71780
|
+
);
|
|
71777
71781
|
}
|
|
71778
71782
|
}
|
|
71779
71783
|
if (args.usableBridgeBanks.length === 0 && args.conflictingBridgeBanks.length > 0) {
|