miclockwork_thread_program/instructions/
get_crate_info.rs

1use {
2    anchor_lang::{prelude::*, system_program},
3    miclockwork_utils::CrateInfo,
4};
5
6/// Accounts required for the `get_crate_info` instruction.
7/// We are not using system program actually
8/// But anchor does not support empty structs: https://github.com/coral-xyz/anchor/pull/1659
9#[derive(Accounts)]
10pub struct GetCrateInfo<'info> {
11    #[account(address = system_program::ID)]
12    pub system_program: Program<'info, System>,
13}
14
15pub fn handler(_ctx: Context<GetCrateInfo>) -> Result<CrateInfo> {
16    let spec = format!(
17        "https://github.com/clockwork-xyz/clockwork/blob/v{}/programs/thread/Cargo.toml",
18        version!()
19    );
20    let blob = "";
21    let info = CrateInfo {
22        spec: spec.into(),
23        blob: blob.into(),
24    };
25    msg!("{}", info);
26
27    Ok(info)
28}