Crate bonk_staking_rewards_v3

Crate bonk_staking_rewards_v3 

Source
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§

StakeConfig
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.