Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.meteora.ag/llms.txt

Use this file to discover all available pages before exploring further.

The local Rust integration source contains two crates:
CratePathUse
stake_for_fee_interfacestake-for-fee-sdk/stake_for_fee_interfaceGenerated Rust interface for accounts, instructions, typedefs, events, and errors.
commonstake-for-fee-sdk/commonSmall PDA helper crate that depends on stake_for_fee_interface as m3m3.
The inspected source does not include a high-level ergonomic Rust SDK like the TypeScript StakeForFee class. Rust integrations should use the generated interface crate, PDA helpers, and fresh on-chain account reads.

Workspace

[workspace]
members = ["stake_for_fee_interface", "common"]
resolver = "2"
For local development against the source checkout:
[dependencies]
stake_for_fee_interface = { path = "../stake-for-fee-sdk/stake_for_fee_interface" }
common = { path = "../stake-for-fee-sdk/common" }

Program ID

stake_for_fee_interface declares the public program ID:
ProgramID
stake_for_feeFEESngU3neckdwib9X3KWqdL7Mjmqk9XNp3uh5JbP4KP

PDA Helpers

The common::pda module exports:
FunctionDerives
derive_m3m3_vault_key(pool_key)["vault", pool] under stake_for_fee_interface::ID.
derive_top_staker_list_key(vault_key)["list", vault].
derive_full_balance_list_key(vault_key)["balance", vault].
derive_m3m3_event_authority_key()Anchor Event CPI authority ["__event_authority"].
use common::pda::{
    derive_full_balance_list_key, derive_m3m3_event_authority_key,
    derive_m3m3_vault_key, derive_top_staker_list_key,
};
use solana_sdk::pubkey::Pubkey;

let pool = Pubkey::new_unique();
let vault = derive_m3m3_vault_key(pool);
let top_list = derive_top_staker_list_key(vault);
let full_balance_list = derive_full_balance_list_key(vault);
let event_authority = derive_m3m3_event_authority_key();

Generated Modules

ModuleExports
accountsAccount structs, discriminators, and deserialize helpers for FeeVault, StakeEscrow, Unstake, list metadata, and dummy account wrappers used for generated types.
typedefsInitializeVaultParams, StakerBalance, StakerMetadata, Configuration, Metrics, TopStakerInfo, and Rounding.
instructionsInstruction enum, discriminators, key structs, argument structs, *_ix, *_invoke, and *_invoke_signed helpers.
eventsEvent structs matching the Anchor event definitions.
errorsStakeForFeeError enum with custom codes 6000 through 6022.

Instruction Builders

HelperArgsUse
initialize_vault_ix(keys, args)InitializeVaultIxArgs { params }Create the root vault and list accounts.
initialize_stake_escrow_ix(keys)NoneCreate a user stake escrow.
stake_ix(keys, args)StakeIxArgs { amount }Stake tokens and sync lists.
claim_fee_ix(keys, args)ClaimFeeIxArgs { max_fee }Claim quote fees and restake base fees.
request_unstake_ix(keys, args)RequestUnstakeIxArgs { unstake_amount }Create a pending unstake request.
cancel_unstake_ix(keys)NoneCancel an open unstake request.
withdraw_ix(keys)NoneWithdraw released stake.
claim_fee_crank_ix(keys)NonePermissionlessly claim and distribute lock escrow fees.
update_unstake_lock_duration_ix(keys, args)UpdateUnstakeLockDurationIxArgs { unstake_lock_duration }Admin update for future unstake cooldowns.
update_seconds_to_full_unlock_ix(keys, args)UpdateSecondsToFullUnlockIxArgs { seconds_to_full_unlock }Admin update for fee drip duration after a crank.
Each instruction also has *_ix_with_program_id, *_invoke, *_invoke_with_program_id, *_invoke_signed, and verification helpers in the generated source.

Account Decoding

Account wrapperUse
FeeVaultAccount::deserialize(data)Decode root vault state.
StakeEscrowAccount::deserialize(data)Decode a user stake escrow.
UnstakeAccount::deserialize(data)Decode a pending unstake account.
TopListMetadataAccount::deserialize(data)Decode only the top-list header.
FullBalanceListMetadataAccount::deserialize(data)Decode only the full-balance-list header.
Top and full balance list entries are appended after the account discriminator and metadata header. Use the TypeScript decoder logic as a model if you need to parse appended entries in Rust.

Error Decoding

StakeForFeeError implements From<StakeForFeeError> for ProgramError, DecodeError, and PrintProgramError.
Code rangeMeaning
6000 to 6022Stake2Earn custom errors from stake_for_fee.
See the program error reference for the full table.