@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.browser.d.mts
CHANGED
|
@@ -6,6 +6,10 @@ import * as z$1 from "zod";
|
|
|
6
6
|
import { Client } from "openapi-fetch";
|
|
7
7
|
import { Chain } from "viem/chains";
|
|
8
8
|
import { StandardMerkleTree } from "@openzeppelin/merkle-tree";
|
|
9
|
+
import "@electric-sql/pglite";
|
|
10
|
+
import "drizzle-orm/node-postgres";
|
|
11
|
+
import "drizzle-orm/pglite";
|
|
12
|
+
import "pg";
|
|
9
13
|
|
|
10
14
|
//#region src/api/Schema/BookResponse.d.ts
|
|
11
15
|
declare namespace BookResponse_d_exports {
|
|
@@ -331,7 +335,7 @@ declare const Morpho: readonly [{
|
|
|
331
335
|
readonly stateMutability: "view";
|
|
332
336
|
}];
|
|
333
337
|
declare namespace Callback_d_exports {
|
|
334
|
-
export { CallbackType, decode$3 as decode, decodeBuyVaultV1Callback, decodeSellERC20Callback, encode$3 as encode, encodeBuyVaultV1Callback, encodeSellERC20Callback, isEmptyCallback };
|
|
338
|
+
export { BuyVaultV1CallbackData, CallbackType, SellERC20CallbackData, decode$3 as decode, decodeBuyVaultV1Callback, decodeSellERC20Callback, encode$3 as encode, encodeBuyVaultV1Callback, encodeSellERC20Callback, isEmptyCallback };
|
|
335
339
|
}
|
|
336
340
|
declare enum CallbackType {
|
|
337
341
|
BuyWithEmptyCallback = "buy_with_empty_callback",
|
|
@@ -343,7 +347,16 @@ declare function decode$3(type: CallbackType, data: Hex): {
|
|
|
343
347
|
contract: Address;
|
|
344
348
|
amount: bigint;
|
|
345
349
|
}[];
|
|
346
|
-
|
|
350
|
+
type BuyVaultV1CallbackData = {
|
|
351
|
+
vaults: Address[];
|
|
352
|
+
amounts: bigint[];
|
|
353
|
+
};
|
|
354
|
+
type SellERC20CallbackData = {
|
|
355
|
+
collaterals: Address[];
|
|
356
|
+
amounts: bigint[];
|
|
357
|
+
};
|
|
358
|
+
declare function encode$3(type: CallbackType.BuyVaultV1Callback, data: BuyVaultV1CallbackData): Hex;
|
|
359
|
+
declare function encode$3(type: CallbackType.SellERC20Callback, data: SellERC20CallbackData): Hex;
|
|
347
360
|
declare function decodeBuyVaultV1Callback(data: Hex): Array<{
|
|
348
361
|
contract: Address;
|
|
349
362
|
amount: bigint;
|
|
@@ -692,7 +705,7 @@ declare class InvalidOptionError extends BaseError {
|
|
|
692
705
|
constructor(input: string);
|
|
693
706
|
}
|
|
694
707
|
declare namespace Offer_d_exports {
|
|
695
|
-
export { AccountNotSetError, InvalidOfferError, Offer, OfferConsumed, OfferHashSchema, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$2 as decode, domain, encode$2 as encode, from$9 as from, fromSnakeCase$2 as fromSnakeCase, hash, obligationId, random$2 as random, sign, signatureMsg, toSnakeCase, types };
|
|
708
|
+
export { AccountNotSetError, InvalidOfferError, Offer, OfferConsumed, OfferHashSchema, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$2 as decode, domain, encode$2 as encode, from$9 as from, fromSnakeCase$2 as fromSnakeCase, hash, obligationId, random$2 as random, serialize, sign, signatureMsg, toSnakeCase, types };
|
|
696
709
|
}
|
|
697
710
|
type Offer = {
|
|
698
711
|
/** The address that made the offer. */
|
|
@@ -801,6 +814,37 @@ declare function fromSnakeCase$2(input: Snake<Omit<Offer, "chainId" | "hash"> &
|
|
|
801
814
|
* @returns The converted offer.
|
|
802
815
|
*/
|
|
803
816
|
declare function toSnakeCase(offer: Offer): Snake<Offer>;
|
|
817
|
+
/**
|
|
818
|
+
* Serializes an offer for merkle tree encoding.
|
|
819
|
+
* Converts BigInt fields to strings for JSON compatibility.
|
|
820
|
+
*
|
|
821
|
+
* @param offer - Offer to serialize
|
|
822
|
+
* @returns JSON-serializable offer object
|
|
823
|
+
*/
|
|
824
|
+
declare const serialize: (offer: Offer) => {
|
|
825
|
+
offering: `0x${string}`;
|
|
826
|
+
assets: string;
|
|
827
|
+
rate: string;
|
|
828
|
+
maturity: number;
|
|
829
|
+
expiry: number;
|
|
830
|
+
start: number;
|
|
831
|
+
nonce: string;
|
|
832
|
+
buy: boolean;
|
|
833
|
+
chainId: Id;
|
|
834
|
+
loanToken: `0x${string}`;
|
|
835
|
+
collaterals: {
|
|
836
|
+
asset: `0x${string}`;
|
|
837
|
+
oracle: `0x${string}`;
|
|
838
|
+
lltv: string;
|
|
839
|
+
}[];
|
|
840
|
+
callback: {
|
|
841
|
+
address: `0x${string}`;
|
|
842
|
+
data: `0x${string}`;
|
|
843
|
+
gasLimit: string;
|
|
844
|
+
};
|
|
845
|
+
signature: `0x${string}` | undefined;
|
|
846
|
+
hash: `0x${string}`;
|
|
847
|
+
};
|
|
804
848
|
type RandomConfig = {
|
|
805
849
|
chains?: Chain$1[];
|
|
806
850
|
loanTokens?: Address[];
|
|
@@ -1432,46 +1476,148 @@ declare namespace from$4 {
|
|
|
1432
1476
|
type ReturnType = Transfer;
|
|
1433
1477
|
}
|
|
1434
1478
|
declare namespace Tree_d_exports {
|
|
1435
|
-
export { Tree, VERSION, decode$1 as decode, encode$1 as encode, from$3 as from };
|
|
1479
|
+
export { DecodeError, EncodeError, Proof, Tree, TreeError, VERSION, decode$1 as decode, encode$1 as encode, encodeUnsigned, from$3 as from, proofs };
|
|
1436
1480
|
}
|
|
1481
|
+
/**
|
|
1482
|
+
* A merkle tree of offers built from offer hashes.
|
|
1483
|
+
* Constructed via {@link from}. The tree root can be signed for onchain broadcast.
|
|
1484
|
+
*/
|
|
1437
1485
|
type Tree = Compute<StandardMerkleTree<[Hex]> & {
|
|
1486
|
+
/** The offers in the tree. */
|
|
1438
1487
|
offers: Offer[];
|
|
1488
|
+
/** The root of the tree. */
|
|
1439
1489
|
root: Hex;
|
|
1440
1490
|
}>;
|
|
1491
|
+
type Proof = {
|
|
1492
|
+
/** The offer that the proof is for. */
|
|
1493
|
+
offer: Offer;
|
|
1494
|
+
/** The merkle proof path for the offer. */
|
|
1495
|
+
path: Hex[];
|
|
1496
|
+
};
|
|
1441
1497
|
declare const VERSION = 1;
|
|
1442
1498
|
/**
|
|
1443
1499
|
* Builds a Merkle tree from a list of offers.
|
|
1444
1500
|
*
|
|
1445
1501
|
* Leaves are the offer `hash` values as `bytes32` and are deterministically
|
|
1446
|
-
* ordered
|
|
1447
|
-
* regardless of the input order.
|
|
1502
|
+
* ordered following the StandardMerkleTree leaf ordering so that the resulting
|
|
1503
|
+
* root is stable regardless of the input order.
|
|
1448
1504
|
*
|
|
1449
1505
|
* @param offers - Offers to include in the tree.
|
|
1450
1506
|
* @returns A `StandardMerkleTree` of `bytes32` leaves representing the offers.
|
|
1507
|
+
* @throws {TreeError} If tree building fails due to offer inconsistencies.
|
|
1451
1508
|
*/
|
|
1452
1509
|
declare const from$3: (offers: Offer[]) => Tree;
|
|
1453
1510
|
/**
|
|
1454
|
-
*
|
|
1511
|
+
* Generates merkle proofs for all offers in a tree.
|
|
1512
|
+
*
|
|
1513
|
+
* Each proof allows independent verification that an offer is included in the tree
|
|
1514
|
+
* without requiring the full tree. Proofs are ordered by StandardMerkleTree leaf ordering.
|
|
1515
|
+
*
|
|
1516
|
+
* @param tree - The {@link Tree} to generate proofs for.
|
|
1517
|
+
* @returns Array of proofs - {@link Proof}
|
|
1518
|
+
*/
|
|
1519
|
+
declare const proofs: (tree: Tree) => Proof[];
|
|
1520
|
+
/**
|
|
1521
|
+
* Encodes a merkle tree with signature into hex calldata for onchain broadcast.
|
|
1522
|
+
*
|
|
1523
|
+
* Layout: `0x{vv}{gzip([...offers])}{root}{signature}` where:
|
|
1524
|
+
* - `{vv}`: 1-byte version (currently 0x01)
|
|
1525
|
+
* - `{gzip([...offers])}`: gzipped JSON array of serialized offers
|
|
1526
|
+
* - `{root}`: 32-byte merkle root
|
|
1527
|
+
* - `{signature}`: 65-byte EIP-191 signature over raw root bytes
|
|
1528
|
+
*
|
|
1529
|
+
* Validates signature authenticity and root integrity before encoding.
|
|
1530
|
+
*
|
|
1531
|
+
* @example
|
|
1532
|
+
* ```typescript
|
|
1533
|
+
* const tree = Tree.from(offers);
|
|
1534
|
+
* const signature = await wallet.signMessage({ message: { raw: tree.root } });
|
|
1535
|
+
* const calldata = await Tree.encode(tree, signature);
|
|
1536
|
+
* await broadcast(calldata);
|
|
1537
|
+
* ```
|
|
1538
|
+
*
|
|
1539
|
+
* @example
|
|
1540
|
+
* Manual construction (for advanced users):
|
|
1541
|
+
* ```typescript
|
|
1542
|
+
* const tree = Tree.from(offers);
|
|
1543
|
+
* const compressed = gzip(JSON.stringify(tree.offers.map(Offer.serialize)));
|
|
1544
|
+
* const partial = `0x01${bytesToHex(compressed)}${tree.root.slice(2)}`;
|
|
1545
|
+
* const signature = await wallet.signMessage({ message: { raw: tree.root } });
|
|
1546
|
+
* const calldata = `${partial}${signature.slice(2)}`;
|
|
1547
|
+
* ```
|
|
1548
|
+
*
|
|
1549
|
+
* @param tree - Merkle tree of offers
|
|
1550
|
+
* @param signature - EIP-191 signature over raw root bytes
|
|
1551
|
+
* @returns Hex-encoded calldata ready for onchain broadcast
|
|
1552
|
+
* @throws {EncodeError} If signature verification fails or root mismatch
|
|
1553
|
+
*/
|
|
1554
|
+
declare const encode$1: (tree: Tree, signature: Hex) => Promise<Hex>;
|
|
1555
|
+
/**
|
|
1556
|
+
* Encodes a merkle tree without a signature into hex payload for client-side signing.
|
|
1557
|
+
*
|
|
1558
|
+
* Layout: `0x{vv}{gzip([...offers])}{root}` where:
|
|
1559
|
+
* - `{vv}`: 1-byte version (currently 0x01)
|
|
1560
|
+
* - `{gzip([...offers])}`: gzipped JSON array of serialized offers
|
|
1561
|
+
* - `{root}`: 32-byte merkle root
|
|
1455
1562
|
*
|
|
1456
|
-
*
|
|
1457
|
-
* - Payload is gzip(JSON.stringify([root, ...offers])) with bigint stringified.
|
|
1563
|
+
* Validates root integrity before encoding.
|
|
1458
1564
|
*
|
|
1459
|
-
* @param tree -
|
|
1460
|
-
* @returns Hex
|
|
1461
|
-
* @throws
|
|
1565
|
+
* @param tree - Merkle tree of offers
|
|
1566
|
+
* @returns Hex-encoded unsigned payload
|
|
1567
|
+
* @throws {EncodeError} If root mismatch
|
|
1462
1568
|
*/
|
|
1463
|
-
declare const
|
|
1569
|
+
declare const encodeUnsigned: (tree: Tree) => Hex;
|
|
1464
1570
|
/**
|
|
1465
|
-
* Decodes
|
|
1571
|
+
* Decodes hex calldata into a validated merkle tree.
|
|
1466
1572
|
*
|
|
1467
|
-
*
|
|
1468
|
-
*
|
|
1573
|
+
* Validates signature before decompression for fail-fast rejection of invalid payloads.
|
|
1574
|
+
* Returns the tree with separately validated signature and recovered signer address.
|
|
1469
1575
|
*
|
|
1470
|
-
*
|
|
1471
|
-
*
|
|
1472
|
-
*
|
|
1576
|
+
* Validation order:
|
|
1577
|
+
* 1. Version check
|
|
1578
|
+
* 2. Signature verification (fail-fast, before decompression)
|
|
1579
|
+
* 3. Decompression (only if signature valid)
|
|
1580
|
+
* 4. Root verification (computed from offers vs embedded root)
|
|
1581
|
+
*
|
|
1582
|
+
* @example
|
|
1583
|
+
* ```typescript
|
|
1584
|
+
* const { tree, signature, signer } = await Tree.decode(calldata);
|
|
1585
|
+
* console.log(`Tree signed by ${signer} with ${tree.offers.length} offers`);
|
|
1586
|
+
* ```
|
|
1587
|
+
*
|
|
1588
|
+
* @param encoded - Hex calldata in format `0x{vv}{gzip}{root}{signature}`
|
|
1589
|
+
* @returns Validated tree, signature, and recovered signer address
|
|
1590
|
+
* @throws {DecodeError} If version invalid, signature invalid, or root mismatch
|
|
1591
|
+
*/
|
|
1592
|
+
declare const decode$1: (encoded: Hex) => Promise<{
|
|
1593
|
+
tree: Tree;
|
|
1594
|
+
signature: Hex;
|
|
1595
|
+
signer: Address;
|
|
1596
|
+
}>;
|
|
1597
|
+
/**
|
|
1598
|
+
* Error thrown during tree building operations.
|
|
1599
|
+
* Indicates structural issues with the tree (missing offers, inconsistent state).
|
|
1473
1600
|
*/
|
|
1474
|
-
declare
|
|
1601
|
+
declare class TreeError extends BaseError {
|
|
1602
|
+
name: string;
|
|
1603
|
+
constructor(reason: string);
|
|
1604
|
+
}
|
|
1605
|
+
/**
|
|
1606
|
+
* Error thrown during tree encoding.
|
|
1607
|
+
* Indicates validation failures (signature, root mismatch, mixed makers).
|
|
1608
|
+
*/
|
|
1609
|
+
declare class EncodeError extends BaseError {
|
|
1610
|
+
name: string;
|
|
1611
|
+
constructor(reason: string);
|
|
1612
|
+
}
|
|
1613
|
+
/**
|
|
1614
|
+
* Error thrown during tree decoding.
|
|
1615
|
+
* Indicates payload corruption, version mismatch, or validation failures.
|
|
1616
|
+
*/
|
|
1617
|
+
declare class DecodeError extends BaseError {
|
|
1618
|
+
name: string;
|
|
1619
|
+
constructor(reason: string);
|
|
1620
|
+
}
|
|
1475
1621
|
//#endregion
|
|
1476
1622
|
//#region src/api/Schema/generated/swagger.d.ts
|
|
1477
1623
|
/**
|
|
@@ -1842,10 +1988,11 @@ interface paths {
|
|
|
1842
1988
|
put?: never;
|
|
1843
1989
|
/**
|
|
1844
1990
|
* Validate offers
|
|
1845
|
-
* @description Validates offers against router validation rules. Returns
|
|
1991
|
+
* @description Validates offers against router validation rules. Returns unsigned payload + root on success, or issues only on validation failure.
|
|
1846
1992
|
*
|
|
1847
1993
|
* **Available validation rules:**
|
|
1848
1994
|
* - **parse_error**: Returns when an offer fails to parse due to invalid format or missing required fields
|
|
1995
|
+
* - **mixed_maker**: Validates that all offers in a batch have the same maker (offering address)
|
|
1849
1996
|
* - **chain_ids**: Validates that offer chain is one of: [109111114]
|
|
1850
1997
|
* - **maturity**: Validates that offer maturity is one of: [end_of_month, end_of_next_month]
|
|
1851
1998
|
* - **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]
|
|
@@ -1870,7 +2017,7 @@ interface paths {
|
|
|
1870
2017
|
[name: string]: unknown;
|
|
1871
2018
|
};
|
|
1872
2019
|
content: {
|
|
1873
|
-
"application/json": components["schemas"]["
|
|
2020
|
+
"application/json": components["schemas"]["ValidationSuccessResponse"];
|
|
1874
2021
|
};
|
|
1875
2022
|
};
|
|
1876
2023
|
/** @description Bad Request */
|
|
@@ -1965,10 +2112,15 @@ interface components {
|
|
|
1965
2112
|
* "data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000",
|
|
1966
2113
|
* "gas_limit": "500000"
|
|
1967
2114
|
* },
|
|
1968
|
-
* "signature": "0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400",
|
|
1969
2115
|
* "consumed": "0",
|
|
1970
2116
|
* "takeable": "369216000000000000000000",
|
|
1971
|
-
* "block_number": 2942933377146801
|
|
2117
|
+
* "block_number": 2942933377146801,
|
|
2118
|
+
* "root": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
|
|
2119
|
+
* "proof": [
|
|
2120
|
+
* "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
|
|
2121
|
+
* "0x9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba"
|
|
2122
|
+
* ],
|
|
2123
|
+
* "signature": "0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400"
|
|
1972
2124
|
* }
|
|
1973
2125
|
* ]
|
|
1974
2126
|
*/
|
|
@@ -2021,6 +2173,15 @@ interface components {
|
|
|
2021
2173
|
consumed: string;
|
|
2022
2174
|
/** @example 2942933377146801 */
|
|
2023
2175
|
block_number: number;
|
|
2176
|
+
/** @example 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef */
|
|
2177
|
+
root: string | null;
|
|
2178
|
+
/**
|
|
2179
|
+
* @example [
|
|
2180
|
+
* "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
|
|
2181
|
+
* "0x9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba"
|
|
2182
|
+
* ]
|
|
2183
|
+
*/
|
|
2184
|
+
proof: string[] | null;
|
|
2024
2185
|
/** @example 0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400 */
|
|
2025
2186
|
signature: string | null;
|
|
2026
2187
|
};
|
|
@@ -2152,13 +2313,8 @@ interface components {
|
|
|
2152
2313
|
updated_at: string;
|
|
2153
2314
|
};
|
|
2154
2315
|
ValidateOffersRequest: {
|
|
2155
|
-
/** @description Array of offers in snake_case format.
|
|
2156
|
-
offers
|
|
2157
|
-
/**
|
|
2158
|
-
* @description Encoded tree calldata as a hex string (0x-prefixed). Mutually exclusive with 'offers'.
|
|
2159
|
-
* @example 0x01...
|
|
2160
|
-
*/
|
|
2161
|
-
calldata?: string;
|
|
2316
|
+
/** @description Array of offers in snake_case format. Required, non-empty. */
|
|
2317
|
+
offers: components["schemas"]["ValidateOfferRequest"][];
|
|
2162
2318
|
};
|
|
2163
2319
|
ValidateOfferRequest: {
|
|
2164
2320
|
/** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
@@ -2200,22 +2356,24 @@ interface components {
|
|
|
2200
2356
|
*/
|
|
2201
2357
|
callback: components["schemas"]["OfferCallbackResponse"];
|
|
2202
2358
|
};
|
|
2203
|
-
|
|
2359
|
+
ValidationSuccessResponse: {
|
|
2204
2360
|
meta: components["schemas"]["Meta"];
|
|
2205
2361
|
/** @example null */
|
|
2206
2362
|
cursor: string | null;
|
|
2207
|
-
/** @description
|
|
2208
|
-
data: components["schemas"]["
|
|
2363
|
+
/** @description Payload and root for client-side signing. */
|
|
2364
|
+
data: components["schemas"]["ValidationSuccessDataResponse"];
|
|
2209
2365
|
};
|
|
2210
|
-
|
|
2211
|
-
/**
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2366
|
+
ValidationSuccessDataResponse: {
|
|
2367
|
+
/**
|
|
2368
|
+
* @description Unsigned payload: version (1B) + gzip(offers) + root (32B).
|
|
2369
|
+
* @example 0x01789c...
|
|
2370
|
+
*/
|
|
2371
|
+
payload: string;
|
|
2372
|
+
/**
|
|
2373
|
+
* @description Merkle tree root to sign with EIP-191.
|
|
2374
|
+
* @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427
|
|
2375
|
+
*/
|
|
2376
|
+
root: string;
|
|
2219
2377
|
};
|
|
2220
2378
|
};
|
|
2221
2379
|
responses: never;
|
|
@@ -2235,6 +2393,202 @@ type ObligationResponse = paths["/v1/obligations"]["get"]["responses"]["200"]["c
|
|
|
2235
2393
|
* @returns The created `ObligationResponse`. {@link ObligationResponse}
|
|
2236
2394
|
*/
|
|
2237
2395
|
declare function from$2(obligation: Obligation, quote: Quote): ObligationResponse;
|
|
2396
|
+
declare namespace Gate_d_exports {
|
|
2397
|
+
export { Batch, Issue, Result, Rule, RuleNames, Single, batch$1 as batch, run, single };
|
|
2398
|
+
}
|
|
2399
|
+
/**
|
|
2400
|
+
* A validation rule.
|
|
2401
|
+
*/
|
|
2402
|
+
type Rule<T, Name$1 extends string = string> = {
|
|
2403
|
+
kind: "single";
|
|
2404
|
+
name: Name$1;
|
|
2405
|
+
description: string;
|
|
2406
|
+
run: Single<T, Name$1>;
|
|
2407
|
+
} | {
|
|
2408
|
+
kind: "batch";
|
|
2409
|
+
name: Name$1;
|
|
2410
|
+
description: string;
|
|
2411
|
+
run: Batch<T, Name$1>;
|
|
2412
|
+
};
|
|
2413
|
+
type RuleNames<Rules$1 extends readonly {
|
|
2414
|
+
name: string;
|
|
2415
|
+
}[]> = Rules$1[number]["name"];
|
|
2416
|
+
/**
|
|
2417
|
+
* A single item validation rule.
|
|
2418
|
+
* @param item - The item to validate.
|
|
2419
|
+
* @returns The issue that was found. If the item is valid, this will be undefined.
|
|
2420
|
+
*/
|
|
2421
|
+
type Single<T, RuleName extends string> = (item: T) => Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined | Promise<Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined>;
|
|
2422
|
+
/**
|
|
2423
|
+
* A batch item validation rule.
|
|
2424
|
+
* @param items - The items to validate.
|
|
2425
|
+
* @returns A map of the items to the issue that was found.
|
|
2426
|
+
*/
|
|
2427
|
+
type Batch<T, RuleName extends string> = (items: T[]) => Map<number, Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined> | Promise<Map<number, Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined>>;
|
|
2428
|
+
/**
|
|
2429
|
+
* Create a validation rule iterating over a single item at a time.
|
|
2430
|
+
* @param name - The name of the rule.
|
|
2431
|
+
* @param description - A human-readable description of the rule.
|
|
2432
|
+
* @param run - The function that validates the rule.
|
|
2433
|
+
* @returns The created rule.
|
|
2434
|
+
*/
|
|
2435
|
+
declare function single<Name$1 extends string, T>(name: Name$1, description: string, run: Single<T, Name$1>): Rule<T, Name$1>;
|
|
2436
|
+
/**
|
|
2437
|
+
* Create a validation rule iterating over a batch of items at a time.
|
|
2438
|
+
* @param name - The name of the rule.
|
|
2439
|
+
* @param description - A human-readable description of the rule.
|
|
2440
|
+
* @param run - The function that validates the rule.
|
|
2441
|
+
* @returns The created rule.
|
|
2442
|
+
*/
|
|
2443
|
+
declare function batch$1<Name$1 extends string, T>(name: Name$1, description: string, run: Batch<T, Name$1>): Rule<T, Name$1>;
|
|
2444
|
+
/**
|
|
2445
|
+
* A validation issue.
|
|
2446
|
+
*/
|
|
2447
|
+
type Issue<T, RuleName extends string = string> = {
|
|
2448
|
+
/** The name of the rule that caused the issue. */
|
|
2449
|
+
ruleName: RuleName;
|
|
2450
|
+
/** The message of the issue. */
|
|
2451
|
+
message: string;
|
|
2452
|
+
/** The item that was not valid. */
|
|
2453
|
+
item: T;
|
|
2454
|
+
};
|
|
2455
|
+
/**
|
|
2456
|
+
* The result of a validation.
|
|
2457
|
+
*/
|
|
2458
|
+
type Result<T, RuleName extends string = string> = {
|
|
2459
|
+
/** The items that were valid. */
|
|
2460
|
+
valid: T[];
|
|
2461
|
+
/** The reports of the failed validations. */
|
|
2462
|
+
issues: Issue<T, RuleName>[];
|
|
2463
|
+
};
|
|
2464
|
+
declare function run<T, Name$1 extends string, Rules$1 extends readonly Rule<T, Name$1>[]>(parameters: {
|
|
2465
|
+
items: T[];
|
|
2466
|
+
rules: Rules$1;
|
|
2467
|
+
chunkSize?: number;
|
|
2468
|
+
}): Promise<Result<T, RuleNames<Rules$1>>>;
|
|
2469
|
+
declare namespace Gatekeeper_d_exports {
|
|
2470
|
+
export { Gatekeeper, Rules, create };
|
|
2471
|
+
}
|
|
2472
|
+
type Rules = readonly Rule<Offer, string>[];
|
|
2473
|
+
type Gatekeeper = {
|
|
2474
|
+
rules: Rules;
|
|
2475
|
+
isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>;
|
|
2476
|
+
};
|
|
2477
|
+
type GatekeeperParameters = {
|
|
2478
|
+
rules: Rules;
|
|
2479
|
+
};
|
|
2480
|
+
declare function create(parameters: GatekeeperParameters): Gatekeeper;
|
|
2481
|
+
declare namespace GateConfig_d_exports {
|
|
2482
|
+
export { CallbackConfig, GateConfig, assets$1 as assets, configs, getCallback, getCallbackAddresses, getCallbackType, getCallbackTypeAddresses };
|
|
2483
|
+
}
|
|
2484
|
+
type GateConfig = {
|
|
2485
|
+
callbacks?: CallbackConfig[];
|
|
2486
|
+
maturities?: MaturityType[];
|
|
2487
|
+
};
|
|
2488
|
+
type CallbackConfig = {
|
|
2489
|
+
type: CallbackType.BuyVaultV1Callback;
|
|
2490
|
+
addresses: Address[];
|
|
2491
|
+
vaultFactories: Address[];
|
|
2492
|
+
} | {
|
|
2493
|
+
type: CallbackType.SellERC20Callback;
|
|
2494
|
+
addresses: Address[];
|
|
2495
|
+
} | {
|
|
2496
|
+
type: CallbackType.BuyWithEmptyCallback;
|
|
2497
|
+
};
|
|
2498
|
+
declare function getCallback(chain: Name, type: CallbackType.BuyVaultV1Callback): Extract<CallbackConfig, {
|
|
2499
|
+
type: CallbackType.BuyVaultV1Callback;
|
|
2500
|
+
}> | undefined;
|
|
2501
|
+
declare function getCallback(chain: Name, type: CallbackType.SellERC20Callback): Extract<CallbackConfig, {
|
|
2502
|
+
type: CallbackType.SellERC20Callback;
|
|
2503
|
+
}> | undefined;
|
|
2504
|
+
declare function getCallback(chain: Name, type: CallbackType.BuyWithEmptyCallback): Extract<CallbackConfig, {
|
|
2505
|
+
type: CallbackType.BuyWithEmptyCallback;
|
|
2506
|
+
}> | undefined;
|
|
2507
|
+
declare function getCallback(chain: Name, type: CallbackType): CallbackConfig | undefined;
|
|
2508
|
+
/**
|
|
2509
|
+
* Attempts to infer the configured callback type from a callback address on a chain.
|
|
2510
|
+
* Skips the empty callback type as it does not carry addresses.
|
|
2511
|
+
*
|
|
2512
|
+
* @param chain - Chain name for which to infer the callback type
|
|
2513
|
+
* @param address - Callback contract address
|
|
2514
|
+
* @returns The callback type when found, otherwise undefined
|
|
2515
|
+
*/
|
|
2516
|
+
declare function getCallbackType(chain: Name, address: Address): CallbackType | undefined;
|
|
2517
|
+
/**
|
|
2518
|
+
* Returns the callback addresses for a given chain and callback type, if it exists.
|
|
2519
|
+
* @param chain - Chain name for which to read the validation configuration
|
|
2520
|
+
* @param type - Callback type to retrieve
|
|
2521
|
+
* @returns The matching callback addresses or an empty array if not configured
|
|
2522
|
+
*/
|
|
2523
|
+
declare function getCallbackTypeAddresses(chain: Name, type: CallbackType): Address[];
|
|
2524
|
+
/**
|
|
2525
|
+
* Returns the list of allowed non-empty callback addresses for a chain.
|
|
2526
|
+
*
|
|
2527
|
+
* @param chain - Chain name
|
|
2528
|
+
* @returns Array of allowed callback addresses (lowercased). Empty when none configured
|
|
2529
|
+
*/
|
|
2530
|
+
declare const getCallbackAddresses: (chain: Name) => Address[];
|
|
2531
|
+
declare const assets$1: Record<string, Address[]>;
|
|
2532
|
+
declare const configs: Record<Name, GateConfig>;
|
|
2533
|
+
//#endregion
|
|
2534
|
+
//#region src/gatekeeper/morphoRules.d.ts
|
|
2535
|
+
declare const morphoRules: (chains: Chain$1[]) => (Rule<Offer, "mixed_maker"> | Rule<Offer, "chain_ids"> | Rule<Offer, "maturity"> | Rule<Offer, "callback"> | Rule<Offer, "token">)[];
|
|
2536
|
+
declare namespace Rules_d_exports {
|
|
2537
|
+
export { ValidityParameters, callback, chains, maturity, sameMaker, token, validity };
|
|
2538
|
+
}
|
|
2539
|
+
type ValidityParameters = {
|
|
2540
|
+
client: PublicClient<Transport, Chain$1>;
|
|
2541
|
+
};
|
|
2542
|
+
/**
|
|
2543
|
+
* set of rules to validate offers.
|
|
2544
|
+
*
|
|
2545
|
+
* @param parameters - Validity parameters with chain and client
|
|
2546
|
+
* @returns Array of validation rules to evaluate against offers
|
|
2547
|
+
*/
|
|
2548
|
+
declare function validity(parameters: ValidityParameters): (Rule<Offer, "expiry"> | Rule<Offer, "sell_erc20_callback_invalid"> | Rule<Offer, "buy_offers_callback_vault_invalid">)[];
|
|
2549
|
+
declare const chains: ({
|
|
2550
|
+
chains
|
|
2551
|
+
}: {
|
|
2552
|
+
chains: Chain$1[];
|
|
2553
|
+
}) => Rule<Offer, "chain_ids">;
|
|
2554
|
+
declare const maturity: ({
|
|
2555
|
+
maturities
|
|
2556
|
+
}: {
|
|
2557
|
+
maturities: MaturityType[];
|
|
2558
|
+
}) => Rule<Offer, "maturity">;
|
|
2559
|
+
declare const callback: ({
|
|
2560
|
+
callbacks,
|
|
2561
|
+
allowedAddresses
|
|
2562
|
+
}: {
|
|
2563
|
+
callbacks: CallbackType[];
|
|
2564
|
+
allowedAddresses: Address[];
|
|
2565
|
+
}) => Rule<Offer, "callback">;
|
|
2566
|
+
/**
|
|
2567
|
+
* A validation rule that checks if the offer's token is allowed.
|
|
2568
|
+
* @param offer - The offer to validate.
|
|
2569
|
+
* @returns The issue that was found. If the offer is valid, this will be undefined.
|
|
2570
|
+
*/
|
|
2571
|
+
declare const token: ({
|
|
2572
|
+
assets
|
|
2573
|
+
}: {
|
|
2574
|
+
assets: Address[];
|
|
2575
|
+
}) => Rule<Offer, "token">;
|
|
2576
|
+
/**
|
|
2577
|
+
* A batch validation rule that ensures all offers in a tree have the same maker (offering address).
|
|
2578
|
+
* Returns an issue only for the first non-conforming offer.
|
|
2579
|
+
* This rule is signing-agnostic; signer verification is handled at the collector level.
|
|
2580
|
+
*/
|
|
2581
|
+
declare const sameMaker: () => Rule<Offer, "mixed_maker">;
|
|
2582
|
+
//#endregion
|
|
2583
|
+
//#region src/database/domains/Trees.d.ts
|
|
2584
|
+
/**
|
|
2585
|
+
* Attestation data for a single offer, containing the merkle root, signature, and proof.
|
|
2586
|
+
*/
|
|
2587
|
+
type Attestation = {
|
|
2588
|
+
root: Hex;
|
|
2589
|
+
signature: Hex;
|
|
2590
|
+
proof: Hex[];
|
|
2591
|
+
};
|
|
2238
2592
|
declare namespace OfferResponse_d_exports {
|
|
2239
2593
|
export { OfferResponse, from$1 as from };
|
|
2240
2594
|
}
|
|
@@ -2243,9 +2597,10 @@ type OfferResponse = paths["/v1/offers"]["get"]["responses"]["200"]["content"]["
|
|
|
2243
2597
|
* Creates an `OfferResponse` from an `Offer`.
|
|
2244
2598
|
* @constructor
|
|
2245
2599
|
* @param offer - {@link Offer}
|
|
2600
|
+
* @param attestation - {@link Attestation}
|
|
2246
2601
|
* @returns The created `OfferResponse`. {@link OfferResponse}
|
|
2247
2602
|
*/
|
|
2248
|
-
declare function from$1(offer: Offer): OfferResponse;
|
|
2603
|
+
declare function from$1(offer: Offer, attestation?: Attestation): OfferResponse;
|
|
2249
2604
|
//#endregion
|
|
2250
2605
|
//#region src/api/Schema/openapi.d.ts
|
|
2251
2606
|
declare class BooksController {
|
|
@@ -2304,9 +2659,8 @@ declare const schemas: {
|
|
|
2304
2659
|
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
2305
2660
|
}, z$1.core.$strip>;
|
|
2306
2661
|
readonly validate_offers: z$1.ZodObject<{
|
|
2307
|
-
offers: z$1.
|
|
2308
|
-
|
|
2309
|
-
}, z$1.core.$strip>;
|
|
2662
|
+
offers: z$1.ZodArray<z$1.ZodUnknown>;
|
|
2663
|
+
}, z$1.core.$strict>;
|
|
2310
2664
|
};
|
|
2311
2665
|
type Action = keyof typeof schemas;
|
|
2312
2666
|
declare function parse<A extends Action>(action: A, query: unknown): z$1.infer<(typeof schemas)[A]>;
|
|
@@ -2393,7 +2747,12 @@ declare namespace getOffers {
|
|
|
2393
2747
|
limit?: number;
|
|
2394
2748
|
};
|
|
2395
2749
|
type ReturnType = {
|
|
2396
|
-
offers: Offer
|
|
2750
|
+
offers: Compute<Offer & {
|
|
2751
|
+
/** 32-byte merkle root. */
|
|
2752
|
+
root?: Hex;
|
|
2753
|
+
/** Sibling hashes for the merkle proof. */
|
|
2754
|
+
proof?: Hex[];
|
|
2755
|
+
}>[];
|
|
2397
2756
|
/** The pagination cursor. */
|
|
2398
2757
|
cursor: string | null;
|
|
2399
2758
|
};
|
|
@@ -2458,186 +2817,6 @@ type Cursor = {
|
|
|
2458
2817
|
declare function validate(cursor: unknown): cursor is Cursor;
|
|
2459
2818
|
declare function encode(c: Cursor): string;
|
|
2460
2819
|
declare function decode(token?: string): Cursor | null;
|
|
2461
|
-
declare namespace Gate_d_exports {
|
|
2462
|
-
export { Batch, Issue, Result, Rule, RuleNames, Single, batch$1 as batch, run, single };
|
|
2463
|
-
}
|
|
2464
|
-
/**
|
|
2465
|
-
* A validation rule.
|
|
2466
|
-
*/
|
|
2467
|
-
type Rule<T, Name$1 extends string = string> = {
|
|
2468
|
-
kind: "single";
|
|
2469
|
-
name: Name$1;
|
|
2470
|
-
description: string;
|
|
2471
|
-
run: Single<T, Name$1>;
|
|
2472
|
-
} | {
|
|
2473
|
-
kind: "batch";
|
|
2474
|
-
name: Name$1;
|
|
2475
|
-
description: string;
|
|
2476
|
-
run: Batch<T, Name$1>;
|
|
2477
|
-
};
|
|
2478
|
-
type RuleNames<Rules$1 extends readonly {
|
|
2479
|
-
name: string;
|
|
2480
|
-
}[]> = Rules$1[number]["name"];
|
|
2481
|
-
/**
|
|
2482
|
-
* A single item validation rule.
|
|
2483
|
-
* @param item - The item to validate.
|
|
2484
|
-
* @returns The issue that was found. If the item is valid, this will be undefined.
|
|
2485
|
-
*/
|
|
2486
|
-
type Single<T, RuleName extends string> = (item: T) => Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined | Promise<Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined>;
|
|
2487
|
-
/**
|
|
2488
|
-
* A batch item validation rule.
|
|
2489
|
-
* @param items - The items to validate.
|
|
2490
|
-
* @returns A map of the items to the issue that was found.
|
|
2491
|
-
*/
|
|
2492
|
-
type Batch<T, RuleName extends string> = (items: T[]) => Map<number, Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined> | Promise<Map<number, Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined>>;
|
|
2493
|
-
/**
|
|
2494
|
-
* Create a validation rule iterating over a single item at a time.
|
|
2495
|
-
* @param name - The name of the rule.
|
|
2496
|
-
* @param description - A human-readable description of the rule.
|
|
2497
|
-
* @param run - The function that validates the rule.
|
|
2498
|
-
* @returns The created rule.
|
|
2499
|
-
*/
|
|
2500
|
-
declare function single<Name$1 extends string, T>(name: Name$1, description: string, run: Single<T, Name$1>): Rule<T, Name$1>;
|
|
2501
|
-
/**
|
|
2502
|
-
* Create a validation rule iterating over a batch of items at a time.
|
|
2503
|
-
* @param name - The name of the rule.
|
|
2504
|
-
* @param description - A human-readable description of the rule.
|
|
2505
|
-
* @param run - The function that validates the rule.
|
|
2506
|
-
* @returns The created rule.
|
|
2507
|
-
*/
|
|
2508
|
-
declare function batch$1<Name$1 extends string, T>(name: Name$1, description: string, run: Batch<T, Name$1>): Rule<T, Name$1>;
|
|
2509
|
-
/**
|
|
2510
|
-
* A validation issue.
|
|
2511
|
-
*/
|
|
2512
|
-
type Issue<T, RuleName extends string = string> = {
|
|
2513
|
-
/** The name of the rule that caused the issue. */
|
|
2514
|
-
ruleName: RuleName;
|
|
2515
|
-
/** The message of the issue. */
|
|
2516
|
-
message: string;
|
|
2517
|
-
/** The item that was not valid. */
|
|
2518
|
-
item: T;
|
|
2519
|
-
};
|
|
2520
|
-
/**
|
|
2521
|
-
* The result of a validation.
|
|
2522
|
-
*/
|
|
2523
|
-
type Result<T, RuleName extends string = string> = {
|
|
2524
|
-
/** The items that were valid. */
|
|
2525
|
-
valid: T[];
|
|
2526
|
-
/** The reports of the failed validations. */
|
|
2527
|
-
issues: Issue<T, RuleName>[];
|
|
2528
|
-
};
|
|
2529
|
-
declare function run<T, Name$1 extends string, Rules$1 extends readonly Rule<T, Name$1>[]>(parameters: {
|
|
2530
|
-
items: T[];
|
|
2531
|
-
rules: Rules$1;
|
|
2532
|
-
chunkSize?: number;
|
|
2533
|
-
}): Promise<Result<T, RuleNames<Rules$1>>>;
|
|
2534
|
-
declare namespace GateConfig_d_exports {
|
|
2535
|
-
export { CallbackConfig, GateConfig, assets$1 as assets, configs, getCallback, getCallbackAddresses, getCallbackType, getCallbackTypeAddresses };
|
|
2536
|
-
}
|
|
2537
|
-
type GateConfig = {
|
|
2538
|
-
callbacks?: CallbackConfig[];
|
|
2539
|
-
maturities?: MaturityType[];
|
|
2540
|
-
};
|
|
2541
|
-
type CallbackConfig = {
|
|
2542
|
-
type: CallbackType.BuyVaultV1Callback;
|
|
2543
|
-
addresses: Address[];
|
|
2544
|
-
vaultFactories: Address[];
|
|
2545
|
-
} | {
|
|
2546
|
-
type: CallbackType.SellERC20Callback;
|
|
2547
|
-
addresses: Address[];
|
|
2548
|
-
} | {
|
|
2549
|
-
type: CallbackType.BuyWithEmptyCallback;
|
|
2550
|
-
};
|
|
2551
|
-
declare function getCallback(chain: Name, type: CallbackType.BuyVaultV1Callback): Extract<CallbackConfig, {
|
|
2552
|
-
type: CallbackType.BuyVaultV1Callback;
|
|
2553
|
-
}> | undefined;
|
|
2554
|
-
declare function getCallback(chain: Name, type: CallbackType.SellERC20Callback): Extract<CallbackConfig, {
|
|
2555
|
-
type: CallbackType.SellERC20Callback;
|
|
2556
|
-
}> | undefined;
|
|
2557
|
-
declare function getCallback(chain: Name, type: CallbackType.BuyWithEmptyCallback): Extract<CallbackConfig, {
|
|
2558
|
-
type: CallbackType.BuyWithEmptyCallback;
|
|
2559
|
-
}> | undefined;
|
|
2560
|
-
declare function getCallback(chain: Name, type: CallbackType): CallbackConfig | undefined;
|
|
2561
|
-
/**
|
|
2562
|
-
* Attempts to infer the configured callback type from a callback address on a chain.
|
|
2563
|
-
* Skips the empty callback type as it does not carry addresses.
|
|
2564
|
-
*
|
|
2565
|
-
* @param chain - Chain name for which to infer the callback type
|
|
2566
|
-
* @param address - Callback contract address
|
|
2567
|
-
* @returns The callback type when found, otherwise undefined
|
|
2568
|
-
*/
|
|
2569
|
-
declare function getCallbackType(chain: Name, address: Address): CallbackType | undefined;
|
|
2570
|
-
/**
|
|
2571
|
-
* Returns the callback addresses for a given chain and callback type, if it exists.
|
|
2572
|
-
* @param chain - Chain name for which to read the validation configuration
|
|
2573
|
-
* @param type - Callback type to retrieve
|
|
2574
|
-
* @returns The matching callback addresses or an empty array if not configured
|
|
2575
|
-
*/
|
|
2576
|
-
declare function getCallbackTypeAddresses(chain: Name, type: CallbackType): Address[];
|
|
2577
|
-
/**
|
|
2578
|
-
* Returns the list of allowed non-empty callback addresses for a chain.
|
|
2579
|
-
*
|
|
2580
|
-
* @param chain - Chain name
|
|
2581
|
-
* @returns Array of allowed callback addresses (lowercased). Empty when none configured
|
|
2582
|
-
*/
|
|
2583
|
-
declare const getCallbackAddresses: (chain: Name) => Address[];
|
|
2584
|
-
declare const assets$1: Record<string, Address[]>;
|
|
2585
|
-
declare const configs: Record<Name, GateConfig>;
|
|
2586
|
-
declare namespace Gatekeeper_d_exports {
|
|
2587
|
-
export { Gatekeeper, Rules, create };
|
|
2588
|
-
}
|
|
2589
|
-
type Rules = readonly Rule<Offer, string>[];
|
|
2590
|
-
type Gatekeeper = {
|
|
2591
|
-
rules: Rules;
|
|
2592
|
-
isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>;
|
|
2593
|
-
};
|
|
2594
|
-
type GatekeeperParameters = {
|
|
2595
|
-
rules: Rules;
|
|
2596
|
-
};
|
|
2597
|
-
declare function create(parameters: GatekeeperParameters): Gatekeeper;
|
|
2598
|
-
//#endregion
|
|
2599
|
-
//#region src/gatekeeper/morphoRules.d.ts
|
|
2600
|
-
declare const morphoRules: (chains: Chain$1[]) => (Rule<Offer, "chain_ids"> | Rule<Offer, "maturity"> | Rule<Offer, "callback"> | Rule<Offer, "token">)[];
|
|
2601
|
-
declare namespace Rules_d_exports {
|
|
2602
|
-
export { ValidityParameters, callback, chains, maturity, token, validity };
|
|
2603
|
-
}
|
|
2604
|
-
type ValidityParameters = {
|
|
2605
|
-
client: PublicClient<Transport, Chain$1>;
|
|
2606
|
-
};
|
|
2607
|
-
/**
|
|
2608
|
-
* set of rules to validate offers.
|
|
2609
|
-
*
|
|
2610
|
-
* @param parameters - Validity parameters with chain and client
|
|
2611
|
-
* @returns Array of validation rules to evaluate against offers
|
|
2612
|
-
*/
|
|
2613
|
-
declare function validity(parameters: ValidityParameters): (Rule<Offer, "expiry"> | Rule<Offer, "sell_erc20_callback_invalid"> | Rule<Offer, "buy_offers_callback_vault_invalid">)[];
|
|
2614
|
-
declare const chains: ({
|
|
2615
|
-
chains
|
|
2616
|
-
}: {
|
|
2617
|
-
chains: Chain$1[];
|
|
2618
|
-
}) => Rule<Offer, "chain_ids">;
|
|
2619
|
-
declare const maturity: ({
|
|
2620
|
-
maturities
|
|
2621
|
-
}: {
|
|
2622
|
-
maturities: MaturityType[];
|
|
2623
|
-
}) => Rule<Offer, "maturity">;
|
|
2624
|
-
declare const callback: ({
|
|
2625
|
-
callbacks,
|
|
2626
|
-
allowedAddresses
|
|
2627
|
-
}: {
|
|
2628
|
-
callbacks: CallbackType[];
|
|
2629
|
-
allowedAddresses: Address[];
|
|
2630
|
-
}) => Rule<Offer, "callback">;
|
|
2631
|
-
/**
|
|
2632
|
-
* A validation rule that checks if the offer's token is allowed.
|
|
2633
|
-
* @param offer - The offer to validate.
|
|
2634
|
-
* @returns The issue that was found. If the offer is valid, this will be undefined.
|
|
2635
|
-
*/
|
|
2636
|
-
declare const token: ({
|
|
2637
|
-
assets
|
|
2638
|
-
}: {
|
|
2639
|
-
assets: Address[];
|
|
2640
|
-
}) => Rule<Offer, "token">;
|
|
2641
2820
|
//#endregion
|
|
2642
2821
|
//#region src/mempool/MempoolEVMClient.d.ts
|
|
2643
2822
|
declare function from(parameters: from.Parameters): from.ReturnType;
|
|
@@ -2775,6 +2954,41 @@ declare function poll<data>(fn: ({
|
|
|
2775
2954
|
}: {
|
|
2776
2955
|
interval: () => Promise<number>;
|
|
2777
2956
|
}): () => boolean;
|
|
2957
|
+
declare namespace Random_d_exports {
|
|
2958
|
+
export { address, bool, bytes, float, hex, int, seed, withSeed };
|
|
2959
|
+
}
|
|
2960
|
+
/**
|
|
2961
|
+
* Runs a function with a deterministic RNG derived from the given seed.
|
|
2962
|
+
*/
|
|
2963
|
+
declare function withSeed<T>(seed: string, fn: () => T): T;
|
|
2964
|
+
/**
|
|
2965
|
+
* Seeds the global RNG for deterministic test runs.
|
|
2966
|
+
*/
|
|
2967
|
+
declare function seed(seed: string): void;
|
|
2968
|
+
/**
|
|
2969
|
+
* Returns a deterministic random float in [0, 1).
|
|
2970
|
+
*/
|
|
2971
|
+
declare function float(): number;
|
|
2972
|
+
/**
|
|
2973
|
+
* Returns a deterministic random integer in [min, maxExclusive).
|
|
2974
|
+
*/
|
|
2975
|
+
declare function int(maxExclusive: number, min?: number): number;
|
|
2976
|
+
/**
|
|
2977
|
+
* Returns a deterministic random boolean.
|
|
2978
|
+
*/
|
|
2979
|
+
declare function bool(probability?: number): boolean;
|
|
2980
|
+
/**
|
|
2981
|
+
* Returns deterministic random bytes.
|
|
2982
|
+
*/
|
|
2983
|
+
declare function bytes(length: number): Uint8Array;
|
|
2984
|
+
/**
|
|
2985
|
+
* Returns a deterministic random hex string for the given byte length.
|
|
2986
|
+
*/
|
|
2987
|
+
declare function hex(byteLength: number): Hex;
|
|
2988
|
+
/**
|
|
2989
|
+
* Returns a deterministic random address.
|
|
2990
|
+
*/
|
|
2991
|
+
declare function address(): Address;
|
|
2778
2992
|
//#endregion
|
|
2779
2993
|
//#region src/utils/retry.d.ts
|
|
2780
2994
|
declare const retry: <T>(fn: () => Promise<T>, attempts?: number, delayMs?: number) => Promise<T>;
|
|
@@ -2787,7 +3001,7 @@ declare function max(): number;
|
|
|
2787
3001
|
//#region src/utils/wait.d.ts
|
|
2788
3002
|
declare function wait(time: number): Promise<unknown>;
|
|
2789
3003
|
declare namespace index_d_exports$2 {
|
|
2790
|
-
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 };
|
|
3004
|
+
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 };
|
|
2791
3005
|
}
|
|
2792
3006
|
//#endregion
|
|
2793
3007
|
export { index_d_exports as Abi, Brand, BrandTypeId, Callback_d_exports as Callback, Chain_d_exports as Chain, Collateral_d_exports as Collateral, Compute, Cursor_d_exports as Cursor, 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, LLTV_d_exports as LLTV, Liquidity_d_exports as Liquidity, Maturity_d_exports as Maturity, MempoolClient_d_exports as Mempool, Obligation_d_exports as Obligation, Offer_d_exports as Offer, Oracle_d_exports as Oracle, Position_d_exports as Position, Quote_d_exports as Quote, index_d_exports$1 as RouterApi, Client_d_exports as RouterClient, Rules_d_exports as Rules, time_d_exports as Time, Transfer_d_exports as Transfer, Tree_d_exports as Tree, index_d_exports$2 as Utils, Gate_d_exports as Validation, morphoRules };
|