@hyperbridge/sdk 2.8.2 → 2.8.4

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.
@@ -2,7 +2,7 @@ import { ConsolaInstance } from 'consola';
2
2
  import Decimal from 'decimal.js';
3
3
  import { GraphQLClient } from 'graphql-request';
4
4
  import * as viem from 'viem';
5
- import { PublicClient, TransactionReceipt, Hex, Log, ContractFunctionArgs, Address } from 'viem';
5
+ import { PublicClient, TransactionReceipt, Hex, Log, ContractFunctionArgs, Chain as Chain$1, Address } from 'viem';
6
6
  import { Chain } from 'viem/chains';
7
7
  import { ApiPromise } from '@polkadot/api';
8
8
  import { KeyringPair } from '@polkadot/keyring/types';
@@ -891,7 +891,9 @@ declare const tronNile: {
891
891
  verifyHash?: ((client: viem.Client, parameters: viem.VerifyHashActionParameters) => Promise<viem.VerifyHashActionReturnType>) | undefined;
892
892
  };
893
893
  declare const tronChainIds: Set<number>;
894
- type ConfiguredAssetSymbol = "WETH" | "DAI" | "USDC" | "USDT" | "cNGN" | "EXT";
894
+ type ConfiguredAssetSymbol = "WETH" | "DAI" | "USDC" | "USDT" | "cNGN" | "EXT" | "ZARP" | "EURC" | "XSGD" | "TRYB" | "USDR";
895
+ /** A configured asset symbol in its canonical, lowercase, or uppercase form. */
896
+ type ConfiguredAssetSymbolInput = ConfiguredAssetSymbol | Lowercase<ConfiguredAssetSymbol> | Uppercase<ConfiguredAssetSymbol>;
895
897
  interface UniswapV4PoolConfigData {
896
898
  tokens: readonly [ConfiguredAssetSymbol, ConfiguredAssetSymbol];
897
899
  fee: number;
@@ -1020,7 +1022,7 @@ interface ChainConfigData {
1020
1022
  layerZeroEid?: number;
1021
1023
  }
1022
1024
  declare const chainConfigs: Record<number, ChainConfigData>;
1023
- declare const getConfigByStateMachineId: (id: Chains) => ChainConfigData | undefined;
1025
+ declare const getConfigByStateMachineId: (id: string) => ChainConfigData | undefined;
1024
1026
  declare const getChainId: (stateMachineId: string) => number | undefined;
1025
1027
  declare const getViemChain: (chainId: number) => Chain | undefined;
1026
1028
  declare const hyperbridgeAddress = "";
@@ -1061,6 +1063,12 @@ declare class ChainConfigService {
1061
1063
  * it, so a new asset is added once in `chain.ts` and nowhere else.
1062
1064
  */
1063
1065
  getAssetBySymbol(chain: string, symbol: string): HexString$1 | undefined;
1066
+ /** Resolves a configured token symbol case-insensitively on a specific chain. */
1067
+ getAssetMetadataBySymbol(chain: string, symbol: string): {
1068
+ symbol: ConfiguredAssetSymbol;
1069
+ address: HexString$1;
1070
+ decimals?: number;
1071
+ } | undefined;
1064
1072
  getCNgnDecimals(chain: string): number | undefined;
1065
1073
  getExtAsset(chain: string): HexString$1 | undefined;
1066
1074
  getExtDecimals(chain: string): number | undefined;
@@ -1917,6 +1925,25 @@ declare function convertCodecToIProof(codec: {
1917
1925
  }): IProof;
1918
1926
  declare function encodeISMPMessage(message: IIsmpMessage): Uint8Array;
1919
1927
 
1928
+ /**
1929
+ * How long a submitted extrinsic has to reach a block before the attempt is treated as stalled.
1930
+ *
1931
+ * Sized against the bid window, not against how long inclusion can conceivably take: a bid is worth
1932
+ * nothing once its window closes, so an extrinsic still sitting in the pool after a few blocks is
1933
+ * better replaced by a higher-tipped copy than waited on.
1934
+ */
1935
+ declare const INCLUSION_TIMEOUT_MS = 20000;
1936
+ /**
1937
+ * Maps a websocket endpoint onto the HTTP endpoint of the same node — substrate serves both on the
1938
+ * same host and port, so the scheme is the only difference. Throws for anything that is not a
1939
+ * `ws(s)://` url rather than guessing at an endpoint.
1940
+ *
1941
+ * The HTTP endpoint is always derived, never configured, because it must be the *same node* as the
1942
+ * websocket: phantom orders are read out of that node's offchain worker storage, which is
1943
+ * node-local and not replicated, so a separately configured host would return nothing for orders
1944
+ * the events said exist.
1945
+ */
1946
+ declare function deriveHttpUrl(wsUrl: string): string;
1920
1947
  /**
1921
1948
  * Encodes a PackedUserOperation using SCALE codec for submission to Hyperbridge.
1922
1949
  * This is the recommended way to encode UserOps for the intents coprocessor.
@@ -1948,8 +1975,41 @@ interface PhantomOrderEvent {
1948
1975
  */
1949
1976
  legs: PhantomOrderLeg[];
1950
1977
  }
1978
+ /** One phantom bid to place, and the bid it replaces on the same chain. */
1979
+ interface PhantomBid {
1980
+ /** The phantom order commitment being bid on. */
1981
+ commitment: HexString$1;
1982
+ /** The SCALE-encoded PackedUserOperation backing the quote. */
1983
+ userOp: HexString$1;
1984
+ /**
1985
+ * A live bid from a previous interval on the same chain, retracted alongside this one to
1986
+ * reclaim its deposit. Best-effort: a retraction that fails never affects the bid.
1987
+ */
1988
+ retractCommitment?: HexString$1;
1989
+ }
1990
+ /** What became of one bid in a batch. */
1991
+ interface PhantomBidOutcome {
1992
+ commitment: HexString$1;
1993
+ success: boolean;
1994
+ /** The dispatch error that rejected this bid, when it failed. */
1995
+ error?: string;
1996
+ }
1997
+ interface PhantomBidBatchResult {
1998
+ /** One entry per submitted bid, in the order they were given. */
1999
+ bids: PhantomBidOutcome[];
2000
+ /** The block and extrinsic the bids landed in. */
2001
+ blockHash?: HexString$1;
2002
+ extrinsicHash?: HexString$1;
2003
+ /**
2004
+ * The batch reached the pool but its inclusion was not observed, so no per-bid outcome is
2005
+ * known. Same contract as {@link BidSubmissionResult.pending}: in flight, do not re-sign.
2006
+ */
2007
+ pending?: boolean;
2008
+ /** Set when the batch never landed at all, or when its item events could not be attributed. */
2009
+ error?: string;
2010
+ }
1951
2011
  interface PollPhantomOrdersOptions {
1952
- /** How often to check for a new head. Defaults to 6s, roughly one block. */
2012
+ /** How often to check for a new head. Defaults to 15s, or 6s when the runtime is Gargantua. */
1953
2013
  intervalMs?: number;
1954
2014
  /**
1955
2015
  * Most blocks scanned in a single poll, so a long outage catches up over several ticks instead of
@@ -1977,6 +2037,8 @@ declare class IntentsCoprocessor {
1977
2037
  private ownsConnection;
1978
2038
  /** Cached result of whether the node exposes intents_* RPC methods */
1979
2039
  private hasIntentsRpc;
2040
+ /** The HTTP-backed api, connected on first use. Cleared after a failed attempt so it retries. */
2041
+ private httpApi;
1980
2042
  private submissionQueue;
1981
2043
  /**
1982
2044
  * Creates and connects an IntentsCoprocessor to a Hyperbridge node.
@@ -2003,11 +2065,44 @@ declare class IntentsCoprocessor {
2003
2065
  */
2004
2066
  static fromApi(api: ApiPromise, substratePrivateKey?: string): IntentsCoprocessor;
2005
2067
  private constructor();
2068
+ /**
2069
+ * The API every RPC query runs on: HTTP, connected to the same node as the websocket. Exposed so
2070
+ * callers query through this connection rather than opening one of their own.
2071
+ *
2072
+ * The split is by what each transport is for. Queries are one-shot request/response, which HTTP
2073
+ * serves without holding any state that can silently rot between calls. The websocket earns its
2074
+ * keep only where subscriptions do — watching a submitted extrinsic to inclusion.
2075
+ */
2076
+ queryApi(): Promise<ApiPromise>;
2077
+ /**
2078
+ * The websocket API, exposed so callers share this one connection instead of opening a second
2079
+ * socket to the same node. Only needed for subscriptions; use {@link queryApi} to read.
2080
+ */
2081
+ get apiConnection(): ApiPromise;
2006
2082
  /**
2007
2083
  * Disconnects the underlying API connection if this instance owns it.
2008
- * Only disconnects if created via `connect()`, not when using shared connections.
2084
+ * Only disconnects the websocket if created via `connect()`, not when using shared connections.
2085
+ * The HTTP api is always created here, so it is always ours to close.
2009
2086
  */
2010
2087
  disconnect(): Promise<void>;
2088
+ /**
2089
+ * The HTTP api for this node, connected on first use. Every coprocessor has one — the endpoint
2090
+ * is derived from the websocket's own endpoint, so there is nothing to configure and nothing to
2091
+ * be absent.
2092
+ *
2093
+ * The connection attempt is bounded on both sides. `isReadyOrError` rejects on a failed
2094
+ * handshake, where plain `isReady` would simply never resolve, and the timeout covers an
2095
+ * endpoint that accepts the request and then goes quiet. An unbounded wait here would hang the
2096
+ * poll tick awaiting it, which is precisely the silent stall that polling exists to avoid. A
2097
+ * failed attempt is not cached, so the next call tries again.
2098
+ */
2099
+ private http;
2100
+ /**
2101
+ * The endpoint the websocket provider is connected to. Read from the provider rather than
2102
+ * remembered from a constructor argument, so it is the one endpoint in use no matter which
2103
+ * factory built this instance.
2104
+ */
2105
+ private wsEndpoint;
2011
2106
  /**
2012
2107
  * Creates a Substrate keypair from the configured private key.
2013
2108
  * Supports hex seed (with or without 0x), mnemonic phrases, and URI derivation paths (//Alice).
@@ -2016,22 +2111,62 @@ declare class IntentsCoprocessor {
2016
2111
  /**
2017
2112
  * Signs and sends an extrinsic. Submissions are serialised through {@link submissionQueue} so
2018
2113
  * concurrent calls never collide on the substrate account nonce — each extrinsic reaches a block
2019
- * (or is confirmed still pooled and returned as `pending`) before the next is signed; auto-nonce
2020
- * via `system.accountNextIndex` counts pooled extrinsics, so a pending one is never re-used.
2114
+ * (or is confirmed still pooled and returned as `pending`) before the next is signed. The
2115
+ * auto-nonce is the account's on-chain nonce, so a still-pooled extrinsic does not advance it: a
2116
+ * submission signed behind a pending one bounces off it (1013/1014) and is reported as pending
2117
+ * too, rather than landing as a second copy.
2118
+ *
2119
+ * The extrinsic is built rather than passed in because the api it is built on decides where it
2120
+ * is signed and sent: a websocket that is down when the queue reaches this submission diverts it
2121
+ * to {@link sendViaHttp}, which needs the call bound to the HTTP api instead.
2021
2122
  */
2022
2123
  private signAndSendExtrinsic;
2124
+ /**
2125
+ * Last-resort submission for when the websocket is down at signing time. A bid is only worth
2126
+ * anything inside its window, so waiting for a reconnect usually means not bidding at all.
2127
+ *
2128
+ * HTTP has no subscriptions, so this is `author_submitExtrinsic`: the node accepts the extrinsic
2129
+ * into its pool and returns its hash, and nothing further is observable from here. That is
2130
+ * exactly the `pending` contract — in flight, outcome unknown, do not re-sign — so the result
2131
+ * says so rather than claiming a success it cannot see.
2132
+ *
2133
+ * Only reached when the socket was already down before signing. A submission that got as far as
2134
+ * the pool over the websocket is never retried here: that is the duplicate-nonce race the
2135
+ * `pending` result exists to prevent.
2136
+ */
2137
+ private sendViaHttp;
2023
2138
  /**
2024
2139
  * Signs and sends an extrinsic, handling status updates and errors.
2025
2140
  * Implements retry logic with progressive tip increases for stuck transactions.
2026
2141
  *
2027
- * A retry only happens when the previous attempt verifiably went nowhere. Once an attempt's
2028
- * extrinsic is known to be pooled (`pending`), re-signing the same call would race our own
2029
- * submission: the copy either bounces off the pool (1014, same nonce below the replacement
2030
- * priority bump) or if the original lands first, freeing the nonce — executes as a duplicate
2031
- * and fails on-chain (e.g. `BidNotFound` for a retraction). Neither can succeed, so the pending
2032
- * result is returned for the caller to confirm later.
2142
+ * Two kinds of failure are retried, and the difference is the nonce.
2143
+ *
2144
+ * An attempt that verifiably went nowhere (rejected before the pool, dropped, invalid) leaves
2145
+ * the account nonce free, so the next attempt simply re-signs with the auto-nonce.
2146
+ *
2147
+ * An attempt that reached the pool and was still there when the watch timed out (`stalled`) is
2148
+ * retried as a *replacement*: the same nonce it was signed with, and double the tip. Substrate's
2149
+ * pool evicts a pooled extrinsic in favour of a higher-priority one at the same (account, nonce),
2150
+ * so exactly one of the two can ever execute. This matters for a bid, which is worth nothing once
2151
+ * its window closes — waiting out a stalled extrinsic usually means not bidding at all.
2152
+ *
2153
+ * Re-signing without pinning the nonce is what must never happen here. The auto-nonce is read
2154
+ * from on-chain state, so it is only the stalled extrinsic's nonce for as long as that extrinsic
2155
+ * stays out of a block — and a stall is precisely the case where it may land at any moment. Once
2156
+ * it does, an unpinned retry takes the *next* nonce and both execute: a duplicate `placeBid` that
2157
+ * fails on-chain, and a second `retractBid` that pulls the bid just placed. When the signed nonce
2158
+ * cannot be read, the stalled result is returned rather than guessed at.
2159
+ *
2160
+ * A rejection that bounced off a copy already pooled (1013/1014) is likewise left alone: that
2161
+ * copy is in flight and its outcome is unknown here, so the `pending` result goes back to the
2162
+ * caller to confirm later.
2033
2163
  */
2034
2164
  private sendExtrinsicWithRetries;
2165
+ /**
2166
+ * The nonce an extrinsic was signed with, or undefined if it carries no readable one — which is
2167
+ * the case before it has ever been signed, and for a stub api in tests.
2168
+ */
2169
+ private signedNonce;
2035
2170
  /**
2036
2171
  * Classifies a submission rejection. Codes 1013 ("already imported") and 1014 ("priority is
2037
2172
  * too low") both mean a copy of this account+nonce is already in the pool — almost always our
@@ -2045,8 +2180,13 @@ declare class IntentsCoprocessor {
2045
2180
  *
2046
2181
  * A timeout is only a failure when the extrinsic never made it into the transaction pool.
2047
2182
  * Once a pool-entry status (Future/Ready/Broadcast/Retracted) has been seen, the extrinsic is
2048
- * in flight and may well execute after the watch is abandoned — the result is then `pending`,
2049
- * telling the caller to confirm the outcome later instead of re-signing the same call.
2183
+ * in flight and may well execute after the watch is abandoned — the result is then `pending`
2184
+ * and `stalled`, telling the caller to replace it under the same nonce or confirm it later,
2185
+ * never to re-sign the same call under a fresh one.
2186
+ *
2187
+ * `nonce` pins the submission to a specific account nonce, which is what makes a retry a pool
2188
+ * replacement rather than a second extrinsic queued behind the first. Left undefined on the
2189
+ * first attempt, where the api's auto-nonce is correct.
2050
2190
  */
2051
2191
  private sendWithTimeout;
2052
2192
  /**
@@ -2087,6 +2227,40 @@ declare class IntentsCoprocessor {
2087
2227
  * @returns BidSubmissionResult with success status and block/extrinsic hash
2088
2228
  */
2089
2229
  submitBidWithRetraction(retractCommitment: HexString$1, bidCommitment: HexString$1, userOp: HexString$1): Promise<BidSubmissionResult>;
2230
+ /**
2231
+ * Places every phantom bid of one interval in a single extrinsic, retracting each chain's
2232
+ * previous bid alongside it.
2233
+ *
2234
+ * The pallet registers one phantom order per configured chain in the same block, so this is the
2235
+ * whole interval's set. Submitting them one at a time costs a block per chain: submissions are
2236
+ * serialised on the account nonce and each waits for inclusion, so the last chain's bid is many
2237
+ * blocks behind the first, against a bid window measured in tens of blocks. Batched, every bid
2238
+ * lands in the same block.
2239
+ *
2240
+ * Uses `utility.force_batch`, not `utility.batch`. `batch` stops at the first failing call, so
2241
+ * one rejected bid — a closed window, a duplicate, an insufficient deposit — would silently
2242
+ * drop every bid after it. `force_batch` runs them all and reports each outcome. It needs no
2243
+ * special origin: any signed account may call it, exactly like `batch`.
2244
+ *
2245
+ * @param bids - The bids to place; an empty list is a no-op
2246
+ * @returns Per-bid outcomes, in the order given
2247
+ */
2248
+ submitPhantomBids(bids: PhantomBid[]): Promise<PhantomBidBatchResult>;
2249
+ /**
2250
+ * Reads one outcome per call out of a force_batch's events.
2251
+ *
2252
+ * `ItemFailed` carries no index — pallet-utility emits exactly one `ItemCompleted` or
2253
+ * `ItemFailed` per call, in call order, so the k-th item event belongs to call k.
2254
+ *
2255
+ * A count that does not match the calls submitted means the events are not the ones assumed
2256
+ * here, and every attribution after the discrepancy would be off by one. The bids are then
2257
+ * reported as placed: a bid wrongly recorded as landed is retracted next interval and the
2258
+ * retraction harmlessly fails with `BidNotFound`, whereas one wrongly recorded as failed is
2259
+ * never retracted at all and leaves its deposit reserved.
2260
+ */
2261
+ private readForceBatchItems;
2262
+ /** Renders a DispatchError as `pallet::Error`, falling back to its raw form. */
2263
+ private describeDispatchError;
2090
2264
  /**
2091
2265
  * Fetches all bid storage entries for a given order commitment.
2092
2266
  * Returns the on-chain data only (filler addresses and deposits).
@@ -2134,7 +2308,13 @@ declare class IntentsCoprocessor {
2134
2308
  */
2135
2309
  getPhantomOrdersInBlock(blockNumber: number): Promise<PhantomOrderEvent[]>;
2136
2310
  /**
2137
- * Polls for newly registered phantom orders, invoking the callback once per order.
2311
+ * Polls for newly registered phantom orders, invoking the callback once per block that carries
2312
+ * any, with all of that block's orders.
2313
+ *
2314
+ * Per block rather than per order because that is how the pallet writes them: one order per
2315
+ * configured chain, all registered in the same `on_initialize`. Delivering them together lets a
2316
+ * caller bid on the whole interval in one extrinsic (see {@link submitPhantomBids}) instead of
2317
+ * one per chain.
2138
2318
  *
2139
2319
  * Each tick reads the current head and scans every block between the last one processed and that
2140
2320
  * head, so the block cursor — not the connection — determines what has been seen. This replaced a
@@ -2147,9 +2327,21 @@ declare class IntentsCoprocessor {
2147
2327
  * cannot drop them, because the cursor only advances past a block whose events were actually
2148
2328
  * read. Recovery replays the backlog.
2149
2329
  *
2330
+ * Every read here goes over HTTP, never the websocket. Polling is a sequence of independent
2331
+ * one-shot requests with no state to lose between them, which is exactly what a stateless
2332
+ * transport does well: a request either answers or fails loudly on this tick, instead of a
2333
+ * socket that looks alive while delivering nothing. It also means a websocket outage does not
2334
+ * pause phantom bidding at all — the two transports fail independently.
2335
+ *
2150
2336
  * Returns a function that stops polling.
2151
2337
  */
2152
- pollPhantomOrders(callback: (event: PhantomOrderEvent) => void, options?: PollPhantomOrdersOptions): () => void;
2338
+ pollPhantomOrders(callback: (events: PhantomOrderEvent[]) => void, options?: PollPhantomOrdersOptions): () => void;
2339
+ /**
2340
+ * The poll cadence for the runtime this instance is connected to: Gargantua polls every block,
2341
+ * everything else every 15s. Falls back to the slower cadence if the runtime cannot be read,
2342
+ * since an unreachable node is the poll's problem to report, not the cadence lookup's.
2343
+ */
2344
+ private phantomPollIntervalMs;
2153
2345
  }
2154
2346
 
2155
2347
  /**
@@ -3231,6 +3423,17 @@ interface FillerConfig {
3231
3423
  * chains"; an empty array declares that no source chain is accepted.
3232
3424
  */
3233
3425
  acceptedSourceChains?: string[];
3426
+ /**
3427
+ * Uniswap V4 position tokenIds this filler holds, per chain (state machine id -> tokenIds as
3428
+ * decimal strings), declared inside its phantom bids' paymasterAndData for the bid's own chain.
3429
+ *
3430
+ * Liquidity parked in a V4 position is invisible to the snapshot's inventory read, which sees
3431
+ * only ERC-20 balances and ERC-4626 vault shares — so without this a venue-funded filler is
3432
+ * weighted at zero and its quotes are discarded. The declaration is only a POINTER: the indexer
3433
+ * reads each position's liquidity on-chain and checks it is owned by the solver that signed the
3434
+ * bid, so naming a position cannot inflate it and naming someone else's achieves nothing.
3435
+ */
3436
+ uniswapV4PositionsByChain?: Record<string, string[]>;
3234
3437
  }
