@hyperbridge/sdk 2.8.0 → 2.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.d.ts +298 -17
- package/dist/browser/index.js +496 -113
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +497 -111
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +46 -6
- package/dist/node/index.d.ts +46 -6
- package/dist/node/index.js +496 -113
- package/dist/node/index.js.map +1 -1
- package/dist/node/{intents-helpers-gyGREuyu.d.cts → intents-helpers-CxCDx-hH.d.cts} +300 -19
- package/dist/node/{intents-helpers-gyGREuyu.d.ts → intents-helpers-CxCDx-hH.d.ts} +300 -19
- package/dist/node/intents-helpers.cjs +406 -50
- package/dist/node/intents-helpers.cjs.map +1 -1
- package/dist/node/intents-helpers.d.cts +1 -1
- package/dist/node/intents-helpers.d.ts +1 -1
- package/dist/node/intents-helpers.js +405 -51
- package/dist/node/intents-helpers.js.map +1 -1
- package/package.json +1 -1
|
@@ -924,6 +924,11 @@ interface ChainConfigData {
|
|
|
924
924
|
USDT: number;
|
|
925
925
|
cNGN?: number;
|
|
926
926
|
EXT?: number;
|
|
927
|
+
ZARP?: number;
|
|
928
|
+
EURC?: number;
|
|
929
|
+
XSGD?: number;
|
|
930
|
+
TRYB?: number;
|
|
931
|
+
USDR?: number;
|
|
927
932
|
};
|
|
928
933
|
tokenStorageSlots?: {
|
|
929
934
|
USDT?: {
|
|
@@ -942,6 +947,30 @@ interface ChainConfigData {
|
|
|
942
947
|
balanceSlot: number;
|
|
943
948
|
allowanceSlot: number;
|
|
944
949
|
};
|
|
950
|
+
cNGN?: {
|
|
951
|
+
balanceSlot: number;
|
|
952
|
+
allowanceSlot: number;
|
|
953
|
+
};
|
|
954
|
+
ZARP?: {
|
|
955
|
+
balanceSlot: number;
|
|
956
|
+
allowanceSlot: number;
|
|
957
|
+
};
|
|
958
|
+
EURC?: {
|
|
959
|
+
balanceSlot: number;
|
|
960
|
+
allowanceSlot: number;
|
|
961
|
+
};
|
|
962
|
+
XSGD?: {
|
|
963
|
+
balanceSlot: number;
|
|
964
|
+
allowanceSlot: number;
|
|
965
|
+
};
|
|
966
|
+
TRYB?: {
|
|
967
|
+
balanceSlot: number;
|
|
968
|
+
allowanceSlot: number;
|
|
969
|
+
};
|
|
970
|
+
USDR?: {
|
|
971
|
+
balanceSlot: number;
|
|
972
|
+
allowanceSlot: number;
|
|
973
|
+
};
|
|
945
974
|
};
|
|
946
975
|
addresses: {
|
|
947
976
|
IntentGateway?: `0x${string}`;
|
|
@@ -1343,6 +1372,17 @@ declare function convertCodecToIProof(codec: {
|
|
|
1343
1372
|
}): IProof;
|
|
1344
1373
|
declare function encodeISMPMessage(message: IIsmpMessage): Uint8Array;
|
|
1345
1374
|
|
|
1375
|
+
/**
|
|
1376
|
+
* Maps a websocket endpoint onto the HTTP endpoint of the same node — substrate serves both on the
|
|
1377
|
+
* same host and port, so the scheme is the only difference. Throws for anything that is not a
|
|
1378
|
+
* `ws(s)://` url rather than guessing at an endpoint.
|
|
1379
|
+
*
|
|
1380
|
+
* The HTTP endpoint is always derived, never configured, because it must be the *same node* as the
|
|
1381
|
+
* websocket: phantom orders are read out of that node's offchain worker storage, which is
|
|
1382
|
+
* node-local and not replicated, so a separately configured host would return nothing for orders
|
|
1383
|
+
* the events said exist.
|
|
1384
|
+
*/
|
|
1385
|
+
declare function deriveHttpUrl(wsUrl: string): string;
|
|
1346
1386
|
/**
|
|
1347
1387
|
* Encodes a PackedUserOperation using SCALE codec for submission to Hyperbridge.
|
|
1348
1388
|
* This is the recommended way to encode UserOps for the intents coprocessor.
|
|
@@ -1374,8 +1414,41 @@ interface PhantomOrderEvent {
|
|
|
1374
1414
|
*/
|
|
1375
1415
|
legs: PhantomOrderLeg[];
|
|
1376
1416
|
}
|
|
1417
|
+
/** One phantom bid to place, and the bid it replaces on the same chain. */
|
|
1418
|
+
interface PhantomBid {
|
|
1419
|
+
/** The phantom order commitment being bid on. */
|
|
1420
|
+
commitment: HexString$1;
|
|
1421
|
+
/** The SCALE-encoded PackedUserOperation backing the quote. */
|
|
1422
|
+
userOp: HexString$1;
|
|
1423
|
+
/**
|
|
1424
|
+
* A live bid from a previous interval on the same chain, retracted alongside this one to
|
|
1425
|
+
* reclaim its deposit. Best-effort: a retraction that fails never affects the bid.
|
|
1426
|
+
*/
|
|
1427
|
+
retractCommitment?: HexString$1;
|
|
1428
|
+
}
|
|
1429
|
+
/** What became of one bid in a batch. */
|
|
1430
|
+
interface PhantomBidOutcome {
|
|
1431
|
+
commitment: HexString$1;
|
|
1432
|
+
success: boolean;
|
|
1433
|
+
/** The dispatch error that rejected this bid, when it failed. */
|
|
1434
|
+
error?: string;
|
|
1435
|
+
}
|
|
1436
|
+
interface PhantomBidBatchResult {
|
|
1437
|
+
/** One entry per submitted bid, in the order they were given. */
|
|
1438
|
+
bids: PhantomBidOutcome[];
|
|
1439
|
+
/** The block and extrinsic the bids landed in. */
|
|
1440
|
+
blockHash?: HexString$1;
|
|
1441
|
+
extrinsicHash?: HexString$1;
|
|
1442
|
+
/**
|
|
1443
|
+
* The batch reached the pool but its inclusion was not observed, so no per-bid outcome is
|
|
1444
|
+
* known. Same contract as {@link BidSubmissionResult.pending}: in flight, do not re-sign.
|
|
1445
|
+
*/
|
|
1446
|
+
pending?: boolean;
|
|
1447
|
+
/** Set when the batch never landed at all, or when its item events could not be attributed. */
|
|
1448
|
+
error?: string;
|
|
1449
|
+
}
|
|
1377
1450
|
interface PollPhantomOrdersOptions {
|
|
1378
|
-
/** How often to check for a new head. Defaults to
|
|
1451
|
+
/** How often to check for a new head. Defaults to 15s, or 6s when the runtime is Gargantua. */
|
|
1379
1452
|
intervalMs?: number;
|
|
1380
1453
|
/**
|
|
1381
1454
|
* Most blocks scanned in a single poll, so a long outage catches up over several ticks instead of
|
|
@@ -1403,6 +1476,8 @@ declare class IntentsCoprocessor {
|
|
|
1403
1476
|
private ownsConnection;
|
|
1404
1477
|
/** Cached result of whether the node exposes intents_* RPC methods */
|
|
1405
1478
|
private hasIntentsRpc;
|
|
1479
|
+
/** The HTTP-backed api, connected on first use. Cleared after a failed attempt so it retries. */
|
|
1480
|
+
private httpApi;
|
|
1406
1481
|
private submissionQueue;
|
|
1407
1482
|
/**
|
|
1408
1483
|
* Creates and connects an IntentsCoprocessor to a Hyperbridge node.
|
|
@@ -1429,11 +1504,44 @@ declare class IntentsCoprocessor {
|
|
|
1429
1504
|
*/
|
|
1430
1505
|
static fromApi(api: ApiPromise, substratePrivateKey?: string): IntentsCoprocessor;
|
|
1431
1506
|
private constructor();
|
|
1507
|
+
/**
|
|
1508
|
+
* The API every RPC query runs on: HTTP, connected to the same node as the websocket. Exposed so
|
|
1509
|
+
* callers query through this connection rather than opening one of their own.
|
|
1510
|
+
*
|
|
1511
|
+
* The split is by what each transport is for. Queries are one-shot request/response, which HTTP
|
|
1512
|
+
* serves without holding any state that can silently rot between calls. The websocket earns its
|
|
1513
|
+
* keep only where subscriptions do — watching a submitted extrinsic to inclusion.
|
|
1514
|
+
*/
|
|
1515
|
+
queryApi(): Promise<ApiPromise>;
|
|
1516
|
+
/**
|
|
1517
|
+
* The websocket API, exposed so callers share this one connection instead of opening a second
|
|
1518
|
+
* socket to the same node. Only needed for subscriptions; use {@link queryApi} to read.
|
|
1519
|
+
*/
|
|
1520
|
+
get apiConnection(): ApiPromise;
|
|
1432
1521
|
/**
|
|
1433
1522
|
* Disconnects the underlying API connection if this instance owns it.
|
|
1434
|
-
* Only disconnects if created via `connect()`, not when using shared connections.
|
|
1523
|
+
* Only disconnects the websocket if created via `connect()`, not when using shared connections.
|
|
1524
|
+
* The HTTP api is always created here, so it is always ours to close.
|
|
1435
1525
|
*/
|
|
1436
1526
|
disconnect(): Promise<void>;
|
|
1527
|
+
/**
|
|
1528
|
+
* The HTTP api for this node, connected on first use. Every coprocessor has one — the endpoint
|
|
1529
|
+
* is derived from the websocket's own endpoint, so there is nothing to configure and nothing to
|
|
1530
|
+
* be absent.
|
|
1531
|
+
*
|
|
1532
|
+
* The connection attempt is bounded on both sides. `isReadyOrError` rejects on a failed
|
|
1533
|
+
* handshake, where plain `isReady` would simply never resolve, and the timeout covers an
|
|
1534
|
+
* endpoint that accepts the request and then goes quiet. An unbounded wait here would hang the
|
|
1535
|
+
* poll tick awaiting it, which is precisely the silent stall that polling exists to avoid. A
|
|
1536
|
+
* failed attempt is not cached, so the next call tries again.
|
|
1537
|
+
*/
|
|
1538
|
+
private http;
|
|
1539
|
+
/**
|
|
1540
|
+
* The endpoint the websocket provider is connected to. Read from the provider rather than
|
|
1541
|
+
* remembered from a constructor argument, so it is the one endpoint in use no matter which
|
|
1542
|
+
* factory built this instance.
|
|
1543
|
+
*/
|
|
1544
|
+
private wsEndpoint;
|
|
1437
1545
|
/**
|
|
1438
1546
|
* Creates a Substrate keypair from the configured private key.
|
|
1439
1547
|
* Supports hex seed (with or without 0x), mnemonic phrases, and URI derivation paths (//Alice).
|
|
@@ -1442,16 +1550,55 @@ declare class IntentsCoprocessor {
|
|
|
1442
1550
|
/**
|
|
1443
1551
|
* Signs and sends an extrinsic. Submissions are serialised through {@link submissionQueue} so
|
|
1444
1552
|
* concurrent calls never collide on the substrate account nonce — each extrinsic reaches a block
|
|
1445
|
-
* before the next is signed
|
|
1553
|
+
* (or is confirmed still pooled and returned as `pending`) before the next is signed; auto-nonce
|
|
1554
|
+
* via `system.accountNextIndex` counts pooled extrinsics, so a pending one is never re-used.
|
|
1555
|
+
*
|
|
1556
|
+
* The extrinsic is built rather than passed in because the api it is built on decides where it
|
|
1557
|
+
* is signed and sent: a websocket that is down when the queue reaches this submission diverts it
|
|
1558
|
+
* to {@link sendViaHttp}, which needs the call bound to the HTTP api instead.
|
|
1446
1559
|
*/
|
|
1447
1560
|
private signAndSendExtrinsic;
|
|
1561
|
+
/**
|
|
1562
|
+
* Last-resort submission for when the websocket is down at signing time. A bid is only worth
|
|
1563
|
+
* anything inside its window, so waiting for a reconnect usually means not bidding at all.
|
|
1564
|
+
*
|
|
1565
|
+
* HTTP has no subscriptions, so this is `author_submitExtrinsic`: the node accepts the extrinsic
|
|
1566
|
+
* into its pool and returns its hash, and nothing further is observable from here. That is
|
|
1567
|
+
* exactly the `pending` contract — in flight, outcome unknown, do not re-sign — so the result
|
|
1568
|
+
* says so rather than claiming a success it cannot see.
|
|
1569
|
+
*
|
|
1570
|
+
* Only reached when the socket was already down before signing. A submission that got as far as
|
|
1571
|
+
* the pool over the websocket is never retried here: that is the duplicate-nonce race the
|
|
1572
|
+
* `pending` result exists to prevent.
|
|
1573
|
+
*/
|
|
1574
|
+
private sendViaHttp;
|
|
1448
1575
|
/**
|
|
1449
1576
|
* Signs and sends an extrinsic, handling status updates and errors.
|
|
1450
1577
|
* Implements retry logic with progressive tip increases for stuck transactions.
|
|
1578
|
+
*
|
|
1579
|
+
* A retry only happens when the previous attempt verifiably went nowhere. Once an attempt's
|
|
1580
|
+
* extrinsic is known to be pooled (`pending`), re-signing the same call would race our own
|
|
1581
|
+
* submission: the copy either bounces off the pool (1014, same nonce below the replacement
|
|
1582
|
+
* priority bump) or — if the original lands first, freeing the nonce — executes as a duplicate
|
|
1583
|
+
* and fails on-chain (e.g. `BidNotFound` for a retraction). Neither can succeed, so the pending
|
|
1584
|
+
* result is returned for the caller to confirm later.
|
|
1451
1585
|
*/
|
|
1452
1586
|
private sendExtrinsicWithRetries;
|
|
1453
1587
|
/**
|
|
1454
|
-
*
|
|
1588
|
+
* Classifies a submission rejection. Codes 1013 ("already imported") and 1014 ("priority is
|
|
1589
|
+
* too low") both mean a copy of this account+nonce is already in the pool — almost always our
|
|
1590
|
+
* own earlier attempt whose watch handle didn't confirm cleanly. That extrinsic is in flight;
|
|
1591
|
+
* resubmitting can only bounce again or land a duplicate, so these are surfaced as `pending`
|
|
1592
|
+
* rather than failure.
|
|
1593
|
+
*/
|
|
1594
|
+
private classifySubmissionError;
|
|
1595
|
+
/**
|
|
1596
|
+
* Sends an extrinsic with a timeout.
|
|
1597
|
+
*
|
|
1598
|
+
* A timeout is only a failure when the extrinsic never made it into the transaction pool.
|
|
1599
|
+
* Once a pool-entry status (Future/Ready/Broadcast/Retracted) has been seen, the extrinsic is
|
|
1600
|
+
* in flight and may well execute after the watch is abandoned — the result is then `pending`,
|
|
1601
|
+
* telling the caller to confirm the outcome later instead of re-signing the same call.
|
|
1455
1602
|
*/
|
|
1456
1603
|
private sendWithTimeout;
|
|
1457
1604
|
/**
|
|
@@ -1492,6 +1639,40 @@ declare class IntentsCoprocessor {
|
|
|
1492
1639
|
* @returns BidSubmissionResult with success status and block/extrinsic hash
|
|
1493
1640
|
*/
|
|
1494
1641
|
submitBidWithRetraction(retractCommitment: HexString$1, bidCommitment: HexString$1, userOp: HexString$1): Promise<BidSubmissionResult>;
|
|
1642
|
+
/**
|
|
1643
|
+
* Places every phantom bid of one interval in a single extrinsic, retracting each chain's
|
|
1644
|
+
* previous bid alongside it.
|
|
1645
|
+
*
|
|
1646
|
+
* The pallet registers one phantom order per configured chain in the same block, so this is the
|
|
1647
|
+
* whole interval's set. Submitting them one at a time costs a block per chain: submissions are
|
|
1648
|
+
* serialised on the account nonce and each waits for inclusion, so the last chain's bid is many
|
|
1649
|
+
* blocks behind the first, against a bid window measured in tens of blocks. Batched, every bid
|
|
1650
|
+
* lands in the same block.
|
|
1651
|
+
*
|
|
1652
|
+
* Uses `utility.force_batch`, not `utility.batch`. `batch` stops at the first failing call, so
|
|
1653
|
+
* one rejected bid — a closed window, a duplicate, an insufficient deposit — would silently
|
|
1654
|
+
* drop every bid after it. `force_batch` runs them all and reports each outcome. It needs no
|
|
1655
|
+
* special origin: any signed account may call it, exactly like `batch`.
|
|
1656
|
+
*
|
|
1657
|
+
* @param bids - The bids to place; an empty list is a no-op
|
|
1658
|
+
* @returns Per-bid outcomes, in the order given
|
|
1659
|
+
*/
|
|
1660
|
+
submitPhantomBids(bids: PhantomBid[]): Promise<PhantomBidBatchResult>;
|
|
1661
|
+
/**
|
|
1662
|
+
* Reads one outcome per call out of a force_batch's events.
|
|
1663
|
+
*
|
|
1664
|
+
* `ItemFailed` carries no index — pallet-utility emits exactly one `ItemCompleted` or
|
|
1665
|
+
* `ItemFailed` per call, in call order, so the k-th item event belongs to call k.
|
|
1666
|
+
*
|
|
1667
|
+
* A count that does not match the calls submitted means the events are not the ones assumed
|
|
1668
|
+
* here, and every attribution after the discrepancy would be off by one. The bids are then
|
|
1669
|
+
* reported as placed: a bid wrongly recorded as landed is retracted next interval and the
|
|
1670
|
+
* retraction harmlessly fails with `BidNotFound`, whereas one wrongly recorded as failed is
|
|
1671
|
+
* never retracted at all and leaves its deposit reserved.
|
|
1672
|
+
*/
|
|
1673
|
+
private readForceBatchItems;
|
|
1674
|
+
/** Renders a DispatchError as `pallet::Error`, falling back to its raw form. */
|
|
1675
|
+
private describeDispatchError;
|
|
1495
1676
|
/**
|
|
1496
1677
|
* Fetches all bid storage entries for a given order commitment.
|
|
1497
1678
|
* Returns the on-chain data only (filler addresses and deposits).
|
|
@@ -1539,7 +1720,13 @@ declare class IntentsCoprocessor {
|
|
|
1539
1720
|
*/
|
|
1540
1721
|
getPhantomOrdersInBlock(blockNumber: number): Promise<PhantomOrderEvent[]>;
|
|
1541
1722
|
/**
|
|
1542
|
-
* Polls for newly registered phantom orders, invoking the callback once per
|
|
1723
|
+
* Polls for newly registered phantom orders, invoking the callback once per block that carries
|
|
1724
|
+
* any, with all of that block's orders.
|
|
1725
|
+
*
|
|
1726
|
+
* Per block rather than per order because that is how the pallet writes them: one order per
|
|
1727
|
+
* configured chain, all registered in the same `on_initialize`. Delivering them together lets a
|
|
1728
|
+
* caller bid on the whole interval in one extrinsic (see {@link submitPhantomBids}) instead of
|
|
1729
|
+
* one per chain.
|
|
1543
1730
|
*
|
|
1544
1731
|
* Each tick reads the current head and scans every block between the last one processed and that
|
|
1545
1732
|
* head, so the block cursor — not the connection — determines what has been seen. This replaced a
|
|
@@ -1552,9 +1739,21 @@ declare class IntentsCoprocessor {
|
|
|
1552
1739
|
* cannot drop them, because the cursor only advances past a block whose events were actually
|
|
1553
1740
|
* read. Recovery replays the backlog.
|
|
1554
1741
|
*
|
|
1742
|
+
* Every read here goes over HTTP, never the websocket. Polling is a sequence of independent
|
|
1743
|
+
* one-shot requests with no state to lose between them, which is exactly what a stateless
|
|
1744
|
+
* transport does well: a request either answers or fails loudly on this tick, instead of a
|
|
1745
|
+
* socket that looks alive while delivering nothing. It also means a websocket outage does not
|
|
1746
|
+
* pause phantom bidding at all — the two transports fail independently.
|
|
1747
|
+
*
|
|
1555
1748
|
* Returns a function that stops polling.
|
|
1556
1749
|
*/
|
|
1557
|
-
pollPhantomOrders(callback: (
|
|
1750
|
+
pollPhantomOrders(callback: (events: PhantomOrderEvent[]) => void, options?: PollPhantomOrdersOptions): () => void;
|
|
1751
|
+
/**
|
|
1752
|
+
* The poll cadence for the runtime this instance is connected to: Gargantua polls every block,
|
|
1753
|
+
* everything else every 15s. Falls back to the slower cadence if the runtime cannot be read,
|
|
1754
|
+
* since an unreachable node is the poll's problem to report, not the cadence lookup's.
|
|
1755
|
+
*/
|
|
1756
|
+
private phantomPollIntervalMs;
|
|
1558
1757
|
}
|
|
1559
1758
|
|
|
1560
1759
|
/**
|
|
@@ -2423,6 +2622,17 @@ interface FillerConfig {
|
|
|
2423
2622
|
* chains"; an empty array declares that no source chain is accepted.
|
|
2424
2623
|
*/
|
|
2425
2624
|
acceptedSourceChains?: string[];
|
|
2625
|
+
/**
|
|
2626
|
+
* Uniswap V4 position tokenIds this filler holds, per chain (state machine id -> tokenIds as
|
|
2627
|
+
* decimal strings), declared inside its phantom bids' paymasterAndData for the bid's own chain.
|
|
2628
|
+
*
|
|
2629
|
+
* Liquidity parked in a V4 position is invisible to the snapshot's inventory read, which sees
|
|
2630
|
+
* only ERC-20 balances and ERC-4626 vault shares — so without this a venue-funded filler is
|
|
2631
|
+
* weighted at zero and its quotes are discarded. The declaration is only a POINTER: the indexer
|
|
2632
|
+
* reads each position's liquidity on-chain and checks it is owned by the solver that signed the
|
|
2633
|
+
* bid, so naming a position cannot inflate it and naming someone else's achieves nothing.
|
|
2634
|
+
*/
|
|
2635
|
+
uniswapV4PositionsByChain?: Record<string, string[]>;
|
|
2426
2636
|
}
|
|
2427
2637
|
/**
|
|
2428
2638
|
* Result of an order execution attempt
|
|
@@ -2948,6 +3158,15 @@ interface BidSubmissionResult {
|
|
|
2948
3158
|
* Error message if submission failed
|
|
2949
3159
|
*/
|
|
2950
3160
|
error?: string;
|
|
3161
|
+
/**
|
|
3162
|
+
* The extrinsic is (or may still be) in the transaction pool: it was accepted but its
|
|
3163
|
+
* inclusion was not observed before the watch timed out, or a resubmission bounced off an
|
|
3164
|
+
* earlier copy already pooled (RPC 1013/1014). Only meaningful when `success` is false —
|
|
3165
|
+
* the operation is in flight, not failed, and must not be re-signed with the same nonce.
|
|
3166
|
+
* Callers should confirm the outcome later (e.g. re-check on-chain state) instead of
|
|
3167
|
+
* treating this as a terminal failure.
|
|
3168
|
+
*/
|
|
3169
|
+
pending?: boolean;
|
|
2951
3170
|
}
|
|
2952
3171
|
/**
|
|
2953
3172
|
* Represents a storage entry from pallet-intents Bids storage
|
|
@@ -4590,16 +4809,38 @@ declare const FILL_ORDER_ABI: readonly [{
|
|
|
4590
4809
|
readonly name: "WrongChain";
|
|
4591
4810
|
readonly inputs: readonly [];
|
|
4592
4811
|
}];
|
|
4812
|
+
/** What a phantom bid's paymasterAndData declares about the solver behind it. */
|
|
4813
|
+
interface PhantomBidDeclaration {
|
|
4814
|
+
/**
|
|
4815
|
+
* Source chains the solver accepts payment from. Null when the bid carries no parseable
|
|
4816
|
+
* declaration (the legacy default: the solver has not restricted its sources); an empty array
|
|
4817
|
+
* is an explicit accepts-nothing. Callers must preserve that distinction.
|
|
4818
|
+
*/
|
|
4819
|
+
acceptedSources: string[] | null;
|
|
4820
|
+
/**
|
|
4821
|
+
* Uniswap V4 position tokenIds the solver declares as backing this bid, on the order's own
|
|
4822
|
+
* chain. Empty when none are declared — including for every v1 bid, which predates the field.
|
|
4823
|
+
*/
|
|
4824
|
+
uniswapV4Positions: bigint[];
|
|
4825
|
+
}
|
|
4593
4826
|
/**
|
|
4594
|
-
* Encodes
|
|
4595
|
-
*
|
|
4827
|
+
* Encodes a phantom bid's declaration into the paymasterAndData blob. Emits the v1 layout when no
|
|
4828
|
+
* positions are declared, so a solver that only names source chains produces exactly the bytes it
|
|
4829
|
+
* produced before positions existed.
|
|
4596
4830
|
*/
|
|
4597
|
-
declare function
|
|
4831
|
+
declare function encodePhantomBidDeclaration(declaration: {
|
|
4832
|
+
acceptedSourceChains?: string[];
|
|
4833
|
+
uniswapV4Positions?: bigint[];
|
|
4834
|
+
}): HexString;
|
|
4598
4835
|
/**
|
|
4599
|
-
* Decodes a phantom bid's paymasterAndData
|
|
4600
|
-
*
|
|
4601
|
-
*
|
|
4836
|
+
* Decodes a phantom bid's paymasterAndData. Understands both layout versions, so bids placed
|
|
4837
|
+
* before positions existed keep decoding unchanged. Anything absent, unversioned or malformed
|
|
4838
|
+
* yields a null `acceptedSources` with no positions — never a partial read.
|
|
4602
4839
|
*/
|
|
4840
|
+
declare function decodePhantomBidDeclaration(paymasterAndData: string | undefined | null): PhantomBidDeclaration;
|
|
4841
|
+
/** Back-compat wrapper: the source-chain half of {@link encodePhantomBidDeclaration}. */
|
|
4842
|
+
declare function encodeAcceptedSourceChains(chains: string[]): HexString;
|
|
4843
|
+
/** Back-compat wrapper: the source-chain half of {@link decodePhantomBidDeclaration}. */
|
|
4603
4844
|
declare function decodeAcceptedSourceChains(paymasterAndData: string | undefined | null): string[] | null;
|
|
4604
4845
|
/** ERC-4626 vaults per chain, keyed by chain id then lowercase underlying token address. */
|
|
4605
4846
|
type YieldVaultMap = Record<string, Record<string, string[]>>;
|
|
@@ -4636,12 +4877,25 @@ interface LpBalance {
|
|
|
4636
4877
|
/** State machine id of the chain the balance was measured on (e.g. EVM-8453). */
|
|
4637
4878
|
chain: string;
|
|
4638
4879
|
tokenAddress: HexString;
|
|
4880
|
+
/**
|
|
4881
|
+
* Wallet ERC-20, redeemable ERC-4626 vault shares, and the withdrawable amount held in the
|
|
4882
|
+
* solver's declared Uniswap V4 positions — the same total the leg weights are built from, so a
|
|
4883
|
+
* provider's reported inventory and the depth attributed to it cannot disagree.
|
|
4884
|
+
*
|
|
4885
|
+
* The V4 share is only ever included on the chain whose bid declared the positions: a bid is
|
|
4886
|
+
* per chain, so no other chain's sweep can know about them. Consumers must therefore treat the
|
|
4887
|
+
* larger of two readings for the same (chain, token, block) as the complete one.
|
|
4888
|
+
*/
|
|
4639
4889
|
balance: bigint;
|
|
4640
4890
|
}
|
|
4641
|
-
/** One verified solver behind a leg's quote. */
|
|
4891
|
+
/** One verified solver behind a leg's quote, holding inventory to deliver it. */
|
|
4642
4892
|
interface PhantomLegBidder {
|
|
4643
4893
|
solver: HexString;
|
|
4644
|
-
/**
|
|
4894
|
+
/**
|
|
4895
|
+
* The solver's output-token inventory on the destination chain — its weight in the median.
|
|
4896
|
+
* Always greater than zero: a solver quoting a leg it holds none of is dropped, not recorded
|
|
4897
|
+
* at zero, since it can deliver nothing at any price.
|
|
4898
|
+
*/
|
|
4645
4899
|
weight: bigint;
|
|
4646
4900
|
/**
|
|
4647
4901
|
* Source chains the solver's signed paymasterAndData declaration accepts payment from. Null
|
|
@@ -4658,13 +4912,18 @@ interface PhantomLegAggregation {
|
|
|
4658
4912
|
lowestPrice: bigint;
|
|
4659
4913
|
highestPrice: bigint;
|
|
4660
4914
|
medianPrice: bigint;
|
|
4915
|
+
/** Backed quotes behind the price. Quotes from solvers holding no inventory are not counted. */
|
|
4661
4916
|
bidCount: number;
|
|
4662
|
-
/** The verified solvers quoting this leg; bidCount === bidders.length. */
|
|
4917
|
+
/** The verified, inventory-backed solvers quoting this leg; bidCount === bidders.length. */
|
|
4663
4918
|
bidders: PhantomLegBidder[];
|
|
4664
4919
|
}
|
|
4665
4920
|
/** The aggregated result for a single phantom order's bid window. */
|
|
4666
4921
|
interface PhantomAggregation {
|
|
4667
|
-
/**
|
|
4922
|
+
/**
|
|
4923
|
+
* One entry per leg that at least one solver quoted AND at least one of those quotes is backed
|
|
4924
|
+
* by output-token inventory on the destination chain. Legs nobody quoted are absent, and so are
|
|
4925
|
+
* legs every bidder quoted on zero inventory — neither is a price anyone could trade against.
|
|
4926
|
+
*/
|
|
4668
4927
|
legs: PhantomLegAggregation[];
|
|
4669
4928
|
lpBalances: LpBalance[];
|
|
4670
4929
|
}
|
|
@@ -4703,7 +4962,14 @@ type RecoverBidSigner = (userOp: PackedUserOperation, entryPoint: HexString, cha
|
|
|
4703
4962
|
* indexer injects an ethers equivalent (see the note at the top of this file).
|
|
4704
4963
|
*/
|
|
4705
4964
|
declare const recoverBidSignerViem: RecoverBidSigner;
|
|
4965
|
+
/** Promise-caching delegation reader produced by {@link memoizedDelegationCheck}. */
|
|
4966
|
+
type DelegationReader = (evmRpcUrl: string, account: string, solverAccount: string) => Promise<boolean>;
|
|
4706
4967
|
declare function fetchBidsForOrder(nodeUrl: string, commitment: string): Promise<RpcBidInfo[]>;
|
|
4968
|
+
/** PositionManager + StateView addresses for a chain's Uniswap V4 deployment. */
|
|
4969
|
+
interface UniswapV4Contracts {
|
|
4970
|
+
positionManager: string;
|
|
4971
|
+
stateView: string;
|
|
4972
|
+
}
|
|
4707
4973
|
/** Promise-caching balance reader produced by [`memoizedSolverBalance`]. */
|
|
4708
4974
|
type SolverBalanceReader = (evmRpcUrl: string, chain: string, token: string, solver: string) => Promise<bigint>;
|
|
4709
4975
|
declare function memoizedSolverBalance(yieldVaults: YieldVaultMap): SolverBalanceReader;
|
|
@@ -4723,8 +4989,15 @@ declare function memoizedSolverBalance(yieldVaults: YieldVaultMap): SolverBalanc
|
|
|
4723
4989
|
* `extractFill` decodes a bid's ERC-7821 calldata into the fill's order/output and `recoverSigner`
|
|
4724
4990
|
* recovers its solver signature; both default to the viem implementations, but the indexer injects
|
|
4725
4991
|
* VM2-safe variants (viem's keccak throws in the SubQuery sandbox).
|
|
4992
|
+
*
|
|
4993
|
+
* The whole run is retried up to {@link AGGREGATION_ATTEMPTS} times on any error, because every
|
|
4994
|
+
* error that escapes the per-bid handling means some input could not be read, and a snapshot
|
|
4995
|
+
* computed from a partial bid set is worse than none: it publishes a confident price and zeroes
|
|
4996
|
+
* depth that exists. Throws if every attempt fails, leaving the window unsnapshotted — consumers
|
|
4997
|
+
* see the previous rate with a stale lastUpdatedBlock, which is a state they can already detect.
|
|
4726
4998
|
*/
|
|
4727
|
-
declare function aggregatePhantomBids(params:
|
|
4999
|
+
declare function aggregatePhantomBids(params: Parameters<typeof runAggregation>[0]): Promise<PhantomAggregation | null>;
|
|
5000
|
+
declare function runAggregation(params: {
|
|
4728
5001
|
nodeUrl: string;
|
|
4729
5002
|
/** RPC URL per supported EVM chain (stateMachineId -> url); must include the destination chain. */
|
|
4730
5003
|
evmRpcUrls: Record<string, string>;
|
|
@@ -4744,8 +5017,16 @@ declare function aggregatePhantomBids(params: {
|
|
|
4744
5017
|
* same `yieldVaults` passed here — the memo bakes in the vault map its balances include.
|
|
4745
5018
|
*/
|
|
4746
5019
|
getBalance?: SolverBalanceReader;
|
|
5020
|
+
/**
|
|
5021
|
+
* Uniswap V4 deployment per chain. Supply it to let bids that declare positions have those
|
|
5022
|
+
* positions counted; without it a declaration is simply ignored, and the weight stays the
|
|
5023
|
+
* plain balance as before.
|
|
5024
|
+
*/
|
|
5025
|
+
uniswapV4?: Record<string, UniswapV4Contracts>;
|
|
5026
|
+
/** keccak256 over hex; defaults to viem's, which the VM2 sandbox must replace. */
|
|
5027
|
+
keccak?: (hex: HexString) => HexString;
|
|
4747
5028
|
logger?: AggregationLogger;
|
|
4748
|
-
}): Promise<PhantomAggregation | null>;
|
|
5029
|
+
}, isDelegated: DelegationReader): Promise<PhantomAggregation | null>;
|
|
4749
5030
|
|
|
4750
5031
|
declare const ABI: readonly [{
|
|
4751
5032
|
readonly type: "constructor";
|
|
@@ -7558,4 +7839,4 @@ declare const _default: {
|
|
|
7558
7839
|
}];
|
|
7559
7840
|
};
|
|
7560
7841
|
|
|
7561
|
-
export { type BidStorageEntry as $, type AssetTeleported as A, type Bid as B, ChainConfigService as C, type EstimateFillOrderParams as D, type EstimateGasCallData as E, type FillerBid as F, type GetRequestWithStatus as G, type HexString$1 as H, type IChain as I, type FillOrderEstimate as J, type OrderFeesQuote as K, type ERC7821Call as L, type OrderWithStatus as M, OrderStatus as N, type Order as O, type PostRequestWithStatus as P, type TokenGatewayAssetTeleportedWithStatus as Q, type RetryConfig as R, type StateMachineIdParams as S, type Transaction as T, TeleportStatus as U, type DecodedOrderPlacedLog as V, type DecodedPostRequestEvent as W, type DecodedPostResponseEvent as X, type AllStatusKey as Y, type AssetTeleportedResponse as Z, type AvailableLiquidityByChain as _, type IEvmConfig as a,
|
|
7842
|
+
export { type BidStorageEntry as $, type AssetTeleported as A, type Bid as B, ChainConfigService as C, type EstimateFillOrderParams as D, type EstimateGasCallData as E, type FillerBid as F, type GetRequestWithStatus as G, type HexString$1 as H, type IChain as I, type FillOrderEstimate as J, type OrderFeesQuote as K, type ERC7821Call as L, type OrderWithStatus as M, OrderStatus as N, type Order as O, type PostRequestWithStatus as P, type TokenGatewayAssetTeleportedWithStatus as Q, type RetryConfig as R, type StateMachineIdParams as S, type Transaction as T, TeleportStatus as U, type DecodedOrderPlacedLog as V, type DecodedPostRequestEvent as W, type DecodedPostResponseEvent as X, type AllStatusKey as Y, type AssetTeleportedResponse as Z, type AvailableLiquidityByChain as _, type IEvmConfig as a, TimeoutStatus as a$, type BidSubmissionResult as a0, type BlockMetadata as a1, type BytesLikeHex as a2, type CancelOptions as a3, type ChainConfig as a4, type ChainConfigData as a5, Chains as a6, type ConfiguredAssetSymbol as a7, type Deployment as a8, type DispatchGet as a9, IntentOrderStatus as aA, type IntentOrderStatusKey as aB, type IsmpRequest as aC, type OrderResponse as aD, type OrderStatusMetadata as aE, type PaymentInfo as aF, type PhantomBid as aG, type PhantomBidBatchResult as aH, type PhantomBidDeclaration as aI, type PhantomBidOutcome as aJ, type PhantomOrderEvent as aK, type PhantomOrderLeg as aL, type PhantomOrderPriceSnapshot as aM, type PhantomOrderPriceSnapshotsResponse as aN, type PollPhantomOrdersOptions as aO, type PostRequestStatus as aP, type RequestBody as aQ, type RequestCommitment as aR, RequestKind as aS, type RequestResponse as aT, RequestStatus as aU, type RequestStatusKey as aV, type SelectOptions as aW, type SigningAccount as aX, type StateMachineId as aY, type StateMachineResponse as aZ, type StorageFacade as a_, type DispatchInfo as aa, type DispatchPost as ab, type Erc4626VaultConfigData as ac, type ExecuteIntentOrderOptions as ad, type ExecutionResult as ae, type FillOptions as af, type FillerConfig as ag, type GetRequestResponse as ah, type GetResponseByRequestIdResponse as ai, type GetResponseStorageValues as aj, type HostParams as ak, HyperClientStatus as al, type IBatchConsensusAndGetResponseMessage as am, type IBatchConsensusAndPostRequestMessage as an, type IConfig as ao, type IConsensusMessage as ap, type IGetRequestMessage as aq, type IGetResponse as ar, type IGetResponseMessage as as, type IHyperbridgeConfig as at, type IPostResponse as au, type IRequestMessage as av, type ISubstrateConfig as aw, type ITimeoutPostRequestMessage as ax, ABI as ay, type IntentGatewayParams as az, type IMessage as b, type TimeoutStatusKey as b0, type TokenGatewayAssetTeleportedResponse as b1, type TokenInfo as b2, type TokenPrice as b3, type TokenPricesResponse as b4, type UniswapV4PoolConfigData as b5, chainConfigs as b6, convertCodecToIGetRequest as b7, convertCodecToIProof as b8, convertIGetRequestToCodec as b9, type BidSignature as bA, ENTRY_POINT_V08_ADDRESS as bB, FILL_ORDER_ABI as bC, type FetchLike as bD, type FillData as bE, type HexString as bF, _default as bG, type LpBalance as bH, type OrderCommitmentFn as bI, type PhantomAggregation as bJ, type PhantomLegAggregation as bK, type PhantomLegBidder as bL, type RecoverBidSigner as bM, type RpcBidInfo as bN, type SolverBalanceReader as bO, type YieldVaultMap as bP, aggregatePhantomBids as bQ, extractFillData as bR, fetchBidsForOrder as bS, memoizedSolverBalance as bT, orderCommitmentFromDecoded as bU, recoverBidSignerViem as bV, setAggregationFetch as bW, splitBidSignature as bX, weightedMedian as bY, zipFillLegs as bZ, convertIProofToCodec as ba, convertStateIdToStateMachineId as bb, convertStateMachineEnumToString as bc, convertStateMachineIdToEnum as bd, decodeAcceptedSourceChains as be, decodeERC7821ExecuteBatch as bf, decodePhantomBidDeclaration as bg, decodeUserOpScale as bh, deriveHttpUrl as bi, encodeAcceptedSourceChains as bj, encodeERC7821ExecuteBatch as bk, encodeISMPMessage as bl, encodePhantomBidDeclaration as bm, encodeUserOpScale as bn, getChainId as bo, getConfigByStateMachineId as bp, getViemChain as bq, hyperbridgeAddress as br, pharosAtlantic as bs, pharosMainnet as bt, polkadotAssetHubPaseo as bu, polkadotHubMainnet as bv, tronChainIds as bw, tronNile as bx, type AggregationLogger as by, type BidNonceKeyFn as bz, type StateMachineHeight as c, type IIsmpMessage as d, type IPostRequest as e, type IGetRequest as f, type IPolkadotHubConfig as g, type IPharosConfig as h, type StateMachineUpdate as i, type ResponseCommitmentWithValues as j, type RequestStatusWithMetadata as k, type PostRequestTimeoutStatus as l, SubstrateChain as m, type ClientConfig as n, type IndexerQueryClient as o, type IProof as p, type IEvmChain as q, IntentsCoprocessor as r, type AvailableLiquiditySnapshot as s, type IntentOrderStatusUpdate as t, type SelectBidResult as u, type ResumeIntentOrderOptions as v, type CancelOrderOptions as w, type CancelQuote as x, type SubmitBidOptions as y, type PackedUserOperation as z };
|