Skip to main content

Repay Debt

Repay borrowed assets to improve your position health.
1

Add Dependencies

klend-interface is a lightweight Rust instruction builder that creates Vec<Instruction> with required refresh instructions prepended automatically.
2

Set Up RPC Client

3

Build Obligation Context

ObligationContext is the recommended approach for obligation-based operations. It fetches the obligation and its associated reserves, then provides convenient .deposit(), .borrow(), .repay(), and .withdraw() methods.
4

Derive Token Accounts

5

Build Instructions

6

Build and Send Transaction

Repaying reduces your debt and improves your loan-to-value (LTV) ratio, making your position healthier and reducing liquidation risk.
The repay is complete. Your debt has been reduced.

Withdraw

1

Add Dependencies

klend-interface is a lightweight Rust instruction builder that creates Vec<Instruction> with required refresh instructions prepended automatically.
2

Set Up RPC Client

3

Build Obligation Context

ObligationContext is the recommended approach for obligation-based operations. It fetches the obligation and its associated reserves, then provides convenient .deposit(), .borrow(), .repay(), and .withdraw() methods.
4

Derive Token Accounts

5

Build Instructions

Use helpers::withdraw::redeem() if you hold cTokens without an obligation — see the Withdraw for Lending tab.
6

Build and Send Transaction

The withdrawal is complete. Your collateral has been returned to your wallet.