@hyperbridge/sdk 2.8.11 → 2.8.12
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 +16 -18
- package/dist/browser/index.js +70 -6
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +71 -7
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +2 -2
- package/dist/node/index.d.ts +2 -2
- package/dist/node/index.js +70 -6
- package/dist/node/index.js.map +1 -1
- package/dist/node/{intents-helpers-BRegx4yZ.d.cts → intents-helpers-C9PJp8rx.d.cts} +16 -18
- package/dist/node/{intents-helpers-BRegx4yZ.d.ts → intents-helpers-C9PJp8rx.d.ts} +16 -18
- package/dist/node/intents-helpers.cjs +27 -6
- 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 +26 -5
- package/dist/node/intents-helpers.js.map +1 -1
- package/package.json +1 -1
|
@@ -2812,13 +2812,6 @@ interface FillerConfig {
|
|
|
2812
2812
|
* Example: { 1: true, 56: false } - watch-only on Ethereum, normal execution on BSC
|
|
2813
2813
|
*/
|
|
2814
2814
|
watchOnly?: Record<number, boolean>;
|
|
2815
|
-
/**
|
|
2816
|
-
* Source chains (state machine ids, e.g. "EVM-8453") this filler accepts payment from when
|
|
2817
|
-
* filling cross-chain orders, declared inside its phantom bids' paymasterAndData. Omit to
|
|
2818
|
-
* declare nothing, which downstream consumers read as "accepts all CCTP/USDT0-covered
|
|
2819
|
-
* chains"; an empty array declares that no source chain is accepted.
|
|
2820
|
-
*/
|
|
2821
|
-
acceptedSourceChains?: string[];
|
|
2822
2815
|
/**
|
|
2823
2816
|
* Uniswap V4 position tokenIds this filler holds, per chain (state machine id -> tokenIds as
|
|
2824
2817
|
* decimal strings), declared inside its phantom bids' paymasterAndData for the bid's own chain.
|
|
@@ -5586,19 +5579,24 @@ interface AggregationLogger {
|
|
|
5586
5579
|
* paid its cost of goods.
|
|
5587
5580
|
*/
|
|
5588
5581
|
declare const UNISWAP_QUOTE_HAIRCUT_BPS = 10n;
|
|
5582
|
+
/** Applies {@link UNISWAP_QUOTE_HAIRCUT_BPS} to a quoted output amount, rounding down. */
|
|
5583
|
+
declare function applyUniswapQuoteHaircut(amount: bigint): bigint;
|
|
5589
5584
|
/**
|
|
5590
|
-
*
|
|
5585
|
+
* The protocol fee haircut: the fee the IntentGateway at `gatewayAddress` charges on order inputs,
|
|
5586
|
+
* in basis points, read live from its `params()`.
|
|
5587
|
+
*
|
|
5588
|
+
* A wallet-funded quote is shaded by exactly this, so the published rate is the one a taker
|
|
5589
|
+
* actually realizes after the gateway takes its cut, and it moves with governance rather than
|
|
5590
|
+
* with a constant someone has to remember to keep in step. Read on the phantom order's own chain,
|
|
5591
|
+
* which is the chain whose gateway will collect the fee on the fills this rate is published for.
|
|
5591
5592
|
*
|
|
5592
|
-
*
|
|
5593
|
-
*
|
|
5594
|
-
*
|
|
5595
|
-
* {@link UNISWAP_QUOTE_HAIRCUT_BPS} instead of this — not on top of it.
|
|
5593
|
+
* Fails loudly rather than defaulting: a gateway that returns no code, or a fee at or above 100%,
|
|
5594
|
+
* is a misconfiguration, and pricing a window unhaircut on the back of it would publish a rate
|
|
5595
|
+
* nobody can trade at. The `PhantomRpcError` lets the run's retry loop have another go first.
|
|
5596
5596
|
*/
|
|
5597
|
-
declare
|
|
5598
|
-
/** Applies {@link
|
|
5599
|
-
declare function
|
|
5600
|
-
/** Applies {@link PHANTOM_QUOTE_HAIRCUT_BPS} to a quoted output amount, rounding down. */
|
|
5601
|
-
declare function applyPhantomQuoteHaircut(amount: bigint): bigint;
|
|
5597
|
+
declare function readProtocolFeeHaircutBps(evmRpcUrl: string, gatewayAddress: string): Promise<bigint>;
|
|
5598
|
+
/** Applies the protocol fee haircut (see {@link readProtocolFeeHaircutBps}) to a quoted output amount, rounding down. */
|
|
5599
|
+
declare function applyProtocolFeeHaircut(amount: bigint, protocolFeeBps: bigint): bigint;
|
|
5602
5600
|
declare function weightedMedian(entries: {
|
|
5603
5601
|
price: bigint;
|
|
5604
5602
|
weight: bigint;
|
|
@@ -8845,4 +8843,4 @@ declare const _default: {
|
|
|
8845
8843
|
}];
|
|
8846
8844
|
};
|
|
8847
8845
|
|
|
8848
|
-
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$2 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,
|
|
8846
|
+
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$2 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, RequestKind 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, CHAINS_WITHOUT_VALID_UNTIL as a6, type CancelOptions as a7, type ChainConfig as a8, type ChainConfigData as a9, type IPostResponse as aA, type IRequestMessage as aB, type ISubstrateConfig as aC, type ITimeoutPostRequestMessage as aD, ABI as aE, type IntentGatewayParams as aF, IntentOrderStatus as aG, type IntentOrderStatusKey as aH, type IsmpRequest as aI, LEGACY_FILL_OPTIONS_IMPLEMENTATIONS as aJ, type LiquiditySlice as aK, type OrderResponse as aL, type OrderStatusMetadata as aM, type PaymentInfo as aN, type PhantomBid as aO, type PhantomBidBatchResult as aP, type PhantomBidDeclaration as aQ, type PhantomBidOutcome as aR, type PhantomOrderEvent as aS, type PhantomOrderLeg as aT, type PhantomOrderPriceSnapshot as aU, type PhantomOrderPriceSnapshotsResponse as aV, type PhantomTimings as aW, type PollPhantomOrdersOptions as aX, type PostRequestStatus as aY, type RequestBody as aZ, type RequestCommitment as a_, type ConfiguredAssetSymbolInput as aa, type Deployment as ab, type DispatchGet as ac, type DispatchInfo as ad, type DispatchPost as ae, type Erc4626VaultConfigData as af, type ExecuteIntentOrderOptions as ag, type ExecutionResult as ah, FILL_ORDER_V1_ABI as ai, type FillOptions as aj, type FillOptionsVersion as ak, type FillerConfig as al, type GetRequestResponse as am, type GetResponseByRequestIdResponse as an, type GetResponseStorageValues as ao, type HostParams as ap, HyperClientStatus as aq, type IBatchConsensusAndGetResponseMessage as ar, type IBatchConsensusAndPostRequestMessage as as, type IConfig as at, type IConsensusMessage as au, type IGetRequestMessage as av, type IGetResponse as aw, type IGetResponseMessage as ax, type IHyperbridgeConfig as ay, INCLUSION_TIMEOUT_MS as az, type IMessage as b, type OrderCommitmentFn as b$, type RequestResponse as b0, RequestStatus as b1, type RequestStatusKey as b2, type SelectOptions as b3, type SigningAccount as b4, type StateMachineId as b5, type StateMachineResponse as b6, type StorageFacade as b7, TimeoutStatus as b8, type TimeoutStatusKey as b9, encodePhantomBidDeclaration as bA, encodeUserOpScale as bB, getChainId as bC, getConfigByStateMachineId as bD, getFillOptionsVersion as bE, getViemChain as bF, hyperbridgeAddress as bG, pharosAtlantic as bH, pharosMainnet as bI, polkadotAssetHubPaseo as bJ, polkadotHubMainnet as bK, poolSlug as bL, readProtocolFeeHaircutBps as bM, resetFillOptionsVersionCache as bN, sortPoolSymbols as bO, tronChainIds as bP, tronNile as bQ, type AggregationLogger as bR, type BidNonceKeyFn as bS, type BidSignature as bT, ENTRY_POINT_V08_ADDRESS as bU, FILL_ORDER_ABI as bV, type FetchLike as bW, type FillData as bX, type HexString as bY, _default as bZ, type LpBalance as b_, type TokenGatewayAssetTeleportedResponse as ba, type TokenInfo as bb, type TokenPrice as bc, type TokenPricesResponse as bd, UNISWAP_QUOTE_HAIRCUT_BPS as be, type UniswapV4PoolConfigData as bf, applyProtocolFeeHaircut as bg, applyUniswapQuoteHaircut as bh, chainConfigs as bi, convertCodecToIGetRequest as bj, convertCodecToIProof as bk, convertIGetRequestToCodec as bl, convertIProofToCodec as bm, convertStateIdToStateMachineId as bn, convertStateMachineEnumToString as bo, convertStateMachineIdToEnum as bp, decodeAcceptedSourceChains as bq, decodeERC7821ExecuteBatch as br, decodeFillOrder as bs, decodePhantomBidDeclaration as bt, decodeUserOpScale as bu, deriveHttpUrl as bv, encodeAcceptedSourceChains as bw, encodeERC7821ExecuteBatch as bx, encodeFillOrder as by, encodeISMPMessage as bz, type StateMachineHeight as c, type PhantomAggregation as c0, type PhantomLegAggregation as c1, type PhantomLegBidder as c2, type PoolAndPositionInfo as c3, type RecoverBidSigner as c4, type RpcBidInfo as c5, type SolverBalanceReader as c6, type SolverV4Position as c7, type UniswapV4Contracts as c8, type V4PositionState as c9, type YieldVaultMap as ca, aggregatePhantomBids as cb, extractFillData as cc, fetchBidsForOrder as cd, getTotalSolverBalance as ce, memoizedSolverBalance as cf, orderCommitmentFromDecoded as cg, positionAmountOfToken as ch, readV4Position as ci, recoverBidSignerViem as cj, setAggregationFetch as ck, splitBidSignature as cl, weightedMedian as cm, zipFillLegs as cn, 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 };
|
|
@@ -2812,13 +2812,6 @@ interface FillerConfig {
|
|
|
2812
2812
|
* Example: { 1: true, 56: false } - watch-only on Ethereum, normal execution on BSC
|
|
2813
2813
|
*/
|
|
2814
2814
|
watchOnly?: Record<number, boolean>;
|
|
2815
|
-
/**
|
|
2816
|
-
* Source chains (state machine ids, e.g. "EVM-8453") this filler accepts payment from when
|
|
2817
|
-
* filling cross-chain orders, declared inside its phantom bids' paymasterAndData. Omit to
|
|
2818
|
-
* declare nothing, which downstream consumers read as "accepts all CCTP/USDT0-covered
|
|
2819
|
-
* chains"; an empty array declares that no source chain is accepted.
|
|
2820
|
-
*/
|
|
2821
|
-
acceptedSourceChains?: string[];
|
|
2822
2815
|
/**
|
|
2823
2816
|
* Uniswap V4 position tokenIds this filler holds, per chain (state machine id -> tokenIds as
|
|
2824
2817
|
* decimal strings), declared inside its phantom bids' paymasterAndData for the bid's own chain.
|
|
@@ -5586,19 +5579,24 @@ interface AggregationLogger {
|
|
|
5586
5579
|
* paid its cost of goods.
|
|
5587
5580
|
*/
|
|
5588
5581
|
declare const UNISWAP_QUOTE_HAIRCUT_BPS = 10n;
|
|
5582
|
+
/** Applies {@link UNISWAP_QUOTE_HAIRCUT_BPS} to a quoted output amount, rounding down. */
|
|
5583
|
+
declare function applyUniswapQuoteHaircut(amount: bigint): bigint;
|
|
5589
5584
|
/**
|
|
5590
|
-
*
|
|
5585
|
+
* The protocol fee haircut: the fee the IntentGateway at `gatewayAddress` charges on order inputs,
|
|
5586
|
+
* in basis points, read live from its `params()`.
|
|
5587
|
+
*
|
|
5588
|
+
* A wallet-funded quote is shaded by exactly this, so the published rate is the one a taker
|
|
5589
|
+
* actually realizes after the gateway takes its cut, and it moves with governance rather than
|
|
5590
|
+
* with a constant someone has to remember to keep in step. Read on the phantom order's own chain,
|
|
5591
|
+
* which is the chain whose gateway will collect the fee on the fills this rate is published for.
|
|
5591
5592
|
*
|
|
5592
|
-
*
|
|
5593
|
-
*
|
|
5594
|
-
*
|
|
5595
|
-
* {@link UNISWAP_QUOTE_HAIRCUT_BPS} instead of this — not on top of it.
|
|
5593
|
+
* Fails loudly rather than defaulting: a gateway that returns no code, or a fee at or above 100%,
|
|
5594
|
+
* is a misconfiguration, and pricing a window unhaircut on the back of it would publish a rate
|
|
5595
|
+
* nobody can trade at. The `PhantomRpcError` lets the run's retry loop have another go first.
|
|
5596
5596
|
*/
|
|
5597
|
-
declare
|
|
5598
|
-
/** Applies {@link
|
|
5599
|
-
declare function
|
|
5600
|
-
/** Applies {@link PHANTOM_QUOTE_HAIRCUT_BPS} to a quoted output amount, rounding down. */
|
|
5601
|
-
declare function applyPhantomQuoteHaircut(amount: bigint): bigint;
|
|
5597
|
+
declare function readProtocolFeeHaircutBps(evmRpcUrl: string, gatewayAddress: string): Promise<bigint>;
|
|
5598
|
+
/** Applies the protocol fee haircut (see {@link readProtocolFeeHaircutBps}) to a quoted output amount, rounding down. */
|
|
5599
|
+
declare function applyProtocolFeeHaircut(amount: bigint, protocolFeeBps: bigint): bigint;
|
|
5602
5600
|
declare function weightedMedian(entries: {
|
|
5603
5601
|
price: bigint;
|
|
5604
5602
|
weight: bigint;
|
|
@@ -8845,4 +8843,4 @@ declare const _default: {
|
|
|
8845
8843
|
}];
|
|
8846
8844
|
};
|
|
8847
8845
|
|
|
8848
|
-
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$2 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,
|
|
8846
|
+
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$2 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, RequestKind 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, CHAINS_WITHOUT_VALID_UNTIL as a6, type CancelOptions as a7, type ChainConfig as a8, type ChainConfigData as a9, type IPostResponse as aA, type IRequestMessage as aB, type ISubstrateConfig as aC, type ITimeoutPostRequestMessage as aD, ABI as aE, type IntentGatewayParams as aF, IntentOrderStatus as aG, type IntentOrderStatusKey as aH, type IsmpRequest as aI, LEGACY_FILL_OPTIONS_IMPLEMENTATIONS as aJ, type LiquiditySlice as aK, type OrderResponse as aL, type OrderStatusMetadata as aM, type PaymentInfo as aN, type PhantomBid as aO, type PhantomBidBatchResult as aP, type PhantomBidDeclaration as aQ, type PhantomBidOutcome as aR, type PhantomOrderEvent as aS, type PhantomOrderLeg as aT, type PhantomOrderPriceSnapshot as aU, type PhantomOrderPriceSnapshotsResponse as aV, type PhantomTimings as aW, type PollPhantomOrdersOptions as aX, type PostRequestStatus as aY, type RequestBody as aZ, type RequestCommitment as a_, type ConfiguredAssetSymbolInput as aa, type Deployment as ab, type DispatchGet as ac, type DispatchInfo as ad, type DispatchPost as ae, type Erc4626VaultConfigData as af, type ExecuteIntentOrderOptions as ag, type ExecutionResult as ah, FILL_ORDER_V1_ABI as ai, type FillOptions as aj, type FillOptionsVersion as ak, type FillerConfig as al, type GetRequestResponse as am, type GetResponseByRequestIdResponse as an, type GetResponseStorageValues as ao, type HostParams as ap, HyperClientStatus as aq, type IBatchConsensusAndGetResponseMessage as ar, type IBatchConsensusAndPostRequestMessage as as, type IConfig as at, type IConsensusMessage as au, type IGetRequestMessage as av, type IGetResponse as aw, type IGetResponseMessage as ax, type IHyperbridgeConfig as ay, INCLUSION_TIMEOUT_MS as az, type IMessage as b, type OrderCommitmentFn as b$, type RequestResponse as b0, RequestStatus as b1, type RequestStatusKey as b2, type SelectOptions as b3, type SigningAccount as b4, type StateMachineId as b5, type StateMachineResponse as b6, type StorageFacade as b7, TimeoutStatus as b8, type TimeoutStatusKey as b9, encodePhantomBidDeclaration as bA, encodeUserOpScale as bB, getChainId as bC, getConfigByStateMachineId as bD, getFillOptionsVersion as bE, getViemChain as bF, hyperbridgeAddress as bG, pharosAtlantic as bH, pharosMainnet as bI, polkadotAssetHubPaseo as bJ, polkadotHubMainnet as bK, poolSlug as bL, readProtocolFeeHaircutBps as bM, resetFillOptionsVersionCache as bN, sortPoolSymbols as bO, tronChainIds as bP, tronNile as bQ, type AggregationLogger as bR, type BidNonceKeyFn as bS, type BidSignature as bT, ENTRY_POINT_V08_ADDRESS as bU, FILL_ORDER_ABI as bV, type FetchLike as bW, type FillData as bX, type HexString as bY, _default as bZ, type LpBalance as b_, type TokenGatewayAssetTeleportedResponse as ba, type TokenInfo as bb, type TokenPrice as bc, type TokenPricesResponse as bd, UNISWAP_QUOTE_HAIRCUT_BPS as be, type UniswapV4PoolConfigData as bf, applyProtocolFeeHaircut as bg, applyUniswapQuoteHaircut as bh, chainConfigs as bi, convertCodecToIGetRequest as bj, convertCodecToIProof as bk, convertIGetRequestToCodec as bl, convertIProofToCodec as bm, convertStateIdToStateMachineId as bn, convertStateMachineEnumToString as bo, convertStateMachineIdToEnum as bp, decodeAcceptedSourceChains as bq, decodeERC7821ExecuteBatch as br, decodeFillOrder as bs, decodePhantomBidDeclaration as bt, decodeUserOpScale as bu, deriveHttpUrl as bv, encodeAcceptedSourceChains as bw, encodeERC7821ExecuteBatch as bx, encodeFillOrder as by, encodeISMPMessage as bz, type StateMachineHeight as c, type PhantomAggregation as c0, type PhantomLegAggregation as c1, type PhantomLegBidder as c2, type PoolAndPositionInfo as c3, type RecoverBidSigner as c4, type RpcBidInfo as c5, type SolverBalanceReader as c6, type SolverV4Position as c7, type UniswapV4Contracts as c8, type V4PositionState as c9, type YieldVaultMap as ca, aggregatePhantomBids as cb, extractFillData as cc, fetchBidsForOrder as cd, getTotalSolverBalance as ce, memoizedSolverBalance as cf, orderCommitmentFromDecoded as cg, positionAmountOfToken as ch, readV4Position as ci, recoverBidSignerViem as cj, setAggregationFetch as ck, splitBidSignature as cl, weightedMedian as cm, zipFillLegs as cn, 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 };
|
|
@@ -2825,15 +2825,35 @@ function zipFillLegs(assets, outputs) {
|
|
|
2825
2825
|
});
|
|
2826
2826
|
}
|
|
2827
2827
|
var UNISWAP_QUOTE_HAIRCUT_BPS = 10n;
|
|
2828
|
-
var PHANTOM_QUOTE_HAIRCUT_BPS = 5n;
|
|
2829
2828
|
function haircut(amount, bps) {
|
|
2830
2829
|
return amount * (10000n - bps) / 10000n;
|
|
2831
2830
|
}
|
|
2832
2831
|
function applyUniswapQuoteHaircut(amount) {
|
|
2833
2832
|
return haircut(amount, UNISWAP_QUOTE_HAIRCUT_BPS);
|
|
2834
2833
|
}
|
|
2835
|
-
|
|
2836
|
-
|
|
2834
|
+
var SELECTOR_GATEWAY_PARAMS = "0xcff0ab96";
|
|
2835
|
+
var GATEWAY_PARAMS_WORDS = 6;
|
|
2836
|
+
var GATEWAY_PARAMS_FEE_WORD = 4;
|
|
2837
|
+
async function readProtocolFeeHaircutBps(evmRpcUrl, gatewayAddress) {
|
|
2838
|
+
const result = await rpcCall(evmRpcUrl, {
|
|
2839
|
+
id: 1,
|
|
2840
|
+
jsonrpc: "2.0",
|
|
2841
|
+
method: "eth_call",
|
|
2842
|
+
params: [{ to: gatewayAddress, data: SELECTOR_GATEWAY_PARAMS }, "latest"]
|
|
2843
|
+
});
|
|
2844
|
+
const hex = result.result;
|
|
2845
|
+
if (typeof hex !== "string" || hex.length < 2 + 64 * GATEWAY_PARAMS_WORDS) {
|
|
2846
|
+
throw new PhantomRpcError(`IntentGateway.params() returned no usable result from ${gatewayAddress} on ${evmRpcUrl}`);
|
|
2847
|
+
}
|
|
2848
|
+
const start = 2 + 64 * GATEWAY_PARAMS_FEE_WORD;
|
|
2849
|
+
const protocolFeeBps = BigInt(`0x${hex.slice(start, start + 64)}`);
|
|
2850
|
+
if (protocolFeeBps >= 10000n) {
|
|
2851
|
+
throw new PhantomRpcError(`IntentGateway ${gatewayAddress} reports an implausible protocol fee: ${protocolFeeBps} bps`);
|
|
2852
|
+
}
|
|
2853
|
+
return protocolFeeBps;
|
|
2854
|
+
}
|
|
2855
|
+
function applyProtocolFeeHaircut(amount, protocolFeeBps) {
|
|
2856
|
+
return haircut(amount, protocolFeeBps);
|
|
2837
2857
|
}
|
|
2838
2858
|
function weightedMedian(entries) {
|
|
2839
2859
|
const sorted = [...entries].sort((a, b) => a.price < b.price ? -1 : a.price > b.price ? 1 : 0);
|
|
@@ -3155,6 +3175,7 @@ async function runAggregation(params, isDelegated) {
|
|
|
3155
3175
|
}
|
|
3156
3176
|
const bids = await fetchBidsForOrder(nodeUrl, commitment);
|
|
3157
3177
|
if (bids.length === 0) return null;
|
|
3178
|
+
const protocolFeeHaircutBps = await readProtocolFeeHaircutBps(destUrl, gatewayAddress);
|
|
3158
3179
|
const v4Contracts = params.uniswapV4?.[chain];
|
|
3159
3180
|
const readPosition = memoizedV4Position(params.keccak ?? viem.keccak256, logger);
|
|
3160
3181
|
const getBalance = params.getBalance ?? memoizedSolverBalance(yieldVaults);
|
|
@@ -3201,7 +3222,7 @@ async function runAggregation(params, isDelegated) {
|
|
|
3201
3222
|
const declaration = decodePhantomBidDeclaration(decoded.paymasterAndData);
|
|
3202
3223
|
const acceptedSources = declaration.acceptedSources;
|
|
3203
3224
|
const poolPriced = declaration.uniswapV4Positions.length > 0;
|
|
3204
|
-
const applyHaircut = poolPriced ? applyUniswapQuoteHaircut :
|
|
3225
|
+
const applyHaircut = (amount) => poolPriced ? applyUniswapQuoteHaircut(amount) : applyProtocolFeeHaircut(amount, protocolFeeHaircutBps);
|
|
3205
3226
|
const quotedLegs = [...fillData.legs.entries()].map(([legIndex, leg]) => [
|
|
3206
3227
|
legIndex,
|
|
3207
3228
|
{ ...leg, solverAmount: applyHaircut(leg.solverAmount) }
|
|
@@ -3293,10 +3314,9 @@ exports.ENTRY_POINT_V08_ADDRESS = ENTRY_POINT_V08_ADDRESS;
|
|
|
3293
3314
|
exports.FILL_ORDER_ABI = FILL_ORDER_ABI;
|
|
3294
3315
|
exports.FILL_ORDER_V1_ABI = FILL_ORDER_V1_ABI;
|
|
3295
3316
|
exports.IntentGatewayV2 = IntentGatewayV2_default;
|
|
3296
|
-
exports.PHANTOM_QUOTE_HAIRCUT_BPS = PHANTOM_QUOTE_HAIRCUT_BPS;
|
|
3297
3317
|
exports.UNISWAP_QUOTE_HAIRCUT_BPS = UNISWAP_QUOTE_HAIRCUT_BPS;
|
|
3298
3318
|
exports.aggregatePhantomBids = aggregatePhantomBids;
|
|
3299
|
-
exports.
|
|
3319
|
+
exports.applyProtocolFeeHaircut = applyProtocolFeeHaircut;
|
|
3300
3320
|
exports.applyUniswapQuoteHaircut = applyUniswapQuoteHaircut;
|
|
3301
3321
|
exports.decodeAcceptedSourceChains = decodeAcceptedSourceChains;
|
|
3302
3322
|
exports.decodeERC7821ExecuteBatch = decodeERC7821ExecuteBatch;
|
|
@@ -3313,6 +3333,7 @@ exports.memoizedSolverBalance = memoizedSolverBalance;
|
|
|
3313
3333
|
exports.orderCommitmentFromDecoded = orderCommitmentFromDecoded;
|
|
3314
3334
|
exports.poolSlug = poolSlug;
|
|
3315
3335
|
exports.positionAmountOfToken = positionAmountOfToken;
|
|
3336
|
+
exports.readProtocolFeeHaircutBps = readProtocolFeeHaircutBps;
|
|
3316
3337
|
exports.readV4Position = readV4Position;
|
|
3317
3338
|
exports.recoverBidSignerViem = recoverBidSignerViem;
|
|
3318
3339
|
exports.setAggregationFetch = setAggregationFetch;
|