@morpho-dev/router 0.5.0 → 0.6.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 +2147 -989
- 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 +497 -162
- package/dist/index.browser.d.mts.map +1 -1
- package/dist/index.browser.d.ts +497 -162
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +881 -426
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.mjs +888 -427
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.node.d.mts +579 -174
- package/dist/index.node.d.mts.map +1 -1
- package/dist/index.node.d.ts +578 -173
- package/dist/index.node.d.ts.map +1 -1
- package/dist/index.node.js +6671 -5605
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.mjs +6659 -5599
- 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,28 @@ 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
|
+
};
|
|
1824
1939
|
header?: never;
|
|
1825
1940
|
path?: never;
|
|
1826
1941
|
cookie?: never;
|
|
@@ -1832,7 +1947,66 @@ interface paths {
|
|
|
1832
1947
|
[name: string]: unknown;
|
|
1833
1948
|
};
|
|
1834
1949
|
content: {
|
|
1835
|
-
"application/json": components["schemas"]["
|
|
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
|
|
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
|
+
};
|
|
1998
|
+
header?: never;
|
|
1999
|
+
path?: never;
|
|
2000
|
+
cookie?: never;
|
|
2001
|
+
};
|
|
2002
|
+
requestBody?: never;
|
|
2003
|
+
responses: {
|
|
2004
|
+
/** @description Success */200: {
|
|
2005
|
+
headers: {
|
|
2006
|
+
[name: string]: unknown;
|
|
2007
|
+
};
|
|
2008
|
+
content: {
|
|
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,39 +2552,78 @@ 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
|
+
* }
|
|
2366
2612
|
* ]
|
|
2367
|
-
* @enum {string}
|
|
2368
2613
|
*/
|
|
2369
|
-
|
|
2614
|
+
data: components["schemas"]["ConfigRulesRuleResponse"][];
|
|
2370
2615
|
};
|
|
2371
|
-
|
|
2372
|
-
/** @example
|
|
2616
|
+
ConfigRulesMeta: {
|
|
2617
|
+
/** @example 2024-01-01T12:00:00.000Z */timestamp: string; /** @example f1d2d2f924e986ac86fdf7b36c94bcdf */
|
|
2618
|
+
checksum: string;
|
|
2619
|
+
};
|
|
2620
|
+
ConfigRulesRuleResponse: {
|
|
2621
|
+
/** @example maturity */type: string; /** @example 1 */
|
|
2622
|
+
chain_id: number; /** @example end_of_next_month */
|
|
2623
|
+
name?: string; /** @example 1730415600 */
|
|
2624
|
+
timestamp?: number; /** @example 0x1111111111111111111111111111111111111111 */
|
|
2625
|
+
address?: string; /** @example sell_erc20_callback */
|
|
2626
|
+
callback_type?: string;
|
|
2373
2627
|
};
|
|
2374
2628
|
OfferListResponse: {
|
|
2375
2629
|
meta: components["schemas"]["Meta"]; /** @example eyJvZmZzZXQiOjEwMH0 */
|
|
@@ -2711,6 +2965,84 @@ interface components {
|
|
|
2711
2965
|
*/
|
|
2712
2966
|
root: string;
|
|
2713
2967
|
};
|
|
2968
|
+
CallbackTypesRequest: {
|
|
2969
|
+
/**
|
|
2970
|
+
* @example [
|
|
2971
|
+
* {
|
|
2972
|
+
* "chain_id": 1,
|
|
2973
|
+
* "addresses": [
|
|
2974
|
+
* "0x1111111111111111111111111111111111111111",
|
|
2975
|
+
* "0x3333333333333333333333333333333333333333",
|
|
2976
|
+
* "0x9999999999999999999999999999999999999999"
|
|
2977
|
+
* ]
|
|
2978
|
+
* }
|
|
2979
|
+
* ]
|
|
2980
|
+
*/
|
|
2981
|
+
callbacks: components["schemas"]["CallbackTypesChainRequest"][];
|
|
2982
|
+
};
|
|
2983
|
+
CallbackTypesChainRequest: {
|
|
2984
|
+
/** @example 1 */chain_id: number;
|
|
2985
|
+
/**
|
|
2986
|
+
* @example [
|
|
2987
|
+
* "0x1111111111111111111111111111111111111111",
|
|
2988
|
+
* "0x3333333333333333333333333333333333333333",
|
|
2989
|
+
* "0x9999999999999999999999999999999999999999"
|
|
2990
|
+
* ]
|
|
2991
|
+
*/
|
|
2992
|
+
addresses: string[];
|
|
2993
|
+
};
|
|
2994
|
+
CallbackTypesSuccessResponse: {
|
|
2995
|
+
meta: components["schemas"]["Meta"]; /** @example maturity:1:1730415600:end_of_next_month */
|
|
2996
|
+
cursor: string | null;
|
|
2997
|
+
/**
|
|
2998
|
+
* @description Callback types grouped by chain.
|
|
2999
|
+
* @example [
|
|
3000
|
+
* {
|
|
3001
|
+
* "chain_id": 1,
|
|
3002
|
+
* "sell_erc20_callback": [
|
|
3003
|
+
* "0x1111111111111111111111111111111111111111"
|
|
3004
|
+
* ],
|
|
3005
|
+
* "buy_erc20": [
|
|
3006
|
+
* "0x5555555555555555555555555555555555555555"
|
|
3007
|
+
* ],
|
|
3008
|
+
* "buy_vault_v1_callback": [
|
|
3009
|
+
* "0x3333333333333333333333333333333333333333"
|
|
3010
|
+
* ],
|
|
3011
|
+
* "not_supported": [
|
|
3012
|
+
* "0x9999999999999999999999999999999999999999"
|
|
3013
|
+
* ]
|
|
3014
|
+
* }
|
|
3015
|
+
* ]
|
|
3016
|
+
*/
|
|
3017
|
+
data: components["schemas"]["CallbackTypesChainResponse"][];
|
|
3018
|
+
};
|
|
3019
|
+
CallbackTypesChainResponse: {
|
|
3020
|
+
/** @example 1 */chain_id: number;
|
|
3021
|
+
/**
|
|
3022
|
+
* @example [
|
|
3023
|
+
* "0x3333333333333333333333333333333333333333"
|
|
3024
|
+
* ]
|
|
3025
|
+
*/
|
|
3026
|
+
buy_vault_v1_callback?: string[];
|
|
3027
|
+
/**
|
|
3028
|
+
* @example [
|
|
3029
|
+
* "0x1111111111111111111111111111111111111111"
|
|
3030
|
+
* ]
|
|
3031
|
+
*/
|
|
3032
|
+
sell_erc20_callback?: string[];
|
|
3033
|
+
/**
|
|
3034
|
+
* @example [
|
|
3035
|
+
* "0x5555555555555555555555555555555555555555"
|
|
3036
|
+
* ]
|
|
3037
|
+
*/
|
|
3038
|
+
buy_erc20?: string[];
|
|
3039
|
+
/**
|
|
3040
|
+
* @example [
|
|
3041
|
+
* "0x9999999999999999999999999999999999999999"
|
|
3042
|
+
* ]
|
|
3043
|
+
*/
|
|
3044
|
+
not_supported: string[];
|
|
3045
|
+
};
|
|
2714
3046
|
};
|
|
2715
3047
|
responses: never;
|
|
2716
3048
|
parameters: never;
|
|
@@ -2772,45 +3104,6 @@ type Input = Readonly<{
|
|
|
2772
3104
|
*/
|
|
2773
3105
|
declare function from$2(input: Input): OfferResponse;
|
|
2774
3106
|
//#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
3107
|
//#region src/api/Schema/openapi.d.ts
|
|
2815
3108
|
declare class BooksController {
|
|
2816
3109
|
getBook(): Promise<void>;
|
|
@@ -2818,6 +3111,9 @@ declare class BooksController {
|
|
|
2818
3111
|
declare class ValidateController {
|
|
2819
3112
|
validateOffers(): Promise<void>;
|
|
2820
3113
|
}
|
|
3114
|
+
declare class CallbacksController {
|
|
3115
|
+
resolveCallbackTypes(): Promise<void>;
|
|
3116
|
+
}
|
|
2821
3117
|
declare class OffersController {
|
|
2822
3118
|
getOffers(): Promise<void>;
|
|
2823
3119
|
}
|
|
@@ -2826,8 +3122,11 @@ declare class HealthController {
|
|
|
2826
3122
|
getCollectorsHealth(): Promise<void>;
|
|
2827
3123
|
getChainsHealth(): Promise<void>;
|
|
2828
3124
|
}
|
|
2829
|
-
declare class
|
|
2830
|
-
|
|
3125
|
+
declare class ConfigContractsController {
|
|
3126
|
+
getConfigContracts(): Promise<void>;
|
|
3127
|
+
}
|
|
3128
|
+
declare class ConfigRulesController {
|
|
3129
|
+
getConfigRules(): Promise<void>;
|
|
2831
3130
|
}
|
|
2832
3131
|
declare class ObligationsController {
|
|
2833
3132
|
getObligations(): Promise<void>;
|
|
@@ -2836,10 +3135,7 @@ declare class ObligationsController {
|
|
|
2836
3135
|
declare class UsersController {
|
|
2837
3136
|
getUserPositions(): Promise<void>;
|
|
2838
3137
|
}
|
|
2839
|
-
|
|
2840
|
-
rules?: RuleInfo[];
|
|
2841
|
-
};
|
|
2842
|
-
declare const OpenApi: (options?: OpenApiOptions) => Promise<OpenAPIDocument>;
|
|
3138
|
+
declare const OpenApi: () => Promise<OpenAPIDocument>;
|
|
2843
3139
|
//#endregion
|
|
2844
3140
|
//#region src/database/domains/Positions.d.ts
|
|
2845
3141
|
type PaginationParams = {
|
|
@@ -2906,6 +3202,21 @@ declare const schemas: {
|
|
|
2906
3202
|
false: "false";
|
|
2907
3203
|
}>, z$1.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
|
|
2908
3204
|
}, z$1.core.$strip>;
|
|
3205
|
+
readonly get_config_contracts: z$1.ZodObject<{
|
|
3206
|
+
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
3207
|
+
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
3208
|
+
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>>>>>;
|
|
3209
|
+
}, z$1.core.$strip>;
|
|
3210
|
+
readonly get_config_rules: z$1.ZodObject<{
|
|
3211
|
+
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
3212
|
+
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
3213
|
+
types: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodEnum<{
|
|
3214
|
+
maturity: "maturity";
|
|
3215
|
+
callback: "callback";
|
|
3216
|
+
loan_token: "loan_token";
|
|
3217
|
+
}>>>>;
|
|
3218
|
+
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>>>>>;
|
|
3219
|
+
}, z$1.core.$strip>;
|
|
2909
3220
|
readonly get_offers: z$1.ZodObject<{
|
|
2910
3221
|
side: z$1.ZodOptional<z$1.ZodEnum<{
|
|
2911
3222
|
buy: "buy";
|
|
@@ -2939,6 +3250,12 @@ declare const schemas: {
|
|
|
2939
3250
|
readonly validate_offers: z$1.ZodObject<{
|
|
2940
3251
|
offers: z$1.ZodArray<z$1.ZodUnknown>;
|
|
2941
3252
|
}, z$1.core.$strict>;
|
|
3253
|
+
readonly callback_types: z$1.ZodObject<{
|
|
3254
|
+
callbacks: z$1.ZodArray<z$1.ZodObject<{
|
|
3255
|
+
chain_id: z$1.ZodNumber;
|
|
3256
|
+
addresses: z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
3257
|
+
}, z$1.core.$strict>>;
|
|
3258
|
+
}, z$1.core.$strict>;
|
|
2942
3259
|
readonly get_user_positions: z$1.ZodObject<{
|
|
2943
3260
|
user_address: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
2944
3261
|
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
@@ -2949,7 +3266,7 @@ type Action = keyof typeof schemas;
|
|
|
2949
3266
|
declare function parse<A extends Action>(action: A, query: unknown): z$1.infer<(typeof schemas)[A]>;
|
|
2950
3267
|
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
3268
|
declare namespace index_d_exports$1 {
|
|
2952
|
-
export { BookResponse_d_exports as BookResponse, BooksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse,
|
|
3269
|
+
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
3270
|
}
|
|
2954
3271
|
declare namespace Client_d_exports$1 {
|
|
2955
3272
|
export { Client$2 as Client, ConnectOptions, HttpForbiddenError, HttpGetApiFailedError, HttpRateLimitError, HttpUnauthorizedError, InvalidUrlError, connect$1 as connect, getObligations, getOffers };
|
|
@@ -3147,21 +3464,91 @@ declare function run<T, Name extends string, Rules extends readonly Rule<T, Name
|
|
|
3147
3464
|
rules: Rules;
|
|
3148
3465
|
chunkSize?: number;
|
|
3149
3466
|
}): Promise<Result<T, RuleNames<Rules>>>;
|
|
3467
|
+
//#endregion
|
|
3468
|
+
//#region src/gatekeeper/types.d.ts
|
|
3469
|
+
type ConfigRule = {
|
|
3470
|
+
type: "maturity";
|
|
3471
|
+
chain_id: Id;
|
|
3472
|
+
name: MaturityType;
|
|
3473
|
+
timestamp: Maturity;
|
|
3474
|
+
} | {
|
|
3475
|
+
type: "callback";
|
|
3476
|
+
chain_id: Id;
|
|
3477
|
+
address: Address;
|
|
3478
|
+
callback_type: Exclude<Type$1, Type$1.BuyWithEmptyCallback>;
|
|
3479
|
+
} | {
|
|
3480
|
+
type: "loan_token";
|
|
3481
|
+
chain_id: Id;
|
|
3482
|
+
address: Address;
|
|
3483
|
+
};
|
|
3484
|
+
type ValidationIssue = {
|
|
3485
|
+
index: number;
|
|
3486
|
+
rule: string;
|
|
3487
|
+
message: string;
|
|
3488
|
+
};
|
|
3489
|
+
type ValidateOffersSuccess = {
|
|
3490
|
+
payload: Hex;
|
|
3491
|
+
root: Hex;
|
|
3492
|
+
};
|
|
3493
|
+
type ValidateOffersIssues = {
|
|
3494
|
+
issues: ValidationIssue[];
|
|
3495
|
+
};
|
|
3496
|
+
type ValidateOffersData = ValidateOffersSuccess | ValidateOffersIssues;
|
|
3497
|
+
type CallbackType = Type$1 | "not_supported";
|
|
3498
|
+
type CallbackTypesRequest = {
|
|
3499
|
+
callbacks: Array<{
|
|
3500
|
+
chain_id: Id;
|
|
3501
|
+
addresses: Address[];
|
|
3502
|
+
}>;
|
|
3503
|
+
};
|
|
3504
|
+
type CallbackTypesResponse = Array<{
|
|
3505
|
+
chain_id: Id;
|
|
3506
|
+
} & Partial<Record<CallbackType, Address[]>>>;
|
|
3507
|
+
type ConfigRulesPayload = SuccessPayload<ConfigRule[]> | ErrorPayload;
|
|
3508
|
+
type SuccessPayload<T> = {
|
|
3509
|
+
meta: {
|
|
3510
|
+
timestamp: string;
|
|
3511
|
+
checksum?: string;
|
|
3512
|
+
};
|
|
3513
|
+
cursor: string | null;
|
|
3514
|
+
data: T;
|
|
3515
|
+
};
|
|
3516
|
+
type ErrorPayload = {
|
|
3517
|
+
meta: {
|
|
3518
|
+
timestamp: string;
|
|
3519
|
+
checksum?: string;
|
|
3520
|
+
};
|
|
3521
|
+
error: {
|
|
3522
|
+
code: string;
|
|
3523
|
+
message: string;
|
|
3524
|
+
details?: unknown;
|
|
3525
|
+
};
|
|
3526
|
+
};
|
|
3150
3527
|
declare namespace Client_d_exports {
|
|
3151
3528
|
export { ClientConfig, GatekeeperClient, createHttpClient };
|
|
3152
3529
|
}
|
|
3153
|
-
type GatekeeperClient =
|
|
3530
|
+
type GatekeeperClient = {
|
|
3154
3531
|
/** Validate offers and return the raw response payload. */validate: (body: unknown) => Promise<{
|
|
3155
3532
|
statusCode: number;
|
|
3156
3533
|
body: unknown;
|
|
3534
|
+
}>; /** Get configured rules for supported chains. */
|
|
3535
|
+
getConfigRules: (query?: {
|
|
3536
|
+
cursor?: string;
|
|
3537
|
+
limit?: number | string;
|
|
3538
|
+
types?: Array<ConfigRule["type"]> | ConfigRule["type"];
|
|
3539
|
+
}) => Promise<{
|
|
3540
|
+
statusCode: number;
|
|
3541
|
+
body: ConfigRulesPayload;
|
|
3157
3542
|
}>; /** Validate offers and return decision results. */
|
|
3158
|
-
isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>; /**
|
|
3543
|
+
isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>; /** Resolve callback types for callback addresses. */
|
|
3544
|
+
getCallbackTypes: (request: CallbackTypesRequest) => Promise<CallbackTypesResponse>; /** Base URL for the gatekeeper service. */
|
|
3159
3545
|
baseUrl: string;
|
|
3160
3546
|
};
|
|
3161
3547
|
type ClientConfig = {
|
|
3162
3548
|
baseUrl: string;
|
|
3163
3549
|
timeoutMs?: number;
|
|
3164
3550
|
fetchFn?: typeof fetch;
|
|
3551
|
+
originSecret?: string;
|
|
3165
3552
|
};
|
|
3166
3553
|
/**
|
|
3167
3554
|
* Create an HTTP client for a gatekeeper service.
|
|
@@ -3169,65 +3556,12 @@ type ClientConfig = {
|
|
|
3169
3556
|
* @returns An HTTP-backed gatekeeper client. {@link GatekeeperClient}
|
|
3170
3557
|
*/
|
|
3171
3558
|
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
3559
|
declare namespace Gatekeeper_d_exports {
|
|
3225
3560
|
export { Gatekeeper, Rules, create };
|
|
3226
3561
|
}
|
|
3227
3562
|
type Rules = readonly Rule<Offer, string>[];
|
|
3228
3563
|
type Gatekeeper = {
|
|
3229
3564
|
isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>;
|
|
3230
|
-
getRules: () => Promise<RuleInfo[]>;
|
|
3231
3565
|
};
|
|
3232
3566
|
type GatekeeperParameters = {
|
|
3233
3567
|
rules: Rules;
|
|
@@ -3299,7 +3633,8 @@ declare function from(parameters: from.Parameters): from.ReturnType;
|
|
|
3299
3633
|
declare namespace from {
|
|
3300
3634
|
type Parameters = {
|
|
3301
3635
|
/** The viem client to use. */client: WalletClient; /** The mempool address. */
|
|
3302
|
-
mempoolAddress: Address; /** The
|
|
3636
|
+
mempoolAddress: Address; /** The MorphoV2 contract address used for signature verification. */
|
|
3637
|
+
morphoAddress?: Address; /** The block window to use for the mempool. Defaults to 100. */
|
|
3303
3638
|
blockWindow?: number;
|
|
3304
3639
|
};
|
|
3305
3640
|
type ReturnType = Client$1;
|
|
@@ -3484,5 +3819,5 @@ declare namespace index_d_exports$2 {
|
|
|
3484
3819
|
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
3820
|
}
|
|
3486
3821
|
//#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,
|
|
3822
|
+
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
3823
|
//# sourceMappingURL=index.browser.d.ts.map
|