1- import { MarketUtils , midnightBundlesAbi } from "@morpho-org/midnight-sdk" ;
1+ import {
2+ type MarketInput ,
3+ MarketUtils ,
4+ midnightBundlesAbi ,
5+ } from "@morpho-org/midnight-sdk" ;
26import { deepFreeze , getChainAddress } from "@morpho-org/morpho-ts" ;
3- import { encodeFunctionData , zeroAddress } from "viem" ;
7+ import { type Address , encodeFunctionData , zeroAddress } from "viem" ;
48import { addTransactionMetadata } from "../../helpers/index.js" ;
59import {
10+ type AnyRequirementSignature ,
611 EmptyMidnightTakesError ,
12+ type Metadata ,
713 type MidnightBorrowMarketAction ,
814 MidnightTakeMarketMismatchError ,
915 MidnightTakeSideMismatchError ,
@@ -13,10 +19,24 @@ import {
1319 UnknownMidnightCollateralError ,
1420} from "../../types/index.js" ;
1521import { encodeMidnightTokenPermit } from "./encodeMidnightTokenPermit.js" ;
16- import type {
17- MidnightBorrowMarketParams ,
18- MidnightCollateralSupply ,
19- } from "./types.js" ;
22+ import type { MidnightCollateralSupply , MidnightTake } from "./types.js" ;
23+
24+ /** Parameters for {@link midnightBorrowMarket}. */
25+ export interface MidnightBorrowMarketParams {
26+ readonly chainId : number ;
27+ readonly market : MarketInput ;
28+ readonly collateralAssets : bigint ;
29+ readonly loanAssets : bigint ;
30+ readonly maxUnits : bigint ;
31+ readonly taker : Address ;
32+ readonly receiver ?: Address ;
33+ readonly collateralIndex ?: bigint ;
34+ readonly takes : readonly MidnightTake [ ] ;
35+ readonly signatures ?:
36+ | AnyRequirementSignature
37+ | readonly AnyRequirementSignature [ ] ;
38+ readonly metadata ?: Metadata ;
39+ }
2040
2141/** Encodes the borrow-market Midnight bundle. */
2242export const midnightBorrowMarket = (
0 commit comments