@morpho-dev/router 0.8.0 → 0.10.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 +2417 -975
- package/dist/drizzle/migrations/0026_add-receiver-if-maker-is-seller.sql +1 -0
- package/dist/drizzle/migrations/0027_debt-to-transfers.sql +239 -0
- package/dist/drizzle/migrations/0028_obligation_id_and_keys.sql +247 -0
- package/dist/drizzle/migrations/0029_collateral-positions.sql +248 -0
- package/dist/drizzle/migrations/0030_remove_chain_id_from_offer.sql +37 -0
- package/dist/drizzle/migrations/meta/0026_snapshot.json +1454 -0
- package/dist/drizzle/migrations/meta/0027_snapshot.json +1581 -0
- package/dist/drizzle/migrations/meta/0028_snapshot.json +1632 -0
- package/dist/drizzle/migrations/meta/0029_snapshot.json +1619 -0
- package/dist/drizzle/migrations/meta/0030_snapshot.json +1652 -0
- package/dist/drizzle/migrations/meta/_journal.json +35 -0
- package/dist/evm/bytecode/morpho.txt +1 -1
- package/dist/index.browser.d.mts +561 -317
- package/dist/index.browser.d.mts.map +1 -1
- package/dist/index.browser.d.ts +557 -313
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +4032 -3816
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.mjs +4026 -3816
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.node.d.mts +1067 -447
- package/dist/index.node.d.mts.map +1 -1
- package/dist/index.node.d.ts +1067 -447
- package/dist/index.node.d.ts.map +1 -1
- package/dist/index.node.js +2466 -1195
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.mjs +2439 -1174
- package/dist/index.node.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.browser.d.ts
CHANGED
|
@@ -577,7 +577,7 @@ declare const MorphoV2: readonly [{
|
|
|
577
577
|
readonly stateMutability: "nonpayable";
|
|
578
578
|
readonly inputs: readonly [{
|
|
579
579
|
readonly type: "address";
|
|
580
|
-
readonly name: "
|
|
580
|
+
readonly name: "feeRecipient";
|
|
581
581
|
}];
|
|
582
582
|
readonly outputs: readonly [];
|
|
583
583
|
}, {
|
|
@@ -657,6 +657,15 @@ declare const MorphoV2: readonly [{
|
|
|
657
657
|
}, {
|
|
658
658
|
readonly type: "address";
|
|
659
659
|
readonly name: "taker";
|
|
660
|
+
}, {
|
|
661
|
+
readonly type: "address";
|
|
662
|
+
readonly name: "takerCallback";
|
|
663
|
+
}, {
|
|
664
|
+
readonly type: "bytes";
|
|
665
|
+
readonly name: "takerCallbackData";
|
|
666
|
+
}, {
|
|
667
|
+
readonly type: "address";
|
|
668
|
+
readonly name: "receiverIfTakerIsSeller";
|
|
660
669
|
}, {
|
|
661
670
|
readonly type: "tuple";
|
|
662
671
|
readonly components: readonly [{
|
|
@@ -718,6 +727,9 @@ declare const MorphoV2: readonly [{
|
|
|
718
727
|
}, {
|
|
719
728
|
readonly type: "bytes";
|
|
720
729
|
readonly name: "callbackData";
|
|
730
|
+
}, {
|
|
731
|
+
readonly type: "address";
|
|
732
|
+
readonly name: "receiverIfMakerIsSeller";
|
|
721
733
|
}];
|
|
722
734
|
readonly name: "offer";
|
|
723
735
|
}, {
|
|
@@ -739,12 +751,6 @@ declare const MorphoV2: readonly [{
|
|
|
739
751
|
}, {
|
|
740
752
|
readonly type: "bytes32[]";
|
|
741
753
|
readonly name: "proof";
|
|
742
|
-
}, {
|
|
743
|
-
readonly type: "address";
|
|
744
|
-
readonly name: "takerCallback";
|
|
745
|
-
}, {
|
|
746
|
-
readonly type: "bytes";
|
|
747
|
-
readonly name: "takerCallbackData";
|
|
748
754
|
}];
|
|
749
755
|
readonly outputs: readonly [{
|
|
750
756
|
readonly type: "uint256";
|
|
@@ -866,6 +872,9 @@ declare const MorphoV2: readonly [{
|
|
|
866
872
|
}, {
|
|
867
873
|
readonly type: "address";
|
|
868
874
|
readonly name: "onBehalf";
|
|
875
|
+
}, {
|
|
876
|
+
readonly type: "address";
|
|
877
|
+
readonly name: "receiver";
|
|
869
878
|
}];
|
|
870
879
|
readonly outputs: readonly [{
|
|
871
880
|
readonly type: "uint256";
|
|
@@ -908,6 +917,9 @@ declare const MorphoV2: readonly [{
|
|
|
908
917
|
}, {
|
|
909
918
|
readonly type: "address";
|
|
910
919
|
readonly name: "onBehalf";
|
|
920
|
+
}, {
|
|
921
|
+
readonly type: "address";
|
|
922
|
+
readonly name: "receiver";
|
|
911
923
|
}];
|
|
912
924
|
readonly outputs: readonly [];
|
|
913
925
|
}, {
|
|
@@ -1095,7 +1107,7 @@ declare const MorphoV2: readonly [{
|
|
|
1095
1107
|
readonly type: "event";
|
|
1096
1108
|
readonly inputs: readonly [{
|
|
1097
1109
|
readonly type: "address";
|
|
1098
|
-
readonly name: "
|
|
1110
|
+
readonly name: "feeRecipient";
|
|
1099
1111
|
readonly indexed: true;
|
|
1100
1112
|
}];
|
|
1101
1113
|
}, {
|
|
@@ -1170,6 +1182,9 @@ declare const MorphoV2: readonly [{
|
|
|
1170
1182
|
}, {
|
|
1171
1183
|
readonly type: "bool";
|
|
1172
1184
|
readonly name: "sellerIsBorrower";
|
|
1185
|
+
}, {
|
|
1186
|
+
readonly type: "address";
|
|
1187
|
+
readonly name: "sellerReceiver";
|
|
1173
1188
|
}, {
|
|
1174
1189
|
readonly type: "bytes32";
|
|
1175
1190
|
readonly name: "group";
|
|
@@ -1183,7 +1198,6 @@ declare const MorphoV2: readonly [{
|
|
|
1183
1198
|
readonly inputs: readonly [{
|
|
1184
1199
|
readonly type: "address";
|
|
1185
1200
|
readonly name: "caller";
|
|
1186
|
-
readonly indexed: true;
|
|
1187
1201
|
}, {
|
|
1188
1202
|
readonly type: "bytes32";
|
|
1189
1203
|
readonly name: "id";
|
|
@@ -1198,6 +1212,10 @@ declare const MorphoV2: readonly [{
|
|
|
1198
1212
|
readonly type: "address";
|
|
1199
1213
|
readonly name: "onBehalf";
|
|
1200
1214
|
readonly indexed: true;
|
|
1215
|
+
}, {
|
|
1216
|
+
readonly type: "address";
|
|
1217
|
+
readonly name: "receiver";
|
|
1218
|
+
readonly indexed: true;
|
|
1201
1219
|
}];
|
|
1202
1220
|
}, {
|
|
1203
1221
|
readonly name: "WithdrawCollateral";
|
|
@@ -1220,6 +1238,9 @@ declare const MorphoV2: readonly [{
|
|
|
1220
1238
|
readonly type: "address";
|
|
1221
1239
|
readonly name: "onBehalf";
|
|
1222
1240
|
readonly indexed: true;
|
|
1241
|
+
}, {
|
|
1242
|
+
readonly type: "address";
|
|
1243
|
+
readonly name: "receiver";
|
|
1223
1244
|
}];
|
|
1224
1245
|
}];
|
|
1225
1246
|
type MorphoV2 = typeof MorphoV2;
|
|
@@ -1393,7 +1414,7 @@ declare class ReorgError extends BaseError {
|
|
|
1393
1414
|
constructor(blockNumber: number);
|
|
1394
1415
|
}
|
|
1395
1416
|
declare namespace Chain_d_exports {
|
|
1396
|
-
export { Chain$1 as Chain, ChainId, Id, InvalidBatchSizeError, InvalidBlockRangeError, InvalidBlockWindowError, MissingBlockNumberError, Name, chainIds, chainNames, chains
|
|
1417
|
+
export { Chain$1 as Chain, ChainId, Id, InvalidBatchSizeError, InvalidBlockRangeError, InvalidBlockWindowError, MissingBlockNumberError, Name, chainIds, chainNames, chains, getChain, getWhitelistedChains, streamLogs };
|
|
1397
1418
|
}
|
|
1398
1419
|
type Chain$1 = Compute<Omit<Chain<ChainFormatters, {
|
|
1399
1420
|
morpho: ChainContract;
|
|
@@ -1434,7 +1455,7 @@ type Id = (typeof ChainId)[Uppercase<Name>];
|
|
|
1434
1455
|
declare const chainIds: readonly Id[];
|
|
1435
1456
|
declare function getChain(chainId: Id): Chain$1 | undefined;
|
|
1436
1457
|
declare const getWhitelistedChains: () => Chain$1[];
|
|
1437
|
-
declare const chains
|
|
1458
|
+
declare const chains: Record<Lowercase<Name>, Chain$1>;
|
|
1438
1459
|
declare function streamLogs<abiEvent extends AbiEvent | undefined = undefined>(parameters: {
|
|
1439
1460
|
client: PublicClient;
|
|
1440
1461
|
contractAddress?: Address;
|
|
@@ -1512,13 +1533,23 @@ declare class InvalidLLTVError extends BaseError {
|
|
|
1512
1533
|
}
|
|
1513
1534
|
declare const LLTVSchema: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
1514
1535
|
declare namespace Collateral_d_exports {
|
|
1515
|
-
export { Collateral, CollateralSchema, CollateralsSchema, from$13 as from, random$3 as random };
|
|
1536
|
+
export { Collateral, CollateralSchema, CollateralsSchema, abi$1 as abi, from$13 as from, random$3 as random };
|
|
1516
1537
|
}
|
|
1517
1538
|
type Collateral = {
|
|
1518
1539
|
/** Asset being used as collateral. */asset: Address; /** Liquidation Loan-to-Value of the collateral. */
|
|
1519
1540
|
lltv: LLTV; /** Oracle contract used to price the collateral. */
|
|
1520
1541
|
oracle: Address;
|
|
1521
1542
|
};
|
|
1543
|
+
declare const abi$1: readonly [{
|
|
1544
|
+
readonly type: "address";
|
|
1545
|
+
readonly name: "token";
|
|
1546
|
+
}, {
|
|
1547
|
+
readonly type: "uint256";
|
|
1548
|
+
readonly name: "lltv";
|
|
1549
|
+
}, {
|
|
1550
|
+
readonly type: "address";
|
|
1551
|
+
readonly name: "oracle";
|
|
1552
|
+
}];
|
|
1522
1553
|
declare const CollateralSchema: z$1.ZodObject<{
|
|
1523
1554
|
asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1524
1555
|
oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
@@ -1632,102 +1663,33 @@ declare class DenominatorIsZeroError extends BaseError {
|
|
|
1632
1663
|
readonly name = "ERC4626.DenominatorIsZeroError";
|
|
1633
1664
|
constructor();
|
|
1634
1665
|
}
|
|
1635
|
-
declare namespace
|
|
1636
|
-
export {
|
|
1666
|
+
declare namespace Format_d_exports {
|
|
1667
|
+
export { Snake, fromSnakeCase$3 as fromSnakeCase, stringifyBigint, toSnakeCase$1 as toSnakeCase };
|
|
1637
1668
|
}
|
|
1669
|
+
/** The snake case representation of a type with bigint values stringified. */
|
|
1670
|
+
type Snake<T> = DeepMutable<SnakeKeys<StringifiedBigint<T>>>;
|
|
1671
|
+
/** Make arrays/tuples and object props mutable, deeply. */
|
|
1672
|
+
type DeepMutable<T> = T extends ((...args: unknown[]) => unknown) ? T : T extends number | string | boolean | symbol | bigint | null | undefined ? T : T extends readonly [...infer R] ? { -readonly [K in keyof R]: DeepMutable<R[K]> } : T extends ReadonlyArray<infer U> ? Array<DeepMutable<U>> : T extends object ? { -readonly [K in keyof T]: DeepMutable<T[K]> } : T;
|
|
1673
|
+
/** Stringifies bigint values to strings and preserves branded primitives. */
|
|
1674
|
+
type StringifiedBigint<T> = [T] extends [bigint] ? string : [T] extends [`0x${string}`] ? string : T extends number ? T : T extends string ? T : T extends boolean ? T : T extends symbol ? T : T extends null | undefined ? T : T extends readonly (infer U)[] ? readonly StringifiedBigint<U>[] : T extends object ? { [K in keyof T]: StringifiedBigint<T[K]> } : T;
|
|
1675
|
+
/** Key remapping that also preserves branded primitives. */
|
|
1676
|
+
type SnakeKeys<T> = T extends readonly (infer U)[] ? readonly SnakeKeys<U>[] : T extends number | string | boolean | symbol | null | undefined ? T : T extends object ? { [K in keyof T as ToSnakeCase<Extract<K, string>>]: SnakeKeys<T[K]> } : T;
|
|
1677
|
+
type ToSnakeCase<S extends string> = S extends `${infer Head}${infer Tail}` ? Tail extends Uncapitalize<Tail> ? `${Lowercase<Head>}${ToSnakeCase<Tail>}` : `${Lowercase<Head>}_${ToSnakeCase<Uncapitalize<Tail>>}` : S;
|
|
1638
1678
|
/**
|
|
1639
|
-
*
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
amount: bigint;
|
|
1644
|
-
};
|
|
1645
|
-
/**
|
|
1646
|
-
* Represents a hierarchical relationship between two liquidity pools.
|
|
1647
|
-
*/
|
|
1648
|
-
type LiquidityLink = {
|
|
1649
|
-
parentPoolId: string;
|
|
1650
|
-
childPoolId: string;
|
|
1651
|
-
priority: number;
|
|
1652
|
-
};
|
|
1653
|
-
/**
|
|
1654
|
-
* Represents the connection between an offer and its liquidity pools.
|
|
1655
|
-
*/
|
|
1656
|
-
type OfferLiquidityPool = {
|
|
1657
|
-
offerHash: Hex;
|
|
1658
|
-
poolId: string;
|
|
1659
|
-
/**
|
|
1660
|
-
* The available capacity/liquidity from this pool for this offer.
|
|
1661
|
-
* Matches allowance amount from pool below.
|
|
1662
|
-
*/
|
|
1663
|
-
amount: bigint;
|
|
1664
|
-
};
|
|
1665
|
-
/**
|
|
1666
|
-
* Calculate maximum debt capacity from collateral amount.
|
|
1667
|
-
* @param amount - Collateral amount
|
|
1668
|
-
* @param oraclePrice - Oracle price (scaled to 36 decimals)
|
|
1669
|
-
* @param lltv - Loan-to-value ratio (scaled to 18 decimals)
|
|
1670
|
-
* @returns Maximum debt capacity
|
|
1671
|
-
*/
|
|
1672
|
-
declare function calculateMaxDebt(amount: bigint, oraclePrice: bigint, lltv: bigint): bigint;
|
|
1673
|
-
/**
|
|
1674
|
-
* Generate pool ID for balance pools.
|
|
1675
|
-
*/
|
|
1676
|
-
declare function generateBalancePoolId(parameters: {
|
|
1677
|
-
user: Address;
|
|
1678
|
-
chainId: Id;
|
|
1679
|
-
token: Address;
|
|
1680
|
-
}): string;
|
|
1681
|
-
/**
|
|
1682
|
-
* Generate pool ID for allowance pools.
|
|
1683
|
-
*/
|
|
1684
|
-
declare function generateAllowancePoolId(parameters: {
|
|
1685
|
-
user: Address;
|
|
1686
|
-
chainId: Id;
|
|
1687
|
-
token: Address;
|
|
1688
|
-
}): string;
|
|
1689
|
-
/**
|
|
1690
|
-
* Generate pool ID for obligation collateral pools.
|
|
1691
|
-
* Obligation collateral pools represent collateral already deposited in the obligation.
|
|
1692
|
-
* These pools are shared across all offers with the same obligation.
|
|
1693
|
-
*/
|
|
1694
|
-
declare function generateObligationCollateralPoolId(parameters: {
|
|
1695
|
-
user: Address;
|
|
1696
|
-
chainId: Id;
|
|
1697
|
-
obligationId: Hex;
|
|
1698
|
-
token: Address;
|
|
1699
|
-
}): string;
|
|
1700
|
-
/**
|
|
1701
|
-
* Generate pool ID for debt pools.
|
|
1702
|
-
*/
|
|
1703
|
-
declare function generateDebtPoolId(parameters: {
|
|
1704
|
-
user: Address;
|
|
1705
|
-
chainId: Id;
|
|
1706
|
-
obligationId: Hex;
|
|
1707
|
-
}): string;
|
|
1708
|
-
/**
|
|
1709
|
-
* Generate pool ID for user position in a vault.
|
|
1710
|
-
*/
|
|
1711
|
-
declare function generateUserVaultPositionPoolId(parameters: {
|
|
1712
|
-
user: Address;
|
|
1713
|
-
chainId: Id;
|
|
1714
|
-
vault: Address;
|
|
1715
|
-
}): string;
|
|
1716
|
-
/**
|
|
1717
|
-
* Generate pool ID for vault position in a market.
|
|
1679
|
+
* Formats object keys to snake case.
|
|
1680
|
+
* Preserves ethereum addresses as is.
|
|
1681
|
+
* Converts ethereum addresses to checksummed if used as values.
|
|
1682
|
+
* Stringifies bigint values to strings.
|
|
1718
1683
|
*/
|
|
1719
|
-
declare function
|
|
1720
|
-
vault: Address;
|
|
1721
|
-
chainId: Id;
|
|
1722
|
-
marketId: string;
|
|
1723
|
-
}): string;
|
|
1684
|
+
declare function toSnakeCase$1<T>(obj: T): Snake<T>;
|
|
1724
1685
|
/**
|
|
1725
|
-
*
|
|
1686
|
+
* Formats a snake case object to its camel case type.
|
|
1687
|
+
* Preserves ethereum addresses as is.
|
|
1688
|
+
* Converts checksummed ethereum addresses to lowercase if used as values.
|
|
1689
|
+
* @warning Does not unstringify bigint values.
|
|
1726
1690
|
*/
|
|
1727
|
-
declare function
|
|
1728
|
-
|
|
1729
|
-
marketId: string;
|
|
1730
|
-
}): string;
|
|
1691
|
+
declare function fromSnakeCase$3<T>(obj: Snake<T>): T;
|
|
1692
|
+
declare function stringifyBigint<T>(value: T): StringifiedBigint<T>;
|
|
1731
1693
|
declare namespace Maturity_d_exports {
|
|
1732
1694
|
export { InvalidDateError, InvalidFormatError, InvalidOptionError, Maturity, MaturityOptions, MaturitySchema, MaturityType, from$12 as from };
|
|
1733
1695
|
}
|
|
@@ -1776,44 +1738,15 @@ declare class InvalidOptionError extends BaseError {
|
|
|
1776
1738
|
readonly name = "Maturity.InvalidOptionError";
|
|
1777
1739
|
constructor(input: string);
|
|
1778
1740
|
}
|
|
1779
|
-
declare namespace Format_d_exports {
|
|
1780
|
-
export { Snake, fromSnakeCase$3 as fromSnakeCase, stringifyBigint, toSnakeCase$1 as toSnakeCase };
|
|
1781
|
-
}
|
|
1782
|
-
/** The snake case representation of a type with bigint values stringified. */
|
|
1783
|
-
type Snake<T> = DeepMutable<SnakeKeys<StringifiedBigint<T>>>;
|
|
1784
|
-
/** Make arrays/tuples and object props mutable, deeply. */
|
|
1785
|
-
type DeepMutable<T> = T extends ((...args: unknown[]) => unknown) ? T : T extends number | string | boolean | symbol | bigint | null | undefined ? T : T extends readonly [...infer R] ? { -readonly [K in keyof R]: DeepMutable<R[K]> } : T extends ReadonlyArray<infer U> ? Array<DeepMutable<U>> : T extends object ? { -readonly [K in keyof T]: DeepMutable<T[K]> } : T;
|
|
1786
|
-
/** Stringifies bigint values to strings and preserves branded primitives. */
|
|
1787
|
-
type StringifiedBigint<T> = [T] extends [bigint] ? string : [T] extends [`0x${string}`] ? string : T extends number ? T : T extends string ? T : T extends boolean ? T : T extends symbol ? T : T extends null | undefined ? T : T extends readonly (infer U)[] ? readonly StringifiedBigint<U>[] : T extends object ? { [K in keyof T]: StringifiedBigint<T[K]> } : T;
|
|
1788
|
-
/** Key remapping that also preserves branded primitives. */
|
|
1789
|
-
type SnakeKeys<T> = T extends readonly (infer U)[] ? readonly SnakeKeys<U>[] : T extends number | string | boolean | symbol | null | undefined ? T : T extends object ? { [K in keyof T as ToSnakeCase<Extract<K, string>>]: SnakeKeys<T[K]> } : T;
|
|
1790
|
-
type ToSnakeCase<S extends string> = S extends `${infer Head}${infer Tail}` ? Tail extends Uncapitalize<Tail> ? `${Lowercase<Head>}${ToSnakeCase<Tail>}` : `${Lowercase<Head>}_${ToSnakeCase<Uncapitalize<Tail>>}` : S;
|
|
1791
|
-
/**
|
|
1792
|
-
* Formats object keys to snake case.
|
|
1793
|
-
* Preserves ethereum addresses as is.
|
|
1794
|
-
* Converts ethereum addresses to checksummed if used as values.
|
|
1795
|
-
* Stringifies bigint values to strings.
|
|
1796
|
-
*/
|
|
1797
|
-
declare function toSnakeCase$1<T>(obj: T): Snake<T>;
|
|
1798
|
-
/**
|
|
1799
|
-
* Formats a snake case object to its camel case type.
|
|
1800
|
-
* Preserves ethereum addresses as is.
|
|
1801
|
-
* Converts checksummed ethereum addresses to lowercase if used as values.
|
|
1802
|
-
* @warning Does not unstringify bigint values.
|
|
1803
|
-
*/
|
|
1804
|
-
declare function fromSnakeCase$3<T>(obj: Snake<T>): T;
|
|
1805
|
-
declare function stringifyBigint<T>(value: T): StringifiedBigint<T>;
|
|
1806
1741
|
declare namespace Obligation_d_exports {
|
|
1807
|
-
export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$11 as from, fromOffer$1 as fromOffer, fromSnakeCase$2 as fromSnakeCase,
|
|
1742
|
+
export { CollateralsAreNotSortedError, InvalidObligationError, Obligation$1 as Obligation, ObligationSchema, abi, from$11 as from, fromOffer$1 as fromOffer, fromSnakeCase$2 as fromSnakeCase, key$1 as key, random$2 as random, tupleAbi };
|
|
1808
1743
|
}
|
|
1809
|
-
type Obligation = {
|
|
1810
|
-
/** The
|
|
1811
|
-
loanToken: Address; /** The exact set of collaterals required to borrow the loan token. */
|
|
1744
|
+
type Obligation$1 = {
|
|
1745
|
+
/** The token that is being borrowed for this obligation. */loanToken: Address; /** The exact set of collaterals required to borrow the loan token. */
|
|
1812
1746
|
collaterals: Collateral[]; /** The maturity of the obligation. */
|
|
1813
1747
|
maturity: Maturity;
|
|
1814
1748
|
};
|
|
1815
1749
|
declare const ObligationSchema: z$1.ZodObject<{
|
|
1816
|
-
chainId: z$1.ZodNumber;
|
|
1817
1750
|
loanToken: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1818
1751
|
collaterals: z$1.ZodArray<z$1.ZodObject<{
|
|
1819
1752
|
asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
@@ -1822,6 +1755,49 @@ declare const ObligationSchema: z$1.ZodObject<{
|
|
|
1822
1755
|
}, z$1.core.$strip>>;
|
|
1823
1756
|
maturity: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
|
|
1824
1757
|
}, z$1.core.$strip>;
|
|
1758
|
+
declare const abi: readonly [{
|
|
1759
|
+
readonly type: "address";
|
|
1760
|
+
readonly name: "loanToken";
|
|
1761
|
+
}, {
|
|
1762
|
+
readonly type: "tuple[]";
|
|
1763
|
+
readonly name: "collaterals";
|
|
1764
|
+
readonly components: readonly [{
|
|
1765
|
+
readonly type: "address";
|
|
1766
|
+
readonly name: "token";
|
|
1767
|
+
}, {
|
|
1768
|
+
readonly type: "uint256";
|
|
1769
|
+
readonly name: "lltv";
|
|
1770
|
+
}, {
|
|
1771
|
+
readonly type: "address";
|
|
1772
|
+
readonly name: "oracle";
|
|
1773
|
+
}];
|
|
1774
|
+
}, {
|
|
1775
|
+
readonly type: "uint256";
|
|
1776
|
+
readonly name: "maturity";
|
|
1777
|
+
}];
|
|
1778
|
+
declare const tupleAbi: readonly [{
|
|
1779
|
+
readonly type: "tuple";
|
|
1780
|
+
readonly components: readonly [{
|
|
1781
|
+
readonly type: "address";
|
|
1782
|
+
readonly name: "loanToken";
|
|
1783
|
+
}, {
|
|
1784
|
+
readonly type: "tuple[]";
|
|
1785
|
+
readonly name: "collaterals";
|
|
1786
|
+
readonly components: readonly [{
|
|
1787
|
+
readonly type: "address";
|
|
1788
|
+
readonly name: "token";
|
|
1789
|
+
}, {
|
|
1790
|
+
readonly type: "uint256";
|
|
1791
|
+
readonly name: "lltv";
|
|
1792
|
+
}, {
|
|
1793
|
+
readonly type: "address";
|
|
1794
|
+
readonly name: "oracle";
|
|
1795
|
+
}];
|
|
1796
|
+
}, {
|
|
1797
|
+
readonly type: "uint256";
|
|
1798
|
+
readonly name: "maturity";
|
|
1799
|
+
}];
|
|
1800
|
+
}];
|
|
1825
1801
|
/**
|
|
1826
1802
|
* Creates an obligation from the given parameters.
|
|
1827
1803
|
* @constructor
|
|
@@ -1832,7 +1808,6 @@ declare const ObligationSchema: z$1.ZodObject<{
|
|
|
1832
1808
|
* @example
|
|
1833
1809
|
* ```ts
|
|
1834
1810
|
* const obligation = Obligation.from({
|
|
1835
|
-
* chainId: 1,
|
|
1836
1811
|
* loanToken: privateKeyToAccount(generatePrivateKey()).address,
|
|
1837
1812
|
* collaterals: [
|
|
1838
1813
|
* Collateral.from({
|
|
@@ -1848,12 +1823,11 @@ declare const ObligationSchema: z$1.ZodObject<{
|
|
|
1848
1823
|
declare function from$11(parameters: from$11.Parameters): from$11.ReturnType;
|
|
1849
1824
|
declare namespace from$11 {
|
|
1850
1825
|
type Parameters = {
|
|
1851
|
-
/** The
|
|
1852
|
-
loanToken: Address; /** The exact set of collaterals required to borrow the loan token. Must be sorted alphabetically by address. */
|
|
1826
|
+
/** The token that is being borrowed for this obligation. */loanToken: Address; /** The exact set of collaterals required to borrow the loan token. Must be sorted alphabetically by address. */
|
|
1853
1827
|
collaterals: from$13.Parameters[] | readonly from$13.Parameters[]; /** The maturity of the obligation. */
|
|
1854
1828
|
maturity: from$12.Parameters;
|
|
1855
1829
|
};
|
|
1856
|
-
type ReturnType = Obligation;
|
|
1830
|
+
type ReturnType = Obligation$1;
|
|
1857
1831
|
type ErrorType = InvalidObligationError;
|
|
1858
1832
|
}
|
|
1859
1833
|
/**
|
|
@@ -1864,30 +1838,27 @@ declare namespace from$11 {
|
|
|
1864
1838
|
*/
|
|
1865
1839
|
declare function fromSnakeCase$2(input: fromSnakeCase$2.Parameters): fromSnakeCase$2.ReturnType;
|
|
1866
1840
|
declare namespace fromSnakeCase$2 {
|
|
1867
|
-
type Parameters = Snake<
|
|
1868
|
-
|
|
1869
|
-
}>;
|
|
1870
|
-
type ReturnType = Obligation;
|
|
1841
|
+
type Parameters = Snake<Obligation$1>;
|
|
1842
|
+
type ReturnType = Obligation$1;
|
|
1871
1843
|
type ErrorType = InvalidObligationError;
|
|
1872
1844
|
}
|
|
1873
1845
|
/**
|
|
1874
|
-
* Calculates
|
|
1875
|
-
* The
|
|
1846
|
+
* Calculates a canonical key for an obligation payload.
|
|
1847
|
+
* The key is computed as keccak256(abi.encode(loanToken, collaterals, maturity)).
|
|
1876
1848
|
* @throws If the collaterals are not sorted alphabetically by address. {@link CollateralsAreNotSortedError}
|
|
1877
|
-
* @param parameters - {@link
|
|
1878
|
-
* @returns The obligation
|
|
1849
|
+
* @param parameters - {@link key.Parameters}
|
|
1850
|
+
* @returns The obligation key as a 32-byte hex string. {@link key.ReturnType}
|
|
1879
1851
|
*
|
|
1880
1852
|
* @example
|
|
1881
1853
|
* ```ts
|
|
1882
1854
|
* const obligation = Obligation.random();
|
|
1883
|
-
* const
|
|
1884
|
-
* console.log(
|
|
1855
|
+
* const key = Obligation.key(obligation);
|
|
1856
|
+
* console.log(key); // 0x1234567890123456789012345678901234567890123456789012345678901234
|
|
1885
1857
|
* ```
|
|
1886
1858
|
*/
|
|
1887
|
-
declare function
|
|
1888
|
-
declare namespace
|
|
1859
|
+
declare function key$1(parameters: key$1.Parameters): key$1.ReturnType;
|
|
1860
|
+
declare namespace key$1 {
|
|
1889
1861
|
type Parameters = {
|
|
1890
|
-
chainId: number;
|
|
1891
1862
|
loanToken: Address;
|
|
1892
1863
|
collaterals: {
|
|
1893
1864
|
asset: Address;
|
|
@@ -1910,7 +1881,7 @@ declare namespace id {
|
|
|
1910
1881
|
*/
|
|
1911
1882
|
declare function random$2(): random$2.ReturnType;
|
|
1912
1883
|
declare namespace random$2 {
|
|
1913
|
-
type ReturnType = Obligation;
|
|
1884
|
+
type ReturnType = Obligation$1;
|
|
1914
1885
|
}
|
|
1915
1886
|
/**
|
|
1916
1887
|
* Creates an obligation from an offer.
|
|
@@ -1922,7 +1893,7 @@ declare namespace random$2 {
|
|
|
1922
1893
|
declare function fromOffer$1(offer: Offer): fromOffer$1.ReturnType;
|
|
1923
1894
|
declare namespace fromOffer$1 {
|
|
1924
1895
|
type Parameters = Offer;
|
|
1925
|
-
type ReturnType = Obligation;
|
|
1896
|
+
type ReturnType = Obligation$1;
|
|
1926
1897
|
}
|
|
1927
1898
|
declare class InvalidObligationError extends BaseError<z$1.ZodError | Error> {
|
|
1928
1899
|
readonly name = "Obligation.InvalidObligationError";
|
|
@@ -1932,8 +1903,135 @@ declare class CollateralsAreNotSortedError extends BaseError {
|
|
|
1932
1903
|
readonly name = "Obligation.CollateralsAreNotSortedError";
|
|
1933
1904
|
constructor();
|
|
1934
1905
|
}
|
|
1906
|
+
declare namespace Id_d_exports {
|
|
1907
|
+
export { Obligation, creationCode, toId };
|
|
1908
|
+
}
|
|
1909
|
+
type Obligation = Obligation$1;
|
|
1910
|
+
/**
|
|
1911
|
+
* Builds the same creation code as `IdLib.creationCode` in Solidity.
|
|
1912
|
+
*
|
|
1913
|
+
* Layout: `prefix (11 bytes) + chainId (32 bytes) + morphoV2 (20 bytes) + abi.encode(obligation)`.
|
|
1914
|
+
*
|
|
1915
|
+
* @param parameters - {@link creationCode.Parameters}
|
|
1916
|
+
* @returns The CREATE2 init code bytes. {@link creationCode.ReturnType}
|
|
1917
|
+
*/
|
|
1918
|
+
declare function creationCode(parameters: creationCode.Parameters): creationCode.ReturnType;
|
|
1919
|
+
declare namespace creationCode {
|
|
1920
|
+
type Parameters = {
|
|
1921
|
+
obligation: Obligation;
|
|
1922
|
+
chainId: Id;
|
|
1923
|
+
morphoV2: Address;
|
|
1924
|
+
};
|
|
1925
|
+
type ReturnType = Hex;
|
|
1926
|
+
}
|
|
1927
|
+
/**
|
|
1928
|
+
* Computes the same id as `IdLib.toId` in Solidity.
|
|
1929
|
+
* @param parameters - {@link toId.Parameters}
|
|
1930
|
+
* @returns The obligation id. {@link toId.ReturnType}
|
|
1931
|
+
*/
|
|
1932
|
+
declare function toId(parameters: toId.Parameters): toId.ReturnType;
|
|
1933
|
+
declare namespace toId {
|
|
1934
|
+
type Parameters = creationCode.Parameters;
|
|
1935
|
+
type ReturnType = Hex;
|
|
1936
|
+
}
|
|
1937
|
+
declare namespace Liquidity_d_exports {
|
|
1938
|
+
export { LiquidityLink, LiquidityPool, OfferLiquidityPool, calculateMaxDebt, generateAllowancePoolId, generateBalancePoolId, generateDebtPoolId, generateMarketLiquidityPoolId, generateObligationCollateralPoolId, generateUserVaultPositionPoolId, generateVaultPositionPoolId };
|
|
1939
|
+
}
|
|
1940
|
+
/**
|
|
1941
|
+
* Represents a liquidity pool with a unique ID and amount.
|
|
1942
|
+
*/
|
|
1943
|
+
type LiquidityPool = {
|
|
1944
|
+
id: string;
|
|
1945
|
+
amount: bigint;
|
|
1946
|
+
};
|
|
1947
|
+
/**
|
|
1948
|
+
* Represents a hierarchical relationship between two liquidity pools.
|
|
1949
|
+
*/
|
|
1950
|
+
type LiquidityLink = {
|
|
1951
|
+
parentPoolId: string;
|
|
1952
|
+
childPoolId: string;
|
|
1953
|
+
priority: number;
|
|
1954
|
+
};
|
|
1955
|
+
/**
|
|
1956
|
+
* Represents the connection between an offer and its liquidity pools.
|
|
1957
|
+
*/
|
|
1958
|
+
type OfferLiquidityPool = {
|
|
1959
|
+
offerHash: Hex;
|
|
1960
|
+
poolId: string;
|
|
1961
|
+
/**
|
|
1962
|
+
* The available capacity/liquidity from this pool for this offer.
|
|
1963
|
+
* Matches allowance amount from pool below.
|
|
1964
|
+
*/
|
|
1965
|
+
amount: bigint;
|
|
1966
|
+
};
|
|
1967
|
+
/**
|
|
1968
|
+
* Calculate maximum debt capacity from collateral amount.
|
|
1969
|
+
* @param amount - Collateral amount
|
|
1970
|
+
* @param oraclePrice - Oracle price (scaled to 36 decimals)
|
|
1971
|
+
* @param lltv - Loan-to-value ratio (scaled to 18 decimals)
|
|
1972
|
+
* @returns Maximum debt capacity
|
|
1973
|
+
*/
|
|
1974
|
+
declare function calculateMaxDebt(amount: bigint, oraclePrice: bigint, lltv: bigint): bigint;
|
|
1975
|
+
/**
|
|
1976
|
+
* Generate pool ID for balance pools.
|
|
1977
|
+
*/
|
|
1978
|
+
declare function generateBalancePoolId(parameters: {
|
|
1979
|
+
user: Address;
|
|
1980
|
+
chainId: Id;
|
|
1981
|
+
token: Address;
|
|
1982
|
+
}): string;
|
|
1983
|
+
/**
|
|
1984
|
+
* Generate pool ID for allowance pools.
|
|
1985
|
+
*/
|
|
1986
|
+
declare function generateAllowancePoolId(parameters: {
|
|
1987
|
+
user: Address;
|
|
1988
|
+
chainId: Id;
|
|
1989
|
+
token: Address;
|
|
1990
|
+
}): string;
|
|
1991
|
+
/**
|
|
1992
|
+
* Generate pool ID for obligation collateral pools.
|
|
1993
|
+
* Obligation collateral pools represent collateral already deposited in the obligation.
|
|
1994
|
+
* These pools are shared across all offers with the same obligation.
|
|
1995
|
+
*/
|
|
1996
|
+
declare function generateObligationCollateralPoolId(parameters: {
|
|
1997
|
+
user: Address;
|
|
1998
|
+
chainId: Id;
|
|
1999
|
+
obligationId: Hex;
|
|
2000
|
+
token: Address;
|
|
2001
|
+
}): string;
|
|
2002
|
+
/**
|
|
2003
|
+
* Generate pool ID for debt pools.
|
|
2004
|
+
*/
|
|
2005
|
+
declare function generateDebtPoolId(parameters: {
|
|
2006
|
+
user: Address;
|
|
2007
|
+
chainId: Id;
|
|
2008
|
+
obligationId: Hex;
|
|
2009
|
+
}): string;
|
|
2010
|
+
/**
|
|
2011
|
+
* Generate pool ID for user position in a vault.
|
|
2012
|
+
*/
|
|
2013
|
+
declare function generateUserVaultPositionPoolId(parameters: {
|
|
2014
|
+
user: Address;
|
|
2015
|
+
chainId: Id;
|
|
2016
|
+
vault: Address;
|
|
2017
|
+
}): string;
|
|
2018
|
+
/**
|
|
2019
|
+
* Generate pool ID for vault position in a market.
|
|
2020
|
+
*/
|
|
2021
|
+
declare function generateVaultPositionPoolId(parameters: {
|
|
2022
|
+
vault: Address;
|
|
2023
|
+
chainId: Id;
|
|
2024
|
+
marketId: string;
|
|
2025
|
+
}): string;
|
|
2026
|
+
/**
|
|
2027
|
+
* Generate pool ID for market total liquidity.
|
|
2028
|
+
*/
|
|
2029
|
+
declare function generateMarketLiquidityPoolId(parameters: {
|
|
2030
|
+
chainId: Id;
|
|
2031
|
+
marketId: string;
|
|
2032
|
+
}): string;
|
|
1935
2033
|
declare namespace Offer_d_exports {
|
|
1936
|
-
export { InvalidOfferError, Offer, OfferConsumed, OfferInput, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$1 as decode,
|
|
2034
|
+
export { InvalidOfferError, Offer, OfferConsumed, OfferInput, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$1 as decode, encode$1 as encode, from$10 as from, fromSnakeCase$1 as fromSnakeCase, hash, liquidateEvent, obligationId, random$1 as random, repayEvent, serialize, supplyCollateralEvent, takeEvent, toSnakeCase, withdrawCollateralEvent };
|
|
1937
2035
|
}
|
|
1938
2036
|
type Offer = {
|
|
1939
2037
|
/** The address that made the offer. */readonly maker: Address; /** The amount of assets offered. Mutually exclusive with obligationUnits and obligationShares. */
|
|
@@ -1946,14 +2044,14 @@ type Offer = {
|
|
|
1946
2044
|
readonly start: number; /** The group. Used for OCO (One-Cancelled-Other) mechanism. */
|
|
1947
2045
|
readonly group: Hex; /** The session. Used for session-based offer management. */
|
|
1948
2046
|
readonly session: Hex; /** The side of the offer. `true` for buy, `false` for sell. */
|
|
1949
|
-
readonly buy: boolean; /** The
|
|
1950
|
-
readonly chainId: Id; /** The token that is being borrowed. */
|
|
2047
|
+
readonly buy: boolean; /** The token that is being borrowed. */
|
|
1951
2048
|
readonly loanToken: Address; /** The exact set of collaterals required to borrow the loan token. */
|
|
1952
2049
|
readonly collaterals: readonly Collateral[]; /** The optional callback data to retrieve the maker funds. */
|
|
1953
2050
|
readonly callback: {
|
|
1954
2051
|
readonly address: Address;
|
|
1955
2052
|
readonly data: Hex;
|
|
1956
|
-
};
|
|
2053
|
+
}; /** Receiver of loan token proceeds when maker is seller on `take()`. */
|
|
2054
|
+
readonly receiverIfMakerIsSeller: Address;
|
|
1957
2055
|
};
|
|
1958
2056
|
declare enum Status {
|
|
1959
2057
|
VALID = "VALID",
|
|
@@ -1961,6 +2059,7 @@ declare enum Status {
|
|
|
1961
2059
|
}
|
|
1962
2060
|
type Validation = {
|
|
1963
2061
|
offerHash: Hex;
|
|
2062
|
+
obligationId: Hex;
|
|
1964
2063
|
status: Status;
|
|
1965
2064
|
};
|
|
1966
2065
|
declare const OfferSchema: () => z$1.ZodObject<{
|
|
@@ -1975,7 +2074,6 @@ declare const OfferSchema: () => z$1.ZodObject<{
|
|
|
1975
2074
|
group: z$1.ZodPipe<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNumber, z$1.ZodBigInt]>, z$1.ZodTransform<`0x${string}`, string | number | bigint>>;
|
|
1976
2075
|
session: z$1.ZodPipe<z$1.ZodDefault<z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNumber, z$1.ZodBigInt]>>>, z$1.ZodTransform<`0x${string}`, string | number | bigint>>;
|
|
1977
2076
|
buy: z$1.ZodBoolean;
|
|
1978
|
-
chainId: z$1.ZodNumber;
|
|
1979
2077
|
loanToken: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1980
2078
|
collaterals: z$1.ZodArray<z$1.ZodObject<{
|
|
1981
2079
|
asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
@@ -1986,6 +2084,7 @@ declare const OfferSchema: () => z$1.ZodObject<{
|
|
|
1986
2084
|
address: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1987
2085
|
data: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1988
2086
|
}, z$1.core.$strip>;
|
|
2087
|
+
receiverIfMakerIsSeller: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1989
2088
|
}, z$1.core.$strip>;
|
|
1990
2089
|
/**
|
|
1991
2090
|
* Input type for creating offers. Accepts flexible group types that will be coerced to Hex.
|
|
@@ -1998,12 +2097,12 @@ declare const OfferSchema: () => z$1.ZodObject<{
|
|
|
1998
2097
|
*
|
|
1999
2098
|
* All values validated to be non-negative and within bytes32 range.
|
|
2000
2099
|
*/
|
|
2001
|
-
type OfferInput = Compute<Omit<Offer, "
|
|
2002
|
-
chainId: number;
|
|
2100
|
+
type OfferInput = Compute<Omit<Offer, "group" | "session" | "obligationUnits" | "obligationShares" | "receiverIfMakerIsSeller"> & {
|
|
2003
2101
|
group: Hex | bigint | number | string; /** Optional: defaults to zero bytes32. */
|
|
2004
2102
|
session?: Hex | bigint | number | string; /** Optional: defaults to 0n. Mutually exclusive with assets and obligationShares. */
|
|
2005
2103
|
obligationUnits?: bigint; /** Optional: defaults to 0n. Mutually exclusive with assets and obligationUnits. */
|
|
2006
|
-
obligationShares?: bigint;
|
|
2104
|
+
obligationShares?: bigint; /** Optional: defaults to maker for backward compatibility. */
|
|
2105
|
+
receiverIfMakerIsSeller?: Address;
|
|
2007
2106
|
}>;
|
|
2008
2107
|
/**
|
|
2009
2108
|
* Creates an offer from a plain object.
|
|
@@ -2021,9 +2120,9 @@ declare namespace from$10 {
|
|
|
2021
2120
|
* @param input - The offer to create.
|
|
2022
2121
|
* @returns The created offer.
|
|
2023
2122
|
*/
|
|
2024
|
-
declare function fromSnakeCase$1(input: Snake<Omit<Offer, "
|
|
2025
|
-
|
|
2026
|
-
|
|
2123
|
+
declare function fromSnakeCase$1(input: Snake<Omit<Offer, "session" | "receiverIfMakerIsSeller"> & {
|
|
2124
|
+
session?: Hex;
|
|
2125
|
+
receiverIfMakerIsSeller?: Address;
|
|
2027
2126
|
}>): Offer;
|
|
2028
2127
|
/**
|
|
2029
2128
|
* Converts an offer to a snake case object.
|
|
@@ -2050,7 +2149,6 @@ declare const serialize: (offer: Offer) => {
|
|
|
2050
2149
|
group: `0x${string}`;
|
|
2051
2150
|
session: `0x${string}`;
|
|
2052
2151
|
buy: boolean;
|
|
2053
|
-
chainId: Id;
|
|
2054
2152
|
loanToken: `0x${string}`;
|
|
2055
2153
|
collaterals: {
|
|
2056
2154
|
asset: `0x${string}`;
|
|
@@ -2061,10 +2159,10 @@ declare const serialize: (offer: Offer) => {
|
|
|
2061
2159
|
address: `0x${string}`;
|
|
2062
2160
|
data: `0x${string}`;
|
|
2063
2161
|
};
|
|
2162
|
+
receiverIfMakerIsSeller: `0x${string}`;
|
|
2064
2163
|
hash: `0x${string}`;
|
|
2065
2164
|
};
|
|
2066
2165
|
type RandomConfig = {
|
|
2067
|
-
chains?: Chain$1[];
|
|
2068
2166
|
loanTokens?: Address[];
|
|
2069
2167
|
collateralTokens?: Address[];
|
|
2070
2168
|
assetsDecimals?: Record<Address, number>;
|
|
@@ -2083,6 +2181,7 @@ type RandomConfig = {
|
|
|
2083
2181
|
address: Address;
|
|
2084
2182
|
data: Hex;
|
|
2085
2183
|
};
|
|
2184
|
+
receiverIfMakerIsSeller?: Address;
|
|
2086
2185
|
collaterals?: readonly Collateral[];
|
|
2087
2186
|
};
|
|
2088
2187
|
/**
|
|
@@ -2093,93 +2192,28 @@ type RandomConfig = {
|
|
|
2093
2192
|
*/
|
|
2094
2193
|
declare function random$1(config?: RandomConfig): Offer;
|
|
2095
2194
|
/**
|
|
2096
|
-
*
|
|
2097
|
-
*
|
|
2098
|
-
*
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
chainId: bigint;
|
|
2102
|
-
verifyingContract: "0x0000000000000000000000000000000000000000";
|
|
2103
|
-
};
|
|
2104
|
-
/**
|
|
2105
|
-
* The EIP-712 types for the offer.
|
|
2106
|
-
* @warning The ordering of the types should NEVER be changed. The offer hash is computed based on the order of the types.
|
|
2107
|
-
* @returns The EIP-712 types.
|
|
2195
|
+
* Computes the canonical chain-agnostic offer hash.
|
|
2196
|
+
* The hash is `keccak256(abi.encode(offer))` using {@link encode}.
|
|
2197
|
+
*
|
|
2198
|
+
* @param offer - Offer payload to hash.
|
|
2199
|
+
* @returns 32-byte offer hash.
|
|
2108
2200
|
*/
|
|
2109
|
-
declare const types: {
|
|
2110
|
-
readonly EIP712Domain: readonly [{
|
|
2111
|
-
readonly name: "chainId";
|
|
2112
|
-
readonly type: "uint256";
|
|
2113
|
-
}, {
|
|
2114
|
-
readonly name: "verifyingContract";
|
|
2115
|
-
readonly type: "address";
|
|
2116
|
-
}];
|
|
2117
|
-
readonly Offer: readonly [{
|
|
2118
|
-
readonly name: "maker";
|
|
2119
|
-
readonly type: "address";
|
|
2120
|
-
}, {
|
|
2121
|
-
readonly name: "assets";
|
|
2122
|
-
readonly type: "uint256";
|
|
2123
|
-
}, {
|
|
2124
|
-
readonly name: "obligationUnits";
|
|
2125
|
-
readonly type: "uint256";
|
|
2126
|
-
}, {
|
|
2127
|
-
readonly name: "obligationShares";
|
|
2128
|
-
readonly type: "uint256";
|
|
2129
|
-
}, {
|
|
2130
|
-
readonly name: "tick";
|
|
2131
|
-
readonly type: "uint256";
|
|
2132
|
-
}, {
|
|
2133
|
-
readonly name: "maturity";
|
|
2134
|
-
readonly type: "uint256";
|
|
2135
|
-
}, {
|
|
2136
|
-
readonly name: "expiry";
|
|
2137
|
-
readonly type: "uint256";
|
|
2138
|
-
}, {
|
|
2139
|
-
readonly name: "group";
|
|
2140
|
-
readonly type: "bytes32";
|
|
2141
|
-
}, {
|
|
2142
|
-
readonly name: "session";
|
|
2143
|
-
readonly type: "bytes32";
|
|
2144
|
-
}, {
|
|
2145
|
-
readonly name: "buy";
|
|
2146
|
-
readonly type: "bool";
|
|
2147
|
-
}, {
|
|
2148
|
-
readonly name: "loanToken";
|
|
2149
|
-
readonly type: "address";
|
|
2150
|
-
}, {
|
|
2151
|
-
readonly name: "collaterals";
|
|
2152
|
-
readonly type: "Collateral[]";
|
|
2153
|
-
}, {
|
|
2154
|
-
readonly name: "callback";
|
|
2155
|
-
readonly type: "Callback";
|
|
2156
|
-
}];
|
|
2157
|
-
readonly Collateral: readonly [{
|
|
2158
|
-
readonly name: "asset";
|
|
2159
|
-
readonly type: "address";
|
|
2160
|
-
}, {
|
|
2161
|
-
readonly name: "oracle";
|
|
2162
|
-
readonly type: "address";
|
|
2163
|
-
}, {
|
|
2164
|
-
readonly name: "lltv";
|
|
2165
|
-
readonly type: "uint256";
|
|
2166
|
-
}];
|
|
2167
|
-
readonly Callback: readonly [{
|
|
2168
|
-
readonly name: "address";
|
|
2169
|
-
readonly type: "address";
|
|
2170
|
-
}, {
|
|
2171
|
-
readonly name: "data";
|
|
2172
|
-
readonly type: "bytes";
|
|
2173
|
-
}];
|
|
2174
|
-
};
|
|
2175
2201
|
declare function hash(offer: Offer): Hex;
|
|
2176
2202
|
/**
|
|
2177
|
-
* Calculates the obligation id for an offer
|
|
2178
|
-
* The id is computed
|
|
2203
|
+
* Calculates the onchain obligation id for an offer.
|
|
2204
|
+
* The id is computed with {@link Id.toId}.
|
|
2179
2205
|
* @param offer - The offer to calculate the obligation id for.
|
|
2206
|
+
* @param parameters - The chain context used by the onchain id function.
|
|
2180
2207
|
* @returns The obligation id as a 32-byte hex string.
|
|
2181
2208
|
*/
|
|
2182
|
-
declare function obligationId(offer: Offer):
|
|
2209
|
+
declare function obligationId(offer: Offer, parameters: obligationId.Parameters): obligationId.ReturnType;
|
|
2210
|
+
declare namespace obligationId {
|
|
2211
|
+
type Parameters = {
|
|
2212
|
+
chainId: Id;
|
|
2213
|
+
morphoV2: Address;
|
|
2214
|
+
};
|
|
2215
|
+
type ReturnType = Hex;
|
|
2216
|
+
}
|
|
2183
2217
|
declare function encode$1(offer: Offer): `0x${string}`;
|
|
2184
2218
|
declare function decode$1(data: Hex): Offer;
|
|
2185
2219
|
type OfferConsumed = {
|
|
@@ -2251,6 +2285,11 @@ declare const takeEvent: {
|
|
|
2251
2285
|
readonly type: "bool";
|
|
2252
2286
|
readonly indexed: false;
|
|
2253
2287
|
readonly internalType: "bool";
|
|
2288
|
+
}, {
|
|
2289
|
+
readonly name: "sellerReceiver";
|
|
2290
|
+
readonly type: "address";
|
|
2291
|
+
readonly indexed: false;
|
|
2292
|
+
readonly internalType: "address";
|
|
2254
2293
|
}, {
|
|
2255
2294
|
readonly name: "group";
|
|
2256
2295
|
readonly type: "bytes32";
|
|
@@ -2288,6 +2327,160 @@ declare const consumedEvent: {
|
|
|
2288
2327
|
}];
|
|
2289
2328
|
readonly anonymous: false;
|
|
2290
2329
|
};
|
|
2330
|
+
/**
|
|
2331
|
+
* ABI for the Repay event emitted by the MorphoV2 contract.
|
|
2332
|
+
*/
|
|
2333
|
+
declare const repayEvent: {
|
|
2334
|
+
readonly type: "event";
|
|
2335
|
+
readonly name: "Repay";
|
|
2336
|
+
readonly inputs: readonly [{
|
|
2337
|
+
readonly name: "caller";
|
|
2338
|
+
readonly type: "address";
|
|
2339
|
+
readonly indexed: true;
|
|
2340
|
+
readonly internalType: "address";
|
|
2341
|
+
}, {
|
|
2342
|
+
readonly name: "id";
|
|
2343
|
+
readonly type: "bytes32";
|
|
2344
|
+
readonly indexed: true;
|
|
2345
|
+
readonly internalType: "bytes32";
|
|
2346
|
+
}, {
|
|
2347
|
+
readonly name: "obligationUnits";
|
|
2348
|
+
readonly type: "uint256";
|
|
2349
|
+
readonly indexed: false;
|
|
2350
|
+
readonly internalType: "uint256";
|
|
2351
|
+
}, {
|
|
2352
|
+
readonly name: "onBehalf";
|
|
2353
|
+
readonly type: "address";
|
|
2354
|
+
readonly indexed: true;
|
|
2355
|
+
readonly internalType: "address";
|
|
2356
|
+
}];
|
|
2357
|
+
readonly anonymous: false;
|
|
2358
|
+
};
|
|
2359
|
+
/**
|
|
2360
|
+
* ABI for the Liquidate event emitted by the MorphoV2 contract.
|
|
2361
|
+
*/
|
|
2362
|
+
declare const liquidateEvent: {
|
|
2363
|
+
readonly type: "event";
|
|
2364
|
+
readonly name: "Liquidate";
|
|
2365
|
+
readonly inputs: readonly [{
|
|
2366
|
+
readonly name: "caller";
|
|
2367
|
+
readonly type: "address";
|
|
2368
|
+
readonly indexed: true;
|
|
2369
|
+
readonly internalType: "address";
|
|
2370
|
+
}, {
|
|
2371
|
+
readonly name: "id";
|
|
2372
|
+
readonly type: "bytes32";
|
|
2373
|
+
readonly indexed: true;
|
|
2374
|
+
readonly internalType: "bytes32";
|
|
2375
|
+
}, {
|
|
2376
|
+
readonly name: "seizures";
|
|
2377
|
+
readonly type: "tuple[]";
|
|
2378
|
+
readonly indexed: false;
|
|
2379
|
+
readonly internalType: "struct IMorphoV2.Seizure[]";
|
|
2380
|
+
readonly components: readonly [{
|
|
2381
|
+
readonly name: "collateralIndex";
|
|
2382
|
+
readonly type: "uint256";
|
|
2383
|
+
readonly internalType: "uint256";
|
|
2384
|
+
}, {
|
|
2385
|
+
readonly name: "repaid";
|
|
2386
|
+
readonly type: "uint256";
|
|
2387
|
+
readonly internalType: "uint256";
|
|
2388
|
+
}, {
|
|
2389
|
+
readonly name: "seized";
|
|
2390
|
+
readonly type: "uint256";
|
|
2391
|
+
readonly internalType: "uint256";
|
|
2392
|
+
}];
|
|
2393
|
+
}, {
|
|
2394
|
+
readonly name: "borrower";
|
|
2395
|
+
readonly type: "address";
|
|
2396
|
+
readonly indexed: true;
|
|
2397
|
+
readonly internalType: "address";
|
|
2398
|
+
}, {
|
|
2399
|
+
readonly name: "totalRepaid";
|
|
2400
|
+
readonly type: "uint256";
|
|
2401
|
+
readonly indexed: false;
|
|
2402
|
+
readonly internalType: "uint256";
|
|
2403
|
+
}, {
|
|
2404
|
+
readonly name: "badDebt";
|
|
2405
|
+
readonly type: "uint256";
|
|
2406
|
+
readonly indexed: false;
|
|
2407
|
+
readonly internalType: "uint256";
|
|
2408
|
+
}];
|
|
2409
|
+
readonly anonymous: false;
|
|
2410
|
+
};
|
|
2411
|
+
/**
|
|
2412
|
+
* ABI for the SupplyCollateral event emitted by the MorphoV2 contract.
|
|
2413
|
+
*/
|
|
2414
|
+
declare const supplyCollateralEvent: {
|
|
2415
|
+
readonly type: "event";
|
|
2416
|
+
readonly name: "SupplyCollateral";
|
|
2417
|
+
readonly inputs: readonly [{
|
|
2418
|
+
readonly name: "caller";
|
|
2419
|
+
readonly type: "address";
|
|
2420
|
+
readonly indexed: false;
|
|
2421
|
+
readonly internalType: "address";
|
|
2422
|
+
}, {
|
|
2423
|
+
readonly name: "id";
|
|
2424
|
+
readonly type: "bytes32";
|
|
2425
|
+
readonly indexed: true;
|
|
2426
|
+
readonly internalType: "bytes32";
|
|
2427
|
+
}, {
|
|
2428
|
+
readonly name: "collateral";
|
|
2429
|
+
readonly type: "address";
|
|
2430
|
+
readonly indexed: true;
|
|
2431
|
+
readonly internalType: "address";
|
|
2432
|
+
}, {
|
|
2433
|
+
readonly name: "assets";
|
|
2434
|
+
readonly type: "uint256";
|
|
2435
|
+
readonly indexed: false;
|
|
2436
|
+
readonly internalType: "uint256";
|
|
2437
|
+
}, {
|
|
2438
|
+
readonly name: "onBehalf";
|
|
2439
|
+
readonly type: "address";
|
|
2440
|
+
readonly indexed: true;
|
|
2441
|
+
readonly internalType: "address";
|
|
2442
|
+
}];
|
|
2443
|
+
readonly anonymous: false;
|
|
2444
|
+
};
|
|
2445
|
+
/**
|
|
2446
|
+
* ABI for the WithdrawCollateral event emitted by the MorphoV2 contract.
|
|
2447
|
+
*/
|
|
2448
|
+
declare const withdrawCollateralEvent: {
|
|
2449
|
+
readonly type: "event";
|
|
2450
|
+
readonly name: "WithdrawCollateral";
|
|
2451
|
+
readonly inputs: readonly [{
|
|
2452
|
+
readonly name: "caller";
|
|
2453
|
+
readonly type: "address";
|
|
2454
|
+
readonly indexed: false;
|
|
2455
|
+
readonly internalType: "address";
|
|
2456
|
+
}, {
|
|
2457
|
+
readonly name: "id";
|
|
2458
|
+
readonly type: "bytes32";
|
|
2459
|
+
readonly indexed: true;
|
|
2460
|
+
readonly internalType: "bytes32";
|
|
2461
|
+
}, {
|
|
2462
|
+
readonly name: "collateral";
|
|
2463
|
+
readonly type: "address";
|
|
2464
|
+
readonly indexed: true;
|
|
2465
|
+
readonly internalType: "address";
|
|
2466
|
+
}, {
|
|
2467
|
+
readonly name: "assets";
|
|
2468
|
+
readonly type: "uint256";
|
|
2469
|
+
readonly indexed: false;
|
|
2470
|
+
readonly internalType: "uint256";
|
|
2471
|
+
}, {
|
|
2472
|
+
readonly name: "onBehalf";
|
|
2473
|
+
readonly type: "address";
|
|
2474
|
+
readonly indexed: true;
|
|
2475
|
+
readonly internalType: "address";
|
|
2476
|
+
}, {
|
|
2477
|
+
readonly name: "receiver";
|
|
2478
|
+
readonly type: "address";
|
|
2479
|
+
readonly indexed: false;
|
|
2480
|
+
readonly internalType: "address";
|
|
2481
|
+
}];
|
|
2482
|
+
readonly anonymous: false;
|
|
2483
|
+
};
|
|
2291
2484
|
declare class InvalidOfferError extends BaseError<z$1.ZodError | Error> {
|
|
2292
2485
|
readonly name = "Offer.InvalidOfferError";
|
|
2293
2486
|
constructor(error: z$1.ZodError | Error);
|
|
@@ -2357,6 +2550,7 @@ declare namespace fromCollateral {
|
|
|
2357
2550
|
declare function fromOffer(parameters: fromOffer.Parameters): fromOffer.ReturnType;
|
|
2358
2551
|
declare namespace fromOffer {
|
|
2359
2552
|
type Parameters = {
|
|
2553
|
+
chainId: Id;
|
|
2360
2554
|
offer: Offer;
|
|
2361
2555
|
blockNumber: number;
|
|
2362
2556
|
price?: bigint | null;
|
|
@@ -2373,6 +2567,7 @@ declare namespace fromOffer {
|
|
|
2373
2567
|
declare function fromOffers(parameters: fromOffers.Parameters): fromOffers.ReturnType;
|
|
2374
2568
|
declare namespace fromOffers {
|
|
2375
2569
|
type Parameters = {
|
|
2570
|
+
chainId: Id;
|
|
2376
2571
|
offers: Offer[];
|
|
2377
2572
|
blockNumber: number;
|
|
2378
2573
|
price?: bigint | null;
|
|
@@ -2411,7 +2606,7 @@ declare namespace Conversion {
|
|
|
2411
2606
|
}): bigint;
|
|
2412
2607
|
}
|
|
2413
2608
|
declare namespace Position_d_exports {
|
|
2414
|
-
export { Position, Type, from$8 as from };
|
|
2609
|
+
export { Position, Type, from$8 as from, positionTypeId };
|
|
2415
2610
|
}
|
|
2416
2611
|
type Position = {
|
|
2417
2612
|
/** The chain id. */chainId: Id;
|
|
@@ -2426,13 +2621,17 @@ type Position = {
|
|
|
2426
2621
|
/** The underlying asset of the position.
|
|
2427
2622
|
* For ERC20 positions, this equals the contract address.
|
|
2428
2623
|
* For vault positions, this is the vault's underlying asset.
|
|
2624
|
+
* For debt positions, this is the zero address (sentinel).
|
|
2625
|
+
* For collateral positions, this is the collateral token address.
|
|
2429
2626
|
*/
|
|
2430
|
-
asset
|
|
2627
|
+
asset: Address; /** The block number at which the position was last updated. */
|
|
2431
2628
|
blockNumber: number;
|
|
2432
2629
|
};
|
|
2433
2630
|
declare enum Type {
|
|
2434
2631
|
ERC20 = "erc20",
|
|
2435
|
-
VAULT_V1 = "vault_v1"
|
|
2632
|
+
VAULT_V1 = "vault_v1",
|
|
2633
|
+
DEBT_OF = "debtOf",
|
|
2634
|
+
COLLATERAL_OF = "collateralOf"
|
|
2436
2635
|
}
|
|
2437
2636
|
/**
|
|
2438
2637
|
* @constructor
|
|
@@ -2448,32 +2647,38 @@ declare namespace from$8 {
|
|
|
2448
2647
|
user: Address;
|
|
2449
2648
|
type: Type;
|
|
2450
2649
|
balance?: bigint;
|
|
2451
|
-
asset
|
|
2650
|
+
asset: Address;
|
|
2452
2651
|
blockNumber: number;
|
|
2453
2652
|
};
|
|
2454
2653
|
type ReturnType = Position;
|
|
2455
2654
|
}
|
|
2655
|
+
/**
|
|
2656
|
+
* Maps a {@link Type} enum value to its 1-based integer ID used in the database.
|
|
2657
|
+
* @param type - The position type.
|
|
2658
|
+
* @returns The 1-based integer ID.
|
|
2659
|
+
*/
|
|
2660
|
+
declare const positionTypeId: (type: Type) => number;
|
|
2456
2661
|
declare namespace Quote_d_exports {
|
|
2457
|
-
export { InvalidQuoteError, Quote,
|
|
2662
|
+
export { InvalidQuoteError, Quote, QuoteInput, Side, from$7 as from, fromSnakeCase, random };
|
|
2458
2663
|
}
|
|
2459
|
-
type
|
|
2664
|
+
type Side = {
|
|
2665
|
+
/** The best side tick, or null when no active quote exists. */tick: number | null; /** The side price for the obligation. (18 decimals). */
|
|
2666
|
+
price: bigint;
|
|
2667
|
+
};
|
|
2668
|
+
type QuoteInput = {
|
|
2460
2669
|
/** The obligation id. */obligationId: Hex;
|
|
2461
2670
|
ask: {
|
|
2462
|
-
/** The ask
|
|
2671
|
+
/** The best ask tick, or null when there is no active ask quote. */tick: number | null;
|
|
2463
2672
|
};
|
|
2464
2673
|
bid: {
|
|
2465
|
-
/** The bid
|
|
2674
|
+
/** The best bid tick, or null when there is no active bid quote. */tick: number | null;
|
|
2466
2675
|
};
|
|
2467
2676
|
};
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
ask:
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
bid: z$1.ZodObject<{
|
|
2474
|
-
price: z$1.ZodBigInt;
|
|
2475
|
-
}, z$1.core.$strip>;
|
|
2476
|
-
}, z$1.core.$strip>;
|
|
2677
|
+
type Quote = {
|
|
2678
|
+
/** The obligation id. */obligationId: Hex;
|
|
2679
|
+
ask: Side;
|
|
2680
|
+
bid: Side;
|
|
2681
|
+
};
|
|
2477
2682
|
/**
|
|
2478
2683
|
* Creates a quote for a given obligation.
|
|
2479
2684
|
* @constructor
|
|
@@ -2483,12 +2688,12 @@ declare const QuoteSchema: z$1.ZodObject<{
|
|
|
2483
2688
|
*
|
|
2484
2689
|
* @example
|
|
2485
2690
|
* ```ts
|
|
2486
|
-
* const quote = Quote.from({ obligationId: "0x123", ask: {
|
|
2691
|
+
* const quote = Quote.from({ obligationId: "0x123", ask: { tick: 500 }, bid: { tick: 510 } });
|
|
2487
2692
|
* ```
|
|
2488
2693
|
*/
|
|
2489
2694
|
declare function from$7(parameters: from$7.Parameters): from$7.ReturnType;
|
|
2490
2695
|
declare namespace from$7 {
|
|
2491
|
-
type Parameters =
|
|
2696
|
+
type Parameters = QuoteInput;
|
|
2492
2697
|
type ReturnType = Quote;
|
|
2493
2698
|
type ErrorType = InvalidQuoteError;
|
|
2494
2699
|
}
|
|
@@ -2500,7 +2705,7 @@ declare namespace from$7 {
|
|
|
2500
2705
|
*/
|
|
2501
2706
|
declare function fromSnakeCase(snake: fromSnakeCase.Parameters): fromSnakeCase.ReturnType;
|
|
2502
2707
|
declare namespace fromSnakeCase {
|
|
2503
|
-
type Parameters = Snake<
|
|
2708
|
+
type Parameters = Snake<QuoteInput>;
|
|
2504
2709
|
type ReturnType = Quote;
|
|
2505
2710
|
type ErrorType = from$7.ErrorType;
|
|
2506
2711
|
}
|
|
@@ -2641,6 +2846,8 @@ type Transfer = {
|
|
|
2641
2846
|
from: Address;
|
|
2642
2847
|
to: Address;
|
|
2643
2848
|
value: bigint;
|
|
2849
|
+
type: Type; /** The underlying asset of the transfer's position. */
|
|
2850
|
+
asset: Address;
|
|
2644
2851
|
blockNumber: number;
|
|
2645
2852
|
};
|
|
2646
2853
|
/**
|
|
@@ -2664,6 +2871,8 @@ declare namespace from$5 {
|
|
|
2664
2871
|
from: Address;
|
|
2665
2872
|
to: Address;
|
|
2666
2873
|
value: bigint;
|
|
2874
|
+
type: Type;
|
|
2875
|
+
asset: Address;
|
|
2667
2876
|
blockNumber: number;
|
|
2668
2877
|
};
|
|
2669
2878
|
type ReturnType = Transfer;
|
|
@@ -3127,11 +3336,16 @@ interface paths {
|
|
|
3127
3336
|
};
|
|
3128
3337
|
/**
|
|
3129
3338
|
* List all obligations
|
|
3130
|
-
* @description Returns a list of obligations with their current best ask and bid.
|
|
3339
|
+
* @description Returns a list of obligations with their current best ask and bid. Sorting is customizable with the sort parameter and defaults to id ascending.
|
|
3131
3340
|
*/
|
|
3132
3341
|
get: {
|
|
3133
3342
|
parameters: {
|
|
3134
3343
|
query?: {
|
|
3344
|
+
/**
|
|
3345
|
+
* @description Sort order as comma-separated fields (`id`, `ask`, `bid`, `maturity`). Prefix with `-` for descending order. Max 3 fields.
|
|
3346
|
+
* @example -ask,bid,maturity
|
|
3347
|
+
*/
|
|
3348
|
+
sort?: string;
|
|
3135
3349
|
/**
|
|
3136
3350
|
* @description Filter by exact maturity timestamps (comma-separated, unix seconds).
|
|
3137
3351
|
* @example 1761922800,1764524800
|
|
@@ -3158,8 +3372,8 @@ interface paths {
|
|
|
3158
3372
|
*/
|
|
3159
3373
|
limit?: number;
|
|
3160
3374
|
/**
|
|
3161
|
-
* @description
|
|
3162
|
-
* @example
|
|
3375
|
+
* @description Pagination cursor in base64url-encoded format.
|
|
3376
|
+
* @example eyJzb3J0IjpbImlkIl0sImlkIjoiMHgxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAiLCJhc2siOiIwIiwiYmlkIjoiMCIsIm1hdHVyaXR5IjoxNzYxOTIyODAwfQ
|
|
3163
3377
|
*/
|
|
3164
3378
|
cursor?: string;
|
|
3165
3379
|
};
|
|
@@ -3644,7 +3858,8 @@ interface components {
|
|
|
3644
3858
|
* "group": "0x000000000000000000000000000000000000000000000000000000000008b8f4",
|
|
3645
3859
|
* "session": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
3646
3860
|
* "callback": "0x0000000000000000000000000000000000000000",
|
|
3647
|
-
* "callback_data": "0x"
|
|
3861
|
+
* "callback_data": "0x",
|
|
3862
|
+
* "receiver_if_maker_is_seller": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401"
|
|
3648
3863
|
* },
|
|
3649
3864
|
* "offer_hash": "0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427",
|
|
3650
3865
|
* "obligation_id": "0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc",
|
|
@@ -3688,7 +3903,8 @@ interface components {
|
|
|
3688
3903
|
* "group": "0x000000000000000000000000000000000000000000000000000000000008b8f4",
|
|
3689
3904
|
* "session": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
3690
3905
|
* "callback": "0x0000000000000000000000000000000000000000",
|
|
3691
|
-
* "callback_data": "0x"
|
|
3906
|
+
* "callback_data": "0x",
|
|
3907
|
+
* "receiver_if_maker_is_seller": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401"
|
|
3692
3908
|
* }
|
|
3693
3909
|
*/
|
|
3694
3910
|
offer: components["schemas"]["OfferDataResponse"]; /** @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427 */
|
|
@@ -3734,7 +3950,8 @@ interface components {
|
|
|
3734
3950
|
group: string; /** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
|
|
3735
3951
|
session: string; /** @example 0x0000000000000000000000000000000000000000 */
|
|
3736
3952
|
callback: string; /** @example 0x */
|
|
3737
|
-
callback_data: string;
|
|
3953
|
+
callback_data: string; /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
3954
|
+
receiver_if_maker_is_seller: string;
|
|
3738
3955
|
};
|
|
3739
3956
|
ObligationOfferResponse: {
|
|
3740
3957
|
/** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */loan_token: string;
|
|
@@ -3756,7 +3973,7 @@ interface components {
|
|
|
3756
3973
|
oracle: string;
|
|
3757
3974
|
};
|
|
3758
3975
|
ObligationListResponse: {
|
|
3759
|
-
meta: components["schemas"]["Meta"]; /** @example
|
|
3976
|
+
meta: components["schemas"]["Meta"]; /** @example eyJzb3J0IjpbImlkIl0sImlkIjoiMHgxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAiLCJhc2siOiIwIiwiYmlkIjoiMCIsIm1hdHVyaXR5IjoxNzYxOTIyODAwfQ */
|
|
3760
3977
|
cursor: string | null; /** @description List of obligations with takable offers. */
|
|
3761
3978
|
data: components["schemas"]["ObligationResponse"][];
|
|
3762
3979
|
};
|
|
@@ -3770,10 +3987,20 @@ interface components {
|
|
|
3770
3987
|
bid: components["schemas"]["BidResponse"];
|
|
3771
3988
|
};
|
|
3772
3989
|
AskResponse: {
|
|
3773
|
-
/**
|
|
3990
|
+
/**
|
|
3991
|
+
* @description Best ask tick. Null when there is no active ask quote.
|
|
3992
|
+
* @example 500
|
|
3993
|
+
*/
|
|
3994
|
+
tick: number | null; /** @example 1000000000000000000 */
|
|
3995
|
+
price: string;
|
|
3774
3996
|
};
|
|
3775
3997
|
BidResponse: {
|
|
3776
|
-
/**
|
|
3998
|
+
/**
|
|
3999
|
+
* @description Best bid tick. Null when there is no active bid quote.
|
|
4000
|
+
* @example 500
|
|
4001
|
+
*/
|
|
4002
|
+
tick: number | null; /** @example 1000000000000000000 */
|
|
4003
|
+
price: string;
|
|
3777
4004
|
};
|
|
3778
4005
|
ObligationSingleSuccessResponse: {
|
|
3779
4006
|
meta: components["schemas"]["Meta"]; /** @example null */
|
|
@@ -3900,7 +4127,12 @@ interface components {
|
|
|
3900
4127
|
block_number: number;
|
|
3901
4128
|
};
|
|
3902
4129
|
ValidateOffersRequest: {
|
|
3903
|
-
/**
|
|
4130
|
+
/**
|
|
4131
|
+
* @description Chain id used for chain-scoped validation rules.
|
|
4132
|
+
* @example 1
|
|
4133
|
+
*/
|
|
4134
|
+
chain_id: number; /** @description Array of offers in snake_case format. Required, non-empty. */
|
|
4135
|
+
offers: components["schemas"]["ValidateOfferRequest"][];
|
|
3904
4136
|
};
|
|
3905
4137
|
ValidateOfferRequest: {
|
|
3906
4138
|
/** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */maker: string; /** @example 369216000000000000000000 */
|
|
@@ -3913,8 +4145,7 @@ interface components {
|
|
|
3913
4145
|
start: number; /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
|
|
3914
4146
|
group: string; /** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
|
|
3915
4147
|
session: string; /** @example false */
|
|
3916
|
-
buy: boolean; /** @example
|
|
3917
|
-
chain_id: number; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
4148
|
+
buy: boolean; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
3918
4149
|
loan_token: string;
|
|
3919
4150
|
/**
|
|
3920
4151
|
* @example [
|
|
@@ -3932,7 +4163,8 @@ interface components {
|
|
|
3932
4163
|
* "data": "0x"
|
|
3933
4164
|
* }
|
|
3934
4165
|
*/
|
|
3935
|
-
callback: components["schemas"]["ValidateCallbackRequest"];
|
|
4166
|
+
callback: components["schemas"]["ValidateCallbackRequest"]; /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
4167
|
+
receiver_if_maker_is_seller: string;
|
|
3936
4168
|
};
|
|
3937
4169
|
ValidateCollateralRequest: {
|
|
3938
4170
|
/** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */asset: string; /** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
@@ -3975,15 +4207,18 @@ type ObligationResponse = paths["/v1/obligations"]["get"]["responses"]["200"]["c
|
|
|
3975
4207
|
* Creates an `ObligationResponse` from a `Obligation`.
|
|
3976
4208
|
* @constructor
|
|
3977
4209
|
* @param obligation - {@link Obligation}
|
|
4210
|
+
* @param quote - {@link Quote}
|
|
4211
|
+
* @param chainId - The chain id used to compute `id`.
|
|
3978
4212
|
* @returns The created `ObligationResponse`. {@link ObligationResponse}
|
|
3979
4213
|
*/
|
|
3980
|
-
declare function from$3(obligation: Obligation, quote: Quote): ObligationResponse;
|
|
4214
|
+
declare function from$3(obligation: Obligation$1, quote: Quote, chainId: Id): ObligationResponse;
|
|
3981
4215
|
declare namespace OfferResponse_d_exports {
|
|
3982
4216
|
export { Input, OfferResponse, from$2 as from };
|
|
3983
4217
|
}
|
|
3984
4218
|
type OfferResponse = paths["/v1/offers"]["get"]["responses"]["200"]["content"]["application/json"]["data"][number];
|
|
3985
4219
|
type Input = Readonly<{
|
|
3986
4220
|
hash: Hex;
|
|
4221
|
+
obligationId: Hex;
|
|
3987
4222
|
maker: Address;
|
|
3988
4223
|
assets: bigint;
|
|
3989
4224
|
obligationUnits: bigint;
|
|
@@ -4006,6 +4241,7 @@ type Input = Readonly<{
|
|
|
4006
4241
|
address: Address;
|
|
4007
4242
|
data: Hex;
|
|
4008
4243
|
};
|
|
4244
|
+
receiverIfMakerIsSeller: Address;
|
|
4009
4245
|
root?: Hex | undefined;
|
|
4010
4246
|
proof?: Hex[] | undefined;
|
|
4011
4247
|
signature?: Hex | undefined;
|
|
@@ -4058,7 +4294,8 @@ type PaginationParams = {
|
|
|
4058
4294
|
};
|
|
4059
4295
|
declare namespace getByUser {
|
|
4060
4296
|
type Parameters = PaginationParams & {
|
|
4061
|
-
/** The user address to get positions for. */user: Address;
|
|
4297
|
+
/** The user address to get positions for. */user: Address; /** The type of position to get. Default is all types. */
|
|
4298
|
+
type?: Type;
|
|
4062
4299
|
};
|
|
4063
4300
|
type PositionWithReserved = {
|
|
4064
4301
|
chainId: Id;
|
|
@@ -4127,11 +4364,11 @@ declare const schemas: {
|
|
|
4127
4364
|
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
4128
4365
|
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
4129
4366
|
types: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodEnum<{
|
|
4130
|
-
oracle: "oracle";
|
|
4131
4367
|
maturity: "maturity";
|
|
4132
4368
|
callback: "callback";
|
|
4133
4369
|
loan_token: "loan_token";
|
|
4134
4370
|
collateral_token: "collateral_token";
|
|
4371
|
+
oracle: "oracle";
|
|
4135
4372
|
}>>>>;
|
|
4136
4373
|
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>>>>>;
|
|
4137
4374
|
}, z$1.core.$strip>;
|
|
@@ -4163,6 +4400,7 @@ declare const schemas: {
|
|
|
4163
4400
|
loan_tokens: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>>>;
|
|
4164
4401
|
collateral_tokens: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>>>;
|
|
4165
4402
|
maturities: 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>>>>>;
|
|
4403
|
+
sort: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodString>>>;
|
|
4166
4404
|
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
4167
4405
|
}, z$1.core.$strip>;
|
|
4168
4406
|
readonly get_obligation: z$1.ZodObject<{
|
|
@@ -4178,6 +4416,7 @@ declare const schemas: {
|
|
|
4178
4416
|
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
4179
4417
|
}, z$1.core.$strip>;
|
|
4180
4418
|
readonly validate_offers: z$1.ZodObject<{
|
|
4419
|
+
chain_id: z$1.ZodNumber;
|
|
4181
4420
|
offers: z$1.ZodArray<z$1.ZodUnknown>;
|
|
4182
4421
|
}, z$1.core.$strict>;
|
|
4183
4422
|
readonly get_user_positions: z$1.ZodObject<{
|
|
@@ -4279,18 +4518,22 @@ declare namespace getOffers {
|
|
|
4279
4518
|
}
|
|
4280
4519
|
declare function getObligations(apiClient: Client<paths>, parameters?: getObligations.Parameters): Promise<getObligations.ReturnType>;
|
|
4281
4520
|
declare namespace getObligations {
|
|
4521
|
+
type SortField = "id" | "ask" | "bid" | "maturity";
|
|
4522
|
+
type SortEntry = SortField | `-${SortField}`;
|
|
4282
4523
|
type Parameters = {
|
|
4283
|
-
/** Pagination cursor
|
|
4524
|
+
/** Pagination cursor in base64url-encoded format. */cursor?: string; /** Maximum number of obligations to return. @default 20 */
|
|
4284
4525
|
limit?: number; /** Filter by chain IDs (comma-separated). */
|
|
4285
4526
|
chainIds?: number[]; /** Filter by loan token addresses (comma-separated). */
|
|
4286
4527
|
loanTokens?: Address[]; /** Filter by collateral tokens (comma-separated, matches any collateral). */
|
|
4287
4528
|
collateralTokens?: Address[]; /** Filter by exact maturity timestamps (comma-separated, unix seconds). */
|
|
4288
|
-
maturities?: number[];
|
|
4529
|
+
maturities?: number[]; /** Sort order entries in priority order. Prefix with '-' for descending. Max 3 fields. */
|
|
4530
|
+
sort?: SortEntry[];
|
|
4289
4531
|
};
|
|
4290
4532
|
type ReturnType = {
|
|
4291
4533
|
obligations: Compute<{
|
|
4292
|
-
/** The obligation id
|
|
4293
|
-
|
|
4534
|
+
/** The obligation id returned by the API. */id: Hex; /** The chain id used to compute the obligation id. */
|
|
4535
|
+
chainId: Id;
|
|
4536
|
+
} & Obligation$1 & Omit<Quote, "obligationId">>[]; /** The pagination cursor. */
|
|
4294
4537
|
cursor: string | null;
|
|
4295
4538
|
};
|
|
4296
4539
|
type ErrorType = GetApiErrorType;
|
|
@@ -4462,7 +4705,10 @@ type GatekeeperClient = {
|
|
|
4462
4705
|
statusCode: number;
|
|
4463
4706
|
body: ConfigRulesPayload;
|
|
4464
4707
|
}>; /** Validate offers and return decision results. */
|
|
4465
|
-
isAllowed: (
|
|
4708
|
+
isAllowed: (parameters: {
|
|
4709
|
+
offers: Offer[];
|
|
4710
|
+
chainId: number;
|
|
4711
|
+
}) => Promise<Result<Offer, string>>; /** Base URL for the gatekeeper service. */
|
|
4466
4712
|
baseUrl: string;
|
|
4467
4713
|
};
|
|
4468
4714
|
type ClientConfig = {
|
|
@@ -4478,14 +4724,18 @@ type ClientConfig = {
|
|
|
4478
4724
|
*/
|
|
4479
4725
|
declare function createHttpClient(config: ClientConfig): GatekeeperClient;
|
|
4480
4726
|
declare namespace Gatekeeper_d_exports {
|
|
4481
|
-
export { Gatekeeper, Rules, create };
|
|
4727
|
+
export { Gatekeeper, Rules, RulesFactory, create };
|
|
4482
4728
|
}
|
|
4483
4729
|
type Rules = readonly Rule<Offer, string>[];
|
|
4730
|
+
type RulesFactory = (chainId: Id) => Rules;
|
|
4484
4731
|
type Gatekeeper = {
|
|
4485
|
-
isAllowed: (
|
|
4732
|
+
isAllowed: (parameters: {
|
|
4733
|
+
offers: Offer[];
|
|
4734
|
+
chainId: Id;
|
|
4735
|
+
}) => Promise<Result<Offer, string>>;
|
|
4486
4736
|
};
|
|
4487
4737
|
type GatekeeperParameters = {
|
|
4488
|
-
rules:
|
|
4738
|
+
rules: RulesFactory;
|
|
4489
4739
|
};
|
|
4490
4740
|
/**
|
|
4491
4741
|
* Create a gatekeeper instance with the provided rules.
|
|
@@ -4495,25 +4745,13 @@ type GatekeeperParameters = {
|
|
|
4495
4745
|
declare function create(parameters: GatekeeperParameters): Gatekeeper;
|
|
4496
4746
|
//#endregion
|
|
4497
4747
|
//#region src/gatekeeper/morphoRules.d.ts
|
|
4498
|
-
declare const morphoRules: (
|
|
4748
|
+
declare const morphoRules: (parameters: {
|
|
4749
|
+
chains: Chain$1[];
|
|
4750
|
+
chainId: Id;
|
|
4751
|
+
}) => (Rule<Offer, "mixed_maker"> | Rule<Offer, "amount_mutual_exclusivity"> | Rule<Offer, "maturity"> | Rule<Offer, "callback"> | Rule<Offer, "loan_token"> | Rule<Offer, "collateral_token"> | Rule<Offer, "oracle">)[];
|
|
4499
4752
|
declare namespace Rules_d_exports {
|
|
4500
|
-
export {
|
|
4753
|
+
export { amountMutualExclusivity, callback, collateralToken, loanToken, maturity, oracle, sameMaker };
|
|
4501
4754
|
}
|
|
4502
|
-
type ValidityParameters = {
|
|
4503
|
-
client: PublicClient<Transport, Chain$1>;
|
|
4504
|
-
};
|
|
4505
|
-
/**
|
|
4506
|
-
* set of rules to validate offers.
|
|
4507
|
-
*
|
|
4508
|
-
* @param _parameters - Validity parameters with chain and client
|
|
4509
|
-
* @returns Array of validation rules to evaluate against offers
|
|
4510
|
-
*/
|
|
4511
|
-
declare function validity(_parameters: ValidityParameters): Rule<Offer, "expiry">[];
|
|
4512
|
-
declare const chains: ({
|
|
4513
|
-
chains
|
|
4514
|
-
}: {
|
|
4515
|
-
chains: Chain$1[];
|
|
4516
|
-
}) => Rule<Offer, "chain_ids">;
|
|
4517
4755
|
declare const maturity: ({
|
|
4518
4756
|
maturities
|
|
4519
4757
|
}: {
|
|
@@ -4531,9 +4769,11 @@ declare const callback: ({
|
|
|
4531
4769
|
* @returns The issue that was found. If the offer is valid, this will be undefined.
|
|
4532
4770
|
*/
|
|
4533
4771
|
declare const loanToken: ({
|
|
4534
|
-
assetsByChainId
|
|
4772
|
+
assetsByChainId,
|
|
4773
|
+
chainId
|
|
4535
4774
|
}: {
|
|
4536
4775
|
assetsByChainId: Partial<Record<Id, Address[]>>;
|
|
4776
|
+
chainId: Id;
|
|
4537
4777
|
}) => Rule<Offer, "loan_token">;
|
|
4538
4778
|
/**
|
|
4539
4779
|
* A validation rule that checks if the offer's collateral tokens are allowed for its chain.
|
|
@@ -4541,9 +4781,11 @@ declare const loanToken: ({
|
|
|
4541
4781
|
* @returns The issue that was found. If the offer is valid, this will be undefined.
|
|
4542
4782
|
*/
|
|
4543
4783
|
declare const collateralToken: ({
|
|
4544
|
-
collateralAssetsByChainId
|
|
4784
|
+
collateralAssetsByChainId,
|
|
4785
|
+
chainId
|
|
4545
4786
|
}: {
|
|
4546
4787
|
collateralAssetsByChainId: Partial<Record<Id, Address[]>>;
|
|
4788
|
+
chainId: Id;
|
|
4547
4789
|
}) => Rule<Offer, "collateral_token">;
|
|
4548
4790
|
/**
|
|
4549
4791
|
* A validation rule that checks if the offer's oracle addresses are allowed for its chain.
|
|
@@ -4551,9 +4793,11 @@ declare const collateralToken: ({
|
|
|
4551
4793
|
* @returns The issue that was found. If the offer is valid, this will be undefined.
|
|
4552
4794
|
*/
|
|
4553
4795
|
declare const oracle: ({
|
|
4554
|
-
oraclesByChainId
|
|
4796
|
+
oraclesByChainId,
|
|
4797
|
+
chainId
|
|
4555
4798
|
}: {
|
|
4556
4799
|
oraclesByChainId: Partial<Record<Id, Address[]>>;
|
|
4800
|
+
chainId: Id;
|
|
4557
4801
|
}) => Rule<Offer, "oracle">;
|
|
4558
4802
|
/**
|
|
4559
4803
|
* A batch validation rule that ensures all offers in a tree have the same maker address.
|
|
@@ -4759,5 +5003,5 @@ declare namespace index_d_exports$2 {
|
|
|
4759
5003
|
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 };
|
|
4760
5004
|
}
|
|
4761
5005
|
//#endregion
|
|
4762
|
-
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, 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, Tick_d_exports as Tick, 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 };
|
|
5006
|
+
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, 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, Id_d_exports as Id, 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, Tick_d_exports as Tick, 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 };
|
|
4763
5007
|
//# sourceMappingURL=index.browser.d.ts.map
|