Publish 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).
Price offers require a nonzero tick; tick 0 returns 422 ACTION_UNSUPPORTED. 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. When collateral_supplies is present, the collaterals are supplied atomically in the same action. Publishing the offers does not move loan assets.
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/borrow" \ -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_borrow", "chain_id": 8453, "account": "0x6aBB9Aeb93e9aF04c8D9FD2b84BF6ca8EDC3eAf2", "expires_at": 1760001800, "offer": { "groups": [ "0xd2420823311ff567933f4c50fb0a2c34744096f50204ac38dfc896f0ed808b4f" ], "entry_count": 1 }, "calls": [ { "id": "call_0", "kind": "cancel_and_publish", "to": "0x0bF30B530f816a619C3F28a3b9f44C441122555D", "data": "0xb4691380000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000008a0e69772315652165921d722b3caaea4c326e695dbdc4799df6cf7061479c7e4727794ed50ea5ec605b596fbda8f764b3af8e300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003e000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000068e77f08000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000017e01000001791f8b08000000000000036360c00b14f04b3330129027a4df01bf344b0201eb1f10301f0564ed9ef57af2cbf52c276efed56ed99fb3e2ede1579f48d18f61de7d2602ee17eeb8e4c4a16c28ff357db2bd4fc06f2e1d931287695f9958d658dc3f31edc3db866e7f4aec67606041750f01ff712c7836bdc8302c482c52f1bad2e653eb961c567b4699fd0400bf1381f02104145991796bdfde589dfbc2a82cffed875f4766eac5f8da2dec429677c234800dbff9f8936fd6930d1f70c99937dd3a3777027ed3a9009890395a8f3fbea9970f103aff6a8344f49faac5e779df28e1d2c82b1b50e7b0af01a7c12c9a173225e6a18a6db0085d1bf537bb7707a7ecd55099357ed7146fa2a48f5fa5bc1738e7adddaeeb20e472aff85c75e7db9ffc38ed9fb9e2dcf147b83d86cdfe05fa49330af7995ebbcddf71d2e5fcd4d09037ed07709b40145830f5f61df799f773beb389541e7f52543ee56dc0abb863ac5ba7fdbed55fe66df5e33185e6e30e6022010058bffc93800500000000", "value": "0" } ], "simulation": { "status": "success", "block": { "number": "21000000", "timestamp": 1760000000 }, "wallet_changes": [], "position_changes": {}, "effects": { "groups": [ "0xd2420823311ff567933f4c50fb0a2c34744096f50204ac38dfc896f0ed808b4f" ], "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" }}POSTBuild a quoted Midnight borrow
Builds a borrow of an exact loan-asset amount (unit: assets) or an exact debt-unit amount (unit: units; debt units are the borrow-side unit, redeemable for…
POSTPublish 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).