bonk_staking_rewards/lib.rs
1//! # BONK Staking Rewards SDK
2//!
3//! A Rust client library for interacting with the BONK staking program on Solana.
4//! This library provides a clean, type-safe interface for staking BONK tokens and
5//! managing stake positions.
6//!
7//! ## Features
8//!
9//! - **Simple API**: Easy-to-use client for staking operations
10//! - **Type-Safe**: Strongly typed interfaces for all operations
11//! - **PDA Utilities**: Helper functions for deriving program-derived addresses
12//! - **Error Handling**: Comprehensive error types with descriptive messages
13//!
14//! ## Usage
15//!
16//! ```no_run
17//! use bonk_staking_rewards::BonkStakingClient;
18//! use solana_sdk::signature::{read_keypair_file, Signer};
19//!
20//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
21//! // Create client
22//! let client = BonkStakingClient::new(
23//! "https://mainnet.helius-rpc.com/?api-key=YOUR_KEY".to_string()
24//! );
25//!
26//! // Load user keypair
27//! let user = read_keypair_file("path/to/keypair.json")?;
28//!
29//! // Stake 100 BONK for 180 days
30//! let amount = 10_000_000; // 100 BONK (5 decimals)
31//! let signature = client.stake(&user, amount, 180, None)?;
32//!
33//! println!("Staked! Transaction: {}", signature);
34//! # Ok(())
35//! # }
36//! ```
37
38pub mod accounts;
39pub mod client;
40pub mod error;
41pub mod instructions;
42pub mod pda;
43
44// Re-export commonly used types
45pub use client::BonkStakingClient;
46pub use error::{BonkStakingError, Result};
47pub use accounts::StakeInfo;
48
49use solana_sdk::pubkey::Pubkey;
50
51/// BONK token mint address
52pub const BONK_MINT: Pubkey = solana_sdk::pubkey!("DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263");
53
54/// BONK Stake Program ID
55pub const BONK_STAKE_PROGRAM_ID: Pubkey = solana_sdk::pubkey!("STAKEkKzbdeKkqzKpLkNQD3SUuLgshDKCD7U8duxAbB");
56
57/// BONK Stake Pool address
58pub const BONK_STAKE_POOL: Pubkey = solana_sdk::pubkey!("9AdEE8AAm1XgJrPEs4zkTPozr3o4U5iGbgvPwkNdLDJ3");
59
60/// BONK Vault (where staked BONK is held)
61pub const BONK_VAULT: Pubkey = solana_sdk::pubkey!("4XHP9YQeeXPXHAjNXuKio1na1ypcxFSqFYBHtptQticd");
62
63/// BONK Stake Mint (the token you receive when staking)
64pub const BONK_STAKE_MINT: Pubkey = solana_sdk::pubkey!("FYUjeMAFjbTzdMG91RSW5P4HT2sT7qzJQgDPiPG9ez9o");
65
66/// BONK Reward Vault (reward pool 0)
67pub const BONK_REWARD_VAULT_0: Pubkey = solana_sdk::pubkey!("2PPAJ8P5JgKZjkxq4h3kFSwLcuakFYr4fbV68jGghWxi");
68
69/// Lock duration for 1 month in days
70pub const DURATION_1_MONTH: u64 = 30;
71
72/// Lock duration for 3 months in days
73pub const DURATION_3_MONTHS: u64 = 90;
74
75/// Lock duration for 6 months in days
76pub const DURATION_6_MONTHS: u64 = 180;
77
78/// Lock duration for 12 months in days
79pub const DURATION_12_MONTHS: u64 = 365;