This is a devnet quickstart guide.
1
Install Dynamic Vault Dependencies
2
Import libraries
3
Set up the connection, wallet and provider
Set up the devnet connection:
4
Airdrop SOL into the devnet wallet
As this demo will be done using a devnet wallet, we can use the Solana airdrop function to deposit some initial SOL into the wallet.Define the SOL airdrop function as shown below. We have already included this function in the util.ts file for easy access and use:To trigger the airdrop to your devnet wallet, simply call the function with devnetConnection and your mockWallet public key as input parameters:
5
Initialize the Vault
Retrieve the token info required to initialize the vault instance. We use the SOL token as an example here:Set up the vault instance using the connection and the token info:If you are an affiliate partner, you have to pass in an additional parameter - affiliateId when setting up the vault instance. The affiliateId is the partner wallet address that was used to set up the affiliate relationship with the Meteora Dynamic Yield layer:
6
Get key data from the vault instance
Retrieve on-chain data from the vault and off-chain APY data from API. Key info includes total amount currently unlocked for user withdrawals, virtual price and the various strategies connected to the vault. The code for this can be found in getVaultDetails.ts:You can trigger the function and get the vault details via the following:
7
Deposit tokens into the vault
The steps below will allow you to deposit tokens into the vault by specifying the source wallet and the amount you want to deposit:
8
Withdraw tokens from the vault (optional)
The steps below will allow you to withdraw tokens from the vault by specifying the destination wallet and the amount you want to withdraw from the vault:
9
Retrieve affiliate partner info (optional)
If you are an affiliate partner, you can retrieve information about the partner account: