@hyperbridge/sdk 2.8.7 → 2.8.8
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/browser/index.d.ts +68 -23
- package/dist/browser/index.js +200 -73
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +203 -72
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +55 -22
- package/dist/node/index.d.ts +55 -22
- package/dist/node/index.js +200 -73
- package/dist/node/index.js.map +1 -1
- package/dist/node/{intents-helpers-BFc6YnD3.d.cts → intents-helpers-BCsIHRts.d.cts} +16 -4
- package/dist/node/{intents-helpers-BFc6YnD3.d.ts → intents-helpers-BCsIHRts.d.ts} +16 -4
- package/dist/node/intents-helpers.cjs +10 -1
- package/dist/node/intents-helpers.cjs.map +1 -1
- package/dist/node/intents-helpers.d.cts +1 -1
- package/dist/node/intents-helpers.d.ts +1 -1
- package/dist/node/intents-helpers.js +9 -2
- package/dist/node/intents-helpers.js.map +1 -1
- package/package.json +1 -1
|
@@ -2992,9 +2992,9 @@ interface AvailableLiquidity {
|
|
|
2992
2992
|
}) | null;
|
|
2993
2993
|
}
|
|
2994
2994
|
/**
|
|
2995
|
-
*
|
|
2996
|
-
* base token. The quote token is the less valuable currency when the
|
|
2997
|
-
*
|
|
2995
|
+
* Aggregate indexed pool buy and sell rates expressed as quote-token units per
|
|
2996
|
+
* one base token. The quote token is the less valuable currency when the rates
|
|
2997
|
+
* establish an ordering (for example, cNGN in a USDC/cNGN pair).
|
|
2998
2998
|
*/
|
|
2999
2999
|
interface BuyAndSellRates {
|
|
3000
3000
|
baseTokenSymbol: ConfiguredAssetSymbol;
|
|
@@ -5007,6 +5007,18 @@ interface PhantomAggregation {
|
|
|
5007
5007
|
interface AggregationLogger {
|
|
5008
5008
|
warn: (payload: unknown, message: string) => void;
|
|
5009
5009
|
}
|
|
5010
|
+
/**
|
|
5011
|
+
* Haircut applied to a quote that is priced off a Uniswap V4 pool, in basis points.
|
|
5012
|
+
*
|
|
5013
|
+
* A bid that declares V4 positions is quoting off those pools, and a pool price is what a trade
|
|
5014
|
+
* gets BEFORE the pool takes its fee — so the amount such a bid names is more than the solver
|
|
5015
|
+
* would actually be left holding once the swap that sources it clears. 30bps is the fee tier the
|
|
5016
|
+
* pools these positions sit in charge, so netting it out here is what makes a pool-priced quote
|
|
5017
|
+
* comparable to a wallet-funded one, whose inventory has already paid its cost of goods.
|
|
5018
|
+
*/
|
|
5019
|
+
declare const UNISWAP_QUOTE_HAIRCUT_BPS = 30n;
|
|
5020
|
+
/** Applies {@link UNISWAP_QUOTE_HAIRCUT_BPS} to a quoted output amount, rounding down. */
|
|
5021
|
+
declare function applyUniswapQuoteHaircut(amount: bigint): bigint;
|
|
5010
5022
|
declare function weightedMedian(entries: {
|
|
5011
5023
|
price: bigint;
|
|
5012
5024
|
weight: bigint;
|
|
@@ -7916,4 +7928,4 @@ declare const _default: {
|
|
|
7916
7928
|
}];
|
|
7917
7929
|
};
|
|
7918
7930
|
|
|
7919
|
-
export { type
|
|
7931
|
+
export { type DecodedPostResponseEvent as $, type AssetTeleported as A, type BuyAndSellRates as B, ChainConfigService as C, type SubmitBidOptions as D, type EstimateGasCallData as E, type PackedUserOperation as F, type GetRequestWithStatus as G, type HexString$1 as H, type IChain as I, type FillerBid as J, type Bid as K, type EstimateFillOrderParams as L, type FillOrderEstimate as M, type OrderFeesQuote as N, type Order as O, type PostRequestWithStatus as P, type QueryBuyAndSellRatesParams as Q, type RetryConfig as R, type StateMachineIdParams as S, type Transaction as T, type ERC7821Call as U, type OrderWithStatus as V, OrderStatus as W, type TokenGatewayAssetTeleportedWithStatus as X, TeleportStatus as Y, type DecodedOrderPlacedLog as Z, type DecodedPostRequestEvent as _, type IEvmConfig as a, type SigningAccount as a$, type AllStatusKey as a0, type AssetTeleportedResponse as a1, type BidStorageEntry as a2, type BidSubmissionResult as a3, type BlockMetadata as a4, type BytesLikeHex as a5, type CancelOptions as a6, type ChainConfig as a7, type ChainConfigData as a8, type ConfiguredAssetSymbolInput as a9, type ITimeoutPostRequestMessage as aA, ABI as aB, type IntentGatewayParams as aC, IntentOrderStatus as aD, type IntentOrderStatusKey as aE, type IsmpRequest as aF, type LiquiditySlice as aG, type OrderResponse as aH, type OrderStatusMetadata as aI, type PaymentInfo as aJ, type PhantomBid as aK, type PhantomBidBatchResult as aL, type PhantomBidDeclaration as aM, type PhantomBidOutcome as aN, type PhantomOrderEvent as aO, type PhantomOrderLeg as aP, type PhantomOrderPriceSnapshot as aQ, type PhantomOrderPriceSnapshotsResponse as aR, type PollPhantomOrdersOptions as aS, type PostRequestStatus as aT, type RequestBody as aU, type RequestCommitment as aV, RequestKind as aW, type RequestResponse as aX, RequestStatus as aY, type RequestStatusKey as aZ, type SelectOptions as a_, type Deployment as aa, type DispatchGet as ab, type DispatchInfo as ac, type DispatchPost as ad, type Erc4626VaultConfigData as ae, type ExecuteIntentOrderOptions as af, type ExecutionResult as ag, type FillOptions as ah, type FillerConfig as ai, type GetRequestResponse as aj, type GetResponseByRequestIdResponse as ak, type GetResponseStorageValues as al, type HostParams as am, HyperClientStatus as an, type IBatchConsensusAndGetResponseMessage as ao, type IBatchConsensusAndPostRequestMessage as ap, type IConfig as aq, type IConsensusMessage as ar, type IGetRequestMessage as as, type IGetResponse as at, type IGetResponseMessage as au, type IHyperbridgeConfig as av, INCLUSION_TIMEOUT_MS as aw, type IPostResponse as ax, type IRequestMessage as ay, type ISubstrateConfig as az, type IMessage as b, memoizedSolverBalance as b$, type StateMachineId as b0, type StateMachineResponse as b1, type StorageFacade as b2, TimeoutStatus as b3, type TimeoutStatusKey as b4, type TokenGatewayAssetTeleportedResponse as b5, type TokenInfo as b6, type TokenPrice as b7, type TokenPricesResponse as b8, UNISWAP_QUOTE_HAIRCUT_BPS as b9, polkadotAssetHubPaseo as bA, polkadotHubMainnet as bB, poolSlug as bC, sortPoolSymbols as bD, tronChainIds as bE, tronNile as bF, type AggregationLogger as bG, type BidNonceKeyFn as bH, type BidSignature as bI, ENTRY_POINT_V08_ADDRESS as bJ, FILL_ORDER_ABI as bK, type FetchLike as bL, type FillData as bM, type HexString as bN, _default as bO, type LpBalance as bP, type OrderCommitmentFn as bQ, type PhantomAggregation as bR, type PhantomLegAggregation as bS, type PhantomLegBidder as bT, type RecoverBidSigner as bU, type RpcBidInfo as bV, type SolverBalanceReader as bW, type YieldVaultMap as bX, aggregatePhantomBids as bY, extractFillData as bZ, fetchBidsForOrder as b_, type UniswapV4PoolConfigData as ba, applyUniswapQuoteHaircut as bb, chainConfigs as bc, convertCodecToIGetRequest as bd, convertCodecToIProof as be, convertIGetRequestToCodec as bf, convertIProofToCodec as bg, convertStateIdToStateMachineId as bh, convertStateMachineEnumToString as bi, convertStateMachineIdToEnum as bj, decodeAcceptedSourceChains as bk, decodeERC7821ExecuteBatch as bl, decodePhantomBidDeclaration as bm, decodeUserOpScale as bn, deriveHttpUrl as bo, encodeAcceptedSourceChains as bp, encodeERC7821ExecuteBatch as bq, encodeISMPMessage as br, encodePhantomBidDeclaration as bs, encodeUserOpScale as bt, getChainId as bu, getConfigByStateMachineId as bv, getViemChain as bw, hyperbridgeAddress as bx, pharosAtlantic as by, pharosMainnet as bz, type StateMachineHeight as c, orderCommitmentFromDecoded as c0, recoverBidSignerViem as c1, setAggregationFetch as c2, splitBidSignature as c3, weightedMedian as c4, zipFillLegs as c5, type IIsmpMessage as d, type IPostRequest as e, type IGetRequest as f, type IPolkadotHubConfig as g, type IPharosConfig as h, type StateMachineUpdate as i, type ResponseCommitmentWithValues as j, type RequestStatusWithMetadata as k, type PostRequestTimeoutStatus as l, SubstrateChain as m, type ClientConfig as n, type IndexerQueryClient as o, type IProof as p, type IEvmChain as q, IntentsCoprocessor as r, Chains as s, type ConfiguredAssetSymbol as t, type AvailableLiquidity as u, type IntentOrderStatusUpdate as v, type SelectBidResult as w, type ResumeIntentOrderOptions as x, type CancelOrderOptions as y, type CancelQuote as z };
|
|
@@ -2992,9 +2992,9 @@ interface AvailableLiquidity {
|
|
|
2992
2992
|
}) | null;
|
|
2993
2993
|
}
|
|
2994
2994
|
/**
|
|
2995
|
-
*
|
|
2996
|
-
* base token. The quote token is the less valuable currency when the
|
|
2997
|
-
*
|
|
2995
|
+
* Aggregate indexed pool buy and sell rates expressed as quote-token units per
|
|
2996
|
+
* one base token. The quote token is the less valuable currency when the rates
|
|
2997
|
+
* establish an ordering (for example, cNGN in a USDC/cNGN pair).
|
|
2998
2998
|
*/
|
|
2999
2999
|
interface BuyAndSellRates {
|
|
3000
3000
|
baseTokenSymbol: ConfiguredAssetSymbol;
|
|
@@ -5007,6 +5007,18 @@ interface PhantomAggregation {
|
|
|
5007
5007
|
interface AggregationLogger {
|
|
5008
5008
|
warn: (payload: unknown, message: string) => void;
|
|
5009
5009
|
}
|
|
5010
|
+
/**
|
|
5011
|
+
* Haircut applied to a quote that is priced off a Uniswap V4 pool, in basis points.
|
|
5012
|
+
*
|
|
5013
|
+
* A bid that declares V4 positions is quoting off those pools, and a pool price is what a trade
|
|
5014
|
+
* gets BEFORE the pool takes its fee — so the amount such a bid names is more than the solver
|
|
5015
|
+
* would actually be left holding once the swap that sources it clears. 30bps is the fee tier the
|
|
5016
|
+
* pools these positions sit in charge, so netting it out here is what makes a pool-priced quote
|
|
5017
|
+
* comparable to a wallet-funded one, whose inventory has already paid its cost of goods.
|
|
5018
|
+
*/
|
|
5019
|
+
declare const UNISWAP_QUOTE_HAIRCUT_BPS = 30n;
|
|
5020
|
+
/** Applies {@link UNISWAP_QUOTE_HAIRCUT_BPS} to a quoted output amount, rounding down. */
|
|
5021
|
+
declare function applyUniswapQuoteHaircut(amount: bigint): bigint;
|
|
5010
5022
|
declare function weightedMedian(entries: {
|
|
5011
5023
|
price: bigint;
|
|
5012
5024
|
weight: bigint;
|
|
@@ -7916,4 +7928,4 @@ declare const _default: {
|
|
|
7916
7928
|
}];
|
|
7917
7929
|
};
|
|
7918
7930
|
|
|
7919
|
-
export { type
|
|
7931
|
+
export { type DecodedPostResponseEvent as $, type AssetTeleported as A, type BuyAndSellRates as B, ChainConfigService as C, type SubmitBidOptions as D, type EstimateGasCallData as E, type PackedUserOperation as F, type GetRequestWithStatus as G, type HexString$1 as H, type IChain as I, type FillerBid as J, type Bid as K, type EstimateFillOrderParams as L, type FillOrderEstimate as M, type OrderFeesQuote as N, type Order as O, type PostRequestWithStatus as P, type QueryBuyAndSellRatesParams as Q, type RetryConfig as R, type StateMachineIdParams as S, type Transaction as T, type ERC7821Call as U, type OrderWithStatus as V, OrderStatus as W, type TokenGatewayAssetTeleportedWithStatus as X, TeleportStatus as Y, type DecodedOrderPlacedLog as Z, type DecodedPostRequestEvent as _, type IEvmConfig as a, type SigningAccount as a$, type AllStatusKey as a0, type AssetTeleportedResponse as a1, type BidStorageEntry as a2, type BidSubmissionResult as a3, type BlockMetadata as a4, type BytesLikeHex as a5, type CancelOptions as a6, type ChainConfig as a7, type ChainConfigData as a8, type ConfiguredAssetSymbolInput as a9, type ITimeoutPostRequestMessage as aA, ABI as aB, type IntentGatewayParams as aC, IntentOrderStatus as aD, type IntentOrderStatusKey as aE, type IsmpRequest as aF, type LiquiditySlice as aG, type OrderResponse as aH, type OrderStatusMetadata as aI, type PaymentInfo as aJ, type PhantomBid as aK, type PhantomBidBatchResult as aL, type PhantomBidDeclaration as aM, type PhantomBidOutcome as aN, type PhantomOrderEvent as aO, type PhantomOrderLeg as aP, type PhantomOrderPriceSnapshot as aQ, type PhantomOrderPriceSnapshotsResponse as aR, type PollPhantomOrdersOptions as aS, type PostRequestStatus as aT, type RequestBody as aU, type RequestCommitment as aV, RequestKind as aW, type RequestResponse as aX, RequestStatus as aY, type RequestStatusKey as aZ, type SelectOptions as a_, type Deployment as aa, type DispatchGet as ab, type DispatchInfo as ac, type DispatchPost as ad, type Erc4626VaultConfigData as ae, type ExecuteIntentOrderOptions as af, type ExecutionResult as ag, type FillOptions as ah, type FillerConfig as ai, type GetRequestResponse as aj, type GetResponseByRequestIdResponse as ak, type GetResponseStorageValues as al, type HostParams as am, HyperClientStatus as an, type IBatchConsensusAndGetResponseMessage as ao, type IBatchConsensusAndPostRequestMessage as ap, type IConfig as aq, type IConsensusMessage as ar, type IGetRequestMessage as as, type IGetResponse as at, type IGetResponseMessage as au, type IHyperbridgeConfig as av, INCLUSION_TIMEOUT_MS as aw, type IPostResponse as ax, type IRequestMessage as ay, type ISubstrateConfig as az, type IMessage as b, memoizedSolverBalance as b$, type StateMachineId as b0, type StateMachineResponse as b1, type StorageFacade as b2, TimeoutStatus as b3, type TimeoutStatusKey as b4, type TokenGatewayAssetTeleportedResponse as b5, type TokenInfo as b6, type TokenPrice as b7, type TokenPricesResponse as b8, UNISWAP_QUOTE_HAIRCUT_BPS as b9, polkadotAssetHubPaseo as bA, polkadotHubMainnet as bB, poolSlug as bC, sortPoolSymbols as bD, tronChainIds as bE, tronNile as bF, type AggregationLogger as bG, type BidNonceKeyFn as bH, type BidSignature as bI, ENTRY_POINT_V08_ADDRESS as bJ, FILL_ORDER_ABI as bK, type FetchLike as bL, type FillData as bM, type HexString as bN, _default as bO, type LpBalance as bP, type OrderCommitmentFn as bQ, type PhantomAggregation as bR, type PhantomLegAggregation as bS, type PhantomLegBidder as bT, type RecoverBidSigner as bU, type RpcBidInfo as bV, type SolverBalanceReader as bW, type YieldVaultMap as bX, aggregatePhantomBids as bY, extractFillData as bZ, fetchBidsForOrder as b_, type UniswapV4PoolConfigData as ba, applyUniswapQuoteHaircut as bb, chainConfigs as bc, convertCodecToIGetRequest as bd, convertCodecToIProof as be, convertIGetRequestToCodec as bf, convertIProofToCodec as bg, convertStateIdToStateMachineId as bh, convertStateMachineEnumToString as bi, convertStateMachineIdToEnum as bj, decodeAcceptedSourceChains as bk, decodeERC7821ExecuteBatch as bl, decodePhantomBidDeclaration as bm, decodeUserOpScale as bn, deriveHttpUrl as bo, encodeAcceptedSourceChains as bp, encodeERC7821ExecuteBatch as bq, encodeISMPMessage as br, encodePhantomBidDeclaration as bs, encodeUserOpScale as bt, getChainId as bu, getConfigByStateMachineId as bv, getViemChain as bw, hyperbridgeAddress as bx, pharosAtlantic as by, pharosMainnet as bz, type StateMachineHeight as c, orderCommitmentFromDecoded as c0, recoverBidSignerViem as c1, setAggregationFetch as c2, splitBidSignature as c3, weightedMedian as c4, zipFillLegs as c5, type IIsmpMessage as d, type IPostRequest as e, type IGetRequest as f, type IPolkadotHubConfig as g, type IPharosConfig as h, type StateMachineUpdate as i, type ResponseCommitmentWithValues as j, type RequestStatusWithMetadata as k, type PostRequestTimeoutStatus as l, SubstrateChain as m, type ClientConfig as n, type IndexerQueryClient as o, type IProof as p, type IEvmChain as q, IntentsCoprocessor as r, Chains as s, type ConfiguredAssetSymbol as t, type AvailableLiquidity as u, type IntentOrderStatusUpdate as v, type SelectBidResult as w, type ResumeIntentOrderOptions as x, type CancelOrderOptions as y, type CancelQuote as z };
|
|
@@ -2593,6 +2593,10 @@ function zipFillLegs(assets, outputs) {
|
|
|
2593
2593
|
};
|
|
2594
2594
|
});
|
|
2595
2595
|
}
|
|
2596
|
+
var UNISWAP_QUOTE_HAIRCUT_BPS = 30n;
|
|
2597
|
+
function applyUniswapQuoteHaircut(amount) {
|
|
2598
|
+
return amount * (10000n - UNISWAP_QUOTE_HAIRCUT_BPS) / 10000n;
|
|
2599
|
+
}
|
|
2596
2600
|
function weightedMedian(entries) {
|
|
2597
2601
|
const sorted = [...entries].sort((a, b) => a.price < b.price ? -1 : a.price > b.price ? 1 : 0);
|
|
2598
2602
|
const totalWeight = sorted.reduce((acc, e) => e.weight > 0n ? acc + e.weight : acc, 0n);
|
|
@@ -2951,7 +2955,10 @@ async function runAggregation(params, isDelegated) {
|
|
|
2951
2955
|
countedSolvers.add(normalizedSolver);
|
|
2952
2956
|
const declaration = decodePhantomBidDeclaration(decoded.paymasterAndData);
|
|
2953
2957
|
const acceptedSources = declaration.acceptedSources;
|
|
2954
|
-
const
|
|
2958
|
+
const poolPriced = declaration.uniswapV4Positions.length > 0;
|
|
2959
|
+
const quotedLegs = [...fillData.legs.entries()].map(
|
|
2960
|
+
([legIndex, leg]) => poolPriced ? [legIndex, { ...leg, solverAmount: applyUniswapQuoteHaircut(leg.solverAmount) }] : [legIndex, leg]
|
|
2961
|
+
).filter(([, leg]) => leg.solverAmount !== 0n);
|
|
2955
2962
|
const declaredPositions = v4Contracts ? declaration.uniswapV4Positions : [];
|
|
2956
2963
|
const positions = (await Promise.all(
|
|
2957
2964
|
declaredPositions.map((tokenId) => readPosition(destUrl, chain, v4Contracts, tokenId))
|
|
@@ -3031,7 +3038,9 @@ async function runAggregation(params, isDelegated) {
|
|
|
3031
3038
|
exports.ENTRY_POINT_V08_ADDRESS = ENTRY_POINT_V08_ADDRESS;
|
|
3032
3039
|
exports.FILL_ORDER_ABI = FILL_ORDER_ABI;
|
|
3033
3040
|
exports.IntentGatewayV2 = IntentGatewayV2_default;
|
|
3041
|
+
exports.UNISWAP_QUOTE_HAIRCUT_BPS = UNISWAP_QUOTE_HAIRCUT_BPS;
|
|
3034
3042
|
exports.aggregatePhantomBids = aggregatePhantomBids;
|
|
3043
|
+
exports.applyUniswapQuoteHaircut = applyUniswapQuoteHaircut;
|
|
3035
3044
|
exports.decodeAcceptedSourceChains = decodeAcceptedSourceChains;
|
|
3036
3045
|
exports.decodeERC7821ExecuteBatch = decodeERC7821ExecuteBatch;
|
|
3037
3046
|
exports.decodePhantomBidDeclaration = decodePhantomBidDeclaration;
|