1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//! A bitvector of slots present over the last epoch.
//!
//! The _slot history sysvar_ provides access to the [`SlotHistory`] type.
//!
//! The [`Sysvar::from_account_info`] and [`Sysvar::get`] methods always return
//! [`ProgramError::UnsupportedSysvar`] because this sysvar account is too large
//! to process on-chain. Thus this sysvar cannot be accessed on chain, though
//! one can still use the [`SysvarId::id`], [`SysvarId::check_id`] and
//! [`Sysvar::size_of`] methods in an on-chain program, and it can be accessed
//! off-chain through RPC.
//!
//! [`SysvarId::id`]: crate::sysvar::SysvarId::id
//! [`SysvarId::check_id`]: crate::sysvar::SysvarId::check_id
//!
//! # Examples
//!
//! Calling via the RPC client:
//!
//! ```
//! # use cbe_program::example_mocks::cbe_sdk;
//! # use cbe_program::example_mocks::cbe_rpc_client;
//! # use cbe_sdk::account::Account;
//! # use cbe_rpc_client::rpc_client::RpcClient;
//! # use cbe_sdk::sysvar::slot_history::{self, SlotHistory};
//! # use anyhow::Result;
//! #
//! fn print_sysvar_slot_history(client: &RpcClient) -> Result<()> {
//! # let slot_history = SlotHistory::default();
//! # let data: Vec<u8> = bincode::serialize(&slot_history)?;
//! # client.set_get_account_response(slot_history::ID, Account {
//! # scoobies: 913326000,
//! # data,
//! # owner: cbe_sdk::system_program::ID,
//! # executable: false,
//! # rent_epoch: 307,
//! # });
//! #
//! let slot_history = client.get_account(&slot_history::ID)?;
//! let data: SlotHistory = bincode::deserialize(&slot_history.data)?;
//!
//! Ok(())
//! }
//! #
//! # let client = RpcClient::new(String::new());
//! # print_sysvar_slot_history(&client)?;
//! #
//! # Ok::<(), anyhow::Error>(())
//! ```
use crateSysvar;
pub use crate::;
cratedeclare_sysvar_id!;