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
//! A bitvector of slots present over the last epoch.
//!
//! The _slot history sysvar_ provides access to the [`SlotHistory`] type.
//!
//! The [`crate::Sysvar::get`] method always returns [`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 [`SIZE`] in an on-chain program,
//! and it can be accessed off-chain through RPC.
//!
//! [`SysvarId::id`]: https://docs.rs/solana-sysvar-id/latest/solana_sysvar_id/trait.SysvarId.html#tymethod.id
//! [`SysvarId::check_id`]: https://docs.rs/solana-sysvar-id/latest/solana_sysvar_id/trait.SysvarId.html#tymethod.check_id
//!
//! # Examples
//!
//! Calling via the RPC client:
//!
//! ```
//! # use solana_example_mocks::solana_account;
//! # use solana_example_mocks::solana_rpc_client;
//! # use solana_rpc_client::rpc_client::RpcClient;
//! # use solana_account::Account;
//! # use solana_slot_history::SlotHistory;
//! # use solana_sdk_ids::sysvar::slot_history;
//! # use anyhow::Result;
//! #
//! fn print_sysvar_slot_history(client: &RpcClient) -> Result<()> {
//! # let slot_history = SlotHistory::default();
//! # let data: Vec<u8> = wincode::serialize(&slot_history)?;
//! # client.set_get_account_response(slot_history::ID, Account {
//! # lamports: 913326000,
//! # data,
//! # owner: solana_sdk_ids::system_program::ID,
//! # executable: false,
//! # });
//! #
//! let slot_history = client.get_account(&slot_history::ID)?;
//! let data: SlotHistory = wincode::deserialize(&slot_history.data)?;
//!
//! Ok(())
//! }
//! #
//! # let client = RpcClient::new(String::new());
//! # print_sysvar_slot_history(&client)?;
//! #
//! # Ok::<(), anyhow::Error>(())
//! ```
pub use ;