@morpho-dev/router 0.2.1 → 0.3.0
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/cli.js +1200 -559
- package/dist/drizzle/migrations/0015_add-lots-table.sql +12 -0
- package/dist/drizzle/migrations/0016_merkle-metadata.sql +26 -0
- package/dist/drizzle/migrations/meta/0015_snapshot.json +1365 -0
- package/dist/drizzle/migrations/meta/0016_snapshot.json +1531 -0
- package/dist/drizzle/migrations/meta/_journal.json +14 -0
- package/dist/index.browser.d.mts +443 -229
- package/dist/index.browser.d.mts.map +1 -1
- package/dist/index.browser.d.ts +439 -229
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +533 -202
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.mjs +534 -203
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.node.d.mts +737 -67
- package/dist/index.node.d.mts.map +1 -1
- package/dist/index.node.d.ts +737 -67
- package/dist/index.node.d.ts.map +1 -1
- package/dist/index.node.js +1240 -513
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.mjs +1241 -514
- package/dist/index.node.mjs.map +1 -1
- package/package.json +1 -2
package/dist/index.node.d.mts
CHANGED
|
@@ -274,7 +274,7 @@ declare const Morpho: readonly [{
|
|
|
274
274
|
readonly stateMutability: "view";
|
|
275
275
|
}];
|
|
276
276
|
declare namespace Callback_d_exports {
|
|
277
|
-
export { CallbackType, decode$3 as decode, decodeBuyVaultV1Callback, decodeSellERC20Callback, encode$3 as encode, encodeBuyVaultV1Callback, encodeSellERC20Callback, isEmptyCallback };
|
|
277
|
+
export { BuyVaultV1CallbackData, CallbackType, SellERC20CallbackData, decode$3 as decode, decodeBuyVaultV1Callback, decodeSellERC20Callback, encode$3 as encode, encodeBuyVaultV1Callback, encodeSellERC20Callback, isEmptyCallback };
|
|
278
278
|
}
|
|
279
279
|
declare enum CallbackType {
|
|
280
280
|
BuyWithEmptyCallback = "buy_with_empty_callback",
|
|
@@ -286,7 +286,16 @@ declare function decode$3(type: CallbackType, data: Hex): {
|
|
|
286
286
|
contract: Address;
|
|
287
287
|
amount: bigint;
|
|
288
288
|
}[];
|
|
289
|
-
|
|
289
|
+
type BuyVaultV1CallbackData = {
|
|
290
|
+
vaults: Address[];
|
|
291
|
+
amounts: bigint[];
|
|
292
|
+
};
|
|
293
|
+
type SellERC20CallbackData = {
|
|
294
|
+
collaterals: Address[];
|
|
295
|
+
amounts: bigint[];
|
|
296
|
+
};
|
|
297
|
+
declare function encode$3(type: CallbackType.BuyVaultV1Callback, data: BuyVaultV1CallbackData): Hex;
|
|
298
|
+
declare function encode$3(type: CallbackType.SellERC20Callback, data: SellERC20CallbackData): Hex;
|
|
290
299
|
declare function decodeBuyVaultV1Callback(data: Hex): Array<{
|
|
291
300
|
contract: Address;
|
|
292
301
|
amount: bigint;
|
|
@@ -635,7 +644,7 @@ declare class InvalidOptionError extends BaseError {
|
|
|
635
644
|
constructor(input: string);
|
|
636
645
|
}
|
|
637
646
|
declare namespace Offer_d_exports {
|
|
638
|
-
export { AccountNotSetError, InvalidOfferError, Offer, OfferConsumed, OfferHashSchema, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$2 as decode, domain, encode$2 as encode, from$12 as from, fromSnakeCase$2 as fromSnakeCase, hash, obligationId, random$2 as random, sign, signatureMsg, toSnakeCase, types };
|
|
647
|
+
export { AccountNotSetError, InvalidOfferError, Offer, OfferConsumed, OfferHashSchema, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$2 as decode, domain, encode$2 as encode, from$12 as from, fromSnakeCase$2 as fromSnakeCase, hash, obligationId, random$2 as random, serialize, sign, signatureMsg, toSnakeCase, types };
|
|
639
648
|
}
|
|
640
649
|
type Offer = {
|
|
641
650
|
/** The address that made the offer. */
|
|
@@ -744,6 +753,37 @@ declare function fromSnakeCase$2(input: Snake<Omit<Offer, "chainId" | "hash"> &
|
|
|
744
753
|
* @returns The converted offer.
|
|
745
754
|
*/
|
|
746
755
|
declare function toSnakeCase(offer: Offer): Snake<Offer>;
|
|
756
|
+
/**
|
|
757
|
+
* Serializes an offer for merkle tree encoding.
|
|
758
|
+
* Converts BigInt fields to strings for JSON compatibility.
|
|
759
|
+
*
|
|
760
|
+
* @param offer - Offer to serialize
|
|
761
|
+
* @returns JSON-serializable offer object
|
|
762
|
+
*/
|
|
763
|
+
declare const serialize: (offer: Offer) => {
|
|
764
|
+
offering: `0x${string}`;
|
|
765
|
+
assets: string;
|
|
766
|
+
rate: string;
|
|
767
|
+
maturity: number;
|
|
768
|
+
expiry: number;
|
|
769
|
+
start: number;
|
|
770
|
+
nonce: string;
|
|
771
|
+
buy: boolean;
|
|
772
|
+
chainId: Id;
|
|
773
|
+
loanToken: `0x${string}`;
|
|
774
|
+
collaterals: {
|
|
775
|
+
asset: `0x${string}`;
|
|
776
|
+
oracle: `0x${string}`;
|
|
777
|
+
lltv: string;
|
|
778
|
+
}[];
|
|
779
|
+
callback: {
|
|
780
|
+
address: `0x${string}`;
|
|
781
|
+
data: `0x${string}`;
|
|
782
|
+
gasLimit: string;
|
|
783
|
+
};
|
|
784
|
+
signature: `0x${string}` | undefined;
|
|
785
|
+
hash: `0x${string}`;
|
|
786
|
+
};
|
|
747
787
|
type RandomConfig = {
|
|
748
788
|
chains?: Chain$1[];
|
|
749
789
|
loanTokens?: Address[];
|
|
@@ -1375,46 +1415,148 @@ declare namespace from$7 {
|
|
|
1375
1415
|
type ReturnType = Transfer;
|
|
1376
1416
|
}
|
|
1377
1417
|
declare namespace Tree_d_exports {
|
|
1378
|
-
export { Tree, VERSION$1 as VERSION, decode$1 as decode, encode$1 as encode, from$6 as from };
|
|
1418
|
+
export { DecodeError, EncodeError, Proof, Tree, TreeError, VERSION$1 as VERSION, decode$1 as decode, encode$1 as encode, encodeUnsigned, from$6 as from, proofs };
|
|
1379
1419
|
}
|
|
1420
|
+
/**
|
|
1421
|
+
* A merkle tree of offers built from offer hashes.
|
|
1422
|
+
* Constructed via {@link from}. The tree root can be signed for onchain broadcast.
|
|
1423
|
+
*/
|
|
1380
1424
|
type Tree = Compute<StandardMerkleTree<[Hex]> & {
|
|
1425
|
+
/** The offers in the tree. */
|
|
1381
1426
|
offers: Offer[];
|
|
1427
|
+
/** The root of the tree. */
|
|
1382
1428
|
root: Hex;
|
|
1383
1429
|
}>;
|
|
1430
|
+
type Proof = {
|
|
1431
|
+
/** The offer that the proof is for. */
|
|
1432
|
+
offer: Offer;
|
|
1433
|
+
/** The merkle proof path for the offer. */
|
|
1434
|
+
path: Hex[];
|
|
1435
|
+
};
|
|
1384
1436
|
declare const VERSION$1 = 1;
|
|
1385
1437
|
/**
|
|
1386
1438
|
* Builds a Merkle tree from a list of offers.
|
|
1387
1439
|
*
|
|
1388
1440
|
* Leaves are the offer `hash` values as `bytes32` and are deterministically
|
|
1389
|
-
* ordered
|
|
1390
|
-
* regardless of the input order.
|
|
1441
|
+
* ordered following the StandardMerkleTree leaf ordering so that the resulting
|
|
1442
|
+
* root is stable regardless of the input order.
|
|
1391
1443
|
*
|
|
1392
1444
|
* @param offers - Offers to include in the tree.
|
|
1393
1445
|
* @returns A `StandardMerkleTree` of `bytes32` leaves representing the offers.
|
|
1446
|
+
* @throws {TreeError} If tree building fails due to offer inconsistencies.
|
|
1394
1447
|
*/
|
|
1395
1448
|
declare const from$6: (offers: Offer[]) => Tree;
|
|
1396
1449
|
/**
|
|
1397
|
-
*
|
|
1450
|
+
* Generates merkle proofs for all offers in a tree.
|
|
1398
1451
|
*
|
|
1399
|
-
*
|
|
1400
|
-
*
|
|
1452
|
+
* Each proof allows independent verification that an offer is included in the tree
|
|
1453
|
+
* without requiring the full tree. Proofs are ordered by StandardMerkleTree leaf ordering.
|
|
1401
1454
|
*
|
|
1402
|
-
* @param tree - The
|
|
1403
|
-
* @returns
|
|
1404
|
-
* @throws Error if the given `root` does not match the offers.
|
|
1455
|
+
* @param tree - The {@link Tree} to generate proofs for.
|
|
1456
|
+
* @returns Array of proofs - {@link Proof}
|
|
1405
1457
|
*/
|
|
1406
|
-
declare const
|
|
1458
|
+
declare const proofs: (tree: Tree) => Proof[];
|
|
1407
1459
|
/**
|
|
1408
|
-
*
|
|
1460
|
+
* Encodes a merkle tree with signature into hex calldata for onchain broadcast.
|
|
1461
|
+
*
|
|
1462
|
+
* Layout: `0x{vv}{gzip([...offers])}{root}{signature}` where:
|
|
1463
|
+
* - `{vv}`: 1-byte version (currently 0x01)
|
|
1464
|
+
* - `{gzip([...offers])}`: gzipped JSON array of serialized offers
|
|
1465
|
+
* - `{root}`: 32-byte merkle root
|
|
1466
|
+
* - `{signature}`: 65-byte EIP-191 signature over raw root bytes
|
|
1467
|
+
*
|
|
1468
|
+
* Validates signature authenticity and root integrity before encoding.
|
|
1469
|
+
*
|
|
1470
|
+
* @example
|
|
1471
|
+
* ```typescript
|
|
1472
|
+
* const tree = Tree.from(offers);
|
|
1473
|
+
* const signature = await wallet.signMessage({ message: { raw: tree.root } });
|
|
1474
|
+
* const calldata = await Tree.encode(tree, signature);
|
|
1475
|
+
* await broadcast(calldata);
|
|
1476
|
+
* ```
|
|
1409
1477
|
*
|
|
1410
|
-
*
|
|
1411
|
-
*
|
|
1478
|
+
* @example
|
|
1479
|
+
* Manual construction (for advanced users):
|
|
1480
|
+
* ```typescript
|
|
1481
|
+
* const tree = Tree.from(offers);
|
|
1482
|
+
* const compressed = gzip(JSON.stringify(tree.offers.map(Offer.serialize)));
|
|
1483
|
+
* const partial = `0x01${bytesToHex(compressed)}${tree.root.slice(2)}`;
|
|
1484
|
+
* const signature = await wallet.signMessage({ message: { raw: tree.root } });
|
|
1485
|
+
* const calldata = `${partial}${signature.slice(2)}`;
|
|
1486
|
+
* ```
|
|
1412
1487
|
*
|
|
1413
|
-
* @param
|
|
1414
|
-
* @
|
|
1415
|
-
* @
|
|
1488
|
+
* @param tree - Merkle tree of offers
|
|
1489
|
+
* @param signature - EIP-191 signature over raw root bytes
|
|
1490
|
+
* @returns Hex-encoded calldata ready for onchain broadcast
|
|
1491
|
+
* @throws {EncodeError} If signature verification fails or root mismatch
|
|
1416
1492
|
*/
|
|
1417
|
-
declare const
|
|
1493
|
+
declare const encode$1: (tree: Tree, signature: Hex) => Promise<Hex>;
|
|
1494
|
+
/**
|
|
1495
|
+
* Encodes a merkle tree without a signature into hex payload for client-side signing.
|
|
1496
|
+
*
|
|
1497
|
+
* Layout: `0x{vv}{gzip([...offers])}{root}` where:
|
|
1498
|
+
* - `{vv}`: 1-byte version (currently 0x01)
|
|
1499
|
+
* - `{gzip([...offers])}`: gzipped JSON array of serialized offers
|
|
1500
|
+
* - `{root}`: 32-byte merkle root
|
|
1501
|
+
*
|
|
1502
|
+
* Validates root integrity before encoding.
|
|
1503
|
+
*
|
|
1504
|
+
* @param tree - Merkle tree of offers
|
|
1505
|
+
* @returns Hex-encoded unsigned payload
|
|
1506
|
+
* @throws {EncodeError} If root mismatch
|
|
1507
|
+
*/
|
|
1508
|
+
declare const encodeUnsigned: (tree: Tree) => Hex;
|
|
1509
|
+
/**
|
|
1510
|
+
* Decodes hex calldata into a validated merkle tree.
|
|
1511
|
+
*
|
|
1512
|
+
* Validates signature before decompression for fail-fast rejection of invalid payloads.
|
|
1513
|
+
* Returns the tree with separately validated signature and recovered signer address.
|
|
1514
|
+
*
|
|
1515
|
+
* Validation order:
|
|
1516
|
+
* 1. Version check
|
|
1517
|
+
* 2. Signature verification (fail-fast, before decompression)
|
|
1518
|
+
* 3. Decompression (only if signature valid)
|
|
1519
|
+
* 4. Root verification (computed from offers vs embedded root)
|
|
1520
|
+
*
|
|
1521
|
+
* @example
|
|
1522
|
+
* ```typescript
|
|
1523
|
+
* const { tree, signature, signer } = await Tree.decode(calldata);
|
|
1524
|
+
* console.log(`Tree signed by ${signer} with ${tree.offers.length} offers`);
|
|
1525
|
+
* ```
|
|
1526
|
+
*
|
|
1527
|
+
* @param encoded - Hex calldata in format `0x{vv}{gzip}{root}{signature}`
|
|
1528
|
+
* @returns Validated tree, signature, and recovered signer address
|
|
1529
|
+
* @throws {DecodeError} If version invalid, signature invalid, or root mismatch
|
|
1530
|
+
*/
|
|
1531
|
+
declare const decode$1: (encoded: Hex) => Promise<{
|
|
1532
|
+
tree: Tree;
|
|
1533
|
+
signature: Hex;
|
|
1534
|
+
signer: Address;
|
|
1535
|
+
}>;
|
|
1536
|
+
/**
|
|
1537
|
+
* Error thrown during tree building operations.
|
|
1538
|
+
* Indicates structural issues with the tree (missing offers, inconsistent state).
|
|
1539
|
+
*/
|
|
1540
|
+
declare class TreeError extends BaseError {
|
|
1541
|
+
name: string;
|
|
1542
|
+
constructor(reason: string);
|
|
1543
|
+
}
|
|
1544
|
+
/**
|
|
1545
|
+
* Error thrown during tree encoding.
|
|
1546
|
+
* Indicates validation failures (signature, root mismatch, mixed makers).
|
|
1547
|
+
*/
|
|
1548
|
+
declare class EncodeError extends BaseError {
|
|
1549
|
+
name: string;
|
|
1550
|
+
constructor(reason: string);
|
|
1551
|
+
}
|
|
1552
|
+
/**
|
|
1553
|
+
* Error thrown during tree decoding.
|
|
1554
|
+
* Indicates payload corruption, version mismatch, or validation failures.
|
|
1555
|
+
*/
|
|
1556
|
+
declare class DecodeError extends BaseError {
|
|
1557
|
+
name: string;
|
|
1558
|
+
constructor(reason: string);
|
|
1559
|
+
}
|
|
1418
1560
|
declare namespace Logger_d_exports {
|
|
1419
1561
|
export { LogEntry, LogFn, LogLevel, LogLevelValues, Logger, defaultLogger, getLogger, runWithLogger, silentLogger };
|
|
1420
1562
|
}
|
|
@@ -1440,11 +1582,11 @@ declare function getLogger(): Logger;
|
|
|
1440
1582
|
//#region src/database/domains/Book.d.ts
|
|
1441
1583
|
type BookDomain = {
|
|
1442
1584
|
/** Get aggregated book levels for a given obligation side. */
|
|
1443
|
-
get: (parameters: get$
|
|
1585
|
+
get: (parameters: get$4.Parameters) => Promise<get$4.ReturnType>;
|
|
1444
1586
|
/** Get all offers for a given obligation side with cross-invalidation. */
|
|
1445
1587
|
getOffers: (parameters: getOffers$2.Parameters) => Promise<getOffers$2.ReturnType>;
|
|
1446
1588
|
};
|
|
1447
|
-
declare namespace get$
|
|
1589
|
+
declare namespace get$4 {
|
|
1448
1590
|
type Parameters = {
|
|
1449
1591
|
/** The side of the offer. */
|
|
1450
1592
|
side: "buy" | "sell";
|
|
@@ -1597,7 +1739,7 @@ declare function run<T, Name$2 extends string, Rules$1 extends readonly Rule<T,
|
|
|
1597
1739
|
chunkSize?: number;
|
|
1598
1740
|
}): Promise<Result<T, RuleNames<Rules$1>>>;
|
|
1599
1741
|
declare namespace Gatekeeper_d_exports {
|
|
1600
|
-
export { Gatekeeper, Rules, create$
|
|
1742
|
+
export { Gatekeeper, Rules, create$5 as create };
|
|
1601
1743
|
}
|
|
1602
1744
|
type Rules = readonly Rule<Offer, string>[];
|
|
1603
1745
|
type Gatekeeper = {
|
|
@@ -1607,7 +1749,7 @@ type Gatekeeper = {
|
|
|
1607
1749
|
type GatekeeperParameters = {
|
|
1608
1750
|
rules: Rules;
|
|
1609
1751
|
};
|
|
1610
|
-
declare function create$
|
|
1752
|
+
declare function create$5(parameters: GatekeeperParameters): Gatekeeper;
|
|
1611
1753
|
declare namespace GateConfig_d_exports {
|
|
1612
1754
|
export { CallbackConfig, GateConfig, assets$1 as assets, configs, getCallback, getCallbackAddresses, getCallbackType, getCallbackTypeAddresses };
|
|
1613
1755
|
}
|
|
@@ -1662,9 +1804,9 @@ declare const assets$1: Record<string, Address[]>;
|
|
|
1662
1804
|
declare const configs: Record<Name$1, GateConfig>;
|
|
1663
1805
|
//#endregion
|
|
1664
1806
|
//#region src/gatekeeper/morphoRules.d.ts
|
|
1665
|
-
declare const morphoRules: (chains: Chain$1[]) => (Rule<Offer, "chain_ids"> | Rule<Offer, "maturity"> | Rule<Offer, "callback"> | Rule<Offer, "token">)[];
|
|
1807
|
+
declare const morphoRules: (chains: Chain$1[]) => (Rule<Offer, "chain_ids"> | Rule<Offer, "maturity"> | Rule<Offer, "callback"> | Rule<Offer, "token"> | Rule<Offer, "mixed_maker">)[];
|
|
1666
1808
|
declare namespace Rules_d_exports {
|
|
1667
|
-
export { ValidityParameters, callback, chains$1 as chains, maturity, token, validity };
|
|
1809
|
+
export { ValidityParameters, callback, chains$1 as chains, maturity, sameMaker, token, validity };
|
|
1668
1810
|
}
|
|
1669
1811
|
type ValidityParameters = {
|
|
1670
1812
|
client: PublicClient<Transport, Chain$1>;
|
|
@@ -1703,8 +1845,14 @@ declare const token: ({
|
|
|
1703
1845
|
}: {
|
|
1704
1846
|
assets: Address[];
|
|
1705
1847
|
}) => Rule<Offer, "token">;
|
|
1848
|
+
/**
|
|
1849
|
+
* A batch validation rule that ensures all offers in a tree have the same maker (offering address).
|
|
1850
|
+
* Returns an issue only for the first non-conforming offer.
|
|
1851
|
+
* This rule is signing-agnostic; signer verification is handled at the collector level.
|
|
1852
|
+
*/
|
|
1853
|
+
declare const sameMaker: () => Rule<Offer, "mixed_maker">;
|
|
1706
1854
|
declare namespace Indexer_d_exports {
|
|
1707
|
-
export { Indexer, IndexerConfig, create$
|
|
1855
|
+
export { Indexer, IndexerConfig, create$4 as create, from$5 as from };
|
|
1708
1856
|
}
|
|
1709
1857
|
type Indexer = {
|
|
1710
1858
|
start: () => () => void;
|
|
@@ -1723,7 +1871,7 @@ type IndexerConfig<client extends PublicClient<Transport, Chain$1, Account | und
|
|
|
1723
1871
|
retryDelayMs?: number;
|
|
1724
1872
|
};
|
|
1725
1873
|
declare function from$5<client extends PublicClient<Transport, Chain$1, Account | undefined>>(config: IndexerConfig<client>): Indexer;
|
|
1726
|
-
declare function create$
|
|
1874
|
+
declare function create$4<client extends PublicClient<Transport, Chain$1, Account | undefined>>(params: {
|
|
1727
1875
|
db: Database;
|
|
1728
1876
|
collectors: Collector[];
|
|
1729
1877
|
client: client;
|
|
@@ -1781,6 +1929,50 @@ type ConsumedDomain = {
|
|
|
1781
1929
|
}) => Promise<number>;
|
|
1782
1930
|
};
|
|
1783
1931
|
//#endregion
|
|
1932
|
+
//#region src/database/domains/Lots.d.ts
|
|
1933
|
+
type Lot = {
|
|
1934
|
+
chainId: Id;
|
|
1935
|
+
user: Address;
|
|
1936
|
+
contract: Address;
|
|
1937
|
+
group: string;
|
|
1938
|
+
lower: bigint;
|
|
1939
|
+
upper: bigint;
|
|
1940
|
+
};
|
|
1941
|
+
type LotsDomain = {
|
|
1942
|
+
/**
|
|
1943
|
+
* Create or update lots for offers.
|
|
1944
|
+
* Called when offers are created to reserve liquidity on positions.
|
|
1945
|
+
* For each (position, group), keeps only the biggest offer by assets.
|
|
1946
|
+
* If lot exists and new offer is bigger, grows the lot and shifts higher lots.
|
|
1947
|
+
*/
|
|
1948
|
+
create: (parameters: create$3.Parameters) => Promise<void>;
|
|
1949
|
+
/**
|
|
1950
|
+
* Get lots with optional filtering.
|
|
1951
|
+
*/
|
|
1952
|
+
get: (parameters?: get$3.Parameters) => Promise<Lot[]>;
|
|
1953
|
+
};
|
|
1954
|
+
declare namespace create$3 {
|
|
1955
|
+
type OfferLotInfo = {
|
|
1956
|
+
positionChainId: Id;
|
|
1957
|
+
positionContract: Address;
|
|
1958
|
+
positionUser: Address;
|
|
1959
|
+
group: string;
|
|
1960
|
+
size: bigint;
|
|
1961
|
+
};
|
|
1962
|
+
type Parameters = OfferLotInfo[];
|
|
1963
|
+
type ReturnType = undefined;
|
|
1964
|
+
}
|
|
1965
|
+
declare namespace get$3 {
|
|
1966
|
+
type Parameters = {
|
|
1967
|
+
chainId?: Id;
|
|
1968
|
+
user?: Address;
|
|
1969
|
+
contract?: Address;
|
|
1970
|
+
group?: string;
|
|
1971
|
+
};
|
|
1972
|
+
type ReturnType = Lot[];
|
|
1973
|
+
}
|
|
1974
|
+
declare function create$3(db: Core): LotsDomain;
|
|
1975
|
+
//#endregion
|
|
1784
1976
|
//#region src/database/domains/Offers.d.ts
|
|
1785
1977
|
type OffersDomain = {
|
|
1786
1978
|
/** Create multiple offer. */
|
|
@@ -1825,6 +2017,30 @@ type GetOffersParams = {
|
|
|
1825
2017
|
offering?: Address;
|
|
1826
2018
|
} & PaginationParams$1;
|
|
1827
2019
|
//#endregion
|
|
2020
|
+
//#region src/database/domains/Offsets.d.ts
|
|
2021
|
+
type Offset = {
|
|
2022
|
+
chainId: Id;
|
|
2023
|
+
user: Address;
|
|
2024
|
+
contract: Address;
|
|
2025
|
+
group: string;
|
|
2026
|
+
value: bigint;
|
|
2027
|
+
};
|
|
2028
|
+
type OffsetsDomain = {
|
|
2029
|
+
/**
|
|
2030
|
+
* Get offsets with optional filtering.
|
|
2031
|
+
*/
|
|
2032
|
+
get: (parameters?: get$2.Parameters) => Promise<Offset[]>;
|
|
2033
|
+
};
|
|
2034
|
+
declare namespace get$2 {
|
|
2035
|
+
type Parameters = {
|
|
2036
|
+
chainId?: Id;
|
|
2037
|
+
user?: Address;
|
|
2038
|
+
contract?: Address;
|
|
2039
|
+
group?: string;
|
|
2040
|
+
};
|
|
2041
|
+
type ReturnType = Offset[];
|
|
2042
|
+
}
|
|
2043
|
+
//#endregion
|
|
1828
2044
|
//#region src/database/domains/Oracles.d.ts
|
|
1829
2045
|
type OraclesDomain = {
|
|
1830
2046
|
/**
|
|
@@ -1915,6 +2131,39 @@ declare namespace create$2 {
|
|
|
1915
2131
|
}
|
|
1916
2132
|
declare const create$2: (db: Core) => TransfersDomain;
|
|
1917
2133
|
//#endregion
|
|
2134
|
+
//#region src/database/domains/Trees.d.ts
|
|
2135
|
+
/**
|
|
2136
|
+
* Attestation data for a single offer, containing the merkle root, signature, and proof.
|
|
2137
|
+
*/
|
|
2138
|
+
type Attestation = {
|
|
2139
|
+
root: Hex;
|
|
2140
|
+
signature: Hex;
|
|
2141
|
+
proof: Hex[];
|
|
2142
|
+
};
|
|
2143
|
+
/**
|
|
2144
|
+
* Input for creating trees with their signatures.
|
|
2145
|
+
*/
|
|
2146
|
+
type CreateInput = {
|
|
2147
|
+
tree: Tree;
|
|
2148
|
+
signature: Hex;
|
|
2149
|
+
};
|
|
2150
|
+
type TreesDomain = {
|
|
2151
|
+
/**
|
|
2152
|
+
* Creates trees, offers, and attestation links in a single transaction.
|
|
2153
|
+
*
|
|
2154
|
+
* @param trees - Array of decoded trees with signatures (batch insertion)
|
|
2155
|
+
* @returns Array of tree roots that were created/upserted
|
|
2156
|
+
*/
|
|
2157
|
+
create: (trees: CreateInput[]) => Promise<Hex[]>;
|
|
2158
|
+
/**
|
|
2159
|
+
* Retrieves merkle attestations for execution flow.
|
|
2160
|
+
*
|
|
2161
|
+
* @param hashes - Array of offer hashes to look up
|
|
2162
|
+
* @returns Map of offer hash to attestation (only entries with attestations are included)
|
|
2163
|
+
*/
|
|
2164
|
+
getAttestations: (hashes: Hex[]) => Promise<Map<Hex, Attestation>>;
|
|
2165
|
+
};
|
|
2166
|
+
//#endregion
|
|
1918
2167
|
//#region src/database/domains/Validations.d.ts
|
|
1919
2168
|
type GetParams = {
|
|
1920
2169
|
status?: Status;
|
|
@@ -1949,7 +2198,10 @@ type Domains = {
|
|
|
1949
2198
|
offers: OffersDomain;
|
|
1950
2199
|
chains: ChainsDomain;
|
|
1951
2200
|
consumed: ConsumedDomain;
|
|
2201
|
+
lots: LotsDomain;
|
|
2202
|
+
offsets: OffsetsDomain;
|
|
1952
2203
|
oracles: OraclesDomain;
|
|
2204
|
+
trees: TreesDomain;
|
|
1953
2205
|
validations: ValidationsDomain;
|
|
1954
2206
|
positions: PositionsDomain;
|
|
1955
2207
|
transfers: TransfersDomain;
|
|
@@ -2454,10 +2706,11 @@ interface paths {
|
|
|
2454
2706
|
put?: never;
|
|
2455
2707
|
/**
|
|
2456
2708
|
* Validate offers
|
|
2457
|
-
* @description Validates offers against router validation rules. Returns
|
|
2709
|
+
* @description Validates offers against router validation rules. Returns unsigned payload + root on success, or issues only on validation failure.
|
|
2458
2710
|
*
|
|
2459
2711
|
* **Available validation rules:**
|
|
2460
2712
|
* - **parse_error**: Returns when an offer fails to parse due to invalid format or missing required fields
|
|
2713
|
+
* - **mixed_maker**: Validates that all offers in a batch have the same maker (offering address)
|
|
2461
2714
|
* - **chain_ids**: Validates that offer chain is one of: [109111114]
|
|
2462
2715
|
* - **maturity**: Validates that offer maturity is one of: [end_of_month, end_of_next_month]
|
|
2463
2716
|
* - **callback**: Validates callbacks: buy empty callback is allowed; sell offers must use a non-empty callback; non-empty callbacks must target one of [0x3333333333333333333333333333333333333333, 0x4444444444444444444444444444444444444444, 0x1111111111111111111111111111111111111111, 0x2222222222222222222222222222222222222222]
|
|
@@ -2482,7 +2735,7 @@ interface paths {
|
|
|
2482
2735
|
[name: string]: unknown;
|
|
2483
2736
|
};
|
|
2484
2737
|
content: {
|
|
2485
|
-
"application/json": components["schemas"]["
|
|
2738
|
+
"application/json": components["schemas"]["ValidationSuccessResponse"];
|
|
2486
2739
|
};
|
|
2487
2740
|
};
|
|
2488
2741
|
/** @description Bad Request */
|
|
@@ -2577,10 +2830,15 @@ interface components {
|
|
|
2577
2830
|
* "data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000",
|
|
2578
2831
|
* "gas_limit": "500000"
|
|
2579
2832
|
* },
|
|
2580
|
-
* "signature": "0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400",
|
|
2581
2833
|
* "consumed": "0",
|
|
2582
2834
|
* "takeable": "369216000000000000000000",
|
|
2583
|
-
* "block_number": 2942933377146801
|
|
2835
|
+
* "block_number": 2942933377146801,
|
|
2836
|
+
* "root": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
|
|
2837
|
+
* "proof": [
|
|
2838
|
+
* "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
|
|
2839
|
+
* "0x9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba"
|
|
2840
|
+
* ],
|
|
2841
|
+
* "signature": "0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400"
|
|
2584
2842
|
* }
|
|
2585
2843
|
* ]
|
|
2586
2844
|
*/
|
|
@@ -2633,6 +2891,15 @@ interface components {
|
|
|
2633
2891
|
consumed: string;
|
|
2634
2892
|
/** @example 2942933377146801 */
|
|
2635
2893
|
block_number: number;
|
|
2894
|
+
/** @example 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef */
|
|
2895
|
+
root: string | null;
|
|
2896
|
+
/**
|
|
2897
|
+
* @example [
|
|
2898
|
+
* "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
|
|
2899
|
+
* "0x9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba"
|
|
2900
|
+
* ]
|
|
2901
|
+
*/
|
|
2902
|
+
proof: string[] | null;
|
|
2636
2903
|
/** @example 0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400 */
|
|
2637
2904
|
signature: string | null;
|
|
2638
2905
|
};
|
|
@@ -2764,13 +3031,8 @@ interface components {
|
|
|
2764
3031
|
updated_at: string;
|
|
2765
3032
|
};
|
|
2766
3033
|
ValidateOffersRequest: {
|
|
2767
|
-
/** @description Array of offers in snake_case format.
|
|
2768
|
-
offers
|
|
2769
|
-
/**
|
|
2770
|
-
* @description Encoded tree calldata as a hex string (0x-prefixed). Mutually exclusive with 'offers'.
|
|
2771
|
-
* @example 0x01...
|
|
2772
|
-
*/
|
|
2773
|
-
calldata?: string;
|
|
3034
|
+
/** @description Array of offers in snake_case format. Required, non-empty. */
|
|
3035
|
+
offers: components["schemas"]["ValidateOfferRequest"][];
|
|
2774
3036
|
};
|
|
2775
3037
|
ValidateOfferRequest: {
|
|
2776
3038
|
/** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
@@ -2812,22 +3074,24 @@ interface components {
|
|
|
2812
3074
|
*/
|
|
2813
3075
|
callback: components["schemas"]["OfferCallbackResponse"];
|
|
2814
3076
|
};
|
|
2815
|
-
|
|
3077
|
+
ValidationSuccessResponse: {
|
|
2816
3078
|
meta: components["schemas"]["Meta"];
|
|
2817
3079
|
/** @example null */
|
|
2818
3080
|
cursor: string | null;
|
|
2819
|
-
/** @description
|
|
2820
|
-
data: components["schemas"]["
|
|
3081
|
+
/** @description Payload and root for client-side signing. */
|
|
3082
|
+
data: components["schemas"]["ValidationSuccessDataResponse"];
|
|
2821
3083
|
};
|
|
2822
|
-
|
|
2823
|
-
/**
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
3084
|
+
ValidationSuccessDataResponse: {
|
|
3085
|
+
/**
|
|
3086
|
+
* @description Unsigned payload: version (1B) + gzip(offers) + root (32B).
|
|
3087
|
+
* @example 0x01789c...
|
|
3088
|
+
*/
|
|
3089
|
+
payload: string;
|
|
3090
|
+
/**
|
|
3091
|
+
* @description Merkle tree root to sign with EIP-191.
|
|
3092
|
+
* @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427
|
|
3093
|
+
*/
|
|
3094
|
+
root: string;
|
|
2831
3095
|
};
|
|
2832
3096
|
};
|
|
2833
3097
|
responses: never;
|
|
@@ -2855,9 +3119,10 @@ type OfferResponse = paths["/v1/offers"]["get"]["responses"]["200"]["content"]["
|
|
|
2855
3119
|
* Creates an `OfferResponse` from an `Offer`.
|
|
2856
3120
|
* @constructor
|
|
2857
3121
|
* @param offer - {@link Offer}
|
|
3122
|
+
* @param attestation - {@link Attestation}
|
|
2858
3123
|
* @returns The created `OfferResponse`. {@link OfferResponse}
|
|
2859
3124
|
*/
|
|
2860
|
-
declare function from$1(offer: Offer): OfferResponse;
|
|
3125
|
+
declare function from$1(offer: Offer, attestation?: Attestation): OfferResponse;
|
|
2861
3126
|
//#endregion
|
|
2862
3127
|
//#region src/api/Schema/openapi.d.ts
|
|
2863
3128
|
declare class BooksController {
|
|
@@ -2916,9 +3181,8 @@ declare const schemas: {
|
|
|
2916
3181
|
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
2917
3182
|
}, z$1.core.$strip>;
|
|
2918
3183
|
readonly validate_offers: z$1.ZodObject<{
|
|
2919
|
-
offers: z$1.
|
|
2920
|
-
|
|
2921
|
-
}, z$1.core.$strip>;
|
|
3184
|
+
offers: z$1.ZodArray<z$1.ZodUnknown>;
|
|
3185
|
+
}, z$1.core.$strict>;
|
|
2922
3186
|
};
|
|
2923
3187
|
type Action = keyof typeof schemas;
|
|
2924
3188
|
declare function parse<A extends Action>(action: A, query: unknown): z$1.infer<(typeof schemas)[A]>;
|
|
@@ -2988,18 +3252,22 @@ declare function getObligations$1(queryParameters: object, db: Database): Promis
|
|
|
2988
3252
|
declare function getOffers$1(queryParameters: object, db: Database): Promise<Payload<OfferResponse[]>>;
|
|
2989
3253
|
//#endregion
|
|
2990
3254
|
//#region src/api/Controllers/validateOffers.d.ts
|
|
2991
|
-
type
|
|
2992
|
-
|
|
2993
|
-
valid: true;
|
|
2994
|
-
} | {
|
|
2995
|
-
offer_hash: Hex;
|
|
2996
|
-
valid: false;
|
|
3255
|
+
type ValidationIssue = {
|
|
3256
|
+
index: number;
|
|
2997
3257
|
rule: string;
|
|
2998
3258
|
message: string;
|
|
2999
3259
|
};
|
|
3000
|
-
|
|
3260
|
+
type ValidateOffersSuccessPayload = SuccessPayload<{
|
|
3261
|
+
payload: Hex;
|
|
3262
|
+
root: Hex;
|
|
3263
|
+
}>;
|
|
3264
|
+
type ValidateOffersIssuesPayload = SuccessPayload<{
|
|
3265
|
+
issues: ValidationIssue[];
|
|
3266
|
+
}>;
|
|
3267
|
+
type ValidateOffersResponse = ValidateOffersSuccessPayload | ValidateOffersIssuesPayload;
|
|
3268
|
+
declare function validateOffers(body: object, gatekeeper: Gatekeeper): Promise<ValidateOffersResponse | ErrorPayload>;
|
|
3001
3269
|
declare namespace index_d_exports$4 {
|
|
3002
|
-
export {
|
|
3270
|
+
export { ValidationIssue, getBook, getDocsHtml, getHealth, getHealthChains, getHealthCollectors, getObligation, getObligations$1 as getObligations, getOffers$1 as getOffers, getSwaggerJson, validateOffers };
|
|
3003
3271
|
}
|
|
3004
3272
|
declare namespace RouterApi_d_exports {
|
|
3005
3273
|
export { ApiConfig, BookResponse_d_exports as BookResponse, BooksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse, index_d_exports$4 as Controllers, HealthController, ObligationResponse_d_exports as ObligationResponse, ObligationsController, OfferResponse_d_exports as OfferResponse, OffersController, OpenApi, OpenApiOptions, RouterApi, RouterStatusResponse, RuleInfo, ValidateController, create, from$4 as from, parse, safeParse };
|
|
@@ -3083,7 +3351,12 @@ declare namespace getOffers {
|
|
|
3083
3351
|
limit?: number;
|
|
3084
3352
|
};
|
|
3085
3353
|
type ReturnType = {
|
|
3086
|
-
offers: Offer
|
|
3354
|
+
offers: Compute<Offer & {
|
|
3355
|
+
/** 32-byte merkle root. */
|
|
3356
|
+
root?: Hex;
|
|
3357
|
+
/** Sibling hashes for the merkle proof. */
|
|
3358
|
+
proof?: Hex[];
|
|
3359
|
+
}>[];
|
|
3087
3360
|
/** The pagination cursor. */
|
|
3088
3361
|
cursor: string | null;
|
|
3089
3362
|
};
|
|
@@ -3151,9 +3424,13 @@ declare enum EnumTableName {
|
|
|
3151
3424
|
VALIDATIONS = "validations",
|
|
3152
3425
|
COLLECTORS = "collectors",
|
|
3153
3426
|
CHAINS = "chains",
|
|
3427
|
+
LOTS = "lots",
|
|
3428
|
+
OFFSETS = "offsets",
|
|
3429
|
+
TREES = "trees",
|
|
3430
|
+
MERKLE_PATHS = "merkle_paths",
|
|
3154
3431
|
}
|
|
3155
3432
|
declare const TABLE_NAMES: readonly EnumTableName[];
|
|
3156
|
-
declare const VERSIONED_TABLE_NAMES: ("\"router_v1.6\".\"obligations\"" | "\"router_v1.6\".\"groups\"" | "\"router_v1.6\".\"consumed_events\"" | "\"router_v1.6\".\"obligation_collaterals_v2\"" | "\"router_v1.6\".\"oracles\"" | "\"router_v1.6\".\"offers\"" | "\"router_v1.6\".\"offers_callbacks\"" | "\"router_v1.6\".\"callbacks\"" | "\"router_v1.6\".\"positions\"" | "\"router_v1.6\".\"transfers\"" | "\"router_v1.6\".\"validations\"" | "\"router_v1.6\".\"collectors\"" | "\"router_v1.6\".\"chains\"")[];
|
|
3433
|
+
declare const VERSIONED_TABLE_NAMES: ("\"router_v1.6\".\"obligations\"" | "\"router_v1.6\".\"groups\"" | "\"router_v1.6\".\"consumed_events\"" | "\"router_v1.6\".\"obligation_collaterals_v2\"" | "\"router_v1.6\".\"oracles\"" | "\"router_v1.6\".\"offers\"" | "\"router_v1.6\".\"offers_callbacks\"" | "\"router_v1.6\".\"callbacks\"" | "\"router_v1.6\".\"positions\"" | "\"router_v1.6\".\"transfers\"" | "\"router_v1.6\".\"validations\"" | "\"router_v1.6\".\"collectors\"" | "\"router_v1.6\".\"chains\"" | "\"router_v1.6\".\"lots\"" | "\"router_v1.6\".\"offsets\"" | "\"router_v1.6\".\"trees\"" | "\"router_v1.6\".\"merkle_paths\"")[];
|
|
3157
3434
|
type TableName = (typeof TABLE_NAMES)[number];
|
|
3158
3435
|
type VersionedTableName = `"${typeof VERSION}"."${TableName}"`;
|
|
3159
3436
|
declare const obligations: drizzle_orm_pg_core0.PgTableWithColumns<{
|
|
@@ -4154,6 +4431,223 @@ declare const callbacks$1: drizzle_orm_pg_core0.PgTableWithColumns<{
|
|
|
4154
4431
|
};
|
|
4155
4432
|
dialect: "pg";
|
|
4156
4433
|
}>;
|
|
4434
|
+
declare const lots: drizzle_orm_pg_core0.PgTableWithColumns<{
|
|
4435
|
+
name: EnumTableName.LOTS;
|
|
4436
|
+
schema: "router_v1.6";
|
|
4437
|
+
columns: {
|
|
4438
|
+
chainId: drizzle_orm_pg_core0.PgColumn<{
|
|
4439
|
+
name: "chain_id";
|
|
4440
|
+
tableName: EnumTableName.LOTS;
|
|
4441
|
+
dataType: "number";
|
|
4442
|
+
columnType: "PgBigInt53";
|
|
4443
|
+
data: Id;
|
|
4444
|
+
driverParam: string | number;
|
|
4445
|
+
notNull: true;
|
|
4446
|
+
hasDefault: false;
|
|
4447
|
+
isPrimaryKey: false;
|
|
4448
|
+
isAutoincrement: false;
|
|
4449
|
+
hasRuntimeDefault: false;
|
|
4450
|
+
enumValues: undefined;
|
|
4451
|
+
baseColumn: never;
|
|
4452
|
+
identity: undefined;
|
|
4453
|
+
generated: undefined;
|
|
4454
|
+
}, {}, {
|
|
4455
|
+
$type: Id;
|
|
4456
|
+
}>;
|
|
4457
|
+
user: drizzle_orm_pg_core0.PgColumn<{
|
|
4458
|
+
name: "user";
|
|
4459
|
+
tableName: EnumTableName.LOTS;
|
|
4460
|
+
dataType: "string";
|
|
4461
|
+
columnType: "PgVarchar";
|
|
4462
|
+
data: string;
|
|
4463
|
+
driverParam: string;
|
|
4464
|
+
notNull: true;
|
|
4465
|
+
hasDefault: false;
|
|
4466
|
+
isPrimaryKey: false;
|
|
4467
|
+
isAutoincrement: false;
|
|
4468
|
+
hasRuntimeDefault: false;
|
|
4469
|
+
enumValues: [string, ...string[]];
|
|
4470
|
+
baseColumn: never;
|
|
4471
|
+
identity: undefined;
|
|
4472
|
+
generated: undefined;
|
|
4473
|
+
}, {}, {
|
|
4474
|
+
length: 42;
|
|
4475
|
+
}>;
|
|
4476
|
+
contract: drizzle_orm_pg_core0.PgColumn<{
|
|
4477
|
+
name: "contract";
|
|
4478
|
+
tableName: EnumTableName.LOTS;
|
|
4479
|
+
dataType: "string";
|
|
4480
|
+
columnType: "PgVarchar";
|
|
4481
|
+
data: string;
|
|
4482
|
+
driverParam: string;
|
|
4483
|
+
notNull: true;
|
|
4484
|
+
hasDefault: false;
|
|
4485
|
+
isPrimaryKey: false;
|
|
4486
|
+
isAutoincrement: false;
|
|
4487
|
+
hasRuntimeDefault: false;
|
|
4488
|
+
enumValues: [string, ...string[]];
|
|
4489
|
+
baseColumn: never;
|
|
4490
|
+
identity: undefined;
|
|
4491
|
+
generated: undefined;
|
|
4492
|
+
}, {}, {
|
|
4493
|
+
length: 42;
|
|
4494
|
+
}>;
|
|
4495
|
+
group: drizzle_orm_pg_core0.PgColumn<{
|
|
4496
|
+
name: "group";
|
|
4497
|
+
tableName: EnumTableName.LOTS;
|
|
4498
|
+
dataType: "string";
|
|
4499
|
+
columnType: "PgVarchar";
|
|
4500
|
+
data: string;
|
|
4501
|
+
driverParam: string;
|
|
4502
|
+
notNull: true;
|
|
4503
|
+
hasDefault: false;
|
|
4504
|
+
isPrimaryKey: false;
|
|
4505
|
+
isAutoincrement: false;
|
|
4506
|
+
hasRuntimeDefault: false;
|
|
4507
|
+
enumValues: [string, ...string[]];
|
|
4508
|
+
baseColumn: never;
|
|
4509
|
+
identity: undefined;
|
|
4510
|
+
generated: undefined;
|
|
4511
|
+
}, {}, {
|
|
4512
|
+
length: 66;
|
|
4513
|
+
}>;
|
|
4514
|
+
lower: drizzle_orm_pg_core0.PgColumn<{
|
|
4515
|
+
name: "lower";
|
|
4516
|
+
tableName: EnumTableName.LOTS;
|
|
4517
|
+
dataType: "string";
|
|
4518
|
+
columnType: "PgNumeric";
|
|
4519
|
+
data: string;
|
|
4520
|
+
driverParam: string;
|
|
4521
|
+
notNull: true;
|
|
4522
|
+
hasDefault: false;
|
|
4523
|
+
isPrimaryKey: false;
|
|
4524
|
+
isAutoincrement: false;
|
|
4525
|
+
hasRuntimeDefault: false;
|
|
4526
|
+
enumValues: undefined;
|
|
4527
|
+
baseColumn: never;
|
|
4528
|
+
identity: undefined;
|
|
4529
|
+
generated: undefined;
|
|
4530
|
+
}, {}, {}>;
|
|
4531
|
+
upper: drizzle_orm_pg_core0.PgColumn<{
|
|
4532
|
+
name: "upper";
|
|
4533
|
+
tableName: EnumTableName.LOTS;
|
|
4534
|
+
dataType: "string";
|
|
4535
|
+
columnType: "PgNumeric";
|
|
4536
|
+
data: string;
|
|
4537
|
+
driverParam: string;
|
|
4538
|
+
notNull: true;
|
|
4539
|
+
hasDefault: false;
|
|
4540
|
+
isPrimaryKey: false;
|
|
4541
|
+
isAutoincrement: false;
|
|
4542
|
+
hasRuntimeDefault: false;
|
|
4543
|
+
enumValues: undefined;
|
|
4544
|
+
baseColumn: never;
|
|
4545
|
+
identity: undefined;
|
|
4546
|
+
generated: undefined;
|
|
4547
|
+
}, {}, {}>;
|
|
4548
|
+
};
|
|
4549
|
+
dialect: "pg";
|
|
4550
|
+
}>;
|
|
4551
|
+
declare const offsets: drizzle_orm_pg_core0.PgTableWithColumns<{
|
|
4552
|
+
name: EnumTableName.OFFSETS;
|
|
4553
|
+
schema: "router_v1.6";
|
|
4554
|
+
columns: {
|
|
4555
|
+
chainId: drizzle_orm_pg_core0.PgColumn<{
|
|
4556
|
+
name: "chain_id";
|
|
4557
|
+
tableName: EnumTableName.OFFSETS;
|
|
4558
|
+
dataType: "number";
|
|
4559
|
+
columnType: "PgBigInt53";
|
|
4560
|
+
data: Id;
|
|
4561
|
+
driverParam: string | number;
|
|
4562
|
+
notNull: true;
|
|
4563
|
+
hasDefault: false;
|
|
4564
|
+
isPrimaryKey: false;
|
|
4565
|
+
isAutoincrement: false;
|
|
4566
|
+
hasRuntimeDefault: false;
|
|
4567
|
+
enumValues: undefined;
|
|
4568
|
+
baseColumn: never;
|
|
4569
|
+
identity: undefined;
|
|
4570
|
+
generated: undefined;
|
|
4571
|
+
}, {}, {
|
|
4572
|
+
$type: Id;
|
|
4573
|
+
}>;
|
|
4574
|
+
user: drizzle_orm_pg_core0.PgColumn<{
|
|
4575
|
+
name: "user";
|
|
4576
|
+
tableName: EnumTableName.OFFSETS;
|
|
4577
|
+
dataType: "string";
|
|
4578
|
+
columnType: "PgVarchar";
|
|
4579
|
+
data: string;
|
|
4580
|
+
driverParam: string;
|
|
4581
|
+
notNull: true;
|
|
4582
|
+
hasDefault: false;
|
|
4583
|
+
isPrimaryKey: false;
|
|
4584
|
+
isAutoincrement: false;
|
|
4585
|
+
hasRuntimeDefault: false;
|
|
4586
|
+
enumValues: [string, ...string[]];
|
|
4587
|
+
baseColumn: never;
|
|
4588
|
+
identity: undefined;
|
|
4589
|
+
generated: undefined;
|
|
4590
|
+
}, {}, {
|
|
4591
|
+
length: 42;
|
|
4592
|
+
}>;
|
|
4593
|
+
contract: drizzle_orm_pg_core0.PgColumn<{
|
|
4594
|
+
name: "contract";
|
|
4595
|
+
tableName: EnumTableName.OFFSETS;
|
|
4596
|
+
dataType: "string";
|
|
4597
|
+
columnType: "PgVarchar";
|
|
4598
|
+
data: string;
|
|
4599
|
+
driverParam: string;
|
|
4600
|
+
notNull: true;
|
|
4601
|
+
hasDefault: false;
|
|
4602
|
+
isPrimaryKey: false;
|
|
4603
|
+
isAutoincrement: false;
|
|
4604
|
+
hasRuntimeDefault: false;
|
|
4605
|
+
enumValues: [string, ...string[]];
|
|
4606
|
+
baseColumn: never;
|
|
4607
|
+
identity: undefined;
|
|
4608
|
+
generated: undefined;
|
|
4609
|
+
}, {}, {
|
|
4610
|
+
length: 42;
|
|
4611
|
+
}>;
|
|
4612
|
+
group: drizzle_orm_pg_core0.PgColumn<{
|
|
4613
|
+
name: "group";
|
|
4614
|
+
tableName: EnumTableName.OFFSETS;
|
|
4615
|
+
dataType: "string";
|
|
4616
|
+
columnType: "PgVarchar";
|
|
4617
|
+
data: string;
|
|
4618
|
+
driverParam: string;
|
|
4619
|
+
notNull: true;
|
|
4620
|
+
hasDefault: false;
|
|
4621
|
+
isPrimaryKey: false;
|
|
4622
|
+
isAutoincrement: false;
|
|
4623
|
+
hasRuntimeDefault: false;
|
|
4624
|
+
enumValues: [string, ...string[]];
|
|
4625
|
+
baseColumn: never;
|
|
4626
|
+
identity: undefined;
|
|
4627
|
+
generated: undefined;
|
|
4628
|
+
}, {}, {
|
|
4629
|
+
length: 66;
|
|
4630
|
+
}>;
|
|
4631
|
+
value: drizzle_orm_pg_core0.PgColumn<{
|
|
4632
|
+
name: "value";
|
|
4633
|
+
tableName: EnumTableName.OFFSETS;
|
|
4634
|
+
dataType: "string";
|
|
4635
|
+
columnType: "PgNumeric";
|
|
4636
|
+
data: string;
|
|
4637
|
+
driverParam: string;
|
|
4638
|
+
notNull: true;
|
|
4639
|
+
hasDefault: false;
|
|
4640
|
+
isPrimaryKey: false;
|
|
4641
|
+
isAutoincrement: false;
|
|
4642
|
+
hasRuntimeDefault: false;
|
|
4643
|
+
enumValues: undefined;
|
|
4644
|
+
baseColumn: never;
|
|
4645
|
+
identity: undefined;
|
|
4646
|
+
generated: undefined;
|
|
4647
|
+
}, {}, {}>;
|
|
4648
|
+
};
|
|
4649
|
+
dialect: "pg";
|
|
4650
|
+
}>;
|
|
4157
4651
|
declare const PositionTypes: drizzle_orm_pg_core0.PgEnum<[Type, ...Type[]]>;
|
|
4158
4652
|
declare const positionTypes: drizzle_orm_pg_core0.PgTableWithColumns<{
|
|
4159
4653
|
name: "position_types";
|
|
@@ -4775,8 +5269,149 @@ declare const chains: drizzle_orm_pg_core0.PgTableWithColumns<{
|
|
|
4775
5269
|
};
|
|
4776
5270
|
dialect: "pg";
|
|
4777
5271
|
}>;
|
|
5272
|
+
declare const trees: drizzle_orm_pg_core0.PgTableWithColumns<{
|
|
5273
|
+
name: EnumTableName.TREES;
|
|
5274
|
+
schema: "router_v1.6";
|
|
5275
|
+
columns: {
|
|
5276
|
+
root: drizzle_orm_pg_core0.PgColumn<{
|
|
5277
|
+
name: "root";
|
|
5278
|
+
tableName: EnumTableName.TREES;
|
|
5279
|
+
dataType: "string";
|
|
5280
|
+
columnType: "PgVarchar";
|
|
5281
|
+
data: string;
|
|
5282
|
+
driverParam: string;
|
|
5283
|
+
notNull: true;
|
|
5284
|
+
hasDefault: false;
|
|
5285
|
+
isPrimaryKey: true;
|
|
5286
|
+
isAutoincrement: false;
|
|
5287
|
+
hasRuntimeDefault: false;
|
|
5288
|
+
enumValues: [string, ...string[]];
|
|
5289
|
+
baseColumn: never;
|
|
5290
|
+
identity: undefined;
|
|
5291
|
+
generated: undefined;
|
|
5292
|
+
}, {}, {
|
|
5293
|
+
length: 66;
|
|
5294
|
+
}>;
|
|
5295
|
+
rootSignature: drizzle_orm_pg_core0.PgColumn<{
|
|
5296
|
+
name: "root_signature";
|
|
5297
|
+
tableName: EnumTableName.TREES;
|
|
5298
|
+
dataType: "string";
|
|
5299
|
+
columnType: "PgVarchar";
|
|
5300
|
+
data: string;
|
|
5301
|
+
driverParam: string;
|
|
5302
|
+
notNull: true;
|
|
5303
|
+
hasDefault: false;
|
|
5304
|
+
isPrimaryKey: false;
|
|
5305
|
+
isAutoincrement: false;
|
|
5306
|
+
hasRuntimeDefault: false;
|
|
5307
|
+
enumValues: [string, ...string[]];
|
|
5308
|
+
baseColumn: never;
|
|
5309
|
+
identity: undefined;
|
|
5310
|
+
generated: undefined;
|
|
5311
|
+
}, {}, {
|
|
5312
|
+
length: 132;
|
|
5313
|
+
}>;
|
|
5314
|
+
createdAt: drizzle_orm_pg_core0.PgColumn<{
|
|
5315
|
+
name: "created_at";
|
|
5316
|
+
tableName: EnumTableName.TREES;
|
|
5317
|
+
dataType: "date";
|
|
5318
|
+
columnType: "PgTimestamp";
|
|
5319
|
+
data: Date;
|
|
5320
|
+
driverParam: string;
|
|
5321
|
+
notNull: true;
|
|
5322
|
+
hasDefault: true;
|
|
5323
|
+
isPrimaryKey: false;
|
|
5324
|
+
isAutoincrement: false;
|
|
5325
|
+
hasRuntimeDefault: false;
|
|
5326
|
+
enumValues: undefined;
|
|
5327
|
+
baseColumn: never;
|
|
5328
|
+
identity: undefined;
|
|
5329
|
+
generated: undefined;
|
|
5330
|
+
}, {}, {}>;
|
|
5331
|
+
};
|
|
5332
|
+
dialect: "pg";
|
|
5333
|
+
}>;
|
|
5334
|
+
declare const merklePaths: drizzle_orm_pg_core0.PgTableWithColumns<{
|
|
5335
|
+
name: EnumTableName.MERKLE_PATHS;
|
|
5336
|
+
schema: "router_v1.6";
|
|
5337
|
+
columns: {
|
|
5338
|
+
offerHash: drizzle_orm_pg_core0.PgColumn<{
|
|
5339
|
+
name: "offer_hash";
|
|
5340
|
+
tableName: EnumTableName.MERKLE_PATHS;
|
|
5341
|
+
dataType: "string";
|
|
5342
|
+
columnType: "PgVarchar";
|
|
5343
|
+
data: string;
|
|
5344
|
+
driverParam: string;
|
|
5345
|
+
notNull: true;
|
|
5346
|
+
hasDefault: false;
|
|
5347
|
+
isPrimaryKey: true;
|
|
5348
|
+
isAutoincrement: false;
|
|
5349
|
+
hasRuntimeDefault: false;
|
|
5350
|
+
enumValues: [string, ...string[]];
|
|
5351
|
+
baseColumn: never;
|
|
5352
|
+
identity: undefined;
|
|
5353
|
+
generated: undefined;
|
|
5354
|
+
}, {}, {
|
|
5355
|
+
length: 66;
|
|
5356
|
+
}>;
|
|
5357
|
+
treeRoot: drizzle_orm_pg_core0.PgColumn<{
|
|
5358
|
+
name: "tree_root";
|
|
5359
|
+
tableName: EnumTableName.MERKLE_PATHS;
|
|
5360
|
+
dataType: "string";
|
|
5361
|
+
columnType: "PgVarchar";
|
|
5362
|
+
data: string;
|
|
5363
|
+
driverParam: string;
|
|
5364
|
+
notNull: true;
|
|
5365
|
+
hasDefault: false;
|
|
5366
|
+
isPrimaryKey: false;
|
|
5367
|
+
isAutoincrement: false;
|
|
5368
|
+
hasRuntimeDefault: false;
|
|
5369
|
+
enumValues: [string, ...string[]];
|
|
5370
|
+
baseColumn: never;
|
|
5371
|
+
identity: undefined;
|
|
5372
|
+
generated: undefined;
|
|
5373
|
+
}, {}, {
|
|
5374
|
+
length: 66;
|
|
5375
|
+
}>;
|
|
5376
|
+
proofNodes: drizzle_orm_pg_core0.PgColumn<{
|
|
5377
|
+
name: "proof_nodes";
|
|
5378
|
+
tableName: EnumTableName.MERKLE_PATHS;
|
|
5379
|
+
dataType: "string";
|
|
5380
|
+
columnType: "PgText";
|
|
5381
|
+
data: string;
|
|
5382
|
+
driverParam: string;
|
|
5383
|
+
notNull: true;
|
|
5384
|
+
hasDefault: false;
|
|
5385
|
+
isPrimaryKey: false;
|
|
5386
|
+
isAutoincrement: false;
|
|
5387
|
+
hasRuntimeDefault: false;
|
|
5388
|
+
enumValues: [string, ...string[]];
|
|
5389
|
+
baseColumn: never;
|
|
5390
|
+
identity: undefined;
|
|
5391
|
+
generated: undefined;
|
|
5392
|
+
}, {}, {}>;
|
|
5393
|
+
createdAt: drizzle_orm_pg_core0.PgColumn<{
|
|
5394
|
+
name: "created_at";
|
|
5395
|
+
tableName: EnumTableName.MERKLE_PATHS;
|
|
5396
|
+
dataType: "date";
|
|
5397
|
+
columnType: "PgTimestamp";
|
|
5398
|
+
data: Date;
|
|
5399
|
+
driverParam: string;
|
|
5400
|
+
notNull: true;
|
|
5401
|
+
hasDefault: true;
|
|
5402
|
+
isPrimaryKey: false;
|
|
5403
|
+
isAutoincrement: false;
|
|
5404
|
+
hasRuntimeDefault: false;
|
|
5405
|
+
enumValues: undefined;
|
|
5406
|
+
baseColumn: never;
|
|
5407
|
+
identity: undefined;
|
|
5408
|
+
generated: undefined;
|
|
5409
|
+
}, {}, {}>;
|
|
5410
|
+
};
|
|
5411
|
+
dialect: "pg";
|
|
5412
|
+
}>;
|
|
4778
5413
|
declare namespace index_d_exports$2 {
|
|
4779
|
-
export { PositionTypes, StatusCode, TABLE_NAMES, TableName, VERSION, VERSIONED_TABLE_NAMES, VersionedTableName, callbacks$1 as callbacks, chains, collectors, consumedEvents, groups, obligationCollateralsV2, obligations, offers, offersCallbacks, oracles, positionTypes, positions, status, transfers, validations };
|
|
5414
|
+
export { PositionTypes, StatusCode, TABLE_NAMES, TableName, VERSION, VERSIONED_TABLE_NAMES, VersionedTableName, callbacks$1 as callbacks, chains, collectors, consumedEvents, groups, lots, merklePaths, obligationCollateralsV2, obligations, offers, offersCallbacks, offsets, oracles, positionTypes, positions, status, transfers, trees, validations };
|
|
4780
5415
|
}
|
|
4781
5416
|
declare namespace Cursor_d_exports {
|
|
4782
5417
|
export { Cursor, decode, encode, validate };
|
|
@@ -4968,6 +5603,41 @@ declare function poll<data>(fn: ({
|
|
|
4968
5603
|
}: {
|
|
4969
5604
|
interval: () => Promise<number>;
|
|
4970
5605
|
}): () => boolean;
|
|
5606
|
+
declare namespace Random_d_exports {
|
|
5607
|
+
export { address, bool, bytes, float, hex, int, seed, withSeed };
|
|
5608
|
+
}
|
|
5609
|
+
/**
|
|
5610
|
+
* Runs a function with a deterministic RNG derived from the given seed.
|
|
5611
|
+
*/
|
|
5612
|
+
declare function withSeed<T>(seed: string, fn: () => T): T;
|
|
5613
|
+
/**
|
|
5614
|
+
* Seeds the global RNG for deterministic test runs.
|
|
5615
|
+
*/
|
|
5616
|
+
declare function seed(seed: string): void;
|
|
5617
|
+
/**
|
|
5618
|
+
* Returns a deterministic random float in [0, 1).
|
|
5619
|
+
*/
|
|
5620
|
+
declare function float(): number;
|
|
5621
|
+
/**
|
|
5622
|
+
* Returns a deterministic random integer in [min, maxExclusive).
|
|
5623
|
+
*/
|
|
5624
|
+
declare function int(maxExclusive: number, min?: number): number;
|
|
5625
|
+
/**
|
|
5626
|
+
* Returns a deterministic random boolean.
|
|
5627
|
+
*/
|
|
5628
|
+
declare function bool(probability?: number): boolean;
|
|
5629
|
+
/**
|
|
5630
|
+
* Returns deterministic random bytes.
|
|
5631
|
+
*/
|
|
5632
|
+
declare function bytes(length: number): Uint8Array;
|
|
5633
|
+
/**
|
|
5634
|
+
* Returns a deterministic random hex string for the given byte length.
|
|
5635
|
+
*/
|
|
5636
|
+
declare function hex(byteLength: number): Hex;
|
|
5637
|
+
/**
|
|
5638
|
+
* Returns a deterministic random address.
|
|
5639
|
+
*/
|
|
5640
|
+
declare function address(): Address;
|
|
4971
5641
|
//#endregion
|
|
4972
5642
|
//#region src/utils/retry.d.ts
|
|
4973
5643
|
declare const retry: <T>(fn: () => Promise<T>, attempts?: number, delayMs?: number) => Promise<T>;
|
|
@@ -4980,7 +5650,7 @@ declare function max(): number;
|
|
|
4980
5650
|
//#region src/utils/wait.d.ts
|
|
4981
5651
|
declare function wait(time: number): Promise<unknown>;
|
|
4982
5652
|
declare namespace index_d_exports$3 {
|
|
4983
|
-
export { BaseError, GlobalErrorType, ReorgError, Snake, time_d_exports as Time, batch, batchMulticall, fromSnakeCase$3 as fromSnakeCase, lazy, max$1 as max, min, poll, retry, stringifyBigint, toSnakeCase$1 as toSnakeCase, wait };
|
|
5653
|
+
export { BaseError, GlobalErrorType, Random_d_exports as Random, ReorgError, Snake, time_d_exports as Time, batch, batchMulticall, fromSnakeCase$3 as fromSnakeCase, lazy, max$1 as max, min, poll, retry, stringifyBigint, toSnakeCase$1 as toSnakeCase, wait };
|
|
4984
5654
|
}
|
|
4985
5655
|
//#endregion
|
|
4986
5656
|
export { index_d_exports as Abi, BookResponse_d_exports as BookResponse, BooksController, Brand, BrandTypeId, Callback_d_exports as Callback, Chain_d_exports as Chain, ChainHealth, ChainsHealthResponse, Collateral_d_exports as Collateral, CollectorHealth, CollectorsHealthResponse, Compute, Cursor_d_exports as Cursor, Database_d_exports as Database, ERC4626_d_exports as ERC4626, Errors_d_exports as Errors, Format_d_exports as Format, GateConfig_d_exports as GateConfig, Gatekeeper_d_exports as Gatekeeper, Health_d_exports as Health, HealthController, Indexer_d_exports as Indexer, LLTV_d_exports as LLTV, Liquidity_d_exports as Liquidity, Logger_d_exports as Logger, Maturity_d_exports as Maturity, index_d_exports$1 as Mempool, Obligation_d_exports as Obligation, ObligationResponse_d_exports as ObligationResponse, ObligationsController, Offer_d_exports as Offer, OfferResponse_d_exports as OfferResponse, OffersController, index_d_exports$2 as OffersSchema, OpenApi, OpenApiOptions, Oracle_d_exports as Oracle, Position_d_exports as Position, Quote_d_exports as Quote, RouterApi_d_exports as RouterApi, Client_d_exports as RouterClient, RouterStatusResponse, RuleInfo, Rules_d_exports as Rules, time_d_exports as Time, Transfer_d_exports as Transfer, Tree_d_exports as Tree, index_d_exports$3 as Utils, ValidateController, Gate_d_exports as Validation, morphoRules, parse, safeParse };
|