1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use solana_client::rpc_client::RpcClient;
use solana_program::pubkey::Pubkey;

use common::command::{CliConfig, ProcessResult};
use common::contract::instructions::collect_rewarder::{new_collect_rewarder_tx};
use common::utils::send::send_tx;


pub fn process_collect_rewarder(
    rpc_client: &RpcClient,
    config: &CliConfig,
    mint: Pubkey,
    rewarder_index: u8,
) -> ProcessResult {
    let ixs = new_collect_rewarder_tx(
        rpc_client,
        config,
        mint,
        rewarder_index,
    );
    if ixs.len() == 0 {
        return Ok("postion rewarder fee is zero for rewarder_index".parse().unwrap());
    }

    let res = send_tx(rpc_client, config, &ixs.as_slice())?;

    Ok("signers : ".to_owned() + res.to_string().as_str())
}