3235
3438
  /**
3236
3439
  * Result of an order execution attempt
@@ -3524,25 +3727,51 @@ interface PhantomOrderPriceSnapshotsResponse {
3524
3727
  }>;
3525
3728
  };
3526
3729
  }
3730
+ /** One independently reported slice of indexed liquidity. */
3731
+ interface LiquiditySlice {
3732
+ totalLiquidity: string;
3733
+ providerCount: number;
3734
+ }
3527
3735
  /**
3528
- * Total solver liquidity measured at one immutable Phantom price snapshot.
3736
+ * Indexed destination capacity and its source-routing slices.
3529
3737
  *
3530
- * Liquidity amounts are decimal strings formatted with the configured decimals
3531
- * for their respective `tokenAddress` and chain.
3738
+ * The SDK reports the indexer's facts separately and does not decide whether a
3739
+ * source chain is covered by the legacy unrestricted-bidder policy.
3532
3740
  */
3533
- interface AvailableLiquiditySnapshot {
3534
- totalLiquidity: string;
3535
- providerCount: number;
3741
+ interface AvailableLiquidity {
3742
+ sourceChain: Chains;
3743
+ destinationChain: Chains;
3536
3744
  tokenAddress: HexString$1;
3537
- snapshotTime: Date;
3538
- liquidityByChain: AvailableLiquidityByChain[];
3745
+ updatedAt: Date;
3746
+ destination: LiquiditySlice;
3747
+ unrestricted: LiquiditySlice;
3748
+ explicitRoute: (LiquiditySlice & {
3749
+ updatedAt: Date;
3750
+ }) | null;
3539
3751
  }
3540
- /** Liquidity for one chain/token balance group in an availability snapshot. */
3541
- interface AvailableLiquidityByChain {
3542
- chain: string;
3543
- tokenAddress: HexString$1;
3544
- totalLiquidity: string;
3545
- providerCount: number;
3752
+ /**
3753
+ * Chain-specific buy and sell rates expressed as quote-token units per one
3754
+ * base token. The quote token is the less valuable currency when the indexed
3755
+ * rates establish an ordering (for example, cNGN in a USDC/cNGN pair).
3756
+ */
3757
+ interface BuyAndSellRates {
3758
+ baseTokenSymbol: ConfiguredAssetSymbol;
3759
+ quoteTokenSymbol: ConfiguredAssetSymbol;
3760
+ sourceChain: Chains;
3761
+ destinationChain: Chains;
3762
+ /** Quote-token units received when buying the quote token with one base token. */
3763
+ buyRate: string | null;
3764
+ /** Quote-token units sold to receive one base token. */
3765
+ sellRate: string | null;
3766
+ buyRateUpdatedAt: Date | null;
3767
+ sellRateUpdatedAt: Date | null;
3768
+ }
3769
+ /** Symbol-only input for querying an indexed pool's rates. */
3770
+ interface QueryBuyAndSellRatesParams {
3771
+ tokenInSymbol: ConfiguredAssetSymbolInput;
3772
+ tokenOutSymbol: ConfiguredAssetSymbolInput;
3773
+ sourceChainId: Chain$1["id"];
3774
+ destinationChainId: Chain$1["id"];
3546
3775
  }
3547
3776
  interface TokenPrice {
3548
3777
  symbol: string;
@@ -5066,8 +5295,6 @@ declare class IntentGateway {
5066
5295
  private readonly gasEstimator;
5067
5296
  /** Quote strategies for pricing orders before placement, keyed by strategy name. */
5068
5297
  private readonly quoteStrategies;
5069
- /** Resolves order tokens to canonical Phantom snapshot market pairs. */
5070
- private readonly phantomSnapshotPairResolver;
5071
5298
  /**
5072
5299
  * Private constructor — use {@link IntentGateway.create} instead.
5073
5300
  *
@@ -5123,17 +5350,22 @@ declare class IntentGateway {
5123
5350
  */
5124
5351
  quoteIntent(params: QuoteIntentParams): Promise<QuoteIntentResult>;
5125
5352
  /**
5126
- * Returns the output-token liquidity measured in the latest directional
5127
- * Phantom snapshot for this gateway's source and destination.
5353
+ * Returns indexed destination liquidity and its source-routing slices.
5128
5354
  *
5129
- * Pair resolution uses the same canonical Base market as {@link quoteIntent}.
5130
- * The snapshot itself determines the output token and chain to aggregate. The
5131
- * amount is in the token's smallest unit and reflects the indexer's
5132
- * `snapshotTime`; it is not a live reservation or fill guarantee.
5355
+ * Destination, unrestricted, and explicit-route capacity come exclusively
5356
+ * from the indexer's pair-centric liquidity entities. The SDK does not decide
5357
+ * whether unrestricted bidders cover the source chain. Amounts reflect the
5358
+ * latest rolling sample; they are not reservations or fill guarantees.
5133
5359
  *
5134
5360
  * Requires a prior call to {@link withQueryClient}.
5135
5361
  */
5136
- queryAvailableLiquidity(params: Pick<QuoteIntentParams, "tokenIn" | "tokenOut">): Promise<AvailableLiquiditySnapshot | undefined>;
5362
+ queryAvailableLiquidity(params: Pick<QuoteIntentParams, "tokenIn" | "tokenOut">): Promise<AvailableLiquidity | undefined>;
5363
+ /**
5364
+ * Returns chain-specific buy and sell rates in less-valued quote-token units
5365
+ * without requiring token addresses. Symbols are matched case-insensitively;
5366
+ * chain IDs are numeric IDs for chains configured in the SDK.
5367
+ */
5368
+ queryBuyAndSellRates(params: QueryBuyAndSellRatesParams): Promise<BuyAndSellRates | undefined>;
5137
5369
  /**
5138
5370
  * Bidirectional async generator that orchestrates the full order lifecycle:
5139
5371
  * placement, fee estimation, bid collection, and execution.
@@ -5477,6 +5709,26 @@ declare class IntentGateway {
5477
5709
  }, void>;
5478
5710
  }
5479
5711
 
5712
+ declare class InvalidLiquidityIndexerResponseError extends Error {
5713
+ constructor(reason: string);
5714
+ }
5715
+ declare class UnsupportedLiquidityAssetError extends Error {
5716
+ constructor(chain: string, asset: string);
5717
+ }
5718
+ declare class UnsupportedLiquidityChainError extends Error {
5719
+ constructor(chainId: number | string);
5720
+ }
5721
+
5722
+ /**
5723
+ * Canonical symbol order used by the SDK and indexer pool IDs.
5724
+ *
5725
+ * Plain code-unit comparison, never locale-sensitive collation — the result is
5726
+ * a persisted primary key and must sort identically everywhere.
5727
+ */
5728
+ declare function sortPoolSymbols<Symbol extends string>(symbolA: Symbol, symbolB: Symbol): [Symbol, Symbol];
5729
+ /** Canonical indexer pool ID for a pair of canonical token symbols. */
5730
+ declare function poolSlug(symbolA: string, symbolB: string): string;
5731
+
5480
5732
  /**
5481
5733
  * Checks the on-chain fill and refund status of IntentGatewayV2 orders.
5482
5734
  *
@@ -5662,6 +5914,12 @@ declare class CryptoUtils {
5662
5914
  * signing infrastructure (hardware wallets, MPC/TEE policy engines) instead
5663
5915
  * of an opaque 32-byte digest.
5664
5916
  *
5917
+ * The payload must be a standard self-describing `eth_signTypedData_v4`
5918
+ * payload — `EIP712Domain` listed in `types`, `chainId` as a JSON number —
5919
+ * because some signing backends (e.g. MPC Vault) hash it server-side from
5920
+ * the JSON rather than locally via viem. viem ignores both details when
5921
+ * hashing, so the digest is unchanged for local signers.
5922
+ *
5665
5923
  * @param userOp - The packed UserOperation to sign (signature field ignored).
5666
5924
  * @param entryPoint - Address of the EntryPoint v0.8 contract.
5667
5925
  * @param chainId - Chain ID of the network on which the operation will execute.
@@ -5675,10 +5933,44 @@ declare class CryptoUtils {
5675
5933
  verifyingContract: `0x${string}`;
5676
5934
  };
5677
5935
  types: {
5678
- PackedUserOperation: {
5679
- name: string;
5680
- type: string;
5681
- }[];
5936
+ readonly EIP712Domain: readonly [{
5937
+ readonly name: "name";
5938
+ readonly type: "string";
5939
+ }, {
5940
+ readonly name: "version";
5941
+ readonly type: "string";
5942
+ }, {
5943
+ readonly name: "chainId";
5944
+ readonly type: "uint256";
5945
+ }, {
5946
+ readonly name: "verifyingContract";
5947
+ readonly type: "address";
5948
+ }];
5949
+ readonly PackedUserOperation: readonly [{
5950
+ readonly name: "sender";
5951
+ readonly type: "address";
5952
+ }, {
5953
+ readonly name: "nonce";
5954
+ readonly type: "uint256";
5955
+ }, {
5956
+ readonly name: "initCode";
5957
+ readonly type: "bytes";
5958
+ }, {
5959
+ readonly name: "callData";
5960
+ readonly type: "bytes";
5961
+ }, {
5962
+ readonly name: "accountGasLimits";
5963
+ readonly type: "bytes32";
5964
+ }, {
5965
+ readonly name: "preVerificationGas";
5966
+ readonly type: "uint256";
5967
+ }, {
5968
+ readonly name: "gasFees";
5969
+ readonly type: "bytes32";
5970
+ }, {
5971
+ readonly name: "paymasterAndData";
5972
+ readonly type: "bytes";
5973
+ }];
5682
5974
  };
5683
5975
  primaryType: "PackedUserOperation";
5684
5976
  message: {
@@ -5803,16 +6095,38 @@ declare class CryptoUtils {
5803
6095
  }
5804
6096
 
5805
6097
  type HexString = `0x${string}`;
6098
+ /** What a phantom bid's paymasterAndData declares about the solver behind it. */
6099
+ interface PhantomBidDeclaration {
6100
+ /**
6101
+ * Source chains the solver accepts payment from. Null when the bid carries no parseable
6102
+ * declaration (the legacy default: the solver has not restricted its sources); an empty array
6103
+ * is an explicit accepts-nothing. Callers must preserve that distinction.
6104
+ */
6105
+ acceptedSources: string[] | null;
6106
+ /**
6107
+ * Uniswap V4 position tokenIds the solver declares as backing this bid, on the order's own
6108
+ * chain. Empty when none are declared — including for every v1 bid, which predates the field.
6109
+ */
6110
+ uniswapV4Positions: bigint[];
6111
+ }
5806
6112
  /**
5807
- * Encodes the accepted source chains (state machine ids, e.g. "EVM-8453") into the
5808
- * paymasterAndData declaration blob.
6113
+ * Encodes a phantom bid's declaration into the paymasterAndData blob. Emits the v1 layout when no
6114
+ * positions are declared, so a solver that only names source chains produces exactly the bytes it
6115
+ * produced before positions existed.
5809
6116
  */
5810
- declare function encodeAcceptedSourceChains(chains: string[]): HexString;
6117
+ declare function encodePhantomBidDeclaration(declaration: {
6118
+ acceptedSourceChains?: string[];
6119
+ uniswapV4Positions?: bigint[];
6120
+ }): HexString;
5811
6121
  /**
5812
- * Decodes a phantom bid's paymasterAndData into its declared source chains. Returns null for an
5813
- * absent, unversioned or malformed blob the legacy default and an empty array only for an
5814
- * explicit zero-entry declaration. Callers must preserve that distinction.
6122
+ * Decodes a phantom bid's paymasterAndData. Understands both layout versions, so bids placed
6123
+ * before positions existed keep decoding unchanged. Anything absent, unversioned or malformed
6124
+ * yields a null `acceptedSources` with no positions — never a partial read.
5815
6125
  */
6126
+ declare function decodePhantomBidDeclaration(paymasterAndData: string | undefined | null): PhantomBidDeclaration;
6127
+ /** Back-compat wrapper: the source-chain half of {@link encodePhantomBidDeclaration}. */
6128
+ declare function encodeAcceptedSourceChains(chains: string[]): HexString;
6129
+ /** Back-compat wrapper: the source-chain half of {@link decodePhantomBidDeclaration}. */
5816
6130
  declare function decodeAcceptedSourceChains(paymasterAndData: string | undefined | null): string[] | null;
5817
6131
 
5818
6132
  declare const ABI$1: readonly [{
@@ -10698,4 +11012,4 @@ declare function teleport(teleport_param: {
10698
11012
  extrinsics?: Array<SubmittableExtrinsic<"promise", ISubmittableResult>>;
10699
11013
  }): Promise<ReadableStream<HyperbridgeTxEvents>>;
10700
11014
 
10701
- export { ADDRESS_ZERO, type AllStatusKey, type AssetTeleported, type AssetTeleportedResponse, type AvailableLiquidityByChain, type AvailableLiquiditySnapshot, type Bid, type BidStorageEntry, type BidSubmissionResult, type BlockMetadata, type BridgeParams, type BridgeStep, type BundlerGasEstimate, BundlerMethod, type BytesLikeHex, type CancelEvent, type CancelOptions, type CancelOrderOptions, type CancelQuote, type ChainConfig, type ChainConfigData, ChainConfigService, Chains, type ClientConfig, type ConfiguredAssetSymbol, CryptoUtils, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DOMAIN_TYPEHASH, DUMMY_PRIVATE_KEY, type DecodedOrderPlacedLog, type DecodedPostRequestEvent, type DecodedPostResponseEvent, type Deployment, type DispatchGet, type DispatchInfo, type DispatchPost, ERC20Method, type ERC7821Call, ERC7821_BATCH_MODE, type Erc4626VaultConfigData, type EstimateFillOrderParams, type EstimateGasCallData, EvmChain, type EvmChainParams, ABI as EvmHostABI, EvmLanguage, type ExecuteIntentOrderOptions, type ExecutionResult, type FillOptions, type FillOrderEstimate, type FillerBid, type FillerConfig, type GetRequestResponse, type GetRequestWithStatus, type GetResponseByRequestIdResponse, type GetResponseStorageValues, type HexString$1 as HexString, type HostParams, HyperClientStatus, HyperFungibleToken, HyperFungibleTokenABI, type HyperbridgeTxEvents, type IBatchConsensusAndGetResponseMessage, type IBatchConsensusAndPostRequestMessage, type IChain, type IConfig, type IConsensusMessage, type IEvmChain, type IEvmConfig, type IGetRequest, type IGetRequestMessage, type IGetResponse, type IGetResponseMessage, type IHyperbridgeConfig, type IIsmpMessage, type IMessage, type IPharosConfig, type IPolkadotHubConfig, type IPostRequest, type IPostResponse, type IProof, type IRequestMessage, type ISubstrateConfig, type ITimeoutPostRequestMessage, type IndexerQueryClient, IntentGateway, ABI$1 as IntentGatewayABI, type IntentGatewayContext, type IntentGatewayParams, IntentOrderStatus, type IntentOrderStatusKey, type IntentOrderStatusUpdate, type IntentQuoteStrategy, type IntentQuoteTradeType, IntentsCoprocessor, InvalidPhantomSnapshotError, IsmpClient, type IsmpRequest, MOCK_ADDRESS, ORDER_V2_PARAM_TYPE, type Order, type OrderFeesQuote, type OrderResponse, OrderStatus, OrderStatusChecker, type OrderStatusMetadata, type OrderWithStatus, PACKED_USEROP_TYPEHASH, PLACE_ORDER_SELECTOR, type PackedUserOperation, type Params, type PaymentInfo, type PhantomOrderEvent, type PhantomOrderLeg, type PhantomOrderPriceSnapshot, type PhantomOrderPriceSnapshotsResponse, type PhantomSnapshotIntentQuoteMetadata, type PhantomSnapshotQuoteIntentResult, PhantomSnapshotUnavailableError, PharosChain, type PharosChainParams, PolkadotHubChain, type PolkadotHubChainParams, type PollPhantomOrdersOptions, type PostRequestStatus, type PostRequestTimeoutStatus, type PostRequestWithStatus, type QuoteIntentParams, type QuoteIntentResult, type QuoteNativeResult, type QuoteResult, type QuoteUniswapParams, type QuoteUniswapResult, REQUEST_COMMITMENTS_SLOT, REQUEST_RECEIPTS_SLOT, RESPONSE_COMMITMENTS_SLOT, RESPONSE_RECEIPTS_SLOT, type RequestBody, type RequestCommitment, RequestKind, type RequestResponse, RequestStatus, type RequestStatusKey, type RequestStatusWithMetadata, type ResponseCommitmentWithValues, type ResumeIntentOrderOptions, type RetryConfig, SELECT_SOLVER_TYPEHASH, STATE_COMMITMENTS_SLOT, type SelectBidResult, type SelectOptions, type SigningAccount, type StateMachineHeight, type StateMachineId, type StateMachineIdParams, type StateMachineResponse, type StateMachineUpdate, type StorageFacade, type SubmitBidOptions, SubstrateChain, Swap, TESTNET_CHAINS, type TeleportParams, TeleportStatus, TimeoutStatus, type TimeoutStatusKey, TokenGateway, type TokenGatewayAssetTeleportedResponse, type TokenGatewayAssetTeleportedWithStatus, type TokenInfo, type TokenPrice, type TokenPricesResponse, type Transaction, TronChain, type TronChainParams, USE_ETHERSCAN_CHAINS, type UniswapProtocol, type UniswapQuote, type UniswapQuoteToken, type UniswapTradeType, type UniswapV4IntentQuoteMetadata, type UniswapV4IntentQuoteOptions, type UniswapV4PoolConfigData, type UniswapV4PoolKey, type UniswapV4QuoteIntentResult, UnsupportedIntentQuotePairError, UnsupportedIntentQuoteStrategyError, WrappedHyperFungibleTokenABI, type XcmGatewayParams, __test, adjustDecimals, bytes20ToBytes32, bytes32ToBytes20, calculateAllowanceMappingLocation, calculateBalanceMappingLocation, chainConfigs, constructRedeemEscrowRequestBody, constructRefundEscrowRequestBody, convertCodecToIGetRequest, convertCodecToIProof, convertIGetRequestToCodec, convertIProofToCodec, convertStateIdToStateMachineId, convertStateMachineEnumToString, convertStateMachineIdToEnum, createEvmChain, createQueryClient, decodeAcceptedSourceChains, decodeERC7821ExecuteBatch, decodeUserOpScale, encodeAcceptedSourceChains, encodeERC7821ExecuteBatch, encodeISMPMessage, encodeStateMachineId, encodeUserOpScale, encodeWithdrawalRequest, estimateGasForPost, fetchPrice, fetchSourceProof, generateRootWithProof, getChainId, getConfigByStateMachineId, getContractCallInput, getContractCallInputs, getGasPriceFromEtherscan, getOrFetchStorageSlot, getOrderPlacedFromTx, getPostRequestEventFromTx, getPostResponseEventFromTx, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, getViemChain, hexToString, hyperbridgeAddress, maxBigInt, normalizeAddressForEvmBytes32, normalizeAddressForStateMachine, normalizeEvmAddress, normalizeEvmChainId, normalizeStateMachineId, orderCommitment, parseStateMachineId, pharosAtlantic, pharosMainnet, polkadotAssetHubPaseo, polkadotHubMainnet, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, quoteUniswap, requestCommitmentKey, responseCommitmentKey, retryPromise, teleport, teleportDot, transformOrderForContract, tronChainIds, tronNile };
11015
+ export { ADDRESS_ZERO, type AllStatusKey, type AssetTeleported, type AssetTeleportedResponse, type AvailableLiquidity, type Bid, type BidStorageEntry, type BidSubmissionResult, type BlockMetadata, type BridgeParams, type BridgeStep, type BundlerGasEstimate, BundlerMethod, type BuyAndSellRates, type BytesLikeHex, type CancelEvent, type CancelOptions, type CancelOrderOptions, type CancelQuote, type ChainConfig, type ChainConfigData, ChainConfigService, Chains, type ClientConfig, type ConfiguredAssetSymbol, type ConfiguredAssetSymbolInput, CryptoUtils, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DOMAIN_TYPEHASH, DUMMY_PRIVATE_KEY, type DecodedOrderPlacedLog, type DecodedPostRequestEvent, type DecodedPostResponseEvent, type Deployment, type DispatchGet, type DispatchInfo, type DispatchPost, ERC20Method, type ERC7821Call, ERC7821_BATCH_MODE, type Erc4626VaultConfigData, type EstimateFillOrderParams, type EstimateGasCallData, EvmChain, type EvmChainParams, ABI as EvmHostABI, EvmLanguage, type ExecuteIntentOrderOptions, type ExecutionResult, type FillOptions, type FillOrderEstimate, type FillerBid, type FillerConfig, type GetRequestResponse, type GetRequestWithStatus, type GetResponseByRequestIdResponse, type GetResponseStorageValues, type HexString$1 as HexString, type HostParams, HyperClientStatus, HyperFungibleToken, HyperFungibleTokenABI, type HyperbridgeTxEvents, type IBatchConsensusAndGetResponseMessage, type IBatchConsensusAndPostRequestMessage, type IChain, type IConfig, type IConsensusMessage, type IEvmChain, type IEvmConfig, type IGetRequest, type IGetRequestMessage, type IGetResponse, type IGetResponseMessage, type IHyperbridgeConfig, type IIsmpMessage, type IMessage, INCLUSION_TIMEOUT_MS, type IPharosConfig, type IPolkadotHubConfig, type IPostRequest, type IPostResponse, type IProof, type IRequestMessage, type ISubstrateConfig, type ITimeoutPostRequestMessage, type IndexerQueryClient, IntentGateway, ABI$1 as IntentGatewayABI, type IntentGatewayContext, type IntentGatewayParams, IntentOrderStatus, type IntentOrderStatusKey, type IntentOrderStatusUpdate, type IntentQuoteStrategy, type IntentQuoteTradeType, IntentsCoprocessor, InvalidLiquidityIndexerResponseError, InvalidPhantomSnapshotError, IsmpClient, type IsmpRequest, type LiquiditySlice, MOCK_ADDRESS, ORDER_V2_PARAM_TYPE, type Order, type OrderFeesQuote, type OrderResponse, OrderStatus, OrderStatusChecker, type OrderStatusMetadata, type OrderWithStatus, PACKED_USEROP_TYPEHASH, PLACE_ORDER_SELECTOR, type PackedUserOperation, type Params, type PaymentInfo, type PhantomBid, type PhantomBidBatchResult, type PhantomBidDeclaration, type PhantomBidOutcome, type PhantomOrderEvent, type PhantomOrderLeg, type PhantomOrderPriceSnapshot, type PhantomOrderPriceSnapshotsResponse, type PhantomSnapshotIntentQuoteMetadata, type PhantomSnapshotQuoteIntentResult, PhantomSnapshotUnavailableError, PharosChain, type PharosChainParams, PolkadotHubChain, type PolkadotHubChainParams, type PollPhantomOrdersOptions, type PostRequestStatus, type PostRequestTimeoutStatus, type PostRequestWithStatus, type QueryBuyAndSellRatesParams, type QuoteIntentParams, type QuoteIntentResult, type QuoteNativeResult, type QuoteResult, type QuoteUniswapParams, type QuoteUniswapResult, REQUEST_COMMITMENTS_SLOT, REQUEST_RECEIPTS_SLOT, RESPONSE_COMMITMENTS_SLOT, RESPONSE_RECEIPTS_SLOT, type RequestBody, type RequestCommitment, RequestKind, type RequestResponse, RequestStatus, type RequestStatusKey, type RequestStatusWithMetadata, type ResponseCommitmentWithValues, type ResumeIntentOrderOptions, type RetryConfig, SELECT_SOLVER_TYPEHASH, STATE_COMMITMENTS_SLOT, type SelectBidResult, type SelectOptions, type SigningAccount, type StateMachineHeight, type StateMachineId, type StateMachineIdParams, type StateMachineResponse, type StateMachineUpdate, type StorageFacade, type SubmitBidOptions, SubstrateChain, Swap, TESTNET_CHAINS, type TeleportParams, TeleportStatus, TimeoutStatus, type TimeoutStatusKey, TokenGateway, type TokenGatewayAssetTeleportedResponse, type TokenGatewayAssetTeleportedWithStatus, type TokenInfo, type TokenPrice, type TokenPricesResponse, type Transaction, TronChain, type TronChainParams, USE_ETHERSCAN_CHAINS, type UniswapProtocol, type UniswapQuote, type UniswapQuoteToken, type UniswapTradeType, type UniswapV4IntentQuoteMetadata, type UniswapV4IntentQuoteOptions, type UniswapV4PoolConfigData, type UniswapV4PoolKey, type UniswapV4QuoteIntentResult, UnsupportedIntentQuotePairError, UnsupportedIntentQuoteStrategyError, UnsupportedLiquidityAssetError, UnsupportedLiquidityChainError, WrappedHyperFungibleTokenABI, type XcmGatewayParams, __test, adjustDecimals, bytes20ToBytes32, bytes32ToBytes20, calculateAllowanceMappingLocation, calculateBalanceMappingLocation, chainConfigs, constructRedeemEscrowRequestBody, constructRefundEscrowRequestBody, convertCodecToIGetRequest, convertCodecToIProof, convertIGetRequestToCodec, convertIProofToCodec, convertStateIdToStateMachineId, convertStateMachineEnumToString, convertStateMachineIdToEnum, createEvmChain, createQueryClient, decodeAcceptedSourceChains, decodeERC7821ExecuteBatch, decodePhantomBidDeclaration, decodeUserOpScale, deriveHttpUrl, encodeAcceptedSourceChains, encodeERC7821ExecuteBatch, encodeISMPMessage, encodePhantomBidDeclaration, encodeStateMachineId, encodeUserOpScale, encodeWithdrawalRequest, estimateGasForPost, fetchPrice, fetchSourceProof, generateRootWithProof, getChainId, getConfigByStateMachineId, getContractCallInput, getContractCallInputs, getGasPriceFromEtherscan, getOrFetchStorageSlot, getOrderPlacedFromTx, getPostRequestEventFromTx, getPostResponseEventFromTx, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, getViemChain, hexToString, hyperbridgeAddress, maxBigInt, normalizeAddressForEvmBytes32, normalizeAddressForStateMachine, normalizeEvmAddress, normalizeEvmChainId, normalizeStateMachineId, orderCommitment, parseStateMachineId, pharosAtlantic, pharosMainnet, polkadotAssetHubPaseo, polkadotHubMainnet, poolSlug, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, quoteUniswap, requestCommitmentKey, responseCommitmentKey, retryPromise, sortPoolSymbols, teleport, teleportDot, transformOrderForContract, tronChainIds, tronNile };