@morpho-dev/router 0.5.0 → 0.7.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 +2353 -1043
- package/dist/drizzle/migrations/0023_remove-block-number-for-collaterals.sql +1 -0
- package/dist/drizzle/migrations/meta/0023_snapshot.json +1436 -0
- package/dist/drizzle/migrations/meta/_journal.json +7 -0
- package/dist/index.browser.d.mts +540 -169
- package/dist/index.browser.d.mts.map +1 -1
- package/dist/index.browser.d.ts +540 -169
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +956 -411
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.mjs +958 -407
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.node.d.mts +628 -187
- package/dist/index.node.d.mts.map +1 -1
- package/dist/index.node.d.ts +627 -186
- package/dist/index.node.d.ts.map +1 -1
- package/dist/index.node.js +6776 -5605
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.mjs +6767 -5602
- package/dist/index.node.mjs.map +1 -1
- package/docs/integrator.md +7 -1
- package/package.json +2 -2
package/dist/index.browser.d.ts
CHANGED
|
@@ -29,9 +29,9 @@ declare const CollectorHealth: z.ZodObject<{
|
|
|
29
29
|
updated_at: z.ZodNullable<z.ZodString>;
|
|
30
30
|
lag: z.ZodNullable<z.ZodNumber>;
|
|
31
31
|
status: z.ZodEnum<{
|
|
32
|
+
unknown: "unknown";
|
|
32
33
|
live: "live";
|
|
33
34
|
lagging: "lagging";
|
|
34
|
-
unknown: "unknown";
|
|
35
35
|
}>;
|
|
36
36
|
initialized: z.ZodBoolean;
|
|
37
37
|
}, z.core.$strip>;
|
|
@@ -42,9 +42,9 @@ declare const CollectorsHealthResponse: z.ZodArray<z.ZodObject<{
|
|
|
42
42
|
updated_at: z.ZodNullable<z.ZodString>;
|
|
43
43
|
lag: z.ZodNullable<z.ZodNumber>;
|
|
44
44
|
status: z.ZodEnum<{
|
|
45
|
+
unknown: "unknown";
|
|
45
46
|
live: "live";
|
|
46
47
|
lagging: "lagging";
|
|
47
|
-
unknown: "unknown";
|
|
48
48
|
}>;
|
|
49
49
|
initialized: z.ZodBoolean;
|
|
50
50
|
}, z.core.$strip>>;
|
|
@@ -886,7 +886,7 @@ declare function toSnakeCase$1<T>(obj: T): Snake<T>;
|
|
|
886
886
|
declare function fromSnakeCase$3<T>(obj: Snake<T>): T;
|
|
887
887
|
declare function stringifyBigint<T>(value: T): StringifiedBigint<T>;
|
|
888
888
|
declare namespace Obligation_d_exports {
|
|
889
|
-
export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$11 as from, fromSnakeCase$2 as fromSnakeCase, id, random$2 as random };
|
|
889
|
+
export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$11 as from, fromOffer$1 as fromOffer, fromSnakeCase$2 as fromSnakeCase, id, random$2 as random };
|
|
890
890
|
}
|
|
891
891
|
type Obligation = {
|
|
892
892
|
/** The chain id where the liquidity for this obligation is located. */chainId: Id; /** The token that is being borrowed for this obligation. */
|
|
@@ -994,6 +994,18 @@ declare function random$2(): random$2.ReturnType;
|
|
|
994
994
|
declare namespace random$2 {
|
|
995
995
|
type ReturnType = Obligation;
|
|
996
996
|
}
|
|
997
|
+
/**
|
|
998
|
+
* Creates an obligation from an offer.
|
|
999
|
+
* @constructor
|
|
1000
|
+
*
|
|
1001
|
+
* @param offer - The offer to create the obligation from.
|
|
1002
|
+
* @returns The created obligation. {@link fromOffer.ReturnType}
|
|
1003
|
+
*/
|
|
1004
|
+
declare function fromOffer$1(offer: Offer): fromOffer$1.ReturnType;
|
|
1005
|
+
declare namespace fromOffer$1 {
|
|
1006
|
+
type Parameters = Offer;
|
|
1007
|
+
type ReturnType = Obligation;
|
|
1008
|
+
}
|
|
997
1009
|
declare class InvalidObligationError extends BaseError<z$1.ZodError | Error> {
|
|
998
1010
|
readonly name = "Obligation.InvalidObligationError";
|
|
999
1011
|
constructor(error: z$1.ZodError | Error);
|
|
@@ -1003,7 +1015,7 @@ declare class CollateralsAreNotSortedError extends BaseError {
|
|
|
1003
1015
|
constructor();
|
|
1004
1016
|
}
|
|
1005
1017
|
declare namespace Offer_d_exports {
|
|
1006
|
-
export {
|
|
1018
|
+
export { InvalidOfferError, Offer, OfferConsumed, OfferInput, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$1 as decode, domain, encode$1 as encode, from$10 as from, fromSnakeCase$1 as fromSnakeCase, hash, obligationId, random$1 as random, serialize, toSnakeCase, types };
|
|
1007
1019
|
}
|
|
1008
1020
|
type Offer = {
|
|
1009
1021
|
/** The address that made the offer. */readonly maker: Address; /** The amount of assets offered. Mutually exclusive with obligationUnits and obligationShares. */
|
|
@@ -1242,15 +1254,6 @@ declare const types: {
|
|
|
1242
1254
|
readonly type: "bytes";
|
|
1243
1255
|
}];
|
|
1244
1256
|
};
|
|
1245
|
-
/**
|
|
1246
|
-
* Signs an array of offers.
|
|
1247
|
-
* @throws {Error} If the wallet account is not set.
|
|
1248
|
-
* @param offers - The offers to sign.
|
|
1249
|
-
* @param wallet - The wallet to sign the offers with.
|
|
1250
|
-
* @returns The signed offers.
|
|
1251
|
-
*/
|
|
1252
|
-
declare function sign(offers: Offer[], wallet: WalletClient): Promise<Hex>;
|
|
1253
|
-
declare function signatureMsg(offers: Offer[]): Hex;
|
|
1254
1257
|
declare function hash(offer: Offer): Hex;
|
|
1255
1258
|
/**
|
|
1256
1259
|
* Calculates the obligation id for an offer based on the smart contract's Obligation struct.
|
|
@@ -1308,12 +1311,8 @@ declare class InvalidOfferError extends BaseError<z$1.ZodError | Error> {
|
|
|
1308
1311
|
*/
|
|
1309
1312
|
get formattedMessage(): string;
|
|
1310
1313
|
}
|
|
1311
|
-
declare class AccountNotSetError extends BaseError {
|
|
1312
|
-
readonly name = "Offer.AccountNotSetError";
|
|
1313
|
-
constructor();
|
|
1314
|
-
}
|
|
1315
1314
|
declare namespace Oracle_d_exports {
|
|
1316
|
-
export { Conversion, Oracle, from$9 as from };
|
|
1315
|
+
export { Conversion, Oracle, from$9 as from, fromCollateral, fromOffer, fromOffers };
|
|
1317
1316
|
}
|
|
1318
1317
|
/**
|
|
1319
1318
|
* An oracle contract that provides price information for assets.
|
|
@@ -1339,6 +1338,55 @@ declare namespace from$9 {
|
|
|
1339
1338
|
};
|
|
1340
1339
|
type ReturnType = Oracle;
|
|
1341
1340
|
}
|
|
1341
|
+
/**
|
|
1342
|
+
* Creates an oracle from a collateral.
|
|
1343
|
+
* @constructor
|
|
1344
|
+
*
|
|
1345
|
+
* @param parameters - {@link fromCollateral.Parameters}
|
|
1346
|
+
* @returns The created oracle. {@link fromCollateral.ReturnType}
|
|
1347
|
+
*/
|
|
1348
|
+
declare function fromCollateral(parameters: fromCollateral.Parameters): fromCollateral.ReturnType;
|
|
1349
|
+
declare namespace fromCollateral {
|
|
1350
|
+
type Parameters = {
|
|
1351
|
+
chainId: Id;
|
|
1352
|
+
collateral: Collateral;
|
|
1353
|
+
blockNumber: number;
|
|
1354
|
+
price?: bigint | null;
|
|
1355
|
+
};
|
|
1356
|
+
type ReturnType = Oracle;
|
|
1357
|
+
}
|
|
1358
|
+
/**
|
|
1359
|
+
* Creates oracles from a single offer.
|
|
1360
|
+
* @constructor
|
|
1361
|
+
*
|
|
1362
|
+
* @param parameters - {@link fromOffer.Parameters}
|
|
1363
|
+
* @returns The created oracles. {@link fromOffer.ReturnType}
|
|
1364
|
+
*/
|
|
1365
|
+
declare function fromOffer(parameters: fromOffer.Parameters): fromOffer.ReturnType;
|
|
1366
|
+
declare namespace fromOffer {
|
|
1367
|
+
type Parameters = {
|
|
1368
|
+
offer: Offer;
|
|
1369
|
+
blockNumber: number;
|
|
1370
|
+
price?: bigint | null;
|
|
1371
|
+
};
|
|
1372
|
+
type ReturnType = Oracle[];
|
|
1373
|
+
}
|
|
1374
|
+
/**
|
|
1375
|
+
* Creates oracles from a list of offers.
|
|
1376
|
+
* @constructor
|
|
1377
|
+
*
|
|
1378
|
+
* @param parameters - {@link fromOffers.Parameters}
|
|
1379
|
+
* @returns The created oracles. {@link fromOffers.ReturnType}
|
|
1380
|
+
*/
|
|
1381
|
+
declare function fromOffers(parameters: fromOffers.Parameters): fromOffers.ReturnType;
|
|
1382
|
+
declare namespace fromOffers {
|
|
1383
|
+
type Parameters = {
|
|
1384
|
+
offers: Offer[];
|
|
1385
|
+
blockNumber: number;
|
|
1386
|
+
price?: bigint | null;
|
|
1387
|
+
};
|
|
1388
|
+
type ReturnType = Oracle[];
|
|
1389
|
+
}
|
|
1342
1390
|
/**
|
|
1343
1391
|
* Conversion utilities for converting between collateral and loan token amounts
|
|
1344
1392
|
* using oracle prices and LLTV
|
|
@@ -1594,7 +1642,7 @@ declare namespace from$5 {
|
|
|
1594
1642
|
type ReturnType = Transfer;
|
|
1595
1643
|
}
|
|
1596
1644
|
declare namespace Tree_d_exports {
|
|
1597
|
-
export { DecodeError, EncodeError, Proof, Tree, TreeError, VERSION, decode, encode, encodeUnsigned, from$4 as from, proofs };
|
|
1645
|
+
export { DecodeError, EncodeError, NormalizedSignatureDomain, Proof, SignatureDomain, SignatureDomainError, Tree, TreeError, VERSION, decode, encode, encodeUnsigned, from$4 as from, proofs, signatureDomain, signatureTypes };
|
|
1598
1646
|
}
|
|
1599
1647
|
/**
|
|
1600
1648
|
* A merkle tree of offers built from offer hashes.
|
|
@@ -1609,6 +1657,31 @@ type Proof = {
|
|
|
1609
1657
|
path: Hex[];
|
|
1610
1658
|
};
|
|
1611
1659
|
declare const VERSION = 1;
|
|
1660
|
+
type SignatureDomain = {
|
|
1661
|
+
/** Chain id used in the EIP-712 domain. */chainId: number | bigint; /** MorphoV2 contract address used as verifying contract. */
|
|
1662
|
+
verifyingContract: Address;
|
|
1663
|
+
};
|
|
1664
|
+
/** Normalized Root signature domain (BigInt chain id, lowercase address). */
|
|
1665
|
+
type NormalizedSignatureDomain = {
|
|
1666
|
+
chainId: bigint;
|
|
1667
|
+
verifyingContract: Address;
|
|
1668
|
+
};
|
|
1669
|
+
/**
|
|
1670
|
+
* EIP-712 types for signing the tree root (Root(bytes32 root)).
|
|
1671
|
+
*/
|
|
1672
|
+
declare const signatureTypes: {
|
|
1673
|
+
readonly EIP712Domain: readonly [{
|
|
1674
|
+
readonly name: "chainId";
|
|
1675
|
+
readonly type: "uint256";
|
|
1676
|
+
}, {
|
|
1677
|
+
readonly name: "verifyingContract";
|
|
1678
|
+
readonly type: "address";
|
|
1679
|
+
}];
|
|
1680
|
+
readonly Root: readonly [{
|
|
1681
|
+
readonly name: "root";
|
|
1682
|
+
readonly type: "bytes32";
|
|
1683
|
+
}];
|
|
1684
|
+
};
|
|
1612
1685
|
/**
|
|
1613
1686
|
* Builds a Merkle tree from a list of offers.
|
|
1614
1687
|
*
|
|
@@ -1631,6 +1704,11 @@ declare const from$4: (offers: Offer[]) => Tree;
|
|
|
1631
1704
|
* @returns Array of proofs - {@link Proof}
|
|
1632
1705
|
*/
|
|
1633
1706
|
declare const proofs: (tree: Tree) => Proof[];
|
|
1707
|
+
/**
|
|
1708
|
+
* Normalizes a Root signature domain (BigInt chain id, lowercase address).
|
|
1709
|
+
* @throws {SignatureDomainError} When the domain is invalid.
|
|
1710
|
+
*/
|
|
1711
|
+
declare const signatureDomain: (domain: SignatureDomain) => NormalizedSignatureDomain;
|
|
1634
1712
|
/**
|
|
1635
1713
|
* Encodes a merkle tree with signature into hex calldata for onchain broadcast.
|
|
1636
1714
|
*
|
|
@@ -1638,15 +1716,21 @@ declare const proofs: (tree: Tree) => Proof[];
|
|
|
1638
1716
|
* - `{vv}`: 1-byte version (currently 0x01)
|
|
1639
1717
|
* - `{gzip([...offers])}`: gzipped JSON array of serialized offers
|
|
1640
1718
|
* - `{root}`: 32-byte merkle root
|
|
1641
|
-
* - `{signature}`: 65-byte EIP-
|
|
1719
|
+
* - `{signature}`: 65-byte EIP-712 signature over Root(bytes32 root)
|
|
1642
1720
|
*
|
|
1643
1721
|
* Validates signature authenticity and root integrity before encoding.
|
|
1644
1722
|
*
|
|
1645
1723
|
* @example
|
|
1646
1724
|
* ```typescript
|
|
1647
1725
|
* const tree = Tree.from(offers);
|
|
1648
|
-
* const signature = await wallet.
|
|
1649
|
-
*
|
|
1726
|
+
* const signature = await wallet.signTypedData({
|
|
1727
|
+
* account: wallet.account,
|
|
1728
|
+
* domain: Tree.signatureDomain({ chainId, verifyingContract }),
|
|
1729
|
+
* types: Tree.signatureTypes,
|
|
1730
|
+
* primaryType: "Root",
|
|
1731
|
+
* message: { root: tree.root },
|
|
1732
|
+
* });
|
|
1733
|
+
* const calldata = await Tree.encode(tree, signature, { chainId, verifyingContract });
|
|
1650
1734
|
* await broadcast(calldata);
|
|
1651
1735
|
* ```
|
|
1652
1736
|
*
|
|
@@ -1656,16 +1740,23 @@ declare const proofs: (tree: Tree) => Proof[];
|
|
|
1656
1740
|
* const tree = Tree.from(offers);
|
|
1657
1741
|
* const compressed = gzip(JSON.stringify(tree.offers.map(Offer.serialize)));
|
|
1658
1742
|
* const partial = `0x01${bytesToHex(compressed)}${tree.root.slice(2)}`;
|
|
1659
|
-
* const signature = await wallet.
|
|
1743
|
+
* const signature = await wallet.signTypedData({
|
|
1744
|
+
* account: wallet.account,
|
|
1745
|
+
* domain: Tree.signatureDomain({ chainId, verifyingContract }),
|
|
1746
|
+
* types: Tree.signatureTypes,
|
|
1747
|
+
* primaryType: "Root",
|
|
1748
|
+
* message: { root: tree.root },
|
|
1749
|
+
* });
|
|
1660
1750
|
* const calldata = `${partial}${signature.slice(2)}`;
|
|
1661
1751
|
* ```
|
|
1662
1752
|
*
|
|
1663
1753
|
* @param tree - Merkle tree of offers
|
|
1664
|
-
* @param signature - EIP-
|
|
1754
|
+
* @param signature - EIP-712 signature over Root(bytes32 root)
|
|
1755
|
+
* @param domain - EIP-712 domain with chain id and verifying contract
|
|
1665
1756
|
* @returns Hex-encoded calldata ready for onchain broadcast
|
|
1666
1757
|
* @throws {EncodeError} If signature verification fails or root mismatch
|
|
1667
1758
|
*/
|
|
1668
|
-
declare const encode: (tree: Tree, signature: Hex) => Promise<Hex>;
|
|
1759
|
+
declare const encode: (tree: Tree, signature: Hex, domain: SignatureDomain) => Promise<Hex>;
|
|
1669
1760
|
/**
|
|
1670
1761
|
* Encodes a merkle tree without a signature into hex payload for client-side signing.
|
|
1671
1762
|
*
|
|
@@ -1695,15 +1786,16 @@ declare const encodeUnsigned: (tree: Tree) => Hex;
|
|
|
1695
1786
|
*
|
|
1696
1787
|
* @example
|
|
1697
1788
|
* ```typescript
|
|
1698
|
-
* const { tree, signature, signer } = await Tree.decode(calldata);
|
|
1789
|
+
* const { tree, signature, signer } = await Tree.decode(calldata, { chainId, verifyingContract });
|
|
1699
1790
|
* console.log(`Tree signed by ${signer} with ${tree.offers.length} offers`);
|
|
1700
1791
|
* ```
|
|
1701
1792
|
*
|
|
1702
1793
|
* @param encoded - Hex calldata in format `0x{vv}{gzip}{root}{signature}`
|
|
1794
|
+
* @param domain - EIP-712 domain with chain id and verifying contract
|
|
1703
1795
|
* @returns Validated tree, signature, and recovered signer address
|
|
1704
1796
|
* @throws {DecodeError} If version invalid, signature invalid, or root mismatch
|
|
1705
1797
|
*/
|
|
1706
|
-
declare const decode: (encoded: Hex) => Promise<{
|
|
1798
|
+
declare const decode: (encoded: Hex, domain: SignatureDomain) => Promise<{
|
|
1707
1799
|
tree: Tree;
|
|
1708
1800
|
signature: Hex;
|
|
1709
1801
|
signer: Address;
|
|
@@ -1732,6 +1824,13 @@ declare class DecodeError extends BaseError {
|
|
|
1732
1824
|
name: string;
|
|
1733
1825
|
constructor(reason: string);
|
|
1734
1826
|
}
|
|
1827
|
+
/**
|
|
1828
|
+
* Error thrown when an invalid signature domain is supplied.
|
|
1829
|
+
*/
|
|
1830
|
+
declare class SignatureDomainError extends BaseError {
|
|
1831
|
+
name: string;
|
|
1832
|
+
constructor(reason: string);
|
|
1833
|
+
}
|
|
1735
1834
|
//#endregion
|
|
1736
1835
|
//#region src/api/Schema/generated/swagger.d.ts
|
|
1737
1836
|
/**
|
|
@@ -1807,7 +1906,7 @@ interface paths {
|
|
|
1807
1906
|
patch?: never;
|
|
1808
1907
|
trace?: never;
|
|
1809
1908
|
};
|
|
1810
|
-
"/v1/config": {
|
|
1909
|
+
"/v1/config/contracts": {
|
|
1811
1910
|
parameters: {
|
|
1812
1911
|
query?: never;
|
|
1813
1912
|
header?: never;
|
|
@@ -1815,12 +1914,87 @@ interface paths {
|
|
|
1815
1914
|
cookie?: never;
|
|
1816
1915
|
};
|
|
1817
1916
|
/**
|
|
1818
|
-
* Get
|
|
1819
|
-
* @description Returns
|
|
1917
|
+
* Get indexer contract configuration
|
|
1918
|
+
* @description Returns contract addresses used by indexers (mempool, v2) and multicall for indexed chains.
|
|
1820
1919
|
*/
|
|
1821
1920
|
get: {
|
|
1822
1921
|
parameters: {
|
|
1823
|
-
query?:
|
|
1922
|
+
query?: {
|
|
1923
|
+
/**
|
|
1924
|
+
* @description Filter by chain IDs (comma-separated).
|
|
1925
|
+
* @example 1,8453
|
|
1926
|
+
*/
|
|
1927
|
+
chains?: number[];
|
|
1928
|
+
/**
|
|
1929
|
+
* @description Maximum number of contracts to return (max 1000).
|
|
1930
|
+
* @example 1000
|
|
1931
|
+
*/
|
|
1932
|
+
limit?: number;
|
|
1933
|
+
/**
|
|
1934
|
+
* @description Pagination cursor in chain_id:address format (lowercase address).
|
|
1935
|
+
* @example 505050505:0xd946246695a9259f3b33a78629026f61b3ab40af
|
|
1936
|
+
*/
|
|
1937
|
+
cursor?: string;
|
|
1938
|
+
};
|
|
1939
|
+
header?: never;
|
|
1940
|
+
path?: never;
|
|
1941
|
+
cookie?: never;
|
|
1942
|
+
};
|
|
1943
|
+
requestBody?: never;
|
|
1944
|
+
responses: {
|
|
1945
|
+
/** @description Success */200: {
|
|
1946
|
+
headers: {
|
|
1947
|
+
[name: string]: unknown;
|
|
1948
|
+
};
|
|
1949
|
+
content: {
|
|
1950
|
+
"application/json": components["schemas"]["ConfigContractsSuccessResponse"];
|
|
1951
|
+
};
|
|
1952
|
+
};
|
|
1953
|
+
};
|
|
1954
|
+
};
|
|
1955
|
+
put?: never;
|
|
1956
|
+
post?: never;
|
|
1957
|
+
delete?: never;
|
|
1958
|
+
options?: never;
|
|
1959
|
+
head?: never;
|
|
1960
|
+
patch?: never;
|
|
1961
|
+
trace?: never;
|
|
1962
|
+
};
|
|
1963
|
+
"/v1/config/rules": {
|
|
1964
|
+
parameters: {
|
|
1965
|
+
query?: never;
|
|
1966
|
+
header?: never;
|
|
1967
|
+
path?: never;
|
|
1968
|
+
cookie?: never;
|
|
1969
|
+
};
|
|
1970
|
+
/**
|
|
1971
|
+
* Get config rules
|
|
1972
|
+
* @description Returns configured rules for supported chains.
|
|
1973
|
+
*/
|
|
1974
|
+
get: {
|
|
1975
|
+
parameters: {
|
|
1976
|
+
query?: {
|
|
1977
|
+
/**
|
|
1978
|
+
* @description Filter by chain IDs (comma-separated).
|
|
1979
|
+
* @example 1,8453
|
|
1980
|
+
*/
|
|
1981
|
+
chains?: number[];
|
|
1982
|
+
/**
|
|
1983
|
+
* @description Filter by rule types (comma-separated).
|
|
1984
|
+
* @example maturity,loan_token,oracle
|
|
1985
|
+
*/
|
|
1986
|
+
types?: string[];
|
|
1987
|
+
/**
|
|
1988
|
+
* @description Maximum number of rules to return (max 1000).
|
|
1989
|
+
* @example 100
|
|
1990
|
+
*/
|
|
1991
|
+
limit?: number;
|
|
1992
|
+
/**
|
|
1993
|
+
* @description Pagination cursor in type:chain_id:<value> format.
|
|
1994
|
+
* @example maturity:1:1730415600:end_of_next_month
|
|
1995
|
+
*/
|
|
1996
|
+
cursor?: string;
|
|
1997
|
+
};
|
|
1824
1998
|
header?: never;
|
|
1825
1999
|
path?: never;
|
|
1826
2000
|
cookie?: never;
|
|
@@ -1832,7 +2006,7 @@ interface paths {
|
|
|
1832
2006
|
[name: string]: unknown;
|
|
1833
2007
|
};
|
|
1834
2008
|
content: {
|
|
1835
|
-
"application/json": components["schemas"]["
|
|
2009
|
+
"application/json": components["schemas"]["ConfigRulesSuccessResponse"];
|
|
1836
2010
|
};
|
|
1837
2011
|
};
|
|
1838
2012
|
};
|
|
@@ -2253,15 +2427,6 @@ interface paths {
|
|
|
2253
2427
|
/**
|
|
2254
2428
|
* Validate offers
|
|
2255
2429
|
* @description Validates offers against router validation rules. Returns unsigned payload + root on success, or issues only on validation failure.
|
|
2256
|
-
*
|
|
2257
|
-
* **Available validation rules:**
|
|
2258
|
-
* - **parse_error**: Returns when an offer fails to parse due to invalid format or missing required fields
|
|
2259
|
-
* - **mixed_maker**: Validates that all offers in a batch have the same maker address
|
|
2260
|
-
* - **amount_mutual_exclusivity**: Validates that at most one of (assets, obligationUnits, obligationShares) is non-zero
|
|
2261
|
-
* - **chain_ids**: Validates that offer chain is one of: [109111114]
|
|
2262
|
-
* - **maturity**: Validates that offer maturity is one of: [end_of_month, end_of_next_month]
|
|
2263
|
-
* - **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]
|
|
2264
|
-
* - **token**: Validates that offer loan token and collateral tokens are in the allowed assets list for the offer chain
|
|
2265
2430
|
*/
|
|
2266
2431
|
post: {
|
|
2267
2432
|
parameters: {
|
|
@@ -2300,6 +2465,56 @@ interface paths {
|
|
|
2300
2465
|
patch?: never;
|
|
2301
2466
|
trace?: never;
|
|
2302
2467
|
};
|
|
2468
|
+
"/v1/callbacks": {
|
|
2469
|
+
parameters: {
|
|
2470
|
+
query?: never;
|
|
2471
|
+
header?: never;
|
|
2472
|
+
path?: never;
|
|
2473
|
+
cookie?: never;
|
|
2474
|
+
};
|
|
2475
|
+
get?: never;
|
|
2476
|
+
put?: never;
|
|
2477
|
+
/**
|
|
2478
|
+
* Resolve callback types
|
|
2479
|
+
* @description Returns callback types for callback addresses grouped by chain.
|
|
2480
|
+
*/
|
|
2481
|
+
post: {
|
|
2482
|
+
parameters: {
|
|
2483
|
+
query?: never;
|
|
2484
|
+
header?: never;
|
|
2485
|
+
path?: never;
|
|
2486
|
+
cookie?: never;
|
|
2487
|
+
};
|
|
2488
|
+
requestBody?: {
|
|
2489
|
+
content: {
|
|
2490
|
+
"application/json": components["schemas"]["CallbackTypesRequest"];
|
|
2491
|
+
};
|
|
2492
|
+
};
|
|
2493
|
+
responses: {
|
|
2494
|
+
/** @description Success */200: {
|
|
2495
|
+
headers: {
|
|
2496
|
+
[name: string]: unknown;
|
|
2497
|
+
};
|
|
2498
|
+
content: {
|
|
2499
|
+
"application/json": components["schemas"]["CallbackTypesSuccessResponse"];
|
|
2500
|
+
};
|
|
2501
|
+
}; /** @description Bad Request */
|
|
2502
|
+
400: {
|
|
2503
|
+
headers: {
|
|
2504
|
+
[name: string]: unknown;
|
|
2505
|
+
};
|
|
2506
|
+
content: {
|
|
2507
|
+
"application/json": components["schemas"]["BadRequestResponse"];
|
|
2508
|
+
};
|
|
2509
|
+
};
|
|
2510
|
+
};
|
|
2511
|
+
};
|
|
2512
|
+
delete?: never;
|
|
2513
|
+
options?: never;
|
|
2514
|
+
head?: never;
|
|
2515
|
+
patch?: never;
|
|
2516
|
+
trace?: never;
|
|
2517
|
+
};
|
|
2303
2518
|
}
|
|
2304
2519
|
interface components {
|
|
2305
2520
|
schemas: {
|
|
@@ -2337,42 +2552,90 @@ interface components {
|
|
|
2337
2552
|
*/
|
|
2338
2553
|
details: Record<string, never>;
|
|
2339
2554
|
};
|
|
2340
|
-
|
|
2555
|
+
ConfigContractsSuccessResponse: {
|
|
2341
2556
|
meta: components["schemas"]["Meta"]; /** @example null */
|
|
2342
2557
|
cursor: string | null;
|
|
2343
2558
|
/**
|
|
2344
|
-
* @description
|
|
2559
|
+
* @description Indexer contract configuration for all indexed chains.
|
|
2345
2560
|
* @example [
|
|
2346
2561
|
* {
|
|
2347
2562
|
* "chain_id": 505050505,
|
|
2348
|
-
* "
|
|
2349
|
-
*
|
|
2350
|
-
*
|
|
2351
|
-
*
|
|
2352
|
-
*
|
|
2353
|
-
*
|
|
2563
|
+
* "address": "0xD946246695A9259F3B33a78629026F61B3Ab40aF",
|
|
2564
|
+
* "name": "mempool"
|
|
2565
|
+
* },
|
|
2566
|
+
* {
|
|
2567
|
+
* "chain_id": 505050505,
|
|
2568
|
+
* "address": "0x8A409D5D6394fC197c596d4E6E2c35e5d13f8a4d",
|
|
2569
|
+
* "name": "multicall"
|
|
2570
|
+
* },
|
|
2571
|
+
* {
|
|
2572
|
+
* "chain_id": 505050505,
|
|
2573
|
+
* "address": "0x23DFBc4B8B80C14CC5e25011B8491f268395BAd6",
|
|
2574
|
+
* "name": "v2"
|
|
2354
2575
|
* }
|
|
2355
2576
|
* ]
|
|
2356
2577
|
*/
|
|
2357
|
-
data: components["schemas"]["
|
|
2578
|
+
data: components["schemas"]["ConfigContractResponse"][];
|
|
2579
|
+
};
|
|
2580
|
+
ConfigContractResponse: {
|
|
2581
|
+
/** @example 505050505 */chain_id: number; /** @example 0xD946246695A9259F3B33a78629026F61B3Ab40aF */
|
|
2582
|
+
address: string;
|
|
2583
|
+
/**
|
|
2584
|
+
* @example mempool
|
|
2585
|
+
* @enum {string}
|
|
2586
|
+
*/
|
|
2587
|
+
name: "mempool" | "multicall" | "v2";
|
|
2358
2588
|
};
|
|
2359
|
-
|
|
2360
|
-
/** @example
|
|
2361
|
-
|
|
2589
|
+
ConfigRulesSuccessResponse: {
|
|
2590
|
+
meta: components["schemas"]["ConfigRulesMeta"]; /** @example null */
|
|
2591
|
+
cursor: string | null;
|
|
2362
2592
|
/**
|
|
2363
|
-
* @description
|
|
2593
|
+
* @description Configured rules returned by the router API.
|
|
2364
2594
|
* @example [
|
|
2365
|
-
*
|
|
2595
|
+
* {
|
|
2596
|
+
* "type": "maturity",
|
|
2597
|
+
* "chain_id": 1,
|
|
2598
|
+
* "name": "end_of_next_month",
|
|
2599
|
+
* "timestamp": 1730415600
|
|
2600
|
+
* },
|
|
2601
|
+
* {
|
|
2602
|
+
* "type": "callback",
|
|
2603
|
+
* "chain_id": 1,
|
|
2604
|
+
* "address": "0x1111111111111111111111111111111111111111",
|
|
2605
|
+
* "callback_type": "sell_erc20_callback"
|
|
2606
|
+
* },
|
|
2607
|
+
* {
|
|
2608
|
+
* "type": "loan_token",
|
|
2609
|
+
* "chain_id": 1,
|
|
2610
|
+
* "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
|
|
2611
|
+
* },
|
|
2612
|
+
* {
|
|
2613
|
+
* "type": "oracle",
|
|
2614
|
+
* "chain_id": 1,
|
|
2615
|
+
* "address": "0xDddd770BADd886dF3864029e4B377B5F6a2B6b83"
|
|
2616
|
+
* }
|
|
2366
2617
|
* ]
|
|
2367
|
-
* @enum {string}
|
|
2368
2618
|
*/
|
|
2369
|
-
|
|
2619
|
+
data: components["schemas"]["ConfigRulesRuleResponse"][];
|
|
2620
|
+
};
|
|
2621
|
+
ConfigRulesMeta: {
|
|
2622
|
+
/** @example 2024-01-01T12:00:00.000Z */timestamp: string; /** @example f1d2d2f924e986ac86fdf7b36c94bcdf */
|
|
2623
|
+
checksum: string;
|
|
2370
2624
|
};
|
|
2371
|
-
|
|
2372
|
-
/** @example
|
|
2625
|
+
ConfigRulesRuleResponse: {
|
|
2626
|
+
/** @example maturity */type: string; /** @example 1 */
|
|
2627
|
+
chain_id: number; /** @example end_of_next_month */
|
|
2628
|
+
name?: string; /** @example 1730415600 */
|
|
2629
|
+
timestamp?: number; /** @example 0x1111111111111111111111111111111111111111 */
|
|
2630
|
+
address?: string; /** @example sell_erc20_callback */
|
|
2631
|
+
callback_type?: string;
|
|
2373
2632
|
};
|
|
2374
2633
|
OfferListResponse: {
|
|
2375
|
-
meta: components["schemas"]["Meta"];
|
|
2634
|
+
meta: components["schemas"]["Meta"];
|
|
2635
|
+
/**
|
|
2636
|
+
* @description Pagination cursor. Offer hash (0x...) for maker queries; base64url-encoded cursor for obligation queries.
|
|
2637
|
+
* @example eyJvZmZzZXQiOjEwMH0
|
|
2638
|
+
*/
|
|
2376
2639
|
cursor: string | null;
|
|
2377
2640
|
/**
|
|
2378
2641
|
* @description Offers matching the provided filters.
|
|
@@ -2711,6 +2974,84 @@ interface components {
|
|
|
2711
2974
|
*/
|
|
2712
2975
|
root: string;
|
|
2713
2976
|
};
|
|
2977
|
+
CallbackTypesRequest: {
|
|
2978
|
+
/**
|
|
2979
|
+
* @example [
|
|
2980
|
+
* {
|
|
2981
|
+
* "chain_id": 1,
|
|
2982
|
+
* "addresses": [
|
|
2983
|
+
* "0x1111111111111111111111111111111111111111",
|
|
2984
|
+
* "0x3333333333333333333333333333333333333333",
|
|
2985
|
+
* "0x9999999999999999999999999999999999999999"
|
|
2986
|
+
* ]
|
|
2987
|
+
* }
|
|
2988
|
+
* ]
|
|
2989
|
+
*/
|
|
2990
|
+
callbacks: components["schemas"]["CallbackTypesChainRequest"][];
|
|
2991
|
+
};
|
|
2992
|
+
CallbackTypesChainRequest: {
|
|
2993
|
+
/** @example 1 */chain_id: number;
|
|
2994
|
+
/**
|
|
2995
|
+
* @example [
|
|
2996
|
+
* "0x1111111111111111111111111111111111111111",
|
|
2997
|
+
* "0x3333333333333333333333333333333333333333",
|
|
2998
|
+
* "0x9999999999999999999999999999999999999999"
|
|
2999
|
+
* ]
|
|
3000
|
+
*/
|
|
3001
|
+
addresses: string[];
|
|
3002
|
+
};
|
|
3003
|
+
CallbackTypesSuccessResponse: {
|
|
3004
|
+
meta: components["schemas"]["Meta"]; /** @example maturity:1:1730415600:end_of_next_month */
|
|
3005
|
+
cursor: string | null;
|
|
3006
|
+
/**
|
|
3007
|
+
* @description Callback types grouped by chain.
|
|
3008
|
+
* @example [
|
|
3009
|
+
* {
|
|
3010
|
+
* "chain_id": 1,
|
|
3011
|
+
* "sell_erc20_callback": [
|
|
3012
|
+
* "0x1111111111111111111111111111111111111111"
|
|
3013
|
+
* ],
|
|
3014
|
+
* "buy_erc20": [
|
|
3015
|
+
* "0x5555555555555555555555555555555555555555"
|
|
3016
|
+
* ],
|
|
3017
|
+
* "buy_vault_v1_callback": [
|
|
3018
|
+
* "0x3333333333333333333333333333333333333333"
|
|
3019
|
+
* ],
|
|
3020
|
+
* "not_supported": [
|
|
3021
|
+
* "0x9999999999999999999999999999999999999999"
|
|
3022
|
+
* ]
|
|
3023
|
+
* }
|
|
3024
|
+
* ]
|
|
3025
|
+
*/
|
|
3026
|
+
data: components["schemas"]["CallbackTypesChainResponse"][];
|
|
3027
|
+
};
|
|
3028
|
+
CallbackTypesChainResponse: {
|
|
3029
|
+
/** @example 1 */chain_id: number;
|
|
3030
|
+
/**
|
|
3031
|
+
* @example [
|
|
3032
|
+
* "0x3333333333333333333333333333333333333333"
|
|
3033
|
+
* ]
|
|
3034
|
+
*/
|
|
3035
|
+
buy_vault_v1_callback?: string[];
|
|
3036
|
+
/**
|
|
3037
|
+
* @example [
|
|
3038
|
+
* "0x1111111111111111111111111111111111111111"
|
|
3039
|
+
* ]
|
|
3040
|
+
*/
|
|
3041
|
+
sell_erc20_callback?: string[];
|
|
3042
|
+
/**
|
|
3043
|
+
* @example [
|
|
3044
|
+
* "0x5555555555555555555555555555555555555555"
|
|
3045
|
+
* ]
|
|
3046
|
+
*/
|
|
3047
|
+
buy_erc20?: string[];
|
|
3048
|
+
/**
|
|
3049
|
+
* @example [
|
|
3050
|
+
* "0x9999999999999999999999999999999999999999"
|
|
3051
|
+
* ]
|
|
3052
|
+
*/
|
|
3053
|
+
not_supported: string[];
|
|
3054
|
+
};
|
|
2714
3055
|
};
|
|
2715
3056
|
responses: never;
|
|
2716
3057
|
parameters: never;
|
|
@@ -2772,45 +3113,6 @@ type Input = Readonly<{
|
|
|
2772
3113
|
*/
|
|
2773
3114
|
declare function from$2(input: Input): OfferResponse;
|
|
2774
3115
|
//#endregion
|
|
2775
|
-
//#region src/gatekeeper/types.d.ts
|
|
2776
|
-
type RuleInfo = {
|
|
2777
|
-
name: string;
|
|
2778
|
-
description: string;
|
|
2779
|
-
};
|
|
2780
|
-
type RulesProvider = {
|
|
2781
|
-
getRules: () => Promise<RuleInfo[]>;
|
|
2782
|
-
};
|
|
2783
|
-
type ValidationIssue = {
|
|
2784
|
-
index: number;
|
|
2785
|
-
rule: string;
|
|
2786
|
-
message: string;
|
|
2787
|
-
};
|
|
2788
|
-
type ValidateOffersSuccess = {
|
|
2789
|
-
payload: Hex;
|
|
2790
|
-
root: Hex;
|
|
2791
|
-
};
|
|
2792
|
-
type ValidateOffersIssues = {
|
|
2793
|
-
issues: ValidationIssue[];
|
|
2794
|
-
};
|
|
2795
|
-
type ValidateOffersData = ValidateOffersSuccess | ValidateOffersIssues;
|
|
2796
|
-
type SuccessPayload<T> = {
|
|
2797
|
-
meta: {
|
|
2798
|
-
timestamp: string;
|
|
2799
|
-
};
|
|
2800
|
-
cursor: string | null;
|
|
2801
|
-
data: T;
|
|
2802
|
-
};
|
|
2803
|
-
type ErrorPayload = {
|
|
2804
|
-
meta: {
|
|
2805
|
-
timestamp: string;
|
|
2806
|
-
};
|
|
2807
|
-
error: {
|
|
2808
|
-
code: string;
|
|
2809
|
-
message: string;
|
|
2810
|
-
details?: unknown;
|
|
2811
|
-
};
|
|
2812
|
-
};
|
|
2813
|
-
//#endregion
|
|
2814
3116
|
//#region src/api/Schema/openapi.d.ts
|
|
2815
3117
|
declare class BooksController {
|
|
2816
3118
|
getBook(): Promise<void>;
|
|
@@ -2818,6 +3120,9 @@ declare class BooksController {
|
|
|
2818
3120
|
declare class ValidateController {
|
|
2819
3121
|
validateOffers(): Promise<void>;
|
|
2820
3122
|
}
|
|
3123
|
+
declare class CallbacksController {
|
|
3124
|
+
resolveCallbackTypes(): Promise<void>;
|
|
3125
|
+
}
|
|
2821
3126
|
declare class OffersController {
|
|
2822
3127
|
getOffers(): Promise<void>;
|
|
2823
3128
|
}
|
|
@@ -2826,8 +3131,11 @@ declare class HealthController {
|
|
|
2826
3131
|
getCollectorsHealth(): Promise<void>;
|
|
2827
3132
|
getChainsHealth(): Promise<void>;
|
|
2828
3133
|
}
|
|
2829
|
-
declare class
|
|
2830
|
-
|
|
3134
|
+
declare class ConfigContractsController {
|
|
3135
|
+
getConfigContracts(): Promise<void>;
|
|
3136
|
+
}
|
|
3137
|
+
declare class ConfigRulesController {
|
|
3138
|
+
getConfigRules(): Promise<void>;
|
|
2831
3139
|
}
|
|
2832
3140
|
declare class ObligationsController {
|
|
2833
3141
|
getObligations(): Promise<void>;
|
|
@@ -2836,10 +3144,7 @@ declare class ObligationsController {
|
|
|
2836
3144
|
declare class UsersController {
|
|
2837
3145
|
getUserPositions(): Promise<void>;
|
|
2838
3146
|
}
|
|
2839
|
-
|
|
2840
|
-
rules?: RuleInfo[];
|
|
2841
|
-
};
|
|
2842
|
-
declare const OpenApi: (options?: OpenApiOptions) => Promise<OpenAPIDocument>;
|
|
3147
|
+
declare const OpenApi: () => Promise<OpenAPIDocument>;
|
|
2843
3148
|
//#endregion
|
|
2844
3149
|
//#region src/database/domains/Positions.d.ts
|
|
2845
3150
|
type PaginationParams = {
|
|
@@ -2906,16 +3211,44 @@ declare const schemas: {
|
|
|
2906
3211
|
false: "false";
|
|
2907
3212
|
}>, z$1.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
|
|
2908
3213
|
}, z$1.core.$strip>;
|
|
2909
|
-
readonly
|
|
3214
|
+
readonly get_config_contracts: z$1.ZodObject<{
|
|
3215
|
+
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
3216
|
+
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
3217
|
+
chains: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>>>>;
|
|
3218
|
+
}, z$1.core.$strip>;
|
|
3219
|
+
readonly get_config_rules: z$1.ZodObject<{
|
|
3220
|
+
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
3221
|
+
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
3222
|
+
types: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodEnum<{
|
|
3223
|
+
maturity: "maturity";
|
|
3224
|
+
callback: "callback";
|
|
3225
|
+
loan_token: "loan_token";
|
|
3226
|
+
oracle: "oracle";
|
|
3227
|
+
}>>>>;
|
|
3228
|
+
chains: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>>>>;
|
|
3229
|
+
}, z$1.core.$strip>;
|
|
3230
|
+
readonly get_offers: z$1.ZodPipe<z$1.ZodObject<{
|
|
3231
|
+
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
3232
|
+
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
2910
3233
|
side: z$1.ZodOptional<z$1.ZodEnum<{
|
|
2911
3234
|
buy: "buy";
|
|
2912
3235
|
sell: "sell";
|
|
2913
3236
|
}>>;
|
|
2914
3237
|
obligation_id: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
2915
3238
|
maker: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
2916
|
-
|
|
2917
|
-
limit:
|
|
2918
|
-
|
|
3239
|
+
}, z$1.core.$strip>, z$1.ZodTransform<{
|
|
3240
|
+
limit: number;
|
|
3241
|
+
cursor?: string | undefined;
|
|
3242
|
+
side?: "buy" | "sell" | undefined;
|
|
3243
|
+
obligation_id?: `0x${string}` | undefined;
|
|
3244
|
+
maker?: `0x${string}` | undefined;
|
|
3245
|
+
}, {
|
|
3246
|
+
limit: number;
|
|
3247
|
+
cursor?: string | undefined;
|
|
3248
|
+
side?: "buy" | "sell" | undefined;
|
|
3249
|
+
obligation_id?: `0x${string}` | undefined;
|
|
3250
|
+
maker?: `0x${string}` | undefined;
|
|
3251
|
+
}>>;
|
|
2919
3252
|
readonly get_obligations: z$1.ZodObject<{
|
|
2920
3253
|
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
2921
3254
|
chains: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>>>>;
|
|
@@ -2939,6 +3272,12 @@ declare const schemas: {
|
|
|
2939
3272
|
readonly validate_offers: z$1.ZodObject<{
|
|
2940
3273
|
offers: z$1.ZodArray<z$1.ZodUnknown>;
|
|
2941
3274
|
}, z$1.core.$strict>;
|
|
3275
|
+
readonly callback_types: z$1.ZodObject<{
|
|
3276
|
+
callbacks: z$1.ZodArray<z$1.ZodObject<{
|
|
3277
|
+
chain_id: z$1.ZodNumber;
|
|
3278
|
+
addresses: z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
3279
|
+
}, z$1.core.$strict>>;
|
|
3280
|
+
}, z$1.core.$strict>;
|
|
2942
3281
|
readonly get_user_positions: z$1.ZodObject<{
|
|
2943
3282
|
user_address: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
2944
3283
|
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
@@ -2949,7 +3288,7 @@ type Action = keyof typeof schemas;
|
|
|
2949
3288
|
declare function parse<A extends Action>(action: A, query: unknown): z$1.infer<(typeof schemas)[A]>;
|
|
2950
3289
|
declare function safeParse<A extends Action>(action: A, query: unknown, error?: z$1.core.$ZodErrorMap<z$1.core.$ZodIssue>): z$1.ZodSafeParseResult<z$1.infer<(typeof schemas)[A]>>;
|
|
2951
3290
|
declare namespace index_d_exports$1 {
|
|
2952
|
-
export { BookResponse_d_exports as BookResponse, BooksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse,
|
|
3291
|
+
export { BookResponse_d_exports as BookResponse, BooksController, CallbacksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse, ConfigContractsController, ConfigRulesController, HealthController, ObligationResponse_d_exports as ObligationResponse, ObligationsController, OfferResponse_d_exports as OfferResponse, OffersController, OpenApi, PositionResponse_d_exports as PositionResponse, RouterStatusResponse, UsersController, ValidateController, parse, safeParse };
|
|
2953
3292
|
}
|
|
2954
3293
|
declare namespace Client_d_exports$1 {
|
|
2955
3294
|
export { Client$2 as Client, ConnectOptions, HttpForbiddenError, HttpGetApiFailedError, HttpRateLimitError, HttpUnauthorizedError, InvalidUrlError, connect$1 as connect, getObligations, getOffers };
|
|
@@ -3147,21 +3486,95 @@ declare function run<T, Name extends string, Rules extends readonly Rule<T, Name
|
|
|
3147
3486
|
rules: Rules;
|
|
3148
3487
|
chunkSize?: number;
|
|
3149
3488
|
}): Promise<Result<T, RuleNames<Rules>>>;
|
|
3489
|
+
//#endregion
|
|
3490
|
+
//#region src/gatekeeper/types.d.ts
|
|
3491
|
+
type ConfigRule = {
|
|
3492
|
+
type: "maturity";
|
|
3493
|
+
chain_id: Id;
|
|
3494
|
+
name: MaturityType;
|
|
3495
|
+
timestamp: Maturity;
|
|
3496
|
+
} | {
|
|
3497
|
+
type: "callback";
|
|
3498
|
+
chain_id: Id;
|
|
3499
|
+
address: Address;
|
|
3500
|
+
callback_type: Exclude<Type$1, Type$1.BuyWithEmptyCallback>;
|
|
3501
|
+
} | {
|
|
3502
|
+
type: "loan_token";
|
|
3503
|
+
chain_id: Id;
|
|
3504
|
+
address: Address;
|
|
3505
|
+
} | {
|
|
3506
|
+
type: "oracle";
|
|
3507
|
+
chain_id: Id;
|
|
3508
|
+
address: Address;
|
|
3509
|
+
};
|
|
3510
|
+
type ValidationIssue = {
|
|
3511
|
+
index: number;
|
|
3512
|
+
rule: string;
|
|
3513
|
+
message: string;
|
|
3514
|
+
};
|
|
3515
|
+
type ValidateOffersSuccess = {
|
|
3516
|
+
payload: Hex;
|
|
3517
|
+
root: Hex;
|
|
3518
|
+
};
|
|
3519
|
+
type ValidateOffersIssues = {
|
|
3520
|
+
issues: ValidationIssue[];
|
|
3521
|
+
};
|
|
3522
|
+
type ValidateOffersData = ValidateOffersSuccess | ValidateOffersIssues;
|
|
3523
|
+
type CallbackType = Type$1 | "not_supported";
|
|
3524
|
+
type CallbackTypesRequest = {
|
|
3525
|
+
callbacks: Array<{
|
|
3526
|
+
chain_id: Id;
|
|
3527
|
+
addresses: Address[];
|
|
3528
|
+
}>;
|
|
3529
|
+
};
|
|
3530
|
+
type CallbackTypesResponse = Array<{
|
|
3531
|
+
chain_id: Id;
|
|
3532
|
+
} & Partial<Record<CallbackType, Address[]>>>;
|
|
3533
|
+
type ConfigRulesPayload = SuccessPayload<ConfigRule[]> | ErrorPayload;
|
|
3534
|
+
type SuccessPayload<T> = {
|
|
3535
|
+
meta: {
|
|
3536
|
+
timestamp: string;
|
|
3537
|
+
checksum?: string;
|
|
3538
|
+
};
|
|
3539
|
+
cursor: string | null;
|
|
3540
|
+
data: T;
|
|
3541
|
+
};
|
|
3542
|
+
type ErrorPayload = {
|
|
3543
|
+
meta: {
|
|
3544
|
+
timestamp: string;
|
|
3545
|
+
checksum?: string;
|
|
3546
|
+
};
|
|
3547
|
+
error: {
|
|
3548
|
+
code: string;
|
|
3549
|
+
message: string;
|
|
3550
|
+
details?: unknown;
|
|
3551
|
+
};
|
|
3552
|
+
};
|
|
3150
3553
|
declare namespace Client_d_exports {
|
|
3151
3554
|
export { ClientConfig, GatekeeperClient, createHttpClient };
|
|
3152
3555
|
}
|
|
3153
|
-
type GatekeeperClient =
|
|
3556
|
+
type GatekeeperClient = {
|
|
3154
3557
|
/** Validate offers and return the raw response payload. */validate: (body: unknown) => Promise<{
|
|
3155
3558
|
statusCode: number;
|
|
3156
3559
|
body: unknown;
|
|
3560
|
+
}>; /** Get configured rules for supported chains. */
|
|
3561
|
+
getConfigRules: (query?: {
|
|
3562
|
+
cursor?: string;
|
|
3563
|
+
limit?: number | string;
|
|
3564
|
+
types?: Array<ConfigRule["type"]> | ConfigRule["type"];
|
|
3565
|
+
}) => Promise<{
|
|
3566
|
+
statusCode: number;
|
|
3567
|
+
body: ConfigRulesPayload;
|
|
3157
3568
|
}>; /** Validate offers and return decision results. */
|
|
3158
|
-
isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>; /**
|
|
3569
|
+
isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>; /** Resolve callback types for callback addresses. */
|
|
3570
|
+
getCallbackTypes: (request: CallbackTypesRequest) => Promise<CallbackTypesResponse>; /** Base URL for the gatekeeper service. */
|
|
3159
3571
|
baseUrl: string;
|
|
3160
3572
|
};
|
|
3161
3573
|
type ClientConfig = {
|
|
3162
3574
|
baseUrl: string;
|
|
3163
3575
|
timeoutMs?: number;
|
|
3164
3576
|
fetchFn?: typeof fetch;
|
|
3577
|
+
originSecret?: string;
|
|
3165
3578
|
};
|
|
3166
3579
|
/**
|
|
3167
3580
|
* Create an HTTP client for a gatekeeper service.
|
|
@@ -3169,65 +3582,12 @@ type ClientConfig = {
|
|
|
3169
3582
|
* @returns An HTTP-backed gatekeeper client. {@link GatekeeperClient}
|
|
3170
3583
|
*/
|
|
3171
3584
|
declare function createHttpClient(config: ClientConfig): GatekeeperClient;
|
|
3172
|
-
declare namespace GateConfig_d_exports {
|
|
3173
|
-
export { CallbackConfig, GateConfig, assets, configs, getCallback, getCallbackAddresses, getCallbackType, getCallbackTypeAddresses };
|
|
3174
|
-
}
|
|
3175
|
-
type GateConfig = {
|
|
3176
|
-
callbacks?: CallbackConfig[];
|
|
3177
|
-
maturities?: MaturityType[];
|
|
3178
|
-
};
|
|
3179
|
-
type CallbackConfig = {
|
|
3180
|
-
type: Type$1.BuyVaultV1Callback;
|
|
3181
|
-
addresses: Address[];
|
|
3182
|
-
vaultFactories: Address[];
|
|
3183
|
-
} | {
|
|
3184
|
-
type: Type$1.SellERC20Callback;
|
|
3185
|
-
addresses: Address[];
|
|
3186
|
-
} | {
|
|
3187
|
-
type: Type$1.BuyWithEmptyCallback;
|
|
3188
|
-
};
|
|
3189
|
-
declare function getCallback(chain: Name, type: Type$1.BuyVaultV1Callback): Extract<CallbackConfig, {
|
|
3190
|
-
type: Type$1.BuyVaultV1Callback;
|
|
3191
|
-
}> | undefined;
|
|
3192
|
-
declare function getCallback(chain: Name, type: Type$1.SellERC20Callback): Extract<CallbackConfig, {
|
|
3193
|
-
type: Type$1.SellERC20Callback;
|
|
3194
|
-
}> | undefined;
|
|
3195
|
-
declare function getCallback(chain: Name, type: Type$1.BuyWithEmptyCallback): Extract<CallbackConfig, {
|
|
3196
|
-
type: Type$1.BuyWithEmptyCallback;
|
|
3197
|
-
}> | undefined;
|
|
3198
|
-
declare function getCallback(chain: Name, type: Type$1): CallbackConfig | undefined;
|
|
3199
|
-
/**
|
|
3200
|
-
* Attempts to infer the configured callback type from a callback address on a chain.
|
|
3201
|
-
* Skips the empty callback type as it does not carry addresses.
|
|
3202
|
-
*
|
|
3203
|
-
* @param chain - Chain name for which to infer the callback type
|
|
3204
|
-
* @param address - Callback contract address
|
|
3205
|
-
* @returns The callback type when found, otherwise undefined
|
|
3206
|
-
*/
|
|
3207
|
-
declare function getCallbackType(chain: Name, address: Address): Type$1.BuyWithEmptyCallback | Type$1.BuyVaultV1Callback | Type$1.SellERC20Callback | undefined;
|
|
3208
|
-
/**
|
|
3209
|
-
* Returns the callback addresses for a given chain and callback type, if it exists.
|
|
3210
|
-
* @param chain - Chain name for which to read the validation configuration
|
|
3211
|
-
* @param type - Callback type to retrieve
|
|
3212
|
-
* @returns The matching callback addresses or an empty array if not configured
|
|
3213
|
-
*/
|
|
3214
|
-
declare function getCallbackTypeAddresses(chain: Name, type: Type$1): Address[];
|
|
3215
|
-
/**
|
|
3216
|
-
* Returns the list of allowed non-empty callback addresses for a chain.
|
|
3217
|
-
*
|
|
3218
|
-
* @param chain - Chain name
|
|
3219
|
-
* @returns Array of allowed callback addresses (lowercased). Empty when none configured
|
|
3220
|
-
*/
|
|
3221
|
-
declare const getCallbackAddresses: (chain: Name) => Address[];
|
|
3222
|
-
declare const assets: Record<string, Address[]>;
|
|
3223
|
-
declare const configs: Record<Name, GateConfig>;
|
|
3224
3585
|
declare namespace Gatekeeper_d_exports {
|
|
3225
3586
|
export { Gatekeeper, Rules, create };
|
|
3226
3587
|
}
|
|
3227
3588
|
type Rules = readonly Rule<Offer, string>[];
|
|
3228
3589
|
type Gatekeeper = {
|
|
3229
3590
|
isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>;
|
|
3230
|
-
getRules: () => Promise<RuleInfo[]>;
|
|
3231
3591
|
};
|
|
3232
3592
|
type GatekeeperParameters = {
|
|
3233
3593
|
rules: Rules;
|
|
@@ -3240,9 +3600,9 @@ type GatekeeperParameters = {
|
|
|
3240
3600
|
declare function create(parameters: GatekeeperParameters): Gatekeeper;
|
|
3241
3601
|
//#endregion
|
|
3242
3602
|
//#region src/gatekeeper/morphoRules.d.ts
|
|
3243
|
-
declare const morphoRules: (chains: Chain$1[]) => (Rule<Offer, "mixed_maker"> | Rule<Offer, "amount_mutual_exclusivity"> | Rule<Offer, "chain_ids"> | Rule<Offer, "maturity"> | Rule<Offer, "callback"> | Rule<Offer, "token">)[];
|
|
3603
|
+
declare const morphoRules: (chains: Chain$1[]) => (Rule<Offer, "mixed_maker"> | Rule<Offer, "amount_mutual_exclusivity"> | Rule<Offer, "chain_ids"> | Rule<Offer, "maturity"> | Rule<Offer, "callback"> | Rule<Offer, "token"> | Rule<Offer, "oracle">)[];
|
|
3244
3604
|
declare namespace Rules_d_exports {
|
|
3245
|
-
export { ValidityParameters, amountMutualExclusivity, callback, chains, maturity, sameMaker, token, validity };
|
|
3605
|
+
export { ValidityParameters, amountMutualExclusivity, callback, chains, maturity, oracle, sameMaker, token, validity };
|
|
3246
3606
|
}
|
|
3247
3607
|
type ValidityParameters = {
|
|
3248
3608
|
client: PublicClient<Transport, Chain$1>;
|
|
@@ -3281,6 +3641,16 @@ declare const token: ({
|
|
|
3281
3641
|
}: {
|
|
3282
3642
|
assetsByChainId: Partial<Record<Id, Address[]>>;
|
|
3283
3643
|
}) => Rule<Offer, "token">;
|
|
3644
|
+
/**
|
|
3645
|
+
* A validation rule that checks if the offer's oracle addresses are allowed for its chain.
|
|
3646
|
+
* @param oraclesByChainId - Allowed oracles indexed by chain id.
|
|
3647
|
+
* @returns The issue that was found. If the offer is valid, this will be undefined.
|
|
3648
|
+
*/
|
|
3649
|
+
declare const oracle: ({
|
|
3650
|
+
oraclesByChainId
|
|
3651
|
+
}: {
|
|
3652
|
+
oraclesByChainId: Partial<Record<Id, Address[]>>;
|
|
3653
|
+
}) => Rule<Offer, "oracle">;
|
|
3284
3654
|
/**
|
|
3285
3655
|
* A batch validation rule that ensures all offers in a tree have the same maker address.
|
|
3286
3656
|
* Returns an issue only for the first non-conforming offer.
|
|
@@ -3299,7 +3669,8 @@ declare function from(parameters: from.Parameters): from.ReturnType;
|
|
|
3299
3669
|
declare namespace from {
|
|
3300
3670
|
type Parameters = {
|
|
3301
3671
|
/** The viem client to use. */client: WalletClient; /** The mempool address. */
|
|
3302
|
-
mempoolAddress: Address; /** The
|
|
3672
|
+
mempoolAddress: Address; /** The MorphoV2 contract address used for signature verification. */
|
|
3673
|
+
morphoAddress?: Address; /** The block window to use for the mempool. Defaults to 100. */
|
|
3303
3674
|
blockWindow?: number;
|
|
3304
3675
|
};
|
|
3305
3676
|
type ReturnType = Client$1;
|
|
@@ -3484,5 +3855,5 @@ declare namespace index_d_exports$2 {
|
|
|
3484
3855
|
export { BaseError, GlobalErrorType, Group_d_exports as Group, Random_d_exports as Random, ReorgError, Snake, time_d_exports as Time, atMostOneNonZero, batch, batchMulticall, fromSnakeCase$3 as fromSnakeCase, lazy, max$1 as max, min, poll, retry, stringifyBigint, toSnakeCase$1 as toSnakeCase, wait };
|
|
3485
3856
|
}
|
|
3486
3857
|
//#endregion
|
|
3487
|
-
export { index_d_exports as Abi, Brand, BrandTypeId, Callback_d_exports as Callback, Chain_d_exports as Chain, ChainRegistry_d_exports as ChainRegistry, Collateral_d_exports as Collateral, Compute, ERC4626_d_exports as ERC4626, ErrorPayload, Errors_d_exports as Errors, Format_d_exports as Format,
|
|
3858
|
+
export { index_d_exports as Abi, Brand, BrandTypeId, Callback_d_exports as Callback, CallbackType, CallbackTypesRequest, CallbackTypesResponse, Chain_d_exports as Chain, ChainRegistry_d_exports as ChainRegistry, Collateral_d_exports as Collateral, Compute, ConfigRule, ConfigRulesPayload, ERC4626_d_exports as ERC4626, ErrorPayload, Errors_d_exports as Errors, Format_d_exports as Format, Gatekeeper_d_exports as Gatekeeper, Client_d_exports as GatekeeperClient, 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$1 as RouterClient, Rules_d_exports as Rules, SuccessPayload, time_d_exports as Time, TradingFee_d_exports as TradingFee, Transfer_d_exports as Transfer, Tree_d_exports as Tree, index_d_exports$2 as Utils, ValidateOffersData, ValidateOffersIssues, ValidateOffersSuccess, Gate_d_exports as Validation, ValidationIssue, morphoRules };
|
|
3488
3859
|
//# sourceMappingURL=index.browser.d.ts.map
|