Publish Midnight lend offers
Builds and simulates the calls that publish a public set of lend offers priced by offers.type (price for a fixed price per unit, rate for an interest rate).
Entries may target different markets on one chain when every market uses the same loan token; each offer must expire by its market maturity. Every offer carries the requested loan-asset cap, and fills across all offers in the group count toward one shared total, so the group as a whole fills at most that cap. For an entry market that is not yet created, include its parameters in market_params; otherwise the route returns 404 MARKET_NOT_FOUND. With p2p: true, the offer is intended for direct sharing with a taker and is not checked against public offer-book admission rules. With funding_source.type wallet (the default), the account wallet funds the offers. The approval threshold is max(new, currentAllowance + new), where new is the new loan-asset cap. If the current allowance is below that threshold, the API requests a persistent maximum (maxUint256) approval rather than approving the threshold exactly. The threshold and approval are subject to the token-specific approval cap. With variable_rate_market, the loan assets are supplied to the selected market on behalf of a dedicated funding address while the offers are live, rather than to the account's own lending position; funding describes how those assets are supplied. With wallet funding, publishing the offers does not transfer loan assets or change the account's lending position. With variable-rate-market funding, publication debits the account's funding assets and supplies them into that dedicated funding address's variable-rate lending position.
Authorization
ApiKeyAuth Send your Morpho-issued key on every action request. JWKS needs no key on every host; public documentation needs no key.
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/v0/actions/midnight/offers/lend" \ -H "Content-Type: application/json" \ -d '{ "account": "0x6aBB9Aeb93e9aF04c8D9FD2b84BF6ca8EDC3eAf2", "chain_id": 8453, "amount": { "unit": "assets", "value": "1000000" }, "offers": { "type": "price", "entries": [ { "market_id": "0xcdea4ca06837feca3026b23a95f0bd96c3eabdc77d1211472ce0346fcc200649", "tick": "5000", "starts_at": 0, "expires_at": 1793000000 } ] } }'{ "data": { "action_id": "act_0123456789abcdef0123456789abcdef", "status": "prepared", "action": "midnight.make_lend", "chain_id": 8453, "account": "0x6aBB9Aeb93e9aF04c8D9FD2b84BF6ca8EDC3eAf2", "expires_at": 1760001800, "offer": { "groups": [ "0x8a5a61e963bbb7b75df0c23ccc4116b981cadc135aa3a8dd220e0ec5e7bcf95c" ], "entry_count": 1 }, "calls": [ { "id": "call_0", "kind": "cancel_and_publish", "to": "0x0bF30B530f816a619C3F28a3b9f44C441122555D", "data": "0xb4691380000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000008a0e69772315652165921d722b3caaea4c326e6d408af886ec8229d52eb6333b210d43c84c85adbfa6d3ee0f36e3bd546e2e34200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003e000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000068e77f080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000174010000016f1f8b08000000000000136360c00b14f04b33303250a6df01bf344b0201eb1f90e2beacddb35e4f7eb99ee5c4cdbfda2dfb7356bc3dfcea13030520eb3e1301f70b77744525be4cdebd7d7bec874336671cc576369eba231cb578c55d253ebea3cff7fc8ca1c47e0606169254732c7836bdc8302c482c52f1bad2e653eb961c567bc6404bc0ef44207c0801455664dedab73756e7be302acb7ffbe1d791997a31be760bbb90e59d300d60a324f9663dd9f001979c79d3ad73732730d01a302173b41e7f7c532f1f2074fed50689e83f558bcff3be51c2a5915736a0ce615f034e8359342f644acc4315db6011ba36ea6f76ef0e4ed9aba1326bfcae29de44491fbf4a792f70ce5bbb5dd741c8e55ef1b9eaceb73ff971da3f73c5b9e38f1848b27f817ed28cc27da6d76ef3779c74393f3534e44dfb01dc261005165ce158df917742696ed0eb64e34d02576c5a4e44ddfe956bf7e0739ef555b7478fb124199200ee002612000060535ff880050000000000000000000000000000", "value": "0" } ], "simulation": { "status": "success", "block": { "number": "21000000", "timestamp": 1760000000 }, "wallet_changes": [], "position_changes": {}, "effects": { "groups": [ "0x8a5a61e963bbb7b75df0c23ccc4116b981cadc135aa3a8dd220e0ec5e7bcf95c" ], "entry_count": 1 } } }}{ "error": { "code": "REQUEST_ABORTED", "message": "string", "details": [ { "code": "string", "message": "string", "path": [ "string" ], "rule": "string", "details": { "min_assets": "string", "loan_token": "string" } } ], "request_id": "string" }}{ "error": { "code": "MARKET_NOT_FOUND", "message": "string", "details": [ { "code": "string", "message": "string", "path": [ "string" ], "rule": "string", "details": { "min_assets": "string", "loan_token": "string" } } ], "request_id": "string" }}{ "error": { "code": "PAYLOAD_TOO_LARGE", "message": "string", "details": [ { "code": "string", "message": "string", "path": [ "string" ], "rule": "string", "details": { "min_assets": "string", "loan_token": "string" } } ], "request_id": "string" }}{ "error": { "code": "ACTION_UNSUPPORTED", "message": "This action is not supported.", "details": null, "request_id": "req_0123456789abcdef0123456789abcdef" }}{ "error": { "code": "INTERNAL_ERROR", "message": "string", "details": [ { "code": "string", "message": "string", "path": [ "string" ], "rule": "string", "details": { "min_assets": "string", "loan_token": "string" } } ], "request_id": "string" }}{ "error": { "code": "CONTRACT_CODE_MISSING", "message": "string", "details": [ { "code": "string", "message": "string", "path": [ "string" ], "rule": "string", "details": { "min_assets": "string", "loan_token": "string" } } ], "request_id": "string" }}POSTPublish Midnight borrow offers with optional collateral supply
Builds and simulates the calls that publish a public set of borrow offers priced by offers.type (price for a fixed price per unit, rate for an interest rate).
POSTPublish Midnight debt-repayment offers
Builds and simulates the calls that publish a public set of reduce-only debt-repayment offers priced by offers.type.