Skip to main content

Make offer (build typed-data)

GET 

/v1/actions/midnight/make

MAKE — step 1 of 2. Build the EIP-712 typed-data for a limit offer at your own rate.

Morpho Midnight is an order-book lender — liquidity is a book of maker offers, not a pool — so there are two ways to interact:

  • TAKE (fill existing offers): use the standard lending actions, which route to Midnight automatically for a MORPHO_MIDNIGHT_<id> market. There is no separate "take" endpoint.
  • MAKE (post your own limit offer at a chosen rate): the endpoints in this section (/v1/actions/midnight/*) plus /v1/data/lending/orders to list and cancel them.

Make flow (worker-assisted signing):

  1. GET /v1/actions/midnight/make → returns typedData, the echoed inputs, and a one-time authorization tx.
  2. The maker signs typedData with their wallet (wallet.signTypedData).
  3. POST /v1/actions/midnight/finalize with { inputs, signature } → the on-chain transaction that publishes the offer to the Midnight mempool.

If authorization is present and the maker has not yet authorized the ratifier (read isAuthorized on-chain), send that one-time setIsAuthorized transaction before finalizing. The APR you request is snapped to an order-book tick — aprPctSnapped is the exact rate the offer will quote.

Plain-text reference — GET /v1/actions/midnight/make

Parameters

ParameterInTypeRequiredDescription
chainIdquerystringyesChain ID (alias: chain). Midnight is Base-only today. See the ChainId schema for the full set of supported chains.
lenderquerystringyesMORPHO_MIDNIGHT_<id> lender key (the market to post into). See the LenderId schema for the full set of accepted values.
sidequerylend, borrowyeslend posts a bid (you lend when taken); borrow posts an ask (you borrow when taken).
aprPctquerynumberyesYour target APR in percent (alias: rate). Snapped to an order-book tick; see aprPctSnapped in the response.
sizequerystringyesOffer size in loan-token units (integer wei).
expiryqueryintegeryesOffer expiry, unix seconds. Must be in the future and ≤ the market maturity.
accountquerystringyesMaker (offer owner) address.

Response 200

FieldTypeDescription
successTrue
dataobjectEverything the frontend needs to sign and publish a maker offer (step 1 of the make flow). actions is null — the publish transaction is produced by /finalize after signing.
data.typedDataobjectEIP-712 typed-data to sign with wallet.signTypedData (bigints serialized as strings — sign the response as-is).
data.inputsobjectDeterministic offer inputs. Returned verbatim by GET /v1/actions/midnight/make; POST them back unchanged to /v1/actions/midnight/finalize alongside the signature so the worker rebuilds the identical offer tree. Any tampering fails on-chain ratification.
data.inputs.chainIdstringEVM chain id, as a decimal string. See the ChainId schema.
data.inputs.lenderstringMORPHO_MIDNIGHT_<id> lender key.
data.inputs.buybooleantrue = maker BUYS units (a lend offer / bid); false = maker SELLS units (a borrow offer / ask).
data.inputs.tickstringOrder-book tick the APR snapped to.
data.inputs.startstring
data.inputs.expirystringOffer expiry, unix seconds.
data.inputs.maxAssetsstringMaker-side size in loan-token units.
data.inputs.makerstringMaker (offer owner) address.
data.authorizationobjectOne-time setIsAuthorized(ecrecoverRatifier, true) transaction on the Midnight core. Send FIRST, only if the maker has not authorized the ratifier yet (read isAuthorized on-chain).
data.authorization.tostring
data.authorization.datastringInformational payload. null when the endpoint only builds calldata.
data.authorization.valuestringNative-token value to send with the transaction, in wei.
data.authorization.ratifierstring
data.aprPctSnappednumberThe exact APR (percent) after tick-snapping — what the offer will actually quote once posted.
data.maturitynumberMarket maturity, unix seconds.
actionsnull

Example response

{
"success": true,
"data": {
"typedData": {},
"inputs": {
"chainId": "8453",
"lender": "MORPHO_MIDNIGHT_0xABC\u2026",
"buy": true,
"tick": "string",
"start": "0",
"expiry": "string",
"maxAssets": "string",
"maker": "string"
},
"authorization": {
"to": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"data": "0x617ba037000000000000000000000000c02aaa39b2",
"value": "1000000000000000000",
"ratifier": "string"
},
"aprPctSnapped": 3.49,
"maturity": 1.0
}
}

Request

Responses

Offer typed-data, echoed inputs, and one-time authorization