Facility closures
repayAndCloseFacility atomically repays every outstanding facility obligation and closes the LOC. The partner does not choose a closure amount, drawdown list, wallet, chain, contract, token, or allocation.
High-level SDK
Use repayAndCloseFacility(...) for the normal partner flow.
The SDK:
retrieves the facility;
verifies the wallet is the facility’s active designated wallet;
creates a closure resource with a generated idempotency key;
handles up to two token approval transactions when needed;
verifies and sends the
repayDrawdownsAndClosetransaction;verifies
RepaymentMade, expectedDrawdownRepaidevents, andLOCClosedin the receipt;polls the closure resource until
CLOSEDorFAILED.
REST workflow
GET /v1/facilities/{facility_id}/closure-dues
POST /v1/facilities/{facility_id}/closures
GET /v1/facility-closures/{closure_id}
POST /v1/facility-closures/{closure_id}/prepareThe dues preview is informational. Creation reads fresh obligations, creates the closure resource, blocks new drawdown requests, and returns the first unsigned action.
If the first action is TOKEN_APPROVAL, the partner signs and confirms the approval, then calls prepare for the next action. If allowance is already sufficient, creation can return the financial closure action directly.
The financial transaction repays all obligations and closes the LOC. Qiro marks the facility closed only after the required repayment and LOCClosed evidence is verified.
Token approval
If allowance is sufficient, creation may return a FACILITY_CLOSURE action immediately.
If allowance is insufficient, creation returns TOKEN_APPROVAL. Some tokens require resetting a non-zero allowance to zero before setting a new allowance. The SDK supports this bounded path:
The SDK stops if the API ever asks for more than two approval transactions.
Main statuses
Do not treat a transaction hash alone as closure. The status endpoint is authoritative.