percli_chain/commands/
settle.rs1use anyhow::Result;
2
3use crate::config::ChainConfig;
4use crate::ix::{self, SettleArgs};
5use crate::rpc::ChainRpc;
6
7pub fn run(config: &ChainConfig, account_idx: u16, funding_rate: i64) -> Result<()> {
8 let rpc = ChainRpc::new(&config.rpc_url);
9 let (market_pda, _) = config.market_pda();
10
11 let ix = ix::settle_ix(
12 &config.program_id,
13 &market_pda,
14 &config.authority(),
15 SettleArgs {
16 account_idx,
17 funding_rate,
18 },
19 );
20
21 println!("Settling account slot {account_idx}...");
22 let sig = rpc.send_tx(&[ix], &config.keypair)?;
23 println!(" Tx: {sig}");
24 Ok(())
25}