Expand description
§BONK Staking Rewards SDK
A Rust client library for interacting with the BONK staking program on Solana. This library provides a clean, type-safe interface for staking BONK tokens and managing stake positions.
§Features
- Simple API: Easy-to-use client for staking operations
- Type-Safe: Strongly typed interfaces for all operations
- PDA Utilities: Helper functions for deriving program-derived addresses
- Error Handling: Comprehensive error types with descriptive messages
§Usage
use bonk_staking_rewards_v3::BonkStakingClient;
use solana_sdk::signature::{read_keypair_file, Signer};
// Create client
let client = BonkStakingClient::new(
"https://mainnet.helius-rpc.com/?api-key=YOUR_KEY".to_string()
);
// Load user keypair
let user = read_keypair_file("path/to/keypair.json")?;
// Stake 100 BONK for 180 days
let amount = 10_000_000; // 100 BONK (5 decimals)
let signature = client.stake(&user, amount, 180, None)?;
println!("Staked! Transaction: {}", signature);Re-exports§
pub use client::BonkStakingClient;pub use error::BonkStakingError;pub use error::Result;pub use accounts::StakeInfo;pub use pda::derive_stake_deposit_receipt;
Modules§
- accounts
- Account types and utilities for BONK staking
- client
- High-level client for BONK staking operations
- error
- Error types for the BONK Staking client library
- instructions
- Instruction builders for BONK staking operations
- pda
- PDA (Program Derived Address) utilities for BONK staking
Structs§
- Stake
Config - Configuration for building a stake transaction.
Constants§
- BONK_
MINT - BONK token mint address
- BONK_
REWARD_ VAULT_ 0 - BONK Reward Vault (reward pool 0)
- BONK_
STAKE_ MINT - BONK Stake Mint (the token you receive when staking)
- BONK_
STAKE_ POOL - BONK Stake Pool address
- BONK_
STAKE_ PROGRAM_ ID - BONK Stake Program ID
- BONK_
VAULT - BONK Vault (where staked BONK is held)
- DURATION_
1_ MONTH - Lock duration for 1 month in days
- DURATION_
3_ MONTHS - Lock duration for 3 months in days
- DURATION_
6_ MONTHS - Lock duration for 6 months in days
- DURATION_
12_ MONTHS - Lock duration for 12 months in days
Functions§
- build_
deposit_ transaction - Build a stake transaction from a simple config.