ephemeral_vrf_sdk/
types.rs1use crate::compat;
2use crate::compat::borsh::{BorshDeserialize, BorshSerialize};
3
4#[derive(BorshSerialize, BorshDeserialize, Debug, PartialEq, Default)]
5#[cfg_attr(
6 not(feature = "backward-compat"),
7 borsh(crate = "crate::compat::borsh")
8)]
9pub struct RequestRandomness {
10 pub caller_seed: [u8; 32],
11 pub callback_program_id: compat::Pubkey,
12 pub callback_discriminator: Vec<u8>,
13 pub callback_accounts_metas: Vec<SerializableAccountMeta>,
14 pub callback_args: Vec<u8>,
15}
16
17impl RequestRandomness {
18 pub fn to_bytes(&self) -> Vec<u8> {
19 let mut bytes = vec![3, 0, 0, 0, 0, 0, 0, 0];
20 self.serialize(&mut bytes).unwrap();
21 bytes
22 }
23}
24
25#[derive(BorshSerialize, BorshDeserialize, Debug, PartialEq, Default, Clone)]
26#[cfg_attr(
27 not(feature = "backward-compat"),
28 borsh(crate = "crate::compat::borsh")
29)]
30pub struct SerializableAccountMeta {
31 pub pubkey: compat::Pubkey,
32 pub is_signer: bool,
33 pub is_writable: bool,
34}