@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.mts
CHANGED
|
@@ -34,9 +34,9 @@ declare const CollectorHealth: z.ZodObject<{
|
|
|
34
34
|
updated_at: z.ZodNullable<z.ZodString>;
|
|
35
35
|
lag: z.ZodNullable<z.ZodNumber>;
|
|
36
36
|
status: z.ZodEnum<{
|
|
37
|
+
unknown: "unknown";
|
|
37
38
|
live: "live";
|
|
38
39
|
lagging: "lagging";
|
|
39
|
-
unknown: "unknown";
|
|
40
40
|
}>;
|
|
41
41
|
initialized: z.ZodBoolean;
|
|
42
42
|
}, z.core.$strip>;
|
|
@@ -47,9 +47,9 @@ declare const CollectorsHealthResponse: z.ZodArray<z.ZodObject<{
|
|
|
47
47
|
updated_at: z.ZodNullable<z.ZodString>;
|
|
48
48
|
lag: z.ZodNullable<z.ZodNumber>;
|
|
49
49
|
status: z.ZodEnum<{
|
|
50
|
+
unknown: "unknown";
|
|
50
51
|
live: "live";
|
|
51
52
|
lagging: "lagging";
|
|
52
|
-
unknown: "unknown";
|
|
53
53
|
}>;
|
|
54
54
|
initialized: z.ZodBoolean;
|
|
55
55
|
}, z.core.$strip>>;
|
|
@@ -891,7 +891,7 @@ declare function toSnakeCase$1<T>(obj: T): Snake<T>;
|
|
|
891
891
|
declare function fromSnakeCase$3<T>(obj: Snake<T>): T;
|
|
892
892
|
declare function stringifyBigint<T>(value: T): StringifiedBigint<T>;
|
|
893
893
|
declare namespace Obligation_d_exports {
|
|
894
|
-
export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$11 as from, fromSnakeCase$2 as fromSnakeCase, id, random$2 as random };
|
|
894
|
+
export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$11 as from, fromOffer$1 as fromOffer, fromSnakeCase$2 as fromSnakeCase, id, random$2 as random };
|
|
895
895
|
}
|
|
896
896
|
type Obligation = {
|
|
897
897
|
/** The chain id where the liquidity for this obligation is located. */chainId: Id; /** The token that is being borrowed for this obligation. */
|
|
@@ -999,6 +999,18 @@ declare function random$2(): random$2.ReturnType;
|
|
|
999
999
|
declare namespace random$2 {
|
|
1000
1000
|
type ReturnType = Obligation;
|
|
1001
1001
|
}
|
|
1002
|
+
/**
|
|
1003
|
+
* Creates an obligation from an offer.
|
|
1004
|
+
* @constructor
|
|
1005
|
+
*
|
|
1006
|
+
* @param offer - The offer to create the obligation from.
|
|
1007
|
+
* @returns The created obligation. {@link fromOffer.ReturnType}
|
|
1008
|
+
*/
|
|
1009
|
+
declare function fromOffer$1(offer: Offer): fromOffer$1.ReturnType;
|
|
1010
|
+
declare namespace fromOffer$1 {
|
|
1011
|
+
type Parameters = Offer;
|
|
1012
|
+
type ReturnType = Obligation;
|
|
1013
|
+
}
|
|
1002
1014
|
declare class InvalidObligationError extends BaseError<z$1.ZodError | Error> {
|
|
1003
1015
|
readonly name = "Obligation.InvalidObligationError";
|
|
1004
1016
|
constructor(error: z$1.ZodError | Error);
|
|
@@ -1008,7 +1020,7 @@ declare class CollateralsAreNotSortedError extends BaseError {
|
|
|
1008
1020
|
constructor();
|
|
1009
1021
|
}
|
|
1010
1022
|
declare namespace Offer_d_exports {
|
|
1011
|
-
export {
|
|
1023
|
+
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 };
|
|
1012
1024
|
}
|
|
1013
1025
|
type Offer = {
|
|
1014
1026
|
/** The address that made the offer. */readonly maker: Address; /** The amount of assets offered. Mutually exclusive with obligationUnits and obligationShares. */
|
|
@@ -1247,15 +1259,6 @@ declare const types: {
|
|
|
1247
1259
|
readonly type: "bytes";
|
|
1248
1260
|
}];
|
|
1249
1261
|
};
|
|
1250
|
-
/**
|
|
1251
|
-
* Signs an array of offers.
|
|
1252
|
-
* @throws {Error} If the wallet account is not set.
|
|
1253
|
-
* @param offers - The offers to sign.
|
|
1254
|
-
* @param wallet - The wallet to sign the offers with.
|
|
1255
|
-
* @returns The signed offers.
|
|
1256
|
-
*/
|
|
1257
|
-
declare function sign(offers: Offer[], wallet: WalletClient): Promise<Hex>;
|
|
1258
|
-
declare function signatureMsg(offers: Offer[]): Hex;
|
|
1259
1262
|
declare function hash(offer: Offer): Hex;
|
|
1260
1263
|
/**
|
|
1261
1264
|
* Calculates the obligation id for an offer based on the smart contract's Obligation struct.
|
|
@@ -1313,12 +1316,8 @@ declare class InvalidOfferError extends BaseError<z$1.ZodError | Error> {
|
|
|
1313
1316
|
*/
|
|
1314
1317
|
get formattedMessage(): string;
|
|
1315
1318
|
}
|
|
1316
|
-
declare class AccountNotSetError extends BaseError {
|
|
1317
|
-
readonly name = "Offer.AccountNotSetError";
|
|
1318
|
-
constructor();
|
|
1319
|
-
}
|
|
1320
1319
|
declare namespace Oracle_d_exports {
|
|
1321
|
-
export { Conversion, Oracle, from$9 as from };
|
|
1320
|
+
export { Conversion, Oracle, from$9 as from, fromCollateral, fromOffer, fromOffers };
|
|
1322
1321
|
}
|
|
1323
1322
|
/**
|
|
1324
1323
|
* An oracle contract that provides price information for assets.
|
|
@@ -1344,6 +1343,55 @@ declare namespace from$9 {
|
|
|
1344
1343
|
};
|
|
1345
1344
|
type ReturnType = Oracle;
|
|
1346
1345
|
}
|
|
1346
|
+
/**
|
|
1347
|
+
* Creates an oracle from a collateral.
|
|
1348
|
+
* @constructor
|
|
1349
|
+
*
|
|
1350
|
+
* @param parameters - {@link fromCollateral.Parameters}
|
|
1351
|
+
* @returns The created oracle. {@link fromCollateral.ReturnType}
|
|
1352
|
+
*/
|
|
1353
|
+
declare function fromCollateral(parameters: fromCollateral.Parameters): fromCollateral.ReturnType;
|
|
1354
|
+
declare namespace fromCollateral {
|
|
1355
|
+
type Parameters = {
|
|
1356
|
+
chainId: Id;
|
|
1357
|
+
collateral: Collateral;
|
|
1358
|
+
blockNumber: number;
|
|
1359
|
+
price?: bigint | null;
|
|
1360
|
+
};
|
|
1361
|
+
type ReturnType = Oracle;
|
|
1362
|
+
}
|
|
1363
|
+
/**
|
|
1364
|
+
* Creates oracles from a single offer.
|
|
1365
|
+
* @constructor
|
|
1366
|
+
*
|
|
1367
|
+
* @param parameters - {@link fromOffer.Parameters}
|
|
1368
|
+
* @returns The created oracles. {@link fromOffer.ReturnType}
|
|
1369
|
+
*/
|
|
1370
|
+
declare function fromOffer(parameters: fromOffer.Parameters): fromOffer.ReturnType;
|
|
1371
|
+
declare namespace fromOffer {
|
|
1372
|
+
type Parameters = {
|
|
1373
|
+
offer: Offer;
|
|
1374
|
+
blockNumber: number;
|
|
1375
|
+
price?: bigint | null;
|
|
1376
|
+
};
|
|
1377
|
+
type ReturnType = Oracle[];
|
|
1378
|
+
}
|
|
1379
|
+
/**
|
|
1380
|
+
* Creates oracles from a list of offers.
|
|
1381
|
+
* @constructor
|
|
1382
|
+
*
|
|
1383
|
+
* @param parameters - {@link fromOffers.Parameters}
|
|
1384
|
+
* @returns The created oracles. {@link fromOffers.ReturnType}
|
|
1385
|
+
*/
|
|
1386
|
+
declare function fromOffers(parameters: fromOffers.Parameters): fromOffers.ReturnType;
|
|
1387
|
+
declare namespace fromOffers {
|
|
1388
|
+
type Parameters = {
|
|
1389
|
+
offers: Offer[];
|
|
1390
|
+
blockNumber: number;
|
|
1391
|
+
price?: bigint | null;
|
|
1392
|
+
};
|
|
1393
|
+
type ReturnType = Oracle[];
|
|
1394
|
+
}
|
|
1347
1395
|
/**
|
|
1348
1396
|
* Conversion utilities for converting between collateral and loan token amounts
|
|
1349
1397
|
* using oracle prices and LLTV
|
|
@@ -1599,7 +1647,7 @@ declare namespace from$5 {
|
|
|
1599
1647
|
type ReturnType = Transfer;
|
|
1600
1648
|
}
|
|
1601
1649
|
declare namespace Tree_d_exports {
|
|
1602
|
-
export { DecodeError, EncodeError, Proof, Tree, TreeError, VERSION, decode, encode, encodeUnsigned, from$4 as from, proofs };
|
|
1650
|
+
export { DecodeError, EncodeError, NormalizedSignatureDomain, Proof, SignatureDomain, SignatureDomainError, Tree, TreeError, VERSION, decode, encode, encodeUnsigned, from$4 as from, proofs, signatureDomain, signatureTypes };
|
|
1603
1651
|
}
|
|
1604
1652
|
/**
|
|
1605
1653
|
* A merkle tree of offers built from offer hashes.
|
|
@@ -1614,6 +1662,31 @@ type Proof = {
|
|
|
1614
1662
|
path: Hex[];
|
|
1615
1663
|
};
|
|
1616
1664
|
declare const VERSION = 1;
|
|
1665
|
+
type SignatureDomain = {
|
|
1666
|
+
/** Chain id used in the EIP-712 domain. */chainId: number | bigint; /** MorphoV2 contract address used as verifying contract. */
|
|
1667
|
+
verifyingContract: Address;
|
|
1668
|
+
};
|
|
1669
|
+
/** Normalized Root signature domain (BigInt chain id, lowercase address). */
|
|
1670
|
+
type NormalizedSignatureDomain = {
|
|
1671
|
+
chainId: bigint;
|
|
1672
|
+
verifyingContract: Address;
|
|
1673
|
+
};
|
|
1674
|
+
/**
|
|
1675
|
+
* EIP-712 types for signing the tree root (Root(bytes32 root)).
|
|
1676
|
+
*/
|
|
1677
|
+
declare const signatureTypes: {
|
|
1678
|
+
readonly EIP712Domain: readonly [{
|
|
1679
|
+
readonly name: "chainId";
|
|
1680
|
+
readonly type: "uint256";
|
|
1681
|
+
}, {
|
|
1682
|
+
readonly name: "verifyingContract";
|
|
1683
|
+
readonly type: "address";
|
|
1684
|
+
}];
|
|
1685
|
+
readonly Root: readonly [{
|
|
1686
|
+
readonly name: "root";
|
|
1687
|
+
readonly type: "bytes32";
|
|
1688
|
+
}];
|
|
1689
|
+
};
|
|
1617
1690
|
/**
|
|
1618
1691
|
* Builds a Merkle tree from a list of offers.
|
|
1619
1692
|
*
|
|
@@ -1636,6 +1709,11 @@ declare const from$4: (offers: Offer[]) => Tree;
|
|
|
1636
1709
|
* @returns Array of proofs - {@link Proof}
|
|
1637
1710
|
*/
|
|
1638
1711
|
declare const proofs: (tree: Tree) => Proof[];
|
|
1712
|
+
/**
|
|
1713
|
+
* Normalizes a Root signature domain (BigInt chain id, lowercase address).
|
|
1714
|
+
* @throws {SignatureDomainError} When the domain is invalid.
|
|
1715
|
+
*/
|
|
1716
|
+
declare const signatureDomain: (domain: SignatureDomain) => NormalizedSignatureDomain;
|
|
1639
1717
|
/**
|
|
1640
1718
|
* Encodes a merkle tree with signature into hex calldata for onchain broadcast.
|
|
1641
1719
|
*
|
|
@@ -1643,15 +1721,21 @@ declare const proofs: (tree: Tree) => Proof[];
|
|
|
1643
1721
|
* - `{vv}`: 1-byte version (currently 0x01)
|
|
1644
1722
|
* - `{gzip([...offers])}`: gzipped JSON array of serialized offers
|
|
1645
1723
|
* - `{root}`: 32-byte merkle root
|
|
1646
|
-
* - `{signature}`: 65-byte EIP-
|
|
1724
|
+
* - `{signature}`: 65-byte EIP-712 signature over Root(bytes32 root)
|
|
1647
1725
|
*
|
|
1648
1726
|
* Validates signature authenticity and root integrity before encoding.
|
|
1649
1727
|
*
|
|
1650
1728
|
* @example
|
|
1651
1729
|
* ```typescript
|
|
1652
1730
|
* const tree = Tree.from(offers);
|
|
1653
|
-
* const signature = await wallet.
|
|
1654
|
-
*
|
|
1731
|
+
* const signature = await wallet.signTypedData({
|
|
1732
|
+
* account: wallet.account,
|
|
1733
|
+
* domain: Tree.signatureDomain({ chainId, verifyingContract }),
|
|
1734
|
+
* types: Tree.signatureTypes,
|
|
1735
|
+
* primaryType: "Root",
|
|
1736
|
+
* message: { root: tree.root },
|
|
1737
|
+
* });
|
|
1738
|
+
* const calldata = await Tree.encode(tree, signature, { chainId, verifyingContract });
|
|
1655
1739
|
* await broadcast(calldata);
|
|
1656
1740
|
* ```
|
|
1657
1741
|
*
|
|
@@ -1661,16 +1745,23 @@ declare const proofs: (tree: Tree) => Proof[];
|
|
|
1661
1745
|
* const tree = Tree.from(offers);
|
|
1662
1746
|
* const compressed = gzip(JSON.stringify(tree.offers.map(Offer.serialize)));
|
|
1663
1747
|
* const partial = `0x01${bytesToHex(compressed)}${tree.root.slice(2)}`;
|
|
1664
|
-
* const signature = await wallet.
|
|
1748
|
+
* const signature = await wallet.signTypedData({
|
|
1749
|
+
* account: wallet.account,
|
|
1750
|
+
* domain: Tree.signatureDomain({ chainId, verifyingContract }),
|
|
1751
|
+
* types: Tree.signatureTypes,
|
|
1752
|
+
* primaryType: "Root",
|
|
1753
|
+
* message: { root: tree.root },
|
|
1754
|
+
* });
|
|
1665
1755
|
* const calldata = `${partial}${signature.slice(2)}`;
|
|
1666
1756
|
* ```
|
|
1667
1757
|
*
|
|
1668
1758
|
* @param tree - Merkle tree of offers
|
|
1669
|
-
* @param signature - EIP-
|
|
1759
|
+
* @param signature - EIP-712 signature over Root(bytes32 root)
|
|
1760
|
+
* @param domain - EIP-712 domain with chain id and verifying contract
|
|
1670
1761
|
* @returns Hex-encoded calldata ready for onchain broadcast
|
|
1671
1762
|
* @throws {EncodeError} If signature verification fails or root mismatch
|
|
1672
1763
|
*/
|
|
1673
|
-
declare const encode: (tree: Tree, signature: Hex) => Promise<Hex>;
|
|
1764
|
+
declare const encode: (tree: Tree, signature: Hex, domain: SignatureDomain) => Promise<Hex>;
|
|
1674
1765
|
/**
|
|
1675
1766
|
* Encodes a merkle tree without a signature into hex payload for client-side signing.
|
|
1676
1767
|
*
|
|
@@ -1700,15 +1791,16 @@ declare const encodeUnsigned: (tree: Tree) => Hex;
|
|
|
1700
1791
|
*
|
|
1701
1792
|
* @example
|
|
1702
1793
|
* ```typescript
|
|
1703
|
-
* const { tree, signature, signer } = await Tree.decode(calldata);
|
|
1794
|
+
* const { tree, signature, signer } = await Tree.decode(calldata, { chainId, verifyingContract });
|
|
1704
1795
|
* console.log(`Tree signed by ${signer} with ${tree.offers.length} offers`);
|
|
1705
1796
|
* ```
|
|
1706
1797
|
*
|
|
1707
1798
|
* @param encoded - Hex calldata in format `0x{vv}{gzip}{root}{signature}`
|
|
1799
|
+
* @param domain - EIP-712 domain with chain id and verifying contract
|
|
1708
1800
|
* @returns Validated tree, signature, and recovered signer address
|
|
1709
1801
|
* @throws {DecodeError} If version invalid, signature invalid, or root mismatch
|
|
1710
1802
|
*/
|
|
1711
|
-
declare const decode: (encoded: Hex) => Promise<{
|
|
1803
|
+
declare const decode: (encoded: Hex, domain: SignatureDomain) => Promise<{
|
|
1712
1804
|
tree: Tree;
|
|
1713
1805
|
signature: Hex;
|
|
1714
1806
|
signer: Address;
|
|
@@ -1737,6 +1829,13 @@ declare class DecodeError extends BaseError {
|
|
|
1737
1829
|
name: string;
|
|
1738
1830
|
constructor(reason: string);
|
|
1739
1831
|
}
|
|
1832
|
+
/**
|
|
1833
|
+
* Error thrown when an invalid signature domain is supplied.
|
|
1834
|
+
*/
|
|
1835
|
+
declare class SignatureDomainError extends BaseError {
|
|
1836
|
+
name: string;
|
|
1837
|
+
constructor(reason: string);
|
|
1838
|
+
}
|
|
1740
1839
|
//#endregion
|
|
1741
1840
|
//#region src/api/Schema/generated/swagger.d.ts
|
|
1742
1841
|
/**
|
|
@@ -1812,7 +1911,7 @@ interface paths {
|
|
|
1812
1911
|
patch?: never;
|
|
1813
1912
|
trace?: never;
|
|
1814
1913
|
};
|
|
1815
|
-
"/v1/config": {
|
|
1914
|
+
"/v1/config/contracts": {
|
|
1816
1915
|
parameters: {
|
|
1817
1916
|
query?: never;
|
|
1818
1917
|
header?: never;
|
|
@@ -1820,12 +1919,87 @@ interface paths {
|
|
|
1820
1919
|
cookie?: never;
|
|
1821
1920
|
};
|
|
1822
1921
|
/**
|
|
1823
|
-
* Get
|
|
1824
|
-
* @description Returns
|
|
1922
|
+
* Get indexer contract configuration
|
|
1923
|
+
* @description Returns contract addresses used by indexers (mempool, v2) and multicall for indexed chains.
|
|
1825
1924
|
*/
|
|
1826
1925
|
get: {
|
|
1827
1926
|
parameters: {
|
|
1828
|
-
query?:
|
|
1927
|
+
query?: {
|
|
1928
|
+
/**
|
|
1929
|
+
* @description Filter by chain IDs (comma-separated).
|
|
1930
|
+
* @example 1,8453
|
|
1931
|
+
*/
|
|
1932
|
+
chains?: number[];
|
|
1933
|
+
/**
|
|
1934
|
+
* @description Maximum number of contracts to return (max 1000).
|
|
1935
|
+
* @example 1000
|
|
1936
|
+
*/
|
|
1937
|
+
limit?: number;
|
|
1938
|
+
/**
|
|
1939
|
+
* @description Pagination cursor in chain_id:address format (lowercase address).
|
|
1940
|
+
* @example 505050505:0xd946246695a9259f3b33a78629026f61b3ab40af
|
|
1941
|
+
*/
|
|
1942
|
+
cursor?: string;
|
|
1943
|
+
};
|
|
1944
|
+
header?: never;
|
|
1945
|
+
path?: never;
|
|
1946
|
+
cookie?: never;
|
|
1947
|
+
};
|
|
1948
|
+
requestBody?: never;
|
|
1949
|
+
responses: {
|
|
1950
|
+
/** @description Success */200: {
|
|
1951
|
+
headers: {
|
|
1952
|
+
[name: string]: unknown;
|
|
1953
|
+
};
|
|
1954
|
+
content: {
|
|
1955
|
+
"application/json": components["schemas"]["ConfigContractsSuccessResponse"];
|
|
1956
|
+
};
|
|
1957
|
+
};
|
|
1958
|
+
};
|
|
1959
|
+
};
|
|
1960
|
+
put?: never;
|
|
1961
|
+
post?: never;
|
|
1962
|
+
delete?: never;
|
|
1963
|
+
options?: never;
|
|
1964
|
+
head?: never;
|
|
1965
|
+
patch?: never;
|
|
1966
|
+
trace?: never;
|
|
1967
|
+
};
|
|
1968
|
+
"/v1/config/rules": {
|
|
1969
|
+
parameters: {
|
|
1970
|
+
query?: never;
|
|
1971
|
+
header?: never;
|
|
1972
|
+
path?: never;
|
|
1973
|
+
cookie?: never;
|
|
1974
|
+
};
|
|
1975
|
+
/**
|
|
1976
|
+
* Get config rules
|
|
1977
|
+
* @description Returns configured rules for supported chains.
|
|
1978
|
+
*/
|
|
1979
|
+
get: {
|
|
1980
|
+
parameters: {
|
|
1981
|
+
query?: {
|
|
1982
|
+
/**
|
|
1983
|
+
* @description Filter by chain IDs (comma-separated).
|
|
1984
|
+
* @example 1,8453
|
|
1985
|
+
*/
|
|
1986
|
+
chains?: number[];
|
|
1987
|
+
/**
|
|
1988
|
+
* @description Filter by rule types (comma-separated).
|
|
1989
|
+
* @example maturity,loan_token,oracle
|
|
1990
|
+
*/
|
|
1991
|
+
types?: string[];
|
|
1992
|
+
/**
|
|
1993
|
+
* @description Maximum number of rules to return (max 1000).
|
|
1994
|
+
* @example 100
|
|
1995
|
+
*/
|
|
1996
|
+
limit?: number;
|
|
1997
|
+
/**
|
|
1998
|
+
* @description Pagination cursor in type:chain_id:<value> format.
|
|
1999
|
+
* @example maturity:1:1730415600:end_of_next_month
|
|
2000
|
+
*/
|
|
2001
|
+
cursor?: string;
|
|
2002
|
+
};
|
|
1829
2003
|
header?: never;
|
|
1830
2004
|
path?: never;
|
|
1831
2005
|
cookie?: never;
|
|
@@ -1837,7 +2011,7 @@ interface paths {
|
|
|
1837
2011
|
[name: string]: unknown;
|
|
1838
2012
|
};
|
|
1839
2013
|
content: {
|
|
1840
|
-
"application/json": components["schemas"]["
|
|
2014
|
+
"application/json": components["schemas"]["ConfigRulesSuccessResponse"];
|
|
1841
2015
|
};
|
|
1842
2016
|
};
|
|
1843
2017
|
};
|
|
@@ -2258,15 +2432,6 @@ interface paths {
|
|
|
2258
2432
|
/**
|
|
2259
2433
|
* Validate offers
|
|
2260
2434
|
* @description Validates offers against router validation rules. Returns unsigned payload + root on success, or issues only on validation failure.
|
|
2261
|
-
*
|
|
2262
|
-
* **Available validation rules:**
|
|
2263
|
-
* - **parse_error**: Returns when an offer fails to parse due to invalid format or missing required fields
|
|
2264
|
-
* - **mixed_maker**: Validates that all offers in a batch have the same maker address
|
|
2265
|
-
* - **amount_mutual_exclusivity**: Validates that at most one of (assets, obligationUnits, obligationShares) is non-zero
|
|
2266
|
-
* - **chain_ids**: Validates that offer chain is one of: [109111114]
|
|
2267
|
-
* - **maturity**: Validates that offer maturity is one of: [end_of_month, end_of_next_month]
|
|
2268
|
-
* - **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]
|
|
2269
|
-
* - **token**: Validates that offer loan token and collateral tokens are in the allowed assets list for the offer chain
|
|
2270
2435
|
*/
|
|
2271
2436
|
post: {
|
|
2272
2437
|
parameters: {
|
|
@@ -2305,6 +2470,56 @@ interface paths {
|
|
|
2305
2470
|
patch?: never;
|
|
2306
2471
|
trace?: never;
|
|
2307
2472
|
};
|
|
2473
|
+
"/v1/callbacks": {
|
|
2474
|
+
parameters: {
|
|
2475
|
+
query?: never;
|
|
2476
|
+
header?: never;
|
|
2477
|
+
path?: never;
|
|
2478
|
+
cookie?: never;
|
|
2479
|
+
};
|
|
2480
|
+
get?: never;
|
|
2481
|
+
put?: never;
|
|
2482
|
+
/**
|
|
2483
|
+
* Resolve callback types
|
|
2484
|
+
* @description Returns callback types for callback addresses grouped by chain.
|
|
2485
|
+
*/
|
|
2486
|
+
post: {
|
|
2487
|
+
parameters: {
|
|
2488
|
+
query?: never;
|
|
2489
|
+
header?: never;
|
|
2490
|
+
path?: never;
|
|
2491
|
+
cookie?: never;
|
|
2492
|
+
};
|
|
2493
|
+
requestBody?: {
|
|
2494
|
+
content: {
|
|
2495
|
+
"application/json": components["schemas"]["CallbackTypesRequest"];
|
|
2496
|
+
};
|
|
2497
|
+
};
|
|
2498
|
+
responses: {
|
|
2499
|
+
/** @description Success */200: {
|
|
2500
|
+
headers: {
|
|
2501
|
+
[name: string]: unknown;
|
|
2502
|
+
};
|
|
2503
|
+
content: {
|
|
2504
|
+
"application/json": components["schemas"]["CallbackTypesSuccessResponse"];
|
|
2505
|
+
};
|
|
2506
|
+
}; /** @description Bad Request */
|
|
2507
|
+
400: {
|
|
2508
|
+
headers: {
|
|
2509
|
+
[name: string]: unknown;
|
|
2510
|
+
};
|
|
2511
|
+
content: {
|
|
2512
|
+
"application/json": components["schemas"]["BadRequestResponse"];
|
|
2513
|
+
};
|
|
2514
|
+
};
|
|
2515
|
+
};
|
|
2516
|
+
};
|
|
2517
|
+
delete?: never;
|
|
2518
|
+
options?: never;
|
|
2519
|
+
head?: never;
|
|
2520
|
+
patch?: never;
|
|
2521
|
+
trace?: never;
|
|
2522
|
+
};
|
|
2308
2523
|
}
|
|
2309
2524
|
interface components {
|
|
2310
2525
|
schemas: {
|
|
@@ -2342,42 +2557,90 @@ interface components {
|
|
|
2342
2557
|
*/
|
|
2343
2558
|
details: Record<string, never>;
|
|
2344
2559
|
};
|
|
2345
|
-
|
|
2560
|
+
ConfigContractsSuccessResponse: {
|
|
2346
2561
|
meta: components["schemas"]["Meta"]; /** @example null */
|
|
2347
2562
|
cursor: string | null;
|
|
2348
2563
|
/**
|
|
2349
|
-
* @description
|
|
2564
|
+
* @description Indexer contract configuration for all indexed chains.
|
|
2350
2565
|
* @example [
|
|
2351
2566
|
* {
|
|
2352
2567
|
* "chain_id": 505050505,
|
|
2353
|
-
* "
|
|
2354
|
-
*
|
|
2355
|
-
*
|
|
2356
|
-
*
|
|
2357
|
-
*
|
|
2358
|
-
*
|
|
2568
|
+
* "address": "0xD946246695A9259F3B33a78629026F61B3Ab40aF",
|
|
2569
|
+
* "name": "mempool"
|
|
2570
|
+
* },
|
|
2571
|
+
* {
|
|
2572
|
+
* "chain_id": 505050505,
|
|
2573
|
+
* "address": "0x8A409D5D6394fC197c596d4E6E2c35e5d13f8a4d",
|
|
2574
|
+
* "name": "multicall"
|
|
2575
|
+
* },
|
|
2576
|
+
* {
|
|
2577
|
+
* "chain_id": 505050505,
|
|
2578
|
+
* "address": "0x23DFBc4B8B80C14CC5e25011B8491f268395BAd6",
|
|
2579
|
+
* "name": "v2"
|
|
2359
2580
|
* }
|
|
2360
2581
|
* ]
|
|
2361
2582
|
*/
|
|
2362
|
-
data: components["schemas"]["
|
|
2583
|
+
data: components["schemas"]["ConfigContractResponse"][];
|
|
2584
|
+
};
|
|
2585
|
+
ConfigContractResponse: {
|
|
2586
|
+
/** @example 505050505 */chain_id: number; /** @example 0xD946246695A9259F3B33a78629026F61B3Ab40aF */
|
|
2587
|
+
address: string;
|
|
2588
|
+
/**
|
|
2589
|
+
* @example mempool
|
|
2590
|
+
* @enum {string}
|
|
2591
|
+
*/
|
|
2592
|
+
name: "mempool" | "multicall" | "v2";
|
|
2363
2593
|
};
|
|
2364
|
-
|
|
2365
|
-
/** @example
|
|
2366
|
-
|
|
2594
|
+
ConfigRulesSuccessResponse: {
|
|
2595
|
+
meta: components["schemas"]["ConfigRulesMeta"]; /** @example null */
|
|
2596
|
+
cursor: string | null;
|
|
2367
2597
|
/**
|
|
2368
|
-
* @description
|
|
2598
|
+
* @description Configured rules returned by the router API.
|
|
2369
2599
|
* @example [
|
|
2370
|
-
*
|
|
2600
|
+
* {
|
|
2601
|
+
* "type": "maturity",
|
|
2602
|
+
* "chain_id": 1,
|
|
2603
|
+
* "name": "end_of_next_month",
|
|
2604
|
+
* "timestamp": 1730415600
|
|
2605
|
+
* },
|
|
2606
|
+
* {
|
|
2607
|
+
* "type": "callback",
|
|
2608
|
+
* "chain_id": 1,
|
|
2609
|
+
* "address": "0x1111111111111111111111111111111111111111",
|
|
2610
|
+
* "callback_type": "sell_erc20_callback"
|
|
2611
|
+
* },
|
|
2612
|
+
* {
|
|
2613
|
+
* "type": "loan_token",
|
|
2614
|
+
* "chain_id": 1,
|
|
2615
|
+
* "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
|
|
2616
|
+
* },
|
|
2617
|
+
* {
|
|
2618
|
+
* "type": "oracle",
|
|
2619
|
+
* "chain_id": 1,
|
|
2620
|
+
* "address": "0xDddd770BADd886dF3864029e4B377B5F6a2B6b83"
|
|
2621
|
+
* }
|
|
2371
2622
|
* ]
|
|
2372
|
-
* @enum {string}
|
|
2373
2623
|
*/
|
|
2374
|
-
|
|
2624
|
+
data: components["schemas"]["ConfigRulesRuleResponse"][];
|
|
2625
|
+
};
|
|
2626
|
+
ConfigRulesMeta: {
|
|
2627
|
+
/** @example 2024-01-01T12:00:00.000Z */timestamp: string; /** @example f1d2d2f924e986ac86fdf7b36c94bcdf */
|
|
2628
|
+
checksum: string;
|
|
2375
2629
|
};
|
|
2376
|
-
|
|
2377
|
-
/** @example
|
|
2630
|
+
ConfigRulesRuleResponse: {
|
|
2631
|
+
/** @example maturity */type: string; /** @example 1 */
|
|
2632
|
+
chain_id: number; /** @example end_of_next_month */
|
|
2633
|
+
name?: string; /** @example 1730415600 */
|
|
2634
|
+
timestamp?: number; /** @example 0x1111111111111111111111111111111111111111 */
|
|
2635
|
+
address?: string; /** @example sell_erc20_callback */
|
|
2636
|
+
callback_type?: string;
|
|
2378
2637
|
};
|
|
2379
2638
|
OfferListResponse: {
|
|
2380
|
-
meta: components["schemas"]["Meta"];
|
|
2639
|
+
meta: components["schemas"]["Meta"];
|
|
2640
|
+
/**
|
|
2641
|
+
* @description Pagination cursor. Offer hash (0x...) for maker queries; base64url-encoded cursor for obligation queries.
|
|
2642
|
+
* @example eyJvZmZzZXQiOjEwMH0
|
|
2643
|
+
*/
|
|
2381
2644
|
cursor: string | null;
|
|
2382
2645
|
/**
|
|
2383
2646
|
* @description Offers matching the provided filters.
|
|
@@ -2716,6 +2979,84 @@ interface components {
|
|
|
2716
2979
|
*/
|
|
2717
2980
|
root: string;
|
|
2718
2981
|
};
|
|
2982
|
+
CallbackTypesRequest: {
|
|
2983
|
+
/**
|
|
2984
|
+
* @example [
|
|
2985
|
+
* {
|
|
2986
|
+
* "chain_id": 1,
|
|
2987
|
+
* "addresses": [
|
|
2988
|
+
* "0x1111111111111111111111111111111111111111",
|
|
2989
|
+
* "0x3333333333333333333333333333333333333333",
|
|
2990
|
+
* "0x9999999999999999999999999999999999999999"
|
|
2991
|
+
* ]
|
|
2992
|
+
* }
|
|
2993
|
+
* ]
|
|
2994
|
+
*/
|
|
2995
|
+
callbacks: components["schemas"]["CallbackTypesChainRequest"][];
|
|
2996
|
+
};
|
|
2997
|
+
CallbackTypesChainRequest: {
|
|
2998
|
+
/** @example 1 */chain_id: number;
|
|
2999
|
+
/**
|
|
3000
|
+
* @example [
|
|
3001
|
+
* "0x1111111111111111111111111111111111111111",
|
|
3002
|
+
* "0x3333333333333333333333333333333333333333",
|
|
3003
|
+
* "0x9999999999999999999999999999999999999999"
|
|
3004
|
+
* ]
|
|
3005
|
+
*/
|
|
3006
|
+
addresses: string[];
|
|
3007
|
+
};
|
|
3008
|
+
CallbackTypesSuccessResponse: {
|
|
3009
|
+
meta: components["schemas"]["Meta"]; /** @example maturity:1:1730415600:end_of_next_month */
|
|
3010
|
+
cursor: string | null;
|
|
3011
|
+
/**
|
|
3012
|
+
* @description Callback types grouped by chain.
|
|
3013
|
+
* @example [
|
|
3014
|
+
* {
|
|
3015
|
+
* "chain_id": 1,
|
|
3016
|
+
* "sell_erc20_callback": [
|
|
3017
|
+
* "0x1111111111111111111111111111111111111111"
|
|
3018
|
+
* ],
|
|
3019
|
+
* "buy_erc20": [
|
|
3020
|
+
* "0x5555555555555555555555555555555555555555"
|
|
3021
|
+
* ],
|
|
3022
|
+
* "buy_vault_v1_callback": [
|
|
3023
|
+
* "0x3333333333333333333333333333333333333333"
|
|
3024
|
+
* ],
|
|
3025
|
+
* "not_supported": [
|
|
3026
|
+
* "0x9999999999999999999999999999999999999999"
|
|
3027
|
+
* ]
|
|
3028
|
+
* }
|
|
3029
|
+
* ]
|
|
3030
|
+
*/
|
|
3031
|
+
data: components["schemas"]["CallbackTypesChainResponse"][];
|
|
3032
|
+
};
|
|
3033
|
+
CallbackTypesChainResponse: {
|
|
3034
|
+
/** @example 1 */chain_id: number;
|
|
3035
|
+
/**
|
|
3036
|
+
* @example [
|
|
3037
|
+
* "0x3333333333333333333333333333333333333333"
|
|
3038
|
+
* ]
|
|
3039
|
+
*/
|
|
3040
|
+
buy_vault_v1_callback?: string[];
|
|
3041
|
+
/**
|
|
3042
|
+
* @example [
|
|
3043
|
+
* "0x1111111111111111111111111111111111111111"
|
|
3044
|
+
* ]
|
|
3045
|
+
*/
|
|
3046
|
+
sell_erc20_callback?: string[];
|
|
3047
|
+
/**
|
|
3048
|
+
* @example [
|
|
3049
|
+
* "0x5555555555555555555555555555555555555555"
|
|
3050
|
+
* ]
|
|
3051
|
+
*/
|
|
3052
|
+
buy_erc20?: string[];
|
|
3053
|
+
/**
|
|
3054
|
+
* @example [
|
|
3055
|
+
* "0x9999999999999999999999999999999999999999"
|
|
3056
|
+
* ]
|
|
3057
|
+
*/
|
|
3058
|
+
not_supported: string[];
|
|
3059
|
+
};
|
|
2719
3060
|
};
|
|
2720
3061
|
responses: never;
|
|
2721
3062
|
parameters: never;
|
|
@@ -2777,45 +3118,6 @@ type Input = Readonly<{
|
|
|
2777
3118
|
*/
|
|
2778
3119
|
declare function from$2(input: Input): OfferResponse;
|
|
2779
3120
|
//#endregion
|
|
2780
|
-
//#region src/gatekeeper/types.d.ts
|
|
2781
|
-
type RuleInfo = {
|
|
2782
|
-
name: string;
|
|
2783
|
-
description: string;
|
|
2784
|
-
};
|
|
2785
|
-
type RulesProvider = {
|
|
2786
|
-
getRules: () => Promise<RuleInfo[]>;
|
|
2787
|
-
};
|
|
2788
|
-
type ValidationIssue = {
|
|
2789
|
-
index: number;
|
|
2790
|
-
rule: string;
|
|
2791
|
-
message: string;
|
|
2792
|
-
};
|
|
2793
|
-
type ValidateOffersSuccess = {
|
|
2794
|
-
payload: Hex;
|
|
2795
|
-
root: Hex;
|
|
2796
|
-
};
|
|
2797
|
-
type ValidateOffersIssues = {
|
|
2798
|
-
issues: ValidationIssue[];
|
|
2799
|
-
};
|
|
2800
|
-
type ValidateOffersData = ValidateOffersSuccess | ValidateOffersIssues;
|
|
2801
|
-
type SuccessPayload<T> = {
|
|
2802
|
-
meta: {
|
|
2803
|
-
timestamp: string;
|
|
2804
|
-
};
|
|
2805
|
-
cursor: string | null;
|
|
2806
|
-
data: T;
|
|
2807
|
-
};
|
|
2808
|
-
type ErrorPayload = {
|
|
2809
|
-
meta: {
|
|
2810
|
-
timestamp: string;
|
|
2811
|
-
};
|
|
2812
|
-
error: {
|
|
2813
|
-
code: string;
|
|
2814
|
-
message: string;
|
|
2815
|
-
details?: unknown;
|
|
2816
|
-
};
|
|
2817
|
-
};
|
|
2818
|
-
//#endregion
|
|
2819
3121
|
//#region src/api/Schema/openapi.d.ts
|
|
2820
3122
|
declare class BooksController {
|
|
2821
3123
|
getBook(): Promise<void>;
|
|
@@ -2823,6 +3125,9 @@ declare class BooksController {
|
|
|
2823
3125
|
declare class ValidateController {
|
|
2824
3126
|
validateOffers(): Promise<void>;
|
|
2825
3127
|
}
|
|
3128
|
+
declare class CallbacksController {
|
|
3129
|
+
resolveCallbackTypes(): Promise<void>;
|
|
3130
|
+
}
|
|
2826
3131
|
declare class OffersController {
|
|
2827
3132
|
getOffers(): Promise<void>;
|
|
2828
3133
|
}
|
|
@@ -2831,8 +3136,11 @@ declare class HealthController {
|
|
|
2831
3136
|
getCollectorsHealth(): Promise<void>;
|
|
2832
3137
|
getChainsHealth(): Promise<void>;
|
|
2833
3138
|
}
|
|
2834
|
-
declare class
|
|
2835
|
-
|
|
3139
|
+
declare class ConfigContractsController {
|
|
3140
|
+
getConfigContracts(): Promise<void>;
|
|
3141
|
+
}
|
|
3142
|
+
declare class ConfigRulesController {
|
|
3143
|
+
getConfigRules(): Promise<void>;
|
|
2836
3144
|
}
|
|
2837
3145
|
declare class ObligationsController {
|
|
2838
3146
|
getObligations(): Promise<void>;
|
|
@@ -2841,10 +3149,7 @@ declare class ObligationsController {
|
|
|
2841
3149
|
declare class UsersController {
|
|
2842
3150
|
getUserPositions(): Promise<void>;
|
|
2843
3151
|
}
|
|
2844
|
-
|
|
2845
|
-
rules?: RuleInfo[];
|
|
2846
|
-
};
|
|
2847
|
-
declare const OpenApi: (options?: OpenApiOptions) => Promise<OpenAPIDocument>;
|
|
3152
|
+
declare const OpenApi: () => Promise<OpenAPIDocument>;
|
|
2848
3153
|
//#endregion
|
|
2849
3154
|
//#region src/database/domains/Positions.d.ts
|
|
2850
3155
|
type PaginationParams = {
|
|
@@ -2911,16 +3216,44 @@ declare const schemas: {
|
|
|
2911
3216
|
false: "false";
|
|
2912
3217
|
}>, z$1.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
|
|
2913
3218
|
}, z$1.core.$strip>;
|
|
2914
|
-
readonly
|
|
3219
|
+
readonly get_config_contracts: 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
|
+
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>>>>>;
|
|
3223
|
+
}, z$1.core.$strip>;
|
|
3224
|
+
readonly get_config_rules: z$1.ZodObject<{
|
|
3225
|
+
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
3226
|
+
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
3227
|
+
types: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodEnum<{
|
|
3228
|
+
maturity: "maturity";
|
|
3229
|
+
callback: "callback";
|
|
3230
|
+
loan_token: "loan_token";
|
|
3231
|
+
oracle: "oracle";
|
|
3232
|
+
}>>>>;
|
|
3233
|
+
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>>>>>;
|
|
3234
|
+
}, z$1.core.$strip>;
|
|
3235
|
+
readonly get_offers: z$1.ZodPipe<z$1.ZodObject<{
|
|
3236
|
+
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
3237
|
+
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
2915
3238
|
side: z$1.ZodOptional<z$1.ZodEnum<{
|
|
2916
3239
|
buy: "buy";
|
|
2917
3240
|
sell: "sell";
|
|
2918
3241
|
}>>;
|
|
2919
3242
|
obligation_id: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
2920
3243
|
maker: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
2921
|
-
|
|
2922
|
-
limit:
|
|
2923
|
-
|
|
3244
|
+
}, z$1.core.$strip>, z$1.ZodTransform<{
|
|
3245
|
+
limit: number;
|
|
3246
|
+
cursor?: string | undefined;
|
|
3247
|
+
side?: "buy" | "sell" | undefined;
|
|
3248
|
+
obligation_id?: `0x${string}` | undefined;
|
|
3249
|
+
maker?: `0x${string}` | undefined;
|
|
3250
|
+
}, {
|
|
3251
|
+
limit: number;
|
|
3252
|
+
cursor?: string | undefined;
|
|
3253
|
+
side?: "buy" | "sell" | undefined;
|
|
3254
|
+
obligation_id?: `0x${string}` | undefined;
|
|
3255
|
+
maker?: `0x${string}` | undefined;
|
|
3256
|
+
}>>;
|
|
2924
3257
|
readonly get_obligations: z$1.ZodObject<{
|
|
2925
3258
|
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
2926
3259
|
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>>>>>;
|
|
@@ -2944,6 +3277,12 @@ declare const schemas: {
|
|
|
2944
3277
|
readonly validate_offers: z$1.ZodObject<{
|
|
2945
3278
|
offers: z$1.ZodArray<z$1.ZodUnknown>;
|
|
2946
3279
|
}, z$1.core.$strict>;
|
|
3280
|
+
readonly callback_types: z$1.ZodObject<{
|
|
3281
|
+
callbacks: z$1.ZodArray<z$1.ZodObject<{
|
|
3282
|
+
chain_id: z$1.ZodNumber;
|
|
3283
|
+
addresses: z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
3284
|
+
}, z$1.core.$strict>>;
|
|
3285
|
+
}, z$1.core.$strict>;
|
|
2947
3286
|
readonly get_user_positions: z$1.ZodObject<{
|
|
2948
3287
|
user_address: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
2949
3288
|
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
@@ -2954,7 +3293,7 @@ type Action = keyof typeof schemas;
|
|
|
2954
3293
|
declare function parse<A extends Action>(action: A, query: unknown): z$1.infer<(typeof schemas)[A]>;
|
|
2955
3294
|
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]>>;
|
|
2956
3295
|
declare namespace index_d_exports$1 {
|
|
2957
|
-
export { BookResponse_d_exports as BookResponse, BooksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse,
|
|
3296
|
+
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 };
|
|
2958
3297
|
}
|
|
2959
3298
|
declare namespace Client_d_exports$1 {
|
|
2960
3299
|
export { Client$2 as Client, ConnectOptions, HttpForbiddenError, HttpGetApiFailedError, HttpRateLimitError, HttpUnauthorizedError, InvalidUrlError, connect$1 as connect, getObligations, getOffers };
|
|
@@ -3152,21 +3491,95 @@ declare function run<T, Name extends string, Rules extends readonly Rule<T, Name
|
|
|
3152
3491
|
rules: Rules;
|
|
3153
3492
|
chunkSize?: number;
|
|
3154
3493
|
}): Promise<Result<T, RuleNames<Rules>>>;
|
|
3494
|
+
//#endregion
|
|
3495
|
+
//#region src/gatekeeper/types.d.ts
|
|
3496
|
+
type ConfigRule = {
|
|
3497
|
+
type: "maturity";
|
|
3498
|
+
chain_id: Id;
|
|
3499
|
+
name: MaturityType;
|
|
3500
|
+
timestamp: Maturity;
|
|
3501
|
+
} | {
|
|
3502
|
+
type: "callback";
|
|
3503
|
+
chain_id: Id;
|
|
3504
|
+
address: Address;
|
|
3505
|
+
callback_type: Exclude<Type$1, Type$1.BuyWithEmptyCallback>;
|
|
3506
|
+
} | {
|
|
3507
|
+
type: "loan_token";
|
|
3508
|
+
chain_id: Id;
|
|
3509
|
+
address: Address;
|
|
3510
|
+
} | {
|
|
3511
|
+
type: "oracle";
|
|
3512
|
+
chain_id: Id;
|
|
3513
|
+
address: Address;
|
|
3514
|
+
};
|
|
3515
|
+
type ValidationIssue = {
|
|
3516
|
+
index: number;
|
|
3517
|
+
rule: string;
|
|
3518
|
+
message: string;
|
|
3519
|
+
};
|
|
3520
|
+
type ValidateOffersSuccess = {
|
|
3521
|
+
payload: Hex;
|
|
3522
|
+
root: Hex;
|
|
3523
|
+
};
|
|
3524
|
+
type ValidateOffersIssues = {
|
|
3525
|
+
issues: ValidationIssue[];
|
|
3526
|
+
};
|
|
3527
|
+
type ValidateOffersData = ValidateOffersSuccess | ValidateOffersIssues;
|
|
3528
|
+
type CallbackType = Type$1 | "not_supported";
|
|
3529
|
+
type CallbackTypesRequest = {
|
|
3530
|
+
callbacks: Array<{
|
|
3531
|
+
chain_id: Id;
|
|
3532
|
+
addresses: Address[];
|
|
3533
|
+
}>;
|
|
3534
|
+
};
|
|
3535
|
+
type CallbackTypesResponse = Array<{
|
|
3536
|
+
chain_id: Id;
|
|
3537
|
+
} & Partial<Record<CallbackType, Address[]>>>;
|
|
3538
|
+
type ConfigRulesPayload = SuccessPayload<ConfigRule[]> | ErrorPayload;
|
|
3539
|
+
type SuccessPayload<T> = {
|
|
3540
|
+
meta: {
|
|
3541
|
+
timestamp: string;
|
|
3542
|
+
checksum?: string;
|
|
3543
|
+
};
|
|
3544
|
+
cursor: string | null;
|
|
3545
|
+
data: T;
|
|
3546
|
+
};
|
|
3547
|
+
type ErrorPayload = {
|
|
3548
|
+
meta: {
|
|
3549
|
+
timestamp: string;
|
|
3550
|
+
checksum?: string;
|
|
3551
|
+
};
|
|
3552
|
+
error: {
|
|
3553
|
+
code: string;
|
|
3554
|
+
message: string;
|
|
3555
|
+
details?: unknown;
|
|
3556
|
+
};
|
|
3557
|
+
};
|
|
3155
3558
|
declare namespace Client_d_exports {
|
|
3156
3559
|
export { ClientConfig, GatekeeperClient, createHttpClient };
|
|
3157
3560
|
}
|
|
3158
|
-
type GatekeeperClient =
|
|
3561
|
+
type GatekeeperClient = {
|
|
3159
3562
|
/** Validate offers and return the raw response payload. */validate: (body: unknown) => Promise<{
|
|
3160
3563
|
statusCode: number;
|
|
3161
3564
|
body: unknown;
|
|
3565
|
+
}>; /** Get configured rules for supported chains. */
|
|
3566
|
+
getConfigRules: (query?: {
|
|
3567
|
+
cursor?: string;
|
|
3568
|
+
limit?: number | string;
|
|
3569
|
+
types?: Array<ConfigRule["type"]> | ConfigRule["type"];
|
|
3570
|
+
}) => Promise<{
|
|
3571
|
+
statusCode: number;
|
|
3572
|
+
body: ConfigRulesPayload;
|
|
3162
3573
|
}>; /** Validate offers and return decision results. */
|
|
3163
|
-
isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>; /**
|
|
3574
|
+
isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>; /** Resolve callback types for callback addresses. */
|
|
3575
|
+
getCallbackTypes: (request: CallbackTypesRequest) => Promise<CallbackTypesResponse>; /** Base URL for the gatekeeper service. */
|
|
3164
3576
|
baseUrl: string;
|
|
3165
3577
|
};
|
|
3166
3578
|
type ClientConfig = {
|
|
3167
3579
|
baseUrl: string;
|
|
3168
3580
|
timeoutMs?: number;
|
|
3169
3581
|
fetchFn?: typeof fetch;
|
|
3582
|
+
originSecret?: string;
|
|
3170
3583
|
};
|
|
3171
3584
|
/**
|
|
3172
3585
|
* Create an HTTP client for a gatekeeper service.
|
|
@@ -3174,65 +3587,12 @@ type ClientConfig = {
|
|
|
3174
3587
|
* @returns An HTTP-backed gatekeeper client. {@link GatekeeperClient}
|
|
3175
3588
|
*/
|
|
3176
3589
|
declare function createHttpClient(config: ClientConfig): GatekeeperClient;
|
|
3177
|
-
declare namespace GateConfig_d_exports {
|
|
3178
|
-
export { CallbackConfig, GateConfig, assets, configs, getCallback, getCallbackAddresses, getCallbackType, getCallbackTypeAddresses };
|
|
3179
|
-
}
|
|
3180
|
-
type GateConfig = {
|
|
3181
|
-
callbacks?: CallbackConfig[];
|
|
3182
|
-
maturities?: MaturityType[];
|
|
3183
|
-
};
|
|
3184
|
-
type CallbackConfig = {
|
|
3185
|
-
type: Type$1.BuyVaultV1Callback;
|
|
3186
|
-
addresses: Address[];
|
|
3187
|
-
vaultFactories: Address[];
|
|
3188
|
-
} | {
|
|
3189
|
-
type: Type$1.SellERC20Callback;
|
|
3190
|
-
addresses: Address[];
|
|
3191
|
-
} | {
|
|
3192
|
-
type: Type$1.BuyWithEmptyCallback;
|
|
3193
|
-
};
|
|
3194
|
-
declare function getCallback(chain: Name, type: Type$1.BuyVaultV1Callback): Extract<CallbackConfig, {
|
|
3195
|
-
type: Type$1.BuyVaultV1Callback;
|
|
3196
|
-
}> | undefined;
|
|
3197
|
-
declare function getCallback(chain: Name, type: Type$1.SellERC20Callback): Extract<CallbackConfig, {
|
|
3198
|
-
type: Type$1.SellERC20Callback;
|
|
3199
|
-
}> | undefined;
|
|
3200
|
-
declare function getCallback(chain: Name, type: Type$1.BuyWithEmptyCallback): Extract<CallbackConfig, {
|
|
3201
|
-
type: Type$1.BuyWithEmptyCallback;
|
|
3202
|
-
}> | undefined;
|
|
3203
|
-
declare function getCallback(chain: Name, type: Type$1): CallbackConfig | undefined;
|
|
3204
|
-
/**
|
|
3205
|
-
* Attempts to infer the configured callback type from a callback address on a chain.
|
|
3206
|
-
* Skips the empty callback type as it does not carry addresses.
|
|
3207
|
-
*
|
|
3208
|
-
* @param chain - Chain name for which to infer the callback type
|
|
3209
|
-
* @param address - Callback contract address
|
|
3210
|
-
* @returns The callback type when found, otherwise undefined
|
|
3211
|
-
*/
|
|
3212
|
-
declare function getCallbackType(chain: Name, address: Address): Type$1.BuyWithEmptyCallback | Type$1.BuyVaultV1Callback | Type$1.SellERC20Callback | undefined;
|
|
3213
|
-
/**
|
|
3214
|
-
* Returns the callback addresses for a given chain and callback type, if it exists.
|
|
3215
|
-
* @param chain - Chain name for which to read the validation configuration
|
|
3216
|
-
* @param type - Callback type to retrieve
|
|
3217
|
-
* @returns The matching callback addresses or an empty array if not configured
|
|
3218
|
-
*/
|
|
3219
|
-
declare function getCallbackTypeAddresses(chain: Name, type: Type$1): Address[];
|
|
3220
|
-
/**
|
|
3221
|
-
* Returns the list of allowed non-empty callback addresses for a chain.
|
|
3222
|
-
*
|
|
3223
|
-
* @param chain - Chain name
|
|
3224
|
-
* @returns Array of allowed callback addresses (lowercased). Empty when none configured
|
|
3225
|
-
*/
|
|
3226
|
-
declare const getCallbackAddresses: (chain: Name) => Address[];
|
|
3227
|
-
declare const assets: Record<string, Address[]>;
|
|
3228
|
-
declare const configs: Record<Name, GateConfig>;
|
|
3229
3590
|
declare namespace Gatekeeper_d_exports {
|
|
3230
3591
|
export { Gatekeeper, Rules, create };
|
|
3231
3592
|
}
|
|
3232
3593
|
type Rules = readonly Rule<Offer, string>[];
|
|
3233
3594
|
type Gatekeeper = {
|
|
3234
3595
|
isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>;
|
|
3235
|
-
getRules: () => Promise<RuleInfo[]>;
|
|
3236
3596
|
};
|
|
3237
3597
|
type GatekeeperParameters = {
|
|
3238
3598
|
rules: Rules;
|
|
@@ -3245,9 +3605,9 @@ type GatekeeperParameters = {
|
|
|
3245
3605
|
declare function create(parameters: GatekeeperParameters): Gatekeeper;
|
|
3246
3606
|
//#endregion
|
|
3247
3607
|
//#region src/gatekeeper/morphoRules.d.ts
|
|
3248
|
-
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">)[];
|
|
3608
|
+
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">)[];
|
|
3249
3609
|
declare namespace Rules_d_exports {
|
|
3250
|
-
export { ValidityParameters, amountMutualExclusivity, callback, chains, maturity, sameMaker, token, validity };
|
|
3610
|
+
export { ValidityParameters, amountMutualExclusivity, callback, chains, maturity, oracle, sameMaker, token, validity };
|
|
3251
3611
|
}
|
|
3252
3612
|
type ValidityParameters = {
|
|
3253
3613
|
client: PublicClient<Transport, Chain$1>;
|
|
@@ -3286,6 +3646,16 @@ declare const token: ({
|
|
|
3286
3646
|
}: {
|
|
3287
3647
|
assetsByChainId: Partial<Record<Id, Address[]>>;
|
|
3288
3648
|
}) => Rule<Offer, "token">;
|
|
3649
|
+
/**
|
|
3650
|
+
* A validation rule that checks if the offer's oracle addresses are allowed for its chain.
|
|
3651
|
+
* @param oraclesByChainId - Allowed oracles indexed by chain id.
|
|
3652
|
+
* @returns The issue that was found. If the offer is valid, this will be undefined.
|
|
3653
|
+
*/
|
|
3654
|
+
declare const oracle: ({
|
|
3655
|
+
oraclesByChainId
|
|
3656
|
+
}: {
|
|
3657
|
+
oraclesByChainId: Partial<Record<Id, Address[]>>;
|
|
3658
|
+
}) => Rule<Offer, "oracle">;
|
|
3289
3659
|
/**
|
|
3290
3660
|
* A batch validation rule that ensures all offers in a tree have the same maker address.
|
|
3291
3661
|
* Returns an issue only for the first non-conforming offer.
|
|
@@ -3304,7 +3674,8 @@ declare function from(parameters: from.Parameters): from.ReturnType;
|
|
|
3304
3674
|
declare namespace from {
|
|
3305
3675
|
type Parameters = {
|
|
3306
3676
|
/** The viem client to use. */client: WalletClient; /** The mempool address. */
|
|
3307
|
-
mempoolAddress: Address; /** The
|
|
3677
|
+
mempoolAddress: Address; /** The MorphoV2 contract address used for signature verification. */
|
|
3678
|
+
morphoAddress?: Address; /** The block window to use for the mempool. Defaults to 100. */
|
|
3308
3679
|
blockWindow?: number;
|
|
3309
3680
|
};
|
|
3310
3681
|
type ReturnType = Client$1;
|
|
@@ -3489,5 +3860,5 @@ declare namespace index_d_exports$2 {
|
|
|
3489
3860
|
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 };
|
|
3490
3861
|
}
|
|
3491
3862
|
//#endregion
|
|
3492
|
-
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,
|
|
3863
|
+
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 };
|
|
3493
3864
|
//# sourceMappingURL=index.browser.d.mts.map
|