entropy_api/
sdk.rs

1use steel::*;
2
3use crate::prelude::*;
4
5pub fn open(
6    signer: Pubkey,
7    commit: [u8; 32],
8    is_auto: bool,
9    samples: u64,
10    end_at: u64,
11) -> Instruction {
12    Instruction {
13        program_id: crate::ID,
14        accounts: vec![
15            AccountMeta::new(signer, true),
16            AccountMeta::new(ENTROPY_PROVIDER, true),
17            AccountMeta::new(var_pda(signer).0, false),
18            AccountMeta::new_readonly(system_program::ID, false),
19        ],
20        data: Open {
21            is_auto: is_auto as u64,
22            commit,
23            samples,
24            end_at,
25        }
26        .to_bytes(),
27    }
28}
29
30pub fn next(signer: Pubkey, var: Pubkey, end_at: u64) -> Instruction {
31    Instruction {
32        program_id: crate::ID,
33        accounts: vec![AccountMeta::new(signer, true), AccountMeta::new(var, false)],
34        data: Next { end_at }.to_bytes(),
35    }
36}
37
38pub fn reveal(signer: Pubkey, var: Pubkey, seed: [u8; 32]) -> Instruction {
39    Instruction {
40        program_id: crate::ID,
41        accounts: vec![AccountMeta::new(signer, true), AccountMeta::new(var, false)],
42        data: Reveal { seed }.to_bytes(),
43    }
44}