entropy_api/
sdk.rs

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