Skip to main content
API REFERENCETo fully utilize the Lend API, check out the Lend API Reference.

Prerequisite

Set up RPC
NOTESolana provides a default RPC endpoint. However, as your application grows, we recommend you to always use your own or provision a 3rd party provider’s RPC endpoint such as Helius or Triton.
Set up Development Wallet
NOTE
  • You can paste in your private key for testing purposes but this is not recommended for production applications.
  • If you want to store your private key in the project directly, you can do it via a .env file.
To set up a development wallet via .env file, you can use the following script.
To set up a development wallet via a wallet generated via Solana CLI, you can use the following script.

Deposit and Withdraw

Using the Deposit or Withdraw endpoint, the user can do so based on the amount of assets to be deposited/withdrawn.
USAGE STEPS
1
User chooses the token.
2
User chooses the amount of assets to deposit or withdraw in the specific token mint.
3
Post request to get the transaction.
4
User sign and send the transaction to the network.
5
The mint authority mints/burns the vault tokens to/from the user.

Mint and Redeem

Using the Mint or Redeem endpoint, the user can do so based on the number shares to be minted/redeemed.
USAGE STEPS
1
User chooses the token.
2
User chooses the number of shares to deposit or withdraw in the specific token mint.
3
Post request to get the transaction.
4
User sign and send the transaction to the network.
5
The mint authority mints/burns the vault tokens to/from the user.

Build Your Own Transaction

The Lend API provides 2 ways to interface with the Earn functions in the Jupiter Lend Program. You can either make a post request to directly get the Transaction, or Instruction which can be used for CPI or composing with additional instructions.

Transaction

To use the Transaction method, simply request to the endpoints without -instructions suffix directly, as shown in the examples above. The API will respond with an unsigned base64 transaction for the signer to sign, then sent to the network for execution.

Instruction

In some use cases, you’d prefer to utilize the instructions instead of the serialized transaction, so you can utilize with CPI or compose with other instructions. You can make a post request to -instructionsendpoints instead.
Example code snippet of using /deposit-instructions endpoint and building a transaction with the instructions.

CPI

Tokens

Jupiter Lend provides Earnings for individual tokens, meaning SOL and USDC will be deposited in isolation. To get all token information such as the underlying token, supply, rates and liquidity information.

User Data

Below are the endpoints to aid user to better manage their positions with data of each existing positions, earnings, etc.

Positions

Given a user, you are able to get their existing position data such as shares, underlying assets, balance and allowance.

Earnings

Get the earnings of specific positions for a user. The response includes the earnings amount and the slot at which it was computed.
Response: