defituna-staking 1.0.9

Rust client to interact with DefiTuna's Staking on-chain program.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::instructions::DepositReward;
use solana_instruction::Instruction;
use solana_pubkey::Pubkey;
use spl_associated_token_account::get_associated_token_address_with_program_id;

pub fn deposit_reward_instruction(authority: &Pubkey, treasury: &Pubkey, reward_token_mint: &Pubkey) -> Instruction {
    let treasury_reward_token_account = get_associated_token_address_with_program_id(&authority, &reward_token_mint, &spl_token::id());

    let ix_builder = DepositReward {
        authority: *authority,
        treasury: *treasury,
        treasury_reward_token_account,
        reward_token_program: spl_token::id(),
    };

    ix_builder.instruction()
}