This commit is contained in:
Hardhat Chad
2025-06-25 16:28:11 -05:00
parent 470cca04c4
commit ce1f8f00a6

View File

@@ -81,7 +81,15 @@ async fn close(
) -> Result<(), anyhow::Error> {
let id_str = std::env::var("ID").expect("Missing ID env var");
let id = id_str.parse::<u64>()?;
let ix = ore_api::sdk::close(payer.pubkey(), payer.pubkey(), payer.pubkey(), id);
let block = get_block(rpc, id).await?;
let config = get_config(rpc).await?;
let ix = ore_api::sdk::close(
payer.pubkey(),
config.fee_collector,
block.opener,
payer.pubkey(),
id,
);
submit_transaction(rpc, payer, &[ix]).await?;
Ok(())
}
@@ -190,6 +198,13 @@ async fn get_block(rpc: &RpcClient, id: u64) -> Result<Block, anyhow::Error> {
Ok(*block)
}
async fn get_config(rpc: &RpcClient) -> Result<Config, anyhow::Error> {
let config_pda = ore_api::state::config_pda();
let account = rpc.get_account(&config_pda.0).await?;
let config = Config::try_from_bytes(&account.data)?;
Ok(*config)
}
async fn get_clock(rpc: &RpcClient) -> Result<Clock, anyhow::Error> {
let data = rpc.get_account_data(&solana_sdk::sysvar::clock::ID).await?;
let clock = bincode::deserialize::<Clock>(&data)?;