@hyperbridge/sdk 2.8.0 → 2.8.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.
@@ -1,4 +1,4 @@
1
- export { br as AggregationLogger, bs as BidNonceKeyFn, bt as BidSignature, bu as ENTRY_POINT_V08_ADDRESS, bv as FILL_ORDER_ABI, bw as FetchLike, bx as FillData, by as HexString, bz as IntentGatewayV2, bA as LpBalance, bB as OrderCommitmentFn, bC as PhantomAggregation, bD as PhantomLegAggregation, bE as PhantomLegBidder, bF as RecoverBidSigner, bG as RpcBidInfo, bH as SolverBalanceReader, bI as YieldVaultMap, bJ as aggregatePhantomBids, ba as decodeAcceptedSourceChains, bb as decodeERC7821ExecuteBatch, bc as decodeUserOpScale, bd as encodeAcceptedSourceChains, be as encodeERC7821ExecuteBatch, bg as encodeUserOpScale, bK as extractFillData, bL as fetchBidsForOrder, bM as memoizedSolverBalance, bN as orderCommitmentFromDecoded, bO as recoverBidSignerViem, bP as setAggregationFetch, bQ as splitBidSignature, bR as weightedMedian, bS as zipFillLegs } from './intents-helpers-gyGREuyu.cjs';
1
+ export { br as AggregationLogger, bs as BidNonceKeyFn, bt as BidSignature, bu as ENTRY_POINT_V08_ADDRESS, bv as FILL_ORDER_ABI, bw as FetchLike, bx as FillData, by as HexString, bz as IntentGatewayV2, bA as LpBalance, bB as OrderCommitmentFn, bC as PhantomAggregation, bD as PhantomLegAggregation, bE as PhantomLegBidder, bF as RecoverBidSigner, bG as RpcBidInfo, bH as SolverBalanceReader, bI as YieldVaultMap, bJ as aggregatePhantomBids, ba as decodeAcceptedSourceChains, bb as decodeERC7821ExecuteBatch, bc as decodeUserOpScale, bd as encodeAcceptedSourceChains, be as encodeERC7821ExecuteBatch, bg as encodeUserOpScale, bK as extractFillData, bL as fetchBidsForOrder, bM as memoizedSolverBalance, bN as orderCommitmentFromDecoded, bO as recoverBidSignerViem, bP as setAggregationFetch, bQ as splitBidSignature, bR as weightedMedian, bS as zipFillLegs } from './intents-helpers-D_km9I2f.cjs';
2
2
  import 'consola';
3
3
  import 'decimal.js';
4
4
  import 'graphql-request';
@@ -1,4 +1,4 @@
1
- export { br as AggregationLogger, bs as BidNonceKeyFn, bt as BidSignature, bu as ENTRY_POINT_V08_ADDRESS, bv as FILL_ORDER_ABI, bw as FetchLike, bx as FillData, by as HexString, bz as IntentGatewayV2, bA as LpBalance, bB as OrderCommitmentFn, bC as PhantomAggregation, bD as PhantomLegAggregation, bE as PhantomLegBidder, bF as RecoverBidSigner, bG as RpcBidInfo, bH as SolverBalanceReader, bI as YieldVaultMap, bJ as aggregatePhantomBids, ba as decodeAcceptedSourceChains, bb as decodeERC7821ExecuteBatch, bc as decodeUserOpScale, bd as encodeAcceptedSourceChains, be as encodeERC7821ExecuteBatch, bg as encodeUserOpScale, bK as extractFillData, bL as fetchBidsForOrder, bM as memoizedSolverBalance, bN as orderCommitmentFromDecoded, bO as recoverBidSignerViem, bP as setAggregationFetch, bQ as splitBidSignature, bR as weightedMedian, bS as zipFillLegs } from './intents-helpers-gyGREuyu.js';
1
+ export { br as AggregationLogger, bs as BidNonceKeyFn, bt as BidSignature, bu as ENTRY_POINT_V08_ADDRESS, bv as FILL_ORDER_ABI, bw as FetchLike, bx as FillData, by as HexString, bz as IntentGatewayV2, bA as LpBalance, bB as OrderCommitmentFn, bC as PhantomAggregation, bD as PhantomLegAggregation, bE as PhantomLegBidder, bF as RecoverBidSigner, bG as RpcBidInfo, bH as SolverBalanceReader, bI as YieldVaultMap, bJ as aggregatePhantomBids, ba as decodeAcceptedSourceChains, bb as decodeERC7821ExecuteBatch, bc as decodeUserOpScale, bd as encodeAcceptedSourceChains, be as encodeERC7821ExecuteBatch, bg as encodeUserOpScale, bK as extractFillData, bL as fetchBidsForOrder, bM as memoizedSolverBalance, bN as orderCommitmentFromDecoded, bO as recoverBidSignerViem, bP as setAggregationFetch, bQ as splitBidSignature, bR as weightedMedian, bS as zipFillLegs } from './intents-helpers-D_km9I2f.js';
2
2
  import 'consola';
3
3
  import 'decimal.js';
4
4
  import 'graphql-request';
@@ -2649,17 +2649,28 @@ async function aggregatePhantomBids(params) {
2649
2649
  }
2650
2650
  }
2651
2651
  if (quotesByLeg.size === 0) return null;
2652
- const legs = [...quotesByLeg.entries()].sort(([a], [b]) => a - b).map(([legIndex, { outputToken, quotes, bidders }]) => {
2653
- const medianPrice = weightedMedian(quotes);
2654
- return {
2655
- legIndex,
2656
- outputToken,
2657
- lowestPrice: medianPrice,
2658
- highestPrice: medianPrice,
2659
- medianPrice,
2660
- bidCount: quotes.length,
2661
- bidders
2662
- };
2652
+ const legs = [...quotesByLeg.entries()].sort(([a], [b]) => a - b).flatMap(([legIndex, { outputToken, quotes, bidders }]) => {
2653
+ const backedQuotes = quotes.filter((quote) => quote.weight > 0n);
2654
+ const backedBidders = bidders.filter((bidder) => bidder.weight > 0n);
2655
+ if (backedQuotes.length === 0) {
2656
+ logger?.warn(
2657
+ { commitment, chain, legIndex, outputToken, quotes: quotes.length },
2658
+ "Dropping phantom leg: no bidder holds the output token on this chain, so no quote is backed"
2659
+ );
2660
+ return [];
2661
+ }
2662
+ const medianPrice = weightedMedian(backedQuotes);
2663
+ return [
2664
+ {
2665
+ legIndex,
2666
+ outputToken,
2667
+ lowestPrice: medianPrice,
2668
+ highestPrice: medianPrice,
2669
+ medianPrice,
2670
+ bidCount: backedQuotes.length,
2671
+ bidders: backedBidders
2672
+ }
2673
+ ];
2663
2674
  });
2664
2675
  return { legs, lpBalances };
2665
2676
  }