Skip to main content
These examples are based on the local stake-for-fee-sdk/ts-client/src/examples source and the public SDK surface.

Connect To A Vault

Create A Fee Vault

createFeeVault fetches the DAMM v1 pool, infers the quote mint as the other pool mint, derives the vault/list/token accounts, creates the DAMM v1 lock escrow if missing, and returns one transaction.

Create A Fee Vault With Explicit Mints

Use createFeeVaultInstructions when you need to compose the vault creation instructions into a larger transaction builder.

Lock DAMM v1 LP To The Vault

The local SDK examples lock DAMM v1 LP with @meteora-ag/dynamic-amm-sdk after the Stake2Earn vault is created:
The lock escrow owner must be the Stake2Earn vault PDA. Fees from that locked LP flow into Stake2Earn distribution instead of the creator wallet.

Stake Tokens

stake includes initializeStakeEscrow when needed. If you have just changed vault state in another transaction, call refreshStates() before building the stake transaction.

Read Stake And Claimable Balance

For a top-list staker, the SDK calculates newly released fees from current vault and lock escrow state before returning unclaimFee.

Claim Fees

claimFee claims quote token fees up to maxFee. Any base/stake token fee is automatically added back to the user’s stake escrow.

Request Unstake

Store the unstake.publicKey. It is required for cancelUnstake and withdraw.

Cancel Unstake

Canceling returns the requested amount to active stake and closes the Unstake account.

Withdraw Released Stake

The transaction fails until the current on-chain timestamp is at or after the Unstake.release_at value.

Find User Vaults And Unstakes

Gotchas