@hyperbridge/sdk 2.8.3 → 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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/abis/erc7281.ts","../../src/protocols/intents/types.ts","../../src/protocols/intents/decode-utils.ts","../../src/abis/IntentGatewayV2.ts","../../src/chains/intentsCoprocessor.ts","../../src/protocols/intents/CryptoUtils.ts","../../src/protocols/intents/uniswap-v4-position.ts","../../src/protocols/intents/phantom-aggregation.ts"],"names":["ABI","encodeAbiParameters","encodeFunctionData","decodeFunctionData","decodeAbiParameters","u8aToHex","hexToU8a","keccak256","total"],"mappings":";;;;;;;;;;;AAAA,IAAM,GAAA,GAAM;AAAA,EACX;AAAA,IACC,IAAA,EAAM,SAAA;AAAA,IACN,IAAA,EAAM,UAAA;AAAA,IACN,MAAA,EAAQ;AAAA,MACP,EAAE,IAAA,EAAM,MAAA,EAAQ,IAAA,EAAM,SAAA,EAAU;AAAA,MAChC,EAAE,IAAA,EAAM,eAAA,EAAiB,IAAA,EAAM,OAAA;AAAQ,KACxC;AAAA,IACA,SAAS;AAAC,GACX;AAAA,EACA;AAAA,IACC,IAAA,EAAM,MAAA;AAAA,IACN,IAAA,EAAM,OAAA;AAAA,IACN,UAAA,EAAY;AAAA,MACX,EAAE,IAAA,EAAM,QAAA,EAAU,IAAA,EAAM,SAAA,EAAU;AAAA,MAClC,EAAE,IAAA,EAAM,OAAA,EAAS,IAAA,EAAM,SAAA,EAAU;AAAA,MACjC,EAAE,IAAA,EAAM,MAAA,EAAQ,IAAA,EAAM,OAAA;AAAQ;AAC/B;AAEF,CAAA;AAEA,IAAO,eAAA,GAAQ,EAAE,GAAA,EAAI;;;ACYd,IAAM,kBAAA,GAAqB,oEAAA;;;AC3B3B,SAAS,0BAA0B,KAAA,EAAiC;AAC1E,EAAA,MAAM,aAAA,GAAgB,mBAAA;AAAA,IACrB,CAAC,EAAE,IAAA,EAAM,SA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AAA,EAAG;AAC9B,MAAA,MAAA,EAAQ,IAAA;AAAA,QACP,EAAE,UAAA,EAAY,KAAA,EAAO,UAAU,WAAA,EAAa,MAAA,EAAQ,OAAO,MAAA,EAAO;AAAA,QAClE;AAAA,OACD;AACA,MAAA,OAAO,EAAC;AAAA,IACT;AAEA,IAAA,MAAM,WAAA,GAAc,eAAe,YAAY,CAAA;AAC/C,IAAA,OAAO;AAAA,MACN;AAAA,QACC,QAAA;AAAA,QACA,WAAA;AAAA,QACA,WAAA,EAAa,WAAA;AAAA,QACb,YAAA,EAAc,WAAA;AAAA,QACd,WAAA;AAAA,QACA,UAAU,YAAA,CAAa,MAAA;AAAA,QACvB,OAAA,EAAS;AAAA;AACV,KACD;AAAA,EACD,CAAC,CAAA;AAEF,EAAA,OAAO,EAAE,MAAM,UAAA,EAAW;AAC3B","file":"intents-helpers.js","sourcesContent":["const ABI = [\n\t{\n\t\tname: \"execute\",\n\t\ttype: \"function\",\n\t\tinputs: [\n\t\t\t{ name: \"mode\", type: \"bytes32\" },\n\t\t\t{ name: \"executionData\", type: \"bytes\" },\n\t\t],\n\t\toutputs: [],\n\t},\n\t{\n\t\tname: \"Call\",\n\t\ttype: \"tuple\",\n\t\tcomponents: [\n\t\t\t{ name: \"target\", type: \"address\" },\n\t\t\t{ name: \"value\", type: \"uint256\" },\n\t\t\t{ name: \"data\", type: \"bytes\" },\n\t\t],\n\t},\n] as const\n\nexport default { ABI }\n","import type { TransactionReceipt } from \"viem\"\nimport type { HexString } from \"@/types\"\nimport type { IProof } from \"@/chain\"\nimport type { RequestStatusWithMetadata } from \"@/types\"\n\n/**\n * ABI-encoded function selector for the IntentGatewayV2 `placeOrder` function,\n * including the full tuple signature of the OrderV2 struct.\n */\nexport const PLACE_ORDER_SELECTOR =\n\t\"placeOrder((bytes32,bytes,bytes,uint256,uint256,uint256,address,((bytes32,uint256)[],bytes),(bytes32,uint256)[],(bytes32,(bytes32,uint256)[],bytes)),bytes32)\"\n\n/**\n * ABI tuple type string for the OrderV2 struct used when ABI-encoding or\n * decoding order data without a full ABI artifact.\n */\nexport const ORDER_V2_PARAM_TYPE =\n\t\"(bytes32,bytes,bytes,uint256,uint256,uint256,address,((bytes32,uint256)[],bytes),(bytes32,uint256)[],(bytes32,(bytes32,uint256)[],bytes))\"\n\n/**\n * Default graffiti value: a bytes32 zero word.\n *\n * When no graffiti is supplied to `placeOrder`, this value is used,\n * indicating no orderflow attribution or revenue-share tag.\n */\nexport const DEFAULT_GRAFFITI = \"0x0000000000000000000000000000000000000000000000000000000000000000\" as HexString\n\n/**\n * ERC-7821 execution mode selector for single-batch execution.\n *\n * The first byte `0x01` indicates batch mode; all remaining bytes are\n * reserved and set to zero.\n */\nexport const ERC7821_BATCH_MODE = \"0x0100000000000000000000000000000000000000000000000000000000000000\" as HexString\n\n/**\n * Bundler RPC method names for ERC-4337 operations.\n *\n * Values map to JSON-RPC method strings sent to a 4337 bundler endpoint.\n * `PIMLICO_GET_USER_OPERATION_GAS_PRICE` is a Pimlico-specific extension.\n */\nexport const BundlerMethod = {\n\t/** Submits a UserOperation to the bundler mempool. */\n\tETH_SEND_USER_OPERATION: \"eth_sendUserOperation\",\n\t/** Retrieves the receipt for a previously submitted UserOperation by its hash. */\n\tETH_GET_USER_OPERATION_RECEIPT: \"eth_getUserOperationReceipt\",\n\t/** Estimates gas limits for a UserOperation before submission. */\n\tETH_ESTIMATE_USER_OPERATION_GAS: \"eth_estimateUserOperationGas\",\n\t/** Pimlico-specific method to fetch recommended EIP-1559 gas prices for UserOperations. */\n\tPIMLICO_GET_USER_OPERATION_GAS_PRICE: \"pimlico_getUserOperationGasPrice\",\n\t/** Alchemy (Rundler) method to fetch recommended priority fee for UserOperations. */\n\tRUNDLER_MAX_PRIORITY_FEE_PER_GAS: \"rundler_maxPriorityFeePerGas\",\n} as const\n\n/** Union of all valid bundler RPC method name strings. */\nexport type BundlerMethod = (typeof BundlerMethod)[keyof typeof BundlerMethod]\n\n/**\n * Response payload returned by a bundler for\n * `eth_estimateUserOperationGas`.\n *\n * All gas values are returned as hex strings.\n */\nexport interface BundlerGasEstimate {\n\t/** Gas required for pre-verification processing (hex). */\n\tpreVerificationGas: HexString\n\t/** Gas limit for the account verification step (hex). */\n\tverificationGasLimit: HexString\n\t/** Gas limit for the main execution call (hex). */\n\tcallGasLimit: HexString\n\t/** Gas limit for paymaster verification, if a paymaster is used (hex). */\n\tpaymasterVerificationGasLimit?: HexString\n\t/** Gas limit for paymaster post-operation hook, if a paymaster is used (hex). */\n\tpaymasterPostOpGasLimit?: HexString\n}\n\n/**\n * Response payload returned by Pimlico's\n * `pimlico_getUserOperationGasPrice` method.\n *\n * Provides EIP-1559 fee recommendations at three priority tiers.\n * Each field is optional; callers should fall back from `fast` → `standard` → `slow`.\n */\nexport interface PimlicoGasPriceEstimate {\n\t/** Low-priority fee recommendation. */\n\tslow: {\n\t\t/** Maximum total fee per gas (hex). */\n\t\tmaxFeePerGas: HexString\n\t\t/** Maximum miner tip per gas (hex). */\n\t\tmaxPriorityFeePerGas: HexString\n\t}\n\t/** Medium-priority fee recommendation. */\n\tstandard: {\n\t\t/** Maximum total fee per gas (hex). */\n\t\tmaxFeePerGas: HexString\n\t\t/** Maximum miner tip per gas (hex). */\n\t\tmaxPriorityFeePerGas: HexString\n\t}\n\t/** High-priority fee recommendation for fastest inclusion. */\n\tfast: {\n\t\t/** Maximum total fee per gas (hex). */\n\t\tmaxFeePerGas: HexString\n\t\t/** Maximum miner tip per gas (hex). */\n\t\tmaxPriorityFeePerGas: HexString\n\t}\n}\n\n/**\n * Tagged union of all status updates that can be yielded by the cancel-order\n * async generator.\n *\n * The `status` field is the discriminant. Consumers should switch on it to\n * handle each stage of the cancellation lifecycle:\n *\n * - `DESTINATION_FINALIZED` – a state proof from the destination chain is ready.\n * - `AWAITING_CANCEL_TRANSACTION` – the caller must sign and submit the cancel tx.\n * - `CANCEL_STARTED` – the cancel transaction was confirmed on-chain.\n * - `SOURCE_FINALIZED` – the cancel request has been finalised on the source chain.\n\t* - `HYPERBRIDGE_DELIVERED` – the cancel message has been delivered to Hyperbridge.\n\t* - `HYPERBRIDGE_FINALIZED` – the cancel message has been finalised on Hyperbridge.\n\t* - `CANCELLATION_COMPLETE` – the escrow has been refunded; cancellation is done.\n */\nexport type CancelEvent =\n\t| { status: \"DESTINATION_FINALIZED\"; proof: IProof }\n\t| { status: \"AWAITING_CANCEL_TRANSACTION\"; data: HexString; to: HexString; value: bigint }\n\t| { status: \"CANCEL_STARTED\"; receipt: TransactionReceipt }\n\t| {\n\t\t\tstatus: \"SOURCE_FINALIZED\"\n\t\t\tmetadata: Extract<RequestStatusWithMetadata, { status: \"SOURCE_FINALIZED\" }>[\"metadata\"]\n\t }\n\t| {\n\t\t\tstatus: \"HYPERBRIDGE_DELIVERED\"\n\t\t\tmetadata: Extract<RequestStatusWithMetadata, { status: \"HYPERBRIDGE_DELIVERED\" }>[\"metadata\"]\n\t }\n\t| {\n\t\t\tstatus: \"HYPERBRIDGE_FINALIZED\"\n\t\t\tmetadata: Extract<RequestStatusWithMetadata, { status: \"HYPERBRIDGE_FINALIZED\" }>[\"metadata\"]\n\t }\n\t| { status: \"CANCELLATION_COMPLETE\"; blockNumber: number; transactionHash: HexString }\n\nimport type { IEvmChain } from \"@/chain\"\nimport type { IntentsCoprocessor } from \"@/chains/intentsCoprocessor\"\nimport type { Swap } from \"@/utils/swap\"\nimport type { createSessionKeyStorage, createCancellationStorage, createUsedUserOpsStorage } from \"@/storage\"\n\n/**\n * Shared runtime context passed to every IntentsV2 sub-module.\n *\n * All sub-modules (OrderPlacer, OrderExecutor, BidManager, etc.) receive a\n * reference to this object so they can share fee-token caches, storage\n * adapters, and chain clients without duplicating initialisation logic.\n */\nexport interface IntentGatewayContext {\n\t/** EVM chain on which orders are placed and escrowed. */\n\tsource: IEvmChain\n\t/** EVM chain on which solvers fill orders and receive outputs. */\n\tdest: IEvmChain\n\t/** Hyperbridge coprocessor client used to fetch solver bids and submit UserOperations. */\n\tintentsCoprocessor?: IntentsCoprocessor\n\t/** URL of the ERC-4337 bundler endpoint for gas estimation and UserOp submission. */\n\tbundlerUrl?: string\n\t/**\n\t * In-memory TTL cache keyed by state-machine ID.\n\t * Stores fee-token address, decimals, and the timestamp of the last fetch.\n\t */\n\tfeeTokenCache: Map<string, { address: HexString; decimals: number; cachedAt: number }>\n\t/**\n\t * In-memory cache of solver account contract bytecode, keyed by lowercased address.\n\t * Used to inject solver code into state-overrides for gas estimation.\n\t */\n\tsolverCodeCache: Map<string, string>\n\t/** Persistent storage for ephemeral session keys generated per order. */\n\tsessionKeyStorage: ReturnType<typeof createSessionKeyStorage>\n\t/** Persistent storage for intermediate cancellation state (proofs, commitments). */\n\tcancellationStorage: ReturnType<typeof createCancellationStorage>\n\t/** Persistent storage for deduplication of already-submitted UserOperations. */\n\tusedUserOpsStorage: ReturnType<typeof createUsedUserOpsStorage>\n\t/** DEX-quote utility used for token pricing and gas-to-fee-token conversions. */\n\tswap: Swap\n}\n","// Pure ERC-7821 encode/decode utilities — no chain dependency (safe for SubQuery VM2).\nimport { encodeFunctionData, encodeAbiParameters, decodeFunctionData, decodeAbiParameters } from \"viem\"\nimport ERC7821ABI from \"@/abis/erc7281\"\nimport { ERC7821_BATCH_MODE } from \"./types\"\nimport type { HexString, ERC7821Call } from \"@/types\"\n\nexport function encodeERC7821ExecuteBatch(calls: ERC7821Call[]): HexString {\n\tconst executionData = encodeAbiParameters(\n\t\t[{ type: \"tuple[]\", components: ERC7821ABI.ABI[1].components }],\n\t\t[calls.map((call) => ({ target: call.target, value: call.value, data: call.data }))],\n\t) as HexString\n\n\treturn encodeFunctionData({\n\t\tabi: ERC7821ABI.ABI,\n\t\tfunctionName: \"execute\",\n\t\targs: [ERC7821_BATCH_MODE, executionData],\n\t}) as HexString\n}\n\nexport function decodeERC7821ExecuteBatch(callData: HexString): ERC7821Call[] | null {\n\ttry {\n\t\tconst decoded = decodeFunctionData({ abi: ERC7821ABI.ABI, data: callData })\n\t\tif (decoded.functionName !== \"execute\" || !decoded.args || decoded.args.length < 2) return null\n\t\tconst executionData = decoded.args[1] as HexString\n\t\tconst [calls] = decodeAbiParameters(\n\t\t\t[{ type: \"tuple[]\", components: ERC7821ABI.ABI[1].components }],\n\t\t\texecutionData,\n\t\t) as [ERC7821Call[]]\n\t\treturn calls.map((call) => ({\n\t\t\ttarget: call.target as HexString,\n\t\t\tvalue: call.value,\n\t\t\tdata: call.data as HexString,\n\t\t}))\n\t} catch {\n\t\treturn null\n\t}\n}\n","export const ABI = [\n\t{\n\t\ttype: \"constructor\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"admin\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"nonpayable\",\n\t},\n\t{\n\t\ttype: \"receive\",\n\t\tstateMutability: \"payable\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"DOMAIN_SEPARATOR\",\n\t\tinputs: [],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"SELECT_SOLVER_TYPEHASH\",\n\t\tinputs: [],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"_destinationProtocolFees\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"_filled\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"_instances\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"_nonce\",\n\t\tinputs: [],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"_orders\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"_partialFills\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"calculateCommitmentSlotHash\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"commitment\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"bytes\",\n\t\t\t\tinternalType: \"bytes\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"pure\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"cancelOrder\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"order\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tinternalType: \"struct Order\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"user\",\n\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"source\",\n\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"destination\",\n\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"deadline\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"nonce\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"fees\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"session\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"predispatch\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\tinternalType: \"struct DispatchInfo\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"assets\",\n\t\t\t\t\t\t\t\ttype: \"tuple[]\",\n\t\t\t\t\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"call\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"inputs\",\n\t\t\t\t\t\ttype: \"tuple[]\",\n\t\t\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"output\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\tinternalType: \"struct PaymentInfo\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"beneficiary\",\n\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"assets\",\n\t\t\t\t\t\t\t\ttype: \"tuple[]\",\n\t\t\t\t\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"call\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"options\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tinternalType: \"struct CancelOptions\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"relayerFee\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"height\",\n\t\t\t\t\t\ttype: \"uint64\",\n\t\t\t\t\t\tinternalType: \"uint64\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\toutputs: [],\n\t\tstateMutability: \"payable\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"eip712Domain\",\n\t\tinputs: [],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"fields\",\n\t\t\t\ttype: \"bytes1\",\n\t\t\t\tinternalType: \"bytes1\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"name\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tinternalType: \"string\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"version\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tinternalType: \"string\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"chainId\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"verifyingContract\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"salt\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"extensions\",\n\t\t\t\ttype: \"uint256[]\",\n\t\t\t\tinternalType: \"uint256[]\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"fillOrder\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"order\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tinternalType: \"struct Order\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"user\",\n\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"source\",\n\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"destination\",\n\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"deadline\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"nonce\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"fees\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"session\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"predispatch\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\tinternalType: \"struct DispatchInfo\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"assets\",\n\t\t\t\t\t\t\t\ttype: \"tuple[]\",\n\t\t\t\t\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"call\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"inputs\",\n\t\t\t\t\t\ttype: \"tuple[]\",\n\t\t\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"output\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\tinternalType: \"struct PaymentInfo\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"beneficiary\",\n\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"assets\",\n\t\t\t\t\t\t\t\ttype: \"tuple[]\",\n\t\t\t\t\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"call\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"options\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tinternalType: \"struct FillOptions\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"relayerFee\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"nativeDispatchFee\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"outputs\",\n\t\t\t\t\t\ttype: \"tuple[]\",\n\t\t\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\toutputs: [],\n\t\tstateMutability: \"payable\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"host\",\n\t\tinputs: [],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"instance\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"stateMachineId\",\n\t\t\t\ttype: \"bytes\",\n\t\t\t\tinternalType: \"bytes\",\n\t\t\t},\n\t\t],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"onAccept\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"incoming\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tinternalType: \"struct IncomingPostRequest\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"request\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\tinternalType: \"struct PostRequest\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"source\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"dest\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"nonce\",\n\t\t\t\t\t\t\t\ttype: \"uint64\",\n\t\t\t\t\t\t\t\tinternalType: \"uint64\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"from\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"to\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"timeoutTimestamp\",\n\t\t\t\t\t\t\t\ttype: \"uint64\",\n\t\t\t\t\t\t\t\tinternalType: \"uint64\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"body\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"relayer\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\toutputs: [],\n\t\tstateMutability: \"nonpayable\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"onGetResponse\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"incoming\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tinternalType: \"struct IncomingGetResponse\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"response\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\tinternalType: \"struct GetResponse\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"request\",\n\t\t\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\t\t\tinternalType: \"struct GetRequest\",\n\t\t\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"source\",\n\t\t\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"dest\",\n\t\t\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"nonce\",\n\t\t\t\t\t\t\t\t\t\ttype: \"uint64\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"uint64\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"from\",\n\t\t\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"timeoutTimestamp\",\n\t\t\t\t\t\t\t\t\t\ttype: \"uint64\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"uint64\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"keys\",\n\t\t\t\t\t\t\t\t\t\ttype: \"bytes[]\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"bytes[]\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"height\",\n\t\t\t\t\t\t\t\t\t\ttype: \"uint64\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"uint64\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"context\",\n\t\t\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"values\",\n\t\t\t\t\t\t\t\ttype: \"tuple[]\",\n\t\t\t\t\t\t\t\tinternalType: \"struct StorageValue[]\",\n\t\t\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"key\",\n\t\t\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"value\",\n\t\t\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"relayer\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\toutputs: [],\n\t\tstateMutability: \"nonpayable\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"onGetTimeout\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tinternalType: \"struct GetRequestTimeout\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"request\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\tinternalType: \"struct GetRequest\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"source\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"dest\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"nonce\",\n\t\t\t\t\t\t\t\ttype: \"uint64\",\n\t\t\t\t\t\t\t\tinternalType: \"uint64\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"from\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"timeoutTimestamp\",\n\t\t\t\t\t\t\t\ttype: \"uint64\",\n\t\t\t\t\t\t\t\tinternalType: \"uint64\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"keys\",\n\t\t\t\t\t\t\t\ttype: \"bytes[]\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes[]\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"height\",\n\t\t\t\t\t\t\t\ttype: \"uint64\",\n\t\t\t\t\t\t\t\tinternalType: \"uint64\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"context\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"relayer\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\toutputs: [],\n\t\tstateMutability: \"nonpayable\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"onPostRequestTimeout\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tinternalType: \"struct PostRequestTimeout\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"request\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\tinternalType: \"struct PostRequest\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"source\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"dest\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"nonce\",\n\t\t\t\t\t\t\t\ttype: \"uint64\",\n\t\t\t\t\t\t\t\tinternalType: \"uint64\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"from\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"to\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"timeoutTimestamp\",\n\t\t\t\t\t\t\t\ttype: \"uint64\",\n\t\t\t\t\t\t\t\tinternalType: \"uint64\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"body\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"relayer\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\toutputs: [],\n\t\tstateMutability: \"nonpayable\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"params\",\n\t\tinputs: [],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tinternalType: \"struct Params\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"host\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"dispatcher\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"solverSelection\",\n\t\t\t\t\t\ttype: \"bool\",\n\t\t\t\t\t\tinternalType: \"bool\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"surplusShareBps\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"protocolFeeBps\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"priceOracle\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"placeOrder\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"order\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tinternalType: \"struct Order\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"user\",\n\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"source\",\n\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"destination\",\n\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"deadline\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"nonce\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"fees\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"session\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"predispatch\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\tinternalType: \"struct DispatchInfo\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"assets\",\n\t\t\t\t\t\t\t\ttype: \"tuple[]\",\n\t\t\t\t\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"call\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"inputs\",\n\t\t\t\t\t\ttype: \"tuple[]\",\n\t\t\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"output\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\tinternalType: \"struct PaymentInfo\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"beneficiary\",\n\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"assets\",\n\t\t\t\t\t\t\t\ttype: \"tuple[]\",\n\t\t\t\t\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"call\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"graffiti\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t],\n\t\toutputs: [],\n\t\tstateMutability: \"payable\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"quote\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"request\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tinternalType: \"struct DispatchPost\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"dest\",\n\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"to\",\n\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"body\",\n\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"timeout\",\n\t\t\t\t\t\ttype: \"uint64\",\n\t\t\t\t\t\tinternalType: \"uint64\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"fee\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"payer\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"quote\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"request\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tinternalType: \"struct DispatchGet\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"dest\",\n\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"height\",\n\t\t\t\t\t\ttype: \"uint64\",\n\t\t\t\t\t\tinternalType: \"uint64\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"keys\",\n\t\t\t\t\t\ttype: \"bytes[]\",\n\t\t\t\t\t\tinternalType: \"bytes[]\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"timeout\",\n\t\t\t\t\t\ttype: \"uint64\",\n\t\t\t\t\t\tinternalType: \"uint64\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"fee\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"context\",\n\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"payer\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"select\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"options\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tinternalType: \"struct SelectOptions\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"commitment\",\n\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"solver\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"signature\",\n\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"nonpayable\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"init\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"p\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tinternalType: \"struct Params\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"host\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"dispatcher\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"solverSelection\",\n\t\t\t\t\t\ttype: \"bool\",\n\t\t\t\t\t\tinternalType: \"bool\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"surplusShareBps\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"protocolFeeBps\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"priceOracle\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"deployments\",\n\t\t\t\ttype: \"tuple[]\",\n\t\t\t\tinternalType: \"struct Deployment[]\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"chain\",\n\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"gateway\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\toutputs: [],\n\t\tstateMutability: \"nonpayable\",\n\t},\n\t{\n\t\ttype: \"event\",\n\t\tname: \"DestinationProtocolFeeUpdated\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"chain\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"string\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"feeBps\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t},\n\t\t],\n\t\tanonymous: false,\n\t},\n\t{\n\t\ttype: \"event\",\n\t\tname: \"DustCollected\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"token\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"amount\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t},\n\t\t],\n\t\tanonymous: false,\n\t},\n\t{\n\t\ttype: \"event\",\n\t\tname: \"DustSwept\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"token\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"amount\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"beneficiary\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t],\n\t\tanonymous: false,\n\t},\n\t{\n\t\ttype: \"event\",\n\t\tname: \"EIP712DomainChanged\",\n\t\tinputs: [],\n\t\tanonymous: false,\n\t},\n\t{\n\t\ttype: \"event\",\n\t\tname: \"EscrowRefunded\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"commitment\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tindexed: true,\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"tokens\",\n\t\t\t\ttype: \"tuple[]\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\tanonymous: false,\n\t},\n\t{\n\t\ttype: \"event\",\n\t\tname: \"EscrowReleased\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"commitment\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tindexed: true,\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"tokens\",\n\t\t\t\ttype: \"tuple[]\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\tanonymous: false,\n\t},\n\t{\n\t\ttype: \"event\",\n\t\tname: \"DeploymentAdded\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"chain\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"string\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"gateway\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t],\n\t\tanonymous: false,\n\t},\n\t{\n\t\ttype: \"event\",\n\t\tname: \"OrderFilled\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"commitment\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tindexed: true,\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"filler\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"outputs\",\n\t\t\t\ttype: \"tuple[]\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"inputs\",\n\t\t\t\ttype: \"tuple[]\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\tanonymous: false,\n\t},\n\t{\n\t\ttype: \"event\",\n\t\tname: \"OrderPlaced\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"user\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"source\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"string\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"destination\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"string\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"deadline\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"nonce\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"fees\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"session\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"beneficiary\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"predispatch\",\n\t\t\t\ttype: \"tuple[]\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"inputs\",\n\t\t\t\ttype: \"tuple[]\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"outputs\",\n\t\t\t\ttype: \"tuple[]\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"predispatchCall\",\n\t\t\t\ttype: \"bytes\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"bytes\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"outputCall\",\n\t\t\t\ttype: \"bytes\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"bytes\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"graffiti\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t],\n\t\tanonymous: false,\n\t},\n\t{\n\t\ttype: \"event\",\n\t\tname: \"ParamsUpdated\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"previous\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"struct Params\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"host\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"dispatcher\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"solverSelection\",\n\t\t\t\t\t\ttype: \"bool\",\n\t\t\t\t\t\tinternalType: \"bool\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"surplusShareBps\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"protocolFeeBps\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"priceOracle\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"current\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"struct Params\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"host\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"dispatcher\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"solverSelection\",\n\t\t\t\t\t\ttype: \"bool\",\n\t\t\t\t\t\tinternalType: \"bool\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"surplusShareBps\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"protocolFeeBps\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"priceOracle\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\tanonymous: false,\n\t},\n\t{\n\t\ttype: \"event\",\n\t\tname: \"PartialFill\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"commitment\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tindexed: true,\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"filler\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"outputs\",\n\t\t\t\ttype: \"tuple[]\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"inputs\",\n\t\t\t\ttype: \"tuple[]\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\tanonymous: false,\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"Cancelled\",\n\t\tinputs: [],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"UnknownInstance\",\n\t\tinputs: [],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"ECDSAInvalidSignature\",\n\t\tinputs: [],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"ECDSAInvalidSignatureLength\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"length\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"ECDSAInvalidSignatureS\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"s\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"Expired\",\n\t\tinputs: [],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"Filled\",\n\t\tinputs: [],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"InsufficientNativeToken\",\n\t\tinputs: [],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"InvalidInput\",\n\t\tinputs: [],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"InvalidShortString\",\n\t\tinputs: [],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"NotExpired\",\n\t\tinputs: [],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"SafeERC20FailedOperation\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"token\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"StringTooLong\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"str\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tinternalType: \"string\",\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"Unauthorized\",\n\t\tinputs: [],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"UnauthorizedCall\",\n\t\tinputs: [],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"UnexpectedCall\",\n\t\tinputs: [],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"UnknownOrder\",\n\t\tinputs: [],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"WrongChain\",\n\t\tinputs: [],\n\t},\n] as const\n\nexport default { ABI }\n","import { ApiPromise, HttpProvider, Keyring, WsProvider } from \"@polkadot/api\"\nimport type { ApiOptions, SubmittableExtrinsic } from \"@polkadot/api/types\"\nimport type { KeyringPair } from \"@polkadot/keyring/types\"\nimport { hexToU8a, u8aToHex, u8aConcat } from \"@polkadot/util\"\nimport { decodeAddress, keccakAsU8a } from \"@polkadot/util-crypto\"\nimport { numberToBytes, bytesToBigInt, decodeAbiParameters, hexToBytes } from \"viem\"\nimport { Bytes, Struct, u8, Vector } from \"scale-ts\"\nimport PQueue from \"p-queue\"\nimport type { BidSubmissionResult, HexString, PackedUserOperation, BidStorageEntry, FillerBid, Order } from \"@/types\"\nimport type { SubstrateChain } from \"./substrate\"\nimport IntentGatewayV2 from \"@/abis/IntentGatewayV2\"\n\n/** Offchain storage key prefix for bids */\nconst OFFCHAIN_BID_PREFIX = new TextEncoder().encode(\"intents::bid::\")\n/** Offchain storage key prefix for phantom orders */\nconst OFFCHAIN_PHANTOM_PREFIX = new TextEncoder().encode(\"intents::phantom::order::\")\n\n/** Hyperbridge runtimes hash with keccak, so the registry needs the hasher for both spec names. */\nconst HYPERBRIDGE_TYPES_BUNDLE: ApiOptions[\"typesBundle\"] = {\n\tspec: {\n\t\tnexus: { hasher: keccakAsU8a },\n\t\tgargantua: { hasher: keccakAsU8a },\n\t},\n}\n\n/** Base tip (0.001 BRIDGE) added to every submission to lift it above untipped traffic. */\nconst BASE_TIP = 1_000_000_000n\n\n/** How long the HTTP api has to come up (metadata included) before the attempt is abandoned. */\nconst HTTP_CONNECT_TIMEOUT_MS = 20_000\n\n/** Default phantom order poll cadence, used for every runtime except Gargantua. */\nconst PHANTOM_POLL_INTERVAL_MS = 15_000\n\n/** Gargantua keeps the original one-block cadence. */\nconst GARGANTUA_PHANTOM_POLL_INTERVAL_MS = 6_000\n\n/** Rejects after `ms`, without holding a node process open on its own. */\nfunction rejectAfter(ms: number, message: string): Promise<never> {\n\treturn new Promise((_resolve, reject) => {\n\t\tconst timer = setTimeout(() => reject(new Error(message)), ms)\n\t\t;(timer as unknown as { unref?: () => void }).unref?.()\n\t})\n}\n\n/**\n * Maps a websocket endpoint onto the HTTP endpoint of the same node — substrate serves both on the\n * same host and port, so the scheme is the only difference. Throws for anything that is not a\n * `ws(s)://` url rather than guessing at an endpoint.\n *\n * The HTTP endpoint is always derived, never configured, because it must be the *same node* as the\n * websocket: phantom orders are read out of that node's offchain worker storage, which is\n * node-local and not replicated, so a separately configured host would return nothing for orders\n * the events said exist.\n */\nexport function deriveHttpUrl(wsUrl: string): string {\n\tif (wsUrl.startsWith(\"wss://\")) return `https://${wsUrl.slice(\"wss://\".length)}`\n\tif (wsUrl.startsWith(\"ws://\")) return `http://${wsUrl.slice(\"ws://\".length)}`\n\tthrow new Error(`Cannot derive an HTTP endpoint from a non-websocket url: ${wsUrl}`)\n}\n\n/** Builds the extrinsic to submit against whichever api is live at signing time. */\ntype ExtrinsicBuilder = (api: ApiPromise) => SubmittableExtrinsic<\"promise\">\n\n/** SCALE codec for Bid { filler: AccountId, user_op: Vec<u8> } */\nconst BidCodec = Struct({ filler: Bytes(32), user_op: Vector(u8) })\n\n/**\n * SCALE codec for PackedUserOperation\n * Uses Vec<u8> for all fields to handle hex strings uniformly\n */\nconst PackedUserOperationCodec = Struct({\n\tsender: Bytes(20), // address is 20 bytes\n\tnonce: Bytes(32), // uint256 as 32 bytes\n\tinitCode: Vector(u8), // variable length bytes\n\tcallData: Vector(u8), // variable length bytes\n\taccountGasLimits: Bytes(32), // bytes32\n\tpreVerificationGas: Bytes(32), // uint256 as 32 bytes\n\tgasFees: Bytes(32), // bytes32\n\tpaymasterAndData: Vector(u8), // variable length bytes\n\tsignature: Vector(u8), // variable length bytes\n})\n\n/**\n * Encodes a PackedUserOperation using SCALE codec for submission to Hyperbridge.\n * This is the recommended way to encode UserOps for the intents coprocessor.\n *\n * @param userOp - The PackedUserOperation to encode\n * @returns Hex-encoded SCALE bytes\n */\nexport function encodeUserOpScale(userOp: PackedUserOperation): HexString {\n\tconst encoded = PackedUserOperationCodec.enc({\n\t\tsender: hexToU8a(userOp.sender),\n\t\tnonce: numberToBytes(userOp.nonce, { size: 32 }),\n\t\tinitCode: Array.from(hexToU8a(userOp.initCode)),\n\t\tcallData: Array.from(hexToU8a(userOp.callData)),\n\t\taccountGasLimits: hexToU8a(userOp.accountGasLimits),\n\t\tpreVerificationGas: numberToBytes(userOp.preVerificationGas, { size: 32 }),\n\t\tgasFees: hexToU8a(userOp.gasFees),\n\t\tpaymasterAndData: Array.from(hexToU8a(userOp.paymasterAndData)),\n\t\tsignature: Array.from(hexToU8a(userOp.signature)),\n\t})\n\n\treturn u8aToHex(encoded) as HexString\n}\n\n/**\n * Decodes a SCALE-encoded PackedUserOperation.\n *\n * @param hex - The hex-encoded SCALE bytes\n * @returns The decoded PackedUserOperation\n */\nexport function decodeUserOpScale(hex: HexString): PackedUserOperation {\n\tconst decoded = PackedUserOperationCodec.dec(hexToU8a(hex))\n\n\treturn {\n\t\tsender: u8aToHex(new Uint8Array(decoded.sender)) as HexString,\n\t\tnonce: bytesToBigInt(new Uint8Array(decoded.nonce)),\n\t\tinitCode: u8aToHex(new Uint8Array(decoded.initCode)) as HexString,\n\t\tcallData: u8aToHex(new Uint8Array(decoded.callData)) as HexString,\n\t\taccountGasLimits: u8aToHex(new Uint8Array(decoded.accountGasLimits)) as HexString,\n\t\tpreVerificationGas: bytesToBigInt(new Uint8Array(decoded.preVerificationGas)),\n\t\tgasFees: u8aToHex(new Uint8Array(decoded.gasFees)) as HexString,\n\t\tpaymasterAndData: u8aToHex(new Uint8Array(decoded.paymasterAndData)) as HexString,\n\t\tsignature: u8aToHex(new Uint8Array(decoded.signature)) as HexString,\n\t}\n}\n\n/** RPC response shape from intents_getBidsForOrder */\ninterface RpcBidInfo {\n\tcommitment: HexString\n\tfiller: HexString\n\tuser_op: HexString\n}\n\n/** One directed leg of a phantom order: `standardAmount` of `tokenA` quoted in `tokenB`. */\nexport interface PhantomOrderLeg {\n\ttokenA: HexString\n\ttokenB: HexString\n\tstandardAmount: bigint\n}\n\nexport interface PhantomOrderEvent {\n\tcommitment: HexString\n\tchain: string\n\tcreatedAt: number\n\t/**\n\t * Every configured pair expands into its configured direction plus the reverse. Listed in\n\t * the same order as the order's asset lists, so index `i` here is the order's leg `i`.\n\t */\n\tlegs: PhantomOrderLeg[]\n}\n\n/** One phantom bid to place, and the bid it replaces on the same chain. */\nexport interface PhantomBid {\n\t/** The phantom order commitment being bid on. */\n\tcommitment: HexString\n\t/** The SCALE-encoded PackedUserOperation backing the quote. */\n\tuserOp: HexString\n\t/**\n\t * A live bid from a previous interval on the same chain, retracted alongside this one to\n\t * reclaim its deposit. Best-effort: a retraction that fails never affects the bid.\n\t */\n\tretractCommitment?: HexString\n}\n\n/** What became of one bid in a batch. */\nexport interface PhantomBidOutcome {\n\tcommitment: HexString\n\tsuccess: boolean\n\t/** The dispatch error that rejected this bid, when it failed. */\n\terror?: string\n}\n\nexport interface PhantomBidBatchResult {\n\t/** One entry per submitted bid, in the order they were given. */\n\tbids: PhantomBidOutcome[]\n\t/** The block and extrinsic the bids landed in. */\n\tblockHash?: HexString\n\textrinsicHash?: HexString\n\t/**\n\t * The batch reached the pool but its inclusion was not observed, so no per-bid outcome is\n\t * known. Same contract as {@link BidSubmissionResult.pending}: in flight, do not re-sign.\n\t */\n\tpending?: boolean\n\t/** Set when the batch never landed at all, or when its item events could not be attributed. */\n\terror?: string\n}\n\n/** A submission result plus the extrinsic's own events, for callers that read per-item outcomes. */\ninterface SubmissionOutcome extends BidSubmissionResult {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tevents?: { event: { section: string; method: string; data: any } }[]\n}\n\nexport interface PollPhantomOrdersOptions {\n\t/** How often to check for a new head. Defaults to 15s, or 6s when the runtime is Gargantua. */\n\tintervalMs?: number\n\t/**\n\t * Most blocks scanned in a single poll, so a long outage catches up over several ticks instead of\n\t * one unbounded scan. Defaults to 500.\n\t */\n\tmaxBlocksPerPoll?: number\n\t/**\n\t * How many blocks before the current head to start from on the first poll. Defaults to 0 (start\n\t * at the head). Set this to the runtime's bid window to have a restarting process pick up orders\n\t * whose window is still open.\n\t */\n\tlookbackBlocks?: number\n\t/** Notified when a poll fails; polling continues regardless. */\n\tonError?: (err: unknown) => void\n}\n\n/**\n * Service for interacting with Hyperbridge's pallet-intents coprocessor.\n * Handles bid submission and retrieval for the IntentGatewayV2 protocol.\n *\n * Can be created from an existing SubstrateChain instance to share the connection.\n */\nexport class IntentsCoprocessor {\n\t/** Cached result of whether the node exposes intents_* RPC methods */\n\tprivate hasIntentsRpc: boolean | null = null\n\n\t/** The HTTP-backed api, connected on first use. Cleared after a failed attempt so it retries. */\n\tprivate httpApi: Promise<ApiPromise> | null = null\n\n\t// Serialises every extrinsic submission on this instance's substrate account. All submit/retract\n\t// methods funnel through signAndSendExtrinsic, each using the API's auto-nonce; fired in parallel\n\t// (bids for orders on different chains, or several phantom orders in one interval) they would grab\n\t// the same nonce and all but one would fail. Concurrency 1 sequences them.\n\tprivate submissionQueue = new PQueue({ concurrency: 1 })\n\n\t/**\n\t * Creates and connects an IntentsCoprocessor to a Hyperbridge node.\n\t * This creates and manages its own API connection.\n\t *\n\t * @param wsUrl - WebSocket URL of the Hyperbridge node\n\t * @param substratePrivateKey - Private key for signing extrinsics (optional for read-only operations)\n\t * @returns Promise resolving to a connected IntentsCoprocessor\n\t */\n\tstatic async connect(wsUrl: string, substratePrivateKey?: string): Promise<IntentsCoprocessor> {\n\t\tconst api = await ApiPromise.create({\n\t\t\tprovider: new WsProvider(wsUrl),\n\t\t\ttypesBundle: HYPERBRIDGE_TYPES_BUNDLE,\n\t\t})\n\t\treturn new IntentsCoprocessor(api, substratePrivateKey, true)\n\t}\n\n\t/**\n\t * Creates an IntentsCoprocessor from an existing SubstrateChain instance.\n\t * This shares the connection - the SubstrateChain must already be connected.\n\t *\n\t * @param chain - Connected SubstrateChain instance (typically Hyperbridge)\n\t * @param substratePrivateKey - Private key for signing extrinsics (optional for read-only operations)\n\t */\n\tstatic fromSubstrateChain(chain: SubstrateChain, substratePrivateKey?: string): IntentsCoprocessor {\n\t\tif (!chain.api) {\n\t\t\tthrow new Error(\"SubstrateChain must be connected before creating IntentsCoprocessor\")\n\t\t}\n\t\treturn new IntentsCoprocessor(chain.api, substratePrivateKey, false)\n\t}\n\n\t/**\n\t * Creates an IntentsCoprocessor from an existing ApiPromise instance.\n\t *\n\t * @param api - Connected ApiPromise instance\n\t * @param substratePrivateKey - Private key for signing extrinsics (optional for read-only operations)\n\t */\n\tstatic fromApi(api: ApiPromise, substratePrivateKey?: string): IntentsCoprocessor {\n\t\treturn new IntentsCoprocessor(api, substratePrivateKey, false)\n\t}\n\n\tprivate constructor(\n\t\tprivate api: ApiPromise,\n\t\tprivate substratePrivateKey?: string,\n\t\tprivate ownsConnection: boolean = false,\n\t) {}\n\n\t/**\n\t * The API every RPC query runs on: HTTP, connected to the same node as the websocket. Exposed so\n\t * callers query through this connection rather than opening one of their own.\n\t *\n\t * The split is by what each transport is for. Queries are one-shot request/response, which HTTP\n\t * serves without holding any state that can silently rot between calls. The websocket earns its\n\t * keep only where subscriptions do — watching a submitted extrinsic to inclusion.\n\t */\n\tasync queryApi(): Promise<ApiPromise> {\n\t\treturn await this.http()\n\t}\n\n\t/**\n\t * The websocket API, exposed so callers share this one connection instead of opening a second\n\t * socket to the same node. Only needed for subscriptions; use {@link queryApi} to read.\n\t */\n\tget apiConnection(): ApiPromise {\n\t\treturn this.api\n\t}\n\n\t/**\n\t * Disconnects the underlying API connection if this instance owns it.\n\t * Only disconnects the websocket if created via `connect()`, not when using shared connections.\n\t * The HTTP api is always created here, so it is always ours to close.\n\t */\n\tasync disconnect(): Promise<void> {\n\t\tconst http = this.httpApi\n\t\tthis.httpApi = null\n\t\tif (http) {\n\t\t\t// A creation that never settled must not turn shutdown into an unhandled rejection.\n\t\t\tawait http.then((api) => api.disconnect()).catch(() => {})\n\t\t}\n\t\tif (this.ownsConnection) {\n\t\t\tawait this.api.disconnect()\n\t\t}\n\t}\n\n\t/**\n\t * The HTTP api for this node, connected on first use. Every coprocessor has one — the endpoint\n\t * is derived from the websocket's own endpoint, so there is nothing to configure and nothing to\n\t * be absent.\n\t *\n\t * The connection attempt is bounded on both sides. `isReadyOrError` rejects on a failed\n\t * handshake, where plain `isReady` would simply never resolve, and the timeout covers an\n\t * endpoint that accepts the request and then goes quiet. An unbounded wait here would hang the\n\t * poll tick awaiting it, which is precisely the silent stall that polling exists to avoid. A\n\t * failed attempt is not cached, so the next call tries again.\n\t */\n\tprivate async http(): Promise<ApiPromise> {\n\t\tif (!this.httpApi) {\n\t\t\tconst httpUrl = deriveHttpUrl(this.wsEndpoint())\n\t\t\tconst api = new ApiPromise({\n\t\t\t\tprovider: new HttpProvider(httpUrl),\n\t\t\t\ttypesBundle: HYPERBRIDGE_TYPES_BUNDLE,\n\t\t\t\t// A second connection to the node the ws api already reported on; its init warnings\n\t\t\t\t// would just be duplicates.\n\t\t\t\tnoInitWarn: true,\n\t\t\t})\n\t\t\tthis.httpApi = Promise.race([\n\t\t\t\tapi.isReadyOrError,\n\t\t\t\trejectAfter(HTTP_CONNECT_TIMEOUT_MS, `HTTP RPC ${httpUrl} did not become ready`),\n\t\t\t]).catch(async (err) => {\n\t\t\t\t// Nothing else holds this half-open api; leaving it would keep retrying underneath.\n\t\t\t\tawait api.disconnect().catch(() => {})\n\t\t\t\tthis.httpApi = null\n\t\t\t\t// polkadot-js reports a failed init as a bare \"fetch failed\", which says nothing\n\t\t\t\t// about where it was fetching from.\n\t\t\t\tthrow new Error(`HTTP RPC ${httpUrl} is unavailable: ${err instanceof Error ? err.message : err}`)\n\t\t\t})\n\t\t}\n\t\treturn await this.httpApi\n\t}\n\n\t/**\n\t * The endpoint the websocket provider is connected to. Read from the provider rather than\n\t * remembered from a constructor argument, so it is the one endpoint in use no matter which\n\t * factory built this instance.\n\t */\n\tprivate wsEndpoint(): string {\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tconst endpoint = ((this.api as any)._rpcCore?.provider as { endpoint?: string } | undefined)?.endpoint\n\t\tif (!endpoint) {\n\t\t\tthrow new Error(\"Cannot determine the Hyperbridge websocket endpoint to derive an HTTP endpoint from\")\n\t\t}\n\t\treturn endpoint\n\t}\n\n\t/**\n\t * Creates a Substrate keypair from the configured private key.\n\t * Supports hex seed (with or without 0x), mnemonic phrases, and URI derivation paths (//Alice).\n\t */\n\tpublic getKeyPair(): KeyringPair {\n\t\tif (!this.substratePrivateKey) {\n\t\t\tthrow new Error(\"Substrate PrivateKey Required\")\n\t\t}\n\n\t\tconst keyring = new Keyring({ type: \"sr25519\" })\n\n\t\tif (this.substratePrivateKey.startsWith(\"//\")) {\n\t\t\treturn keyring.addFromUri(this.substratePrivateKey)\n\t\t}\n\t\tif (this.substratePrivateKey.includes(\" \")) {\n\t\t\treturn keyring.addFromMnemonic(this.substratePrivateKey)\n\t\t}\n\t\tconst hex = this.substratePrivateKey.startsWith(\"0x\")\n\t\t\t? this.substratePrivateKey.slice(2)\n\t\t\t: this.substratePrivateKey\n\t\tconst seedBytes = Buffer.from(hex, \"hex\")\n\t\treturn keyring.addFromSeed(seedBytes)\n\t}\n\n\t/**\n\t * Signs and sends an extrinsic. Submissions are serialised through {@link submissionQueue} so\n\t * concurrent calls never collide on the substrate account nonce — each extrinsic reaches a block\n\t * (or is confirmed still pooled and returned as `pending`) before the next is signed; auto-nonce\n\t * via `system.accountNextIndex` counts pooled extrinsics, so a pending one is never re-used.\n\t *\n\t * The extrinsic is built rather than passed in because the api it is built on decides where it\n\t * is signed and sent: a websocket that is down when the queue reaches this submission diverts it\n\t * to {@link sendViaHttp}, which needs the call bound to the HTTP api instead.\n\t */\n\tprivate async signAndSendExtrinsic(\n\t\tbuild: ExtrinsicBuilder,\n\t\tmaxRetries: number = 3,\n\t\ttimeoutMs: number = 30_000,\n\t): Promise<SubmissionOutcome> {\n\t\tconst result = await this.submissionQueue.add(async () => {\n\t\t\t// Checked here, not at call time: the queue may have held this submission for a while.\n\t\t\tif (!this.api.isConnected) {\n\t\t\t\ttry {\n\t\t\t\t\treturn await this.sendViaHttp(await this.http(), build)\n\t\t\t\t} catch (err) {\n\t\t\t\t\treturn { success: false, error: err instanceof Error ? err.message : String(err) }\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn await this.sendExtrinsicWithRetries(build(this.api), maxRetries, timeoutMs)\n\t\t})\n\t\treturn result ?? { success: false, error: \"Submission queue returned no result\" }\n\t}\n\n\t/**\n\t * Last-resort submission for when the websocket is down at signing time. A bid is only worth\n\t * anything inside its window, so waiting for a reconnect usually means not bidding at all.\n\t *\n\t * HTTP has no subscriptions, so this is `author_submitExtrinsic`: the node accepts the extrinsic\n\t * into its pool and returns its hash, and nothing further is observable from here. That is\n\t * exactly the `pending` contract — in flight, outcome unknown, do not re-sign — so the result\n\t * says so rather than claiming a success it cannot see.\n\t *\n\t * Only reached when the socket was already down before signing. A submission that got as far as\n\t * the pool over the websocket is never retried here: that is the duplicate-nonce race the\n\t * `pending` result exists to prevent.\n\t */\n\tprivate async sendViaHttp(api: ApiPromise, build: ExtrinsicBuilder): Promise<BidSubmissionResult> {\n\t\ttry {\n\t\t\tconst hash = await build(api).signAndSend(this.getKeyPair(), { tip: BASE_TIP })\n\t\t\treturn { success: false, pending: true, extrinsicHash: hash.toHex() as HexString }\n\t\t} catch (err) {\n\t\t\treturn this.classifySubmissionError(err instanceof Error ? err : new Error(String(err)))\n\t\t}\n\t}\n\n\t/**\n\t * Signs and sends an extrinsic, handling status updates and errors.\n\t * Implements retry logic with progressive tip increases for stuck transactions.\n\t *\n\t * A retry only happens when the previous attempt verifiably went nowhere. Once an attempt's\n\t * extrinsic is known to be pooled (`pending`), re-signing the same call would race our own\n\t * submission: the copy either bounces off the pool (1014, same nonce below the replacement\n\t * priority bump) or — if the original lands first, freeing the nonce — executes as a duplicate\n\t * and fails on-chain (e.g. `BidNotFound` for a retraction). Neither can succeed, so the pending\n\t * result is returned for the caller to confirm later.\n\t */\n\tprivate async sendExtrinsicWithRetries(\n\t\textrinsic: SubmittableExtrinsic<\"promise\">,\n\t\tmaxRetries: number,\n\t\ttimeoutMs: number,\n\t): Promise<SubmissionOutcome> {\n\t\tconst keyPair = this.getKeyPair()\n\t\tlet attempt = 0\n\n\t\twhile (attempt < maxRetries) {\n\t\t\tconst currentTip = BASE_TIP * BigInt(2 ** attempt) // Double tip on each retry\n\t\t\tattempt++\n\n\t\t\ttry {\n\t\t\t\tconst result = await this.sendWithTimeout(extrinsic, keyPair, currentTip, timeoutMs)\n\t\t\t\tif (result.success || result.pending || result.error?.includes(\"Dispatch error\")) {\n\t\t\t\t\t// Return immediately on success, an in-flight extrinsic, or dispatch errors\n\t\t\t\t\t// (non-recoverable)\n\t\t\t\t\treturn result\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t// Unexpected error, return immediately\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: err instanceof Error ? err.message : \"Unknown error\",\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: `Transaction failed after ${maxRetries} attempts`,\n\t\t}\n\t}\n\n\t/**\n\t * Classifies a submission rejection. Codes 1013 (\"already imported\") and 1014 (\"priority is\n\t * too low\") both mean a copy of this account+nonce is already in the pool — almost always our\n\t * own earlier attempt whose watch handle didn't confirm cleanly. That extrinsic is in flight;\n\t * resubmitting can only bounce again or land a duplicate, so these are surfaced as `pending`\n\t * rather than failure.\n\t */\n\tprivate classifySubmissionError(err: Error): BidSubmissionResult {\n\t\tconst code = (err as { code?: number }).code\n\t\tconst inFlight =\n\t\t\tcode === 1013 ||\n\t\t\tcode === 1014 ||\n\t\t\t/already imported|already in the pool|priority is too low/i.test(err.message)\n\t\treturn { success: false, pending: inFlight || undefined, error: err.message }\n\t}\n\n\t/**\n\t * Sends an extrinsic with a timeout.\n\t *\n\t * A timeout is only a failure when the extrinsic never made it into the transaction pool.\n\t * Once a pool-entry status (Future/Ready/Broadcast/Retracted) has been seen, the extrinsic is\n\t * in flight and may well execute after the watch is abandoned — the result is then `pending`,\n\t * telling the caller to confirm the outcome later instead of re-signing the same call.\n\t */\n\tprivate async sendWithTimeout(\n\t\textrinsic: SubmittableExtrinsic<\"promise\">,\n\t\tkeyPair: KeyringPair,\n\t\ttip: bigint,\n\t\ttimeoutMs: number,\n\t): Promise<SubmissionOutcome> {\n\t\treturn new Promise<SubmissionOutcome>((resolve) => {\n\t\t\tlet resolved = false\n\t\t\tlet unsubscribe: (() => void) | null = null\n\t\t\tlet enteredPool = false\n\n\t\t\t// Set timeout to detect stuck transactions\n\t\t\tconst timeoutId = setTimeout(() => {\n\t\t\t\tif (!resolved) {\n\t\t\t\t\tresolved = true\n\t\t\t\t\tif (unsubscribe) {\n\t\t\t\t\t\tunsubscribe()\n\t\t\t\t\t}\n\t\t\t\t\tresolve({\n\t\t\t\t\t\tsuccess: false,\n\t\t\t\t\t\tpending: enteredPool || undefined,\n\t\t\t\t\t\textrinsicHash: enteredPool ? (extrinsic.hash.toHex() as HexString) : undefined,\n\t\t\t\t\t\terror: `Transaction timed out after ${timeoutMs}ms${enteredPool ? \" while in the transaction pool\" : \"\"}`,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}, timeoutMs)\n\n\t\t\textrinsic\n\t\t\t\t.signAndSend(keyPair, { tip }, (result) => {\n\t\t\t\t\tif (resolved) return\n\n\t\t\t\t\tif (\n\t\t\t\t\t\tresult.status.isFuture ||\n\t\t\t\t\t\tresult.status.isReady ||\n\t\t\t\t\t\tresult.status.isBroadcast ||\n\t\t\t\t\t\tresult.status.isRetracted\n\t\t\t\t\t) {\n\t\t\t\t\t\tenteredPool = true\n\t\t\t\t\t}\n\n\t\t\t\t\tif (result.dispatchError && (result.status.isInBlock || result.status.isFinalized)) {\n\t\t\t\t\t\tresolved = true\n\t\t\t\t\t\tclearTimeout(timeoutId)\n\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\tsuccess: false,\n\t\t\t\t\t\t\terror: `Dispatch error: ${this.describeDispatchError(result.dispatchError)}`,\n\t\t\t\t\t\t})\n\t\t\t\t\t} else if (\n\t\t\t\t\t\tresult.status.isDropped ||\n\t\t\t\t\t\tresult.status.isInvalid ||\n\t\t\t\t\t\tresult.status.isUsurped ||\n\t\t\t\t\t\tresult.status.isFinalityTimeout\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Pool-level terminal statuses — don't retry, let caller decide\n\t\t\t\t\t\tresolved = true\n\t\t\t\t\t\tclearTimeout(timeoutId)\n\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\tsuccess: false,\n\t\t\t\t\t\t\terror: `Transaction ${result.status.type.toLowerCase()}`,\n\t\t\t\t\t\t})\n\t\t\t\t\t} else if (result.status.isInBlock || result.status.isFinalized) {\n\t\t\t\t\t\tresolved = true\n\t\t\t\t\t\tclearTimeout(timeoutId)\n\n\t\t\t\t\t\t// A utility.batch extrinsic is itself `Ok` even when one of its calls fails: the\n\t\t\t\t\t\t// failure surfaces as a BatchInterrupted event, NOT a top-level dispatchError.\n\t\t\t\t\t\t// BatchInterrupted { index, error } means calls [0, index) succeeded and the call\n\t\t\t\t\t\t// at `index` failed (the rest are skipped). We order batches so the primary call\n\t\t\t\t\t\t// is first, so an interruption at index 0 means nothing meaningful landed -> report\n\t\t\t\t\t\t// failure. A later index means the primary call succeeded and only a trailing\n\t\t\t\t\t\t// best-effort call (e.g. a deposit retraction) was skipped, which is still success.\n\t\t\t\t\t\tconst interrupted = result.events.find(\n\t\t\t\t\t\t\t({ event }) => event.section === \"utility\" && event.method === \"BatchInterrupted\",\n\t\t\t\t\t\t)\n\t\t\t\t\t\tif (interrupted) {\n\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\t\t\tconst [indexCodec, dispatchError] = interrupted.event.data as any\n\t\t\t\t\t\t\tif (Number(indexCodec.toString()) === 0) {\n\t\t\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\t\t\tsuccess: false,\n\t\t\t\t\t\t\t\t\terror: `Dispatch error: ${this.describeDispatchError(dispatchError)}`,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\tsuccess: true,\n\t\t\t\t\t\t\tblockHash: (result.status.isInBlock\n\t\t\t\t\t\t\t\t? result.status.asInBlock\n\t\t\t\t\t\t\t\t: result.status.asFinalized\n\t\t\t\t\t\t\t).toHex() as HexString,\n\t\t\t\t\t\t\textrinsicHash: extrinsic.hash.toHex() as HexString,\n\t\t\t\t\t\t\t// Carried so a batch caller can attribute each item's outcome.\n\t\t\t\t\t\t\tevents: result.events,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.then((unsub) => {\n\t\t\t\t\tif (resolved) {\n\t\t\t\t\t\tunsub()\n\t\t\t\t\t} else {\n\t\t\t\t\t\tunsubscribe = unsub\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.catch((err: Error) => {\n\t\t\t\t\tif (!resolved) {\n\t\t\t\t\t\tresolved = true\n\t\t\t\t\t\tclearTimeout(timeoutId)\n\t\t\t\t\t\tresolve(this.classifySubmissionError(err))\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t})\n\t}\n\n\t/**\n\t * Submits a bid to Hyperbridge's pallet-intents\n\t *\n\t * @param commitment - The order commitment hash (bytes32)\n\t * @param userOp - The encoded PackedUserOperation as hex string\n\t * @returns BidSubmissionResult with success status and block/extrinsic hash\n\t */\n\tasync submitBid(commitment: HexString, userOp: HexString): Promise<BidSubmissionResult> {\n\t\ttry {\n\t\t\treturn await this.signAndSendExtrinsic((api) => api.tx.intentsCoprocessor.placeBid(commitment, userOp))\n\t\t} catch (error) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: error instanceof Error ? error.message : \"Unknown error\",\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Retracts a bid from Hyperbridge and reclaims the deposit\n\t *\n\t * Use this to remove unused quotes and claim back deposited BRIDGE tokens.\n\t *\n\t * @param commitment - The order commitment hash (bytes32)\n\t * @returns BidSubmissionResult with success status and block/extrinsic hash\n\t */\n\tasync retractBid(commitment: HexString): Promise<BidSubmissionResult> {\n\t\ttry {\n\t\t\treturn await this.signAndSendExtrinsic((api) => api.tx.intentsCoprocessor.retractBid(commitment))\n\t\t} catch (error) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: error instanceof Error ? error.message : \"Unknown error\",\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Places a new bid and retracts a previous one in a single transaction via utility.batch.\n\t *\n\t * The new bid is the primary operation, so `placeBid` MUST run first. `utility.batch` is\n\t * non-atomic: a failing call interrupts the batch (via a BatchInterrupted event) without\n\t * reverting the calls that already succeeded. Placing first guarantees the new bid lands even\n\t * when the retraction then fails — which it routinely does, because a previous commitment's bid\n\t * may already be gone (or was itself never placed), making `retractBid` return `BidNotFound`.\n\t *\n\t * Ordering retraction first (the previous behaviour) caused a self-sustaining cascade: a\n\t * `BidNotFound` on the leading retract skipped the trailing `placeBid`, so the current bid never\n\t * landed, so the *next* interval's retract of that never-placed commitment also failed, and so\n\t * on — silently, because the batch extrinsic itself reports success. The deposit reclaim is\n\t * best-effort; landing the bid is not.\n\t *\n\t * @param retractCommitment - The order commitment of the bid to retract (bytes32)\n\t * @param bidCommitment - The order commitment of the new bid (bytes32)\n\t * @param userOp - The encoded PackedUserOperation as hex string\n\t * @returns BidSubmissionResult with success status and block/extrinsic hash\n\t */\n\tasync submitBidWithRetraction(\n\t\tretractCommitment: HexString,\n\t\tbidCommitment: HexString,\n\t\tuserOp: HexString,\n\t): Promise<BidSubmissionResult> {\n\t\ttry {\n\t\t\treturn await this.signAndSendExtrinsic((api) =>\n\t\t\t\tapi.tx.utility.batch([\n\t\t\t\t\tapi.tx.intentsCoprocessor.placeBid(bidCommitment, userOp),\n\t\t\t\t\tapi.tx.intentsCoprocessor.retractBid(retractCommitment),\n\t\t\t\t]),\n\t\t\t)\n\t\t} catch (error) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: error instanceof Error ? error.message : \"Unknown error\",\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Places every phantom bid of one interval in a single extrinsic, retracting each chain's\n\t * previous bid alongside it.\n\t *\n\t * The pallet registers one phantom order per configured chain in the same block, so this is the\n\t * whole interval's set. Submitting them one at a time costs a block per chain: submissions are\n\t * serialised on the account nonce and each waits for inclusion, so the last chain's bid is many\n\t * blocks behind the first, against a bid window measured in tens of blocks. Batched, every bid\n\t * lands in the same block.\n\t *\n\t * Uses `utility.force_batch`, not `utility.batch`. `batch` stops at the first failing call, so\n\t * one rejected bid — a closed window, a duplicate, an insufficient deposit — would silently\n\t * drop every bid after it. `force_batch` runs them all and reports each outcome. It needs no\n\t * special origin: any signed account may call it, exactly like `batch`.\n\t *\n\t * @param bids - The bids to place; an empty list is a no-op\n\t * @returns Per-bid outcomes, in the order given\n\t */\n\tasync submitPhantomBids(bids: PhantomBid[]): Promise<PhantomBidBatchResult> {\n\t\tif (bids.length === 0) return { bids: [] }\n\n\t\t// Call order is the only key the item events give us, so record where each bid's placeBid\n\t\t// sits as the calls are built.\n\t\tconst placeIndexByBid: number[] = []\n\t\tlet callCount = 0\n\t\tfor (const bid of bids) {\n\t\t\tplaceIndexByBid.push(callCount)\n\t\t\tcallCount += bid.retractCommitment ? 2 : 1\n\t\t}\n\n\t\tconst outcome = await this.signAndSendExtrinsic((api) =>\n\t\t\tapi.tx.utility.forceBatch(\n\t\t\t\tbids.flatMap((bid) => {\n\t\t\t\t\tconst calls = [api.tx.intentsCoprocessor.placeBid(bid.commitment, bid.userOp)]\n\t\t\t\t\t// Placed first so the pairing reads the same as the call order; with force_batch\n\t\t\t\t\t// the ordering no longer decides whether the bid survives a failed retraction.\n\t\t\t\t\tif (bid.retractCommitment) {\n\t\t\t\t\t\tcalls.push(api.tx.intentsCoprocessor.retractBid(bid.retractCommitment))\n\t\t\t\t\t}\n\t\t\t\t\treturn calls\n\t\t\t\t}),\n\t\t\t),\n\t\t)\n\n\t\tif (!outcome.success) {\n\t\t\t// Nothing landed, so there is nothing to attribute: every bid shares the batch's fate.\n\t\t\treturn {\n\t\t\t\tbids: bids.map((bid) => ({ commitment: bid.commitment, success: false, error: outcome.error })),\n\t\t\t\tpending: outcome.pending,\n\t\t\t\textrinsicHash: outcome.extrinsicHash,\n\t\t\t\terror: outcome.error,\n\t\t\t}\n\t\t}\n\n\t\tconst items = this.readForceBatchItems(outcome.events ?? [], callCount)\n\n\t\treturn {\n\t\t\tbids: bids.map((bid, index) => {\n\t\t\t\tconst error = items.errors[placeIndexByBid[index]]\n\t\t\t\treturn { commitment: bid.commitment, success: !error, error }\n\t\t\t}),\n\t\t\tblockHash: outcome.blockHash,\n\t\t\textrinsicHash: outcome.extrinsicHash,\n\t\t\terror: items.error,\n\t\t}\n\t}\n\n\t/**\n\t * Reads one outcome per call out of a force_batch's events.\n\t *\n\t * `ItemFailed` carries no index — pallet-utility emits exactly one `ItemCompleted` or\n\t * `ItemFailed` per call, in call order, so the k-th item event belongs to call k.\n\t *\n\t * A count that does not match the calls submitted means the events are not the ones assumed\n\t * here, and every attribution after the discrepancy would be off by one. The bids are then\n\t * reported as placed: a bid wrongly recorded as landed is retracted next interval and the\n\t * retraction harmlessly fails with `BidNotFound`, whereas one wrongly recorded as failed is\n\t * never retracted at all and leaves its deposit reserved.\n\t */\n\tprivate readForceBatchItems(\n\t\tevents: NonNullable<SubmissionOutcome[\"events\"]>,\n\t\tcallCount: number,\n\t): { errors: (string | undefined)[]; error?: string } {\n\t\tconst errors: (string | undefined)[] = []\n\t\tfor (const { event } of events) {\n\t\t\tif (event.section !== \"utility\") continue\n\t\t\tif (event.method === \"ItemCompleted\") errors.push(undefined)\n\t\t\telse if (event.method === \"ItemFailed\") errors.push(this.describeDispatchError(event.data[0]))\n\t\t}\n\n\t\tif (errors.length !== callCount) {\n\t\t\treturn {\n\t\t\t\terrors: new Array(callCount).fill(undefined),\n\t\t\t\terror: `force_batch reported ${errors.length} item events for ${callCount} calls; outcomes not attributed`,\n\t\t\t}\n\t\t}\n\t\treturn { errors }\n\t}\n\n\t/** Renders a DispatchError as `pallet::Error`, falling back to its raw form. */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tprivate describeDispatchError(dispatchError: any): string {\n\t\tif (dispatchError?.isModule) {\n\t\t\tconst decoded = this.api.registry.findMetaError(dispatchError.asModule)\n\t\t\treturn `${decoded.section}::${decoded.name}`\n\t\t}\n\t\treturn dispatchError?.toString() ?? \"unknown dispatch error\"\n\t}\n\n\t/**\n\t * Fetches all bid storage entries for a given order commitment.\n\t * Returns the on-chain data only (filler addresses and deposits).\n\t *\n\t * @param commitment - The order commitment hash (bytes32)\n\t * @returns Array of BidStorageEntry objects\n\t */\n\tasync getBidStorageEntries(commitment: HexString): Promise<BidStorageEntry[]> {\n\t\tconst api = await this.http()\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tconst entries = await (api.query.intentsCoprocessor.bids as any).entries(commitment)\n\n\t\treturn entries.map(([storageKey, depositValue]: [any, any]) => ({\n\t\t\tcommitment,\n\t\t\tfiller: storageKey.args[1].toString() as string,\n\t\t\tdeposit: BigInt(depositValue.toString()),\n\t\t}))\n\t}\n\n\t/**\n\t * Fetches all bids for a given order commitment from Hyperbridge.\n\t *\n\t * Uses the custom intents_getBidsForOrder RPC if available on the node\n\t * for a single round-trip. Falls back to parallel storage + offchain\n\t * lookups otherwise.\n\t *\n\t * @param commitment - The order commitment hash (bytes32)\n\t * @returns Array of FillerBid objects containing filler address, userOp, and deposit\n\t */\n\tasync getBidsForOrder(commitment: HexString): Promise<FillerBid[]> {\n\t\ttry {\n\t\t\treturn await this.getBidsViaRpc(commitment)\n\t\t} catch (err) {\n\t\t\tconsole.warn(\"intents RPC failed, falling back to storage queries:\", err)\n\t\t}\n\n\t\treturn await this.getBidsViaStorage(commitment)\n\t}\n\n\t/**\n\t * Fetches bids using the custom intents_getBidsForOrder RPC.\n\t * Single round-trip but does not include deposit amounts.\n\t */\n\tprivate async getBidsViaRpc(commitment: HexString): Promise<FillerBid[]> {\n\t\tconst api = await this.http()\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tconst result: RpcBidInfo[] = await (api as any)._rpcCore.provider.send(\"intents_getBidsForOrder\", [commitment])\n\n\t\treturn result.map((entry) => {\n\t\t\tconst userOp = decodeUserOpScale(entry.user_op as HexString)\n\t\t\tconst filler = new Keyring({ type: \"sr25519\" }).encodeAddress(hexToU8a(entry.filler))\n\t\t\treturn { filler, userOp, deposit: 0n }\n\t\t})\n\t}\n\n\t/**\n\t * Fetches bids using on-chain storage entries + parallel offchain lookups.\n\t * Slower but works on all nodes and includes deposit amounts.\n\t */\n\tprivate async getBidsViaStorage(commitment: HexString): Promise<FillerBid[]> {\n\t\tconst api = await this.http()\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tconst entries = await (api.query.intentsCoprocessor.bids as any).entries(commitment)\n\n\t\tif (entries.length === 0) return []\n\n\t\tconst bidPromises = entries.map(async ([storageKey, depositValue]: [any, any]) => {\n\t\t\ttry {\n\t\t\t\tconst filler = storageKey.args[1].toString()\n\t\t\t\tconst deposit = BigInt(depositValue.toString())\n\n\t\t\t\tconst offchainKey = this.buildOffchainBidKey(commitment, filler)\n\t\t\t\tconst offchainKeyHex = u8aToHex(offchainKey)\n\n\t\t\t\tconst offchainResult = await api.rpc.offchain.localStorageGet(\"PERSISTENT\", offchainKeyHex)\n\n\t\t\t\tif (!offchainResult || offchainResult.isNone) return null\n\n\t\t\t\tconst bidData = offchainResult.unwrap().toHex() as HexString\n\t\t\t\tconst decoded = this.decodeBid(bidData)\n\n\t\t\t\treturn { filler: decoded.filler, userOp: decoded.userOp, deposit }\n\t\t\t} catch {\n\t\t\t\treturn null\n\t\t\t}\n\t\t})\n\n\t\tconst results = await Promise.all(bidPromises)\n\t\treturn results.filter((b): b is FillerBid => b !== null)\n\t}\n\n\t/** Decodes SCALE-encoded Bid struct and SCALE-encoded PackedUserOperation */\n\tprivate decodeBid(hex: HexString): { filler: string; userOp: PackedUserOperation } {\n\t\tconst decoded = BidCodec.dec(hexToU8a(hex))\n\t\tconst filler = new Keyring({ type: \"sr25519\" }).encodeAddress(new Uint8Array(decoded.filler))\n\t\tconst userOpHex = u8aToHex(new Uint8Array(decoded.user_op)) as HexString\n\n\t\t// Decode UserOp using SCALE codec\n\t\tconst userOp = decodeUserOpScale(userOpHex)\n\n\t\treturn { filler, userOp }\n\t}\n\n\t/** Builds offchain storage key: \"intents::bid::\" + commitment + filler */\n\tprivate buildOffchainBidKey(commitment: HexString, filler: string): Uint8Array {\n\t\treturn u8aConcat(OFFCHAIN_BID_PREFIX, hexToU8a(commitment), decodeAddress(filler))\n\t}\n\n\t/**\n\t * Fetches the ABI-encoded phantom order from offchain storage and decodes it\n\t * into an `Order` object. The pallet writes the order bytes under the key\n\t * `intents::phantom::order::<commitment>` when it calls `on_initialize`.\n\t *\n\t * Returns `null` if the key is absent (e.g. the node is not an offchain worker\n\t * or the commitment has expired and been cleared).\n\t */\n\tasync fetchPhantomOrder(commitment: HexString): Promise<Order | null> {\n\t\tconst key = u8aConcat(OFFCHAIN_PHANTOM_PREFIX, hexToU8a(commitment))\n\t\tconst api = await this.http()\n\t\tconst result = await api.rpc.offchain.localStorageGet(\"PERSISTENT\", u8aToHex(key))\n\t\tif (!result || result.isNone) return null\n\n\t\tconst rawHex = result.unwrap().toHex() as HexString\n\t\tif (rawHex === \"0x\" || rawHex === \"0x00\") return null\n\n\t\tconst placeOrderAbi = (\n\t\t\tIntentGatewayV2.ABI as readonly { type: string; name?: string; inputs?: unknown[] }[]\n\t\t).find((item) => item.type === \"function\" && item.name === \"placeOrder\")\n\t\tconst orderType = placeOrderAbi?.inputs?.[0]\n\t\tif (!orderType) return null\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tconst [decoded] = decodeAbiParameters([orderType as any], rawHex)\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tconst d = decoded as any\n\t\tconst textDecoder = new TextDecoder()\n\n\t\treturn {\n\t\t\tid: commitment,\n\t\t\tuser: d.user as HexString,\n\t\t\tsource: textDecoder.decode(hexToBytes(d.source as HexString)),\n\t\t\tdestination: textDecoder.decode(hexToBytes(d.destination as HexString)),\n\t\t\tdeadline: d.deadline as bigint,\n\t\t\tnonce: d.nonce as bigint,\n\t\t\tfees: d.fees as bigint,\n\t\t\tsession: d.session as HexString,\n\t\t\tpredispatch: {\n\t\t\t\tassets: (d.predispatch.assets as { token: HexString; amount: bigint }[]).map((a) => ({\n\t\t\t\t\ttoken: a.token,\n\t\t\t\t\tamount: a.amount,\n\t\t\t\t})),\n\t\t\t\tcall: d.predispatch.call as HexString,\n\t\t\t},\n\t\t\tinputs: (d.inputs as { token: HexString; amount: bigint }[]).map((i) => ({\n\t\t\t\ttoken: i.token,\n\t\t\t\tamount: i.amount,\n\t\t\t})),\n\t\t\toutput: {\n\t\t\t\tbeneficiary: d.output.beneficiary as HexString,\n\t\t\t\tassets: (d.output.assets as { token: HexString; amount: bigint }[]).map((a) => ({\n\t\t\t\t\ttoken: a.token,\n\t\t\t\t\tamount: a.amount,\n\t\t\t\t})),\n\t\t\t\tcall: d.output.call as HexString,\n\t\t\t},\n\t\t}\n\t}\n\n\t/**\n\t * Reads the PhantomOrderRegistered events emitted in a single block.\n\t */\n\tasync getPhantomOrdersInBlock(blockNumber: number): Promise<PhantomOrderEvent[]> {\n\t\tconst api = await this.http()\n\t\tconst blockHash = await api.rpc.chain.getBlockHash(blockNumber)\n\t\tconst apiAt = await api.at(blockHash)\n\t\tconst records = await apiAt.query.system.events()\n\n\t\tconst orders: PhantomOrderEvent[] = []\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tfor (const { event } of records as unknown as Array<{ event: any }>) {\n\t\t\tif (event.section !== \"intentsCoprocessor\" || event.method !== \"PhantomOrderRegistered\") continue\n\t\t\tconst [commitment, chain, createdAt, legs] = event.data\n\t\t\torders.push({\n\t\t\t\tcommitment: commitment.toHex() as HexString,\n\t\t\t\tchain: new TextDecoder().decode(hexToU8a(chain.toHex())),\n\t\t\t\tcreatedAt: createdAt.toNumber(),\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\tlegs: (legs as any[]).map((leg: any) => ({\n\t\t\t\t\ttokenA: leg.tokenA.toHex() as HexString,\n\t\t\t\t\ttokenB: leg.tokenB.toHex() as HexString,\n\t\t\t\t\tstandardAmount: BigInt(leg.standardAmount.toString()),\n\t\t\t\t})),\n\t\t\t})\n\t\t}\n\t\treturn orders\n\t}\n\n\t/**\n\t * Polls for newly registered phantom orders, invoking the callback once per block that carries\n\t * any, with all of that block's orders.\n\t *\n\t * Per block rather than per order because that is how the pallet writes them: one order per\n\t * configured chain, all registered in the same `on_initialize`. Delivering them together lets a\n\t * caller bid on the whole interval in one extrinsic (see {@link submitPhantomBids}) instead of\n\t * one per chain.\n\t *\n\t * Each tick reads the current head and scans every block between the last one processed and that\n\t * head, so the block cursor — not the connection — determines what has been seen. This replaced a\n\t * system.events subscription, which was only as reliable as its socket: polkadot-js reconnects\n\t * the transport but does not reliably re-establish storage subscriptions, and anything emitted\n\t * while disconnected was lost silently. With a bid window measured in a handful of blocks, that\n\t * meant silently missed bids.\n\t *\n\t * Scanning a block range is gap-free rather than merely self-healing: an outage delays orders but\n\t * cannot drop them, because the cursor only advances past a block whose events were actually\n\t * read. Recovery replays the backlog.\n\t *\n\t * Every read here goes over HTTP, never the websocket. Polling is a sequence of independent\n\t * one-shot requests with no state to lose between them, which is exactly what a stateless\n\t * transport does well: a request either answers or fails loudly on this tick, instead of a\n\t * socket that looks alive while delivering nothing. It also means a websocket outage does not\n\t * pause phantom bidding at all — the two transports fail independently.\n\t *\n\t * Returns a function that stops polling.\n\t */\n\tpollPhantomOrders(\n\t\tcallback: (events: PhantomOrderEvent[]) => void,\n\t\toptions: PollPhantomOrdersOptions = {},\n\t): () => void {\n\t\tconst { intervalMs, maxBlocksPerPoll = 500, lookbackBlocks = 0, onError } = options\n\n\t\t// Last block whose events have been delivered. Null until the first successful head read.\n\t\tlet cursor: number | null = null\n\t\tlet inFlight = false\n\t\tlet stopped = false\n\n\t\tconst tick = async (): Promise<void> => {\n\t\t\t// A scan slower than the interval must not stack up behind itself.\n\t\t\tif (inFlight || stopped) return\n\t\t\tinFlight = true\n\t\t\ttry {\n\t\t\t\tconst head = (await (await this.http()).rpc.chain.getHeader()).number.toNumber()\n\n\t\t\t\tif (cursor === null) {\n\t\t\t\t\t// Start just below the head so the head itself is scanned, less any lookback.\n\t\t\t\t\tcursor = Math.max(head - 1 - lookbackBlocks, -1)\n\t\t\t\t}\n\t\t\t\tif (head <= cursor) return\n\n\t\t\t\tconst to = Math.min(head, cursor + maxBlocksPerPoll)\n\t\t\t\tfor (let blockNumber = cursor + 1; blockNumber <= to; blockNumber++) {\n\t\t\t\t\tif (stopped) return\n\t\t\t\t\tconst orders = await this.getPhantomOrdersInBlock(blockNumber)\n\t\t\t\t\tif (orders.length > 0) callback(orders)\n\t\t\t\t\t// Advance per block, not per range: a failure partway through re-scans only the\n\t\t\t\t\t// blocks that were never read, and never re-delivers ones that were.\n\t\t\t\t\tcursor = blockNumber\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\tonError?.(err)\n\t\t\t} finally {\n\t\t\t\tinFlight = false\n\t\t\t}\n\t\t}\n\n\t\tvoid tick()\n\n\t\t// An explicit cadence starts the timer here and now; only the runtime-derived default has to\n\t\t// wait on the node, and the scan above has already gone out either way.\n\t\tlet timer: ReturnType<typeof setInterval> | null = null\n\t\tconst startTimer = (ms: number) => {\n\t\t\tif (stopped) return\n\t\t\ttimer = setInterval(() => void tick(), ms)\n\t\t}\n\t\tif (intervalMs !== undefined) startTimer(intervalMs)\n\t\telse void this.phantomPollIntervalMs().then(startTimer)\n\n\t\treturn () => {\n\t\t\tstopped = true\n\t\t\tif (timer) clearInterval(timer)\n\t\t}\n\t}\n\n\t/**\n\t * The poll cadence for the runtime this instance is connected to: Gargantua polls every block,\n\t * everything else every 15s. Falls back to the slower cadence if the runtime cannot be read,\n\t * since an unreachable node is the poll's problem to report, not the cadence lookup's.\n\t */\n\tprivate async phantomPollIntervalMs(): Promise<number> {\n\t\ttry {\n\t\t\tconst specName = (await this.http()).runtimeVersion.specName.toString()\n\t\t\treturn specName === \"gargantua\" ? GARGANTUA_PHANTOM_POLL_INTERVAL_MS : PHANTOM_POLL_INTERVAL_MS\n\t\t} catch {\n\t\t\treturn PHANTOM_POLL_INTERVAL_MS\n\t\t}\n\t}\n}\n","import {\n\tkeccak256,\n\ttoHex,\n\tencodeAbiParameters,\n\tdecodeAbiParameters,\n\tdecodeFunctionData,\n\tencodeFunctionData,\n\tconcat,\n\tpad,\n\tencodePacked,\n\tparseAbiParameters,\n\ttype Hex,\n} from \"viem\"\nimport { privateKeyToAccount } from \"viem/accounts\"\nimport type { HexString, PackedUserOperation } from \"@/types\"\nimport type { ERC7821Call } from \"@/types\"\nimport ERC7821ABI from \"@/abis/erc7281\"\nimport type { IntentGatewayContext } from \"./types\"\nimport { ERC7821_BATCH_MODE } from \"./types\"\nimport type { BundlerMethod } from \"./types\"\n\n/**\n * EIP-712 type hash for the `SelectSolver` struct.\n *\n * Computed as `keccak256(\"SelectSolver(bytes32 commitment,address solver)\")`.\n * Used when the session key signs a solver-selection message so that the\n * IntentGatewayV2 contract can verify the choice on-chain.\n */\nexport const SELECT_SOLVER_TYPEHASH = keccak256(toHex(\"SelectSolver(bytes32 commitment,address solver)\"))\n\n/**\n * EIP-712 type hash for the `PackedUserOperation` struct.\n *\n * Matches the ERC-4337 v0.8 `PackedUserOperation` type definition used by\n * EntryPoint v0.8. Used when computing the UserOperation hash that solvers\n * must sign before submitting bids.\n */\nexport const PACKED_USEROP_TYPEHASH = keccak256(\n\ttoHex(\n\t\t\"PackedUserOperation(address sender,uint256 nonce,bytes initCode,bytes callData,bytes32 accountGasLimits,uint256 preVerificationGas,bytes32 gasFees,bytes paymasterAndData)\",\n\t),\n)\n\n/**\n * EIP-712 type hash for the `EIP712Domain` struct.\n *\n * Computed as `keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\")`.\n * Used to construct domain separators for all EIP-712 messages in the\n * IntentGatewayV2 protocol.\n */\nexport const DOMAIN_TYPEHASH = keccak256(\n\ttoHex(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"),\n)\n\n/**\n * Crypto and encoding utilities for IntentGatewayV2.\n *\n * Provides helpers for EIP-712 domain separation, UserOperation hashing,\n * gas-limit packing/unpacking, bundler JSON-RPC calls, and ERC-7821\n * batch-execute encoding and decoding. All methods are stateless with respect\n * to the protocol but require the shared {@link IntentGatewayContext} for the\n * bundler URL.\n */\nexport class CryptoUtils {\n\t/**\n\t * @param ctx - Shared IntentsV2 context; used to access the bundler URL for\n\t * JSON-RPC calls.\n\t */\n\tconstructor(private readonly ctx: IntentGatewayContext) {}\n\n\t/**\n\t * Computes an EIP-712 domain separator for a given contract.\n\t *\n\t * @param contractName - Human-readable name of the contract (e.g. `\"IntentGateway\"`).\n\t * @param version - Version string (e.g. `\"2\"`).\n\t * @param chainId - Chain ID of the network the contract is deployed on.\n\t * @param contractAddress - Address of the verifying contract.\n\t * @returns The 32-byte domain separator as a hex string.\n\t */\n\tstatic getDomainSeparator(contractName: string, version: string, chainId: bigint, contractAddress: HexString): HexString {\n\t\treturn keccak256(\n\t\t\tencodeAbiParameters(parseAbiParameters(\"bytes32, bytes32, bytes32, uint256, address\"), [\n\t\t\t\tDOMAIN_TYPEHASH,\n\t\t\t\tkeccak256(toHex(contractName)),\n\t\t\t\tkeccak256(toHex(version)),\n\t\t\t\tchainId,\n\t\t\t\tcontractAddress,\n\t\t\t]),\n\t\t)\n\t}\n\n\t/**\n\t * Signs a `SelectSolver` EIP-712 message with a session key.\n\t *\n\t * The session key authorises the selection of a specific solver for the\n\t * given order commitment. The resulting signature is appended to the\n\t * solver's UserOperation signature before bundle submission.\n\t *\n\t * @param commitment - The order commitment (bytes32) being fulfilled.\n\t * @param solverAddress - Address of the solver account selected to fill the order.\n\t * @param domainSeparator - EIP-712 domain separator for the IntentGatewayV2 contract.\n\t * @param privateKey - Hex-encoded private key of the session key that signs the message.\n\t * @returns The ECDSA signature as a hex string, or `null` if signing fails.\n\t */\n\tstatic async signSolverSelection(\n\t\tcommitment: HexString,\n\t\tsolverAddress: HexString,\n\t\tdomainSeparator: HexString,\n\t\tprivateKey: HexString,\n\t): Promise<HexString | null> {\n\t\tconst account = privateKeyToAccount(privateKey as Hex)\n\n\t\tconst structHash = keccak256(\n\t\t\tencodeAbiParameters(\n\t\t\t\t[{ type: \"bytes32\" }, { type: \"bytes32\" }, { type: \"address\" }],\n\t\t\t\t[SELECT_SOLVER_TYPEHASH, commitment, solverAddress],\n\t\t\t),\n\t\t)\n\n\t\tconst digest = keccak256(concat([\"0x1901\" as Hex, domainSeparator as Hex, structHash]))\n\t\tconst signature = await account.sign({ hash: digest })\n\n\t\treturn signature as HexString\n\t}\n\n\t/**\n\t * Computes the EIP-712 hash of a `PackedUserOperation` as defined by\n\t * ERC-4337 EntryPoint v0.8.\n\t *\n\t * @param userOp - The packed UserOperation to hash.\n\t * @param entryPoint - Address of the EntryPoint v0.8 contract.\n\t * @param chainId - Chain ID of the network on which the operation will execute.\n\t * @returns The UserOperation hash as a hex string.\n\t */\n\tstatic computeUserOpHash(userOp: PackedUserOperation, entryPoint: Hex, chainId: bigint): Hex {\n\t\tconst structHash = CryptoUtils.getPackedUserStructHash(userOp)\n\t\tconst domainSeparator = CryptoUtils.getDomainSeparator(\"ERC4337\", \"1\", chainId, entryPoint as HexString)\n\n\t\treturn keccak256(\n\t\t\tencodePacked([\"bytes1\", \"bytes1\", \"bytes32\", \"bytes32\"], [\"0x19\", \"0x01\", domainSeparator, structHash]),\n\t\t)\n\t}\n\n\t/**\n\t * Derives the ERC-4337 nonce key that binds a bid UserOperation to its\n\t * order and session key: the lower 192 bits of\n\t * `keccak256(commitment ‖ sessionKey)`. `SolverAccount` rejects bid\n\t * operations whose nonce key differs — this is what lets the solver sign\n\t * the plain userOpHash while staying committed to the order and to the\n\t * session key it bid against.\n\t *\n\t * @param commitment - The order commitment (`order.id`).\n\t * @param sessionKey - The order's session key address (`order.session`).\n\t * @returns The 192-bit nonce key as a bigint (pass to `EntryPoint.getNonce`).\n\t */\n\tstatic bidNonceKey(commitment: HexString, sessionKey: HexString): bigint {\n\t\treturn BigInt(keccak256(encodePacked([\"bytes32\", \"address\"], [commitment, sessionKey]))) & ((1n << 192n) - 1n)\n\t}\n\n\t/**\n\t * Builds the EIP-712 typed-data payload whose digest is the EntryPoint v0.8\n\t * `userOpHash` (i.e. `hashTypedData(packedUserOpTypedData(...)) ===\n\t * computeUserOpHash(...)`). Signing this typed data is bit-identical to\n\t * signing the raw userOpHash, but keeps the full operation visible to\n\t * signing infrastructure (hardware wallets, MPC/TEE policy engines) instead\n\t * of an opaque 32-byte digest.\n\t *\n\t * The payload must be a standard self-describing `eth_signTypedData_v4`\n\t * payload — `EIP712Domain` listed in `types`, `chainId` as a JSON number —\n\t * because some signing backends (e.g. MPC Vault) hash it server-side from\n\t * the JSON rather than locally via viem. viem ignores both details when\n\t * hashing, so the digest is unchanged for local signers.\n\t *\n\t * @param userOp - The packed UserOperation to sign (signature field ignored).\n\t * @param entryPoint - Address of the EntryPoint v0.8 contract.\n\t * @param chainId - Chain ID of the network on which the operation will execute.\n\t * @returns A viem `TypedDataDefinition` for the operation.\n\t */\n\tstatic packedUserOpTypedData(userOp: PackedUserOperation, entryPoint: Hex, chainId: bigint) {\n\t\treturn {\n\t\t\tdomain: {\n\t\t\t\tname: \"ERC4337\",\n\t\t\t\tversion: \"1\",\n\t\t\t\t// Runtime number so JSON.stringify emits a canonical v4 numeric chainId for\n\t\t\t\t// server-side hashers; viem's uint256 type mapping wants bigint but its\n\t\t\t\t// runtime accepts numbers, hence the cast.\n\t\t\t\tchainId: Number(chainId) as unknown as bigint,\n\t\t\t\tverifyingContract: entryPoint,\n\t\t\t},\n\t\t\t// `as const`: viem derives the domain's TYPE from `types.EIP712Domain`, so the\n\t\t\t// entries must stay string literals — widened `string` fields make viem's\n\t\t\t// typed-data generics reject the payload at every call site.\n\t\t\ttypes: {\n\t\t\t\tEIP712Domain: [\n\t\t\t\t\t{ name: \"name\", type: \"string\" },\n\t\t\t\t\t{ name: \"version\", type: \"string\" },\n\t\t\t\t\t{ name: \"chainId\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"verifyingContract\", type: \"address\" },\n\t\t\t\t],\n\t\t\t\tPackedUserOperation: [\n\t\t\t\t\t{ name: \"sender\", type: \"address\" },\n\t\t\t\t\t{ name: \"nonce\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"initCode\", type: \"bytes\" },\n\t\t\t\t\t{ name: \"callData\", type: \"bytes\" },\n\t\t\t\t\t{ name: \"accountGasLimits\", type: \"bytes32\" },\n\t\t\t\t\t{ name: \"preVerificationGas\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"gasFees\", type: \"bytes32\" },\n\t\t\t\t\t{ name: \"paymasterAndData\", type: \"bytes\" },\n\t\t\t\t],\n\t\t\t} as const,\n\t\t\tprimaryType: \"PackedUserOperation\" as const,\n\t\t\tmessage: {\n\t\t\t\tsender: userOp.sender,\n\t\t\t\tnonce: userOp.nonce,\n\t\t\t\tinitCode: userOp.initCode,\n\t\t\t\tcallData: userOp.callData,\n\t\t\t\taccountGasLimits: userOp.accountGasLimits,\n\t\t\t\tpreVerificationGas: userOp.preVerificationGas,\n\t\t\t\tgasFees: userOp.gasFees,\n\t\t\t\tpaymasterAndData: userOp.paymasterAndData,\n\t\t\t},\n\t\t}\n\t}\n\n\t/**\n\t * Computes the EIP-712 struct hash of a `PackedUserOperation`.\n\t *\n\t * Hashes dynamic fields (`initCode`, `callData`, `paymasterAndData`) before\n\t * ABI-encoding so the final hash is a fixed-length 32-byte value.\n\t *\n\t * @param userOp - The packed UserOperation to hash.\n\t * @returns The struct hash as a 32-byte hex string.\n\t */\n\tstatic getPackedUserStructHash(userOp: PackedUserOperation): HexString {\n\t\treturn keccak256(\n\t\t\tencodeAbiParameters(\n\t\t\t\tparseAbiParameters(\"bytes32, address, uint256, bytes32, bytes32, bytes32, uint256, bytes32, bytes32\"),\n\t\t\t\t[\n\t\t\t\t\tPACKED_USEROP_TYPEHASH,\n\t\t\t\t\tuserOp.sender,\n\t\t\t\t\tuserOp.nonce,\n\t\t\t\t\tkeccak256(userOp.initCode),\n\t\t\t\t\tkeccak256(userOp.callData),\n\t\t\t\t\tuserOp.accountGasLimits as Hex,\n\t\t\t\t\tuserOp.preVerificationGas,\n\t\t\t\t\tuserOp.gasFees as Hex,\n\t\t\t\t\tkeccak256(userOp.paymasterAndData),\n\t\t\t\t],\n\t\t\t),\n\t\t) as HexString\n\t}\n\n\t/**\n\t * Packs `verificationGasLimit` and `callGasLimit` into the ERC-4337\n\t * `accountGasLimits` bytes32 field.\n\t *\n\t * The high 16 bytes hold `verificationGasLimit` and the low 16 bytes hold\n\t * `callGasLimit`, matching the EntryPoint v0.8 packed representation.\n\t *\n\t * @param verificationGasLimit - Gas limit for the account verification step.\n\t * @param callGasLimit - Gas limit for the main execution call.\n\t * @returns A 32-byte hex string with both limits packed.\n\t */\n\tstatic packGasLimits(verificationGasLimit: bigint, callGasLimit: bigint): HexString {\n\t\tconst verificationGasHex = pad(toHex(verificationGasLimit), { size: 16 })\n\t\tconst callGasHex = pad(toHex(callGasLimit), { size: 16 })\n\t\treturn concat([verificationGasHex, callGasHex]) as HexString\n\t}\n\n\t/**\n\t * Packs `maxPriorityFeePerGas` and `maxFeePerGas` into the ERC-4337\n\t * `gasFees` bytes32 field.\n\t *\n\t * The high 16 bytes hold `maxPriorityFeePerGas` and the low 16 bytes hold\n\t * `maxFeePerGas`, matching the EntryPoint v0.8 packed representation.\n\t *\n\t * @param maxPriorityFeePerGas - Maximum tip per gas (EIP-1559).\n\t * @param maxFeePerGas - Maximum total fee per gas (EIP-1559).\n\t * @returns A 32-byte hex string with both fee values packed.\n\t */\n\tstatic packGasFees(maxPriorityFeePerGas: bigint, maxFeePerGas: bigint): HexString {\n\t\tconst priorityFeeHex = pad(toHex(maxPriorityFeePerGas), { size: 16 })\n\t\tconst maxFeeHex = pad(toHex(maxFeePerGas), { size: 16 })\n\t\treturn concat([priorityFeeHex, maxFeeHex]) as HexString\n\t}\n\n\t/**\n\t * Unpacks the `accountGasLimits` bytes32 field back into its constituent\n\t * gas limits.\n\t *\n\t * @param accountGasLimits - The packed 32-byte gas limits field from a `PackedUserOperation`.\n\t * @returns Object with `verificationGasLimit` and `callGasLimit` as bigints.\n\t */\n\tstatic unpackGasLimits(accountGasLimits: HexString): { verificationGasLimit: bigint; callGasLimit: bigint } {\n\t\tconst hex = accountGasLimits.slice(2)\n\t\tconst verificationGasLimit = BigInt(`0x${hex.slice(0, 32)}`)\n\t\tconst callGasLimit = BigInt(`0x${hex.slice(32, 64)}`)\n\t\treturn { verificationGasLimit, callGasLimit }\n\t}\n\n\t/**\n\t * Unpacks the `gasFees` bytes32 field back into its constituent fee values.\n\t *\n\t * @param gasFees - The packed 32-byte gas fees field from a `PackedUserOperation`.\n\t * @returns Object with `maxPriorityFeePerGas` and `maxFeePerGas` as bigints.\n\t */\n\tstatic unpackGasFees(gasFees: HexString): { maxPriorityFeePerGas: bigint; maxFeePerGas: bigint } {\n\t\tconst hex = gasFees.slice(2)\n\t\tconst maxPriorityFeePerGas = BigInt(`0x${hex.slice(0, 32)}`)\n\t\tconst maxFeePerGas = BigInt(`0x${hex.slice(32, 64)}`)\n\t\treturn { maxPriorityFeePerGas, maxFeePerGas }\n\t}\n\n\t/**\n\t * Converts a packed `PackedUserOperation` into the JSON object format\n\t * expected by ERC-4337 bundler JSON-RPC endpoints.\n\t *\n\t * Unpacks `accountGasLimits` and `gasFees`, separates optional factory and\n\t * paymaster fields, and converts all numeric fields to hex strings.\n\t *\n\t * @param userOp - The packed UserOperation to convert.\n\t * @returns A plain object safe to pass as the first element of bundler RPC params.\n\t */\n\tstatic prepareBundlerCall(userOp: PackedUserOperation): Record<string, unknown> {\n\t\tconst { verificationGasLimit, callGasLimit } = CryptoUtils.unpackGasLimits(userOp.accountGasLimits)\n\t\tconst { maxPriorityFeePerGas, maxFeePerGas } = CryptoUtils.unpackGasFees(userOp.gasFees)\n\n\t\tconst hasFactory = userOp.initCode && userOp.initCode !== \"0x\" && userOp.initCode.length > 2\n\t\tconst factory = hasFactory ? (`0x${userOp.initCode.slice(2, 42)}` as HexString) : undefined\n\t\tconst factoryData = hasFactory ? (`0x${userOp.initCode.slice(42)}` as HexString) : undefined\n\n\t\t// EntryPoint v0.8 packed paymasterAndData layout:\n\t\t// paymaster (20 bytes) || paymasterVerificationGasLimit (uint128, 16 bytes)\n\t\t// || paymasterPostOpGasLimit (uint128, 16 bytes) || paymasterData (variable)\n\t\tconst hasPaymaster =\n\t\t\tuserOp.paymasterAndData && userOp.paymasterAndData !== \"0x\" && userOp.paymasterAndData.length > 2\n\t\tconst pmHex = hasPaymaster ? userOp.paymasterAndData.slice(2) : \"\"\n\t\tconst paymaster = hasPaymaster ? (`0x${pmHex.slice(0, 40)}` as HexString) : undefined\n\t\tconst paymasterVerificationGasLimit = hasPaymaster ? BigInt(`0x${pmHex.slice(40, 72)}`) : undefined\n\t\tconst paymasterPostOpGasLimit = hasPaymaster ? BigInt(`0x${pmHex.slice(72, 104)}`) : undefined\n\t\tconst paymasterData = hasPaymaster ? (`0x${pmHex.slice(104)}` as HexString) : undefined\n\n\t\tconst userOpBundler: Record<string, unknown> = {\n\t\t\tsender: userOp.sender,\n\t\t\tnonce: toHex(userOp.nonce),\n\t\t\tcallData: userOp.callData,\n\t\t\tcallGasLimit: toHex(callGasLimit),\n\t\t\tverificationGasLimit: toHex(verificationGasLimit),\n\t\t\tpreVerificationGas: toHex(userOp.preVerificationGas),\n\t\t\tmaxFeePerGas: toHex(maxFeePerGas),\n\t\t\tmaxPriorityFeePerGas: toHex(maxPriorityFeePerGas),\n\t\t\tsignature: userOp.signature,\n\t\t}\n\n\t\tif (factory) {\n\t\t\tuserOpBundler.factory = factory\n\t\t\tuserOpBundler.factoryData = factoryData || \"0x\"\n\t\t}\n\n\t\tif (paymaster) {\n\t\t\tuserOpBundler.paymaster = paymaster\n\t\t\tuserOpBundler.paymasterData = paymasterData || \"0x\"\n\t\t\tuserOpBundler.paymasterVerificationGasLimit = toHex(paymasterVerificationGasLimit!)\n\t\t\tuserOpBundler.paymasterPostOpGasLimit = toHex(paymasterPostOpGasLimit!)\n\t\t}\n\n\t\treturn userOpBundler\n\t}\n\n\t/**\n\t * Sends a JSON-RPC request to the configured ERC-4337 bundler endpoint.\n\t *\n\t * @param method - The JSON-RPC method name (one of {@link BundlerMethod}).\n\t * @param params - Array of parameters for the RPC call.\n\t * @returns Resolves with the `result` field of the bundler's JSON-RPC response,\n\t * typed as `T`.\n\t * @throws If the bundler URL is not configured or the bundler returns an error.\n\t */\n\tasync sendBundler<T = unknown>(method: BundlerMethod, params: unknown[] = []): Promise<T> {\n\t\tif (!this.ctx.bundlerUrl) {\n\t\t\tthrow new Error(\"Bundler URL not configured\")\n\t\t}\n\n\t\tconst response = await fetch(this.ctx.bundlerUrl, {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\tbody: JSON.stringify({ jsonrpc: \"2.0\", id: 1, method, params }),\n\t\t})\n\n\t\tconst result = await response.json()\n\n\t\tif (result.error) {\n\t\t\tthrow new Error(`Bundler error: ${result.error.message || JSON.stringify(result.error)}`)\n\t\t}\n\n\t\treturn result.result\n\t}\n\n\t/**\n\t * Sends multiple JSON-RPC requests to the bundler in a single HTTP call\n\t * using JSON-RPC 2.0 batch syntax. Results are returned in the same order\n\t * as the input `requests` array.\n\t *\n\t * @throws If the bundler URL is not configured, the HTTP call fails, or any\n\t * individual response contains an error.\n\t */\n\tasync sendBundlerBatch<T extends unknown[]>(requests: { method: BundlerMethod; params: unknown[] }[]): Promise<T> {\n\t\tif (!this.ctx.bundlerUrl) {\n\t\t\tthrow new Error(\"Bundler URL not configured\")\n\t\t}\n\n\t\tconst body = requests.map((r, i) => ({\n\t\t\tjsonrpc: \"2.0\" as const,\n\t\t\tid: i + 1,\n\t\t\tmethod: r.method,\n\t\t\tparams: r.params,\n\t\t}))\n\n\t\tconst response = await fetch(this.ctx.bundlerUrl, {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\tbody: JSON.stringify(body),\n\t\t})\n\n\t\tconst results = (await response.json()) as { id: number; result?: unknown; error?: { message?: string } }[]\n\t\tresults.sort((a, b) => a.id - b.id)\n\n\t\treturn results.map((r) => {\n\t\t\tif (r.error) {\n\t\t\t\tthrow new Error(`Bundler error: ${r.error.message || JSON.stringify(r.error)}`)\n\t\t\t}\n\t\t\treturn r.result\n\t\t}) as T\n\t}\n\n\t/**\n\t * Encodes a list of calls into ERC-7821 `execute` calldata using\n\t * single-batch mode (`ERC7821_BATCH_MODE`).\n\t *\n\t * @param calls - Ordered list of calls to batch; each specifies a `target`\n\t * address, ETH `value`, and `data`.\n\t * @returns ABI-encoded calldata for the ERC-7821 `execute(bytes32,bytes)` function.\n\t */\n\tencodeERC7821Execute(calls: ERC7821Call[]): HexString {\n\t\tconst executionData = encodeAbiParameters(\n\t\t\t[{ type: \"tuple[]\", components: ERC7821ABI.ABI[1].components }],\n\t\t\t[calls.map((call) => ({ target: call.target, value: call.value, data: call.data }))],\n\t\t) as HexString\n\n\t\treturn encodeFunctionData({\n\t\t\tabi: ERC7821ABI.ABI,\n\t\t\tfunctionName: \"execute\",\n\t\t\targs: [ERC7821_BATCH_MODE, executionData],\n\t\t}) as HexString\n\t}\n\n\t/**\n\t * Decodes ERC-7821 `execute` calldata back into its constituent calls.\n\t *\n\t * Returns `null` if the calldata does not match the expected `execute`\n\t * function signature or cannot be decoded.\n\t *\n\t * @param callData - Hex-encoded calldata previously produced by\n\t * {@link encodeERC7821Execute} or an equivalent encoder.\n\t * @returns Array of decoded {@link ERC7821Call} objects, or `null` on failure.\n\t */\n\tdecodeERC7821Execute(callData: HexString): ERC7821Call[] | null {\n\t\ttry {\n\t\t\tconst decoded = decodeFunctionData({\n\t\t\t\tabi: ERC7821ABI.ABI,\n\t\t\t\tdata: callData,\n\t\t\t})\n\n\t\t\tif (decoded?.functionName !== \"execute\" || !decoded.args || decoded.args.length < 2) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\tconst executionData = decoded.args[1] as HexString\n\n\t\t\tconst [calls] = decodeAbiParameters(\n\t\t\t\t[{ type: \"tuple[]\", components: ERC7821ABI.ABI[1].components }],\n\t\t\t\texecutionData,\n\t\t\t) as [ERC7821Call[]]\n\n\t\t\treturn calls.map((call) => ({\n\t\t\t\ttarget: call.target as HexString,\n\t\t\t\tvalue: call.value,\n\t\t\t\tdata: call.data as HexString,\n\t\t\t}))\n\t\t} catch {\n\t\t\treturn null\n\t\t}\n\t}\n}\n","// Uniswap V4 position valuation, in plain bigint arithmetic.\n//\n// Lives apart from the aggregation and performs no I/O: the indexer runs inside the SubQuery VM2\n// sandbox, which has neither viem nor the Uniswap SDK, and this is the one place in the phantom\n// pipeline where a silent arithmetic slip would inflate reported depth rather than merely lose it.\n// Keeping it pure means every branch is exercisable from a table of known values.\n//\n// A position's withdrawable amount of a given token is not stored on-chain. It is derived from the\n// position's liquidity, its tick range, and the pool's current price — so a position that has moved\n// out of range holds exactly one of its two tokens, and the same liquidity is worth different\n// amounts of each token at different prices.\n\nexport type HexString = `0x${string}`\n\n/** Q96 fixed-point scale used throughout Uniswap's price math. */\nconst Q96 = 1n << 96n\n\nconst MIN_TICK = -887272\nconst MAX_TICK = 887272\n\n/** Reads a 32-byte word out of `0x`-prefixed return data as an unsigned bigint. */\nexport function word(data: string, index: number): bigint {\n\tconst hex = data.startsWith(\"0x\") ? data.slice(2) : data\n\tconst start = index * 64\n\tif (hex.length < start + 64) throw new Error(`return data too short for word ${index}`)\n\treturn BigInt(`0x${hex.slice(start, start + 64)}`)\n}\n\n/** Reinterprets the low `bits` of an unsigned word as a two's-complement signed value. */\nexport function asSigned(value: bigint, bits: number): bigint {\n\tconst width = 1n << BigInt(bits)\n\tconst masked = value & (width - 1n)\n\treturn masked >= width >> 1n ? masked - width : masked\n}\n\n/** The 20-byte address in the low bytes of a 32-byte word, lowercased. */\nexport function addressFromWord(data: string, index: number): HexString {\n\tconst hex = data.startsWith(\"0x\") ? data.slice(2) : data\n\treturn `0x${hex.slice(index * 64 + 24, (index + 1) * 64)}`.toLowerCase() as HexString\n}\n\n/**\n * `sqrt(1.0001^tick) * 2^96`, matching Uniswap's TickMath.getSqrtRatioAtTick bit for bit.\n *\n * The constants are the fixed-point square roots of 1.0001^(2^i); multiplying the ones selected by\n * the set bits of |tick| reconstructs the ratio by binary exponentiation without ever leaving\n * integer arithmetic. Reproduced rather than approximated with floating point, because the result\n * feeds an amount that must agree with what the pool would actually pay out.\n */\nexport function getSqrtRatioAtTick(tick: number): bigint {\n\tif (!Number.isInteger(tick) || tick < MIN_TICK || tick > MAX_TICK) {\n\t\tthrow new Error(`tick out of range: ${tick}`)\n\t}\n\tconst absTick = BigInt(Math.abs(tick))\n\n\tlet ratio = (absTick & 0x1n) !== 0n ? 0xfffcb933bd6fad37aa2d162d1a594001n : 0x100000000000000000000000000000000n\n\tconst factors: [bigint, bigint][] = [\n\t\t[0x2n, 0xfff97272373d413259a46990580e213an],\n\t\t[0x4n, 0xfff2e50f5f656932ef12357cf3c7fdccn],\n\t\t[0x8n, 0xffe5caca7e10e4e61c3624eaa0941cd0n],\n\t\t[0x10n, 0xffcb9843d60f6159c9db58835c926644n],\n\t\t[0x20n, 0xff973b41fa98c081472e6896dfb254c0n],\n\t\t[0x40n, 0xff2ea16466c96a3843ec78b326b52861n],\n\t\t[0x80n, 0xfe5dee046a99a2a811c461f1969c3053n],\n\t\t[0x100n, 0xfcbe86c7900a88aedcffc83b479aa3a4n],\n\t\t[0x200n, 0xf987a7253ac413176f2b074cf7815e54n],\n\t\t[0x400n, 0xf3392b0822b70005940c7a398e4b70f3n],\n\t\t[0x800n, 0xe7159475a2c29b7443b29c7fa6e889d9n],\n\t\t[0x1000n, 0xd097f3bdfd2022b8845ad8f792aa5825n],\n\t\t[0x2000n, 0xa9f746462d870fdf8a65dc1f90e061e5n],\n\t\t[0x4000n, 0x70d869a156d2a1b890bb3df62baf32f7n],\n\t\t[0x8000n, 0x31be135f97d08fd981231505542fcfa6n],\n\t\t[0x10000n, 0x9aa508b5b7a84e1c677de54f3e99bc9n],\n\t\t[0x20000n, 0x5d6af8dedb81196699c329225ee604n],\n\t\t[0x40000n, 0x2216e584f5fa1ea926041bedfe98n],\n\t\t[0x80000n, 0x48a170391f7dc42444e8fa2n],\n\t]\n\tfor (const [bit, factor] of factors) {\n\t\tif ((absTick & bit) !== 0n) ratio = (ratio * factor) >> 128n\n\t}\n\n\tif (tick > 0) ratio = (1n << 256n) / ratio\n\n\t// Round up to Q96, as TickMath does, so the ratio never understates the price.\n\treturn (ratio >> 32n) + (ratio % (1n << 32n) === 0n ? 0n : 1n)\n}\n\n/** The tick bounds packed into a PositionInfo word: `poolId(200) ‖ tickUpper(24) ‖ tickLower(24) ‖ hasSubscriber(8)`. */\nexport function positionTicks(info: bigint): { tickLower: number; tickUpper: number } {\n\treturn {\n\t\ttickLower: Number(asSigned(info >> 8n, 24)),\n\t\ttickUpper: Number(asSigned(info >> 32n, 24)),\n\t}\n}\n\n/**\n * The token0/token1 amounts `liquidity` is worth at the current price, mirroring\n * LiquidityAmounts.getAmountsForLiquidity.\n *\n * Below its range a position is entirely token0, above it entirely token1, and inside it holds\n * both — which is why a declared position's contribution to a leg depends on which side that leg\n * pays out, and why it can legitimately be zero.\n */\nexport function getAmountsForLiquidity(params: {\n\tsqrtPriceX96: bigint\n\tsqrtRatioAX96: bigint\n\tsqrtRatioBX96: bigint\n\tliquidity: bigint\n}): { amount0: bigint; amount1: bigint } {\n\tlet { sqrtRatioAX96, sqrtRatioBX96 } = params\n\tconst { sqrtPriceX96, liquidity } = params\n\tif (sqrtRatioAX96 > sqrtRatioBX96) [sqrtRatioAX96, sqrtRatioBX96] = [sqrtRatioBX96, sqrtRatioAX96]\n\n\tconst amount0For = (from: bigint, to: bigint) => (liquidity * Q96 * (to - from)) / to / from\n\tconst amount1For = (from: bigint, to: bigint) => (liquidity * (to - from)) / Q96\n\n\tif (sqrtPriceX96 <= sqrtRatioAX96) {\n\t\treturn { amount0: amount0For(sqrtRatioAX96, sqrtRatioBX96), amount1: 0n }\n\t}\n\tif (sqrtPriceX96 < sqrtRatioBX96) {\n\t\treturn {\n\t\t\tamount0: amount0For(sqrtPriceX96, sqrtRatioBX96),\n\t\t\tamount1: amount1For(sqrtRatioAX96, sqrtPriceX96),\n\t\t}\n\t}\n\treturn { amount0: 0n, amount1: amount1For(sqrtRatioAX96, sqrtRatioBX96) }\n}\n\n/** A decoded `getPoolAndPositionInfo` return: the pool's key words plus the packed position info. */\nexport interface PoolAndPositionInfo {\n\tcurrency0: HexString\n\tcurrency1: HexString\n\t/**\n\t * The ABI-encoded PoolKey exactly as returned, i.e. the first five words. A static struct's\n\t * abi.encode IS its concatenated words, so `keccak256` of this slice is the pool id — no\n\t * re-encoding, and no chance of the re-encoding disagreeing with what the chain hashed.\n\t */\n\tpoolKeyEncoded: HexString\n\ttickLower: number\n\ttickUpper: number\n}\n\n/** Decodes `getPoolAndPositionInfo(uint256)` return data (five static PoolKey words + info). */\nexport function decodePoolAndPositionInfo(data: string): PoolAndPositionInfo {\n\tconst hex = data.startsWith(\"0x\") ? data.slice(2) : data\n\tif (hex.length < 6 * 64) throw new Error(\"getPoolAndPositionInfo returned too little data\")\n\tconst { tickLower, tickUpper } = positionTicks(word(data, 5))\n\treturn {\n\t\tcurrency0: addressFromWord(data, 0),\n\t\tcurrency1: addressFromWord(data, 1),\n\t\tpoolKeyEncoded: `0x${hex.slice(0, 5 * 64)}` as HexString,\n\t\ttickLower,\n\t\ttickUpper,\n\t}\n}\n\n/**\n * How much of `outputToken` a position is currently worth. Zero when the token is not one of the\n * pool's currencies, or when the price has moved the position entirely onto the other side — both\n * ordinary outcomes, not errors.\n */\nexport function positionAmountOfToken(params: {\n\tinfo: PoolAndPositionInfo\n\tliquidity: bigint\n\tsqrtPriceX96: bigint\n\toutputToken: string\n}): bigint {\n\tconst { info, liquidity, sqrtPriceX96 } = params\n\tconst outputToken = params.outputToken.toLowerCase()\n\tif (outputToken !== info.currency0 && outputToken !== info.currency1) return 0n\n\tif (liquidity <= 0n || sqrtPriceX96 <= 0n) return 0n\n\n\tconst { amount0, amount1 } = getAmountsForLiquidity({\n\t\tsqrtPriceX96,\n\t\tsqrtRatioAX96: getSqrtRatioAtTick(info.tickLower),\n\t\tsqrtRatioBX96: getSqrtRatioAtTick(info.tickUpper),\n\t\tliquidity,\n\t})\n\treturn outputToken === info.currency0 ? amount0 : amount1\n}\n","// Phantom-order price/liquidity aggregation. Lives in the SDK so the indexer (which persists the\n// result as entities) and the simplex E2E test share one implementation. Bid decoding (extractFill)\n// and signature recovery (recoverSigner) are injectable because the indexer must do both without\n// viem — viem's @noble/hashes keccak throws \"Uint8Array expected\" in the SubQuery VM2 sandbox — so\n// it passes VM2-safe implementations; the viem-based defaults are fine for Node consumers (tests,\n// simplex).\nimport { decodeFunctionData, encodeAbiParameters, keccak256, recoverAddress } from \"viem\"\nimport { hexToU8a, isHex, stringToU8a, u8aToHex, u8aToString } from \"@polkadot/util\"\nimport { decodeERC7821ExecuteBatch } from \"@/protocols/intents/decode-utils\"\nimport { decodeUserOpScale } from \"@/chains/intentsCoprocessor\"\nimport { CryptoUtils } from \"@/protocols/intents/CryptoUtils\"\nimport type { PackedUserOperation } from \"@/types\"\nimport IntentGatewayV2 from \"@/abis/IntentGatewayV2\"\nimport {\n\tdecodePoolAndPositionInfo,\n\tpositionAmountOfToken,\n\tword,\n\ttype PoolAndPositionInfo,\n} from \"@/protocols/intents/uniswap-v4-position\"\n\nexport type HexString = `0x${string}`\n\n/**\n * ERC-4337 v0.8 EntryPoint, the contract whose userOpHash a bid's solver signature is taken over.\n * Canonical across every EVM chain we support, which is why it is a constant here rather than\n * something callers pass in (chain.ts carries the same address per chain as `EntryPointV08`).\n */\nexport const ENTRY_POINT_V08_ADDRESS = \"0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108\" as const\n\n/** Minimal fetch shape used by the JSON-RPC POSTs below. */\nexport type FetchLike = (url: string, init: any) => Promise<{ json(): Promise<any> }>\n\n// The aggregation talks to RPCs over HTTP. In browsers/Node/tests the global `fetch` is used, but\n// the SubQuery VM2 sandbox the indexer runs in does NOT expose a global `fetch` (and node-fetch\n// crashes there), so the indexer injects a sandbox-safe implementation via setAggregationFetch().\nlet injectedFetch: FetchLike | undefined\nexport function setAggregationFetch(fetchImpl: FetchLike): void {\n\tinjectedFetch = fetchImpl\n}\nfunction rpcFetch(): FetchLike {\n\tconst f = injectedFetch ?? (globalThis as { fetch?: FetchLike }).fetch\n\tif (typeof f !== \"function\") {\n\t\tthrow new Error(\"No fetch available; call setAggregationFetch() before using the aggregation helpers\")\n\t}\n\treturn f\n}\n\n/**\n * An RPC read the aggregation depends on could not be completed. Distinct from a bid being\n * rejected: a rejected bid is a fact about the bid, this is the absence of a fact. The two must\n * never be conflated — treating an unreachable node as \"not delegated\" or as \"holds nothing\"\n * silently drops a real solver from the snapshot, which then publishes a price and a depth\n * computed from whoever happened to answer.\n */\nexport class PhantomRpcError extends Error {\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly cause?: unknown,\n\t) {\n\t\tsuper(message)\n\t\tthis.name = \"PhantomRpcError\"\n\t}\n}\n\n// POSTs a JSON-RPC payload and returns the parsed response, retrying with a short backoff. The node\n// intermittently returns an empty body under concurrent load (a 200 with no payload), which makes\n// response.json() throw; without a retry a single blip would silently drop a bid's quote or a whole\n// window (fetchBids throws). Throws PhantomRpcError if every attempt fails.\nasync function rpcCall(url: string, payload: object): Promise<any> {\n\tlet lastErr: unknown\n\tfor (let attempt = 0; attempt < 4; attempt++) {\n\t\tif (attempt > 0) await new Promise((resolve) => setTimeout(resolve, 150 * attempt))\n\t\tlet timer: ReturnType<typeof setTimeout> | undefined\n\t\ttry {\n\t\t\t// Bound each attempt: the injected fetch (Node http) has no socket timeout, so a stalled\n\t\t\t// connection would otherwise hang forever and block the whole handler. Race it against a\n\t\t\t// deadline; on timeout we reject, retry, and ultimately throw so callers degrade instead.\n\t\t\tconst timeout = new Promise<never>((_, reject) => {\n\t\t\t\ttimer = setTimeout(() => reject(new Error(`rpc timeout: ${url}`)), 12_000)\n\t\t\t})\n\t\t\tconst response = await Promise.race([\n\t\t\t\trpcFetch()(url, {\n\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\theaders: { accept: \"application/json\", \"content-type\": \"application/json\" },\n\t\t\t\t\tbody: JSON.stringify(payload),\n\t\t\t\t}),\n\t\t\t\ttimeout,\n\t\t\t])\n\t\t\tconst body = await response.json()\n\t\t\t// A JSON-RPC error body is a failed read, not an answer. Rate limiting arrives this way,\n\t\t\t// so letting it through as `undefined` is what turns throttling into fabricated data.\n\t\t\tif (body?.error) {\n\t\t\t\tlastErr = new Error(`rpc error: ${JSON.stringify(body.error).slice(0, 200)}`)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn body\n\t\t} catch (err) {\n\t\t\tlastErr = err\n\t\t} finally {\n\t\t\tif (timer) clearTimeout(timer)\n\t\t}\n\t}\n\tthrow new PhantomRpcError(`RPC call failed after 4 attempts: ${url}`, lastErr)\n}\n\nexport const FILL_ORDER_ABI = IntentGatewayV2.ABI\n\n// ─── phantom bid declaration ────────────────────────────────────────────────────────────────────\n//\n// A same-chain phantom bid proves a solver operates on a chain, but not two things the snapshot\n// needs: which chains it will accept payment FROM when filling a cross-chain order, and which\n// Uniswap V4 positions stand behind its quote. Bids declare both inside paymasterAndData, which\n// the userOpHash covers, so the declaration is authenticated by the solver's existing bid\n// signature (the `signature` field is excluded from the hash and therefore unusable). The overload\n// applies to phantom bids only: a real fill's paymasterAndData keeps its functional EntryPoint\n// semantics, and nothing on the real-fill path ever parses this format.\n//\n// Layouts, by leading version byte:\n//\n// v1 0x01 ‖ chainCount(1) ‖ chainCount × ( len(1) ‖ utf8 state machine id )\n// v2 0x01-body ‖ posCount(1) ‖ posCount × ( len(1) ‖ big-endian tokenId ) with 0x02 leading\n//\n// v2 is v1 with a positions section appended, so decoding is one parser with an optional tail.\n// The encoder emits v1 whenever there are no positions, which keeps existing solvers' bids\n// byte-identical to what they produce today; a v1 blob decodes under v2 readers as \"no positions\".\n// A v2 blob read by a pre-v2 decoder fails its version check and reads as no declaration at all —\n// the same degradation as an absent blob, never a misparse, because both versions reject trailing\n// bytes rather than half-reading.\n//\n// Declared positions are implicitly on the order's own chain: a phantom bid is submitted per\n// chain, so the tokenIds a solver names in it are the ones it holds on that chain. The declaration\n// is a POINTER, not a claim of size — the indexer reads each position's liquidity on-chain and\n// checks the position is owned by the very solver that signed the bid, so a solver can point at\n// its own positions but cannot inflate them, nor borrow someone else's.\n\nconst DECLARATION_V1 = 0x01\nconst DECLARATION_V2 = 0x02\n\n/** Upper bound on declared chains and positions alike; one byte of count each. */\nconst MAX_DECLARED_ENTRIES = 255\n\n/** Widest tokenId the codec will carry — a uint256, as minted by the V4 PositionManager. */\nconst MAX_TOKEN_ID_BYTES = 32\n\n/** What a phantom bid's paymasterAndData declares about the solver behind it. */\nexport interface PhantomBidDeclaration {\n\t/**\n\t * Source chains the solver accepts payment from. Null when the bid carries no parseable\n\t * declaration (the legacy default: the solver has not restricted its sources); an empty array\n\t * is an explicit accepts-nothing. Callers must preserve that distinction.\n\t */\n\tacceptedSources: string[] | null\n\t/**\n\t * Uniswap V4 position tokenIds the solver declares as backing this bid, on the order's own\n\t * chain. Empty when none are declared — including for every v1 bid, which predates the field.\n\t */\n\tuniswapV4Positions: bigint[]\n}\n\n/** Minimal big-endian bytes of a non-negative tokenId; `[0]` for zero. */\nfunction tokenIdToBytes(tokenId: bigint): number[] {\n\tif (tokenId < 0n) throw new Error(`Uniswap V4 tokenId cannot be negative: ${tokenId}`)\n\tconst bytes: number[] = []\n\tlet rest = tokenId\n\twhile (rest > 0n) {\n\t\tbytes.unshift(Number(rest & 0xffn))\n\t\trest >>= 8n\n\t}\n\treturn bytes.length > 0 ? bytes : [0]\n}\n\n/**\n * Encodes a phantom bid's declaration into the paymasterAndData blob. Emits the v1 layout when no\n * positions are declared, so a solver that only names source chains produces exactly the bytes it\n * produced before positions existed.\n */\nexport function encodePhantomBidDeclaration(declaration: {\n\tacceptedSourceChains?: string[]\n\tuniswapV4Positions?: bigint[]\n}): HexString {\n\tconst chains = declaration.acceptedSourceChains ?? []\n\tconst positions = declaration.uniswapV4Positions ?? []\n\tif (chains.length > MAX_DECLARED_ENTRIES) {\n\t\tthrow new Error(`Cannot declare more than ${MAX_DECLARED_ENTRIES} source chains`)\n\t}\n\tif (positions.length > MAX_DECLARED_ENTRIES) {\n\t\tthrow new Error(`Cannot declare more than ${MAX_DECLARED_ENTRIES} Uniswap V4 positions`)\n\t}\n\n\tconst version = positions.length > 0 ? DECLARATION_V2 : DECLARATION_V1\n\tconst bytes: number[] = [version, chains.length]\n\tfor (const chain of chains) {\n\t\tconst encoded = stringToU8a(chain)\n\t\tif (encoded.length === 0 || encoded.length > 255) {\n\t\t\tthrow new Error(`Invalid state machine id in source chain declaration: ${chain}`)\n\t\t}\n\t\tbytes.push(encoded.length, ...encoded)\n\t}\n\n\tif (version === DECLARATION_V2) {\n\t\tbytes.push(positions.length)\n\t\tfor (const tokenId of positions) {\n\t\t\tconst encoded = tokenIdToBytes(tokenId)\n\t\t\tif (encoded.length > MAX_TOKEN_ID_BYTES) {\n\t\t\t\tthrow new Error(`Uniswap V4 tokenId exceeds uint256: ${tokenId}`)\n\t\t\t}\n\t\t\tbytes.push(encoded.length, ...encoded)\n\t\t}\n\t}\n\n\treturn u8aToHex(new Uint8Array(bytes)) as HexString\n}\n\n/**\n * Decodes a phantom bid's paymasterAndData. Understands both layout versions, so bids placed\n * before positions existed keep decoding unchanged. Anything absent, unversioned or malformed\n * yields a null `acceptedSources` with no positions — never a partial read.\n */\nexport function decodePhantomBidDeclaration(paymasterAndData: string | undefined | null): PhantomBidDeclaration {\n\tconst absent: PhantomBidDeclaration = { acceptedSources: null, uniswapV4Positions: [] }\n\tif (!paymasterAndData || !isHex(paymasterAndData)) return absent\n\tconst bytes = hexToU8a(paymasterAndData)\n\tif (bytes.length < 2) return absent\n\n\tconst version = bytes[0]\n\tif (version !== DECLARATION_V1 && version !== DECLARATION_V2) return absent\n\n\tconst chains: string[] = []\n\tlet offset = 2\n\tfor (let entry = 0; entry < bytes[1]; entry++) {\n\t\tif (offset >= bytes.length) return absent\n\t\tconst length = bytes[offset]\n\t\toffset += 1\n\t\tif (length === 0 || offset + length > bytes.length) return absent\n\t\tchains.push(u8aToString(bytes.subarray(offset, offset + length)))\n\t\toffset += length\n\t}\n\n\tconst positions: bigint[] = []\n\tif (version === DECLARATION_V2) {\n\t\tif (offset >= bytes.length) return absent\n\t\tconst count = bytes[offset]\n\t\toffset += 1\n\t\tfor (let entry = 0; entry < count; entry++) {\n\t\t\tif (offset >= bytes.length) return absent\n\t\t\tconst length = bytes[offset]\n\t\t\toffset += 1\n\t\t\tif (length === 0 || length > MAX_TOKEN_ID_BYTES || offset + length > bytes.length) return absent\n\t\t\tlet tokenId = 0n\n\t\t\tfor (const byte of bytes.subarray(offset, offset + length)) tokenId = (tokenId << 8n) | BigInt(byte)\n\t\t\tpositions.push(tokenId)\n\t\t\toffset += length\n\t\t}\n\t}\n\n\t// Trailing bytes mean this is not a declaration but something that happens to share the\n\t// version byte, so treat the whole blob as unparseable rather than half-reading it.\n\tif (offset !== bytes.length) return absent\n\n\treturn { acceptedSources: chains, uniswapV4Positions: positions }\n}\n\n/** Back-compat wrapper: the source-chain half of {@link encodePhantomBidDeclaration}. */\nexport function encodeAcceptedSourceChains(chains: string[]): HexString {\n\treturn encodePhantomBidDeclaration({ acceptedSourceChains: chains })\n}\n\n/** Back-compat wrapper: the source-chain half of {@link decodePhantomBidDeclaration}. */\nexport function decodeAcceptedSourceChains(paymasterAndData: string | undefined | null): string[] | null {\n\treturn decodePhantomBidDeclaration(paymasterAndData).acceptedSources\n}\n\n/** ERC-4626 vaults per chain, keyed by chain id then lowercase underlying token address. */\nexport type YieldVaultMap = Record<string, Record<string, string[]>>\n\n/** One leg of a fill: the token the solver pays out and the amount it quoted for that leg. */\nexport interface FillLeg {\n\toutputToken: HexString\n\tsolverAmount: bigint\n}\n\nexport interface FillData {\n\torder: Record<string, unknown>\n\toptions: Record<string, unknown>\n\t/** Positional, matching the order's asset lists. A zero amount means the solver did not quote that leg. */\n\tlegs: FillLeg[]\n}\n\n/**\n * Zips an order's output assets with the bid's quoted amounts into positional legs. A missing or\n * null amount is the \"solver declined this leg\" sentinel and becomes a zero quote. Shared by the\n * viem extractor below and the indexer's VM2-safe one, so the declined-leg convention has a\n * single home while only the ABI decode differs per environment.\n */\nexport function zipFillLegs(assets: { token: HexString }[], outputs: { amount: unknown }[]): FillLeg[] {\n\treturn assets.map((asset, index) => {\n\t\tconst rawAmount = outputs[index]?.amount\n\t\treturn {\n\t\t\toutputToken: asset.token,\n\t\t\tsolverAmount: rawAmount === undefined || rawAmount === null ? 0n : BigInt(rawAmount.toString()),\n\t\t}\n\t})\n}\n\nexport interface RpcBidInfo {\n\tcommitment: string\n\tfiller: string\n\tuser_op: string\n}\n\n/** One solver's measured liquidity for a configured token on one chain at this snapshot. */\nexport interface LpBalance {\n\tsolver: string\n\t/** State machine id of the chain the balance was measured on (e.g. EVM-8453). */\n\tchain: string\n\ttokenAddress: HexString\n\t/**\n\t * Wallet ERC-20, redeemable ERC-4626 vault shares, and the withdrawable amount held in the\n\t * solver's declared Uniswap V4 positions — the same total the leg weights are built from, so a\n\t * provider's reported inventory and the depth attributed to it cannot disagree.\n\t *\n\t * The V4 share is only ever included on the chain whose bid declared the positions: a bid is\n\t * per chain, so no other chain's sweep can know about them. Consumers must therefore treat the\n\t * larger of two readings for the same (chain, token, block) as the complete one.\n\t */\n\tbalance: bigint\n}\n\n/** One verified solver behind a leg's quote, holding inventory to deliver it. */\nexport interface PhantomLegBidder {\n\tsolver: HexString\n\t/**\n\t * The solver's output-token inventory on the destination chain — its weight in the median.\n\t * Always greater than zero: a solver quoting a leg it holds none of is dropped, not recorded\n\t * at zero, since it can deliver nothing at any price.\n\t */\n\tweight: bigint\n\t/**\n\t * Source chains the solver's signed paymasterAndData declaration accepts payment from. Null\n\t * when the bid carries no declaration (legacy default: all CCTP/USDT0-covered chains); an\n\t * empty array is an explicit accepts-nothing declaration.\n\t */\n\tacceptedSources: string[] | null\n}\n\n/** The aggregated price for one leg of a phantom order. */\nexport interface PhantomLegAggregation {\n\t/** Position of the leg in the order's asset lists. */\n\tlegIndex: number\n\toutputToken: HexString\n\tlowestPrice: bigint\n\thighestPrice: bigint\n\tmedianPrice: bigint\n\t/** Backed quotes behind the price. Quotes from solvers holding no inventory are not counted. */\n\tbidCount: number\n\t/** The verified, inventory-backed solvers quoting this leg; bidCount === bidders.length. */\n\tbidders: PhantomLegBidder[]\n}\n\n/** The aggregated result for a single phantom order's bid window. */\nexport interface PhantomAggregation {\n\t/**\n\t * One entry per leg that at least one solver quoted AND at least one of those quotes is backed\n\t * by output-token inventory on the destination chain. Legs nobody quoted are absent, and so are\n\t * legs every bidder quoted on zero inventory — neither is a price anyone could trade against.\n\t */\n\tlegs: PhantomLegAggregation[]\n\tlpBalances: LpBalance[]\n}\n\nexport interface AggregationLogger {\n\twarn: (payload: unknown, message: string) => void\n}\n\n// Liquidity-weighted median of solver quotes. Each quote's influence is proportional to `weight` —\n// the solver's total balance for the output token across native + vault venues — so a solver that\n// can actually deliver size moves the price more than one quoting on thin liquidity. Returns the\n// lower weighted median: the smallest price whose cumulative weight reaches half of the total.\n// Zero-weight quotes contribute nothing.\n//\n// Callers must not hand this an entry set whose weights are all zero: with nothing to weight by it\n// can only pick a quote by position, and for an even-sized set that position is the upper of the\n// two middles — so \"the median\" becomes \"whoever quoted higher\", settable by a solver holding no\n// inventory at all. aggregatePhantomBids drops such legs instead of pricing them. The fallback\n// below stays only so an unguarded caller gets a number rather than a crash; treat reaching it as\n// a caller bug.\nexport function weightedMedian(entries: { price: bigint; weight: bigint }[]): bigint {\n\tconst sorted = [...entries].sort((a, b) => (a.price < b.price ? -1 : a.price > b.price ? 1 : 0))\n\tconst totalWeight = sorted.reduce((acc, e) => (e.weight > 0n ? acc + e.weight : acc), 0n)\n\n\tif (totalWeight === 0n) {\n\t\treturn sorted[Math.floor(sorted.length / 2)].price\n\t}\n\n\tlet cumulative = 0n\n\tfor (const entry of sorted) {\n\t\tif (entry.weight <= 0n) continue\n\t\tcumulative += entry.weight\n\t\tif (cumulative * 2n >= totalWeight) return entry.price\n\t}\n\treturn sorted[sorted.length - 1].price\n}\n\n// Pulls the inner fillOrder call out of the bid's ERC-7821 execute batch and decodes the order, the\n// offered output token, and the solver's quoted amount. Returns null when no matching call targets\n// the gateway or the calldata cannot be decoded.\nexport function extractFillData(callData: HexString, gatewayAddress: string): FillData | null {\n\tconst calls = decodeERC7821ExecuteBatch(callData)\n\tif (!calls) return null\n\n\tconst normalized = gatewayAddress.toLowerCase()\n\tfor (const call of calls) {\n\t\tif (call.target.toLowerCase() !== normalized) continue\n\t\ttry {\n\t\t\tconst decoded = decodeFunctionData({ abi: FILL_ORDER_ABI, data: call.data as HexString })\n\t\t\tif (decoded.functionName !== \"fillOrder\" || !decoded.args || decoded.args.length < 2) continue\n\t\t\tconst order = decoded.args[0] as Record<string, unknown>\n\t\t\tconst options = decoded.args[1] as Record<string, unknown>\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\tconst assets = (order as any)?.output?.assets as { token: HexString }[] | undefined\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\tconst outputs = (options as any)?.outputs as { amount: bigint }[] | undefined\n\t\t\tif (!assets?.length || !outputs?.length) continue\n\t\t\treturn { order, options, legs: zipFillLegs(assets, outputs) }\n\t\t} catch {\n\t\t\tcontinue\n\t\t}\n\t}\n\treturn null\n}\n\n/** Derives the 192-bit bid nonce key binding a bid to an (order, sessionKey) pair. */\nexport type BidNonceKeyFn = (commitment: HexString, sessionKey: HexString) => bigint\n\n/** Recomputes an order's commitment from the contract-shaped order decoded out of a bid's calldata. */\nexport type OrderCommitmentFn = (order: Record<string, unknown>) => HexString | null\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst FILL_ORDER_INPUT = (FILL_ORDER_ABI as readonly any[]).find(\n\t(item) => item?.type === \"function\" && item?.name === \"fillOrder\",\n)?.inputs?.[0]\n\n/**\n * Default (viem) {@link OrderCommitmentFn}. The order comes straight out of `fillOrder`'s ABI\n * decode, so it is already contract-shaped and re-encoding it reproduces `keccak256(abi.encode(order))`\n * — the same commitment IntentGatewayV2 computes on-chain. Returns null when it cannot be computed,\n * which callers treat as unverifiable (fail closed).\n */\nexport function orderCommitmentFromDecoded(order: Record<string, unknown>): HexString | null {\n\ttry {\n\t\tif (!FILL_ORDER_INPUT) return null\n\t\treturn keccak256(encodeAbiParameters([FILL_ORDER_INPUT], [order as never]))\n\t} catch {\n\t\treturn null\n\t}\n}\n\n// A bid's userOp.signature is `commitment (32) ‖ solverSignature (65)`. SolverAccount.validateUserOp\n// expects 162 bytes on-chain, but the trailing 65-byte session-key signature is only appended at fill\n// time, so a bid is stored and read back in this 97-byte form.\nconst BID_COMMITMENT_BYTES = 32\nconst SOLVER_SIGNATURE_BYTES = 65\n\nexport interface BidSignature {\n\t/** The order commitment the solver signature is bound to. */\n\tcommitment: HexString\n\t/** The solver's 65-byte ECDSA signature over the userOpHash. */\n\tsolverSignature: HexString\n}\n\n/** Splits a bid userOp's signature into its commitment and solver signature; null if malformed. */\nexport function splitBidSignature(signature: HexString): BidSignature | null {\n\tconst raw = signature.replace(/^0x/, \"\")\n\tconst commitmentChars = BID_COMMITMENT_BYTES * 2\n\tconst end = commitmentChars + SOLVER_SIGNATURE_BYTES * 2\n\tif (raw.length < end) return null\n\n\treturn {\n\t\tcommitment: `0x${raw.slice(0, commitmentChars)}` as HexString,\n\t\tsolverSignature: `0x${raw.slice(commitmentChars, end)}` as HexString,\n\t}\n}\n\n/** Recovers the address that produced a bid's solver signature, or null if it cannot be recovered. */\nexport type RecoverBidSigner = (\n\tuserOp: PackedUserOperation,\n\tentryPoint: HexString,\n\tchainId: bigint,\n\tsolverSignature: HexString,\n) => Promise<HexString | null>\n\n/**\n * Default {@link RecoverBidSigner}: recovers over the EntryPoint v0.8 userOpHash, the digest\n * SolverAccount itself validates against. viem-based, so Node consumers get it for free while the\n * indexer injects an ethers equivalent (see the note at the top of this file).\n */\nexport const recoverBidSignerViem: RecoverBidSigner = async (userOp, entryPoint, chainId, solverSignature) => {\n\ttry {\n\t\tconst userOpHash = CryptoUtils.computeUserOpHash(userOp, entryPoint, chainId)\n\t\treturn (await recoverAddress({ hash: userOpHash, signature: solverSignature })) as HexString\n\t} catch {\n\t\treturn null\n\t}\n}\n\n// An EOA that has delegated with EIP-7702 has code `0xef0100 ‖ delegate`.\nconst DELEGATION_INDICATOR_PREFIX = \"0xef0100\"\n\n/** Whether `account` is an EOA EIP-7702-delegated to `solverAccount` on the given chain. */\nasync function isDelegatedToSolverAccount(evmRpcUrl: string, account: string, solverAccount: string): Promise<boolean> {\n\tconst response = await rpcCall(evmRpcUrl, {\n\t\tid: 1,\n\t\tjsonrpc: \"2.0\",\n\t\tmethod: \"eth_getCode\",\n\t\tparams: [account, \"latest\"],\n\t})\n\t// Anything that is not a code string means the node did not answer the question. Reading that\n\t// as \"no delegation\" is how a throttled endpoint silently unseats a real solver: the bid is\n\t// dropped, the legs only it quoted vanish, and the pool reports zero depth it actually has.\n\tif (typeof response.result !== \"string\") {\n\t\tthrow new PhantomRpcError(`eth_getCode returned no code for ${account} on ${evmRpcUrl}`)\n\t}\n\n\tconst code = response.result.toLowerCase()\n\tif (!code.startsWith(DELEGATION_INDICATOR_PREFIX)) return false\n\n\treturn `0x${code.slice(DELEGATION_INDICATOR_PREFIX.length)}` === solverAccount.toLowerCase()\n}\n\n/** Promise-caching delegation reader produced by {@link memoizedDelegationCheck}. */\ntype DelegationReader = (evmRpcUrl: string, account: string, solverAccount: string) => Promise<boolean>\n\n/**\n * Caches the delegation check for the life of one aggregation, retries included.\n *\n * Two reads are otherwise repeated for nothing. A solver running several fillers has its bid\n * copied under each, and the dedupe that collapses them runs only AFTER verification, so every\n * copy re-interrogated the chain for the same answer. And a retry re-verifies every solver, even\n * when the run was abandoned over an unrelated read — so the endpoint most likely to be throttled\n * got up to five times the load from the very code meant to survive it.\n *\n * Rejections are evicted, so a retry re-reads rather than replaying a failure as a verdict. A\n * negative result is cached: an EOA cannot gain a delegation part-way through one bid window, and\n * \"not our solver\" is an answer, unlike an unreachable node.\n */\nfunction memoizedDelegationCheck(): DelegationReader {\n\tconst cache = new Map<string, Promise<boolean>>()\n\treturn (evmRpcUrl: string, account: string, solverAccount: string): Promise<boolean> => {\n\t\tconst key = `${evmRpcUrl}|${account.toLowerCase()}|${solverAccount.toLowerCase()}`\n\t\tlet pending = cache.get(key)\n\t\tif (!pending) {\n\t\t\tpending = isDelegatedToSolverAccount(evmRpcUrl, account, solverAccount).catch((err) => {\n\t\t\t\tcache.delete(key)\n\t\t\t\tthrow err\n\t\t\t})\n\t\t\tcache.set(key, pending)\n\t\t}\n\t\treturn pending\n\t}\n}\n\n/** Chain id out of an EVM state machine id (\"EVM-8453\" -> 8453n); null for any other format. */\nfunction evmChainId(chain: string): bigint | null {\n\tconst [prefix, id] = chain.split(\"-\")\n\tif (prefix !== \"EVM\" || !id || !/^\\d+$/.test(id)) return null\n\treturn BigInt(id)\n}\n\n/**\n * Whether a bid genuinely came from one of our solvers, and so may influence the snapshot.\n *\n * Anyone can submit a bid to the coprocessor, and every accepted quote moves the weighted median the\n * rest of the protocol prices intents against, so a bid is only counted if it clears both of the\n * checks SolverAccount would apply on-chain: the userOp carries a solver signature over this order's\n * userOpHash that recovers to the sender, and the sender is EIP-7702-delegated to the chain's\n * SolverAccount. Fails closed — a bid that cannot be read or verified is not counted.\n */\nasync function isVerifiedSolverBid(params: {\n\tuserOp: PackedUserOperation\n\tcommitment: string\n\tsessionKey: HexString\n\tchainId: bigint\n\tsolverAccount: string\n\tevmRpcUrl: string\n\trecoverSigner: RecoverBidSigner\n\tbidNonceKey: BidNonceKeyFn\n\t/** Cached per aggregation, so duplicate fillers and retries do not re-read the same answer. */\n\tisDelegated: DelegationReader\n\tlogger?: AggregationLogger\n}): Promise<boolean> {\n\tconst {\n\t\tuserOp,\n\t\tcommitment,\n\t\tsessionKey,\n\t\tchainId,\n\t\tsolverAccount,\n\t\tevmRpcUrl,\n\t\trecoverSigner,\n\t\tbidNonceKey,\n\t\tisDelegated,\n\t\tlogger,\n\t} = params\n\tconst solver = userOp.sender\n\n\tconst parsed = splitBidSignature(userOp.signature)\n\tif (!parsed) {\n\t\tlogger?.warn({ solver, commitment }, \"Rejecting phantom bid: malformed userOp signature\")\n\t\treturn false\n\t}\n\n\t// Cheap early-out ONLY. The prefix sits inside userOp.signature, which userOpHash excludes, so it\n\t// is attacker-mutable and must never be what binds a bid to an order — the nonce key below is.\n\tif (parsed.commitment.toLowerCase() !== commitment.toLowerCase()) {\n\t\tlogger?.warn(\n\t\t\t{ solver, commitment, signedFor: parsed.commitment },\n\t\t\t\"Rejecting phantom bid: signed for another order\",\n\t\t)\n\t\treturn false\n\t}\n\n\t// The authoritative binding, mirroring SolverAccount.validateUserOp on-chain. The nonce IS\n\t// covered by userOpHash, so a solver signature stays valid only for the (order, sessionKey) pair\n\t// its nonce key was derived from. `sessionKey` is read from the bid's own calldata, which is also\n\t// covered by userOpHash — so every operand here is signed, leaving nothing for a replay to swap.\n\tif (BigInt(userOp.nonce) >> 64n !== bidNonceKey(commitment as HexString, sessionKey)) {\n\t\tlogger?.warn({ solver, commitment }, \"Rejecting phantom bid: nonce does not bind order and session key\")\n\t\treturn false\n\t}\n\n\t// SolverAccount._rawSignatureValidation recovers over the bare userOpHash and requires the signer\n\t// to be the account itself, which under EIP-7702 is the sender EOA.\n\tconst signer = await recoverSigner(userOp, ENTRY_POINT_V08_ADDRESS, chainId, parsed.solverSignature)\n\tif (!signer || signer.toLowerCase() !== solver.toLowerCase()) {\n\t\tlogger?.warn({ solver, commitment, signer }, \"Rejecting phantom bid: signature does not recover to the sender\")\n\t\treturn false\n\t}\n\n\tif (!(await isDelegated(evmRpcUrl, solver, solverAccount))) {\n\t\tlogger?.warn({ solver, commitment, solverAccount }, \"Rejecting phantom bid: sender is not a delegated solver\")\n\t\treturn false\n\t}\n\n\treturn true\n}\n\nexport async function fetchBidsForOrder(nodeUrl: string, commitment: string): Promise<RpcBidInfo[]> {\n\tconst data = await rpcCall(nodeUrl, {\n\t\tid: 1,\n\t\tjsonrpc: \"2.0\",\n\t\tmethod: \"intents_getBidsForOrder\",\n\t\tparams: [commitment],\n\t})\n\treturn Array.isArray(data.result) ? (data.result as RpcBidInfo[]) : []\n}\n\n// A balance read that fails is NOT a balance of zero. Zero weight now removes a leg from the\n// snapshot entirely, so swallowing the failure would delete real liquidity on an RPC blip and\n// leave a pool reporting depth it has. Only \"0x\" — the call reverted or there is no code at the\n// address, i.e. the node did answer — is a genuine zero; everything else propagates.\nasync function ethCallUint(evmRpcUrl: string, to: string, data: string): Promise<bigint> {\n\tconst result = await rpcCall(evmRpcUrl, {\n\t\tid: 1,\n\t\tjsonrpc: \"2.0\",\n\t\tmethod: \"eth_call\",\n\t\tparams: [{ to, data }, \"latest\"],\n\t})\n\tif (result.result === \"0x\") return 0n\n\tif (typeof result.result !== \"string\") {\n\t\tthrow new PhantomRpcError(`eth_call returned no result for ${to} on ${evmRpcUrl}`)\n\t}\n\treturn BigInt(result.result)\n}\n\n// Sums the solver's redeemable balance of a single token on its destination chain: the raw ERC-20\n// balance plus any ERC-4626 vault positions wrapping it.\nasync function getTotalSolverBalance(\n\tevmRpcUrl: string,\n\tchain: string,\n\ttoken: string,\n\tsolver: string,\n\tyieldVaults: YieldVaultMap,\n): Promise<bigint> {\n\tconst padded = solver.replace(\"0x\", \"\").padStart(64, \"0\")\n\tconst raw = await ethCallUint(evmRpcUrl, token, `0x70a08231${padded}`) // balanceOf(address)\n\tconst vaults = yieldVaults[chain]?.[token.toLowerCase()] ?? []\n\tconst vaultBalances = await Promise.all(\n\t\tvaults.map((v) => ethCallUint(evmRpcUrl, v, `0xce96cb77${padded}`)), // maxWithdraw(address)\n\t)\n\treturn vaultBalances.reduce((acc, b) => acc + b, raw)\n}\n\n/** PositionManager + StateView addresses for a chain's Uniswap V4 deployment. */\nexport interface UniswapV4Contracts {\n\tpositionManager: string\n\tstateView: string\n}\n\n/** Everything a declared position's contribution depends on, read once and reused across legs. */\ninterface V4PositionState {\n\t/** Current on-chain owner. Compared against the bid's signer, never trusted from the bid. */\n\towner: string\n\tinfo: PoolAndPositionInfo\n\tliquidity: bigint\n\tsqrtPriceX96: bigint\n}\n\nconst SELECTOR_OWNER_OF = \"0x6352211e\"\nconst SELECTOR_POSITION_LIQUIDITY = \"0x1efeed33\"\nconst SELECTOR_POOL_AND_POSITION_INFO = \"0x7ba03aad\"\nconst SELECTOR_GET_SLOT0 = \"0xc815641c\"\n\nconst uint256Arg = (value: bigint) => value.toString(16).padStart(64, \"0\")\n\n/**\n * Reads a declared position: who owns it, how much liquidity it holds, and the price its pool is\n * currently at. Null when the position does not exist — a solver may name a burned tokenId, which\n * is not an RPC failure and must not sink the run.\n */\nasync function readV4Position(\n\tevmRpcUrl: string,\n\tcontracts: UniswapV4Contracts,\n\ttokenId: bigint,\n\tkeccak: (hex: HexString) => HexString,\n\tlogger?: AggregationLogger,\n): Promise<V4PositionState | null> {\n\tconst call = async (to: string, data: string): Promise<string | null> => {\n\t\tconst result = await rpcCall(evmRpcUrl, {\n\t\t\tid: 1,\n\t\t\tjsonrpc: \"2.0\",\n\t\t\tmethod: \"eth_call\",\n\t\t\tparams: [{ to, data }, \"latest\"],\n\t\t})\n\t\tif (result.result === \"0x\") return null\n\t\tif (typeof result.result !== \"string\") {\n\t\t\tthrow new PhantomRpcError(`eth_call returned no result for ${to} on ${evmRpcUrl}`)\n\t\t}\n\t\treturn result.result\n\t}\n\n\tconst arg = uint256Arg(tokenId)\n\tconst [ownerData, infoData, liquidityData] = await Promise.all([\n\t\tcall(contracts.positionManager, `${SELECTOR_OWNER_OF}${arg}`),\n\t\tcall(contracts.positionManager, `${SELECTOR_POOL_AND_POSITION_INFO}${arg}`),\n\t\tcall(contracts.positionManager, `${SELECTOR_POSITION_LIQUIDITY}${arg}`),\n\t])\n\t// An empty ownerOf is a tokenId that was never minted or has been burned — a solver may name a\n\t// stale position, which is its problem and not ours.\n\tif (!ownerData) return null\n\tif (!infoData || !liquidityData) {\n\t\tlogger?.warn(\n\t\t\t{ tokenId: tokenId.toString(), positionManager: contracts.positionManager },\n\t\t\t\"Uniswap V4 position exists but its pool info or liquidity did not read back — check the configured PositionManager\",\n\t\t)\n\t\treturn null\n\t}\n\n\tconst info = decodePoolAndPositionInfo(infoData)\n\t// The pool id is keccak of the PoolKey exactly as the chain returned it, so no re-encoding of\n\t// ours can disagree with the hash the pool was registered under.\n\tconst slot0Data = await call(contracts.stateView, `${SELECTOR_GET_SLOT0}${keccak(info.poolKeyEncoded).slice(2)}`)\n\t// The position resolved, so its pool exists — an empty slot0 means the call went somewhere that\n\t// is not a StateView, i.e. a misconfigured address. Silence here is what let a wrong address\n\t// zero out every declared position indefinitely instead of failing where someone would see it.\n\tif (!slot0Data) {\n\t\tlogger?.warn(\n\t\t\t{ tokenId: tokenId.toString(), stateView: contracts.stateView, evmRpcUrl },\n\t\t\t\"Uniswap V4 slot0 read returned nothing for a live position — the configured StateView address is wrong\",\n\t\t)\n\t\treturn null\n\t}\n\n\treturn {\n\t\towner: `0x${ownerData.slice(-40)}`.toLowerCase(),\n\t\tinfo,\n\t\tliquidity: word(liquidityData, 0),\n\t\tsqrtPriceX96: word(slot0Data, 0),\n\t}\n}\n\n/** Promise-caching position reader: one set of reads per position, reused across every leg. */\nfunction memoizedV4Position(keccak: (hex: HexString) => HexString, logger?: AggregationLogger) {\n\tconst cache = new Map<string, Promise<V4PositionState | null>>()\n\treturn (evmRpcUrl: string, chain: string, contracts: UniswapV4Contracts, tokenId: bigint) => {\n\t\tconst key = `${chain}|${tokenId}`\n\t\tlet pending = cache.get(key)\n\t\tif (!pending) {\n\t\t\tpending = readV4Position(evmRpcUrl, contracts, tokenId, keccak, logger).catch((err) => {\n\t\t\t\tcache.delete(key)\n\t\t\t\tthrow err\n\t\t\t})\n\t\t\tcache.set(key, pending)\n\t\t}\n\t\treturn pending\n\t}\n}\n\n/** Promise-caching balance reader produced by [`memoizedSolverBalance`]. */\nexport type SolverBalanceReader = (evmRpcUrl: string, chain: string, token: string, solver: string) => Promise<bigint>\n\n// One aggregation run reads the same (chain, token, solver) balance from several places — once\n// per leg the solver quoted in that token, and again in the liquidity sweep — and a bundled order\n// can carry up to 128 legs. Memoizing for the life of the run collapses that to one RPC round\n// trip per distinct triple, at the cost of ignoring balance changes within the run (the snapshot\n// is a point-in-time read either way). Exported so a caller aggregating several orders whose bid\n// windows close on the same block (one bundled order per configured chain) can share one memo\n// across the runs instead of re-reading identical balances per order.\nexport function memoizedSolverBalance(yieldVaults: YieldVaultMap): SolverBalanceReader {\n\tconst cache = new Map<string, Promise<bigint>>()\n\treturn (evmRpcUrl: string, chain: string, token: string, solver: string): Promise<bigint> => {\n\t\tconst key = `${chain}|${token.toLowerCase()}|${solver.toLowerCase()}`\n\t\tlet pending = cache.get(key)\n\t\tif (!pending) {\n\t\t\t// Evict on rejection. Caching a failure would make it permanent for the memo's lifetime —\n\t\t\t// every retry would replay the same failed read, and a block-scoped memo would carry one\n\t\t\t// blip across every order closing on that block.\n\t\t\tpending = getTotalSolverBalance(evmRpcUrl, chain, token, solver, yieldVaults).catch((err) => {\n\t\t\t\tcache.delete(key)\n\t\t\t\tthrow err\n\t\t\t})\n\t\t\tcache.set(key, pending)\n\t\t}\n\t\treturn pending\n\t}\n}\n\n// Sweeps a solver's liquidity for every configured yield-vault token on every supported chain: for\n// each chain that has both an RPC (in evmRpcUrls) and configured tokens (in yieldVaults), the\n// solver's balance (raw ERC-20 + ERC-4626 vault positions) for each token. Captures the LP's whole\n// liquidity picture, not just the token of the bid being priced. Zero balances are skipped so the\n// snapshot only records tokens the solver actually holds.\nasync function sweepSolverLiquidity(\n\tevmRpcUrls: Record<string, string>,\n\tyieldVaults: YieldVaultMap,\n\tsolver: string,\n\tgetBalance: ReturnType<typeof memoizedSolverBalance>,\n\t/** Verified positions and the chain they sit on; only that chain's tokens can draw on them. */\n\tpositions: { chain: string; states: V4PositionState[] },\n): Promise<LpBalance[]> {\n\tconst balances: LpBalance[] = []\n\tfor (const [chain, tokens] of Object.entries(yieldVaults)) {\n\t\tconst url = evmRpcUrls[chain]\n\t\tif (!url) continue\n\t\tfor (const token of Object.keys(tokens)) {\n\t\t\tconst balance = await getBalance(url, chain, token, solver)\n\t\t\tconst uniswapV4Balance =\n\t\t\t\tchain === positions.chain\n\t\t\t\t\t? positions.states.reduce(\n\t\t\t\t\t\t\t(total, state) =>\n\t\t\t\t\t\t\t\ttotal +\n\t\t\t\t\t\t\t\tpositionAmountOfToken({\n\t\t\t\t\t\t\t\t\tinfo: state.info,\n\t\t\t\t\t\t\t\t\tliquidity: state.liquidity,\n\t\t\t\t\t\t\t\t\tsqrtPriceX96: state.sqrtPriceX96,\n\t\t\t\t\t\t\t\t\toutputToken: token,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t0n,\n\t\t\t\t\t\t)\n\t\t\t\t\t: 0n\n\t\t\t// A token the solver neither holds nor has parked in a position is not a row.\n\t\t\tconst total = balance + uniswapV4Balance\n\t\t\tif (total === 0n) continue\n\t\t\tbalances.push({ solver, chain, tokenAddress: token as HexString, balance: total })\n\t\t}\n\t}\n\treturn balances\n}\n\n// Strips a bytes32 token field to a 20-byte lowercase address (or normalises an address as-is).\nfunction toAddress(token: string): HexString {\n\tconst hex = token.toLowerCase().replace(/^0x/, \"\")\n\tconst addr = hex.length > 40 ? hex.slice(-40) : hex.padStart(40, \"0\")\n\treturn `0x${addr}` as HexString\n}\n\n/**\n * Aggregates every bid for a phantom order into a single price/liquidity snapshot.\n *\n * Fetches the live bids via `intents_getBidsForOrder` and reads each filler's quoted output amount.\n * Only bids that {@link isVerifiedSolverBid} accepts are counted — a bid from anyone who is not one\n * of our delegated solvers, or whose signature was not produced for this order, is dropped rather\n * than allowed to move the price. The liquidity-weighted median then weights every surviving quote by\n * the solver's balance of the output token on the destination chain, so a solver that can't actually\n * deliver size carries little or no weight — which is why no fill simulation is needed to filter\n * unfillable quotes. For each bidding solver it also records a full liquidity sweep — every\n * configured yield-vault token on every supported chain (raw ERC-20 + vault positions). Returns\n * `null` when no bid survives verification.\n *\n * `extractFill` decodes a bid's ERC-7821 calldata into the fill's order/output and `recoverSigner`\n * recovers its solver signature; both default to the viem implementations, but the indexer injects\n * VM2-safe variants (viem's keccak throws in the SubQuery sandbox).\n *\n * The whole run is retried up to {@link AGGREGATION_ATTEMPTS} times on any error, because every\n * error that escapes the per-bid handling means some input could not be read, and a snapshot\n * computed from a partial bid set is worse than none: it publishes a confident price and zeroes\n * depth that exists. Throws if every attempt fails, leaving the window unsnapshotted — consumers\n * see the previous rate with a stale lastUpdatedBlock, which is a state they can already detect.\n */\nexport async function aggregatePhantomBids(\n\tparams: Parameters<typeof runAggregation>[0],\n): Promise<PhantomAggregation | null> {\n\t// Built out here, not per attempt: delegation cannot change within a bid window, so a retry\n\t// forced by one unrelated failed read must not re-interrogate every solver it already verified.\n\tconst isDelegated = memoizedDelegationCheck()\n\tlet lastErr: unknown\n\tfor (let attempt = 1; attempt <= AGGREGATION_ATTEMPTS; attempt++) {\n\t\ttry {\n\t\t\treturn await runAggregation(params, isDelegated)\n\t\t} catch (err) {\n\t\t\tlastErr = err\n\t\t\tparams.logger?.warn(\n\t\t\t\t{ err, commitment: params.commitment, chain: params.chain, attempt, of: AGGREGATION_ATTEMPTS },\n\t\t\t\t\"Phantom aggregation attempt failed\",\n\t\t\t)\n\t\t\tif (attempt < AGGREGATION_ATTEMPTS) await new Promise((resolve) => setTimeout(resolve, 250 * attempt))\n\t\t}\n\t}\n\tthrow lastErr\n}\n\n/** How many times a failed aggregation run is retried before the window is given up on. */\nexport const AGGREGATION_ATTEMPTS = 5\n\nasync function runAggregation(\n\tparams: {\n\t\tnodeUrl: string\n\t\t/** RPC URL per supported EVM chain (stateMachineId -> url); must include the destination chain. */\n\t\tevmRpcUrls: Record<string, string>\n\t\tchain: string\n\t\tgatewayAddress: string\n\t\tcommitment: string\n\t\tyieldVaults: YieldVaultMap\n\t\t/** SolverAccount on `chain` that our solvers delegate to; bids from anyone else are dropped. */\n\t\tsolverAccount: string\n\t\textractFill?: (callData: HexString, gatewayAddress: string) => FillData | null\n\t\trecoverSigner?: RecoverBidSigner\n\t\tbidNonceKey?: BidNonceKeyFn\n\t\torderCommitment?: OrderCommitmentFn\n\t\t/**\n\t\t * Balance reader shared across runs; defaults to a fresh per-run memo. Pass one built with\n\t\t * `memoizedSolverBalance` when aggregating several same-block orders, and build it from the\n\t\t * same `yieldVaults` passed here — the memo bakes in the vault map its balances include.\n\t\t */\n\t\tgetBalance?: SolverBalanceReader\n\t\t/**\n\t\t * Uniswap V4 deployment per chain. Supply it to let bids that declare positions have those\n\t\t * positions counted; without it a declaration is simply ignored, and the weight stays the\n\t\t * plain balance as before.\n\t\t */\n\t\tuniswapV4?: Record<string, UniswapV4Contracts>\n\t\t/** keccak256 over hex; defaults to viem's, which the VM2 sandbox must replace. */\n\t\tkeccak?: (hex: HexString) => HexString\n\t\tlogger?: AggregationLogger\n\t},\n\tisDelegated: DelegationReader,\n): Promise<PhantomAggregation | null> {\n\tconst { nodeUrl, evmRpcUrls, chain, gatewayAddress, commitment, yieldVaults, solverAccount, logger } = params\n\tconst extractFill = params.extractFill ?? extractFillData\n\tconst recoverSigner = params.recoverSigner ?? recoverBidSignerViem\n\tconst bidNonceKey = params.bidNonceKey ?? CryptoUtils.bidNonceKey\n\tconst orderCommitment = params.orderCommitment ?? orderCommitmentFromDecoded\n\n\tconst destUrl = evmRpcUrls[chain]\n\tif (!destUrl) return null\n\n\t// Both bid checks need these, and neither can be skipped without letting an unverified quote into\n\t// the price, so a chain we can't resolve them for produces no snapshot at all. solverAccount is\n\t// typed as required but comes from a config lookup that can miss, so it is re-checked here.\n\tconst chainId = evmChainId(chain)\n\tif (!solverAccount || chainId === null) {\n\t\tlogger?.warn({ chain, commitment }, \"Cannot verify phantom bids: no SolverAccount or chain id for chain\")\n\t\treturn null\n\t}\n\n\tconst bids = await fetchBidsForOrder(nodeUrl, commitment)\n\tif (bids.length === 0) return null\n\n\t// One set of reads per declared position, reused by every leg it backs.\n\tconst v4Contracts = params.uniswapV4?.[chain]\n\tconst readPosition = memoizedV4Position(params.keccak ?? keccak256, logger)\n\n\t// Balances repeat across legs and the sweep; one memo serves the whole run.\n\tconst getBalance = params.getBalance ?? memoizedSolverBalance(yieldVaults)\n\n\t// Quotes per leg, keyed by the leg's position in the order's asset lists. One bid carries a quote\n\t// for every leg its solver priced, so a solver that only handles some of the pairs still counts\n\t// towards those, and legs it skipped are left to the solvers that do handle them.\n\tconst quotesByLeg = new Map<\n\t\tnumber,\n\t\t{\n\t\t\toutputToken: HexString\n\t\t\tquotes: { price: bigint; weight: bigint }[]\n\t\t\tbidders: PhantomLegBidder[]\n\t\t}\n\t>()\n\tconst lpBalances: LpBalance[] = []\n\t// Bids are stored per substrate filler, but weight is a property of the EVM solver. Without this\n\t// one solver's bid, copied under N funded fillers, would count N times in the weighted median.\n\tconst countedSolvers = new Set<string>()\n\n\tfor (const bid of bids) {\n\t\tif (!bid.user_op) continue\n\t\ttry {\n\t\t\tconst decoded = decodeUserOpScale(bid.user_op as HexString)\n\t\t\tconst solver = decoded.sender\n\n\t\t\tconst fillData = extractFill(decoded.callData as HexString, gatewayAddress)\n\t\t\tif (!fillData) continue\n\n\t\t\t// The quoted price is read out of this order, so it must be the order being priced.\n\t\t\tconst decodedCommitment = orderCommitment(fillData.order)\n\t\t\tif (!decodedCommitment || decodedCommitment.toLowerCase() !== commitment.toLowerCase()) {\n\t\t\t\tlogger?.warn({ solver, commitment }, \"Rejecting phantom bid: calldata order is not the indexed order\")\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\tconst sessionKey = (fillData.order as any)?.session as HexString | undefined\n\t\t\tif (!sessionKey) {\n\t\t\t\tlogger?.warn({ solver, commitment }, \"Rejecting phantom bid: order carries no session key\")\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst verified = await isVerifiedSolverBid({\n\t\t\t\tuserOp: decoded,\n\t\t\t\tcommitment,\n\t\t\t\tsessionKey,\n\t\t\t\tchainId,\n\t\t\t\tsolverAccount,\n\t\t\t\tevmRpcUrl: destUrl,\n\t\t\t\trecoverSigner,\n\t\t\t\tbidNonceKey,\n\t\t\t\tisDelegated,\n\t\t\t\tlogger,\n\t\t\t})\n\t\t\tif (!verified) continue\n\n\t\t\tconst normalizedSolver = solver.toLowerCase()\n\t\t\tif (countedSolvers.has(normalizedSolver)) {\n\t\t\t\tlogger?.warn({ solver, commitment }, \"Skipping phantom bid: solver already counted for this order\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcountedSolvers.add(normalizedSolver)\n\n\t\t\t// The declaration rides in paymasterAndData, which the userOpHash covers, so it carries\n\t\t\t// the same authenticity as the quote itself.\n\t\t\tconst declaration = decodePhantomBidDeclaration(decoded.paymasterAndData)\n\t\t\tconst acceptedSources = declaration.acceptedSources\n\n\t\t\t// A zero amount is how a solver declines a leg it does not price, so it is not a quote.\n\t\t\t// Weights are fetched concurrently: the memo caches promises, so identical output tokens\n\t\t\t// across legs still collapse to a single RPC round trip.\n\t\t\tconst quotedLegs = [...fillData.legs.entries()].filter(([, leg]) => leg.solverAmount !== 0n)\n\n\t\t\t// Liquidity a solver parked in a Uniswap V4 position is real capacity but holds no ERC-20\n\t\t\t// balance, so without this it reads as zero and the leg is dropped. The bid only NAMES\n\t\t\t// the positions; ownership is checked against the signer here and the amounts come off\n\t\t\t// the chain, so naming more, or naming someone else's, buys nothing.\n\t\t\tconst declaredPositions = v4Contracts ? declaration.uniswapV4Positions : []\n\t\t\tconst positions = (\n\t\t\t\tawait Promise.all(\n\t\t\t\t\tdeclaredPositions.map((tokenId) => readPosition(destUrl, chain, v4Contracts!, tokenId)),\n\t\t\t\t)\n\t\t\t).filter((state, index): state is V4PositionState => {\n\t\t\t\tif (!state) return false\n\t\t\t\tif (state.owner !== normalizedSolver) {\n\t\t\t\t\tlogger?.warn(\n\t\t\t\t\t\t{ solver, commitment, tokenId: declaredPositions[index].toString(), owner: state.owner },\n\t\t\t\t\t\t\"Ignoring declared Uniswap V4 position: not owned by the bidding solver\",\n\t\t\t\t\t)\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t\treturn true\n\t\t\t})\n\n\t\t\tconst weights = await Promise.all(\n\t\t\t\t// Price influence: the solver's liquidity in THIS leg's output token on the destination\n\t\t\t\t// chain, so a leg is weighted by the inventory that actually backs it.\n\t\t\t\tquotedLegs.map(async ([, leg]) => {\n\t\t\t\t\tconst outputToken = toAddress(leg.outputToken)\n\t\t\t\t\tconst balance = await getBalance(destUrl, chain, outputToken, solver)\n\t\t\t\t\treturn positions.reduce(\n\t\t\t\t\t\t(total, state) =>\n\t\t\t\t\t\t\ttotal +\n\t\t\t\t\t\t\tpositionAmountOfToken({\n\t\t\t\t\t\t\t\tinfo: state.info,\n\t\t\t\t\t\t\t\tliquidity: state.liquidity,\n\t\t\t\t\t\t\t\tsqrtPriceX96: state.sqrtPriceX96,\n\t\t\t\t\t\t\t\toutputToken,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tbalance,\n\t\t\t\t\t)\n\t\t\t\t}),\n\t\t\t)\n\t\t\tfor (const [position, [legIndex, leg]] of quotedLegs.entries()) {\n\t\t\t\tconst weight = weights[position]\n\t\t\t\tconst entry = quotesByLeg.get(legIndex) ?? { outputToken: leg.outputToken, quotes: [], bidders: [] }\n\t\t\t\tentry.quotes.push({ price: leg.solverAmount, weight })\n\t\t\t\tentry.bidders.push({ solver: normalizedSolver as HexString, weight, acceptedSources })\n\t\t\t\tquotesByLeg.set(legIndex, entry)\n\t\t\t}\n\n\t\t\t// Full liquidity picture: every configured token on every supported chain. Swept once per\n\t\t\t// bid rather than per leg, since it measures the solver's whole inventory either way.\n\t\t\tlpBalances.push(\n\t\t\t\t...(await sweepSolverLiquidity(evmRpcUrls, yieldVaults, solver, getBalance, {\n\t\t\t\t\tchain,\n\t\t\t\t\tstates: positions,\n\t\t\t\t})),\n\t\t\t)\n\t\t} catch (err) {\n\t\t\t// A malformed bid is this bid's problem — skip it and price the rest. An unreachable RPC\n\t\t\t// is the snapshot's problem: continuing would silently price the order from whichever\n\t\t\t// bids happened to be readable, so abandon the run and let the retry above re-read.\n\t\t\tif (err instanceof PhantomRpcError) throw err\n\t\t\tlogger?.warn({ err, filler: bid.filler }, \"Failed to process bid for price snapshot\")\n\t\t}\n\t}\n\n\tif (quotesByLeg.size === 0) return null\n\n\t// Each leg reports a single price: the liquidity-weighted median of the quotes for that leg.\n\t// lowestPrice and highestPrice carry that same value rather than the raw min/max of the bid set,\n\t// so consumers cannot read an outlier bid as if it were a tradeable bound.\n\t//\n\t// A quote's weight is the solver's inventory in THAT leg's output token on the destination\n\t// chain, so a zero-weight quote is one its solver cannot deliver at any price. Those are\n\t// dropped outright rather than merely down-weighted: they must not reach weightedMedian (with\n\t// nothing to weight by it picks a quote by position, letting whoever quotes the extreme set the\n\t// rate on zero capital), and they must not reach bidCount or `bidders`, where they would inflate\n\t// the solver count behind a price and mint zero-capacity PoolBidder/PoolRoute rows downstream.\n\t// A leg left with no backed quote at all is therefore absent entirely, exactly as if nobody had\n\t// quoted it — no snapshot, and its depth zeroes out downstream.\n\tconst legs = [...quotesByLeg.entries()]\n\t\t.sort(([a], [b]) => a - b)\n\t\t.flatMap(([legIndex, { outputToken, quotes, bidders }]) => {\n\t\t\t// quotes and bidders are pushed in lockstep above, so the same predicate keeps them aligned.\n\t\t\tconst backedQuotes = quotes.filter((quote) => quote.weight > 0n)\n\t\t\tconst backedBidders = bidders.filter((bidder) => bidder.weight > 0n)\n\t\t\tif (backedQuotes.length === 0) {\n\t\t\t\tlogger?.warn(\n\t\t\t\t\t{ commitment, chain, legIndex, outputToken, quotes: quotes.length },\n\t\t\t\t\t\"Dropping phantom leg: no bidder holds the output token on this chain, so no quote is backed\",\n\t\t\t\t)\n\t\t\t\treturn []\n\t\t\t}\n\n\t\t\tconst medianPrice = weightedMedian(backedQuotes)\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tlegIndex,\n\t\t\t\t\toutputToken,\n\t\t\t\t\tlowestPrice: medianPrice,\n\t\t\t\t\thighestPrice: medianPrice,\n\t\t\t\t\tmedianPrice,\n\t\t\t\t\tbidCount: backedQuotes.length,\n\t\t\t\t\tbidders: backedBidders,\n\t\t\t\t},\n\t\t\t]\n\t\t})\n\n\treturn { legs, lpBalances }\n}\n"]}
1
+ {"version":3,"sources":["../../src/abis/erc7281.ts","../../src/protocols/intents/types.ts","../../src/protocols/intents/decode-utils.ts","../../src/abis/IntentGatewayV2.ts","../../src/chains/intentsCoprocessor.ts","../../src/protocols/intents/liquidity-pool.ts","../../src/protocols/intents/CryptoUtils.ts","../../src/protocols/intents/uniswap-v4-position.ts","../../src/protocols/intents/phantom-aggregation.ts"],"names":["ABI","encodeAbiParameters","encodeFunctionData","decodeFunctionData","decodeAbiParameters","u8aToHex","hexToU8a","keccak256","total"],"mappings":";;;;;;;;;;;AAAA,IAAM,GAAA,GAAM;AAAA,EACX;AAAA,IACC,IAAA,EAAM,SAAA;AAAA,IACN,IAAA,EAAM,UAAA;AAAA,IACN,MAAA,EAAQ;AAAA,MACP,EAAE,IAAA,EAAM,MAAA,EAAQ,IAAA,EAAM,SAAA,EAAU;AAAA,MAChC,EAAE,IAAA,EAAM,eAAA,EAAiB,IAAA,EAAM,OAAA;AAAQ,KACxC;AAAA,IACA,SAAS;AAAC,GACX;AAAA,EACA;AAAA,IACC,IAAA,EAAM,MAAA;AAAA,IACN,IAAA,EAAM,OAAA;AAAA,IACN,UAAA,EAAY;AAAA,MACX,EAAE,IAAA,EAAM,QAAA,EAAU,IAAA,EAAM,SAAA,EAAU;A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ABI = [\n\t{\n\t\tname: \"execute\",\n\t\ttype: \"function\",\n\t\tinputs: [\n\t\t\t{ name: \"mode\", type: \"bytes32\" },\n\t\t\t{ name: \"executionData\", type: \"bytes\" },\n\t\t],\n\t\toutputs: [],\n\t},\n\t{\n\t\tname: \"Call\",\n\t\ttype: \"tuple\",\n\t\tcomponents: [\n\t\t\t{ name: \"target\", type: \"address\" },\n\t\t\t{ name: \"value\", type: \"uint256\" },\n\t\t\t{ name: \"data\", type: \"bytes\" },\n\t\t],\n\t},\n] as const\n\nexport default { ABI }\n","import type { TransactionReceipt } from \"viem\"\nimport type { HexString } from \"@/types\"\nimport type { IProof } from \"@/chain\"\nimport type { RequestStatusWithMetadata } from \"@/types\"\n\n/**\n * ABI-encoded function selector for the IntentGatewayV2 `placeOrder` function,\n * including the full tuple signature of the OrderV2 struct.\n */\nexport const PLACE_ORDER_SELECTOR =\n\t\"placeOrder((bytes32,bytes,bytes,uint256,uint256,uint256,address,((bytes32,uint256)[],bytes),(bytes32,uint256)[],(bytes32,(bytes32,uint256)[],bytes)),bytes32)\"\n\n/**\n * ABI tuple type string for the OrderV2 struct used when ABI-encoding or\n * decoding order data without a full ABI artifact.\n */\nexport const ORDER_V2_PARAM_TYPE =\n\t\"(bytes32,bytes,bytes,uint256,uint256,uint256,address,((bytes32,uint256)[],bytes),(bytes32,uint256)[],(bytes32,(bytes32,uint256)[],bytes))\"\n\n/**\n * Default graffiti value: a bytes32 zero word.\n *\n * When no graffiti is supplied to `placeOrder`, this value is used,\n * indicating no orderflow attribution or revenue-share tag.\n */\nexport const DEFAULT_GRAFFITI = \"0x0000000000000000000000000000000000000000000000000000000000000000\" as HexString\n\n/**\n * ERC-7821 execution mode selector for single-batch execution.\n *\n * The first byte `0x01` indicates batch mode; all remaining bytes are\n * reserved and set to zero.\n */\nexport const ERC7821_BATCH_MODE = \"0x0100000000000000000000000000000000000000000000000000000000000000\" as HexString\n\n/**\n * Bundler RPC method names for ERC-4337 operations.\n *\n * Values map to JSON-RPC method strings sent to a 4337 bundler endpoint.\n * `PIMLICO_GET_USER_OPERATION_GAS_PRICE` is a Pimlico-specific extension.\n */\nexport const BundlerMethod = {\n\t/** Submits a UserOperation to the bundler mempool. */\n\tETH_SEND_USER_OPERATION: \"eth_sendUserOperation\",\n\t/** Retrieves the receipt for a previously submitted UserOperation by its hash. */\n\tETH_GET_USER_OPERATION_RECEIPT: \"eth_getUserOperationReceipt\",\n\t/** Estimates gas limits for a UserOperation before submission. */\n\tETH_ESTIMATE_USER_OPERATION_GAS: \"eth_estimateUserOperationGas\",\n\t/** Pimlico-specific method to fetch recommended EIP-1559 gas prices for UserOperations. */\n\tPIMLICO_GET_USER_OPERATION_GAS_PRICE: \"pimlico_getUserOperationGasPrice\",\n\t/** Alchemy (Rundler) method to fetch recommended priority fee for UserOperations. */\n\tRUNDLER_MAX_PRIORITY_FEE_PER_GAS: \"rundler_maxPriorityFeePerGas\",\n} as const\n\n/** Union of all valid bundler RPC method name strings. */\nexport type BundlerMethod = (typeof BundlerMethod)[keyof typeof BundlerMethod]\n\n/**\n * Response payload returned by a bundler for\n * `eth_estimateUserOperationGas`.\n *\n * All gas values are returned as hex strings.\n */\nexport interface BundlerGasEstimate {\n\t/** Gas required for pre-verification processing (hex). */\n\tpreVerificationGas: HexString\n\t/** Gas limit for the account verification step (hex). */\n\tverificationGasLimit: HexString\n\t/** Gas limit for the main execution call (hex). */\n\tcallGasLimit: HexString\n\t/** Gas limit for paymaster verification, if a paymaster is used (hex). */\n\tpaymasterVerificationGasLimit?: HexString\n\t/** Gas limit for paymaster post-operation hook, if a paymaster is used (hex). */\n\tpaymasterPostOpGasLimit?: HexString\n}\n\n/**\n * Response payload returned by Pimlico's\n * `pimlico_getUserOperationGasPrice` method.\n *\n * Provides EIP-1559 fee recommendations at three priority tiers.\n * Each field is optional; callers should fall back from `fast` → `standard` → `slow`.\n */\nexport interface PimlicoGasPriceEstimate {\n\t/** Low-priority fee recommendation. */\n\tslow: {\n\t\t/** Maximum total fee per gas (hex). */\n\t\tmaxFeePerGas: HexString\n\t\t/** Maximum miner tip per gas (hex). */\n\t\tmaxPriorityFeePerGas: HexString\n\t}\n\t/** Medium-priority fee recommendation. */\n\tstandard: {\n\t\t/** Maximum total fee per gas (hex). */\n\t\tmaxFeePerGas: HexString\n\t\t/** Maximum miner tip per gas (hex). */\n\t\tmaxPriorityFeePerGas: HexString\n\t}\n\t/** High-priority fee recommendation for fastest inclusion. */\n\tfast: {\n\t\t/** Maximum total fee per gas (hex). */\n\t\tmaxFeePerGas: HexString\n\t\t/** Maximum miner tip per gas (hex). */\n\t\tmaxPriorityFeePerGas: HexString\n\t}\n}\n\n/**\n * Tagged union of all status updates that can be yielded by the cancel-order\n * async generator.\n *\n * The `status` field is the discriminant. Consumers should switch on it to\n * handle each stage of the cancellation lifecycle:\n *\n * - `DESTINATION_FINALIZED` – a state proof from the destination chain is ready.\n * - `AWAITING_CANCEL_TRANSACTION` – the caller must sign and submit the cancel tx.\n * - `CANCEL_STARTED` – the cancel transaction was confirmed on-chain.\n * - `SOURCE_FINALIZED` – the cancel request has been finalised on the source chain.\n\t* - `HYPERBRIDGE_DELIVERED` – the cancel message has been delivered to Hyperbridge.\n\t* - `HYPERBRIDGE_FINALIZED` – the cancel message has been finalised on Hyperbridge.\n\t* - `CANCELLATION_COMPLETE` – the escrow has been refunded; cancellation is done.\n */\nexport type CancelEvent =\n\t| { status: \"DESTINATION_FINALIZED\"; proof: IProof }\n\t| { status: \"AWAITING_CANCEL_TRANSACTION\"; data: HexString; to: HexString; value: bigint }\n\t| { status: \"CANCEL_STARTED\"; receipt: TransactionReceipt }\n\t| {\n\t\t\tstatus: \"SOURCE_FINALIZED\"\n\t\t\tmetadata: Extract<RequestStatusWithMetadata, { status: \"SOURCE_FINALIZED\" }>[\"metadata\"]\n\t }\n\t| {\n\t\t\tstatus: \"HYPERBRIDGE_DELIVERED\"\n\t\t\tmetadata: Extract<RequestStatusWithMetadata, { status: \"HYPERBRIDGE_DELIVERED\" }>[\"metadata\"]\n\t }\n\t| {\n\t\t\tstatus: \"HYPERBRIDGE_FINALIZED\"\n\t\t\tmetadata: Extract<RequestStatusWithMetadata, { status: \"HYPERBRIDGE_FINALIZED\" }>[\"metadata\"]\n\t }\n\t| { status: \"CANCELLATION_COMPLETE\"; blockNumber: number; transactionHash: HexString }\n\nimport type { IEvmChain } from \"@/chain\"\nimport type { IntentsCoprocessor } from \"@/chains/intentsCoprocessor\"\nimport type { Swap } from \"@/utils/swap\"\nimport type { createSessionKeyStorage, createCancellationStorage, createUsedUserOpsStorage } from \"@/storage\"\n\n/**\n * Shared runtime context passed to every IntentsV2 sub-module.\n *\n * All sub-modules (OrderPlacer, OrderExecutor, BidManager, etc.) receive a\n * reference to this object so they can share fee-token caches, storage\n * adapters, and chain clients without duplicating initialisation logic.\n */\nexport interface IntentGatewayContext {\n\t/** EVM chain on which orders are placed and escrowed. */\n\tsource: IEvmChain\n\t/** EVM chain on which solvers fill orders and receive outputs. */\n\tdest: IEvmChain\n\t/** Hyperbridge coprocessor client used to fetch solver bids and submit UserOperations. */\n\tintentsCoprocessor?: IntentsCoprocessor\n\t/** URL of the ERC-4337 bundler endpoint for gas estimation and UserOp submission. */\n\tbundlerUrl?: string\n\t/**\n\t * In-memory TTL cache keyed by state-machine ID.\n\t * Stores fee-token address, decimals, and the timestamp of the last fetch.\n\t */\n\tfeeTokenCache: Map<string, { address: HexString; decimals: number; cachedAt: number }>\n\t/**\n\t * In-memory cache of solver account contract bytecode, keyed by lowercased address.\n\t * Used to inject solver code into state-overrides for gas estimation.\n\t */\n\tsolverCodeCache: Map<string, string>\n\t/** Persistent storage for ephemeral session keys generated per order. */\n\tsessionKeyStorage: ReturnType<typeof createSessionKeyStorage>\n\t/** Persistent storage for intermediate cancellation state (proofs, commitments). */\n\tcancellationStorage: ReturnType<typeof createCancellationStorage>\n\t/** Persistent storage for deduplication of already-submitted UserOperations. */\n\tusedUserOpsStorage: ReturnType<typeof createUsedUserOpsStorage>\n\t/** DEX-quote utility used for token pricing and gas-to-fee-token conversions. */\n\tswap: Swap\n}\n","// Pure ERC-7821 encode/decode utilities — no chain dependency (safe for SubQuery VM2).\nimport { encodeFunctionData, encodeAbiParameters, decodeFunctionData, decodeAbiParameters } from \"viem\"\nimport ERC7821ABI from \"@/abis/erc7281\"\nimport { ERC7821_BATCH_MODE } from \"./types\"\nimport type { HexString, ERC7821Call } from \"@/types\"\n\nexport function encodeERC7821ExecuteBatch(calls: ERC7821Call[]): HexString {\n\tconst executionData = encodeAbiParameters(\n\t\t[{ type: \"tuple[]\", components: ERC7821ABI.ABI[1].components }],\n\t\t[calls.map((call) => ({ target: call.target, value: call.value, data: call.data }))],\n\t) as HexString\n\n\treturn encodeFunctionData({\n\t\tabi: ERC7821ABI.ABI,\n\t\tfunctionName: \"execute\",\n\t\targs: [ERC7821_BATCH_MODE, executionData],\n\t}) as HexString\n}\n\nexport function decodeERC7821ExecuteBatch(callData: HexString): ERC7821Call[] | null {\n\ttry {\n\t\tconst decoded = decodeFunctionData({ abi: ERC7821ABI.ABI, data: callData })\n\t\tif (decoded.functionName !== \"execute\" || !decoded.args || decoded.args.length < 2) return null\n\t\tconst executionData = decoded.args[1] as HexString\n\t\tconst [calls] = decodeAbiParameters(\n\t\t\t[{ type: \"tuple[]\", components: ERC7821ABI.ABI[1].components }],\n\t\t\texecutionData,\n\t\t) as [ERC7821Call[]]\n\t\treturn calls.map((call) => ({\n\t\t\ttarget: call.target as HexString,\n\t\t\tvalue: call.value,\n\t\t\tdata: call.data as HexString,\n\t\t}))\n\t} catch {\n\t\treturn null\n\t}\n}\n","export const ABI = [\n\t{\n\t\ttype: \"constructor\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"admin\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"nonpayable\",\n\t},\n\t{\n\t\ttype: \"receive\",\n\t\tstateMutability: \"payable\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"DOMAIN_SEPARATOR\",\n\t\tinputs: [],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"SELECT_SOLVER_TYPEHASH\",\n\t\tinputs: [],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"_destinationProtocolFees\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"_filled\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"_instances\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"_nonce\",\n\t\tinputs: [],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"_orders\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"_partialFills\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"calculateCommitmentSlotHash\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"commitment\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"bytes\",\n\t\t\t\tinternalType: \"bytes\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"pure\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"cancelOrder\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"order\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tinternalType: \"struct Order\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"user\",\n\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"source\",\n\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"destination\",\n\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"deadline\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"nonce\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"fees\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"session\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"predispatch\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\tinternalType: \"struct DispatchInfo\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"assets\",\n\t\t\t\t\t\t\t\ttype: \"tuple[]\",\n\t\t\t\t\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"call\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"inputs\",\n\t\t\t\t\t\ttype: \"tuple[]\",\n\t\t\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"output\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\tinternalType: \"struct PaymentInfo\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"beneficiary\",\n\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"assets\",\n\t\t\t\t\t\t\t\ttype: \"tuple[]\",\n\t\t\t\t\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"call\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"options\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tinternalType: \"struct CancelOptions\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"relayerFee\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"height\",\n\t\t\t\t\t\ttype: \"uint64\",\n\t\t\t\t\t\tinternalType: \"uint64\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\toutputs: [],\n\t\tstateMutability: \"payable\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"eip712Domain\",\n\t\tinputs: [],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"fields\",\n\t\t\t\ttype: \"bytes1\",\n\t\t\t\tinternalType: \"bytes1\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"name\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tinternalType: \"string\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"version\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tinternalType: \"string\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"chainId\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"verifyingContract\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"salt\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"extensions\",\n\t\t\t\ttype: \"uint256[]\",\n\t\t\t\tinternalType: \"uint256[]\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"fillOrder\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"order\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tinternalType: \"struct Order\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"user\",\n\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"source\",\n\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"destination\",\n\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"deadline\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"nonce\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"fees\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"session\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"predispatch\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\tinternalType: \"struct DispatchInfo\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"assets\",\n\t\t\t\t\t\t\t\ttype: \"tuple[]\",\n\t\t\t\t\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"call\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"inputs\",\n\t\t\t\t\t\ttype: \"tuple[]\",\n\t\t\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"output\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\tinternalType: \"struct PaymentInfo\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"beneficiary\",\n\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"assets\",\n\t\t\t\t\t\t\t\ttype: \"tuple[]\",\n\t\t\t\t\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"call\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"options\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tinternalType: \"struct FillOptions\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"relayerFee\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"nativeDispatchFee\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"outputs\",\n\t\t\t\t\t\ttype: \"tuple[]\",\n\t\t\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\toutputs: [],\n\t\tstateMutability: \"payable\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"host\",\n\t\tinputs: [],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"instance\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"stateMachineId\",\n\t\t\t\ttype: \"bytes\",\n\t\t\t\tinternalType: \"bytes\",\n\t\t\t},\n\t\t],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"onAccept\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"incoming\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tinternalType: \"struct IncomingPostRequest\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"request\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\tinternalType: \"struct PostRequest\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"source\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"dest\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"nonce\",\n\t\t\t\t\t\t\t\ttype: \"uint64\",\n\t\t\t\t\t\t\t\tinternalType: \"uint64\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"from\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"to\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"timeoutTimestamp\",\n\t\t\t\t\t\t\t\ttype: \"uint64\",\n\t\t\t\t\t\t\t\tinternalType: \"uint64\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"body\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"relayer\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\toutputs: [],\n\t\tstateMutability: \"nonpayable\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"onGetResponse\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"incoming\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tinternalType: \"struct IncomingGetResponse\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"response\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\tinternalType: \"struct GetResponse\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"request\",\n\t\t\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\t\t\tinternalType: \"struct GetRequest\",\n\t\t\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"source\",\n\t\t\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"dest\",\n\t\t\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"nonce\",\n\t\t\t\t\t\t\t\t\t\ttype: \"uint64\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"uint64\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"from\",\n\t\t\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"timeoutTimestamp\",\n\t\t\t\t\t\t\t\t\t\ttype: \"uint64\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"uint64\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"keys\",\n\t\t\t\t\t\t\t\t\t\ttype: \"bytes[]\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"bytes[]\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"height\",\n\t\t\t\t\t\t\t\t\t\ttype: \"uint64\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"uint64\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"context\",\n\t\t\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"values\",\n\t\t\t\t\t\t\t\ttype: \"tuple[]\",\n\t\t\t\t\t\t\t\tinternalType: \"struct StorageValue[]\",\n\t\t\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"key\",\n\t\t\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"value\",\n\t\t\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"relayer\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\toutputs: [],\n\t\tstateMutability: \"nonpayable\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"onGetTimeout\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tinternalType: \"struct GetRequestTimeout\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"request\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\tinternalType: \"struct GetRequest\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"source\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"dest\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"nonce\",\n\t\t\t\t\t\t\t\ttype: \"uint64\",\n\t\t\t\t\t\t\t\tinternalType: \"uint64\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"from\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"timeoutTimestamp\",\n\t\t\t\t\t\t\t\ttype: \"uint64\",\n\t\t\t\t\t\t\t\tinternalType: \"uint64\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"keys\",\n\t\t\t\t\t\t\t\ttype: \"bytes[]\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes[]\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"height\",\n\t\t\t\t\t\t\t\ttype: \"uint64\",\n\t\t\t\t\t\t\t\tinternalType: \"uint64\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"context\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"relayer\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\toutputs: [],\n\t\tstateMutability: \"nonpayable\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"onPostRequestTimeout\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tinternalType: \"struct PostRequestTimeout\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"request\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\tinternalType: \"struct PostRequest\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"source\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"dest\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"nonce\",\n\t\t\t\t\t\t\t\ttype: \"uint64\",\n\t\t\t\t\t\t\t\tinternalType: \"uint64\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"from\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"to\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"timeoutTimestamp\",\n\t\t\t\t\t\t\t\ttype: \"uint64\",\n\t\t\t\t\t\t\t\tinternalType: \"uint64\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"body\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"relayer\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\toutputs: [],\n\t\tstateMutability: \"nonpayable\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"params\",\n\t\tinputs: [],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tinternalType: \"struct Params\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"host\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"dispatcher\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"solverSelection\",\n\t\t\t\t\t\ttype: \"bool\",\n\t\t\t\t\t\tinternalType: \"bool\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"surplusShareBps\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"protocolFeeBps\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"priceOracle\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"placeOrder\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"order\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tinternalType: \"struct Order\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"user\",\n\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"source\",\n\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"destination\",\n\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"deadline\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"nonce\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"fees\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"session\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"predispatch\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\tinternalType: \"struct DispatchInfo\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"assets\",\n\t\t\t\t\t\t\t\ttype: \"tuple[]\",\n\t\t\t\t\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"call\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"inputs\",\n\t\t\t\t\t\ttype: \"tuple[]\",\n\t\t\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"output\",\n\t\t\t\t\t\ttype: \"tuple\",\n\t\t\t\t\t\tinternalType: \"struct PaymentInfo\",\n\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"beneficiary\",\n\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"assets\",\n\t\t\t\t\t\t\t\ttype: \"tuple[]\",\n\t\t\t\t\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\t\t\t\t\tcomponents: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"call\",\n\t\t\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"graffiti\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t],\n\t\toutputs: [],\n\t\tstateMutability: \"payable\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"quote\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"request\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tinternalType: \"struct DispatchPost\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"dest\",\n\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"to\",\n\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"body\",\n\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"timeout\",\n\t\t\t\t\t\ttype: \"uint64\",\n\t\t\t\t\t\tinternalType: \"uint64\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"fee\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"payer\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"quote\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"request\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tinternalType: \"struct DispatchGet\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"dest\",\n\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"height\",\n\t\t\t\t\t\ttype: \"uint64\",\n\t\t\t\t\t\tinternalType: \"uint64\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"keys\",\n\t\t\t\t\t\ttype: \"bytes[]\",\n\t\t\t\t\t\tinternalType: \"bytes[]\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"timeout\",\n\t\t\t\t\t\ttype: \"uint64\",\n\t\t\t\t\t\tinternalType: \"uint64\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"fee\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"context\",\n\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"payer\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"view\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"select\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"options\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tinternalType: \"struct SelectOptions\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"commitment\",\n\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"solver\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"signature\",\n\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\toutputs: [\n\t\t\t{\n\t\t\t\tname: \"\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t],\n\t\tstateMutability: \"nonpayable\",\n\t},\n\t{\n\t\ttype: \"function\",\n\t\tname: \"init\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"p\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tinternalType: \"struct Params\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"host\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"dispatcher\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"solverSelection\",\n\t\t\t\t\t\ttype: \"bool\",\n\t\t\t\t\t\tinternalType: \"bool\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"surplusShareBps\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"protocolFeeBps\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"priceOracle\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"deployments\",\n\t\t\t\ttype: \"tuple[]\",\n\t\t\t\tinternalType: \"struct Deployment[]\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"chain\",\n\t\t\t\t\t\ttype: \"bytes\",\n\t\t\t\t\t\tinternalType: \"bytes\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"gateway\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\toutputs: [],\n\t\tstateMutability: \"nonpayable\",\n\t},\n\t{\n\t\ttype: \"event\",\n\t\tname: \"DestinationProtocolFeeUpdated\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"chain\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"string\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"feeBps\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t},\n\t\t],\n\t\tanonymous: false,\n\t},\n\t{\n\t\ttype: \"event\",\n\t\tname: \"DustCollected\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"token\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"amount\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t},\n\t\t],\n\t\tanonymous: false,\n\t},\n\t{\n\t\ttype: \"event\",\n\t\tname: \"DustSwept\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"token\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"amount\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"beneficiary\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t],\n\t\tanonymous: false,\n\t},\n\t{\n\t\ttype: \"event\",\n\t\tname: \"EIP712DomainChanged\",\n\t\tinputs: [],\n\t\tanonymous: false,\n\t},\n\t{\n\t\ttype: \"event\",\n\t\tname: \"EscrowRefunded\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"commitment\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tindexed: true,\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"tokens\",\n\t\t\t\ttype: \"tuple[]\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\tanonymous: false,\n\t},\n\t{\n\t\ttype: \"event\",\n\t\tname: \"EscrowReleased\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"commitment\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tindexed: true,\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"tokens\",\n\t\t\t\ttype: \"tuple[]\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\tanonymous: false,\n\t},\n\t{\n\t\ttype: \"event\",\n\t\tname: \"DeploymentAdded\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"chain\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"string\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"gateway\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t],\n\t\tanonymous: false,\n\t},\n\t{\n\t\ttype: \"event\",\n\t\tname: \"OrderFilled\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"commitment\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tindexed: true,\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"filler\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"outputs\",\n\t\t\t\ttype: \"tuple[]\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"inputs\",\n\t\t\t\ttype: \"tuple[]\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\tanonymous: false,\n\t},\n\t{\n\t\ttype: \"event\",\n\t\tname: \"OrderPlaced\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"user\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"source\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"string\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"destination\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"string\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"deadline\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"nonce\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"fees\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"session\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"beneficiary\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"predispatch\",\n\t\t\t\ttype: \"tuple[]\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"inputs\",\n\t\t\t\ttype: \"tuple[]\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"outputs\",\n\t\t\t\ttype: \"tuple[]\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"predispatchCall\",\n\t\t\t\ttype: \"bytes\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"bytes\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"outputCall\",\n\t\t\t\ttype: \"bytes\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"bytes\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"graffiti\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t],\n\t\tanonymous: false,\n\t},\n\t{\n\t\ttype: \"event\",\n\t\tname: \"ParamsUpdated\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"previous\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"struct Params\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"host\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"dispatcher\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"solverSelection\",\n\t\t\t\t\t\ttype: \"bool\",\n\t\t\t\t\t\tinternalType: \"bool\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"surplusShareBps\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"protocolFeeBps\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"priceOracle\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"current\",\n\t\t\t\ttype: \"tuple\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"struct Params\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"host\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"dispatcher\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"solverSelection\",\n\t\t\t\t\t\ttype: \"bool\",\n\t\t\t\t\t\tinternalType: \"bool\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"surplusShareBps\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"protocolFeeBps\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"priceOracle\",\n\t\t\t\t\t\ttype: \"address\",\n\t\t\t\t\t\tinternalType: \"address\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\tanonymous: false,\n\t},\n\t{\n\t\ttype: \"event\",\n\t\tname: \"PartialFill\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"commitment\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tindexed: true,\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"filler\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"outputs\",\n\t\t\t\ttype: \"tuple[]\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"inputs\",\n\t\t\t\ttype: \"tuple[]\",\n\t\t\t\tindexed: false,\n\t\t\t\tinternalType: \"struct TokenInfo[]\",\n\t\t\t\tcomponents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"token\",\n\t\t\t\t\t\ttype: \"bytes32\",\n\t\t\t\t\t\tinternalType: \"bytes32\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: \"amount\",\n\t\t\t\t\t\ttype: \"uint256\",\n\t\t\t\t\t\tinternalType: \"uint256\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\tanonymous: false,\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"Cancelled\",\n\t\tinputs: [],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"UnknownInstance\",\n\t\tinputs: [],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"ECDSAInvalidSignature\",\n\t\tinputs: [],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"ECDSAInvalidSignatureLength\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"length\",\n\t\t\t\ttype: \"uint256\",\n\t\t\t\tinternalType: \"uint256\",\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"ECDSAInvalidSignatureS\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"s\",\n\t\t\t\ttype: \"bytes32\",\n\t\t\t\tinternalType: \"bytes32\",\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"Expired\",\n\t\tinputs: [],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"Filled\",\n\t\tinputs: [],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"InsufficientNativeToken\",\n\t\tinputs: [],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"InvalidInput\",\n\t\tinputs: [],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"InvalidShortString\",\n\t\tinputs: [],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"NotExpired\",\n\t\tinputs: [],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"SafeERC20FailedOperation\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"token\",\n\t\t\t\ttype: \"address\",\n\t\t\t\tinternalType: \"address\",\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"StringTooLong\",\n\t\tinputs: [\n\t\t\t{\n\t\t\t\tname: \"str\",\n\t\t\t\ttype: \"string\",\n\t\t\t\tinternalType: \"string\",\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"Unauthorized\",\n\t\tinputs: [],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"UnauthorizedCall\",\n\t\tinputs: [],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"UnexpectedCall\",\n\t\tinputs: [],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"UnknownOrder\",\n\t\tinputs: [],\n\t},\n\t{\n\t\ttype: \"error\",\n\t\tname: \"WrongChain\",\n\t\tinputs: [],\n\t},\n] as const\n\nexport default { ABI }\n","import { ApiPromise, HttpProvider, Keyring, WsProvider } from \"@polkadot/api\"\nimport type { ApiOptions, SubmittableExtrinsic } from \"@polkadot/api/types\"\nimport type { KeyringPair } from \"@polkadot/keyring/types\"\nimport { hexToU8a, u8aToHex, u8aConcat } from \"@polkadot/util\"\nimport { decodeAddress, keccakAsU8a } from \"@polkadot/util-crypto\"\nimport { numberToBytes, bytesToBigInt, decodeAbiParameters, hexToBytes } from \"viem\"\nimport { Bytes, Struct, u8, Vector } from \"scale-ts\"\nimport PQueue from \"p-queue\"\nimport type { BidSubmissionResult, HexString, PackedUserOperation, BidStorageEntry, FillerBid, Order } from \"@/types\"\nimport type { SubstrateChain } from \"./substrate\"\nimport IntentGatewayV2 from \"@/abis/IntentGatewayV2\"\n\n/** Offchain storage key prefix for bids */\nconst OFFCHAIN_BID_PREFIX = new TextEncoder().encode(\"intents::bid::\")\n/** Offchain storage key prefix for phantom orders */\nconst OFFCHAIN_PHANTOM_PREFIX = new TextEncoder().encode(\"intents::phantom::order::\")\n\n/** Hyperbridge runtimes hash with keccak, so the registry needs the hasher for both spec names. */\nconst HYPERBRIDGE_TYPES_BUNDLE: ApiOptions[\"typesBundle\"] = {\n\tspec: {\n\t\tnexus: { hasher: keccakAsU8a },\n\t\tgargantua: { hasher: keccakAsU8a },\n\t},\n}\n\n/** Base tip (0.001 BRIDGE) added to every submission to lift it above untipped traffic. */\nconst BASE_TIP = 1_000_000_000n\n\n/** How long the HTTP api has to come up (metadata included) before the attempt is abandoned. */\nconst HTTP_CONNECT_TIMEOUT_MS = 20_000\n\n/**\n * How long a submitted extrinsic has to reach a block before the attempt is treated as stalled.\n *\n * Sized against the bid window, not against how long inclusion can conceivably take: a bid is worth\n * nothing once its window closes, so an extrinsic still sitting in the pool after a few blocks is\n * better replaced by a higher-tipped copy than waited on.\n */\nexport const INCLUSION_TIMEOUT_MS = 20_000\n\n/** Default phantom order poll cadence, used for every runtime except Gargantua. */\nconst PHANTOM_POLL_INTERVAL_MS = 15_000\n\n/** Gargantua keeps the original one-block cadence. */\nconst GARGANTUA_PHANTOM_POLL_INTERVAL_MS = 6_000\n\n/** Rejects after `ms`, without holding a node process open on its own. */\nfunction rejectAfter(ms: number, message: string): Promise<never> {\n\treturn new Promise((_resolve, reject) => {\n\t\tconst timer = setTimeout(() => reject(new Error(message)), ms)\n\t\t;(timer as unknown as { unref?: () => void }).unref?.()\n\t})\n}\n\n/**\n * Maps a websocket endpoint onto the HTTP endpoint of the same node — substrate serves both on the\n * same host and port, so the scheme is the only difference. Throws for anything that is not a\n * `ws(s)://` url rather than guessing at an endpoint.\n *\n * The HTTP endpoint is always derived, never configured, because it must be the *same node* as the\n * websocket: phantom orders are read out of that node's offchain worker storage, which is\n * node-local and not replicated, so a separately configured host would return nothing for orders\n * the events said exist.\n */\nexport function deriveHttpUrl(wsUrl: string): string {\n\tif (wsUrl.startsWith(\"wss://\")) return `https://${wsUrl.slice(\"wss://\".length)}`\n\tif (wsUrl.startsWith(\"ws://\")) return `http://${wsUrl.slice(\"ws://\".length)}`\n\tthrow new Error(`Cannot derive an HTTP endpoint from a non-websocket url: ${wsUrl}`)\n}\n\n/** Builds the extrinsic to submit against whichever api is live at signing time. */\ntype ExtrinsicBuilder = (api: ApiPromise) => SubmittableExtrinsic<\"promise\">\n\n/** SCALE codec for Bid { filler: AccountId, user_op: Vec<u8> } */\nconst BidCodec = Struct({ filler: Bytes(32), user_op: Vector(u8) })\n\n/**\n * SCALE codec for PackedUserOperation\n * Uses Vec<u8> for all fields to handle hex strings uniformly\n */\nconst PackedUserOperationCodec = Struct({\n\tsender: Bytes(20), // address is 20 bytes\n\tnonce: Bytes(32), // uint256 as 32 bytes\n\tinitCode: Vector(u8), // variable length bytes\n\tcallData: Vector(u8), // variable length bytes\n\taccountGasLimits: Bytes(32), // bytes32\n\tpreVerificationGas: Bytes(32), // uint256 as 32 bytes\n\tgasFees: Bytes(32), // bytes32\n\tpaymasterAndData: Vector(u8), // variable length bytes\n\tsignature: Vector(u8), // variable length bytes\n})\n\n/**\n * Encodes a PackedUserOperation using SCALE codec for submission to Hyperbridge.\n * This is the recommended way to encode UserOps for the intents coprocessor.\n *\n * @param userOp - The PackedUserOperation to encode\n * @returns Hex-encoded SCALE bytes\n */\nexport function encodeUserOpScale(userOp: PackedUserOperation): HexString {\n\tconst encoded = PackedUserOperationCodec.enc({\n\t\tsender: hexToU8a(userOp.sender),\n\t\tnonce: numberToBytes(userOp.nonce, { size: 32 }),\n\t\tinitCode: Array.from(hexToU8a(userOp.initCode)),\n\t\tcallData: Array.from(hexToU8a(userOp.callData)),\n\t\taccountGasLimits: hexToU8a(userOp.accountGasLimits),\n\t\tpreVerificationGas: numberToBytes(userOp.preVerificationGas, { size: 32 }),\n\t\tgasFees: hexToU8a(userOp.gasFees),\n\t\tpaymasterAndData: Array.from(hexToU8a(userOp.paymasterAndData)),\n\t\tsignature: Array.from(hexToU8a(userOp.signature)),\n\t})\n\n\treturn u8aToHex(encoded) as HexString\n}\n\n/**\n * Decodes a SCALE-encoded PackedUserOperation.\n *\n * @param hex - The hex-encoded SCALE bytes\n * @returns The decoded PackedUserOperation\n */\nexport function decodeUserOpScale(hex: HexString): PackedUserOperation {\n\tconst decoded = PackedUserOperationCodec.dec(hexToU8a(hex))\n\n\treturn {\n\t\tsender: u8aToHex(new Uint8Array(decoded.sender)) as HexString,\n\t\tnonce: bytesToBigInt(new Uint8Array(decoded.nonce)),\n\t\tinitCode: u8aToHex(new Uint8Array(decoded.initCode)) as HexString,\n\t\tcallData: u8aToHex(new Uint8Array(decoded.callData)) as HexString,\n\t\taccountGasLimits: u8aToHex(new Uint8Array(decoded.accountGasLimits)) as HexString,\n\t\tpreVerificationGas: bytesToBigInt(new Uint8Array(decoded.preVerificationGas)),\n\t\tgasFees: u8aToHex(new Uint8Array(decoded.gasFees)) as HexString,\n\t\tpaymasterAndData: u8aToHex(new Uint8Array(decoded.paymasterAndData)) as HexString,\n\t\tsignature: u8aToHex(new Uint8Array(decoded.signature)) as HexString,\n\t}\n}\n\n/** RPC response shape from intents_getBidsForOrder */\ninterface RpcBidInfo {\n\tcommitment: HexString\n\tfiller: HexString\n\tuser_op: HexString\n}\n\n/** One directed leg of a phantom order: `standardAmount` of `tokenA` quoted in `tokenB`. */\nexport interface PhantomOrderLeg {\n\ttokenA: HexString\n\ttokenB: HexString\n\tstandardAmount: bigint\n}\n\nexport interface PhantomOrderEvent {\n\tcommitment: HexString\n\tchain: string\n\tcreatedAt: number\n\t/**\n\t * Every configured pair expands into its configured direction plus the reverse. Listed in\n\t * the same order as the order's asset lists, so index `i` here is the order's leg `i`.\n\t */\n\tlegs: PhantomOrderLeg[]\n}\n\n/** One phantom bid to place, and the bid it replaces on the same chain. */\nexport interface PhantomBid {\n\t/** The phantom order commitment being bid on. */\n\tcommitment: HexString\n\t/** The SCALE-encoded PackedUserOperation backing the quote. */\n\tuserOp: HexString\n\t/**\n\t * A live bid from a previous interval on the same chain, retracted alongside this one to\n\t * reclaim its deposit. Best-effort: a retraction that fails never affects the bid.\n\t */\n\tretractCommitment?: HexString\n}\n\n/** What became of one bid in a batch. */\nexport interface PhantomBidOutcome {\n\tcommitment: HexString\n\tsuccess: boolean\n\t/** The dispatch error that rejected this bid, when it failed. */\n\terror?: string\n}\n\nexport interface PhantomBidBatchResult {\n\t/** One entry per submitted bid, in the order they were given. */\n\tbids: PhantomBidOutcome[]\n\t/** The block and extrinsic the bids landed in. */\n\tblockHash?: HexString\n\textrinsicHash?: HexString\n\t/**\n\t * The batch reached the pool but its inclusion was not observed, so no per-bid outcome is\n\t * known. Same contract as {@link BidSubmissionResult.pending}: in flight, do not re-sign.\n\t */\n\tpending?: boolean\n\t/** Set when the batch never landed at all, or when its item events could not be attributed. */\n\terror?: string\n}\n\n/** A submission result plus the extrinsic's own events, for callers that read per-item outcomes. */\ninterface SubmissionOutcome extends BidSubmissionResult {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tevents?: { event: { section: string; method: string; data: any } }[]\n\t/**\n\t * The extrinsic reached the pool under this account's nonce and was still there when the watch\n\t * timed out — the one flavour of `pending` a replacement can act on, as opposed to a rejection\n\t * that bounced off a copy already pooled. Internal to the retry loop; callers see `pending`.\n\t */\n\tstalled?: boolean\n}\n\nexport interface PollPhantomOrdersOptions {\n\t/** How often to check for a new head. Defaults to 15s, or 6s when the runtime is Gargantua. */\n\tintervalMs?: number\n\t/**\n\t * Most blocks scanned in a single poll, so a long outage catches up over several ticks instead of\n\t * one unbounded scan. Defaults to 500.\n\t */\n\tmaxBlocksPerPoll?: number\n\t/**\n\t * How many blocks before the current head to start from on the first poll. Defaults to 0 (start\n\t * at the head). Set this to the runtime's bid window to have a restarting process pick up orders\n\t * whose window is still open.\n\t */\n\tlookbackBlocks?: number\n\t/** Notified when a poll fails; polling continues regardless. */\n\tonError?: (err: unknown) => void\n}\n\n/**\n * Service for interacting with Hyperbridge's pallet-intents coprocessor.\n * Handles bid submission and retrieval for the IntentGatewayV2 protocol.\n *\n * Can be created from an existing SubstrateChain instance to share the connection.\n */\nexport class IntentsCoprocessor {\n\t/** Cached result of whether the node exposes intents_* RPC methods */\n\tprivate hasIntentsRpc: boolean | null = null\n\n\t/** The HTTP-backed api, connected on first use. Cleared after a failed attempt so it retries. */\n\tprivate httpApi: Promise<ApiPromise> | null = null\n\n\t// Serialises every extrinsic submission on this instance's substrate account. All submit/retract\n\t// methods funnel through signAndSendExtrinsic, each using the API's auto-nonce; fired in parallel\n\t// (bids for orders on different chains, or several phantom orders in one interval) they would grab\n\t// the same nonce and all but one would fail. Concurrency 1 sequences them.\n\tprivate submissionQueue = new PQueue({ concurrency: 1 })\n\n\t/**\n\t * Creates and connects an IntentsCoprocessor to a Hyperbridge node.\n\t * This creates and manages its own API connection.\n\t *\n\t * @param wsUrl - WebSocket URL of the Hyperbridge node\n\t * @param substratePrivateKey - Private key for signing extrinsics (optional for read-only operations)\n\t * @returns Promise resolving to a connected IntentsCoprocessor\n\t */\n\tstatic async connect(wsUrl: string, substratePrivateKey?: string): Promise<IntentsCoprocessor> {\n\t\tconst api = await ApiPromise.create({\n\t\t\tprovider: new WsProvider(wsUrl),\n\t\t\ttypesBundle: HYPERBRIDGE_TYPES_BUNDLE,\n\t\t})\n\t\treturn new IntentsCoprocessor(api, substratePrivateKey, true)\n\t}\n\n\t/**\n\t * Creates an IntentsCoprocessor from an existing SubstrateChain instance.\n\t * This shares the connection - the SubstrateChain must already be connected.\n\t *\n\t * @param chain - Connected SubstrateChain instance (typically Hyperbridge)\n\t * @param substratePrivateKey - Private key for signing extrinsics (optional for read-only operations)\n\t */\n\tstatic fromSubstrateChain(chain: SubstrateChain, substratePrivateKey?: string): IntentsCoprocessor {\n\t\tif (!chain.api) {\n\t\t\tthrow new Error(\"SubstrateChain must be connected before creating IntentsCoprocessor\")\n\t\t}\n\t\treturn new IntentsCoprocessor(chain.api, substratePrivateKey, false)\n\t}\n\n\t/**\n\t * Creates an IntentsCoprocessor from an existing ApiPromise instance.\n\t *\n\t * @param api - Connected ApiPromise instance\n\t * @param substratePrivateKey - Private key for signing extrinsics (optional for read-only operations)\n\t */\n\tstatic fromApi(api: ApiPromise, substratePrivateKey?: string): IntentsCoprocessor {\n\t\treturn new IntentsCoprocessor(api, substratePrivateKey, false)\n\t}\n\n\tprivate constructor(\n\t\tprivate api: ApiPromise,\n\t\tprivate substratePrivateKey?: string,\n\t\tprivate ownsConnection: boolean = false,\n\t) {}\n\n\t/**\n\t * The API every RPC query runs on: HTTP, connected to the same node as the websocket. Exposed so\n\t * callers query through this connection rather than opening one of their own.\n\t *\n\t * The split is by what each transport is for. Queries are one-shot request/response, which HTTP\n\t * serves without holding any state that can silently rot between calls. The websocket earns its\n\t * keep only where subscriptions do — watching a submitted extrinsic to inclusion.\n\t */\n\tasync queryApi(): Promise<ApiPromise> {\n\t\treturn await this.http()\n\t}\n\n\t/**\n\t * The websocket API, exposed so callers share this one connection instead of opening a second\n\t * socket to the same node. Only needed for subscriptions; use {@link queryApi} to read.\n\t */\n\tget apiConnection(): ApiPromise {\n\t\treturn this.api\n\t}\n\n\t/**\n\t * Disconnects the underlying API connection if this instance owns it.\n\t * Only disconnects the websocket if created via `connect()`, not when using shared connections.\n\t * The HTTP api is always created here, so it is always ours to close.\n\t */\n\tasync disconnect(): Promise<void> {\n\t\tconst http = this.httpApi\n\t\tthis.httpApi = null\n\t\tif (http) {\n\t\t\t// A creation that never settled must not turn shutdown into an unhandled rejection.\n\t\t\tawait http.then((api) => api.disconnect()).catch(() => {})\n\t\t}\n\t\tif (this.ownsConnection) {\n\t\t\tawait this.api.disconnect()\n\t\t}\n\t}\n\n\t/**\n\t * The HTTP api for this node, connected on first use. Every coprocessor has one — the endpoint\n\t * is derived from the websocket's own endpoint, so there is nothing to configure and nothing to\n\t * be absent.\n\t *\n\t * The connection attempt is bounded on both sides. `isReadyOrError` rejects on a failed\n\t * handshake, where plain `isReady` would simply never resolve, and the timeout covers an\n\t * endpoint that accepts the request and then goes quiet. An unbounded wait here would hang the\n\t * poll tick awaiting it, which is precisely the silent stall that polling exists to avoid. A\n\t * failed attempt is not cached, so the next call tries again.\n\t */\n\tprivate async http(): Promise<ApiPromise> {\n\t\tif (!this.httpApi) {\n\t\t\tconst httpUrl = deriveHttpUrl(this.wsEndpoint())\n\t\t\tconst api = new ApiPromise({\n\t\t\t\tprovider: new HttpProvider(httpUrl),\n\t\t\t\ttypesBundle: HYPERBRIDGE_TYPES_BUNDLE,\n\t\t\t\t// A second connection to the node the ws api already reported on; its init warnings\n\t\t\t\t// would just be duplicates.\n\t\t\t\tnoInitWarn: true,\n\t\t\t})\n\t\t\tthis.httpApi = Promise.race([\n\t\t\t\tapi.isReadyOrError,\n\t\t\t\trejectAfter(HTTP_CONNECT_TIMEOUT_MS, `HTTP RPC ${httpUrl} did not become ready`),\n\t\t\t]).catch(async (err) => {\n\t\t\t\t// Nothing else holds this half-open api; leaving it would keep retrying underneath.\n\t\t\t\tawait api.disconnect().catch(() => {})\n\t\t\t\tthis.httpApi = null\n\t\t\t\t// polkadot-js reports a failed init as a bare \"fetch failed\", which says nothing\n\t\t\t\t// about where it was fetching from.\n\t\t\t\tthrow new Error(`HTTP RPC ${httpUrl} is unavailable: ${err instanceof Error ? err.message : err}`)\n\t\t\t})\n\t\t}\n\t\treturn await this.httpApi\n\t}\n\n\t/**\n\t * The endpoint the websocket provider is connected to. Read from the provider rather than\n\t * remembered from a constructor argument, so it is the one endpoint in use no matter which\n\t * factory built this instance.\n\t */\n\tprivate wsEndpoint(): string {\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tconst endpoint = ((this.api as any)._rpcCore?.provider as { endpoint?: string } | undefined)?.endpoint\n\t\tif (!endpoint) {\n\t\t\tthrow new Error(\"Cannot determine the Hyperbridge websocket endpoint to derive an HTTP endpoint from\")\n\t\t}\n\t\treturn endpoint\n\t}\n\n\t/**\n\t * Creates a Substrate keypair from the configured private key.\n\t * Supports hex seed (with or without 0x), mnemonic phrases, and URI derivation paths (//Alice).\n\t */\n\tpublic getKeyPair(): KeyringPair {\n\t\tif (!this.substratePrivateKey) {\n\t\t\tthrow new Error(\"Substrate PrivateKey Required\")\n\t\t}\n\n\t\tconst keyring = new Keyring({ type: \"sr25519\" })\n\n\t\tif (this.substratePrivateKey.startsWith(\"//\")) {\n\t\t\treturn keyring.addFromUri(this.substratePrivateKey)\n\t\t}\n\t\tif (this.substratePrivateKey.includes(\" \")) {\n\t\t\treturn keyring.addFromMnemonic(this.substratePrivateKey)\n\t\t}\n\t\tconst hex = this.substratePrivateKey.startsWith(\"0x\")\n\t\t\t? this.substratePrivateKey.slice(2)\n\t\t\t: this.substratePrivateKey\n\t\tconst seedBytes = Buffer.from(hex, \"hex\")\n\t\treturn keyring.addFromSeed(seedBytes)\n\t}\n\n\t/**\n\t * Signs and sends an extrinsic. Submissions are serialised through {@link submissionQueue} so\n\t * concurrent calls never collide on the substrate account nonce — each extrinsic reaches a block\n\t * (or is confirmed still pooled and returned as `pending`) before the next is signed. The\n\t * auto-nonce is the account's on-chain nonce, so a still-pooled extrinsic does not advance it: a\n\t * submission signed behind a pending one bounces off it (1013/1014) and is reported as pending\n\t * too, rather than landing as a second copy.\n\t *\n\t * The extrinsic is built rather than passed in because the api it is built on decides where it\n\t * is signed and sent: a websocket that is down when the queue reaches this submission diverts it\n\t * to {@link sendViaHttp}, which needs the call bound to the HTTP api instead.\n\t */\n\tprivate async signAndSendExtrinsic(\n\t\tbuild: ExtrinsicBuilder,\n\t\tmaxRetries: number = 3,\n\t\ttimeoutMs: number = INCLUSION_TIMEOUT_MS,\n\t): Promise<SubmissionOutcome> {\n\t\tconst result = await this.submissionQueue.add(async () => {\n\t\t\t// Checked here, not at call time: the queue may have held this submission for a while.\n\t\t\tif (!this.api.isConnected) {\n\t\t\t\ttry {\n\t\t\t\t\treturn await this.sendViaHttp(await this.http(), build)\n\t\t\t\t} catch (err) {\n\t\t\t\t\treturn { success: false, error: err instanceof Error ? err.message : String(err) }\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn await this.sendExtrinsicWithRetries(build(this.api), maxRetries, timeoutMs)\n\t\t})\n\t\treturn result ?? { success: false, error: \"Submission queue returned no result\" }\n\t}\n\n\t/**\n\t * Last-resort submission for when the websocket is down at signing time. A bid is only worth\n\t * anything inside its window, so waiting for a reconnect usually means not bidding at all.\n\t *\n\t * HTTP has no subscriptions, so this is `author_submitExtrinsic`: the node accepts the extrinsic\n\t * into its pool and returns its hash, and nothing further is observable from here. That is\n\t * exactly the `pending` contract — in flight, outcome unknown, do not re-sign — so the result\n\t * says so rather than claiming a success it cannot see.\n\t *\n\t * Only reached when the socket was already down before signing. A submission that got as far as\n\t * the pool over the websocket is never retried here: that is the duplicate-nonce race the\n\t * `pending` result exists to prevent.\n\t */\n\tprivate async sendViaHttp(api: ApiPromise, build: ExtrinsicBuilder): Promise<BidSubmissionResult> {\n\t\ttry {\n\t\t\tconst hash = await build(api).signAndSend(this.getKeyPair(), { tip: BASE_TIP })\n\t\t\treturn { success: false, pending: true, extrinsicHash: hash.toHex() as HexString }\n\t\t} catch (err) {\n\t\t\treturn this.classifySubmissionError(err instanceof Error ? err : new Error(String(err)))\n\t\t}\n\t}\n\n\t/**\n\t * Signs and sends an extrinsic, handling status updates and errors.\n\t * Implements retry logic with progressive tip increases for stuck transactions.\n\t *\n\t * Two kinds of failure are retried, and the difference is the nonce.\n\t *\n\t * An attempt that verifiably went nowhere (rejected before the pool, dropped, invalid) leaves\n\t * the account nonce free, so the next attempt simply re-signs with the auto-nonce.\n\t *\n\t * An attempt that reached the pool and was still there when the watch timed out (`stalled`) is\n\t * retried as a *replacement*: the same nonce it was signed with, and double the tip. Substrate's\n\t * pool evicts a pooled extrinsic in favour of a higher-priority one at the same (account, nonce),\n\t * so exactly one of the two can ever execute. This matters for a bid, which is worth nothing once\n\t * its window closes — waiting out a stalled extrinsic usually means not bidding at all.\n\t *\n\t * Re-signing without pinning the nonce is what must never happen here. The auto-nonce is read\n\t * from on-chain state, so it is only the stalled extrinsic's nonce for as long as that extrinsic\n\t * stays out of a block — and a stall is precisely the case where it may land at any moment. Once\n\t * it does, an unpinned retry takes the *next* nonce and both execute: a duplicate `placeBid` that\n\t * fails on-chain, and a second `retractBid` that pulls the bid just placed. When the signed nonce\n\t * cannot be read, the stalled result is returned rather than guessed at.\n\t *\n\t * A rejection that bounced off a copy already pooled (1013/1014) is likewise left alone: that\n\t * copy is in flight and its outcome is unknown here, so the `pending` result goes back to the\n\t * caller to confirm later.\n\t */\n\tprivate async sendExtrinsicWithRetries(\n\t\textrinsic: SubmittableExtrinsic<\"promise\">,\n\t\tmaxRetries: number,\n\t\ttimeoutMs: number,\n\t): Promise<SubmissionOutcome> {\n\t\tconst keyPair = this.getKeyPair()\n\t\tlet attempt = 0\n\t\t// Set once an attempt stalls in the pool, so every later attempt replaces it instead of\n\t\t// queueing behind it.\n\t\tlet nonce: number | undefined\n\t\tlet stalled: SubmissionOutcome | undefined\n\n\t\twhile (attempt < maxRetries) {\n\t\t\tconst currentTip = BASE_TIP * BigInt(2 ** attempt) // Double tip on each retry\n\t\t\tattempt++\n\n\t\t\ttry {\n\t\t\t\tconst result = await this.sendWithTimeout(extrinsic, keyPair, currentTip, timeoutMs, nonce)\n\t\t\t\tif (result.success || result.error?.includes(\"Dispatch error\")) {\n\t\t\t\t\t// Return immediately on success or dispatch errors (non-recoverable)\n\t\t\t\t\treturn result\n\t\t\t\t}\n\t\t\t\tif (result.stalled) {\n\t\t\t\t\tstalled = result\n\t\t\t\t\tnonce ??= this.signedNonce(extrinsic)\n\t\t\t\t\t// Without the nonce the extrinsic went out under, a retry cannot be a replacement.\n\t\t\t\t\tif (nonce === undefined) return result\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t// A copy of this nonce is already pooled — in flight, not ours to replace. When that\n\t\t\t\t// copy is the attempt that stalled here, its own result is the one to report: it\n\t\t\t\t// carries the extrinsic hash the caller would look up.\n\t\t\t\tif (result.pending) return stalled ?? result\n\t\t\t} catch (err) {\n\t\t\t\t// Unexpected error. A stalled extrinsic is still in flight whatever went wrong on\n\t\t\t\t// this attempt, so it is reported as pending rather than as a failure.\n\t\t\t\treturn (\n\t\t\t\t\tstalled ?? {\n\t\t\t\t\t\tsuccess: false,\n\t\t\t\t\t\terror: err instanceof Error ? err.message : \"Unknown error\",\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\n\t\t// A stalled extrinsic that outlived every bump is still in flight, so it is reported as\n\t\t// pending — the caller must not re-sign it.\n\t\treturn (\n\t\t\tstalled ?? {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: `Transaction failed after ${maxRetries} attempts`,\n\t\t\t}\n\t\t)\n\t}\n\n\t/**\n\t * The nonce an extrinsic was signed with, or undefined if it carries no readable one — which is\n\t * the case before it has ever been signed, and for a stub api in tests.\n\t */\n\tprivate signedNonce(extrinsic: SubmittableExtrinsic<\"promise\">): number | undefined {\n\t\ttry {\n\t\t\tconst nonce = (extrinsic as unknown as { nonce?: { toNumber?: () => number } }).nonce?.toNumber?.()\n\t\t\treturn typeof nonce === \"number\" && Number.isFinite(nonce) ? nonce : undefined\n\t\t} catch {\n\t\t\treturn undefined\n\t\t}\n\t}\n\n\t/**\n\t * Classifies a submission rejection. Codes 1013 (\"already imported\") and 1014 (\"priority is\n\t * too low\") both mean a copy of this account+nonce is already in the pool — almost always our\n\t * own earlier attempt whose watch handle didn't confirm cleanly. That extrinsic is in flight;\n\t * resubmitting can only bounce again or land a duplicate, so these are surfaced as `pending`\n\t * rather than failure.\n\t */\n\tprivate classifySubmissionError(err: Error): BidSubmissionResult {\n\t\tconst code = (err as { code?: number }).code\n\t\tconst inFlight =\n\t\t\tcode === 1013 ||\n\t\t\tcode === 1014 ||\n\t\t\t/already imported|already in the pool|priority is too low/i.test(err.message)\n\t\treturn { success: false, pending: inFlight || undefined, error: err.message }\n\t}\n\n\t/**\n\t * Sends an extrinsic with a timeout.\n\t *\n\t * A timeout is only a failure when the extrinsic never made it into the transaction pool.\n\t * Once a pool-entry status (Future/Ready/Broadcast/Retracted) has been seen, the extrinsic is\n\t * in flight and may well execute after the watch is abandoned — the result is then `pending`\n\t * and `stalled`, telling the caller to replace it under the same nonce or confirm it later,\n\t * never to re-sign the same call under a fresh one.\n\t *\n\t * `nonce` pins the submission to a specific account nonce, which is what makes a retry a pool\n\t * replacement rather than a second extrinsic queued behind the first. Left undefined on the\n\t * first attempt, where the api's auto-nonce is correct.\n\t */\n\tprivate async sendWithTimeout(\n\t\textrinsic: SubmittableExtrinsic<\"promise\">,\n\t\tkeyPair: KeyringPair,\n\t\ttip: bigint,\n\t\ttimeoutMs: number,\n\t\tnonce?: number,\n\t): Promise<SubmissionOutcome> {\n\t\treturn new Promise<SubmissionOutcome>((resolve) => {\n\t\t\tlet resolved = false\n\t\t\tlet unsubscribe: (() => void) | null = null\n\t\t\tlet enteredPool = false\n\n\t\t\t// Set timeout to detect stuck transactions\n\t\t\tconst timeoutId = setTimeout(() => {\n\t\t\t\tif (!resolved) {\n\t\t\t\t\tresolved = true\n\t\t\t\t\tif (unsubscribe) {\n\t\t\t\t\t\tunsubscribe()\n\t\t\t\t\t}\n\t\t\t\t\tresolve({\n\t\t\t\t\t\tsuccess: false,\n\t\t\t\t\t\tpending: enteredPool || undefined,\n\t\t\t\t\t\tstalled: enteredPool || undefined,\n\t\t\t\t\t\textrinsicHash: enteredPool ? (extrinsic.hash.toHex() as HexString) : undefined,\n\t\t\t\t\t\terror: `Transaction timed out after ${timeoutMs}ms${enteredPool ? \" while in the transaction pool\" : \"\"}`,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}, timeoutMs)\n\n\t\t\textrinsic\n\t\t\t\t.signAndSend(keyPair, nonce === undefined ? { tip } : { tip, nonce }, (result) => {\n\t\t\t\t\tif (resolved) return\n\n\t\t\t\t\tif (\n\t\t\t\t\t\tresult.status.isFuture ||\n\t\t\t\t\t\tresult.status.isReady ||\n\t\t\t\t\t\tresult.status.isBroadcast ||\n\t\t\t\t\t\tresult.status.isRetracted\n\t\t\t\t\t) {\n\t\t\t\t\t\tenteredPool = true\n\t\t\t\t\t}\n\n\t\t\t\t\tif (result.dispatchError && (result.status.isInBlock || result.status.isFinalized)) {\n\t\t\t\t\t\tresolved = true\n\t\t\t\t\t\tclearTimeout(timeoutId)\n\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\tsuccess: false,\n\t\t\t\t\t\t\terror: `Dispatch error: ${this.describeDispatchError(result.dispatchError)}`,\n\t\t\t\t\t\t})\n\t\t\t\t\t} else if (\n\t\t\t\t\t\tresult.status.isDropped ||\n\t\t\t\t\t\tresult.status.isInvalid ||\n\t\t\t\t\t\tresult.status.isUsurped ||\n\t\t\t\t\t\tresult.status.isFinalityTimeout\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Pool-level terminal statuses — don't retry, let caller decide\n\t\t\t\t\t\tresolved = true\n\t\t\t\t\t\tclearTimeout(timeoutId)\n\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\tsuccess: false,\n\t\t\t\t\t\t\terror: `Transaction ${result.status.type.toLowerCase()}`,\n\t\t\t\t\t\t})\n\t\t\t\t\t} else if (result.status.isInBlock || result.status.isFinalized) {\n\t\t\t\t\t\tresolved = true\n\t\t\t\t\t\tclearTimeout(timeoutId)\n\n\t\t\t\t\t\t// A utility.batch extrinsic is itself `Ok` even when one of its calls fails: the\n\t\t\t\t\t\t// failure surfaces as a BatchInterrupted event, NOT a top-level dispatchError.\n\t\t\t\t\t\t// BatchInterrupted { index, error } means calls [0, index) succeeded and the call\n\t\t\t\t\t\t// at `index` failed (the rest are skipped). We order batches so the primary call\n\t\t\t\t\t\t// is first, so an interruption at index 0 means nothing meaningful landed -> report\n\t\t\t\t\t\t// failure. A later index means the primary call succeeded and only a trailing\n\t\t\t\t\t\t// best-effort call (e.g. a deposit retraction) was skipped, which is still success.\n\t\t\t\t\t\tconst interrupted = result.events.find(\n\t\t\t\t\t\t\t({ event }) => event.section === \"utility\" && event.method === \"BatchInterrupted\",\n\t\t\t\t\t\t)\n\t\t\t\t\t\tif (interrupted) {\n\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\t\t\tconst [indexCodec, dispatchError] = interrupted.event.data as any\n\t\t\t\t\t\t\tif (Number(indexCodec.toString()) === 0) {\n\t\t\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\t\t\tsuccess: false,\n\t\t\t\t\t\t\t\t\terror: `Dispatch error: ${this.describeDispatchError(dispatchError)}`,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\tsuccess: true,\n\t\t\t\t\t\t\tblockHash: (result.status.isInBlock\n\t\t\t\t\t\t\t\t? result.status.asInBlock\n\t\t\t\t\t\t\t\t: result.status.asFinalized\n\t\t\t\t\t\t\t).toHex() as HexString,\n\t\t\t\t\t\t\textrinsicHash: extrinsic.hash.toHex() as HexString,\n\t\t\t\t\t\t\t// Carried so a batch caller can attribute each item's outcome.\n\t\t\t\t\t\t\tevents: result.events,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.then((unsub) => {\n\t\t\t\t\tif (resolved) {\n\t\t\t\t\t\tunsub()\n\t\t\t\t\t} else {\n\t\t\t\t\t\tunsubscribe = unsub\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.catch((err: Error) => {\n\t\t\t\t\tif (!resolved) {\n\t\t\t\t\t\tresolved = true\n\t\t\t\t\t\tclearTimeout(timeoutId)\n\t\t\t\t\t\tresolve(this.classifySubmissionError(err))\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t})\n\t}\n\n\t/**\n\t * Submits a bid to Hyperbridge's pallet-intents\n\t *\n\t * @param commitment - The order commitment hash (bytes32)\n\t * @param userOp - The encoded PackedUserOperation as hex string\n\t * @returns BidSubmissionResult with success status and block/extrinsic hash\n\t */\n\tasync submitBid(commitment: HexString, userOp: HexString): Promise<BidSubmissionResult> {\n\t\ttry {\n\t\t\treturn await this.signAndSendExtrinsic((api) => api.tx.intentsCoprocessor.placeBid(commitment, userOp))\n\t\t} catch (error) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: error instanceof Error ? error.message : \"Unknown error\",\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Retracts a bid from Hyperbridge and reclaims the deposit\n\t *\n\t * Use this to remove unused quotes and claim back deposited BRIDGE tokens.\n\t *\n\t * @param commitment - The order commitment hash (bytes32)\n\t * @returns BidSubmissionResult with success status and block/extrinsic hash\n\t */\n\tasync retractBid(commitment: HexString): Promise<BidSubmissionResult> {\n\t\ttry {\n\t\t\treturn await this.signAndSendExtrinsic((api) => api.tx.intentsCoprocessor.retractBid(commitment))\n\t\t} catch (error) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: error instanceof Error ? error.message : \"Unknown error\",\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Places a new bid and retracts a previous one in a single transaction via utility.batch.\n\t *\n\t * The new bid is the primary operation, so `placeBid` MUST run first. `utility.batch` is\n\t * non-atomic: a failing call interrupts the batch (via a BatchInterrupted event) without\n\t * reverting the calls that already succeeded. Placing first guarantees the new bid lands even\n\t * when the retraction then fails — which it routinely does, because a previous commitment's bid\n\t * may already be gone (or was itself never placed), making `retractBid` return `BidNotFound`.\n\t *\n\t * Ordering retraction first (the previous behaviour) caused a self-sustaining cascade: a\n\t * `BidNotFound` on the leading retract skipped the trailing `placeBid`, so the current bid never\n\t * landed, so the *next* interval's retract of that never-placed commitment also failed, and so\n\t * on — silently, because the batch extrinsic itself reports success. The deposit reclaim is\n\t * best-effort; landing the bid is not.\n\t *\n\t * @param retractCommitment - The order commitment of the bid to retract (bytes32)\n\t * @param bidCommitment - The order commitment of the new bid (bytes32)\n\t * @param userOp - The encoded PackedUserOperation as hex string\n\t * @returns BidSubmissionResult with success status and block/extrinsic hash\n\t */\n\tasync submitBidWithRetraction(\n\t\tretractCommitment: HexString,\n\t\tbidCommitment: HexString,\n\t\tuserOp: HexString,\n\t): Promise<BidSubmissionResult> {\n\t\ttry {\n\t\t\treturn await this.signAndSendExtrinsic((api) =>\n\t\t\t\tapi.tx.utility.batch([\n\t\t\t\t\tapi.tx.intentsCoprocessor.placeBid(bidCommitment, userOp),\n\t\t\t\t\tapi.tx.intentsCoprocessor.retractBid(retractCommitment),\n\t\t\t\t]),\n\t\t\t)\n\t\t} catch (error) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: error instanceof Error ? error.message : \"Unknown error\",\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Places every phantom bid of one interval in a single extrinsic, retracting each chain's\n\t * previous bid alongside it.\n\t *\n\t * The pallet registers one phantom order per configured chain in the same block, so this is the\n\t * whole interval's set. Submitting them one at a time costs a block per chain: submissions are\n\t * serialised on the account nonce and each waits for inclusion, so the last chain's bid is many\n\t * blocks behind the first, against a bid window measured in tens of blocks. Batched, every bid\n\t * lands in the same block.\n\t *\n\t * Uses `utility.force_batch`, not `utility.batch`. `batch` stops at the first failing call, so\n\t * one rejected bid — a closed window, a duplicate, an insufficient deposit — would silently\n\t * drop every bid after it. `force_batch` runs them all and reports each outcome. It needs no\n\t * special origin: any signed account may call it, exactly like `batch`.\n\t *\n\t * @param bids - The bids to place; an empty list is a no-op\n\t * @returns Per-bid outcomes, in the order given\n\t */\n\tasync submitPhantomBids(bids: PhantomBid[]): Promise<PhantomBidBatchResult> {\n\t\tif (bids.length === 0) return { bids: [] }\n\n\t\t// Call order is the only key the item events give us, so record where each bid's placeBid\n\t\t// sits as the calls are built.\n\t\tconst placeIndexByBid: number[] = []\n\t\tlet callCount = 0\n\t\tfor (const bid of bids) {\n\t\t\tplaceIndexByBid.push(callCount)\n\t\t\tcallCount += bid.retractCommitment ? 2 : 1\n\t\t}\n\n\t\tconst outcome = await this.signAndSendExtrinsic((api) =>\n\t\t\tapi.tx.utility.forceBatch(\n\t\t\t\tbids.flatMap((bid) => {\n\t\t\t\t\tconst calls = [api.tx.intentsCoprocessor.placeBid(bid.commitment, bid.userOp)]\n\t\t\t\t\t// Placed first so the pairing reads the same as the call order; with force_batch\n\t\t\t\t\t// the ordering no longer decides whether the bid survives a failed retraction.\n\t\t\t\t\tif (bid.retractCommitment) {\n\t\t\t\t\t\tcalls.push(api.tx.intentsCoprocessor.retractBid(bid.retractCommitment))\n\t\t\t\t\t}\n\t\t\t\t\treturn calls\n\t\t\t\t}),\n\t\t\t),\n\t\t)\n\n\t\tif (!outcome.success) {\n\t\t\t// Nothing landed, so there is nothing to attribute: every bid shares the batch's fate.\n\t\t\treturn {\n\t\t\t\tbids: bids.map((bid) => ({ commitment: bid.commitment, success: false, error: outcome.error })),\n\t\t\t\tpending: outcome.pending,\n\t\t\t\textrinsicHash: outcome.extrinsicHash,\n\t\t\t\terror: outcome.error,\n\t\t\t}\n\t\t}\n\n\t\tconst items = this.readForceBatchItems(outcome.events ?? [], callCount)\n\n\t\treturn {\n\t\t\tbids: bids.map((bid, index) => {\n\t\t\t\tconst error = items.errors[placeIndexByBid[index]]\n\t\t\t\treturn { commitment: bid.commitment, success: !error, error }\n\t\t\t}),\n\t\t\tblockHash: outcome.blockHash,\n\t\t\textrinsicHash: outcome.extrinsicHash,\n\t\t\terror: items.error,\n\t\t}\n\t}\n\n\t/**\n\t * Reads one outcome per call out of a force_batch's events.\n\t *\n\t * `ItemFailed` carries no index — pallet-utility emits exactly one `ItemCompleted` or\n\t * `ItemFailed` per call, in call order, so the k-th item event belongs to call k.\n\t *\n\t * A count that does not match the calls submitted means the events are not the ones assumed\n\t * here, and every attribution after the discrepancy would be off by one. The bids are then\n\t * reported as placed: a bid wrongly recorded as landed is retracted next interval and the\n\t * retraction harmlessly fails with `BidNotFound`, whereas one wrongly recorded as failed is\n\t * never retracted at all and leaves its deposit reserved.\n\t */\n\tprivate readForceBatchItems(\n\t\tevents: NonNullable<SubmissionOutcome[\"events\"]>,\n\t\tcallCount: number,\n\t): { errors: (string | undefined)[]; error?: string } {\n\t\tconst errors: (string | undefined)[] = []\n\t\tfor (const { event } of events) {\n\t\t\tif (event.section !== \"utility\") continue\n\t\t\tif (event.method === \"ItemCompleted\") errors.push(undefined)\n\t\t\telse if (event.method === \"ItemFailed\") errors.push(this.describeDispatchError(event.data[0]))\n\t\t}\n\n\t\tif (errors.length !== callCount) {\n\t\t\treturn {\n\t\t\t\terrors: new Array(callCount).fill(undefined),\n\t\t\t\terror: `force_batch reported ${errors.length} item events for ${callCount} calls; outcomes not attributed`,\n\t\t\t}\n\t\t}\n\t\treturn { errors }\n\t}\n\n\t/** Renders a DispatchError as `pallet::Error`, falling back to its raw form. */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tprivate describeDispatchError(dispatchError: any): string {\n\t\tif (dispatchError?.isModule) {\n\t\t\tconst decoded = this.api.registry.findMetaError(dispatchError.asModule)\n\t\t\treturn `${decoded.section}::${decoded.name}`\n\t\t}\n\t\treturn dispatchError?.toString() ?? \"unknown dispatch error\"\n\t}\n\n\t/**\n\t * Fetches all bid storage entries for a given order commitment.\n\t * Returns the on-chain data only (filler addresses and deposits).\n\t *\n\t * @param commitment - The order commitment hash (bytes32)\n\t * @returns Array of BidStorageEntry objects\n\t */\n\tasync getBidStorageEntries(commitment: HexString): Promise<BidStorageEntry[]> {\n\t\tconst api = await this.http()\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tconst entries = await (api.query.intentsCoprocessor.bids as any).entries(commitment)\n\n\t\treturn entries.map(([storageKey, depositValue]: [any, any]) => ({\n\t\t\tcommitment,\n\t\t\tfiller: storageKey.args[1].toString() as string,\n\t\t\tdeposit: BigInt(depositValue.toString()),\n\t\t}))\n\t}\n\n\t/**\n\t * Fetches all bids for a given order commitment from Hyperbridge.\n\t *\n\t * Uses the custom intents_getBidsForOrder RPC if available on the node\n\t * for a single round-trip. Falls back to parallel storage + offchain\n\t * lookups otherwise.\n\t *\n\t * @param commitment - The order commitment hash (bytes32)\n\t * @returns Array of FillerBid objects containing filler address, userOp, and deposit\n\t */\n\tasync getBidsForOrder(commitment: HexString): Promise<FillerBid[]> {\n\t\ttry {\n\t\t\treturn await this.getBidsViaRpc(commitment)\n\t\t} catch (err) {\n\t\t\tconsole.warn(\"intents RPC failed, falling back to storage queries:\", err)\n\t\t}\n\n\t\treturn await this.getBidsViaStorage(commitment)\n\t}\n\n\t/**\n\t * Fetches bids using the custom intents_getBidsForOrder RPC.\n\t * Single round-trip but does not include deposit amounts.\n\t */\n\tprivate async getBidsViaRpc(commitment: HexString): Promise<FillerBid[]> {\n\t\tconst api = await this.http()\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tconst result: RpcBidInfo[] = await (api as any)._rpcCore.provider.send(\"intents_getBidsForOrder\", [commitment])\n\n\t\treturn result.map((entry) => {\n\t\t\tconst userOp = decodeUserOpScale(entry.user_op as HexString)\n\t\t\tconst filler = new Keyring({ type: \"sr25519\" }).encodeAddress(hexToU8a(entry.filler))\n\t\t\treturn { filler, userOp, deposit: 0n }\n\t\t})\n\t}\n\n\t/**\n\t * Fetches bids using on-chain storage entries + parallel offchain lookups.\n\t * Slower but works on all nodes and includes deposit amounts.\n\t */\n\tprivate async getBidsViaStorage(commitment: HexString): Promise<FillerBid[]> {\n\t\tconst api = await this.http()\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tconst entries = await (api.query.intentsCoprocessor.bids as any).entries(commitment)\n\n\t\tif (entries.length === 0) return []\n\n\t\tconst bidPromises = entries.map(async ([storageKey, depositValue]: [any, any]) => {\n\t\t\ttry {\n\t\t\t\tconst filler = storageKey.args[1].toString()\n\t\t\t\tconst deposit = BigInt(depositValue.toString())\n\n\t\t\t\tconst offchainKey = this.buildOffchainBidKey(commitment, filler)\n\t\t\t\tconst offchainKeyHex = u8aToHex(offchainKey)\n\n\t\t\t\tconst offchainResult = await api.rpc.offchain.localStorageGet(\"PERSISTENT\", offchainKeyHex)\n\n\t\t\t\tif (!offchainResult || offchainResult.isNone) return null\n\n\t\t\t\tconst bidData = offchainResult.unwrap().toHex() as HexString\n\t\t\t\tconst decoded = this.decodeBid(bidData)\n\n\t\t\t\treturn { filler: decoded.filler, userOp: decoded.userOp, deposit }\n\t\t\t} catch {\n\t\t\t\treturn null\n\t\t\t}\n\t\t})\n\n\t\tconst results = await Promise.all(bidPromises)\n\t\treturn results.filter((b): b is FillerBid => b !== null)\n\t}\n\n\t/** Decodes SCALE-encoded Bid struct and SCALE-encoded PackedUserOperation */\n\tprivate decodeBid(hex: HexString): { filler: string; userOp: PackedUserOperation } {\n\t\tconst decoded = BidCodec.dec(hexToU8a(hex))\n\t\tconst filler = new Keyring({ type: \"sr25519\" }).encodeAddress(new Uint8Array(decoded.filler))\n\t\tconst userOpHex = u8aToHex(new Uint8Array(decoded.user_op)) as HexString\n\n\t\t// Decode UserOp using SCALE codec\n\t\tconst userOp = decodeUserOpScale(userOpHex)\n\n\t\treturn { filler, userOp }\n\t}\n\n\t/** Builds offchain storage key: \"intents::bid::\" + commitment + filler */\n\tprivate buildOffchainBidKey(commitment: HexString, filler: string): Uint8Array {\n\t\treturn u8aConcat(OFFCHAIN_BID_PREFIX, hexToU8a(commitment), decodeAddress(filler))\n\t}\n\n\t/**\n\t * Fetches the ABI-encoded phantom order from offchain storage and decodes it\n\t * into an `Order` object. The pallet writes the order bytes under the key\n\t * `intents::phantom::order::<commitment>` when it calls `on_initialize`.\n\t *\n\t * Returns `null` if the key is absent (e.g. the node is not an offchain worker\n\t * or the commitment has expired and been cleared).\n\t */\n\tasync fetchPhantomOrder(commitment: HexString): Promise<Order | null> {\n\t\tconst key = u8aConcat(OFFCHAIN_PHANTOM_PREFIX, hexToU8a(commitment))\n\t\tconst api = await this.http()\n\t\tconst result = await api.rpc.offchain.localStorageGet(\"PERSISTENT\", u8aToHex(key))\n\t\tif (!result || result.isNone) return null\n\n\t\tconst rawHex = result.unwrap().toHex() as HexString\n\t\tif (rawHex === \"0x\" || rawHex === \"0x00\") return null\n\n\t\tconst placeOrderAbi = (\n\t\t\tIntentGatewayV2.ABI as readonly { type: string; name?: string; inputs?: unknown[] }[]\n\t\t).find((item) => item.type === \"function\" && item.name === \"placeOrder\")\n\t\tconst orderType = placeOrderAbi?.inputs?.[0]\n\t\tif (!orderType) return null\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tconst [decoded] = decodeAbiParameters([orderType as any], rawHex)\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tconst d = decoded as any\n\t\tconst textDecoder = new TextDecoder()\n\n\t\treturn {\n\t\t\tid: commitment,\n\t\t\tuser: d.user as HexString,\n\t\t\tsource: textDecoder.decode(hexToBytes(d.source as HexString)),\n\t\t\tdestination: textDecoder.decode(hexToBytes(d.destination as HexString)),\n\t\t\tdeadline: d.deadline as bigint,\n\t\t\tnonce: d.nonce as bigint,\n\t\t\tfees: d.fees as bigint,\n\t\t\tsession: d.session as HexString,\n\t\t\tpredispatch: {\n\t\t\t\tassets: (d.predispatch.assets as { token: HexString; amount: bigint }[]).map((a) => ({\n\t\t\t\t\ttoken: a.token,\n\t\t\t\t\tamount: a.amount,\n\t\t\t\t})),\n\t\t\t\tcall: d.predispatch.call as HexString,\n\t\t\t},\n\t\t\tinputs: (d.inputs as { token: HexString; amount: bigint }[]).map((i) => ({\n\t\t\t\ttoken: i.token,\n\t\t\t\tamount: i.amount,\n\t\t\t})),\n\t\t\toutput: {\n\t\t\t\tbeneficiary: d.output.beneficiary as HexString,\n\t\t\t\tassets: (d.output.assets as { token: HexString; amount: bigint }[]).map((a) => ({\n\t\t\t\t\ttoken: a.token,\n\t\t\t\t\tamount: a.amount,\n\t\t\t\t})),\n\t\t\t\tcall: d.output.call as HexString,\n\t\t\t},\n\t\t}\n\t}\n\n\t/**\n\t * Reads the PhantomOrderRegistered events emitted in a single block.\n\t */\n\tasync getPhantomOrdersInBlock(blockNumber: number): Promise<PhantomOrderEvent[]> {\n\t\tconst api = await this.http()\n\t\tconst blockHash = await api.rpc.chain.getBlockHash(blockNumber)\n\t\tconst apiAt = await api.at(blockHash)\n\t\tconst records = await apiAt.query.system.events()\n\n\t\tconst orders: PhantomOrderEvent[] = []\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tfor (const { event } of records as unknown as Array<{ event: any }>) {\n\t\t\tif (event.section !== \"intentsCoprocessor\" || event.method !== \"PhantomOrderRegistered\") continue\n\t\t\tconst [commitment, chain, createdAt, legs] = event.data\n\t\t\torders.push({\n\t\t\t\tcommitment: commitment.toHex() as HexString,\n\t\t\t\tchain: new TextDecoder().decode(hexToU8a(chain.toHex())),\n\t\t\t\tcreatedAt: createdAt.toNumber(),\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\tlegs: (legs as any[]).map((leg: any) => ({\n\t\t\t\t\ttokenA: leg.tokenA.toHex() as HexString,\n\t\t\t\t\ttokenB: leg.tokenB.toHex() as HexString,\n\t\t\t\t\tstandardAmount: BigInt(leg.standardAmount.toString()),\n\t\t\t\t})),\n\t\t\t})\n\t\t}\n\t\treturn orders\n\t}\n\n\t/**\n\t * Polls for newly registered phantom orders, invoking the callback once per block that carries\n\t * any, with all of that block's orders.\n\t *\n\t * Per block rather than per order because that is how the pallet writes them: one order per\n\t * configured chain, all registered in the same `on_initialize`. Delivering them together lets a\n\t * caller bid on the whole interval in one extrinsic (see {@link submitPhantomBids}) instead of\n\t * one per chain.\n\t *\n\t * Each tick reads the current head and scans every block between the last one processed and that\n\t * head, so the block cursor — not the connection — determines what has been seen. This replaced a\n\t * system.events subscription, which was only as reliable as its socket: polkadot-js reconnects\n\t * the transport but does not reliably re-establish storage subscriptions, and anything emitted\n\t * while disconnected was lost silently. With a bid window measured in a handful of blocks, that\n\t * meant silently missed bids.\n\t *\n\t * Scanning a block range is gap-free rather than merely self-healing: an outage delays orders but\n\t * cannot drop them, because the cursor only advances past a block whose events were actually\n\t * read. Recovery replays the backlog.\n\t *\n\t * Every read here goes over HTTP, never the websocket. Polling is a sequence of independent\n\t * one-shot requests with no state to lose between them, which is exactly what a stateless\n\t * transport does well: a request either answers or fails loudly on this tick, instead of a\n\t * socket that looks alive while delivering nothing. It also means a websocket outage does not\n\t * pause phantom bidding at all — the two transports fail independently.\n\t *\n\t * Returns a function that stops polling.\n\t */\n\tpollPhantomOrders(\n\t\tcallback: (events: PhantomOrderEvent[]) => void,\n\t\toptions: PollPhantomOrdersOptions = {},\n\t): () => void {\n\t\tconst { intervalMs, maxBlocksPerPoll = 500, lookbackBlocks = 0, onError } = options\n\n\t\t// Last block whose events have been delivered. Null until the first successful head read.\n\t\tlet cursor: number | null = null\n\t\tlet inFlight = false\n\t\tlet stopped = false\n\n\t\tconst tick = async (): Promise<void> => {\n\t\t\t// A scan slower than the interval must not stack up behind itself.\n\t\t\tif (inFlight || stopped) return\n\t\t\tinFlight = true\n\t\t\ttry {\n\t\t\t\tconst head = (await (await this.http()).rpc.chain.getHeader()).number.toNumber()\n\n\t\t\t\tif (cursor === null) {\n\t\t\t\t\t// Start just below the head so the head itself is scanned, less any lookback.\n\t\t\t\t\tcursor = Math.max(head - 1 - lookbackBlocks, -1)\n\t\t\t\t}\n\t\t\t\tif (head <= cursor) return\n\n\t\t\t\tconst to = Math.min(head, cursor + maxBlocksPerPoll)\n\t\t\t\tfor (let blockNumber = cursor + 1; blockNumber <= to; blockNumber++) {\n\t\t\t\t\tif (stopped) return\n\t\t\t\t\tconst orders = await this.getPhantomOrdersInBlock(blockNumber)\n\t\t\t\t\tif (orders.length > 0) callback(orders)\n\t\t\t\t\t// Advance per block, not per range: a failure partway through re-scans only the\n\t\t\t\t\t// blocks that were never read, and never re-delivers ones that were.\n\t\t\t\t\tcursor = blockNumber\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\tonError?.(err)\n\t\t\t} finally {\n\t\t\t\tinFlight = false\n\t\t\t}\n\t\t}\n\n\t\tvoid tick()\n\n\t\t// An explicit cadence starts the timer here and now; only the runtime-derived default has to\n\t\t// wait on the node, and the scan above has already gone out either way.\n\t\tlet timer: ReturnType<typeof setInterval> | null = null\n\t\tconst startTimer = (ms: number) => {\n\t\t\tif (stopped) return\n\t\t\ttimer = setInterval(() => void tick(), ms)\n\t\t}\n\t\tif (intervalMs !== undefined) startTimer(intervalMs)\n\t\telse void this.phantomPollIntervalMs().then(startTimer)\n\n\t\treturn () => {\n\t\t\tstopped = true\n\t\t\tif (timer) clearInterval(timer)\n\t\t}\n\t}\n\n\t/**\n\t * The poll cadence for the runtime this instance is connected to: Gargantua polls every block,\n\t * everything else every 15s. Falls back to the slower cadence if the runtime cannot be read,\n\t * since an unreachable node is the poll's problem to report, not the cadence lookup's.\n\t */\n\tprivate async phantomPollIntervalMs(): Promise<number> {\n\t\ttry {\n\t\t\tconst specName = (await this.http()).runtimeVersion.specName.toString()\n\t\t\treturn specName === \"gargantua\" ? GARGANTUA_PHANTOM_POLL_INTERVAL_MS : PHANTOM_POLL_INTERVAL_MS\n\t\t} catch {\n\t\t\treturn PHANTOM_POLL_INTERVAL_MS\n\t\t}\n\t}\n}\n","export interface ResolvedLiquidityPool<Symbol extends string = string> {\n\tpoolId: string\n\ttoken0Symbol: Symbol\n\ttoken1Symbol: Symbol\n}\n\n/**\n * Canonical symbol order used by the SDK and indexer pool IDs.\n *\n * Plain code-unit comparison, never locale-sensitive collation — the result is\n * a persisted primary key and must sort identically everywhere.\n */\nexport function sortPoolSymbols<Symbol extends string>(symbolA: Symbol, symbolB: Symbol): [Symbol, Symbol] {\n\treturn symbolA.toLowerCase() <= symbolB.toLowerCase() ? [symbolA, symbolB] : [symbolB, symbolA]\n}\n\n/** Canonical indexer pool ID for a pair of canonical token symbols. */\nexport function poolSlug(symbolA: string, symbolB: string): string {\n\treturn sortPoolSymbols(symbolA, symbolB).join(\"-\")\n}\n\nexport function resolveLiquidityPool<Symbol extends string>(\n\tsymbolA: Symbol,\n\tsymbolB: Symbol,\n): ResolvedLiquidityPool<Symbol> {\n\tconst [token0Symbol, token1Symbol] = sortPoolSymbols(symbolA, symbolB)\n\treturn {\n\t\tpoolId: `${token0Symbol}-${token1Symbol}`,\n\t\ttoken0Symbol,\n\t\ttoken1Symbol,\n\t}\n}\n","import {\n\tkeccak256,\n\ttoHex,\n\tencodeAbiParameters,\n\tdecodeAbiParameters,\n\tdecodeFunctionData,\n\tencodeFunctionData,\n\tconcat,\n\tpad,\n\tencodePacked,\n\tparseAbiParameters,\n\ttype Hex,\n} from \"viem\"\nimport { privateKeyToAccount } from \"viem/accounts\"\nimport type { HexString, PackedUserOperation } from \"@/types\"\nimport type { ERC7821Call } from \"@/types\"\nimport ERC7821ABI from \"@/abis/erc7281\"\nimport type { IntentGatewayContext } from \"./types\"\nimport { ERC7821_BATCH_MODE } from \"./types\"\nimport type { BundlerMethod } from \"./types\"\n\n/**\n * EIP-712 type hash for the `SelectSolver` struct.\n *\n * Computed as `keccak256(\"SelectSolver(bytes32 commitment,address solver)\")`.\n * Used when the session key signs a solver-selection message so that the\n * IntentGatewayV2 contract can verify the choice on-chain.\n */\nexport const SELECT_SOLVER_TYPEHASH = keccak256(toHex(\"SelectSolver(bytes32 commitment,address solver)\"))\n\n/**\n * EIP-712 type hash for the `PackedUserOperation` struct.\n *\n * Matches the ERC-4337 v0.8 `PackedUserOperation` type definition used by\n * EntryPoint v0.8. Used when computing the UserOperation hash that solvers\n * must sign before submitting bids.\n */\nexport const PACKED_USEROP_TYPEHASH = keccak256(\n\ttoHex(\n\t\t\"PackedUserOperation(address sender,uint256 nonce,bytes initCode,bytes callData,bytes32 accountGasLimits,uint256 preVerificationGas,bytes32 gasFees,bytes paymasterAndData)\",\n\t),\n)\n\n/**\n * EIP-712 type hash for the `EIP712Domain` struct.\n *\n * Computed as `keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\")`.\n * Used to construct domain separators for all EIP-712 messages in the\n * IntentGatewayV2 protocol.\n */\nexport const DOMAIN_TYPEHASH = keccak256(\n\ttoHex(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"),\n)\n\n/**\n * Crypto and encoding utilities for IntentGatewayV2.\n *\n * Provides helpers for EIP-712 domain separation, UserOperation hashing,\n * gas-limit packing/unpacking, bundler JSON-RPC calls, and ERC-7821\n * batch-execute encoding and decoding. All methods are stateless with respect\n * to the protocol but require the shared {@link IntentGatewayContext} for the\n * bundler URL.\n */\nexport class CryptoUtils {\n\t/**\n\t * @param ctx - Shared IntentsV2 context; used to access the bundler URL for\n\t * JSON-RPC calls.\n\t */\n\tconstructor(private readonly ctx: IntentGatewayContext) {}\n\n\t/**\n\t * Computes an EIP-712 domain separator for a given contract.\n\t *\n\t * @param contractName - Human-readable name of the contract (e.g. `\"IntentGateway\"`).\n\t * @param version - Version string (e.g. `\"2\"`).\n\t * @param chainId - Chain ID of the network the contract is deployed on.\n\t * @param contractAddress - Address of the verifying contract.\n\t * @returns The 32-byte domain separator as a hex string.\n\t */\n\tstatic getDomainSeparator(contractName: string, version: string, chainId: bigint, contractAddress: HexString): HexString {\n\t\treturn keccak256(\n\t\t\tencodeAbiParameters(parseAbiParameters(\"bytes32, bytes32, bytes32, uint256, address\"), [\n\t\t\t\tDOMAIN_TYPEHASH,\n\t\t\t\tkeccak256(toHex(contractName)),\n\t\t\t\tkeccak256(toHex(version)),\n\t\t\t\tchainId,\n\t\t\t\tcontractAddress,\n\t\t\t]),\n\t\t)\n\t}\n\n\t/**\n\t * Signs a `SelectSolver` EIP-712 message with a session key.\n\t *\n\t * The session key authorises the selection of a specific solver for the\n\t * given order commitment. The resulting signature is appended to the\n\t * solver's UserOperation signature before bundle submission.\n\t *\n\t * @param commitment - The order commitment (bytes32) being fulfilled.\n\t * @param solverAddress - Address of the solver account selected to fill the order.\n\t * @param domainSeparator - EIP-712 domain separator for the IntentGatewayV2 contract.\n\t * @param privateKey - Hex-encoded private key of the session key that signs the message.\n\t * @returns The ECDSA signature as a hex string, or `null` if signing fails.\n\t */\n\tstatic async signSolverSelection(\n\t\tcommitment: HexString,\n\t\tsolverAddress: HexString,\n\t\tdomainSeparator: HexString,\n\t\tprivateKey: HexString,\n\t): Promise<HexString | null> {\n\t\tconst account = privateKeyToAccount(privateKey as Hex)\n\n\t\tconst structHash = keccak256(\n\t\t\tencodeAbiParameters(\n\t\t\t\t[{ type: \"bytes32\" }, { type: \"bytes32\" }, { type: \"address\" }],\n\t\t\t\t[SELECT_SOLVER_TYPEHASH, commitment, solverAddress],\n\t\t\t),\n\t\t)\n\n\t\tconst digest = keccak256(concat([\"0x1901\" as Hex, domainSeparator as Hex, structHash]))\n\t\tconst signature = await account.sign({ hash: digest })\n\n\t\treturn signature as HexString\n\t}\n\n\t/**\n\t * Computes the EIP-712 hash of a `PackedUserOperation` as defined by\n\t * ERC-4337 EntryPoint v0.8.\n\t *\n\t * @param userOp - The packed UserOperation to hash.\n\t * @param entryPoint - Address of the EntryPoint v0.8 contract.\n\t * @param chainId - Chain ID of the network on which the operation will execute.\n\t * @returns The UserOperation hash as a hex string.\n\t */\n\tstatic computeUserOpHash(userOp: PackedUserOperation, entryPoint: Hex, chainId: bigint): Hex {\n\t\tconst structHash = CryptoUtils.getPackedUserStructHash(userOp)\n\t\tconst domainSeparator = CryptoUtils.getDomainSeparator(\"ERC4337\", \"1\", chainId, entryPoint as HexString)\n\n\t\treturn keccak256(\n\t\t\tencodePacked([\"bytes1\", \"bytes1\", \"bytes32\", \"bytes32\"], [\"0x19\", \"0x01\", domainSeparator, structHash]),\n\t\t)\n\t}\n\n\t/**\n\t * Derives the ERC-4337 nonce key that binds a bid UserOperation to its\n\t * order and session key: the lower 192 bits of\n\t * `keccak256(commitment ‖ sessionKey)`. `SolverAccount` rejects bid\n\t * operations whose nonce key differs — this is what lets the solver sign\n\t * the plain userOpHash while staying committed to the order and to the\n\t * session key it bid against.\n\t *\n\t * @param commitment - The order commitment (`order.id`).\n\t * @param sessionKey - The order's session key address (`order.session`).\n\t * @returns The 192-bit nonce key as a bigint (pass to `EntryPoint.getNonce`).\n\t */\n\tstatic bidNonceKey(commitment: HexString, sessionKey: HexString): bigint {\n\t\treturn BigInt(keccak256(encodePacked([\"bytes32\", \"address\"], [commitment, sessionKey]))) & ((1n << 192n) - 1n)\n\t}\n\n\t/**\n\t * Builds the EIP-712 typed-data payload whose digest is the EntryPoint v0.8\n\t * `userOpHash` (i.e. `hashTypedData(packedUserOpTypedData(...)) ===\n\t * computeUserOpHash(...)`). Signing this typed data is bit-identical to\n\t * signing the raw userOpHash, but keeps the full operation visible to\n\t * signing infrastructure (hardware wallets, MPC/TEE policy engines) instead\n\t * of an opaque 32-byte digest.\n\t *\n\t * The payload must be a standard self-describing `eth_signTypedData_v4`\n\t * payload — `EIP712Domain` listed in `types`, `chainId` as a JSON number —\n\t * because some signing backends (e.g. MPC Vault) hash it server-side from\n\t * the JSON rather than locally via viem. viem ignores both details when\n\t * hashing, so the digest is unchanged for local signers.\n\t *\n\t * @param userOp - The packed UserOperation to sign (signature field ignored).\n\t * @param entryPoint - Address of the EntryPoint v0.8 contract.\n\t * @param chainId - Chain ID of the network on which the operation will execute.\n\t * @returns A viem `TypedDataDefinition` for the operation.\n\t */\n\tstatic packedUserOpTypedData(userOp: PackedUserOperation, entryPoint: Hex, chainId: bigint) {\n\t\treturn {\n\t\t\tdomain: {\n\t\t\t\tname: \"ERC4337\",\n\t\t\t\tversion: \"1\",\n\t\t\t\t// Runtime number so JSON.stringify emits a canonical v4 numeric chainId for\n\t\t\t\t// server-side hashers; viem's uint256 type mapping wants bigint but its\n\t\t\t\t// runtime accepts numbers, hence the cast.\n\t\t\t\tchainId: Number(chainId) as unknown as bigint,\n\t\t\t\tverifyingContract: entryPoint,\n\t\t\t},\n\t\t\t// `as const`: viem derives the domain's TYPE from `types.EIP712Domain`, so the\n\t\t\t// entries must stay string literals — widened `string` fields make viem's\n\t\t\t// typed-data generics reject the payload at every call site.\n\t\t\ttypes: {\n\t\t\t\tEIP712Domain: [\n\t\t\t\t\t{ name: \"name\", type: \"string\" },\n\t\t\t\t\t{ name: \"version\", type: \"string\" },\n\t\t\t\t\t{ name: \"chainId\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"verifyingContract\", type: \"address\" },\n\t\t\t\t],\n\t\t\t\tPackedUserOperation: [\n\t\t\t\t\t{ name: \"sender\", type: \"address\" },\n\t\t\t\t\t{ name: \"nonce\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"initCode\", type: \"bytes\" },\n\t\t\t\t\t{ name: \"callData\", type: \"bytes\" },\n\t\t\t\t\t{ name: \"accountGasLimits\", type: \"bytes32\" },\n\t\t\t\t\t{ name: \"preVerificationGas\", type: \"uint256\" },\n\t\t\t\t\t{ name: \"gasFees\", type: \"bytes32\" },\n\t\t\t\t\t{ name: \"paymasterAndData\", type: \"bytes\" },\n\t\t\t\t],\n\t\t\t} as const,\n\t\t\tprimaryType: \"PackedUserOperation\" as const,\n\t\t\tmessage: {\n\t\t\t\tsender: userOp.sender,\n\t\t\t\tnonce: userOp.nonce,\n\t\t\t\tinitCode: userOp.initCode,\n\t\t\t\tcallData: userOp.callData,\n\t\t\t\taccountGasLimits: userOp.accountGasLimits,\n\t\t\t\tpreVerificationGas: userOp.preVerificationGas,\n\t\t\t\tgasFees: userOp.gasFees,\n\t\t\t\tpaymasterAndData: userOp.paymasterAndData,\n\t\t\t},\n\t\t}\n\t}\n\n\t/**\n\t * Computes the EIP-712 struct hash of a `PackedUserOperation`.\n\t *\n\t * Hashes dynamic fields (`initCode`, `callData`, `paymasterAndData`) before\n\t * ABI-encoding so the final hash is a fixed-length 32-byte value.\n\t *\n\t * @param userOp - The packed UserOperation to hash.\n\t * @returns The struct hash as a 32-byte hex string.\n\t */\n\tstatic getPackedUserStructHash(userOp: PackedUserOperation): HexString {\n\t\treturn keccak256(\n\t\t\tencodeAbiParameters(\n\t\t\t\tparseAbiParameters(\"bytes32, address, uint256, bytes32, bytes32, bytes32, uint256, bytes32, bytes32\"),\n\t\t\t\t[\n\t\t\t\t\tPACKED_USEROP_TYPEHASH,\n\t\t\t\t\tuserOp.sender,\n\t\t\t\t\tuserOp.nonce,\n\t\t\t\t\tkeccak256(userOp.initCode),\n\t\t\t\t\tkeccak256(userOp.callData),\n\t\t\t\t\tuserOp.accountGasLimits as Hex,\n\t\t\t\t\tuserOp.preVerificationGas,\n\t\t\t\t\tuserOp.gasFees as Hex,\n\t\t\t\t\tkeccak256(userOp.paymasterAndData),\n\t\t\t\t],\n\t\t\t),\n\t\t) as HexString\n\t}\n\n\t/**\n\t * Packs `verificationGasLimit` and `callGasLimit` into the ERC-4337\n\t * `accountGasLimits` bytes32 field.\n\t *\n\t * The high 16 bytes hold `verificationGasLimit` and the low 16 bytes hold\n\t * `callGasLimit`, matching the EntryPoint v0.8 packed representation.\n\t *\n\t * @param verificationGasLimit - Gas limit for the account verification step.\n\t * @param callGasLimit - Gas limit for the main execution call.\n\t * @returns A 32-byte hex string with both limits packed.\n\t */\n\tstatic packGasLimits(verificationGasLimit: bigint, callGasLimit: bigint): HexString {\n\t\tconst verificationGasHex = pad(toHex(verificationGasLimit), { size: 16 })\n\t\tconst callGasHex = pad(toHex(callGasLimit), { size: 16 })\n\t\treturn concat([verificationGasHex, callGasHex]) as HexString\n\t}\n\n\t/**\n\t * Packs `maxPriorityFeePerGas` and `maxFeePerGas` into the ERC-4337\n\t * `gasFees` bytes32 field.\n\t *\n\t * The high 16 bytes hold `maxPriorityFeePerGas` and the low 16 bytes hold\n\t * `maxFeePerGas`, matching the EntryPoint v0.8 packed representation.\n\t *\n\t * @param maxPriorityFeePerGas - Maximum tip per gas (EIP-1559).\n\t * @param maxFeePerGas - Maximum total fee per gas (EIP-1559).\n\t * @returns A 32-byte hex string with both fee values packed.\n\t */\n\tstatic packGasFees(maxPriorityFeePerGas: bigint, maxFeePerGas: bigint): HexString {\n\t\tconst priorityFeeHex = pad(toHex(maxPriorityFeePerGas), { size: 16 })\n\t\tconst maxFeeHex = pad(toHex(maxFeePerGas), { size: 16 })\n\t\treturn concat([priorityFeeHex, maxFeeHex]) as HexString\n\t}\n\n\t/**\n\t * Unpacks the `accountGasLimits` bytes32 field back into its constituent\n\t * gas limits.\n\t *\n\t * @param accountGasLimits - The packed 32-byte gas limits field from a `PackedUserOperation`.\n\t * @returns Object with `verificationGasLimit` and `callGasLimit` as bigints.\n\t */\n\tstatic unpackGasLimits(accountGasLimits: HexString): { verificationGasLimit: bigint; callGasLimit: bigint } {\n\t\tconst hex = accountGasLimits.slice(2)\n\t\tconst verificationGasLimit = BigInt(`0x${hex.slice(0, 32)}`)\n\t\tconst callGasLimit = BigInt(`0x${hex.slice(32, 64)}`)\n\t\treturn { verificationGasLimit, callGasLimit }\n\t}\n\n\t/**\n\t * Unpacks the `gasFees` bytes32 field back into its constituent fee values.\n\t *\n\t * @param gasFees - The packed 32-byte gas fees field from a `PackedUserOperation`.\n\t * @returns Object with `maxPriorityFeePerGas` and `maxFeePerGas` as bigints.\n\t */\n\tstatic unpackGasFees(gasFees: HexString): { maxPriorityFeePerGas: bigint; maxFeePerGas: bigint } {\n\t\tconst hex = gasFees.slice(2)\n\t\tconst maxPriorityFeePerGas = BigInt(`0x${hex.slice(0, 32)}`)\n\t\tconst maxFeePerGas = BigInt(`0x${hex.slice(32, 64)}`)\n\t\treturn { maxPriorityFeePerGas, maxFeePerGas }\n\t}\n\n\t/**\n\t * Converts a packed `PackedUserOperation` into the JSON object format\n\t * expected by ERC-4337 bundler JSON-RPC endpoints.\n\t *\n\t * Unpacks `accountGasLimits` and `gasFees`, separates optional factory and\n\t * paymaster fields, and converts all numeric fields to hex strings.\n\t *\n\t * @param userOp - The packed UserOperation to convert.\n\t * @returns A plain object safe to pass as the first element of bundler RPC params.\n\t */\n\tstatic prepareBundlerCall(userOp: PackedUserOperation): Record<string, unknown> {\n\t\tconst { verificationGasLimit, callGasLimit } = CryptoUtils.unpackGasLimits(userOp.accountGasLimits)\n\t\tconst { maxPriorityFeePerGas, maxFeePerGas } = CryptoUtils.unpackGasFees(userOp.gasFees)\n\n\t\tconst hasFactory = userOp.initCode && userOp.initCode !== \"0x\" && userOp.initCode.length > 2\n\t\tconst factory = hasFactory ? (`0x${userOp.initCode.slice(2, 42)}` as HexString) : undefined\n\t\tconst factoryData = hasFactory ? (`0x${userOp.initCode.slice(42)}` as HexString) : undefined\n\n\t\t// EntryPoint v0.8 packed paymasterAndData layout:\n\t\t// paymaster (20 bytes) || paymasterVerificationGasLimit (uint128, 16 bytes)\n\t\t// || paymasterPostOpGasLimit (uint128, 16 bytes) || paymasterData (variable)\n\t\tconst hasPaymaster =\n\t\t\tuserOp.paymasterAndData && userOp.paymasterAndData !== \"0x\" && userOp.paymasterAndData.length > 2\n\t\tconst pmHex = hasPaymaster ? userOp.paymasterAndData.slice(2) : \"\"\n\t\tconst paymaster = hasPaymaster ? (`0x${pmHex.slice(0, 40)}` as HexString) : undefined\n\t\tconst paymasterVerificationGasLimit = hasPaymaster ? BigInt(`0x${pmHex.slice(40, 72)}`) : undefined\n\t\tconst paymasterPostOpGasLimit = hasPaymaster ? BigInt(`0x${pmHex.slice(72, 104)}`) : undefined\n\t\tconst paymasterData = hasPaymaster ? (`0x${pmHex.slice(104)}` as HexString) : undefined\n\n\t\tconst userOpBundler: Record<string, unknown> = {\n\t\t\tsender: userOp.sender,\n\t\t\tnonce: toHex(userOp.nonce),\n\t\t\tcallData: userOp.callData,\n\t\t\tcallGasLimit: toHex(callGasLimit),\n\t\t\tverificationGasLimit: toHex(verificationGasLimit),\n\t\t\tpreVerificationGas: toHex(userOp.preVerificationGas),\n\t\t\tmaxFeePerGas: toHex(maxFeePerGas),\n\t\t\tmaxPriorityFeePerGas: toHex(maxPriorityFeePerGas),\n\t\t\tsignature: userOp.signature,\n\t\t}\n\n\t\tif (factory) {\n\t\t\tuserOpBundler.factory = factory\n\t\t\tuserOpBundler.factoryData = factoryData || \"0x\"\n\t\t}\n\n\t\tif (paymaster) {\n\t\t\tuserOpBundler.paymaster = paymaster\n\t\t\tuserOpBundler.paymasterData = paymasterData || \"0x\"\n\t\t\tuserOpBundler.paymasterVerificationGasLimit = toHex(paymasterVerificationGasLimit!)\n\t\t\tuserOpBundler.paymasterPostOpGasLimit = toHex(paymasterPostOpGasLimit!)\n\t\t}\n\n\t\treturn userOpBundler\n\t}\n\n\t/**\n\t * Sends a JSON-RPC request to the configured ERC-4337 bundler endpoint.\n\t *\n\t * @param method - The JSON-RPC method name (one of {@link BundlerMethod}).\n\t * @param params - Array of parameters for the RPC call.\n\t * @returns Resolves with the `result` field of the bundler's JSON-RPC response,\n\t * typed as `T`.\n\t * @throws If the bundler URL is not configured or the bundler returns an error.\n\t */\n\tasync sendBundler<T = unknown>(method: BundlerMethod, params: unknown[] = []): Promise<T> {\n\t\tif (!this.ctx.bundlerUrl) {\n\t\t\tthrow new Error(\"Bundler URL not configured\")\n\t\t}\n\n\t\tconst response = await fetch(this.ctx.bundlerUrl, {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\tbody: JSON.stringify({ jsonrpc: \"2.0\", id: 1, method, params }),\n\t\t})\n\n\t\tconst result = await response.json()\n\n\t\tif (result.error) {\n\t\t\tthrow new Error(`Bundler error: ${result.error.message || JSON.stringify(result.error)}`)\n\t\t}\n\n\t\treturn result.result\n\t}\n\n\t/**\n\t * Sends multiple JSON-RPC requests to the bundler in a single HTTP call\n\t * using JSON-RPC 2.0 batch syntax. Results are returned in the same order\n\t * as the input `requests` array.\n\t *\n\t * @throws If the bundler URL is not configured, the HTTP call fails, or any\n\t * individual response contains an error.\n\t */\n\tasync sendBundlerBatch<T extends unknown[]>(requests: { method: BundlerMethod; params: unknown[] }[]): Promise<T> {\n\t\tif (!this.ctx.bundlerUrl) {\n\t\t\tthrow new Error(\"Bundler URL not configured\")\n\t\t}\n\n\t\tconst body = requests.map((r, i) => ({\n\t\t\tjsonrpc: \"2.0\" as const,\n\t\t\tid: i + 1,\n\t\t\tmethod: r.method,\n\t\t\tparams: r.params,\n\t\t}))\n\n\t\tconst response = await fetch(this.ctx.bundlerUrl, {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\tbody: JSON.stringify(body),\n\t\t})\n\n\t\tconst results = (await response.json()) as { id: number; result?: unknown; error?: { message?: string } }[]\n\t\tresults.sort((a, b) => a.id - b.id)\n\n\t\treturn results.map((r) => {\n\t\t\tif (r.error) {\n\t\t\t\tthrow new Error(`Bundler error: ${r.error.message || JSON.stringify(r.error)}`)\n\t\t\t}\n\t\t\treturn r.result\n\t\t}) as T\n\t}\n\n\t/**\n\t * Encodes a list of calls into ERC-7821 `execute` calldata using\n\t * single-batch mode (`ERC7821_BATCH_MODE`).\n\t *\n\t * @param calls - Ordered list of calls to batch; each specifies a `target`\n\t * address, ETH `value`, and `data`.\n\t * @returns ABI-encoded calldata for the ERC-7821 `execute(bytes32,bytes)` function.\n\t */\n\tencodeERC7821Execute(calls: ERC7821Call[]): HexString {\n\t\tconst executionData = encodeAbiParameters(\n\t\t\t[{ type: \"tuple[]\", components: ERC7821ABI.ABI[1].components }],\n\t\t\t[calls.map((call) => ({ target: call.target, value: call.value, data: call.data }))],\n\t\t) as HexString\n\n\t\treturn encodeFunctionData({\n\t\t\tabi: ERC7821ABI.ABI,\n\t\t\tfunctionName: \"execute\",\n\t\t\targs: [ERC7821_BATCH_MODE, executionData],\n\t\t}) as HexString\n\t}\n\n\t/**\n\t * Decodes ERC-7821 `execute` calldata back into its constituent calls.\n\t *\n\t * Returns `null` if the calldata does not match the expected `execute`\n\t * function signature or cannot be decoded.\n\t *\n\t * @param callData - Hex-encoded calldata previously produced by\n\t * {@link encodeERC7821Execute} or an equivalent encoder.\n\t * @returns Array of decoded {@link ERC7821Call} objects, or `null` on failure.\n\t */\n\tdecodeERC7821Execute(callData: HexString): ERC7821Call[] | null {\n\t\ttry {\n\t\t\tconst decoded = decodeFunctionData({\n\t\t\t\tabi: ERC7821ABI.ABI,\n\t\t\t\tdata: callData,\n\t\t\t})\n\n\t\t\tif (decoded?.functionName !== \"execute\" || !decoded.args || decoded.args.length < 2) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\tconst executionData = decoded.args[1] as HexString\n\n\t\t\tconst [calls] = decodeAbiParameters(\n\t\t\t\t[{ type: \"tuple[]\", components: ERC7821ABI.ABI[1].components }],\n\t\t\t\texecutionData,\n\t\t\t) as [ERC7821Call[]]\n\n\t\t\treturn calls.map((call) => ({\n\t\t\t\ttarget: call.target as HexString,\n\t\t\t\tvalue: call.value,\n\t\t\t\tdata: call.data as HexString,\n\t\t\t}))\n\t\t} catch {\n\t\t\treturn null\n\t\t}\n\t}\n}\n","// Uniswap V4 position valuation, in plain bigint arithmetic.\n//\n// Lives apart from the aggregation and performs no I/O: the indexer runs inside the SubQuery VM2\n// sandbox, which has neither viem nor the Uniswap SDK, and this is the one place in the phantom\n// pipeline where a silent arithmetic slip would inflate reported depth rather than merely lose it.\n// Keeping it pure means every branch is exercisable from a table of known values.\n//\n// A position's withdrawable amount of a given token is not stored on-chain. It is derived from the\n// position's liquidity, its tick range, and the pool's current price — so a position that has moved\n// out of range holds exactly one of its two tokens, and the same liquidity is worth different\n// amounts of each token at different prices.\n\nexport type HexString = `0x${string}`\n\n/** Q96 fixed-point scale used throughout Uniswap's price math. */\nconst Q96 = 1n << 96n\n\nconst MIN_TICK = -887272\nconst MAX_TICK = 887272\n\n/** Reads a 32-byte word out of `0x`-prefixed return data as an unsigned bigint. */\nexport function word(data: string, index: number): bigint {\n\tconst hex = data.startsWith(\"0x\") ? data.slice(2) : data\n\tconst start = index * 64\n\tif (hex.length < start + 64) throw new Error(`return data too short for word ${index}`)\n\treturn BigInt(`0x${hex.slice(start, start + 64)}`)\n}\n\n/** Reinterprets the low `bits` of an unsigned word as a two's-complement signed value. */\nexport function asSigned(value: bigint, bits: number): bigint {\n\tconst width = 1n << BigInt(bits)\n\tconst masked = value & (width - 1n)\n\treturn masked >= width >> 1n ? masked - width : masked\n}\n\n/** The 20-byte address in the low bytes of a 32-byte word, lowercased. */\nexport function addressFromWord(data: string, index: number): HexString {\n\tconst hex = data.startsWith(\"0x\") ? data.slice(2) : data\n\treturn `0x${hex.slice(index * 64 + 24, (index + 1) * 64)}`.toLowerCase() as HexString\n}\n\n/**\n * `sqrt(1.0001^tick) * 2^96`, matching Uniswap's TickMath.getSqrtRatioAtTick bit for bit.\n *\n * The constants are the fixed-point square roots of 1.0001^(2^i); multiplying the ones selected by\n * the set bits of |tick| reconstructs the ratio by binary exponentiation without ever leaving\n * integer arithmetic. Reproduced rather than approximated with floating point, because the result\n * feeds an amount that must agree with what the pool would actually pay out.\n */\nexport function getSqrtRatioAtTick(tick: number): bigint {\n\tif (!Number.isInteger(tick) || tick < MIN_TICK || tick > MAX_TICK) {\n\t\tthrow new Error(`tick out of range: ${tick}`)\n\t}\n\tconst absTick = BigInt(Math.abs(tick))\n\n\tlet ratio = (absTick & 0x1n) !== 0n ? 0xfffcb933bd6fad37aa2d162d1a594001n : 0x100000000000000000000000000000000n\n\tconst factors: [bigint, bigint][] = [\n\t\t[0x2n, 0xfff97272373d413259a46990580e213an],\n\t\t[0x4n, 0xfff2e50f5f656932ef12357cf3c7fdccn],\n\t\t[0x8n, 0xffe5caca7e10e4e61c3624eaa0941cd0n],\n\t\t[0x10n, 0xffcb9843d60f6159c9db58835c926644n],\n\t\t[0x20n, 0xff973b41fa98c081472e6896dfb254c0n],\n\t\t[0x40n, 0xff2ea16466c96a3843ec78b326b52861n],\n\t\t[0x80n, 0xfe5dee046a99a2a811c461f1969c3053n],\n\t\t[0x100n, 0xfcbe86c7900a88aedcffc83b479aa3a4n],\n\t\t[0x200n, 0xf987a7253ac413176f2b074cf7815e54n],\n\t\t[0x400n, 0xf3392b0822b70005940c7a398e4b70f3n],\n\t\t[0x800n, 0xe7159475a2c29b7443b29c7fa6e889d9n],\n\t\t[0x1000n, 0xd097f3bdfd2022b8845ad8f792aa5825n],\n\t\t[0x2000n, 0xa9f746462d870fdf8a65dc1f90e061e5n],\n\t\t[0x4000n, 0x70d869a156d2a1b890bb3df62baf32f7n],\n\t\t[0x8000n, 0x31be135f97d08fd981231505542fcfa6n],\n\t\t[0x10000n, 0x9aa508b5b7a84e1c677de54f3e99bc9n],\n\t\t[0x20000n, 0x5d6af8dedb81196699c329225ee604n],\n\t\t[0x40000n, 0x2216e584f5fa1ea926041bedfe98n],\n\t\t[0x80000n, 0x48a170391f7dc42444e8fa2n],\n\t]\n\tfor (const [bit, factor] of factors) {\n\t\tif ((absTick & bit) !== 0n) ratio = (ratio * factor) >> 128n\n\t}\n\n\tif (tick > 0) ratio = (1n << 256n) / ratio\n\n\t// Round up to Q96, as TickMath does, so the ratio never understates the price.\n\treturn (ratio >> 32n) + (ratio % (1n << 32n) === 0n ? 0n : 1n)\n}\n\n/** The tick bounds packed into a PositionInfo word: `poolId(200) ‖ tickUpper(24) ‖ tickLower(24) ‖ hasSubscriber(8)`. */\nexport function positionTicks(info: bigint): { tickLower: number; tickUpper: number } {\n\treturn {\n\t\ttickLower: Number(asSigned(info >> 8n, 24)),\n\t\ttickUpper: Number(asSigned(info >> 32n, 24)),\n\t}\n}\n\n/**\n * The token0/token1 amounts `liquidity` is worth at the current price, mirroring\n * LiquidityAmounts.getAmountsForLiquidity.\n *\n * Below its range a position is entirely token0, above it entirely token1, and inside it holds\n * both — which is why a declared position's contribution to a leg depends on which side that leg\n * pays out, and why it can legitimately be zero.\n */\nexport function getAmountsForLiquidity(params: {\n\tsqrtPriceX96: bigint\n\tsqrtRatioAX96: bigint\n\tsqrtRatioBX96: bigint\n\tliquidity: bigint\n}): { amount0: bigint; amount1: bigint } {\n\tlet { sqrtRatioAX96, sqrtRatioBX96 } = params\n\tconst { sqrtPriceX96, liquidity } = params\n\tif (sqrtRatioAX96 > sqrtRatioBX96) [sqrtRatioAX96, sqrtRatioBX96] = [sqrtRatioBX96, sqrtRatioAX96]\n\n\tconst amount0For = (from: bigint, to: bigint) => (liquidity * Q96 * (to - from)) / to / from\n\tconst amount1For = (from: bigint, to: bigint) => (liquidity * (to - from)) / Q96\n\n\tif (sqrtPriceX96 <= sqrtRatioAX96) {\n\t\treturn { amount0: amount0For(sqrtRatioAX96, sqrtRatioBX96), amount1: 0n }\n\t}\n\tif (sqrtPriceX96 < sqrtRatioBX96) {\n\t\treturn {\n\t\t\tamount0: amount0For(sqrtPriceX96, sqrtRatioBX96),\n\t\t\tamount1: amount1For(sqrtRatioAX96, sqrtPriceX96),\n\t\t}\n\t}\n\treturn { amount0: 0n, amount1: amount1For(sqrtRatioAX96, sqrtRatioBX96) }\n}\n\n/** A decoded `getPoolAndPositionInfo` return: the pool's key words plus the packed position info. */\nexport interface PoolAndPositionInfo {\n\tcurrency0: HexString\n\tcurrency1: HexString\n\t/**\n\t * The ABI-encoded PoolKey exactly as returned, i.e. the first five words. A static struct's\n\t * abi.encode IS its concatenated words, so `keccak256` of this slice is the pool id — no\n\t * re-encoding, and no chance of the re-encoding disagreeing with what the chain hashed.\n\t */\n\tpoolKeyEncoded: HexString\n\ttickLower: number\n\ttickUpper: number\n}\n\n/** Decodes `getPoolAndPositionInfo(uint256)` return data (five static PoolKey words + info). */\nexport function decodePoolAndPositionInfo(data: string): PoolAndPositionInfo {\n\tconst hex = data.startsWith(\"0x\") ? data.slice(2) : data\n\tif (hex.length < 6 * 64) throw new Error(\"getPoolAndPositionInfo returned too little data\")\n\tconst { tickLower, tickUpper } = positionTicks(word(data, 5))\n\treturn {\n\t\tcurrency0: addressFromWord(data, 0),\n\t\tcurrency1: addressFromWord(data, 1),\n\t\tpoolKeyEncoded: `0x${hex.slice(0, 5 * 64)}` as HexString,\n\t\ttickLower,\n\t\ttickUpper,\n\t}\n}\n\n/**\n * How much of `outputToken` a position is currently worth. Zero when the token is not one of the\n * pool's currencies, or when the price has moved the position entirely onto the other side — both\n * ordinary outcomes, not errors.\n */\nexport function positionAmountOfToken(params: {\n\tinfo: PoolAndPositionInfo\n\tliquidity: bigint\n\tsqrtPriceX96: bigint\n\toutputToken: string\n}): bigint {\n\tconst { info, liquidity, sqrtPriceX96 } = params\n\tconst outputToken = params.outputToken.toLowerCase()\n\tif (outputToken !== info.currency0 && outputToken !== info.currency1) return 0n\n\tif (liquidity <= 0n || sqrtPriceX96 <= 0n) return 0n\n\n\tconst { amount0, amount1 } = getAmountsForLiquidity({\n\t\tsqrtPriceX96,\n\t\tsqrtRatioAX96: getSqrtRatioAtTick(info.tickLower),\n\t\tsqrtRatioBX96: getSqrtRatioAtTick(info.tickUpper),\n\t\tliquidity,\n\t})\n\treturn outputToken === info.currency0 ? amount0 : amount1\n}\n","// Phantom-order price/liquidity aggregation. Lives in the SDK so the indexer (which persists the\n// result as entities) and the simplex E2E test share one implementation. Bid decoding (extractFill)\n// and signature recovery (recoverSigner) are injectable because the indexer must do both without\n// viem — viem's @noble/hashes keccak throws \"Uint8Array expected\" in the SubQuery VM2 sandbox — so\n// it passes VM2-safe implementations; the viem-based defaults are fine for Node consumers (tests,\n// simplex).\nimport { decodeFunctionData, encodeAbiParameters, keccak256, recoverAddress } from \"viem\"\nimport { hexToU8a, isHex, stringToU8a, u8aToHex, u8aToString } from \"@polkadot/util\"\nimport { decodeERC7821ExecuteBatch } from \"@/protocols/intents/decode-utils\"\nimport { decodeUserOpScale } from \"@/chains/intentsCoprocessor\"\nimport { CryptoUtils } from \"@/protocols/intents/CryptoUtils\"\nimport type { PackedUserOperation } from \"@/types\"\nimport IntentGatewayV2 from \"@/abis/IntentGatewayV2\"\nimport {\n\tdecodePoolAndPositionInfo,\n\tpositionAmountOfToken,\n\tword,\n\ttype PoolAndPositionInfo,\n} from \"@/protocols/intents/uniswap-v4-position\"\n\nexport type HexString = `0x${string}`\n\n/**\n * ERC-4337 v0.8 EntryPoint, the contract whose userOpHash a bid's solver signature is taken over.\n * Canonical across every EVM chain we support, which is why it is a constant here rather than\n * something callers pass in (chain.ts carries the same address per chain as `EntryPointV08`).\n */\nexport const ENTRY_POINT_V08_ADDRESS = \"0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108\" as const\n\n/** Minimal fetch shape used by the JSON-RPC POSTs below. */\nexport type FetchLike = (url: string, init: any) => Promise<{ json(): Promise<any> }>\n\n// The aggregation talks to RPCs over HTTP. In browsers/Node/tests the global `fetch` is used, but\n// the SubQuery VM2 sandbox the indexer runs in does NOT expose a global `fetch` (and node-fetch\n// crashes there), so the indexer injects a sandbox-safe implementation via setAggregationFetch().\nlet injectedFetch: FetchLike | undefined\nexport function setAggregationFetch(fetchImpl: FetchLike): void {\n\tinjectedFetch = fetchImpl\n}\nfunction rpcFetch(): FetchLike {\n\tconst f = injectedFetch ?? (globalThis as { fetch?: FetchLike }).fetch\n\tif (typeof f !== \"function\") {\n\t\tthrow new Error(\"No fetch available; call setAggregationFetch() before using the aggregation helpers\")\n\t}\n\treturn f\n}\n\n/**\n * An RPC read the aggregation depends on could not be completed. Distinct from a bid being\n * rejected: a rejected bid is a fact about the bid, this is the absence of a fact. The two must\n * never be conflated — treating an unreachable node as \"not delegated\" or as \"holds nothing\"\n * silently drops a real solver from the snapshot, which then publishes a price and a depth\n * computed from whoever happened to answer.\n */\nexport class PhantomRpcError extends Error {\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly cause?: unknown,\n\t) {\n\t\tsuper(message)\n\t\tthis.name = \"PhantomRpcError\"\n\t}\n}\n\n// POSTs a JSON-RPC payload and returns the parsed response, retrying with a short backoff. The node\n// intermittently returns an empty body under concurrent load (a 200 with no payload), which makes\n// response.json() throw; without a retry a single blip would silently drop a bid's quote or a whole\n// window (fetchBids throws). Throws PhantomRpcError if every attempt fails.\nasync function rpcCall(url: string, payload: object): Promise<any> {\n\tlet lastErr: unknown\n\tfor (let attempt = 0; attempt < 4; attempt++) {\n\t\tif (attempt > 0) await new Promise((resolve) => setTimeout(resolve, 150 * attempt))\n\t\tlet timer: ReturnType<typeof setTimeout> | undefined\n\t\ttry {\n\t\t\t// Bound each attempt: the injected fetch (Node http) has no socket timeout, so a stalled\n\t\t\t// connection would otherwise hang forever and block the whole handler. Race it against a\n\t\t\t// deadline; on timeout we reject, retry, and ultimately throw so callers degrade instead.\n\t\t\tconst timeout = new Promise<never>((_, reject) => {\n\t\t\t\ttimer = setTimeout(() => reject(new Error(`rpc timeout: ${url}`)), 12_000)\n\t\t\t})\n\t\t\tconst response = await Promise.race([\n\t\t\t\trpcFetch()(url, {\n\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\theaders: { accept: \"application/json\", \"content-type\": \"application/json\" },\n\t\t\t\t\tbody: JSON.stringify(payload),\n\t\t\t\t}),\n\t\t\t\ttimeout,\n\t\t\t])\n\t\t\tconst body = await response.json()\n\t\t\t// A JSON-RPC error body is a failed read, not an answer. Rate limiting arrives this way,\n\t\t\t// so letting it through as `undefined` is what turns throttling into fabricated data.\n\t\t\tif (body?.error) {\n\t\t\t\tlastErr = new Error(`rpc error: ${JSON.stringify(body.error).slice(0, 200)}`)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn body\n\t\t} catch (err) {\n\t\t\tlastErr = err\n\t\t} finally {\n\t\t\tif (timer) clearTimeout(timer)\n\t\t}\n\t}\n\tthrow new PhantomRpcError(`RPC call failed after 4 attempts: ${url}`, lastErr)\n}\n\nexport const FILL_ORDER_ABI = IntentGatewayV2.ABI\n\n// ─── phantom bid declaration ────────────────────────────────────────────────────────────────────\n//\n// A same-chain phantom bid proves a solver operates on a chain, but not two things the snapshot\n// needs: which chains it will accept payment FROM when filling a cross-chain order, and which\n// Uniswap V4 positions stand behind its quote. Bids declare both inside paymasterAndData, which\n// the userOpHash covers, so the declaration is authenticated by the solver's existing bid\n// signature (the `signature` field is excluded from the hash and therefore unusable). The overload\n// applies to phantom bids only: a real fill's paymasterAndData keeps its functional EntryPoint\n// semantics, and nothing on the real-fill path ever parses this format.\n//\n// Layouts, by leading version byte:\n//\n// v1 0x01 ‖ chainCount(1) ‖ chainCount × ( len(1) ‖ utf8 state machine id )\n// v2 0x01-body ‖ posCount(1) ‖ posCount × ( len(1) ‖ big-endian tokenId ) with 0x02 leading\n//\n// v2 is v1 with a positions section appended, so decoding is one parser with an optional tail.\n// The encoder emits v1 whenever there are no positions, which keeps existing solvers' bids\n// byte-identical to what they produce today; a v1 blob decodes under v2 readers as \"no positions\".\n// A v2 blob read by a pre-v2 decoder fails its version check and reads as no declaration at all —\n// the same degradation as an absent blob, never a misparse, because both versions reject trailing\n// bytes rather than half-reading.\n//\n// Declared positions are implicitly on the order's own chain: a phantom bid is submitted per\n// chain, so the tokenIds a solver names in it are the ones it holds on that chain. The declaration\n// is a POINTER, not a claim of size — the indexer reads each position's liquidity on-chain and\n// checks the position is owned by the very solver that signed the bid, so a solver can point at\n// its own positions but cannot inflate them, nor borrow someone else's.\n\nconst DECLARATION_V1 = 0x01\nconst DECLARATION_V2 = 0x02\n\n/** Upper bound on declared chains and positions alike; one byte of count each. */\nconst MAX_DECLARED_ENTRIES = 255\n\n/** Widest tokenId the codec will carry — a uint256, as minted by the V4 PositionManager. */\nconst MAX_TOKEN_ID_BYTES = 32\n\n/** What a phantom bid's paymasterAndData declares about the solver behind it. */\nexport interface PhantomBidDeclaration {\n\t/**\n\t * Source chains the solver accepts payment from. Null when the bid carries no parseable\n\t * declaration (the legacy default: the solver has not restricted its sources); an empty array\n\t * is an explicit accepts-nothing. Callers must preserve that distinction.\n\t */\n\tacceptedSources: string[] | null\n\t/**\n\t * Uniswap V4 position tokenIds the solver declares as backing this bid, on the order's own\n\t * chain. Empty when none are declared — including for every v1 bid, which predates the field.\n\t */\n\tuniswapV4Positions: bigint[]\n}\n\n/** Minimal big-endian bytes of a non-negative tokenId; `[0]` for zero. */\nfunction tokenIdToBytes(tokenId: bigint): number[] {\n\tif (tokenId < 0n) throw new Error(`Uniswap V4 tokenId cannot be negative: ${tokenId}`)\n\tconst bytes: number[] = []\n\tlet rest = tokenId\n\twhile (rest > 0n) {\n\t\tbytes.unshift(Number(rest & 0xffn))\n\t\trest >>= 8n\n\t}\n\treturn bytes.length > 0 ? bytes : [0]\n}\n\n/**\n * Encodes a phantom bid's declaration into the paymasterAndData blob. Emits the v1 layout when no\n * positions are declared, so a solver that only names source chains produces exactly the bytes it\n * produced before positions existed.\n */\nexport function encodePhantomBidDeclaration(declaration: {\n\tacceptedSourceChains?: string[]\n\tuniswapV4Positions?: bigint[]\n}): HexString {\n\tconst chains = declaration.acceptedSourceChains ?? []\n\tconst positions = declaration.uniswapV4Positions ?? []\n\tif (chains.length > MAX_DECLARED_ENTRIES) {\n\t\tthrow new Error(`Cannot declare more than ${MAX_DECLARED_ENTRIES} source chains`)\n\t}\n\tif (positions.length > MAX_DECLARED_ENTRIES) {\n\t\tthrow new Error(`Cannot declare more than ${MAX_DECLARED_ENTRIES} Uniswap V4 positions`)\n\t}\n\n\tconst version = positions.length > 0 ? DECLARATION_V2 : DECLARATION_V1\n\tconst bytes: number[] = [version, chains.length]\n\tfor (const chain of chains) {\n\t\tconst encoded = stringToU8a(chain)\n\t\tif (encoded.length === 0 || encoded.length > 255) {\n\t\t\tthrow new Error(`Invalid state machine id in source chain declaration: ${chain}`)\n\t\t}\n\t\tbytes.push(encoded.length, ...encoded)\n\t}\n\n\tif (version === DECLARATION_V2) {\n\t\tbytes.push(positions.length)\n\t\tfor (const tokenId of positions) {\n\t\t\tconst encoded = tokenIdToBytes(tokenId)\n\t\t\tif (encoded.length > MAX_TOKEN_ID_BYTES) {\n\t\t\t\tthrow new Error(`Uniswap V4 tokenId exceeds uint256: ${tokenId}`)\n\t\t\t}\n\t\t\tbytes.push(encoded.length, ...encoded)\n\t\t}\n\t}\n\n\treturn u8aToHex(new Uint8Array(bytes)) as HexString\n}\n\n/**\n * Decodes a phantom bid's paymasterAndData. Understands both layout versions, so bids placed\n * before positions existed keep decoding unchanged. Anything absent, unversioned or malformed\n * yields a null `acceptedSources` with no positions — never a partial read.\n */\nexport function decodePhantomBidDeclaration(paymasterAndData: string | undefined | null): PhantomBidDeclaration {\n\tconst absent: PhantomBidDeclaration = { acceptedSources: null, uniswapV4Positions: [] }\n\tif (!paymasterAndData || !isHex(paymasterAndData)) return absent\n\tconst bytes = hexToU8a(paymasterAndData)\n\tif (bytes.length < 2) return absent\n\n\tconst version = bytes[0]\n\tif (version !== DECLARATION_V1 && version !== DECLARATION_V2) return absent\n\n\tconst chains: string[] = []\n\tlet offset = 2\n\tfor (let entry = 0; entry < bytes[1]; entry++) {\n\t\tif (offset >= bytes.length) return absent\n\t\tconst length = bytes[offset]\n\t\toffset += 1\n\t\tif (length === 0 || offset + length > bytes.length) return absent\n\t\tchains.push(u8aToString(bytes.subarray(offset, offset + length)))\n\t\toffset += length\n\t}\n\n\tconst positions: bigint[] = []\n\tif (version === DECLARATION_V2) {\n\t\tif (offset >= bytes.length) return absent\n\t\tconst count = bytes[offset]\n\t\toffset += 1\n\t\tfor (let entry = 0; entry < count; entry++) {\n\t\t\tif (offset >= bytes.length) return absent\n\t\t\tconst length = bytes[offset]\n\t\t\toffset += 1\n\t\t\tif (length === 0 || length > MAX_TOKEN_ID_BYTES || offset + length > bytes.length) return absent\n\t\t\tlet tokenId = 0n\n\t\t\tfor (const byte of bytes.subarray(offset, offset + length)) tokenId = (tokenId << 8n) | BigInt(byte)\n\t\t\tpositions.push(tokenId)\n\t\t\toffset += length\n\t\t}\n\t}\n\n\t// Trailing bytes mean this is not a declaration but something that happens to share the\n\t// version byte, so treat the whole blob as unparseable rather than half-reading it.\n\tif (offset !== bytes.length) return absent\n\n\treturn { acceptedSources: chains, uniswapV4Positions: positions }\n}\n\n/** Back-compat wrapper: the source-chain half of {@link encodePhantomBidDeclaration}. */\nexport function encodeAcceptedSourceChains(chains: string[]): HexString {\n\treturn encodePhantomBidDeclaration({ acceptedSourceChains: chains })\n}\n\n/** Back-compat wrapper: the source-chain half of {@link decodePhantomBidDeclaration}. */\nexport function decodeAcceptedSourceChains(paymasterAndData: string | undefined | null): string[] | null {\n\treturn decodePhantomBidDeclaration(paymasterAndData).acceptedSources\n}\n\n/** ERC-4626 vaults per chain, keyed by chain id then lowercase underlying token address. */\nexport type YieldVaultMap = Record<string, Record<string, string[]>>\n\n/** One leg of a fill: the token the solver pays out and the amount it quoted for that leg. */\nexport interface FillLeg {\n\toutputToken: HexString\n\tsolverAmount: bigint\n}\n\nexport interface FillData {\n\torder: Record<string, unknown>\n\toptions: Record<string, unknown>\n\t/** Positional, matching the order's asset lists. A zero amount means the solver did not quote that leg. */\n\tlegs: FillLeg[]\n}\n\n/**\n * Zips an order's output assets with the bid's quoted amounts into positional legs. A missing or\n * null amount is the \"solver declined this leg\" sentinel and becomes a zero quote. Shared by the\n * viem extractor below and the indexer's VM2-safe one, so the declined-leg convention has a\n * single home while only the ABI decode differs per environment.\n */\nexport function zipFillLegs(assets: { token: HexString }[], outputs: { amount: unknown }[]): FillLeg[] {\n\treturn assets.map((asset, index) => {\n\t\tconst rawAmount = outputs[index]?.amount\n\t\treturn {\n\t\t\toutputToken: asset.token,\n\t\t\tsolverAmount: rawAmount === undefined || rawAmount === null ? 0n : BigInt(rawAmount.toString()),\n\t\t}\n\t})\n}\n\nexport interface RpcBidInfo {\n\tcommitment: string\n\tfiller: string\n\tuser_op: string\n}\n\n/** One solver's measured liquidity for a configured token on one chain at this snapshot. */\nexport interface LpBalance {\n\tsolver: string\n\t/** State machine id of the chain the balance was measured on (e.g. EVM-8453). */\n\tchain: string\n\ttokenAddress: HexString\n\t/**\n\t * Wallet ERC-20, redeemable ERC-4626 vault shares, and the withdrawable amount held in the\n\t * solver's declared Uniswap V4 positions — the same total the leg weights are built from, so a\n\t * provider's reported inventory and the depth attributed to it cannot disagree.\n\t *\n\t * The V4 share is only ever included on the chain whose bid declared the positions: a bid is\n\t * per chain, so no other chain's sweep can know about them. Consumers must therefore treat the\n\t * larger of two readings for the same (chain, token, block) as the complete one.\n\t */\n\tbalance: bigint\n}\n\n/** One verified solver behind a leg's quote, holding inventory to deliver it. */\nexport interface PhantomLegBidder {\n\tsolver: HexString\n\t/**\n\t * The solver's output-token inventory on the destination chain — its weight in the median.\n\t * Always greater than zero: a solver quoting a leg it holds none of is dropped, not recorded\n\t * at zero, since it can deliver nothing at any price.\n\t */\n\tweight: bigint\n\t/**\n\t * Source chains the solver's signed paymasterAndData declaration accepts payment from. Null\n\t * when the bid carries no declaration (legacy default: all CCTP/USDT0-covered chains); an\n\t * empty array is an explicit accepts-nothing declaration.\n\t */\n\tacceptedSources: string[] | null\n}\n\n/** The aggregated price for one leg of a phantom order. */\nexport interface PhantomLegAggregation {\n\t/** Position of the leg in the order's asset lists. */\n\tlegIndex: number\n\toutputToken: HexString\n\tlowestPrice: bigint\n\thighestPrice: bigint\n\tmedianPrice: bigint\n\t/** Backed quotes behind the price. Quotes from solvers holding no inventory are not counted. */\n\tbidCount: number\n\t/** The verified, inventory-backed solvers quoting this leg; bidCount === bidders.length. */\n\tbidders: PhantomLegBidder[]\n}\n\n/** The aggregated result for a single phantom order's bid window. */\nexport interface PhantomAggregation {\n\t/**\n\t * One entry per leg that at least one solver quoted AND at least one of those quotes is backed\n\t * by output-token inventory on the destination chain. Legs nobody quoted are absent, and so are\n\t * legs every bidder quoted on zero inventory — neither is a price anyone could trade against.\n\t */\n\tlegs: PhantomLegAggregation[]\n\tlpBalances: LpBalance[]\n}\n\nexport interface AggregationLogger {\n\twarn: (payload: unknown, message: string) => void\n}\n\n// Liquidity-weighted median of solver quotes. Each quote's influence is proportional to `weight` —\n// the solver's total balance for the output token across native + vault venues — so a solver that\n// can actually deliver size moves the price more than one quoting on thin liquidity. Returns the\n// lower weighted median: the smallest price whose cumulative weight reaches half of the total.\n// Zero-weight quotes contribute nothing.\n//\n// Callers must not hand this an entry set whose weights are all zero: with nothing to weight by it\n// can only pick a quote by position, and for an even-sized set that position is the upper of the\n// two middles — so \"the median\" becomes \"whoever quoted higher\", settable by a solver holding no\n// inventory at all. aggregatePhantomBids drops such legs instead of pricing them. The fallback\n// below stays only so an unguarded caller gets a number rather than a crash; treat reaching it as\n// a caller bug.\nexport function weightedMedian(entries: { price: bigint; weight: bigint }[]): bigint {\n\tconst sorted = [...entries].sort((a, b) => (a.price < b.price ? -1 : a.price > b.price ? 1 : 0))\n\tconst totalWeight = sorted.reduce((acc, e) => (e.weight > 0n ? acc + e.weight : acc), 0n)\n\n\tif (totalWeight === 0n) {\n\t\treturn sorted[Math.floor(sorted.length / 2)].price\n\t}\n\n\tlet cumulative = 0n\n\tfor (const entry of sorted) {\n\t\tif (entry.weight <= 0n) continue\n\t\tcumulative += entry.weight\n\t\tif (cumulative * 2n >= totalWeight) return entry.price\n\t}\n\treturn sorted[sorted.length - 1].price\n}\n\n// Pulls the inner fillOrder call out of the bid's ERC-7821 execute batch and decodes the order, the\n// offered output token, and the solver's quoted amount. Returns null when no matching call targets\n// the gateway or the calldata cannot be decoded.\nexport function extractFillData(callData: HexString, gatewayAddress: string): FillData | null {\n\tconst calls = decodeERC7821ExecuteBatch(callData)\n\tif (!calls) return null\n\n\tconst normalized = gatewayAddress.toLowerCase()\n\tfor (const call of calls) {\n\t\tif (call.target.toLowerCase() !== normalized) continue\n\t\ttry {\n\t\t\tconst decoded = decodeFunctionData({ abi: FILL_ORDER_ABI, data: call.data as HexString })\n\t\t\tif (decoded.functionName !== \"fillOrder\" || !decoded.args || decoded.args.length < 2) continue\n\t\t\tconst order = decoded.args[0] as Record<string, unknown>\n\t\t\tconst options = decoded.args[1] as Record<string, unknown>\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\tconst assets = (order as any)?.output?.assets as { token: HexString }[] | undefined\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\tconst outputs = (options as any)?.outputs as { amount: bigint }[] | undefined\n\t\t\tif (!assets?.length || !outputs?.length) continue\n\t\t\treturn { order, options, legs: zipFillLegs(assets, outputs) }\n\t\t} catch {\n\t\t\tcontinue\n\t\t}\n\t}\n\treturn null\n}\n\n/** Derives the 192-bit bid nonce key binding a bid to an (order, sessionKey) pair. */\nexport type BidNonceKeyFn = (commitment: HexString, sessionKey: HexString) => bigint\n\n/** Recomputes an order's commitment from the contract-shaped order decoded out of a bid's calldata. */\nexport type OrderCommitmentFn = (order: Record<string, unknown>) => HexString | null\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst FILL_ORDER_INPUT = (FILL_ORDER_ABI as readonly any[]).find(\n\t(item) => item?.type === \"function\" && item?.name === \"fillOrder\",\n)?.inputs?.[0]\n\n/**\n * Default (viem) {@link OrderCommitmentFn}. The order comes straight out of `fillOrder`'s ABI\n * decode, so it is already contract-shaped and re-encoding it reproduces `keccak256(abi.encode(order))`\n * — the same commitment IntentGatewayV2 computes on-chain. Returns null when it cannot be computed,\n * which callers treat as unverifiable (fail closed).\n */\nexport function orderCommitmentFromDecoded(order: Record<string, unknown>): HexString | null {\n\ttry {\n\t\tif (!FILL_ORDER_INPUT) return null\n\t\treturn keccak256(encodeAbiParameters([FILL_ORDER_INPUT], [order as never]))\n\t} catch {\n\t\treturn null\n\t}\n}\n\n// A bid's userOp.signature is `commitment (32) ‖ solverSignature (65)`. SolverAccount.validateUserOp\n// expects 162 bytes on-chain, but the trailing 65-byte session-key signature is only appended at fill\n// time, so a bid is stored and read back in this 97-byte form.\nconst BID_COMMITMENT_BYTES = 32\nconst SOLVER_SIGNATURE_BYTES = 65\n\nexport interface BidSignature {\n\t/** The order commitment the solver signature is bound to. */\n\tcommitment: HexString\n\t/** The solver's 65-byte ECDSA signature over the userOpHash. */\n\tsolverSignature: HexString\n}\n\n/** Splits a bid userOp's signature into its commitment and solver signature; null if malformed. */\nexport function splitBidSignature(signature: HexString): BidSignature | null {\n\tconst raw = signature.replace(/^0x/, \"\")\n\tconst commitmentChars = BID_COMMITMENT_BYTES * 2\n\tconst end = commitmentChars + SOLVER_SIGNATURE_BYTES * 2\n\tif (raw.length < end) return null\n\n\treturn {\n\t\tcommitment: `0x${raw.slice(0, commitmentChars)}` as HexString,\n\t\tsolverSignature: `0x${raw.slice(commitmentChars, end)}` as HexString,\n\t}\n}\n\n/** Recovers the address that produced a bid's solver signature, or null if it cannot be recovered. */\nexport type RecoverBidSigner = (\n\tuserOp: PackedUserOperation,\n\tentryPoint: HexString,\n\tchainId: bigint,\n\tsolverSignature: HexString,\n) => Promise<HexString | null>\n\n/**\n * Default {@link RecoverBidSigner}: recovers over the EntryPoint v0.8 userOpHash, the digest\n * SolverAccount itself validates against. viem-based, so Node consumers get it for free while the\n * indexer injects an ethers equivalent (see the note at the top of this file).\n */\nexport const recoverBidSignerViem: RecoverBidSigner = async (userOp, entryPoint, chainId, solverSignature) => {\n\ttry {\n\t\tconst userOpHash = CryptoUtils.computeUserOpHash(userOp, entryPoint, chainId)\n\t\treturn (await recoverAddress({ hash: userOpHash, signature: solverSignature })) as HexString\n\t} catch {\n\t\treturn null\n\t}\n}\n\n// An EOA that has delegated with EIP-7702 has code `0xef0100 ‖ delegate`.\nconst DELEGATION_INDICATOR_PREFIX = \"0xef0100\"\n\n/** Whether `account` is an EOA EIP-7702-delegated to `solverAccount` on the given chain. */\nasync function isDelegatedToSolverAccount(evmRpcUrl: string, account: string, solverAccount: string): Promise<boolean> {\n\tconst response = await rpcCall(evmRpcUrl, {\n\t\tid: 1,\n\t\tjsonrpc: \"2.0\",\n\t\tmethod: \"eth_getCode\",\n\t\tparams: [account, \"latest\"],\n\t})\n\t// Anything that is not a code string means the node did not answer the question. Reading that\n\t// as \"no delegation\" is how a throttled endpoint silently unseats a real solver: the bid is\n\t// dropped, the legs only it quoted vanish, and the pool reports zero depth it actually has.\n\tif (typeof response.result !== \"string\") {\n\t\tthrow new PhantomRpcError(`eth_getCode returned no code for ${account} on ${evmRpcUrl}`)\n\t}\n\n\tconst code = response.result.toLowerCase()\n\tif (!code.startsWith(DELEGATION_INDICATOR_PREFIX)) return false\n\n\treturn `0x${code.slice(DELEGATION_INDICATOR_PREFIX.length)}` === solverAccount.toLowerCase()\n}\n\n/** Promise-caching delegation reader produced by {@link memoizedDelegationCheck}. */\ntype DelegationReader = (evmRpcUrl: string, account: string, solverAccount: string) => Promise<boolean>\n\n/**\n * Caches the delegation check for the life of one aggregation, retries included.\n *\n * Two reads are otherwise repeated for nothing. A solver running several fillers has its bid\n * copied under each, and the dedupe that collapses them runs only AFTER verification, so every\n * copy re-interrogated the chain for the same answer. And a retry re-verifies every solver, even\n * when the run was abandoned over an unrelated read — so the endpoint most likely to be throttled\n * got up to five times the load from the very code meant to survive it.\n *\n * Rejections are evicted, so a retry re-reads rather than replaying a failure as a verdict. A\n * negative result is cached: an EOA cannot gain a delegation part-way through one bid window, and\n * \"not our solver\" is an answer, unlike an unreachable node.\n */\nfunction memoizedDelegationCheck(): DelegationReader {\n\tconst cache = new Map<string, Promise<boolean>>()\n\treturn (evmRpcUrl: string, account: string, solverAccount: string): Promise<boolean> => {\n\t\tconst key = `${evmRpcUrl}|${account.toLowerCase()}|${solverAccount.toLowerCase()}`\n\t\tlet pending = cache.get(key)\n\t\tif (!pending) {\n\t\t\tpending = isDelegatedToSolverAccount(evmRpcUrl, account, solverAccount).catch((err) => {\n\t\t\t\tcache.delete(key)\n\t\t\t\tthrow err\n\t\t\t})\n\t\t\tcache.set(key, pending)\n\t\t}\n\t\treturn pending\n\t}\n}\n\n/** Chain id out of an EVM state machine id (\"EVM-8453\" -> 8453n); null for any other format. */\nfunction evmChainId(chain: string): bigint | null {\n\tconst [prefix, id] = chain.split(\"-\")\n\tif (prefix !== \"EVM\" || !id || !/^\\d+$/.test(id)) return null\n\treturn BigInt(id)\n}\n\n/**\n * Whether a bid genuinely came from one of our solvers, and so may influence the snapshot.\n *\n * Anyone can submit a bid to the coprocessor, and every accepted quote moves the weighted median the\n * rest of the protocol prices intents against, so a bid is only counted if it clears both of the\n * checks SolverAccount would apply on-chain: the userOp carries a solver signature over this order's\n * userOpHash that recovers to the sender, and the sender is EIP-7702-delegated to the chain's\n * SolverAccount. Fails closed — a bid that cannot be read or verified is not counted.\n */\nasync function isVerifiedSolverBid(params: {\n\tuserOp: PackedUserOperation\n\tcommitment: string\n\tsessionKey: HexString\n\tchainId: bigint\n\tsolverAccount: string\n\tevmRpcUrl: string\n\trecoverSigner: RecoverBidSigner\n\tbidNonceKey: BidNonceKeyFn\n\t/** Cached per aggregation, so duplicate fillers and retries do not re-read the same answer. */\n\tisDelegated: DelegationReader\n\tlogger?: AggregationLogger\n}): Promise<boolean> {\n\tconst {\n\t\tuserOp,\n\t\tcommitment,\n\t\tsessionKey,\n\t\tchainId,\n\t\tsolverAccount,\n\t\tevmRpcUrl,\n\t\trecoverSigner,\n\t\tbidNonceKey,\n\t\tisDelegated,\n\t\tlogger,\n\t} = params\n\tconst solver = userOp.sender\n\n\tconst parsed = splitBidSignature(userOp.signature)\n\tif (!parsed) {\n\t\tlogger?.warn({ solver, commitment }, \"Rejecting phantom bid: malformed userOp signature\")\n\t\treturn false\n\t}\n\n\t// Cheap early-out ONLY. The prefix sits inside userOp.signature, which userOpHash excludes, so it\n\t// is attacker-mutable and must never be what binds a bid to an order — the nonce key below is.\n\tif (parsed.commitment.toLowerCase() !== commitment.toLowerCase()) {\n\t\tlogger?.warn(\n\t\t\t{ solver, commitment, signedFor: parsed.commitment },\n\t\t\t\"Rejecting phantom bid: signed for another order\",\n\t\t)\n\t\treturn false\n\t}\n\n\t// The authoritative binding, mirroring SolverAccount.validateUserOp on-chain. The nonce IS\n\t// covered by userOpHash, so a solver signature stays valid only for the (order, sessionKey) pair\n\t// its nonce key was derived from. `sessionKey` is read from the bid's own calldata, which is also\n\t// covered by userOpHash — so every operand here is signed, leaving nothing for a replay to swap.\n\tif (BigInt(userOp.nonce) >> 64n !== bidNonceKey(commitment as HexString, sessionKey)) {\n\t\tlogger?.warn({ solver, commitment }, \"Rejecting phantom bid: nonce does not bind order and session key\")\n\t\treturn false\n\t}\n\n\t// SolverAccount._rawSignatureValidation recovers over the bare userOpHash and requires the signer\n\t// to be the account itself, which under EIP-7702 is the sender EOA.\n\tconst signer = await recoverSigner(userOp, ENTRY_POINT_V08_ADDRESS, chainId, parsed.solverSignature)\n\tif (!signer || signer.toLowerCase() !== solver.toLowerCase()) {\n\t\tlogger?.warn({ solver, commitment, signer }, \"Rejecting phantom bid: signature does not recover to the sender\")\n\t\treturn false\n\t}\n\n\tif (!(await isDelegated(evmRpcUrl, solver, solverAccount))) {\n\t\tlogger?.warn({ solver, commitment, solverAccount }, \"Rejecting phantom bid: sender is not a delegated solver\")\n\t\treturn false\n\t}\n\n\treturn true\n}\n\nexport async function fetchBidsForOrder(nodeUrl: string, commitment: string): Promise<RpcBidInfo[]> {\n\tconst data = await rpcCall(nodeUrl, {\n\t\tid: 1,\n\t\tjsonrpc: \"2.0\",\n\t\tmethod: \"intents_getBidsForOrder\",\n\t\tparams: [commitment],\n\t})\n\treturn Array.isArray(data.result) ? (data.result as RpcBidInfo[]) : []\n}\n\n// A balance read that fails is NOT a balance of zero. Zero weight now removes a leg from the\n// snapshot entirely, so swallowing the failure would delete real liquidity on an RPC blip and\n// leave a pool reporting depth it has. Only \"0x\" — the call reverted or there is no code at the\n// address, i.e. the node did answer — is a genuine zero; everything else propagates.\nasync function ethCallUint(evmRpcUrl: string, to: string, data: string): Promise<bigint> {\n\tconst result = await rpcCall(evmRpcUrl, {\n\t\tid: 1,\n\t\tjsonrpc: \"2.0\",\n\t\tmethod: \"eth_call\",\n\t\tparams: [{ to, data }, \"latest\"],\n\t})\n\tif (result.result === \"0x\") return 0n\n\tif (typeof result.result !== \"string\") {\n\t\tthrow new PhantomRpcError(`eth_call returned no result for ${to} on ${evmRpcUrl}`)\n\t}\n\treturn BigInt(result.result)\n}\n\n// Sums the solver's redeemable balance of a single token on its destination chain: the raw ERC-20\n// balance plus any ERC-4626 vault positions wrapping it.\nasync function getTotalSolverBalance(\n\tevmRpcUrl: string,\n\tchain: string,\n\ttoken: string,\n\tsolver: string,\n\tyieldVaults: YieldVaultMap,\n): Promise<bigint> {\n\tconst padded = solver.replace(\"0x\", \"\").padStart(64, \"0\")\n\tconst raw = await ethCallUint(evmRpcUrl, token, `0x70a08231${padded}`) // balanceOf(address)\n\tconst vaults = yieldVaults[chain]?.[token.toLowerCase()] ?? []\n\tconst vaultBalances = await Promise.all(\n\t\tvaults.map((v) => ethCallUint(evmRpcUrl, v, `0xce96cb77${padded}`)), // maxWithdraw(address)\n\t)\n\treturn vaultBalances.reduce((acc, b) => acc + b, raw)\n}\n\n/** PositionManager + StateView addresses for a chain's Uniswap V4 deployment. */\nexport interface UniswapV4Contracts {\n\tpositionManager: string\n\tstateView: string\n}\n\n/** Everything a declared position's contribution depends on, read once and reused across legs. */\ninterface V4PositionState {\n\t/** Current on-chain owner. Compared against the bid's signer, never trusted from the bid. */\n\towner: string\n\tinfo: PoolAndPositionInfo\n\tliquidity: bigint\n\tsqrtPriceX96: bigint\n}\n\nconst SELECTOR_OWNER_OF = \"0x6352211e\"\nconst SELECTOR_POSITION_LIQUIDITY = \"0x1efeed33\"\nconst SELECTOR_POOL_AND_POSITION_INFO = \"0x7ba03aad\"\nconst SELECTOR_GET_SLOT0 = \"0xc815641c\"\n\nconst uint256Arg = (value: bigint) => value.toString(16).padStart(64, \"0\")\n\n/**\n * Reads a declared position: who owns it, how much liquidity it holds, and the price its pool is\n * currently at. Null when the position does not exist — a solver may name a burned tokenId, which\n * is not an RPC failure and must not sink the run.\n */\nasync function readV4Position(\n\tevmRpcUrl: string,\n\tcontracts: UniswapV4Contracts,\n\ttokenId: bigint,\n\tkeccak: (hex: HexString) => HexString,\n\tlogger?: AggregationLogger,\n): Promise<V4PositionState | null> {\n\tconst call = async (to: string, data: string): Promise<string | null> => {\n\t\tconst result = await rpcCall(evmRpcUrl, {\n\t\t\tid: 1,\n\t\t\tjsonrpc: \"2.0\",\n\t\t\tmethod: \"eth_call\",\n\t\t\tparams: [{ to, data }, \"latest\"],\n\t\t})\n\t\tif (result.result === \"0x\") return null\n\t\tif (typeof result.result !== \"string\") {\n\t\t\tthrow new PhantomRpcError(`eth_call returned no result for ${to} on ${evmRpcUrl}`)\n\t\t}\n\t\treturn result.result\n\t}\n\n\tconst arg = uint256Arg(tokenId)\n\tconst [ownerData, infoData, liquidityData] = await Promise.all([\n\t\tcall(contracts.positionManager, `${SELECTOR_OWNER_OF}${arg}`),\n\t\tcall(contracts.positionManager, `${SELECTOR_POOL_AND_POSITION_INFO}${arg}`),\n\t\tcall(contracts.positionManager, `${SELECTOR_POSITION_LIQUIDITY}${arg}`),\n\t])\n\t// An empty ownerOf is a tokenId that was never minted or has been burned — a solver may name a\n\t// stale position, which is its problem and not ours.\n\tif (!ownerData) return null\n\tif (!infoData || !liquidityData) {\n\t\tlogger?.warn(\n\t\t\t{ tokenId: tokenId.toString(), positionManager: contracts.positionManager },\n\t\t\t\"Uniswap V4 position exists but its pool info or liquidity did not read back — check the configured PositionManager\",\n\t\t)\n\t\treturn null\n\t}\n\n\tconst info = decodePoolAndPositionInfo(infoData)\n\t// The pool id is keccak of the PoolKey exactly as the chain returned it, so no re-encoding of\n\t// ours can disagree with the hash the pool was registered under.\n\tconst slot0Data = await call(contracts.stateView, `${SELECTOR_GET_SLOT0}${keccak(info.poolKeyEncoded).slice(2)}`)\n\t// The position resolved, so its pool exists — an empty slot0 means the call went somewhere that\n\t// is not a StateView, i.e. a misconfigured address. Silence here is what let a wrong address\n\t// zero out every declared position indefinitely instead of failing where someone would see it.\n\tif (!slot0Data) {\n\t\tlogger?.warn(\n\t\t\t{ tokenId: tokenId.toString(), stateView: contracts.stateView, evmRpcUrl },\n\t\t\t\"Uniswap V4 slot0 read returned nothing for a live position — the configured StateView address is wrong\",\n\t\t)\n\t\treturn null\n\t}\n\n\treturn {\n\t\towner: `0x${ownerData.slice(-40)}`.toLowerCase(),\n\t\tinfo,\n\t\tliquidity: word(liquidityData, 0),\n\t\tsqrtPriceX96: word(slot0Data, 0),\n\t}\n}\n\n/** Promise-caching position reader: one set of reads per position, reused across every leg. */\nfunction memoizedV4Position(keccak: (hex: HexString) => HexString, logger?: AggregationLogger) {\n\tconst cache = new Map<string, Promise<V4PositionState | null>>()\n\treturn (evmRpcUrl: string, chain: string, contracts: UniswapV4Contracts, tokenId: bigint) => {\n\t\tconst key = `${chain}|${tokenId}`\n\t\tlet pending = cache.get(key)\n\t\tif (!pending) {\n\t\t\tpending = readV4Position(evmRpcUrl, contracts, tokenId, keccak, logger).catch((err) => {\n\t\t\t\tcache.delete(key)\n\t\t\t\tthrow err\n\t\t\t})\n\t\t\tcache.set(key, pending)\n\t\t}\n\t\treturn pending\n\t}\n}\n\n/** Promise-caching balance reader produced by [`memoizedSolverBalance`]. */\nexport type SolverBalanceReader = (evmRpcUrl: string, chain: string, token: string, solver: string) => Promise<bigint>\n\n// One aggregation run reads the same (chain, token, solver) balance from several places — once\n// per leg the solver quoted in that token, and again in the liquidity sweep — and a bundled order\n// can carry up to 128 legs. Memoizing for the life of the run collapses that to one RPC round\n// trip per distinct triple, at the cost of ignoring balance changes within the run (the snapshot\n// is a point-in-time read either way). Exported so a caller aggregating several orders whose bid\n// windows close on the same block (one bundled order per configured chain) can share one memo\n// across the runs instead of re-reading identical balances per order.\nexport function memoizedSolverBalance(yieldVaults: YieldVaultMap): SolverBalanceReader {\n\tconst cache = new Map<string, Promise<bigint>>()\n\treturn (evmRpcUrl: string, chain: string, token: string, solver: string): Promise<bigint> => {\n\t\tconst key = `${chain}|${token.toLowerCase()}|${solver.toLowerCase()}`\n\t\tlet pending = cache.get(key)\n\t\tif (!pending) {\n\t\t\t// Evict on rejection. Caching a failure would make it permanent for the memo's lifetime —\n\t\t\t// every retry would replay the same failed read, and a block-scoped memo would carry one\n\t\t\t// blip across every order closing on that block.\n\t\t\tpending = getTotalSolverBalance(evmRpcUrl, chain, token, solver, yieldVaults).catch((err) => {\n\t\t\t\tcache.delete(key)\n\t\t\t\tthrow err\n\t\t\t})\n\t\t\tcache.set(key, pending)\n\t\t}\n\t\treturn pending\n\t}\n}\n\n// Sweeps a solver's liquidity for every configured yield-vault token on every supported chain: for\n// each chain that has both an RPC (in evmRpcUrls) and configured tokens (in yieldVaults), the\n// solver's balance (raw ERC-20 + ERC-4626 vault positions) for each token. Captures the LP's whole\n// liquidity picture, not just the token of the bid being priced. Zero balances are skipped so the\n// snapshot only records tokens the solver actually holds.\nasync function sweepSolverLiquidity(\n\tevmRpcUrls: Record<string, string>,\n\tyieldVaults: YieldVaultMap,\n\tsolver: string,\n\tgetBalance: ReturnType<typeof memoizedSolverBalance>,\n\t/** Verified positions and the chain they sit on; only that chain's tokens can draw on them. */\n\tpositions: { chain: string; states: V4PositionState[] },\n): Promise<LpBalance[]> {\n\tconst balances: LpBalance[] = []\n\tfor (const [chain, tokens] of Object.entries(yieldVaults)) {\n\t\tconst url = evmRpcUrls[chain]\n\t\tif (!url) continue\n\t\tfor (const token of Object.keys(tokens)) {\n\t\t\tconst balance = await getBalance(url, chain, token, solver)\n\t\t\tconst uniswapV4Balance =\n\t\t\t\tchain === positions.chain\n\t\t\t\t\t? positions.states.reduce(\n\t\t\t\t\t\t\t(total, state) =>\n\t\t\t\t\t\t\t\ttotal +\n\t\t\t\t\t\t\t\tpositionAmountOfToken({\n\t\t\t\t\t\t\t\t\tinfo: state.info,\n\t\t\t\t\t\t\t\t\tliquidity: state.liquidity,\n\t\t\t\t\t\t\t\t\tsqrtPriceX96: state.sqrtPriceX96,\n\t\t\t\t\t\t\t\t\toutputToken: token,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t0n,\n\t\t\t\t\t\t)\n\t\t\t\t\t: 0n\n\t\t\t// A token the solver neither holds nor has parked in a position is not a row.\n\t\t\tconst total = balance + uniswapV4Balance\n\t\t\tif (total === 0n) continue\n\t\t\tbalances.push({ solver, chain, tokenAddress: token as HexString, balance: total })\n\t\t}\n\t}\n\treturn balances\n}\n\n// Strips a bytes32 token field to a 20-byte lowercase address (or normalises an address as-is).\nfunction toAddress(token: string): HexString {\n\tconst hex = token.toLowerCase().replace(/^0x/, \"\")\n\tconst addr = hex.length > 40 ? hex.slice(-40) : hex.padStart(40, \"0\")\n\treturn `0x${addr}` as HexString\n}\n\n/**\n * Aggregates every bid for a phantom order into a single price/liquidity snapshot.\n *\n * Fetches the live bids via `intents_getBidsForOrder` and reads each filler's quoted output amount.\n * Only bids that {@link isVerifiedSolverBid} accepts are counted — a bid from anyone who is not one\n * of our delegated solvers, or whose signature was not produced for this order, is dropped rather\n * than allowed to move the price. The liquidity-weighted median then weights every surviving quote by\n * the solver's balance of the output token on the destination chain, so a solver that can't actually\n * deliver size carries little or no weight — which is why no fill simulation is needed to filter\n * unfillable quotes. For each bidding solver it also records a full liquidity sweep — every\n * configured yield-vault token on every supported chain (raw ERC-20 + vault positions). Returns\n * `null` when no bid survives verification.\n *\n * `extractFill` decodes a bid's ERC-7821 calldata into the fill's order/output and `recoverSigner`\n * recovers its solver signature; both default to the viem implementations, but the indexer injects\n * VM2-safe variants (viem's keccak throws in the SubQuery sandbox).\n *\n * The whole run is retried up to {@link AGGREGATION_ATTEMPTS} times on any error, because every\n * error that escapes the per-bid handling means some input could not be read, and a snapshot\n * computed from a partial bid set is worse than none: it publishes a confident price and zeroes\n * depth that exists. Throws if every attempt fails, leaving the window unsnapshotted — consumers\n * see the previous rate with a stale lastUpdatedBlock, which is a state they can already detect.\n */\nexport async function aggregatePhantomBids(\n\tparams: Parameters<typeof runAggregation>[0],\n): Promise<PhantomAggregation | null> {\n\t// Built out here, not per attempt: delegation cannot change within a bid window, so a retry\n\t// forced by one unrelated failed read must not re-interrogate every solver it already verified.\n\tconst isDelegated = memoizedDelegationCheck()\n\tlet lastErr: unknown\n\tfor (let attempt = 1; attempt <= AGGREGATION_ATTEMPTS; attempt++) {\n\t\ttry {\n\t\t\treturn await runAggregation(params, isDelegated)\n\t\t} catch (err) {\n\t\t\tlastErr = err\n\t\t\tparams.logger?.warn(\n\t\t\t\t{ err, commitment: params.commitment, chain: params.chain, attempt, of: AGGREGATION_ATTEMPTS },\n\t\t\t\t\"Phantom aggregation attempt failed\",\n\t\t\t)\n\t\t\tif (attempt < AGGREGATION_ATTEMPTS) await new Promise((resolve) => setTimeout(resolve, 250 * attempt))\n\t\t}\n\t}\n\tthrow lastErr\n}\n\n/** How many times a failed aggregation run is retried before the window is given up on. */\nexport const AGGREGATION_ATTEMPTS = 5\n\nasync function runAggregation(\n\tparams: {\n\t\tnodeUrl: string\n\t\t/** RPC URL per supported EVM chain (stateMachineId -> url); must include the destination chain. */\n\t\tevmRpcUrls: Record<string, string>\n\t\tchain: string\n\t\tgatewayAddress: string\n\t\tcommitment: string\n\t\tyieldVaults: YieldVaultMap\n\t\t/** SolverAccount on `chain` that our solvers delegate to; bids from anyone else are dropped. */\n\t\tsolverAccount: string\n\t\textractFill?: (callData: HexString, gatewayAddress: string) => FillData | null\n\t\trecoverSigner?: RecoverBidSigner\n\t\tbidNonceKey?: BidNonceKeyFn\n\t\torderCommitment?: OrderCommitmentFn\n\t\t/**\n\t\t * Balance reader shared across runs; defaults to a fresh per-run memo. Pass one built with\n\t\t * `memoizedSolverBalance` when aggregating several same-block orders, and build it from the\n\t\t * same `yieldVaults` passed here — the memo bakes in the vault map its balances include.\n\t\t */\n\t\tgetBalance?: SolverBalanceReader\n\t\t/**\n\t\t * Uniswap V4 deployment per chain. Supply it to let bids that declare positions have those\n\t\t * positions counted; without it a declaration is simply ignored, and the weight stays the\n\t\t * plain balance as before.\n\t\t */\n\t\tuniswapV4?: Record<string, UniswapV4Contracts>\n\t\t/** keccak256 over hex; defaults to viem's, which the VM2 sandbox must replace. */\n\t\tkeccak?: (hex: HexString) => HexString\n\t\tlogger?: AggregationLogger\n\t},\n\tisDelegated: DelegationReader,\n): Promise<PhantomAggregation | null> {\n\tconst { nodeUrl, evmRpcUrls, chain, gatewayAddress, commitment, yieldVaults, solverAccount, logger } = params\n\tconst extractFill = params.extractFill ?? extractFillData\n\tconst recoverSigner = params.recoverSigner ?? recoverBidSignerViem\n\tconst bidNonceKey = params.bidNonceKey ?? CryptoUtils.bidNonceKey\n\tconst orderCommitment = params.orderCommitment ?? orderCommitmentFromDecoded\n\n\tconst destUrl = evmRpcUrls[chain]\n\tif (!destUrl) return null\n\n\t// Both bid checks need these, and neither can be skipped without letting an unverified quote into\n\t// the price, so a chain we can't resolve them for produces no snapshot at all. solverAccount is\n\t// typed as required but comes from a config lookup that can miss, so it is re-checked here.\n\tconst chainId = evmChainId(chain)\n\tif (!solverAccount || chainId === null) {\n\t\tlogger?.warn({ chain, commitment }, \"Cannot verify phantom bids: no SolverAccount or chain id for chain\")\n\t\treturn null\n\t}\n\n\tconst bids = await fetchBidsForOrder(nodeUrl, commitment)\n\tif (bids.length === 0) return null\n\n\t// One set of reads per declared position, reused by every leg it backs.\n\tconst v4Contracts = params.uniswapV4?.[chain]\n\tconst readPosition = memoizedV4Position(params.keccak ?? keccak256, logger)\n\n\t// Balances repeat across legs and the sweep; one memo serves the whole run.\n\tconst getBalance = params.getBalance ?? memoizedSolverBalance(yieldVaults)\n\n\t// Quotes per leg, keyed by the leg's position in the order's asset lists. One bid carries a quote\n\t// for every leg its solver priced, so a solver that only handles some of the pairs still counts\n\t// towards those, and legs it skipped are left to the solvers that do handle them.\n\tconst quotesByLeg = new Map<\n\t\tnumber,\n\t\t{\n\t\t\toutputToken: HexString\n\t\t\tquotes: { price: bigint; weight: bigint }[]\n\t\t\tbidders: PhantomLegBidder[]\n\t\t}\n\t>()\n\tconst lpBalances: LpBalance[] = []\n\t// Bids are stored per substrate filler, but weight is a property of the EVM solver. Without this\n\t// one solver's bid, copied under N funded fillers, would count N times in the weighted median.\n\tconst countedSolvers = new Set<string>()\n\n\tfor (const bid of bids) {\n\t\tif (!bid.user_op) continue\n\t\ttry {\n\t\t\tconst decoded = decodeUserOpScale(bid.user_op as HexString)\n\t\t\tconst solver = decoded.sender\n\n\t\t\tconst fillData = extractFill(decoded.callData as HexString, gatewayAddress)\n\t\t\tif (!fillData) continue\n\n\t\t\t// The quoted price is read out of this order, so it must be the order being priced.\n\t\t\tconst decodedCommitment = orderCommitment(fillData.order)\n\t\t\tif (!decodedCommitment || decodedCommitment.toLowerCase() !== commitment.toLowerCase()) {\n\t\t\t\tlogger?.warn({ solver, commitment }, \"Rejecting phantom bid: calldata order is not the indexed order\")\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\tconst sessionKey = (fillData.order as any)?.session as HexString | undefined\n\t\t\tif (!sessionKey) {\n\t\t\t\tlogger?.warn({ solver, commitment }, \"Rejecting phantom bid: order carries no session key\")\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst verified = await isVerifiedSolverBid({\n\t\t\t\tuserOp: decoded,\n\t\t\t\tcommitment,\n\t\t\t\tsessionKey,\n\t\t\t\tchainId,\n\t\t\t\tsolverAccount,\n\t\t\t\tevmRpcUrl: destUrl,\n\t\t\t\trecoverSigner,\n\t\t\t\tbidNonceKey,\n\t\t\t\tisDelegated,\n\t\t\t\tlogger,\n\t\t\t})\n\t\t\tif (!verified) continue\n\n\t\t\tconst normalizedSolver = solver.toLowerCase()\n\t\t\tif (countedSolvers.has(normalizedSolver)) {\n\t\t\t\tlogger?.warn({ solver, commitment }, \"Skipping phantom bid: solver already counted for this order\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcountedSolvers.add(normalizedSolver)\n\n\t\t\t// The declaration rides in paymasterAndData, which the userOpHash covers, so it carries\n\t\t\t// the same authenticity as the quote itself.\n\t\t\tconst declaration = decodePhantomBidDeclaration(decoded.paymasterAndData)\n\t\t\tconst acceptedSources = declaration.acceptedSources\n\n\t\t\t// A zero amount is how a solver declines a leg it does not price, so it is not a quote.\n\t\t\t// Weights are fetched concurrently: the memo caches promises, so identical output tokens\n\t\t\t// across legs still collapse to a single RPC round trip.\n\t\t\tconst quotedLegs = [...fillData.legs.entries()].filter(([, leg]) => leg.solverAmount !== 0n)\n\n\t\t\t// Liquidity a solver parked in a Uniswap V4 position is real capacity but holds no ERC-20\n\t\t\t// balance, so without this it reads as zero and the leg is dropped. The bid only NAMES\n\t\t\t// the positions; ownership is checked against the signer here and the amounts come off\n\t\t\t// the chain, so naming more, or naming someone else's, buys nothing.\n\t\t\tconst declaredPositions = v4Contracts ? declaration.uniswapV4Positions : []\n\t\t\tconst positions = (\n\t\t\t\tawait Promise.all(\n\t\t\t\t\tdeclaredPositions.map((tokenId) => readPosition(destUrl, chain, v4Contracts!, tokenId)),\n\t\t\t\t)\n\t\t\t).filter((state, index): state is V4PositionState => {\n\t\t\t\tif (!state) return false\n\t\t\t\tif (state.owner !== normalizedSolver) {\n\t\t\t\t\tlogger?.warn(\n\t\t\t\t\t\t{ solver, commitment, tokenId: declaredPositions[index].toString(), owner: state.owner },\n\t\t\t\t\t\t\"Ignoring declared Uniswap V4 position: not owned by the bidding solver\",\n\t\t\t\t\t)\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t\treturn true\n\t\t\t})\n\n\t\t\tconst weights = await Promise.all(\n\t\t\t\t// Price influence: the solver's liquidity in THIS leg's output token on the destination\n\t\t\t\t// chain, so a leg is weighted by the inventory that actually backs it.\n\t\t\t\tquotedLegs.map(async ([, leg]) => {\n\t\t\t\t\tconst outputToken = toAddress(leg.outputToken)\n\t\t\t\t\tconst balance = await getBalance(destUrl, chain, outputToken, solver)\n\t\t\t\t\treturn positions.reduce(\n\t\t\t\t\t\t(total, state) =>\n\t\t\t\t\t\t\ttotal +\n\t\t\t\t\t\t\tpositionAmountOfToken({\n\t\t\t\t\t\t\t\tinfo: state.info,\n\t\t\t\t\t\t\t\tliquidity: state.liquidity,\n\t\t\t\t\t\t\t\tsqrtPriceX96: state.sqrtPriceX96,\n\t\t\t\t\t\t\t\toutputToken,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tbalance,\n\t\t\t\t\t)\n\t\t\t\t}),\n\t\t\t)\n\t\t\tfor (const [position, [legIndex, leg]] of quotedLegs.entries()) {\n\t\t\t\tconst weight = weights[position]\n\t\t\t\tconst entry = quotesByLeg.get(legIndex) ?? { outputToken: leg.outputToken, quotes: [], bidders: [] }\n\t\t\t\tentry.quotes.push({ price: leg.solverAmount, weight })\n\t\t\t\tentry.bidders.push({ solver: normalizedSolver as HexString, weight, acceptedSources })\n\t\t\t\tquotesByLeg.set(legIndex, entry)\n\t\t\t}\n\n\t\t\t// Full liquidity picture: every configured token on every supported chain. Swept once per\n\t\t\t// bid rather than per leg, since it measures the solver's whole inventory either way.\n\t\t\tlpBalances.push(\n\t\t\t\t...(await sweepSolverLiquidity(evmRpcUrls, yieldVaults, solver, getBalance, {\n\t\t\t\t\tchain,\n\t\t\t\t\tstates: positions,\n\t\t\t\t})),\n\t\t\t)\n\t\t} catch (err) {\n\t\t\t// A malformed bid is this bid's problem — skip it and price the rest. An unreachable RPC\n\t\t\t// is the snapshot's problem: continuing would silently price the order from whichever\n\t\t\t// bids happened to be readable, so abandon the run and let the retry above re-read.\n\t\t\tif (err instanceof PhantomRpcError) throw err\n\t\t\tlogger?.warn({ err, filler: bid.filler }, \"Failed to process bid for price snapshot\")\n\t\t}\n\t}\n\n\tif (quotesByLeg.size === 0) return null\n\n\t// Each leg reports a single price: the liquidity-weighted median of the quotes for that leg.\n\t// lowestPrice and highestPrice carry that same value rather than the raw min/max of the bid set,\n\t// so consumers cannot read an outlier bid as if it were a tradeable bound.\n\t//\n\t// A quote's weight is the solver's inventory in THAT leg's output token on the destination\n\t// chain, so a zero-weight quote is one its solver cannot deliver at any price. Those are\n\t// dropped outright rather than merely down-weighted: they must not reach weightedMedian (with\n\t// nothing to weight by it picks a quote by position, letting whoever quotes the extreme set the\n\t// rate on zero capital), and they must not reach bidCount or `bidders`, where they would inflate\n\t// the solver count behind a price and mint zero-capacity PoolBidder/PoolRoute rows downstream.\n\t// A leg left with no backed quote at all is therefore absent entirely, exactly as if nobody had\n\t// quoted it — no snapshot, and its depth zeroes out downstream.\n\tconst legs = [...quotesByLeg.entries()]\n\t\t.sort(([a], [b]) => a - b)\n\t\t.flatMap(([legIndex, { outputToken, quotes, bidders }]) => {\n\t\t\t// quotes and bidders are pushed in lockstep above, so the same predicate keeps them aligned.\n\t\t\tconst backedQuotes = quotes.filter((quote) => quote.weight > 0n)\n\t\t\tconst backedBidders = bidders.filter((bidder) => bidder.weight > 0n)\n\t\t\tif (backedQuotes.length === 0) {\n\t\t\t\tlogger?.warn(\n\t\t\t\t\t{ commitment, chain, legIndex, outputToken, quotes: quotes.length },\n\t\t\t\t\t\"Dropping phantom leg: no bidder holds the output token on this chain, so no quote is backed\",\n\t\t\t\t)\n\t\t\t\treturn []\n\t\t\t}\n\n\t\t\tconst medianPrice = weightedMedian(backedQuotes)\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tlegIndex,\n\t\t\t\t\toutputToken,\n\t\t\t\t\tlowestPrice: medianPrice,\n\t\t\t\t\thighestPrice: medianPrice,\n\t\t\t\t\tmedianPrice,\n\t\t\t\t\tbidCount: backedQuotes.length,\n\t\t\t\t\tbidders: backedBidders,\n\t\t\t\t},\n\t\t\t]\n\t\t})\n\n\treturn { legs, lpBalances }\n}\n"]}