loanId.
Prerequisites
Before you begin, ensure that you’ve:- Installed the App Kit SDK and an adapter
- Opened a loan with debt or collateral to withdraw
Repay part of a loan
Callrepay with the loan’s loanId and the USDC amount. The SDK rejects the
request before signing if repayAmount exceeds outstanding debt. Use
closeLoan for a full payoff.
TypeScript
Close a loan in full
CallcloseLoan to repay all outstanding debt and withdraw all collateral in a
single atomic batch. The SDK uses share-based payoff math and may pull more USDC
than needed, up to your slippageBps bound, refunding any surplus.
TypeScript
Withdraw collateral
CallwithdrawCollateralRepayIfNeeded to release cirBTC from a loan. The SDK
sizes any repayment needed to keep the loan healthy after the withdrawal and
pays it from the wallet’s USDC balance in the same atomic batch. If the
repayment covers the entire debt, the withdrawal closes the loan.
TypeScript