magicblock_magic_program_api/compat.rs
1#![allow(unused)]
2
3///
4/// compat is a boundary layer for the public API.
5///
6/// It lets sdk expose either the legacy compatibility types or the current
7/// Solana 3.0 types at the API surface, while keeping the implementation itself
8/// always on Solana 3.0.
9///
10/// In practice, compat::{Pubkey, borsh, ...} is used only for public function
11/// parameters and return types. As soon as execution enters a function body, inputs
12/// are normalized to the Solana 3.0 types. with the help of AsModern and Modern traits
13/// and the internal logic runs entirely on Solana 3.0. If a value needs to cross
14/// back out through the public API, it is converted back at the boundary with the help
15/// of Compat trait.
16///
17
18#[cfg(feature = "backward-compat")]
19mod backward_compat {
20 pub use solana_program_compat::{
21 account_info::AccountInfo,
22 declare_id,
23 instruction::{AccountMeta, Instruction},
24 pubkey,
25 pubkey::Pubkey,
26 };
27 pub use solana_signature_compat::Signature;
28}
29
30mod latest {
31 pub use solana_program::{
32 account_info::AccountInfo,
33 declare_id,
34 instruction::{AccountMeta, Instruction},
35 pubkey,
36 pubkey::Pubkey,
37 };
38 pub use solana_signature::Signature;
39}
40
41#[cfg(feature = "backward-compat")]
42pub use backward_compat::*;
43#[cfg(not(feature = "backward-compat"))]
44pub use latest::*;