Overview
Starkzap supports lending and borrowing through Vesu. Users can supply assets (deposit), borrow against collateral, repay debt, and withdraw supplied assets. What users can do with lending:- 💰 Supply assets - Deposit tokens into lending pools and earn interest (supply APY)
- 💳 Borrow - Use supplied collateral to borrow other assets
- 💵 Repay - Pay down debt; optionally withdraw collateral in the same flow
- 📤 Withdraw - Withdraw supplied tokens (or max withdraw in one call)
- 📊 Monitor positions - Query position size, debt, and collateralization health
The default lending provider is Vesu. It is registered automatically when the wallet is created. You can register additional providers or set a different default via
wallet.lending().registerProvider() and setDefaultProvider().Configuration
No extra configuration is required for Vesu on mainnet or Sepolia. The wallet’slending() client uses the connected chain:
Discovering markets
Fetch available lending markets for the wallet’s chain:LendingMarket shape
poolAddress / asset / vTokenAddress) when calling deposit, withdraw, borrow, and repay with the same token/pool.
Depositing
Supply tokens into a lending pool. The provider includes the approval call when building the transaction.Withdrawing
Withdraw a specific amount of supplied tokens:Max withdraw may not be supported by all providers. Vesu supports
withdrawMax. Check provider.prepareWithdrawMax or catch the error if you need to support multiple providers.Borrowing
Borrow against collateral. You specify the collateral pair (collateral token + debt token) and the amount to borrow (or collateral amount, depending on denomination).poolAddress if you have a specific pool, or provider: "vesu" to force the provider. user defaults to the wallet address.
Repaying
Repay borrowed debt. You can optionally withdraw collateral in the same action (provider-dependent).Position and health
Get position
Retrieve the user’s lending position for a collateral/debt pair:LendingPosition shape
Get health
Check if the position is collateralized (above liquidation threshold):Quote projected health
Simulate an action (e.g. borrow or repay) and get the projected health after the action, plus the prepared calls and fee simulation:Using the transaction builder
Batch lending actions with transfers, staking, or other operations using the tx builder. Methods are prefixed withlend:
.lendDeposit(request)— add a deposit.lendWithdraw(request)— add a withdraw.lendWithdrawMax(request)— add a max withdraw.lendBorrow(request)— add a borrow.lendRepay(request)— add a repay
Best practices
- Check health before and after borrow/repay so users understand liquidation risk.
Use quoteHealth()to show projected health after an action before the user confirms.- Discover markets once (e.g. on load) and cache
getMarkets()if you list markets in the UI. - Use token presets for
token,collateralToken, anddebtTokenso addresses match the chain.
Troubleshooting
”Lending provider returned no calls”
The provider could not build calls for the given request (e.g. wrong pool, unsupported pair, or invalid amount). Verify the market exists for the current chain and that you are passing the correct tokens and pool.Provider does not support chain
Vesu supportsSN_MAIN and SN_SEPOLIA. Ensure the wallet is on one of these chains. If you use a custom provider, ensure it supports the wallet’s chain.
”No default lending provider configured”
The default is set when the wallet is created (Vesu). If you replaced it, callsetDefaultProvider("vesu") or pass provider: "vesu" in each request.
Next steps
- Bitcoin, Stablecoins, and Tokens — Token presets and amounts
- Transactions — Execution options and fee modes
- Tx Builder — Batching operations
- API Reference — Full method signatures