Publish Midnight debt-repayment offers
Builds and simulates the calls that publish a public set of reduce-only debt-repayment offers priced by offers.type.
Every offer carries the requested debt-unit 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. The new loan-token approval requirement (new) is derived from the debt-unit cap in amount.value. The approval threshold is max(new, currentAllowance + new). 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. Entries may target different markets on one chain when every market uses the same loan token; each offer must expire by its market maturity. With p2p: true, the offer is intended for direct sharing with a taker and is not checked against public offer-book admission rules. Publishing the offers does not transfer loan assets or change a 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/repay" \ -H "Content-Type: application/json" \ -d '{ "account": "0x6aBB9Aeb93e9aF04c8D9FD2b84BF6ca8EDC3eAf2", "chain_id": 8453, "amount": { "unit": "units", "value": "1000000" }, "offers": { "type": "rate", "entries": [ { "market_id": "0xcdea4ca06837feca3026b23a95f0bd96c3eabdc77d1211472ce0346fcc200649", "tick": "4513", "starts_at": 0, "expires_at": 1793000000, "rate_wad": "1000000000" } ] } }'{ "data": { "action_id": "act_0123456789abcdef0123456789abcdef", "status": "prepared", "action": "midnight.make_repay", "chain_id": 8453, "account": "0x6aBB9Aeb93e9aF04c8D9FD2b84BF6ca8EDC3eAf2", "expires_at": 1760001800, "offer": { "groups": [ "0x8306585ae2d17ab16b540b390c4e18b755ea9c62c718aa584a2912ccd8cdbb4a" ], "entry_count": 1 }, "calls": [ { "id": "call_0", "kind": "cancel_and_publish", "to": "0x0bF30B530f816a619C3F28a3b9f44C441122555D", "data": "0xb4691380000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000003c00000000000000000000000003b2fba901c88f026bf50a12c8b28484cd81f952628c2ed3bff7018c78511a6a4501656efa086529a9133ab5f41f2259c3bcf7eec00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003e000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000068e77f08000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000017801000001731f8b08000000000000136360c00b14f04b33303250a6df01bf344b0201eb1f90e2beacddb35e4f7eb99ee5c4cdbfda2dfb7356bc3dfcea13030520eb3e1301f70b2e6c668b887a74b16a637608b7258f9fc4f6d05773928e4bac8af0d2143a73e3ec6e2f4aec6760602149b5b5feae09321d1fd4f6072cd4e9d6f0f0b9213f558da2f8e57722e07f4a81222b326feddb1bab735f1895e5bffdf0ebc84cbd185fbb855dc8f24e9806b051e2bdac271b3ee092336fba756eee04065a0326648ed6e38f6feae50384cebfda2011fda76af179de374ab834f2ca06d439ec6bc069308be6854c8979a8621b2c42d746fdcdeeddc1297b3554668ddf35c59bcf90e57f95f25ee09cb776bbae8390cbbde273d59d6f7ff2e3b47fe68a73c71f319064ff02fda41985fb4cafdde6ef38e9727e6a68c89bf603b84d200a1cd038f4d6fa7f81c4f156c1654b02c4c2de2f680b9a35d17875bce327d539d6e7ebde5068fe027c92d6b34e51683c03030059d8d1daa00500000000000000000000", "value": "0" } ], "simulation": { "status": "success", "block": { "number": "21000000", "timestamp": 1760000000 }, "wallet_changes": [], "position_changes": {}, "effects": { "groups": [ "0x8306585ae2d17ab16b540b390c4e18b755ea9c62c718aa584a2912ccd8cdbb4a" ], "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 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).
POSTPublish Midnight credit-withdrawal offers
Builds and simulates the calls that publish a public set of reduce-only credit-withdrawal offers priced by offers.type.