This commit is contained in:
Hardhat Chad
2025-10-09 16:36:38 -07:00
parent 25ec6250c4
commit 838f059a33
7 changed files with 84 additions and 45 deletions

View File

@@ -95,6 +95,9 @@ async fn main() {
"ata" => {
ata(&rpc, &payer).await.unwrap();
}
"checkpoint" => {
checkpoint(&rpc, &payer).await.unwrap();
}
"checkpoint_all" => {
checkpoint_all(&rpc, &payer).await.unwrap();
}
@@ -199,16 +202,16 @@ async fn ata(
rpc: &RpcClient,
payer: &solana_sdk::signer::keypair::Keypair,
) -> Result<(), anyhow::Error> {
let user = pubkey!("45db2FSR4mcXdSVVZbKbwojU6uYDpMyhpEi7cC8nHaWG");
let token = pubkey!("So11111111111111111111111111111111111111112");
let user = pubkey!("BQbXD9tqv3ysrvojSZao2RoW9ucR4RmiKbKEaVWJp4J3");
let token = pubkey!("8H8rPiWW4iTFCfEkSnf7jpqeNpFfvdH9gLouAL3Fe2Zx");
let ata = get_associated_token_address(&user, &token);
let ix = spl_associated_token_account::instruction::create_associated_token_account(
&payer.pubkey(),
&user,
&token,
&spl_token::ID,
);
submit_transaction(rpc, payer, &[ix]).await?;
// let ix = spl_associated_token_account::instruction::create_associated_token_account(
// &payer.pubkey(),
// &user,
// &token,
// &spl_token::ID,
// );
// submit_transaction(rpc, payer, &[ix]).await?;
let account = rpc.get_account(&ata).await?;
println!("ATA: {}", ata);
println!("Account: {:?}", account);
@@ -266,8 +269,8 @@ async fn bury(
let amount_u64 = ui_amount_to_amount(amount_f64, TOKEN_DECIMALS);
let wrap_ix = ore_api::sdk::wrap(payer.pubkey());
let bury_ix = ore_api::sdk::bury(payer.pubkey(), amount_u64);
// submit_transaction(rpc, payer, &[wrap_ix, bury_ix]).await?;
simulate_transaction(rpc, payer, &[wrap_ix, bury_ix]).await;
submit_transaction(rpc, payer, &[wrap_ix, bury_ix]).await?;
// simulate_transaction(rpc, payer, &[wrap_ix, bury_ix]).await;
Ok(())
}
@@ -368,6 +371,18 @@ async fn set_fee_collector(
Ok(())
}
async fn checkpoint(
rpc: &RpcClient,
payer: &solana_sdk::signer::keypair::Keypair,
) -> Result<(), anyhow::Error> {
let authority = std::env::var("AUTHORITY").unwrap_or(payer.pubkey().to_string());
let authority = Pubkey::from_str(&authority).expect("Invalid AUTHORITY");
let miner = get_miner(rpc, authority).await?;
let ix = ore_api::sdk::checkpoint(payer.pubkey(), authority, miner.round_id);
submit_transaction(rpc, payer, &[ix]).await?;
Ok(())
}
async fn checkpoint_all(
rpc: &RpcClient,
payer: &solana_sdk::signer::keypair::Keypair,
@@ -626,8 +641,14 @@ async fn log_config(rpc: &RpcClient) -> Result<(), anyhow::Error> {
let config = get_config(&rpc).await?;
println!("Config");
println!(" admin: {}", config.admin);
println!(" last_boost: {}", config.last_boost);
println!(" bury_authority: {}", config.bury_authority);
println!(" fee_collector: {}", config.fee_collector);
println!(" last_boost: {}", config.last_boost);
println!(
" is_seeker_activation_enabled: {}",
config.is_seeker_activation_enabled
);
Ok(())
}