@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.node.d.ts
CHANGED
|
@@ -821,7 +821,7 @@ declare function toSnakeCase$1<T>(obj: T): Snake<T>;
|
|
|
821
821
|
declare function fromSnakeCase$3<T>(obj: Snake<T>): T;
|
|
822
822
|
declare function stringifyBigint<T>(value: T): StringifiedBigint<T>;
|
|
823
823
|
declare namespace Obligation_d_exports {
|
|
824
|
-
export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$14 as from, fromSnakeCase$2 as fromSnakeCase, id, random$2 as random };
|
|
824
|
+
export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$14 as from, fromOffer$1 as fromOffer, fromSnakeCase$2 as fromSnakeCase, id, random$2 as random };
|
|
825
825
|
}
|
|
826
826
|
type Obligation = {
|
|
827
827
|
/** The chain id where the liquidity for this obligation is located. */chainId: Id; /** The token that is being borrowed for this obligation. */
|
|
@@ -929,6 +929,18 @@ declare function random$2(): random$2.ReturnType;
|
|
|
929
929
|
declare namespace random$2 {
|
|
930
930
|
type ReturnType = Obligation;
|
|
931
931
|
}
|
|
932
|
+
/**
|
|
933
|
+
* Creates an obligation from an offer.
|
|
934
|
+
* @constructor
|
|
935
|
+
*
|
|
936
|
+
* @param offer - The offer to create the obligation from.
|
|
937
|
+
* @returns The created obligation. {@link fromOffer.ReturnType}
|
|
938
|
+
*/
|
|
939
|
+
declare function fromOffer$1(offer: Offer): fromOffer$1.ReturnType;
|
|
940
|
+
declare namespace fromOffer$1 {
|
|
941
|
+
type Parameters = Offer;
|
|
942
|
+
type ReturnType = Obligation;
|
|
943
|
+
}
|
|
932
944
|
declare class InvalidObligationError extends BaseError<z$1.ZodError | Error> {
|
|
933
945
|
readonly name = "Obligation.InvalidObligationError";
|
|
934
946
|
constructor(error: z$1.ZodError | Error);
|
|
@@ -938,7 +950,7 @@ declare class CollateralsAreNotSortedError extends BaseError {
|
|
|
938
950
|
constructor();
|
|
939
951
|
}
|
|
940
952
|
declare namespace Offer_d_exports {
|
|
941
|
-
export {
|
|
953
|
+
export { InvalidOfferError, Offer, OfferConsumed, OfferInput, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$1 as decode, domain, encode$1 as encode, from$13 as from, fromSnakeCase$1 as fromSnakeCase, hash, obligationId, random$1 as random, serialize, toSnakeCase, types };
|
|
942
954
|
}
|
|
943
955
|
type Offer = {
|
|
944
956
|
/** The address that made the offer. */readonly maker: Address; /** The amount of assets offered. Mutually exclusive with obligationUnits and obligationShares. */
|
|
@@ -1177,15 +1189,6 @@ declare const types: {
|
|
|
1177
1189
|
readonly type: "bytes";
|
|
1178
1190
|
}];
|
|
1179
1191
|
};
|
|
1180
|
-
/**
|
|
1181
|
-
* Signs an array of offers.
|
|
1182
|
-
* @throws {Error} If the wallet account is not set.
|
|
1183
|
-
* @param offers - The offers to sign.
|
|
1184
|
-
* @param wallet - The wallet to sign the offers with.
|
|
1185
|
-
* @returns The signed offers.
|
|
1186
|
-
*/
|
|
1187
|
-
declare function sign(offers: Offer[], wallet: WalletClient): Promise<Hex>;
|
|
1188
|
-
declare function signatureMsg(offers: Offer[]): Hex;
|
|
1189
1192
|
declare function hash(offer: Offer): Hex;
|
|
1190
1193
|
/**
|
|
1191
1194
|
* Calculates the obligation id for an offer based on the smart contract's Obligation struct.
|
|
@@ -1243,12 +1246,8 @@ declare class InvalidOfferError extends BaseError<z$1.ZodError | Error> {
|
|
|
1243
1246
|
*/
|
|
1244
1247
|
get formattedMessage(): string;
|
|
1245
1248
|
}
|
|
1246
|
-
declare class AccountNotSetError extends BaseError {
|
|
1247
|
-
readonly name = "Offer.AccountNotSetError";
|
|
1248
|
-
constructor();
|
|
1249
|
-
}
|
|
1250
1249
|
declare namespace Oracle_d_exports {
|
|
1251
|
-
export { Conversion, Oracle, from$12 as from };
|
|
1250
|
+
export { Conversion, Oracle, from$12 as from, fromCollateral, fromOffer, fromOffers };
|
|
1252
1251
|
}
|
|
1253
1252
|
/**
|
|
1254
1253
|
* An oracle contract that provides price information for assets.
|
|
@@ -1274,6 +1273,55 @@ declare namespace from$12 {
|
|
|
1274
1273
|
};
|
|
1275
1274
|
type ReturnType = Oracle;
|
|
1276
1275
|
}
|
|
1276
|
+
/**
|
|
1277
|
+
* Creates an oracle from a collateral.
|
|
1278
|
+
* @constructor
|
|
1279
|
+
*
|
|
1280
|
+
* @param parameters - {@link fromCollateral.Parameters}
|
|
1281
|
+
* @returns The created oracle. {@link fromCollateral.ReturnType}
|
|
1282
|
+
*/
|
|
1283
|
+
declare function fromCollateral(parameters: fromCollateral.Parameters): fromCollateral.ReturnType;
|
|
1284
|
+
declare namespace fromCollateral {
|
|
1285
|
+
type Parameters = {
|
|
1286
|
+
chainId: Id;
|
|
1287
|
+
collateral: Collateral;
|
|
1288
|
+
blockNumber: number;
|
|
1289
|
+
price?: bigint | null;
|
|
1290
|
+
};
|
|
1291
|
+
type ReturnType = Oracle;
|
|
1292
|
+
}
|
|
1293
|
+
/**
|
|
1294
|
+
* Creates oracles from a single offer.
|
|
1295
|
+
* @constructor
|
|
1296
|
+
*
|
|
1297
|
+
* @param parameters - {@link fromOffer.Parameters}
|
|
1298
|
+
* @returns The created oracles. {@link fromOffer.ReturnType}
|
|
1299
|
+
*/
|
|
1300
|
+
declare function fromOffer(parameters: fromOffer.Parameters): fromOffer.ReturnType;
|
|
1301
|
+
declare namespace fromOffer {
|
|
1302
|
+
type Parameters = {
|
|
1303
|
+
offer: Offer;
|
|
1304
|
+
blockNumber: number;
|
|
1305
|
+
price?: bigint | null;
|
|
1306
|
+
};
|
|
1307
|
+
type ReturnType = Oracle[];
|
|
1308
|
+
}
|
|
1309
|
+
/**
|
|
1310
|
+
* Creates oracles from a list of offers.
|
|
1311
|
+
* @constructor
|
|
1312
|
+
*
|
|
1313
|
+
* @param parameters - {@link fromOffers.Parameters}
|
|
1314
|
+
* @returns The created oracles. {@link fromOffers.ReturnType}
|
|
1315
|
+
*/
|
|
1316
|
+
declare function fromOffers(parameters: fromOffers.Parameters): fromOffers.ReturnType;
|
|
1317
|
+
declare namespace fromOffers {
|
|
1318
|
+
type Parameters = {
|
|
1319
|
+
offers: Offer[];
|
|
1320
|
+
blockNumber: number;
|
|
1321
|
+
price?: bigint | null;
|
|
1322
|
+
};
|
|
1323
|
+
type ReturnType = Oracle[];
|
|
1324
|
+
}
|
|
1277
1325
|
/**
|
|
1278
1326
|
* Conversion utilities for converting between collateral and loan token amounts
|
|
1279
1327
|
* using oracle prices and LLTV
|
|
@@ -1529,7 +1577,7 @@ declare namespace from$8 {
|
|
|
1529
1577
|
type ReturnType = Transfer;
|
|
1530
1578
|
}
|
|
1531
1579
|
declare namespace Tree_d_exports {
|
|
1532
|
-
export { DecodeError, EncodeError, Proof, Tree, TreeError, VERSION$1 as VERSION, decode, encode, encodeUnsigned, from$7 as from, proofs };
|
|
1580
|
+
export { DecodeError, EncodeError, NormalizedSignatureDomain, Proof, SignatureDomain, SignatureDomainError, Tree, TreeError, VERSION$1 as VERSION, decode, encode, encodeUnsigned, from$7 as from, proofs, signatureDomain, signatureTypes };
|
|
1533
1581
|
}
|
|
1534
1582
|
/**
|
|
1535
1583
|
* A merkle tree of offers built from offer hashes.
|
|
@@ -1544,6 +1592,31 @@ type Proof = {
|
|
|
1544
1592
|
path: Hex[];
|
|
1545
1593
|
};
|
|
1546
1594
|
declare const VERSION$1 = 1;
|
|
1595
|
+
type SignatureDomain = {
|
|
1596
|
+
/** Chain id used in the EIP-712 domain. */chainId: number | bigint; /** MorphoV2 contract address used as verifying contract. */
|
|
1597
|
+
verifyingContract: Address;
|
|
1598
|
+
};
|
|
1599
|
+
/** Normalized Root signature domain (BigInt chain id, lowercase address). */
|
|
1600
|
+
type NormalizedSignatureDomain = {
|
|
1601
|
+
chainId: bigint;
|
|
1602
|
+
verifyingContract: Address;
|
|
1603
|
+
};
|
|
1604
|
+
/**
|
|
1605
|
+
* EIP-712 types for signing the tree root (Root(bytes32 root)).
|
|
1606
|
+
*/
|
|
1607
|
+
declare const signatureTypes: {
|
|
1608
|
+
readonly EIP712Domain: readonly [{
|
|
1609
|
+
readonly name: "chainId";
|
|
1610
|
+
readonly type: "uint256";
|
|
1611
|
+
}, {
|
|
1612
|
+
readonly name: "verifyingContract";
|
|
1613
|
+
readonly type: "address";
|
|
1614
|
+
}];
|
|
1615
|
+
readonly Root: readonly [{
|
|
1616
|
+
readonly name: "root";
|
|
1617
|
+
readonly type: "bytes32";
|
|
1618
|
+
}];
|
|
1619
|
+
};
|
|
1547
1620
|
/**
|
|
1548
1621
|
* Builds a Merkle tree from a list of offers.
|
|
1549
1622
|
*
|
|
@@ -1566,6 +1639,11 @@ declare const from$7: (offers: Offer[]) => Tree;
|
|
|
1566
1639
|
* @returns Array of proofs - {@link Proof}
|
|
1567
1640
|
*/
|
|
1568
1641
|
declare const proofs: (tree: Tree) => Proof[];
|
|
1642
|
+
/**
|
|
1643
|
+
* Normalizes a Root signature domain (BigInt chain id, lowercase address).
|
|
1644
|
+
* @throws {SignatureDomainError} When the domain is invalid.
|
|
1645
|
+
*/
|
|
1646
|
+
declare const signatureDomain: (domain: SignatureDomain) => NormalizedSignatureDomain;
|
|
1569
1647
|
/**
|
|
1570
1648
|
* Encodes a merkle tree with signature into hex calldata for onchain broadcast.
|
|
1571
1649
|
*
|
|
@@ -1573,15 +1651,21 @@ declare const proofs: (tree: Tree) => Proof[];
|
|
|
1573
1651
|
* - `{vv}`: 1-byte version (currently 0x01)
|
|
1574
1652
|
* - `{gzip([...offers])}`: gzipped JSON array of serialized offers
|
|
1575
1653
|
* - `{root}`: 32-byte merkle root
|
|
1576
|
-
* - `{signature}`: 65-byte EIP-
|
|
1654
|
+
* - `{signature}`: 65-byte EIP-712 signature over Root(bytes32 root)
|
|
1577
1655
|
*
|
|
1578
1656
|
* Validates signature authenticity and root integrity before encoding.
|
|
1579
1657
|
*
|
|
1580
1658
|
* @example
|
|
1581
1659
|
* ```typescript
|
|
1582
1660
|
* const tree = Tree.from(offers);
|
|
1583
|
-
* const signature = await wallet.
|
|
1584
|
-
*
|
|
1661
|
+
* const signature = await wallet.signTypedData({
|
|
1662
|
+
* account: wallet.account,
|
|
1663
|
+
* domain: Tree.signatureDomain({ chainId, verifyingContract }),
|
|
1664
|
+
* types: Tree.signatureTypes,
|
|
1665
|
+
* primaryType: "Root",
|
|
1666
|
+
* message: { root: tree.root },
|
|
1667
|
+
* });
|
|
1668
|
+
* const calldata = await Tree.encode(tree, signature, { chainId, verifyingContract });
|
|
1585
1669
|
* await broadcast(calldata);
|
|
1586
1670
|
* ```
|
|
1587
1671
|
*
|
|
@@ -1591,16 +1675,23 @@ declare const proofs: (tree: Tree) => Proof[];
|
|
|
1591
1675
|
* const tree = Tree.from(offers);
|
|
1592
1676
|
* const compressed = gzip(JSON.stringify(tree.offers.map(Offer.serialize)));
|
|
1593
1677
|
* const partial = `0x01${bytesToHex(compressed)}${tree.root.slice(2)}`;
|
|
1594
|
-
* const signature = await wallet.
|
|
1678
|
+
* const signature = await wallet.signTypedData({
|
|
1679
|
+
* account: wallet.account,
|
|
1680
|
+
* domain: Tree.signatureDomain({ chainId, verifyingContract }),
|
|
1681
|
+
* types: Tree.signatureTypes,
|
|
1682
|
+
* primaryType: "Root",
|
|
1683
|
+
* message: { root: tree.root },
|
|
1684
|
+
* });
|
|
1595
1685
|
* const calldata = `${partial}${signature.slice(2)}`;
|
|
1596
1686
|
* ```
|
|
1597
1687
|
*
|
|
1598
1688
|
* @param tree - Merkle tree of offers
|
|
1599
|
-
* @param signature - EIP-
|
|
1689
|
+
* @param signature - EIP-712 signature over Root(bytes32 root)
|
|
1690
|
+
* @param domain - EIP-712 domain with chain id and verifying contract
|
|
1600
1691
|
* @returns Hex-encoded calldata ready for onchain broadcast
|
|
1601
1692
|
* @throws {EncodeError} If signature verification fails or root mismatch
|
|
1602
1693
|
*/
|
|
1603
|
-
declare const encode: (tree: Tree, signature: Hex) => Promise<Hex>;
|
|
1694
|
+
declare const encode: (tree: Tree, signature: Hex, domain: SignatureDomain) => Promise<Hex>;
|
|
1604
1695
|
/**
|
|
1605
1696
|
* Encodes a merkle tree without a signature into hex payload for client-side signing.
|
|
1606
1697
|
*
|
|
@@ -1630,15 +1721,16 @@ declare const encodeUnsigned: (tree: Tree) => Hex;
|
|
|
1630
1721
|
*
|
|
1631
1722
|
* @example
|
|
1632
1723
|
* ```typescript
|
|
1633
|
-
* const { tree, signature, signer } = await Tree.decode(calldata);
|
|
1724
|
+
* const { tree, signature, signer } = await Tree.decode(calldata, { chainId, verifyingContract });
|
|
1634
1725
|
* console.log(`Tree signed by ${signer} with ${tree.offers.length} offers`);
|
|
1635
1726
|
* ```
|
|
1636
1727
|
*
|
|
1637
1728
|
* @param encoded - Hex calldata in format `0x{vv}{gzip}{root}{signature}`
|
|
1729
|
+
* @param domain - EIP-712 domain with chain id and verifying contract
|
|
1638
1730
|
* @returns Validated tree, signature, and recovered signer address
|
|
1639
1731
|
* @throws {DecodeError} If version invalid, signature invalid, or root mismatch
|
|
1640
1732
|
*/
|
|
1641
|
-
declare const decode: (encoded: Hex) => Promise<{
|
|
1733
|
+
declare const decode: (encoded: Hex, domain: SignatureDomain) => Promise<{
|
|
1642
1734
|
tree: Tree;
|
|
1643
1735
|
signature: Hex;
|
|
1644
1736
|
signer: Address;
|
|
@@ -1667,6 +1759,13 @@ declare class DecodeError extends BaseError {
|
|
|
1667
1759
|
name: string;
|
|
1668
1760
|
constructor(reason: string);
|
|
1669
1761
|
}
|
|
1762
|
+
/**
|
|
1763
|
+
* Error thrown when an invalid signature domain is supplied.
|
|
1764
|
+
*/
|
|
1765
|
+
declare class SignatureDomainError extends BaseError {
|
|
1766
|
+
name: string;
|
|
1767
|
+
constructor(reason: string);
|
|
1768
|
+
}
|
|
1670
1769
|
//#endregion
|
|
1671
1770
|
//#region src/indexer/collectors/Collector.d.ts
|
|
1672
1771
|
declare const names: readonly ["offers", "consumed_events", "positions", "prices"];
|
|
@@ -1800,7 +1899,7 @@ type Row = {
|
|
|
1800
1899
|
blockNumber: number;
|
|
1801
1900
|
};
|
|
1802
1901
|
type OffersDomain = {
|
|
1803
|
-
/**
|
|
1902
|
+
/** Insert offers (insert-only). */create: (batches: CreateBatch[]) => Promise<Hex[]>;
|
|
1804
1903
|
/** Delete multiple offers by hashes or block number greater than or equal to the given value on a given chain.
|
|
1805
1904
|
* @returns the number of offers deleted.
|
|
1806
1905
|
*/
|
|
@@ -1809,7 +1908,7 @@ type OffersDomain = {
|
|
|
1809
1908
|
} | {
|
|
1810
1909
|
blockNumberGte: number;
|
|
1811
1910
|
chainId: Id;
|
|
1812
|
-
}) => Promise<number>; /** Get
|
|
1911
|
+
}) => Promise<number>; /** Get offers with collaterals only (no availability/takeable computation). */
|
|
1813
1912
|
get: (parameters?: GetOffersParams) => Promise<{
|
|
1814
1913
|
rows: Row[];
|
|
1815
1914
|
nextCursor: string | null;
|
|
@@ -1873,6 +1972,35 @@ declare namespace getOffers$2 {
|
|
|
1873
1972
|
};
|
|
1874
1973
|
}
|
|
1875
1974
|
//#endregion
|
|
1975
|
+
//#region src/database/domains/Callbacks.d.ts
|
|
1976
|
+
type CallbackInput = {
|
|
1977
|
+
chainId: Id;
|
|
1978
|
+
contract: Address;
|
|
1979
|
+
user: Address;
|
|
1980
|
+
amount: bigint;
|
|
1981
|
+
};
|
|
1982
|
+
type OfferCallbacks = {
|
|
1983
|
+
offerHash: Hex;
|
|
1984
|
+
callbacks: CallbackInput[];
|
|
1985
|
+
};
|
|
1986
|
+
type CallbacksDomain = {
|
|
1987
|
+
/**
|
|
1988
|
+
* Upsert callbacks and their offer associations.
|
|
1989
|
+
* @param inputs - Callback associations grouped by offer hash. {@link OfferCallbacks}
|
|
1990
|
+
*/
|
|
1991
|
+
upsert: (inputs: OfferCallbacks[]) => Promise<void>;
|
|
1992
|
+
/**
|
|
1993
|
+
* Delete callback associations by offer hashes.
|
|
1994
|
+
* @param parameters - Offer hashes to delete. {@link DeleteParameters}
|
|
1995
|
+
* @returns Number of rows deleted. {@link DeleteReturnType}
|
|
1996
|
+
*/
|
|
1997
|
+
delete: (parameters: DeleteParameters) => Promise<DeleteReturnType>;
|
|
1998
|
+
};
|
|
1999
|
+
type DeleteParameters = {
|
|
2000
|
+
offers: Hex[];
|
|
2001
|
+
};
|
|
2002
|
+
type DeleteReturnType = number;
|
|
2003
|
+
//#endregion
|
|
1876
2004
|
//#region src/database/domains/Consumed.d.ts
|
|
1877
2005
|
type Event = {
|
|
1878
2006
|
id: string;
|
|
@@ -1890,6 +2018,22 @@ type ConsumedDomain = {
|
|
|
1890
2018
|
}) => Promise<number>;
|
|
1891
2019
|
};
|
|
1892
2020
|
//#endregion
|
|
2021
|
+
//#region src/database/domains/Groups.d.ts
|
|
2022
|
+
type GroupInput = {
|
|
2023
|
+
chainId: Id;
|
|
2024
|
+
maker: Address;
|
|
2025
|
+
group: Hex;
|
|
2026
|
+
blockNumber: number;
|
|
2027
|
+
consumed?: bigint;
|
|
2028
|
+
};
|
|
2029
|
+
type GroupsDomain = {
|
|
2030
|
+
/**
|
|
2031
|
+
* Insert groups (insert-only).
|
|
2032
|
+
* @param groups - Groups to insert. {@link GroupInput}
|
|
2033
|
+
*/
|
|
2034
|
+
create: (groups: GroupInput[]) => Promise<void>;
|
|
2035
|
+
};
|
|
2036
|
+
//#endregion
|
|
1893
2037
|
//#region src/database/domains/Lots.d.ts
|
|
1894
2038
|
type Lot = {
|
|
1895
2039
|
chainId: Id;
|
|
@@ -1934,6 +2078,15 @@ declare namespace get$3 {
|
|
|
1934
2078
|
}
|
|
1935
2079
|
declare function create$5(db: Core): LotsDomain;
|
|
1936
2080
|
//#endregion
|
|
2081
|
+
//#region src/database/domains/Obligations.d.ts
|
|
2082
|
+
type ObligationsDomain = {
|
|
2083
|
+
/**
|
|
2084
|
+
* Insert obligations (insert-only).
|
|
2085
|
+
* @param obligations - Obligations to insert. {@link Obligation.Obligation}
|
|
2086
|
+
*/
|
|
2087
|
+
create: (obligations: Obligation[]) => Promise<void>;
|
|
2088
|
+
};
|
|
2089
|
+
//#endregion
|
|
1937
2090
|
//#region src/database/domains/Offsets.d.ts
|
|
1938
2091
|
type Offset = {
|
|
1939
2092
|
chainId: Id;
|
|
@@ -2078,11 +2231,10 @@ type Attestation = {
|
|
|
2078
2231
|
type CreateInput = {
|
|
2079
2232
|
tree: Tree;
|
|
2080
2233
|
signature: Hex;
|
|
2081
|
-
blockNumber: number;
|
|
2082
2234
|
};
|
|
2083
2235
|
type TreesDomain = {
|
|
2084
2236
|
/**
|
|
2085
|
-
* Creates trees
|
|
2237
|
+
* Creates trees and attestation links in a single transaction.
|
|
2086
2238
|
*
|
|
2087
2239
|
* @param trees - Array of decoded trees with signatures (batch insertion)
|
|
2088
2240
|
* @returns Array of tree roots that were created/upserted
|
|
@@ -2128,9 +2280,12 @@ type Driver = ReturnType<typeof drizzle> | ReturnType<typeof drizzle$1>;
|
|
|
2128
2280
|
type Domains = {
|
|
2129
2281
|
book: BookDomain;
|
|
2130
2282
|
blocks: BlocksDomain;
|
|
2283
|
+
callbacks: CallbacksDomain;
|
|
2131
2284
|
offers: OffersDomain;
|
|
2132
2285
|
consumed: ConsumedDomain;
|
|
2286
|
+
groups: GroupsDomain;
|
|
2133
2287
|
lots: LotsDomain;
|
|
2288
|
+
obligations: ObligationsDomain;
|
|
2134
2289
|
offsets: OffsetsDomain;
|
|
2135
2290
|
oracles: OraclesDomain;
|
|
2136
2291
|
trees: TreesDomain;
|
|
@@ -2225,12 +2380,24 @@ declare function run<T, Name extends string, Rules extends readonly Rule<T, Name
|
|
|
2225
2380
|
}): Promise<Result<T, RuleNames<Rules>>>;
|
|
2226
2381
|
//#endregion
|
|
2227
2382
|
//#region src/gatekeeper/types.d.ts
|
|
2228
|
-
type
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2383
|
+
type ConfigRule = {
|
|
2384
|
+
type: "maturity";
|
|
2385
|
+
chain_id: Id;
|
|
2386
|
+
name: MaturityType;
|
|
2387
|
+
timestamp: Maturity;
|
|
2388
|
+
} | {
|
|
2389
|
+
type: "callback";
|
|
2390
|
+
chain_id: Id;
|
|
2391
|
+
address: Address;
|
|
2392
|
+
callback_type: Exclude<Type$1, Type$1.BuyWithEmptyCallback>;
|
|
2393
|
+
} | {
|
|
2394
|
+
type: "loan_token";
|
|
2395
|
+
chain_id: Id;
|
|
2396
|
+
address: Address;
|
|
2397
|
+
} | {
|
|
2398
|
+
type: "oracle";
|
|
2399
|
+
chain_id: Id;
|
|
2400
|
+
address: Address;
|
|
2234
2401
|
};
|
|
2235
2402
|
type ValidationIssue = {
|
|
2236
2403
|
index: number;
|
|
@@ -2245,9 +2412,21 @@ type ValidateOffersIssues = {
|
|
|
2245
2412
|
issues: ValidationIssue[];
|
|
2246
2413
|
};
|
|
2247
2414
|
type ValidateOffersData = ValidateOffersSuccess | ValidateOffersIssues;
|
|
2415
|
+
type CallbackType = Type$1 | "not_supported";
|
|
2416
|
+
type CallbackTypesRequest = {
|
|
2417
|
+
callbacks: Array<{
|
|
2418
|
+
chain_id: Id;
|
|
2419
|
+
addresses: Address[];
|
|
2420
|
+
}>;
|
|
2421
|
+
};
|
|
2422
|
+
type CallbackTypesResponse = Array<{
|
|
2423
|
+
chain_id: Id;
|
|
2424
|
+
} & Partial<Record<CallbackType, Address[]>>>;
|
|
2425
|
+
type ConfigRulesPayload = SuccessPayload<ConfigRule[]> | ErrorPayload;
|
|
2248
2426
|
type SuccessPayload<T> = {
|
|
2249
2427
|
meta: {
|
|
2250
2428
|
timestamp: string;
|
|
2429
|
+
checksum?: string;
|
|
2251
2430
|
};
|
|
2252
2431
|
cursor: string | null;
|
|
2253
2432
|
data: T;
|
|
@@ -2255,6 +2434,7 @@ type SuccessPayload<T> = {
|
|
|
2255
2434
|
type ErrorPayload = {
|
|
2256
2435
|
meta: {
|
|
2257
2436
|
timestamp: string;
|
|
2437
|
+
checksum?: string;
|
|
2258
2438
|
};
|
|
2259
2439
|
error: {
|
|
2260
2440
|
code: string;
|
|
@@ -2265,18 +2445,28 @@ type ErrorPayload = {
|
|
|
2265
2445
|
declare namespace Client_d_exports {
|
|
2266
2446
|
export { ClientConfig, GatekeeperClient, createHttpClient };
|
|
2267
2447
|
}
|
|
2268
|
-
type GatekeeperClient =
|
|
2448
|
+
type GatekeeperClient = {
|
|
2269
2449
|
/** Validate offers and return the raw response payload. */validate: (body: unknown) => Promise<{
|
|
2270
2450
|
statusCode: number;
|
|
2271
2451
|
body: unknown;
|
|
2452
|
+
}>; /** Get configured rules for supported chains. */
|
|
2453
|
+
getConfigRules: (query?: {
|
|
2454
|
+
cursor?: string;
|
|
2455
|
+
limit?: number | string;
|
|
2456
|
+
types?: Array<ConfigRule["type"]> | ConfigRule["type"];
|
|
2457
|
+
}) => Promise<{
|
|
2458
|
+
statusCode: number;
|
|
2459
|
+
body: ConfigRulesPayload;
|
|
2272
2460
|
}>; /** Validate offers and return decision results. */
|
|
2273
|
-
isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>; /**
|
|
2461
|
+
isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>; /** Resolve callback types for callback addresses. */
|
|
2462
|
+
getCallbackTypes: (request: CallbackTypesRequest) => Promise<CallbackTypesResponse>; /** Base URL for the gatekeeper service. */
|
|
2274
2463
|
baseUrl: string;
|
|
2275
2464
|
};
|
|
2276
2465
|
type ClientConfig = {
|
|
2277
2466
|
baseUrl: string;
|
|
2278
2467
|
timeoutMs?: number;
|
|
2279
2468
|
fetchFn?: typeof fetch;
|
|
2469
|
+
originSecret?: string;
|
|
2280
2470
|
};
|
|
2281
2471
|
/**
|
|
2282
2472
|
* Create an HTTP client for a gatekeeper service.
|
|
@@ -2528,7 +2718,7 @@ interface paths {
|
|
|
2528
2718
|
patch?: never;
|
|
2529
2719
|
trace?: never;
|
|
2530
2720
|
};
|
|
2531
|
-
"/v1/config": {
|
|
2721
|
+
"/v1/config/contracts": {
|
|
2532
2722
|
parameters: {
|
|
2533
2723
|
query?: never;
|
|
2534
2724
|
header?: never;
|
|
@@ -2536,12 +2726,28 @@ interface paths {
|
|
|
2536
2726
|
cookie?: never;
|
|
2537
2727
|
};
|
|
2538
2728
|
/**
|
|
2539
|
-
* Get
|
|
2540
|
-
* @description Returns
|
|
2729
|
+
* Get indexer contract configuration
|
|
2730
|
+
* @description Returns contract addresses used by indexers (mempool, v2) and multicall for indexed chains.
|
|
2541
2731
|
*/
|
|
2542
2732
|
get: {
|
|
2543
2733
|
parameters: {
|
|
2544
|
-
query?:
|
|
2734
|
+
query?: {
|
|
2735
|
+
/**
|
|
2736
|
+
* @description Filter by chain IDs (comma-separated).
|
|
2737
|
+
* @example 1,8453
|
|
2738
|
+
*/
|
|
2739
|
+
chains?: number[];
|
|
2740
|
+
/**
|
|
2741
|
+
* @description Maximum number of contracts to return (max 1000).
|
|
2742
|
+
* @example 1000
|
|
2743
|
+
*/
|
|
2744
|
+
limit?: number;
|
|
2745
|
+
/**
|
|
2746
|
+
* @description Pagination cursor in chain_id:address format (lowercase address).
|
|
2747
|
+
* @example 505050505:0xd946246695a9259f3b33a78629026f61b3ab40af
|
|
2748
|
+
*/
|
|
2749
|
+
cursor?: string;
|
|
2750
|
+
};
|
|
2545
2751
|
header?: never;
|
|
2546
2752
|
path?: never;
|
|
2547
2753
|
cookie?: never;
|
|
@@ -2553,7 +2759,66 @@ interface paths {
|
|
|
2553
2759
|
[name: string]: unknown;
|
|
2554
2760
|
};
|
|
2555
2761
|
content: {
|
|
2556
|
-
"application/json": components["schemas"]["
|
|
2762
|
+
"application/json": components["schemas"]["ConfigContractsSuccessResponse"];
|
|
2763
|
+
};
|
|
2764
|
+
};
|
|
2765
|
+
};
|
|
2766
|
+
};
|
|
2767
|
+
put?: never;
|
|
2768
|
+
post?: never;
|
|
2769
|
+
delete?: never;
|
|
2770
|
+
options?: never;
|
|
2771
|
+
head?: never;
|
|
2772
|
+
patch?: never;
|
|
2773
|
+
trace?: never;
|
|
2774
|
+
};
|
|
2775
|
+
"/v1/config/rules": {
|
|
2776
|
+
parameters: {
|
|
2777
|
+
query?: never;
|
|
2778
|
+
header?: never;
|
|
2779
|
+
path?: never;
|
|
2780
|
+
cookie?: never;
|
|
2781
|
+
};
|
|
2782
|
+
/**
|
|
2783
|
+
* Get config rules
|
|
2784
|
+
* @description Returns configured rules for supported chains.
|
|
2785
|
+
*/
|
|
2786
|
+
get: {
|
|
2787
|
+
parameters: {
|
|
2788
|
+
query?: {
|
|
2789
|
+
/**
|
|
2790
|
+
* @description Filter by chain IDs (comma-separated).
|
|
2791
|
+
* @example 1,8453
|
|
2792
|
+
*/
|
|
2793
|
+
chains?: number[];
|
|
2794
|
+
/**
|
|
2795
|
+
* @description Filter by rule types (comma-separated).
|
|
2796
|
+
* @example maturity,loan_token,oracle
|
|
2797
|
+
*/
|
|
2798
|
+
types?: string[];
|
|
2799
|
+
/**
|
|
2800
|
+
* @description Maximum number of rules to return (max 1000).
|
|
2801
|
+
* @example 100
|
|
2802
|
+
*/
|
|
2803
|
+
limit?: number;
|
|
2804
|
+
/**
|
|
2805
|
+
* @description Pagination cursor in type:chain_id:<value> format.
|
|
2806
|
+
* @example maturity:1:1730415600:end_of_next_month
|
|
2807
|
+
*/
|
|
2808
|
+
cursor?: string;
|
|
2809
|
+
};
|
|
2810
|
+
header?: never;
|
|
2811
|
+
path?: never;
|
|
2812
|
+
cookie?: never;
|
|
2813
|
+
};
|
|
2814
|
+
requestBody?: never;
|
|
2815
|
+
responses: {
|
|
2816
|
+
/** @description Success */200: {
|
|
2817
|
+
headers: {
|
|
2818
|
+
[name: string]: unknown;
|
|
2819
|
+
};
|
|
2820
|
+
content: {
|
|
2821
|
+
"application/json": components["schemas"]["ConfigRulesSuccessResponse"];
|
|
2557
2822
|
};
|
|
2558
2823
|
};
|
|
2559
2824
|
};
|
|
@@ -2974,15 +3239,6 @@ interface paths {
|
|
|
2974
3239
|
/**
|
|
2975
3240
|
* Validate offers
|
|
2976
3241
|
* @description Validates offers against router validation rules. Returns unsigned payload + root on success, or issues only on validation failure.
|
|
2977
|
-
*
|
|
2978
|
-
* **Available validation rules:**
|
|
2979
|
-
* - **parse_error**: Returns when an offer fails to parse due to invalid format or missing required fields
|
|
2980
|
-
* - **mixed_maker**: Validates that all offers in a batch have the same maker address
|
|
2981
|
-
* - **amount_mutual_exclusivity**: Validates that at most one of (assets, obligationUnits, obligationShares) is non-zero
|
|
2982
|
-
* - **chain_ids**: Validates that offer chain is one of: [109111114]
|
|
2983
|
-
* - **maturity**: Validates that offer maturity is one of: [end_of_month, end_of_next_month]
|
|
2984
|
-
* - **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]
|
|
2985
|
-
* - **token**: Validates that offer loan token and collateral tokens are in the allowed assets list for the offer chain
|
|
2986
3242
|
*/
|
|
2987
3243
|
post: {
|
|
2988
3244
|
parameters: {
|
|
@@ -3021,6 +3277,56 @@ interface paths {
|
|
|
3021
3277
|
patch?: never;
|
|
3022
3278
|
trace?: never;
|
|
3023
3279
|
};
|
|
3280
|
+
"/v1/callbacks": {
|
|
3281
|
+
parameters: {
|
|
3282
|
+
query?: never;
|
|
3283
|
+
header?: never;
|
|
3284
|
+
path?: never;
|
|
3285
|
+
cookie?: never;
|
|
3286
|
+
};
|
|
3287
|
+
get?: never;
|
|
3288
|
+
put?: never;
|
|
3289
|
+
/**
|
|
3290
|
+
* Resolve callback types
|
|
3291
|
+
* @description Returns callback types for callback addresses grouped by chain.
|
|
3292
|
+
*/
|
|
3293
|
+
post: {
|
|
3294
|
+
parameters: {
|
|
3295
|
+
query?: never;
|
|
3296
|
+
header?: never;
|
|
3297
|
+
path?: never;
|
|
3298
|
+
cookie?: never;
|
|
3299
|
+
};
|
|
3300
|
+
requestBody?: {
|
|
3301
|
+
content: {
|
|
3302
|
+
"application/json": components["schemas"]["CallbackTypesRequest"];
|
|
3303
|
+
};
|
|
3304
|
+
};
|
|
3305
|
+
responses: {
|
|
3306
|
+
/** @description Success */200: {
|
|
3307
|
+
headers: {
|
|
3308
|
+
[name: string]: unknown;
|
|
3309
|
+
};
|
|
3310
|
+
content: {
|
|
3311
|
+
"application/json": components["schemas"]["CallbackTypesSuccessResponse"];
|
|
3312
|
+
};
|
|
3313
|
+
}; /** @description Bad Request */
|
|
3314
|
+
400: {
|
|
3315
|
+
headers: {
|
|
3316
|
+
[name: string]: unknown;
|
|
3317
|
+
};
|
|
3318
|
+
content: {
|
|
3319
|
+
"application/json": components["schemas"]["BadRequestResponse"];
|
|
3320
|
+
};
|
|
3321
|
+
};
|
|
3322
|
+
};
|
|
3323
|
+
};
|
|
3324
|
+
delete?: never;
|
|
3325
|
+
options?: never;
|
|
3326
|
+
head?: never;
|
|
3327
|
+
patch?: never;
|
|
3328
|
+
trace?: never;
|
|
3329
|
+
};
|
|
3024
3330
|
}
|
|
3025
3331
|
interface components {
|
|
3026
3332
|
schemas: {
|
|
@@ -3058,42 +3364,90 @@ interface components {
|
|
|
3058
3364
|
*/
|
|
3059
3365
|
details: Record<string, never>;
|
|
3060
3366
|
};
|
|
3061
|
-
|
|
3367
|
+
ConfigContractsSuccessResponse: {
|
|
3062
3368
|
meta: components["schemas"]["Meta"]; /** @example null */
|
|
3063
3369
|
cursor: string | null;
|
|
3064
3370
|
/**
|
|
3065
|
-
* @description
|
|
3371
|
+
* @description Indexer contract configuration for all indexed chains.
|
|
3066
3372
|
* @example [
|
|
3067
3373
|
* {
|
|
3068
3374
|
* "chain_id": 505050505,
|
|
3069
|
-
* "
|
|
3070
|
-
*
|
|
3071
|
-
*
|
|
3072
|
-
*
|
|
3073
|
-
*
|
|
3074
|
-
*
|
|
3375
|
+
* "address": "0xD946246695A9259F3B33a78629026F61B3Ab40aF",
|
|
3376
|
+
* "name": "mempool"
|
|
3377
|
+
* },
|
|
3378
|
+
* {
|
|
3379
|
+
* "chain_id": 505050505,
|
|
3380
|
+
* "address": "0x8A409D5D6394fC197c596d4E6E2c35e5d13f8a4d",
|
|
3381
|
+
* "name": "multicall"
|
|
3382
|
+
* },
|
|
3383
|
+
* {
|
|
3384
|
+
* "chain_id": 505050505,
|
|
3385
|
+
* "address": "0x23DFBc4B8B80C14CC5e25011B8491f268395BAd6",
|
|
3386
|
+
* "name": "v2"
|
|
3075
3387
|
* }
|
|
3076
3388
|
* ]
|
|
3077
3389
|
*/
|
|
3078
|
-
data: components["schemas"]["
|
|
3390
|
+
data: components["schemas"]["ConfigContractResponse"][];
|
|
3079
3391
|
};
|
|
3080
|
-
|
|
3081
|
-
/** @example 505050505 */chain_id: number;
|
|
3082
|
-
|
|
3392
|
+
ConfigContractResponse: {
|
|
3393
|
+
/** @example 505050505 */chain_id: number; /** @example 0xD946246695A9259F3B33a78629026F61B3Ab40aF */
|
|
3394
|
+
address: string;
|
|
3083
3395
|
/**
|
|
3084
|
-
* @
|
|
3396
|
+
* @example mempool
|
|
3397
|
+
* @enum {string}
|
|
3398
|
+
*/
|
|
3399
|
+
name: "mempool" | "multicall" | "v2";
|
|
3400
|
+
};
|
|
3401
|
+
ConfigRulesSuccessResponse: {
|
|
3402
|
+
meta: components["schemas"]["ConfigRulesMeta"]; /** @example null */
|
|
3403
|
+
cursor: string | null;
|
|
3404
|
+
/**
|
|
3405
|
+
* @description Configured rules returned by the router API.
|
|
3085
3406
|
* @example [
|
|
3086
|
-
*
|
|
3407
|
+
* {
|
|
3408
|
+
* "type": "maturity",
|
|
3409
|
+
* "chain_id": 1,
|
|
3410
|
+
* "name": "end_of_next_month",
|
|
3411
|
+
* "timestamp": 1730415600
|
|
3412
|
+
* },
|
|
3413
|
+
* {
|
|
3414
|
+
* "type": "callback",
|
|
3415
|
+
* "chain_id": 1,
|
|
3416
|
+
* "address": "0x1111111111111111111111111111111111111111",
|
|
3417
|
+
* "callback_type": "sell_erc20_callback"
|
|
3418
|
+
* },
|
|
3419
|
+
* {
|
|
3420
|
+
* "type": "loan_token",
|
|
3421
|
+
* "chain_id": 1,
|
|
3422
|
+
* "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
|
|
3423
|
+
* },
|
|
3424
|
+
* {
|
|
3425
|
+
* "type": "oracle",
|
|
3426
|
+
* "chain_id": 1,
|
|
3427
|
+
* "address": "0xDddd770BADd886dF3864029e4B377B5F6a2B6b83"
|
|
3428
|
+
* }
|
|
3087
3429
|
* ]
|
|
3088
|
-
* @enum {string}
|
|
3089
3430
|
*/
|
|
3090
|
-
|
|
3431
|
+
data: components["schemas"]["ConfigRulesRuleResponse"][];
|
|
3432
|
+
};
|
|
3433
|
+
ConfigRulesMeta: {
|
|
3434
|
+
/** @example 2024-01-01T12:00:00.000Z */timestamp: string; /** @example f1d2d2f924e986ac86fdf7b36c94bcdf */
|
|
3435
|
+
checksum: string;
|
|
3091
3436
|
};
|
|
3092
|
-
|
|
3093
|
-
/** @example
|
|
3437
|
+
ConfigRulesRuleResponse: {
|
|
3438
|
+
/** @example maturity */type: string; /** @example 1 */
|
|
3439
|
+
chain_id: number; /** @example end_of_next_month */
|
|
3440
|
+
name?: string; /** @example 1730415600 */
|
|
3441
|
+
timestamp?: number; /** @example 0x1111111111111111111111111111111111111111 */
|
|
3442
|
+
address?: string; /** @example sell_erc20_callback */
|
|
3443
|
+
callback_type?: string;
|
|
3094
3444
|
};
|
|
3095
3445
|
OfferListResponse: {
|
|
3096
|
-
meta: components["schemas"]["Meta"];
|
|
3446
|
+
meta: components["schemas"]["Meta"];
|
|
3447
|
+
/**
|
|
3448
|
+
* @description Pagination cursor. Offer hash (0x...) for maker queries; base64url-encoded cursor for obligation queries.
|
|
3449
|
+
* @example eyJvZmZzZXQiOjEwMH0
|
|
3450
|
+
*/
|
|
3097
3451
|
cursor: string | null;
|
|
3098
3452
|
/**
|
|
3099
3453
|
* @description Offers matching the provided filters.
|
|
@@ -3432,6 +3786,84 @@ interface components {
|
|
|
3432
3786
|
*/
|
|
3433
3787
|
root: string;
|
|
3434
3788
|
};
|
|
3789
|
+
CallbackTypesRequest: {
|
|
3790
|
+
/**
|
|
3791
|
+
* @example [
|
|
3792
|
+
* {
|
|
3793
|
+
* "chain_id": 1,
|
|
3794
|
+
* "addresses": [
|
|
3795
|
+
* "0x1111111111111111111111111111111111111111",
|
|
3796
|
+
* "0x3333333333333333333333333333333333333333",
|
|
3797
|
+
* "0x9999999999999999999999999999999999999999"
|
|
3798
|
+
* ]
|
|
3799
|
+
* }
|
|
3800
|
+
* ]
|
|
3801
|
+
*/
|
|
3802
|
+
callbacks: components["schemas"]["CallbackTypesChainRequest"][];
|
|
3803
|
+
};
|
|
3804
|
+
CallbackTypesChainRequest: {
|
|
3805
|
+
/** @example 1 */chain_id: number;
|
|
3806
|
+
/**
|
|
3807
|
+
* @example [
|
|
3808
|
+
* "0x1111111111111111111111111111111111111111",
|
|
3809
|
+
* "0x3333333333333333333333333333333333333333",
|
|
3810
|
+
* "0x9999999999999999999999999999999999999999"
|
|
3811
|
+
* ]
|
|
3812
|
+
*/
|
|
3813
|
+
addresses: string[];
|
|
3814
|
+
};
|
|
3815
|
+
CallbackTypesSuccessResponse: {
|
|
3816
|
+
meta: components["schemas"]["Meta"]; /** @example maturity:1:1730415600:end_of_next_month */
|
|
3817
|
+
cursor: string | null;
|
|
3818
|
+
/**
|
|
3819
|
+
* @description Callback types grouped by chain.
|
|
3820
|
+
* @example [
|
|
3821
|
+
* {
|
|
3822
|
+
* "chain_id": 1,
|
|
3823
|
+
* "sell_erc20_callback": [
|
|
3824
|
+
* "0x1111111111111111111111111111111111111111"
|
|
3825
|
+
* ],
|
|
3826
|
+
* "buy_erc20": [
|
|
3827
|
+
* "0x5555555555555555555555555555555555555555"
|
|
3828
|
+
* ],
|
|
3829
|
+
* "buy_vault_v1_callback": [
|
|
3830
|
+
* "0x3333333333333333333333333333333333333333"
|
|
3831
|
+
* ],
|
|
3832
|
+
* "not_supported": [
|
|
3833
|
+
* "0x9999999999999999999999999999999999999999"
|
|
3834
|
+
* ]
|
|
3835
|
+
* }
|
|
3836
|
+
* ]
|
|
3837
|
+
*/
|
|
3838
|
+
data: components["schemas"]["CallbackTypesChainResponse"][];
|
|
3839
|
+
};
|
|
3840
|
+
CallbackTypesChainResponse: {
|
|
3841
|
+
/** @example 1 */chain_id: number;
|
|
3842
|
+
/**
|
|
3843
|
+
* @example [
|
|
3844
|
+
* "0x3333333333333333333333333333333333333333"
|
|
3845
|
+
* ]
|
|
3846
|
+
*/
|
|
3847
|
+
buy_vault_v1_callback?: string[];
|
|
3848
|
+
/**
|
|
3849
|
+
* @example [
|
|
3850
|
+
* "0x1111111111111111111111111111111111111111"
|
|
3851
|
+
* ]
|
|
3852
|
+
*/
|
|
3853
|
+
sell_erc20_callback?: string[];
|
|
3854
|
+
/**
|
|
3855
|
+
* @example [
|
|
3856
|
+
* "0x5555555555555555555555555555555555555555"
|
|
3857
|
+
* ]
|
|
3858
|
+
*/
|
|
3859
|
+
buy_erc20?: string[];
|
|
3860
|
+
/**
|
|
3861
|
+
* @example [
|
|
3862
|
+
* "0x9999999999999999999999999999999999999999"
|
|
3863
|
+
* ]
|
|
3864
|
+
*/
|
|
3865
|
+
not_supported: string[];
|
|
3866
|
+
};
|
|
3435
3867
|
};
|
|
3436
3868
|
responses: never;
|
|
3437
3869
|
parameters: never;
|
|
@@ -3500,6 +3932,9 @@ declare class BooksController {
|
|
|
3500
3932
|
declare class ValidateController {
|
|
3501
3933
|
validateOffers(): Promise<void>;
|
|
3502
3934
|
}
|
|
3935
|
+
declare class CallbacksController {
|
|
3936
|
+
resolveCallbackTypes(): Promise<void>;
|
|
3937
|
+
}
|
|
3503
3938
|
declare class OffersController {
|
|
3504
3939
|
getOffers(): Promise<void>;
|
|
3505
3940
|
}
|
|
@@ -3508,8 +3943,11 @@ declare class HealthController {
|
|
|
3508
3943
|
getCollectorsHealth(): Promise<void>;
|
|
3509
3944
|
getChainsHealth(): Promise<void>;
|
|
3510
3945
|
}
|
|
3511
|
-
declare class
|
|
3512
|
-
|
|
3946
|
+
declare class ConfigContractsController {
|
|
3947
|
+
getConfigContracts(): Promise<void>;
|
|
3948
|
+
}
|
|
3949
|
+
declare class ConfigRulesController {
|
|
3950
|
+
getConfigRules(): Promise<void>;
|
|
3513
3951
|
}
|
|
3514
3952
|
declare class ObligationsController {
|
|
3515
3953
|
getObligations(): Promise<void>;
|
|
@@ -3518,10 +3956,7 @@ declare class ObligationsController {
|
|
|
3518
3956
|
declare class UsersController {
|
|
3519
3957
|
getUserPositions(): Promise<void>;
|
|
3520
3958
|
}
|
|
3521
|
-
|
|
3522
|
-
rules?: RuleInfo[];
|
|
3523
|
-
};
|
|
3524
|
-
declare const OpenApi: (options?: OpenApiOptions) => Promise<OpenAPIDocument>;
|
|
3959
|
+
declare const OpenApi: () => Promise<OpenAPIDocument>;
|
|
3525
3960
|
declare namespace PositionResponse_d_exports {
|
|
3526
3961
|
export { PositionResponse, PositionWithReserved$1 as PositionWithReserved, from$1 as from };
|
|
3527
3962
|
}
|
|
@@ -3546,36 +3981,64 @@ declare const schemas: {
|
|
|
3546
3981
|
strict: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodEnum<{
|
|
3547
3982
|
0: "0";
|
|
3548
3983
|
1: "1";
|
|
3549
|
-
true: "true";
|
|
3550
3984
|
false: "false";
|
|
3551
|
-
|
|
3985
|
+
true: "true";
|
|
3986
|
+
}>, z$1.ZodTransform<boolean, "0" | "1" | "false" | "true">>>;
|
|
3552
3987
|
}, z$1.core.$strip>;
|
|
3553
3988
|
readonly get_health_collectors: z$1.ZodObject<{
|
|
3554
3989
|
strict: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodEnum<{
|
|
3555
3990
|
0: "0";
|
|
3556
3991
|
1: "1";
|
|
3557
|
-
true: "true";
|
|
3558
3992
|
false: "false";
|
|
3559
|
-
|
|
3993
|
+
true: "true";
|
|
3994
|
+
}>, z$1.ZodTransform<boolean, "0" | "1" | "false" | "true">>>;
|
|
3560
3995
|
}, z$1.core.$strip>;
|
|
3561
3996
|
readonly get_health_chains: z$1.ZodObject<{
|
|
3562
3997
|
strict: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodEnum<{
|
|
3563
3998
|
0: "0";
|
|
3564
3999
|
1: "1";
|
|
3565
|
-
true: "true";
|
|
3566
4000
|
false: "false";
|
|
3567
|
-
|
|
4001
|
+
true: "true";
|
|
4002
|
+
}>, z$1.ZodTransform<boolean, "0" | "1" | "false" | "true">>>;
|
|
3568
4003
|
}, z$1.core.$strip>;
|
|
3569
|
-
readonly
|
|
4004
|
+
readonly get_config_contracts: z$1.ZodObject<{
|
|
4005
|
+
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
4006
|
+
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
4007
|
+
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>>>>>;
|
|
4008
|
+
}, z$1.core.$strip>;
|
|
4009
|
+
readonly get_config_rules: z$1.ZodObject<{
|
|
4010
|
+
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
4011
|
+
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
4012
|
+
types: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodEnum<{
|
|
4013
|
+
loan_token: "loan_token";
|
|
4014
|
+
maturity: "maturity";
|
|
4015
|
+
callback: "callback";
|
|
4016
|
+
oracle: "oracle";
|
|
4017
|
+
}>>>>;
|
|
4018
|
+
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>>>>>;
|
|
4019
|
+
}, z$1.core.$strip>;
|
|
4020
|
+
readonly get_offers: z$1.ZodPipe<z$1.ZodObject<{
|
|
4021
|
+
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
4022
|
+
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
3570
4023
|
side: z$1.ZodOptional<z$1.ZodEnum<{
|
|
3571
4024
|
buy: "buy";
|
|
3572
4025
|
sell: "sell";
|
|
3573
4026
|
}>>;
|
|
3574
4027
|
obligation_id: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
3575
4028
|
maker: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
3576
|
-
|
|
3577
|
-
limit:
|
|
3578
|
-
|
|
4029
|
+
}, z$1.core.$strip>, z$1.ZodTransform<{
|
|
4030
|
+
limit: number;
|
|
4031
|
+
cursor?: string | undefined;
|
|
4032
|
+
side?: "buy" | "sell" | undefined;
|
|
4033
|
+
obligation_id?: `0x${string}` | undefined;
|
|
4034
|
+
maker?: `0x${string}` | undefined;
|
|
4035
|
+
}, {
|
|
4036
|
+
limit: number;
|
|
4037
|
+
cursor?: string | undefined;
|
|
4038
|
+
side?: "buy" | "sell" | undefined;
|
|
4039
|
+
obligation_id?: `0x${string}` | undefined;
|
|
4040
|
+
maker?: `0x${string}` | undefined;
|
|
4041
|
+
}>>;
|
|
3579
4042
|
readonly get_obligations: z$1.ZodObject<{
|
|
3580
4043
|
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
3581
4044
|
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>>>>>;
|
|
@@ -3599,6 +4062,12 @@ declare const schemas: {
|
|
|
3599
4062
|
readonly validate_offers: z$1.ZodObject<{
|
|
3600
4063
|
offers: z$1.ZodArray<z$1.ZodUnknown>;
|
|
3601
4064
|
}, z$1.core.$strict>;
|
|
4065
|
+
readonly callback_types: z$1.ZodObject<{
|
|
4066
|
+
callbacks: z$1.ZodArray<z$1.ZodObject<{
|
|
4067
|
+
chain_id: z$1.ZodNumber;
|
|
4068
|
+
addresses: z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
4069
|
+
}, z$1.core.$strict>>;
|
|
4070
|
+
}, z$1.core.$strict>;
|
|
3602
4071
|
readonly get_user_positions: z$1.ZodObject<{
|
|
3603
4072
|
user_address: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
3604
4073
|
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
@@ -3620,6 +4089,7 @@ declare enum STATUS_CODE {
|
|
|
3620
4089
|
}
|
|
3621
4090
|
type Meta = {
|
|
3622
4091
|
timestamp: string;
|
|
4092
|
+
checksum?: string;
|
|
3623
4093
|
};
|
|
3624
4094
|
type ErrorDetail = {
|
|
3625
4095
|
code: APIErrorCode;
|
|
@@ -3646,42 +4116,42 @@ type Payload<T> = SuccessPayload$1<T> | ErrorPayload$1;
|
|
|
3646
4116
|
//#region src/api/Controllers/getBook.d.ts
|
|
3647
4117
|
declare function getBook(params: object, db: Database): Promise<Payload<BookLevelResponse[]>>;
|
|
3648
4118
|
//#endregion
|
|
3649
|
-
//#region src/api/Controllers/
|
|
3650
|
-
|
|
4119
|
+
//#region src/api/Controllers/getConfigContracts.d.ts
|
|
4120
|
+
declare const CONFIG_CONTRACT_NAMES: readonly ["mempool", "multicall", "v2"];
|
|
4121
|
+
type ConfigContractName = (typeof CONFIG_CONTRACT_NAMES)[number];
|
|
4122
|
+
type ConfigContract = {
|
|
3651
4123
|
chain_id: Id;
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
};
|
|
3655
|
-
callbacks: string[];
|
|
4124
|
+
address: Address;
|
|
4125
|
+
name: ConfigContractName;
|
|
3656
4126
|
};
|
|
3657
4127
|
/**
|
|
3658
|
-
* Returns
|
|
4128
|
+
* Returns contract addresses used by indexers (mempool, v2) plus multicall per chain.
|
|
4129
|
+
* @param query - Raw query parameters containing optional chain filters.
|
|
3659
4130
|
* @param chainRegistry - The chain registry instance. {@link ChainRegistry.ChainRegistry}
|
|
3660
|
-
* @returns The
|
|
4131
|
+
* @returns The indexer contract configuration. {@link ApiPayload.Payload<ConfigContract[]>}
|
|
3661
4132
|
*/
|
|
3662
|
-
declare function
|
|
4133
|
+
declare function getConfigContracts(query: unknown, chainRegistry: ChainRegistry): Promise<Payload<ConfigContract[]>>;
|
|
4134
|
+
//#endregion
|
|
4135
|
+
//#region src/api/Controllers/getConfigRules.d.ts
|
|
4136
|
+
/**
|
|
4137
|
+
* Returns configured rules for the configured chains.
|
|
4138
|
+
* @param query - Raw query parameters containing filters/cursor/limit.
|
|
4139
|
+
* @param chains - Chains to include in the configured rules.
|
|
4140
|
+
* @returns Config rules response payload. {@link ApiPayload.Payload}
|
|
4141
|
+
*/
|
|
4142
|
+
declare function getConfigRules(query: unknown, chains: Chain$1[]): Promise<Payload<ConfigRule[]>>;
|
|
3663
4143
|
//#endregion
|
|
3664
4144
|
//#region src/api/Controllers/getDocs.d.ts
|
|
3665
4145
|
/**
|
|
3666
4146
|
* Build the OpenAPI document for the router.
|
|
3667
|
-
* @param parameters - Includes a {@link RulesProvider} to fetch gatekeeper rules.
|
|
3668
4147
|
* @returns OpenAPI document. {@link OpenAPIDocument}
|
|
3669
4148
|
*/
|
|
3670
|
-
declare function getSwaggerJson(
|
|
3671
|
-
gatekeeper
|
|
3672
|
-
}: {
|
|
3673
|
-
gatekeeper: RulesProvider;
|
|
3674
|
-
}): Promise<OpenAPIDocument>;
|
|
4149
|
+
declare function getSwaggerJson(): Promise<OpenAPIDocument>;
|
|
3675
4150
|
/**
|
|
3676
4151
|
* Render the API documentation HTML page.
|
|
3677
|
-
* @param parameters - Includes a {@link RulesProvider} to fetch gatekeeper rules.
|
|
3678
4152
|
* @returns HTML page as string.
|
|
3679
4153
|
*/
|
|
3680
|
-
declare function getDocsHtml(
|
|
3681
|
-
gatekeeper
|
|
3682
|
-
}: {
|
|
3683
|
-
gatekeeper: RulesProvider;
|
|
3684
|
-
}): Promise<string>;
|
|
4154
|
+
declare function getDocsHtml(): Promise<string>;
|
|
3685
4155
|
/**
|
|
3686
4156
|
* Renders the integrator documentation as HTML.
|
|
3687
4157
|
* @returns HTML page with the rendered markdown documentation.
|
|
@@ -3700,6 +4170,21 @@ declare function getObligation(params: object, db: Database): Promise<Payload<Ob
|
|
|
3700
4170
|
declare function getObligations$1(queryParameters: object, db: Database): Promise<Payload<ObligationResponse[]>>;
|
|
3701
4171
|
//#endregion
|
|
3702
4172
|
//#region src/api/Controllers/getOffers.d.ts
|
|
4173
|
+
type GetOffersQueryParams = {
|
|
4174
|
+
/** Filter by maker address */maker?: Address; /** Cursor string returned by a previous call, for pagination */
|
|
4175
|
+
cursor?: string; /** Page size; defaults to {@link OffersDomain.DEFAULT_LIMIT} */
|
|
4176
|
+
limit?: number;
|
|
4177
|
+
};
|
|
4178
|
+
/**
|
|
4179
|
+
* Query offers with computed consumed/available/takeable values.
|
|
4180
|
+
* @param db - The database client. {@link Database.Core}
|
|
4181
|
+
* @param parameters - {@link GetOffersQueryParams}
|
|
4182
|
+
* @returns The offers with pagination cursor.
|
|
4183
|
+
*/
|
|
4184
|
+
declare function getOffersQuery(db: Core, parameters?: GetOffersQueryParams): Promise<{
|
|
4185
|
+
rows: Row[];
|
|
4186
|
+
nextCursor: string | null;
|
|
4187
|
+
}>;
|
|
3703
4188
|
declare function getOffers$1(queryParameters: object, db: Database): Promise<Payload<OfferResponse[]>>;
|
|
3704
4189
|
//#endregion
|
|
3705
4190
|
//#region src/api/Controllers/getUserPositions.d.ts
|
|
@@ -3710,13 +4195,22 @@ declare function getOffers$1(queryParameters: object, db: Database): Promise<Pay
|
|
|
3710
4195
|
* @returns Paginated list of positions with remaining balances.
|
|
3711
4196
|
*/
|
|
3712
4197
|
declare function getUserPositions(queryParameters: object, db: Database): Promise<Payload<PositionResponse[]>>;
|
|
4198
|
+
//#endregion
|
|
4199
|
+
//#region src/api/Controllers/resolveCallbackTypes.d.ts
|
|
4200
|
+
type CallbackTypesPayload = SuccessPayload$1<CallbackTypesResponse>;
|
|
4201
|
+
/**
|
|
4202
|
+
* Resolve callback types for a list of callback addresses grouped by chain.
|
|
4203
|
+
* @param body - Request body with callback addresses. {@link CallbackTypesRequest}
|
|
4204
|
+
* @param chains - Chains to resolve callback types against. {@link Chain.Chain}
|
|
4205
|
+
* @returns Callback types grouped by chain. {@link CallbackTypesPayload}
|
|
4206
|
+
*/
|
|
4207
|
+
declare function resolveCallbackTypes(body: object, chains: Chain$1[]): Promise<CallbackTypesPayload | ErrorPayload$1>;
|
|
3713
4208
|
declare namespace Gatekeeper_d_exports {
|
|
3714
4209
|
export { Gatekeeper, Rules, create };
|
|
3715
4210
|
}
|
|
3716
4211
|
type Rules = readonly Rule<Offer, string>[];
|
|
3717
4212
|
type Gatekeeper = {
|
|
3718
4213
|
isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>;
|
|
3719
|
-
getRules: () => Promise<RuleInfo[]>;
|
|
3720
4214
|
};
|
|
3721
4215
|
type GatekeeperParameters = {
|
|
3722
4216
|
rules: Rules;
|
|
@@ -3744,10 +4238,10 @@ type ValidateOffersIssuesPayload = SuccessPayload$1<{
|
|
|
3744
4238
|
type ValidateOffersResponse = ValidateOffersSuccessPayload | ValidateOffersIssuesPayload;
|
|
3745
4239
|
declare function validateOffers(body: object, gatekeeper: Gatekeeper): Promise<ValidateOffersResponse | ErrorPayload$1>;
|
|
3746
4240
|
declare namespace index_d_exports$4 {
|
|
3747
|
-
export {
|
|
4241
|
+
export { CONFIG_CONTRACT_NAMES, ConfigContract, ConfigContractName, GetOffersQueryParams, ValidationIssue$1 as ValidationIssue, getBook, getConfigContracts, getConfigRules, getDocsHtml, getHealth, getHealthChains, getHealthCollectors, getIntegratorDocsHtml, getObligation, getObligations$1 as getObligations, getOffers$1 as getOffers, getOffersQuery, getSwaggerJson, getUserPositions, resolveCallbackTypes, validateOffers };
|
|
3748
4242
|
}
|
|
3749
4243
|
declare namespace RouterApi_d_exports {
|
|
3750
|
-
export { ApiConfig, BookResponse_d_exports as BookResponse, BooksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse,
|
|
4244
|
+
export { ApiConfig, BookResponse_d_exports as BookResponse, BooksController, CallbacksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse, ConfigContractsController, ConfigRulesController, index_d_exports$4 as Controllers, HealthController, ObligationResponse_d_exports as ObligationResponse, ObligationsController, OfferResponse_d_exports as OfferResponse, OffersController, OpenApi, PositionResponse_d_exports as PositionResponse, RouterApi, RouterStatusResponse, UsersController, ValidateController, create$1 as create, from$5 as from, parse, safeParse };
|
|
3751
4245
|
}
|
|
3752
4246
|
declare namespace Client_d_exports$1 {
|
|
3753
4247
|
export { Client$3 as Client, ConnectOptions, HttpForbiddenError, HttpGetApiFailedError, HttpRateLimitError, HttpUnauthorizedError, InvalidUrlError, connect$1 as connect, getObligations, getOffers };
|
|
@@ -4332,23 +4826,6 @@ declare const obligationCollateralsV2: drizzle_orm_pg_core0.PgTableWithColumns<{
|
|
|
4332
4826
|
identity: undefined;
|
|
4333
4827
|
generated: undefined;
|
|
4334
4828
|
}, {}, {}>;
|
|
4335
|
-
blockNumber: drizzle_orm_pg_core0.PgColumn<{
|
|
4336
|
-
name: "block_number";
|
|
4337
|
-
tableName: EnumTableName.OBLIGATION_COLLATERALS_V2;
|
|
4338
|
-
dataType: "number";
|
|
4339
|
-
columnType: "PgBigInt53";
|
|
4340
|
-
data: number;
|
|
4341
|
-
driverParam: string | number;
|
|
4342
|
-
notNull: true;
|
|
4343
|
-
hasDefault: false;
|
|
4344
|
-
isPrimaryKey: false;
|
|
4345
|
-
isAutoincrement: false;
|
|
4346
|
-
hasRuntimeDefault: false;
|
|
4347
|
-
enumValues: undefined;
|
|
4348
|
-
baseColumn: never;
|
|
4349
|
-
identity: undefined;
|
|
4350
|
-
generated: undefined;
|
|
4351
|
-
}, {}, {}>;
|
|
4352
4829
|
updatedAt: drizzle_orm_pg_core0.PgColumn<{
|
|
4353
4830
|
name: "updated_at";
|
|
4354
4831
|
tableName: EnumTableName.OBLIGATION_COLLATERALS_V2;
|
|
@@ -5919,63 +6396,11 @@ declare const merklePaths: drizzle_orm_pg_core0.PgTableWithColumns<{
|
|
|
5919
6396
|
declare namespace index_d_exports$2 {
|
|
5920
6397
|
export { PositionTypes, StatusCode, TABLE_NAMES, TableName, VERSION, VERSIONED_TABLE_NAMES, VersionedTableName, callbacks$1 as callbacks, chains$1 as chains, collectors, consumedEvents, groups, lots, merklePaths, obligationCollateralsV2, obligations, offers, offersCallbacks, offsets, oracles, positionTypes, positions, status, transfers, trees, validations };
|
|
5921
6398
|
}
|
|
5922
|
-
declare namespace GateConfig_d_exports {
|
|
5923
|
-
export { CallbackConfig, GateConfig, assets, configs, getCallback, getCallbackAddresses, getCallbackType, getCallbackTypeAddresses };
|
|
5924
|
-
}
|
|
5925
|
-
type GateConfig = {
|
|
5926
|
-
callbacks?: CallbackConfig[];
|
|
5927
|
-
maturities?: MaturityType[];
|
|
5928
|
-
};
|
|
5929
|
-
type CallbackConfig = {
|
|
5930
|
-
type: Type$1.BuyVaultV1Callback;
|
|
5931
|
-
addresses: Address[];
|
|
5932
|
-
vaultFactories: Address[];
|
|
5933
|
-
} | {
|
|
5934
|
-
type: Type$1.SellERC20Callback;
|
|
5935
|
-
addresses: Address[];
|
|
5936
|
-
} | {
|
|
5937
|
-
type: Type$1.BuyWithEmptyCallback;
|
|
5938
|
-
};
|
|
5939
|
-
declare function getCallback(chain: Name$1, type: Type$1.BuyVaultV1Callback): Extract<CallbackConfig, {
|
|
5940
|
-
type: Type$1.BuyVaultV1Callback;
|
|
5941
|
-
}> | undefined;
|
|
5942
|
-
declare function getCallback(chain: Name$1, type: Type$1.SellERC20Callback): Extract<CallbackConfig, {
|
|
5943
|
-
type: Type$1.SellERC20Callback;
|
|
5944
|
-
}> | undefined;
|
|
5945
|
-
declare function getCallback(chain: Name$1, type: Type$1.BuyWithEmptyCallback): Extract<CallbackConfig, {
|
|
5946
|
-
type: Type$1.BuyWithEmptyCallback;
|
|
5947
|
-
}> | undefined;
|
|
5948
|
-
declare function getCallback(chain: Name$1, type: Type$1): CallbackConfig | undefined;
|
|
5949
|
-
/**
|
|
5950
|
-
* Attempts to infer the configured callback type from a callback address on a chain.
|
|
5951
|
-
* Skips the empty callback type as it does not carry addresses.
|
|
5952
|
-
*
|
|
5953
|
-
* @param chain - Chain name for which to infer the callback type
|
|
5954
|
-
* @param address - Callback contract address
|
|
5955
|
-
* @returns The callback type when found, otherwise undefined
|
|
5956
|
-
*/
|
|
5957
|
-
declare function getCallbackType(chain: Name$1, address: Address): Type$1.BuyWithEmptyCallback | Type$1.BuyVaultV1Callback | Type$1.SellERC20Callback | undefined;
|
|
5958
|
-
/**
|
|
5959
|
-
* Returns the callback addresses for a given chain and callback type, if it exists.
|
|
5960
|
-
* @param chain - Chain name for which to read the validation configuration
|
|
5961
|
-
* @param type - Callback type to retrieve
|
|
5962
|
-
* @returns The matching callback addresses or an empty array if not configured
|
|
5963
|
-
*/
|
|
5964
|
-
declare function getCallbackTypeAddresses(chain: Name$1, type: Type$1): Address[];
|
|
5965
|
-
/**
|
|
5966
|
-
* Returns the list of allowed non-empty callback addresses for a chain.
|
|
5967
|
-
*
|
|
5968
|
-
* @param chain - Chain name
|
|
5969
|
-
* @returns Array of allowed callback addresses (lowercased). Empty when none configured
|
|
5970
|
-
*/
|
|
5971
|
-
declare const getCallbackAddresses: (chain: Name$1) => Address[];
|
|
5972
|
-
declare const assets: Record<string, Address[]>;
|
|
5973
|
-
declare const configs: Record<Name$1, GateConfig>;
|
|
5974
6399
|
//#endregion
|
|
5975
6400
|
//#region src/gatekeeper/morphoRules.d.ts
|
|
5976
|
-
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">)[];
|
|
6401
|
+
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">)[];
|
|
5977
6402
|
declare namespace Rules_d_exports {
|
|
5978
|
-
export { ValidityParameters, amountMutualExclusivity, callback, chains, maturity, sameMaker, token, validity };
|
|
6403
|
+
export { ValidityParameters, amountMutualExclusivity, callback, chains, maturity, oracle, sameMaker, token, validity };
|
|
5979
6404
|
}
|
|
5980
6405
|
type ValidityParameters = {
|
|
5981
6406
|
client: PublicClient<Transport, Chain$1>;
|
|
@@ -6014,6 +6439,16 @@ declare const token: ({
|
|
|
6014
6439
|
}: {
|
|
6015
6440
|
assetsByChainId: Partial<Record<Id, Address[]>>;
|
|
6016
6441
|
}) => Rule<Offer, "token">;
|
|
6442
|
+
/**
|
|
6443
|
+
* A validation rule that checks if the offer's oracle addresses are allowed for its chain.
|
|
6444
|
+
* @param oraclesByChainId - Allowed oracles indexed by chain id.
|
|
6445
|
+
* @returns The issue that was found. If the offer is valid, this will be undefined.
|
|
6446
|
+
*/
|
|
6447
|
+
declare const oracle: ({
|
|
6448
|
+
oraclesByChainId
|
|
6449
|
+
}: {
|
|
6450
|
+
oraclesByChainId: Partial<Record<Id, Address[]>>;
|
|
6451
|
+
}) => Rule<Offer, "oracle">;
|
|
6017
6452
|
/**
|
|
6018
6453
|
* A batch validation rule that ensures all offers in a tree have the same maker address.
|
|
6019
6454
|
* Returns an issue only for the first non-conforming offer.
|
|
@@ -6031,13 +6466,15 @@ declare const amountMutualExclusivity: () => Rule<Offer, "amount_mutual_exclusiv
|
|
|
6031
6466
|
type MempoolEVMClientConfig = {
|
|
6032
6467
|
readonly client: WalletClient;
|
|
6033
6468
|
readonly mempoolAddress: Address;
|
|
6469
|
+
readonly morphoAddress?: Address;
|
|
6034
6470
|
readonly blockWindow?: number;
|
|
6035
6471
|
};
|
|
6036
6472
|
declare function from(parameters: from.Parameters): from.ReturnType;
|
|
6037
6473
|
declare namespace from {
|
|
6038
6474
|
type Parameters = {
|
|
6039
6475
|
/** The viem client to use. */client: WalletClient; /** The mempool address. */
|
|
6040
|
-
mempoolAddress: Address; /** The
|
|
6476
|
+
mempoolAddress: Address; /** The MorphoV2 contract address used for signature verification. */
|
|
6477
|
+
morphoAddress?: Address; /** The block window to use for the mempool. Defaults to 100. */
|
|
6041
6478
|
blockWindow?: number;
|
|
6042
6479
|
};
|
|
6043
6480
|
type ReturnType = Client$2;
|
|
@@ -6052,7 +6489,7 @@ declare namespace from {
|
|
|
6052
6489
|
*/
|
|
6053
6490
|
declare function add(config: MempoolEVMClientConfig, offers: AddParameters): Promise<Hex>;
|
|
6054
6491
|
declare namespace add {
|
|
6055
|
-
type ErrorType = WalletAccountNotSetError | ViemClientError | InvalidOfferError | ChainIdMismatchError;
|
|
6492
|
+
type ErrorType = WalletAccountNotSetError | ViemClientError | InvalidOfferError | ChainIdMismatchError | MissingMorphoAddressError;
|
|
6056
6493
|
}
|
|
6057
6494
|
declare function get(config: MempoolEVMClientConfig, parameters?: GetParameters): AsyncGenerator<{
|
|
6058
6495
|
offers: Offer[];
|
|
@@ -6061,7 +6498,7 @@ declare function get(config: MempoolEVMClientConfig, parameters?: GetParameters)
|
|
|
6061
6498
|
declare namespace get {
|
|
6062
6499
|
type ErrorType = streamOffersReturnType;
|
|
6063
6500
|
}
|
|
6064
|
-
type streamOffersReturnType = WalletAccountNotSetError | ChainIdMismatchError;
|
|
6501
|
+
type streamOffersReturnType = WalletAccountNotSetError | ChainIdMismatchError | MissingMorphoAddressError;
|
|
6065
6502
|
declare class WalletAccountNotSetError extends BaseError {
|
|
6066
6503
|
name: string;
|
|
6067
6504
|
constructor();
|
|
@@ -6073,6 +6510,10 @@ declare class ChainIdMismatchError extends BaseError {
|
|
|
6073
6510
|
name: string;
|
|
6074
6511
|
constructor(expected: Id, actual: Id);
|
|
6075
6512
|
}
|
|
6513
|
+
declare class MissingMorphoAddressError extends BaseError {
|
|
6514
|
+
name: string;
|
|
6515
|
+
constructor();
|
|
6516
|
+
}
|
|
6076
6517
|
//#endregion
|
|
6077
6518
|
//#region src/mempool/MempoolClient.d.ts
|
|
6078
6519
|
type AddParameters = Compute<Omit<Offer, "createdAt">[]>;
|
|
@@ -6119,7 +6560,7 @@ declare namespace connect {
|
|
|
6119
6560
|
type ErrorType = from.ErrorType;
|
|
6120
6561
|
}
|
|
6121
6562
|
declare namespace index_d_exports$1 {
|
|
6122
|
-
export { AddParameters, ChainIdMismatchError, Client$2 as Client, GetParameters, ViemClientError, WalletAccountNotSetError, add, connect, from, get };
|
|
6563
|
+
export { AddParameters, ChainIdMismatchError, Client$2 as Client, GetParameters, MissingMorphoAddressError, ViemClientError, WalletAccountNotSetError, add, connect, from, get };
|
|
6123
6564
|
}
|
|
6124
6565
|
//#endregion
|
|
6125
6566
|
//#region src/utils/BigMath.d.ts
|
|
@@ -6254,5 +6695,5 @@ declare namespace index_d_exports$3 {
|
|
|
6254
6695
|
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 };
|
|
6255
6696
|
}
|
|
6256
6697
|
//#endregion
|
|
6257
|
-
export { index_d_exports as Abi, BookResponse_d_exports as BookResponse, BooksController, Brand, BrandTypeId, Callback_d_exports as Callback, Chain_d_exports as Chain, ChainHealth, ChainRegistry_d_exports as ChainRegistry, ChainsHealthResponse, Collateral_d_exports as Collateral, CollectorHealth, CollectorsHealthResponse, Compute,
|
|
6698
|
+
export { index_d_exports as Abi, BookResponse_d_exports as BookResponse, BooksController, Brand, BrandTypeId, Callback_d_exports as Callback, CallbackType, CallbackTypesRequest, CallbackTypesResponse, CallbacksController, Chain_d_exports as Chain, ChainHealth, ChainRegistry_d_exports as ChainRegistry, ChainsHealthResponse, Collateral_d_exports as Collateral, CollectorHealth, CollectorsHealthResponse, Compute, ConfigContractsController, ConfigRule, ConfigRulesController, ConfigRulesPayload, Database_d_exports as Database, 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, Health_d_exports as Health, HealthController, Indexer_d_exports as Indexer, LLTV_d_exports as LLTV, Liquidity_d_exports as Liquidity, Logger_d_exports as Logger, Maturity_d_exports as Maturity, index_d_exports$1 as Mempool, Obligation_d_exports as Obligation, ObligationResponse_d_exports as ObligationResponse, ObligationsController, Offer_d_exports as Offer, OfferResponse_d_exports as OfferResponse, OffersController, index_d_exports$2 as OffersSchema, OpenApi, Oracle_d_exports as Oracle, Position_d_exports as Position, PositionResponse_d_exports as PositionResponse, Quote_d_exports as Quote, RouterApi_d_exports as RouterApi, Client_d_exports$1 as RouterClient, RouterStatusResponse, 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, UsersController, index_d_exports$3 as Utils, ValidateController, ValidateOffersData, ValidateOffersIssues, ValidateOffersSuccess, Gate_d_exports as Validation, ValidationIssue, morphoRules, parse, safeParse };
|
|
6258
6699
|
//# sourceMappingURL=index.node.d.ts.map
|