@hyperbridge/sdk 2.8.12 → 2.8.13
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 +61 -2
- package/dist/browser/index.js +133 -22
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +134 -20
- 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 +133 -22
- package/dist/node/index.js.map +1 -1
- package/dist/node/{intents-helpers-C9PJp8rx.d.cts → intents-helpers-fntBuoYM.d.cts} +61 -2
- package/dist/node/{intents-helpers-C9PJp8rx.d.ts → intents-helpers-fntBuoYM.d.ts} +61 -2
- package/dist/node/intents-helpers.cjs +135 -21
- 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 +134 -23
- package/dist/node/intents-helpers.js.map +1 -1
- package/package.json +1 -1
|
@@ -5419,6 +5419,24 @@ declare const FILL_ORDER_ABI: readonly [{
|
|
|
5419
5419
|
readonly name: "WrongChain";
|
|
5420
5420
|
readonly inputs: readonly [];
|
|
5421
5421
|
}];
|
|
5422
|
+
/** A complete Permit2-sponsored paymasterAndData, before any declaration is appended. */
|
|
5423
|
+
declare const PERMIT2_SPONSORSHIP_BYTES: number;
|
|
5424
|
+
/**
|
|
5425
|
+
* The Permit2 sponsorship a bid's paymasterAndData carries when it was built on the real-bid path:
|
|
5426
|
+
* which paymaster it names and the fee-token permit it signed for that paymaster. Read for the
|
|
5427
|
+
* record only — the bid's authenticity comes from the solver signature over the userOpHash, which
|
|
5428
|
+
* covers these bytes, so nothing here is verified further and the permit signature is not kept.
|
|
5429
|
+
*/
|
|
5430
|
+
interface PhantomBidSponsorship {
|
|
5431
|
+
paymaster: HexString;
|
|
5432
|
+
/** The fee token the permit draws on. */
|
|
5433
|
+
token: HexString;
|
|
5434
|
+
permitAmount: bigint;
|
|
5435
|
+
/** Permit2 unordered nonce — random per op, which is what lets a solver's bids run in parallel. */
|
|
5436
|
+
nonce: bigint;
|
|
5437
|
+
/** Unix seconds after which the permit is unusable. */
|
|
5438
|
+
deadline: bigint;
|
|
5439
|
+
}
|
|
5422
5440
|
/** What a phantom bid's paymasterAndData declares about the solver behind it. */
|
|
5423
5441
|
interface PhantomBidDeclaration {
|
|
5424
5442
|
/**
|
|
@@ -5442,12 +5460,53 @@ declare function encodePhantomBidDeclaration(declaration: {
|
|
|
5442
5460
|
acceptedSourceChains?: string[];
|
|
5443
5461
|
uniswapV4Positions?: bigint[];
|
|
5444
5462
|
}): HexString;
|
|
5463
|
+
/** Everything a phantom bid's paymasterAndData was found to carry. */
|
|
5464
|
+
interface PhantomBidPaymasterAndData {
|
|
5465
|
+
/**
|
|
5466
|
+
* Which shape the field was read as: a bare declaration, a Permit2-sponsored bid (with or
|
|
5467
|
+
* without a declaration appended), or neither — empty, or bytes matching no known layout.
|
|
5468
|
+
*/
|
|
5469
|
+
mode: "declaration" | "permit2" | "none";
|
|
5470
|
+
/** Never null: an unreadable or missing declaration is the absent one (null sources, no positions). */
|
|
5471
|
+
declaration: PhantomBidDeclaration;
|
|
5472
|
+
/** The paymaster fields of a sponsored bid; null for the other two modes. */
|
|
5473
|
+
sponsorship: PhantomBidSponsorship | null;
|
|
5474
|
+
}
|
|
5445
5475
|
/**
|
|
5446
|
-
* Decodes a phantom bid's paymasterAndData
|
|
5476
|
+
* Decodes a phantom bid's paymasterAndData in whichever shape it takes.
|
|
5477
|
+
*
|
|
5478
|
+
* A bare declaration is tried first, so every bid placed before sponsored phantom bids existed
|
|
5479
|
+
* decodes to the byte exactly as it did. Failing that, a blob opening with a complete
|
|
5480
|
+
* Permit2-sponsored payload is read as a sponsored bid, and whatever follows the permit is parsed
|
|
5481
|
+
* as its declaration. Both parsers demand exact consumption — a bare declaration must end where
|
|
5482
|
+
* the bytes end, and a sponsored bid's tail must be a whole declaration or nothing — so neither
|
|
5483
|
+
* shape can be half-read as the other.
|
|
5484
|
+
*
|
|
5485
|
+
* A malformed tail on a sponsored bid yields the absent declaration but still reports the
|
|
5486
|
+
* sponsorship: the bid is still a bid, it just declared nothing readable.
|
|
5487
|
+
*/
|
|
5488
|
+
declare function decodePhantomBidPaymasterAndData(paymasterAndData: string | undefined | null): PhantomBidPaymasterAndData;
|
|
5489
|
+
/**
|
|
5490
|
+
* Decodes the declaration out of a phantom bid's paymasterAndData, whichever shape it takes (see
|
|
5491
|
+
* {@link decodePhantomBidPaymasterAndData}). Understands both declaration versions, so bids placed
|
|
5447
5492
|
* before positions existed keep decoding unchanged. Anything absent, unversioned or malformed
|
|
5448
5493
|
* yields a null `acceptedSources` with no positions — never a partial read.
|
|
5449
5494
|
*/
|
|
5450
5495
|
declare function decodePhantomBidDeclaration(paymasterAndData: string | undefined | null): PhantomBidDeclaration;
|
|
5496
|
+
/**
|
|
5497
|
+
* Builds a phantom bid's paymasterAndData: the declaration alone, or appended to a Permit2
|
|
5498
|
+
* sponsorship when the bid was built on the real-bid path and carries one.
|
|
5499
|
+
*
|
|
5500
|
+
* `sponsorship` is the packed EntryPoint v0.8 paymasterAndData the paymaster builder produced. It
|
|
5501
|
+
* must be exactly the Permit2-mode layout — the only one the decoder recognises — so a caller
|
|
5502
|
+
* cannot sign bytes the aggregation would read as "no declaration"; anything else throws. Empty
|
|
5503
|
+
* or omitted, the result is the bare declaration, byte-identical to what unsponsored bids carry.
|
|
5504
|
+
*/
|
|
5505
|
+
declare function encodePhantomBidPaymasterAndData(bid: {
|
|
5506
|
+
sponsorship?: HexString | null;
|
|
5507
|
+
acceptedSourceChains?: string[];
|
|
5508
|
+
uniswapV4Positions?: bigint[];
|
|
5509
|
+
}): HexString;
|
|
5451
5510
|
/** Back-compat wrapper: the source-chain half of {@link encodePhantomBidDeclaration}. */
|
|
5452
5511
|
declare function encodeAcceptedSourceChains(chains: string[]): HexString;
|
|
5453
5512
|
/** Back-compat wrapper: the source-chain half of {@link decodePhantomBidDeclaration}. */
|
|
@@ -8843,4 +8902,4 @@ declare const _default: {
|
|
|
8843
8902
|
}];
|
|
8844
8903
|
};
|
|
8845
8904
|
|
|
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,
|
|
8905
|
+
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, type PostRequestStatus 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, PERMIT2_SPONSORSHIP_BYTES as aN, type PaymentInfo as aO, type PhantomBid as aP, type PhantomBidBatchResult as aQ, type PhantomBidDeclaration as aR, type PhantomBidOutcome as aS, type PhantomBidPaymasterAndData as aT, type PhantomBidSponsorship as aU, type PhantomOrderEvent as aV, type PhantomOrderLeg as aW, type PhantomOrderPriceSnapshot as aX, type PhantomOrderPriceSnapshotsResponse as aY, type PhantomTimings as aZ, type PollPhantomOrdersOptions 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 FetchLike as b$, type RequestBody as b0, type RequestCommitment as b1, RequestKind as b2, type RequestResponse as b3, RequestStatus as b4, type RequestStatusKey as b5, type SelectOptions as b6, type SigningAccount as b7, type StateMachineId as b8, type StateMachineResponse as b9, encodeAcceptedSourceChains as bA, encodeERC7821ExecuteBatch as bB, encodeFillOrder as bC, encodeISMPMessage as bD, encodePhantomBidDeclaration as bE, encodePhantomBidPaymasterAndData as bF, encodeUserOpScale as bG, getChainId as bH, getConfigByStateMachineId as bI, getFillOptionsVersion as bJ, getViemChain as bK, hyperbridgeAddress as bL, pharosAtlantic as bM, pharosMainnet as bN, polkadotAssetHubPaseo as bO, polkadotHubMainnet as bP, poolSlug as bQ, readProtocolFeeHaircutBps as bR, resetFillOptionsVersionCache as bS, sortPoolSymbols as bT, tronChainIds as bU, tronNile as bV, type AggregationLogger as bW, type BidNonceKeyFn as bX, type BidSignature as bY, ENTRY_POINT_V08_ADDRESS as bZ, FILL_ORDER_ABI as b_, type StorageFacade as ba, TimeoutStatus as bb, type TimeoutStatusKey as bc, type TokenGatewayAssetTeleportedResponse as bd, type TokenInfo as be, type TokenPrice as bf, type TokenPricesResponse as bg, UNISWAP_QUOTE_HAIRCUT_BPS as bh, type UniswapV4PoolConfigData as bi, applyProtocolFeeHaircut as bj, applyUniswapQuoteHaircut as bk, chainConfigs as bl, convertCodecToIGetRequest as bm, convertCodecToIProof as bn, convertIGetRequestToCodec as bo, convertIProofToCodec as bp, convertStateIdToStateMachineId as bq, convertStateMachineEnumToString as br, convertStateMachineIdToEnum as bs, decodeAcceptedSourceChains as bt, decodeERC7821ExecuteBatch as bu, decodeFillOrder as bv, decodePhantomBidDeclaration as bw, decodePhantomBidPaymasterAndData as bx, decodeUserOpScale as by, deriveHttpUrl as bz, type StateMachineHeight as c, type FillData as c0, type HexString as c1, _default as c2, type LpBalance as c3, type OrderCommitmentFn as c4, type PhantomAggregation as c5, type PhantomLegAggregation as c6, type PhantomLegBidder as c7, type PoolAndPositionInfo as c8, type RecoverBidSigner as c9, type RpcBidInfo as ca, type SolverBalanceReader as cb, type SolverV4Position as cc, type UniswapV4Contracts as cd, type V4PositionState as ce, type YieldVaultMap as cf, aggregatePhantomBids as cg, extractFillData as ch, fetchBidsForOrder as ci, getTotalSolverBalance as cj, memoizedSolverBalance as ck, orderCommitmentFromDecoded as cl, positionAmountOfToken as cm, readV4Position as cn, recoverBidSignerViem as co, setAggregationFetch as cp, splitBidSignature as cq, weightedMedian as cr, zipFillLegs as cs, 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 };
|
|
@@ -5419,6 +5419,24 @@ declare const FILL_ORDER_ABI: readonly [{
|
|
|
5419
5419
|
readonly name: "WrongChain";
|
|
5420
5420
|
readonly inputs: readonly [];
|
|
5421
5421
|
}];
|
|
5422
|
+
/** A complete Permit2-sponsored paymasterAndData, before any declaration is appended. */
|
|
5423
|
+
declare const PERMIT2_SPONSORSHIP_BYTES: number;
|
|
5424
|
+
/**
|
|
5425
|
+
* The Permit2 sponsorship a bid's paymasterAndData carries when it was built on the real-bid path:
|
|
5426
|
+
* which paymaster it names and the fee-token permit it signed for that paymaster. Read for the
|
|
5427
|
+
* record only — the bid's authenticity comes from the solver signature over the userOpHash, which
|
|
5428
|
+
* covers these bytes, so nothing here is verified further and the permit signature is not kept.
|
|
5429
|
+
*/
|
|
5430
|
+
interface PhantomBidSponsorship {
|
|
5431
|
+
paymaster: HexString;
|
|
5432
|
+
/** The fee token the permit draws on. */
|
|
5433
|
+
token: HexString;
|
|
5434
|
+
permitAmount: bigint;
|
|
5435
|
+
/** Permit2 unordered nonce — random per op, which is what lets a solver's bids run in parallel. */
|
|
5436
|
+
nonce: bigint;
|
|
5437
|
+
/** Unix seconds after which the permit is unusable. */
|
|
5438
|
+
deadline: bigint;
|
|
5439
|
+
}
|
|
5422
5440
|
/** What a phantom bid's paymasterAndData declares about the solver behind it. */
|
|
5423
5441
|
interface PhantomBidDeclaration {
|
|
5424
5442
|
/**
|
|
@@ -5442,12 +5460,53 @@ declare function encodePhantomBidDeclaration(declaration: {
|
|
|
5442
5460
|
acceptedSourceChains?: string[];
|
|
5443
5461
|
uniswapV4Positions?: bigint[];
|
|
5444
5462
|
}): HexString;
|
|
5463
|
+
/** Everything a phantom bid's paymasterAndData was found to carry. */
|
|
5464
|
+
interface PhantomBidPaymasterAndData {
|
|
5465
|
+
/**
|
|
5466
|
+
* Which shape the field was read as: a bare declaration, a Permit2-sponsored bid (with or
|
|
5467
|
+
* without a declaration appended), or neither — empty, or bytes matching no known layout.
|
|
5468
|
+
*/
|
|
5469
|
+
mode: "declaration" | "permit2" | "none";
|
|
5470
|
+
/** Never null: an unreadable or missing declaration is the absent one (null sources, no positions). */
|
|
5471
|
+
declaration: PhantomBidDeclaration;
|
|
5472
|
+
/** The paymaster fields of a sponsored bid; null for the other two modes. */
|
|
5473
|
+
sponsorship: PhantomBidSponsorship | null;
|
|
5474
|
+
}
|
|
5445
5475
|
/**
|
|
5446
|
-
* Decodes a phantom bid's paymasterAndData
|
|
5476
|
+
* Decodes a phantom bid's paymasterAndData in whichever shape it takes.
|
|
5477
|
+
*
|
|
5478
|
+
* A bare declaration is tried first, so every bid placed before sponsored phantom bids existed
|
|
5479
|
+
* decodes to the byte exactly as it did. Failing that, a blob opening with a complete
|
|
5480
|
+
* Permit2-sponsored payload is read as a sponsored bid, and whatever follows the permit is parsed
|
|
5481
|
+
* as its declaration. Both parsers demand exact consumption — a bare declaration must end where
|
|
5482
|
+
* the bytes end, and a sponsored bid's tail must be a whole declaration or nothing — so neither
|
|
5483
|
+
* shape can be half-read as the other.
|
|
5484
|
+
*
|
|
5485
|
+
* A malformed tail on a sponsored bid yields the absent declaration but still reports the
|
|
5486
|
+
* sponsorship: the bid is still a bid, it just declared nothing readable.
|
|
5487
|
+
*/
|
|
5488
|
+
declare function decodePhantomBidPaymasterAndData(paymasterAndData: string | undefined | null): PhantomBidPaymasterAndData;
|
|
5489
|
+
/**
|
|
5490
|
+
* Decodes the declaration out of a phantom bid's paymasterAndData, whichever shape it takes (see
|
|
5491
|
+
* {@link decodePhantomBidPaymasterAndData}). Understands both declaration versions, so bids placed
|
|
5447
5492
|
* before positions existed keep decoding unchanged. Anything absent, unversioned or malformed
|
|
5448
5493
|
* yields a null `acceptedSources` with no positions — never a partial read.
|
|
5449
5494
|
*/
|
|
5450
5495
|
declare function decodePhantomBidDeclaration(paymasterAndData: string | undefined | null): PhantomBidDeclaration;
|
|
5496
|
+
/**
|
|
5497
|
+
* Builds a phantom bid's paymasterAndData: the declaration alone, or appended to a Permit2
|
|
5498
|
+
* sponsorship when the bid was built on the real-bid path and carries one.
|
|
5499
|
+
*
|
|
5500
|
+
* `sponsorship` is the packed EntryPoint v0.8 paymasterAndData the paymaster builder produced. It
|
|
5501
|
+
* must be exactly the Permit2-mode layout — the only one the decoder recognises — so a caller
|
|
5502
|
+
* cannot sign bytes the aggregation would read as "no declaration"; anything else throws. Empty
|
|
5503
|
+
* or omitted, the result is the bare declaration, byte-identical to what unsponsored bids carry.
|
|
5504
|
+
*/
|
|
5505
|
+
declare function encodePhantomBidPaymasterAndData(bid: {
|
|
5506
|
+
sponsorship?: HexString | null;
|
|
5507
|
+
acceptedSourceChains?: string[];
|
|
5508
|
+
uniswapV4Positions?: bigint[];
|
|
5509
|
+
}): HexString;
|
|
5451
5510
|
/** Back-compat wrapper: the source-chain half of {@link encodePhantomBidDeclaration}. */
|
|
5452
5511
|
declare function encodeAcceptedSourceChains(chains: string[]): HexString;
|
|
5453
5512
|
/** Back-compat wrapper: the source-chain half of {@link decodePhantomBidDeclaration}. */
|
|
@@ -8843,4 +8902,4 @@ declare const _default: {
|
|
|
8843
8902
|
}];
|
|
8844
8903
|
};
|
|
8845
8904
|
|
|
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,
|
|
8905
|
+
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, type PostRequestStatus 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, PERMIT2_SPONSORSHIP_BYTES as aN, type PaymentInfo as aO, type PhantomBid as aP, type PhantomBidBatchResult as aQ, type PhantomBidDeclaration as aR, type PhantomBidOutcome as aS, type PhantomBidPaymasterAndData as aT, type PhantomBidSponsorship as aU, type PhantomOrderEvent as aV, type PhantomOrderLeg as aW, type PhantomOrderPriceSnapshot as aX, type PhantomOrderPriceSnapshotsResponse as aY, type PhantomTimings as aZ, type PollPhantomOrdersOptions 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 FetchLike as b$, type RequestBody as b0, type RequestCommitment as b1, RequestKind as b2, type RequestResponse as b3, RequestStatus as b4, type RequestStatusKey as b5, type SelectOptions as b6, type SigningAccount as b7, type StateMachineId as b8, type StateMachineResponse as b9, encodeAcceptedSourceChains as bA, encodeERC7821ExecuteBatch as bB, encodeFillOrder as bC, encodeISMPMessage as bD, encodePhantomBidDeclaration as bE, encodePhantomBidPaymasterAndData as bF, encodeUserOpScale as bG, getChainId as bH, getConfigByStateMachineId as bI, getFillOptionsVersion as bJ, getViemChain as bK, hyperbridgeAddress as bL, pharosAtlantic as bM, pharosMainnet as bN, polkadotAssetHubPaseo as bO, polkadotHubMainnet as bP, poolSlug as bQ, readProtocolFeeHaircutBps as bR, resetFillOptionsVersionCache as bS, sortPoolSymbols as bT, tronChainIds as bU, tronNile as bV, type AggregationLogger as bW, type BidNonceKeyFn as bX, type BidSignature as bY, ENTRY_POINT_V08_ADDRESS as bZ, FILL_ORDER_ABI as b_, type StorageFacade as ba, TimeoutStatus as bb, type TimeoutStatusKey as bc, type TokenGatewayAssetTeleportedResponse as bd, type TokenInfo as be, type TokenPrice as bf, type TokenPricesResponse as bg, UNISWAP_QUOTE_HAIRCUT_BPS as bh, type UniswapV4PoolConfigData as bi, applyProtocolFeeHaircut as bj, applyUniswapQuoteHaircut as bk, chainConfigs as bl, convertCodecToIGetRequest as bm, convertCodecToIProof as bn, convertIGetRequestToCodec as bo, convertIProofToCodec as bp, convertStateIdToStateMachineId as bq, convertStateMachineEnumToString as br, convertStateMachineIdToEnum as bs, decodeAcceptedSourceChains as bt, decodeERC7821ExecuteBatch as bu, decodeFillOrder as bv, decodePhantomBidDeclaration as bw, decodePhantomBidPaymasterAndData as bx, decodeUserOpScale as by, deriveHttpUrl as bz, type StateMachineHeight as c, type FillData as c0, type HexString as c1, _default as c2, type LpBalance as c3, type OrderCommitmentFn as c4, type PhantomAggregation as c5, type PhantomLegAggregation as c6, type PhantomLegBidder as c7, type PoolAndPositionInfo as c8, type RecoverBidSigner as c9, type RpcBidInfo as ca, type SolverBalanceReader as cb, type SolverV4Position as cc, type UniswapV4Contracts as cd, type V4PositionState as ce, type YieldVaultMap as cf, aggregatePhantomBids as cg, extractFillData as ch, fetchBidsForOrder as ci, getTotalSolverBalance as cj, memoizedSolverBalance as ck, orderCommitmentFromDecoded as cl, positionAmountOfToken as cm, readV4Position as cn, recoverBidSignerViem as co, setAggregationFetch as cp, splitBidSignature as cq, weightedMedian as cr, zipFillLegs as cs, 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 };
|
|
@@ -2731,8 +2731,67 @@ async function rpcCall(url, payload) {
|
|
|
2731
2731
|
var FILL_ORDER_ABI = IntentGatewayV2_default.ABI;
|
|
2732
2732
|
var DECLARATION_V1 = 1;
|
|
2733
2733
|
var DECLARATION_V2 = 2;
|
|
2734
|
+
var PAYMASTER_ADDRESS_BYTES = 20;
|
|
2735
|
+
var PAYMASTER_GAS_LIMIT_BYTES = 16;
|
|
2736
|
+
var PAYMASTER_DATA_OFFSET = PAYMASTER_ADDRESS_BYTES + 2 * PAYMASTER_GAS_LIMIT_BYTES;
|
|
2737
|
+
var SIMPLEX_MODE_PERMIT2 = 2;
|
|
2738
|
+
var PERMIT2_DATA_BYTES = 1 + 20 + 32 + 32 + 32 + 1 + 32 + 32;
|
|
2739
|
+
var PERMIT2_SPONSORSHIP_BYTES = PAYMASTER_DATA_OFFSET + PERMIT2_DATA_BYTES;
|
|
2734
2740
|
var MAX_DECLARED_ENTRIES = 255;
|
|
2735
2741
|
var MAX_TOKEN_ID_BYTES = 32;
|
|
2742
|
+
function utf8Encode(text) {
|
|
2743
|
+
const bytes = [];
|
|
2744
|
+
for (const char of text) {
|
|
2745
|
+
const codePoint = char.codePointAt(0);
|
|
2746
|
+
if (codePoint < 128) bytes.push(codePoint);
|
|
2747
|
+
else if (codePoint < 2048) bytes.push(192 | codePoint >> 6, 128 | codePoint & 63);
|
|
2748
|
+
else if (codePoint < 65536) {
|
|
2749
|
+
bytes.push(224 | codePoint >> 12, 128 | codePoint >> 6 & 63, 128 | codePoint & 63);
|
|
2750
|
+
} else {
|
|
2751
|
+
bytes.push(
|
|
2752
|
+
240 | codePoint >> 18,
|
|
2753
|
+
128 | codePoint >> 12 & 63,
|
|
2754
|
+
128 | codePoint >> 6 & 63,
|
|
2755
|
+
128 | codePoint & 63
|
|
2756
|
+
);
|
|
2757
|
+
}
|
|
2758
|
+
}
|
|
2759
|
+
return bytes;
|
|
2760
|
+
}
|
|
2761
|
+
function utf8Decode(bytes) {
|
|
2762
|
+
let text = "";
|
|
2763
|
+
for (let offset = 0; offset < bytes.length; ) {
|
|
2764
|
+
const lead = bytes[offset];
|
|
2765
|
+
let codePoint;
|
|
2766
|
+
let continuations;
|
|
2767
|
+
if (lead < 128) {
|
|
2768
|
+
codePoint = lead;
|
|
2769
|
+
continuations = 0;
|
|
2770
|
+
} else if ((lead & 224) === 192) {
|
|
2771
|
+
codePoint = lead & 31;
|
|
2772
|
+
continuations = 1;
|
|
2773
|
+
} else if ((lead & 240) === 224) {
|
|
2774
|
+
codePoint = lead & 15;
|
|
2775
|
+
continuations = 2;
|
|
2776
|
+
} else if ((lead & 248) === 240) {
|
|
2777
|
+
codePoint = lead & 7;
|
|
2778
|
+
continuations = 3;
|
|
2779
|
+
} else {
|
|
2780
|
+
return null;
|
|
2781
|
+
}
|
|
2782
|
+
if (offset + continuations >= bytes.length) return null;
|
|
2783
|
+
for (let index = 1; index <= continuations; index++) {
|
|
2784
|
+
const byte = bytes[offset + index];
|
|
2785
|
+
if ((byte & 192) !== 128) return null;
|
|
2786
|
+
codePoint = codePoint << 6 | byte & 63;
|
|
2787
|
+
}
|
|
2788
|
+
const overlong = continuations === 1 && codePoint < 128 || continuations === 2 && codePoint < 2048 || continuations === 3 && codePoint < 65536;
|
|
2789
|
+
if (overlong || codePoint > 1114111 || codePoint >= 55296 && codePoint <= 57343) return null;
|
|
2790
|
+
text += String.fromCodePoint(codePoint);
|
|
2791
|
+
offset += continuations + 1;
|
|
2792
|
+
}
|
|
2793
|
+
return text;
|
|
2794
|
+
}
|
|
2736
2795
|
function tokenIdToBytes(tokenId) {
|
|
2737
2796
|
if (tokenId < 0n) throw new Error(`Uniswap V4 tokenId cannot be negative: ${tokenId}`);
|
|
2738
2797
|
const bytes = [];
|
|
@@ -2755,7 +2814,7 @@ function encodePhantomBidDeclaration(declaration) {
|
|
|
2755
2814
|
const version = positions.length > 0 ? DECLARATION_V2 : DECLARATION_V1;
|
|
2756
2815
|
const bytes = [version, chains.length];
|
|
2757
2816
|
for (const chain of chains) {
|
|
2758
|
-
const encoded =
|
|
2817
|
+
const encoded = utf8Encode(chain);
|
|
2759
2818
|
if (encoded.length === 0 || encoded.length > 255) {
|
|
2760
2819
|
throw new Error(`Invalid state machine id in source chain declaration: ${chain}`);
|
|
2761
2820
|
}
|
|
@@ -2773,42 +2832,94 @@ function encodePhantomBidDeclaration(declaration) {
|
|
|
2773
2832
|
}
|
|
2774
2833
|
return util.u8aToHex(new Uint8Array(bytes));
|
|
2775
2834
|
}
|
|
2776
|
-
function
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
if (bytes.length < 2) return absent;
|
|
2781
|
-
const version = bytes[0];
|
|
2782
|
-
if (version !== DECLARATION_V1 && version !== DECLARATION_V2) return absent;
|
|
2835
|
+
function parseDeclaration(bytes, start) {
|
|
2836
|
+
if (bytes.length - start < 2) return null;
|
|
2837
|
+
const version = bytes[start];
|
|
2838
|
+
if (version !== DECLARATION_V1 && version !== DECLARATION_V2) return null;
|
|
2783
2839
|
const chains = [];
|
|
2784
|
-
let offset = 2;
|
|
2785
|
-
for (let entry = 0; entry < bytes[1]; entry++) {
|
|
2786
|
-
if (offset >= bytes.length) return
|
|
2840
|
+
let offset = start + 2;
|
|
2841
|
+
for (let entry = 0; entry < bytes[start + 1]; entry++) {
|
|
2842
|
+
if (offset >= bytes.length) return null;
|
|
2787
2843
|
const length = bytes[offset];
|
|
2788
2844
|
offset += 1;
|
|
2789
|
-
if (length === 0 || offset + length > bytes.length) return
|
|
2790
|
-
|
|
2845
|
+
if (length === 0 || offset + length > bytes.length) return null;
|
|
2846
|
+
const chain = utf8Decode(bytes.subarray(offset, offset + length));
|
|
2847
|
+
if (chain === null) return null;
|
|
2848
|
+
chains.push(chain);
|
|
2791
2849
|
offset += length;
|
|
2792
2850
|
}
|
|
2793
2851
|
const positions = [];
|
|
2794
2852
|
if (version === DECLARATION_V2) {
|
|
2795
|
-
if (offset >= bytes.length) return
|
|
2853
|
+
if (offset >= bytes.length) return null;
|
|
2796
2854
|
const count = bytes[offset];
|
|
2797
2855
|
offset += 1;
|
|
2798
2856
|
for (let entry = 0; entry < count; entry++) {
|
|
2799
|
-
if (offset >= bytes.length) return
|
|
2857
|
+
if (offset >= bytes.length) return null;
|
|
2800
2858
|
const length = bytes[offset];
|
|
2801
2859
|
offset += 1;
|
|
2802
|
-
if (length === 0 || length > MAX_TOKEN_ID_BYTES || offset + length > bytes.length) return
|
|
2803
|
-
|
|
2804
|
-
for (const byte of bytes.subarray(offset, offset + length)) tokenId = tokenId << 8n | BigInt(byte);
|
|
2805
|
-
positions.push(tokenId);
|
|
2860
|
+
if (length === 0 || length > MAX_TOKEN_ID_BYTES || offset + length > bytes.length) return null;
|
|
2861
|
+
positions.push(bytesToBigInt2(bytes.subarray(offset, offset + length)));
|
|
2806
2862
|
offset += length;
|
|
2807
2863
|
}
|
|
2808
2864
|
}
|
|
2809
|
-
if (offset !== bytes.length) return
|
|
2865
|
+
if (offset !== bytes.length) return null;
|
|
2810
2866
|
return { acceptedSources: chains, uniswapV4Positions: positions };
|
|
2811
2867
|
}
|
|
2868
|
+
function bytesToBigInt2(bytes) {
|
|
2869
|
+
let value = 0n;
|
|
2870
|
+
for (const byte of bytes) value = value << 8n | BigInt(byte);
|
|
2871
|
+
return value;
|
|
2872
|
+
}
|
|
2873
|
+
function bytesToAddress(bytes) {
|
|
2874
|
+
return util.u8aToHex(bytes);
|
|
2875
|
+
}
|
|
2876
|
+
function hasPermit2Sponsorship(bytes) {
|
|
2877
|
+
return bytes.length >= PERMIT2_SPONSORSHIP_BYTES && bytes[PAYMASTER_DATA_OFFSET] === SIMPLEX_MODE_PERMIT2;
|
|
2878
|
+
}
|
|
2879
|
+
function parseSponsorship(bytes) {
|
|
2880
|
+
let offset = 0;
|
|
2881
|
+
const take = (length) => {
|
|
2882
|
+
const slice = bytes.subarray(offset, offset + length);
|
|
2883
|
+
offset += length;
|
|
2884
|
+
return slice;
|
|
2885
|
+
};
|
|
2886
|
+
const paymaster = bytesToAddress(take(PAYMASTER_ADDRESS_BYTES));
|
|
2887
|
+
take(2 * PAYMASTER_GAS_LIMIT_BYTES);
|
|
2888
|
+
take(1);
|
|
2889
|
+
const token = bytesToAddress(take(20));
|
|
2890
|
+
const permitAmount = bytesToBigInt2(take(32));
|
|
2891
|
+
const nonce = bytesToBigInt2(take(32));
|
|
2892
|
+
const deadline = bytesToBigInt2(take(32));
|
|
2893
|
+
return { paymaster, token, permitAmount, nonce, deadline };
|
|
2894
|
+
}
|
|
2895
|
+
var absentDeclaration = () => ({ acceptedSources: null, uniswapV4Positions: [] });
|
|
2896
|
+
function decodePhantomBidPaymasterAndData(paymasterAndData) {
|
|
2897
|
+
const none = { mode: "none", declaration: absentDeclaration(), sponsorship: null };
|
|
2898
|
+
if (!paymasterAndData || !util.isHex(paymasterAndData)) return none;
|
|
2899
|
+
const bytes = util.hexToU8a(paymasterAndData);
|
|
2900
|
+
const bare = parseDeclaration(bytes, 0);
|
|
2901
|
+
if (bare) return { mode: "declaration", declaration: bare, sponsorship: null };
|
|
2902
|
+
if (!hasPermit2Sponsorship(bytes)) return none;
|
|
2903
|
+
const sponsorship = parseSponsorship(bytes);
|
|
2904
|
+
const tail = bytes.length > PERMIT2_SPONSORSHIP_BYTES ? parseDeclaration(bytes, PERMIT2_SPONSORSHIP_BYTES) : null;
|
|
2905
|
+
return { mode: "permit2", declaration: tail ?? absentDeclaration(), sponsorship };
|
|
2906
|
+
}
|
|
2907
|
+
function decodePhantomBidDeclaration(paymasterAndData) {
|
|
2908
|
+
return decodePhantomBidPaymasterAndData(paymasterAndData).declaration;
|
|
2909
|
+
}
|
|
2910
|
+
function encodePhantomBidPaymasterAndData(bid) {
|
|
2911
|
+
const declaration = encodePhantomBidDeclaration(bid);
|
|
2912
|
+
const sponsorship = bid.sponsorship;
|
|
2913
|
+
if (!sponsorship || sponsorship === "0x") return declaration;
|
|
2914
|
+
if (!util.isHex(sponsorship)) throw new Error("Phantom bid sponsorship is not hex");
|
|
2915
|
+
const bytes = util.hexToU8a(sponsorship);
|
|
2916
|
+
if (bytes.length !== PERMIT2_SPONSORSHIP_BYTES || !hasPermit2Sponsorship(bytes)) {
|
|
2917
|
+
throw new Error(
|
|
2918
|
+
`Phantom bid sponsorship must be a ${PERMIT2_SPONSORSHIP_BYTES}-byte Permit2-mode paymasterAndData, got ${bytes.length} bytes`
|
|
2919
|
+
);
|
|
2920
|
+
}
|
|
2921
|
+
return `${sponsorship}${declaration.slice(2)}`;
|
|
2922
|
+
}
|
|
2812
2923
|
function encodeAcceptedSourceChains(chains) {
|
|
2813
2924
|
return encodePhantomBidDeclaration({ acceptedSourceChains: chains });
|
|
2814
2925
|
}
|
|
@@ -3219,7 +3330,7 @@ async function runAggregation(params, isDelegated) {
|
|
|
3219
3330
|
continue;
|
|
3220
3331
|
}
|
|
3221
3332
|
countedSolvers.add(normalizedSolver);
|
|
3222
|
-
const declaration =
|
|
3333
|
+
const { declaration } = decodePhantomBidPaymasterAndData(decoded.paymasterAndData);
|
|
3223
3334
|
const acceptedSources = declaration.acceptedSources;
|
|
3224
3335
|
const poolPriced = declaration.uniswapV4Positions.length > 0;
|
|
3225
3336
|
const applyHaircut = (amount) => poolPriced ? applyUniswapQuoteHaircut(amount) : applyProtocolFeeHaircut(amount, protocolFeeHaircutBps);
|
|
@@ -3314,6 +3425,7 @@ exports.ENTRY_POINT_V08_ADDRESS = ENTRY_POINT_V08_ADDRESS;
|
|
|
3314
3425
|
exports.FILL_ORDER_ABI = FILL_ORDER_ABI;
|
|
3315
3426
|
exports.FILL_ORDER_V1_ABI = FILL_ORDER_V1_ABI;
|
|
3316
3427
|
exports.IntentGatewayV2 = IntentGatewayV2_default;
|
|
3428
|
+
exports.PERMIT2_SPONSORSHIP_BYTES = PERMIT2_SPONSORSHIP_BYTES;
|
|
3317
3429
|
exports.UNISWAP_QUOTE_HAIRCUT_BPS = UNISWAP_QUOTE_HAIRCUT_BPS;
|
|
3318
3430
|
exports.aggregatePhantomBids = aggregatePhantomBids;
|
|
3319
3431
|
exports.applyProtocolFeeHaircut = applyProtocolFeeHaircut;
|
|
@@ -3321,10 +3433,12 @@ exports.applyUniswapQuoteHaircut = applyUniswapQuoteHaircut;
|
|
|
3321
3433
|
exports.decodeAcceptedSourceChains = decodeAcceptedSourceChains;
|
|
3322
3434
|
exports.decodeERC7821ExecuteBatch = decodeERC7821ExecuteBatch;
|
|
3323
3435
|
exports.decodePhantomBidDeclaration = decodePhantomBidDeclaration;
|
|
3436
|
+
exports.decodePhantomBidPaymasterAndData = decodePhantomBidPaymasterAndData;
|
|
3324
3437
|
exports.decodeUserOpScale = decodeUserOpScale;
|
|
3325
3438
|
exports.encodeAcceptedSourceChains = encodeAcceptedSourceChains;
|
|
3326
3439
|
exports.encodeERC7821ExecuteBatch = encodeERC7821ExecuteBatch;
|
|
3327
3440
|
exports.encodePhantomBidDeclaration = encodePhantomBidDeclaration;
|
|
3441
|
+
exports.encodePhantomBidPaymasterAndData = encodePhantomBidPaymasterAndData;
|
|
3328
3442
|
exports.encodeUserOpScale = encodeUserOpScale;
|
|
3329
3443
|
exports.extractFillData = extractFillData;
|
|
3330
3444
|
exports.fetchBidsForOrder = fetchBidsForOrder;
|