The Vault
โšก Power Users

๐Ÿ“š Direct Stake API

Mint LSTs directly with The Vault API, no React needed.

View as Markdown

For developers who prefer not to use React or wish to integrate minting functionality in a custom manner, The Vault offers a direct API endpoint at https://direct.vaultapi.dev. This API enables you to mint Liquid Staking Tokens (LSTs) by constructing transactions tailored to your application's requirements.

Banner: A developer joins two orange puzzle connectors between a cream laptop with a blank screen and a small validator server, representing a staking API integration.

For the code, see the GitHub repository The Vault LST Creator Widget.

API endpoint

The endpoint that builds a stake transaction is https://direct.vaultapi.dev/stake.

Required query parameters

To successfully create a transaction, the following parameters must be included in the request:

ParameterTypeDescription
mintStringThe mint address of the LST to be minted.
addressStringThe wallet address initiating the minting process.
amountNumberThe amount of SOL to stake, in lamports.
balanceNumberThe wallet's SOL balance, in lamports. The API stakes at most this amount.

Optional parameter

The target parameter (String) is used only when minting vSOL: set it to the vote account of the validator to direct the vSOL to. Without it, the vSOL is not directed to a validator and becomes undirected stake. With it, the transaction also sets the wallet to direct stake to that validator.

API response

Upon sending a valid request, the API returns a base64-encoded transaction in the transaction field. The user's wallet must sign this transaction and then broadcast it to the Solana network to complete the minting process.

Integrate the API

Integration takes five steps.

Construct the API request

Gather the required parameters: address, mint, amount and balance. To direct the vSOL to a validator, also include the target parameter.

Send the request

Make a GET request with the collected parameters to:

https://direct.vaultapi.dev/stake

Handle the response

Receive a base64-encoded transaction in the API's transaction field.

Sign the transaction

Prompt the user's wallet to sign the received transaction.

Broadcast the transaction

Submit the signed transaction to the Solana network for processing.

Example API call

You can test the API with the following example:

curl "https://direct.vaultapi.dev/stake?\
address=<Minter's wallet address>&\
mint=vSoLxydx6akxyMD9XEcPvGYNGq6Nn66oqVb3UkGkei7&\
amount=100000&\
balance=1000000"

If you run this, the transaction field contains a transaction that you can inspect and simulate by pasting it into the Solana Transaction Inspector.

Unstake endpoint

To swap vSOL back to SOL, send a GET request to https://direct.vaultapi.dev/unstake with two parameters:

  • address: the wallet that holds the vSOL.
  • amount: the amount of vSOL to unstake, in raw units.

The API returns a transaction that unstakes through The Vault's Unstake Pool and falls back to a Jupiter swap when the pool lacks liquidity.

Stake data

The API builds transactions only; it doesn't serve stake data. The stakebot publishes its validated stake data, including direct stake per validator, in the stakebot-data repository, and the Dune dashboard lists The Vault's validators.

Get help

For any issues or questions, join our Discord community.

On this page