eosio_chain/
lib.rs

1#![cfg_attr(not(feature = "std"), no_std)]
2#![cfg_attr(not(feature = "std"), feature(alloc_error_handler, panic_info_message, core_intrinsics))]
3
4#[cfg(not(feature = "std"))]
5mod allocator;
6
7#[cfg(not(feature = "std"))]
8#[cfg(not(feature = "wee-alloc"))]
9#[global_allocator]
10static mut ALLOC: allocator::bump::BumpAllocator = allocator::bump::BumpAllocator {};
11
12#[cfg(all(not(feature = "std"), target_arch = "wasm32"))]
13#[allow(unused_variables)]
14#[panic_handler]
15fn panic(info: &core::panic::PanicInfo) -> ! {
16    let msg = format!("{:?}", info.message().unwrap().as_str().unwrap());
17    self::vmapi::eosio::check(false, &msg);
18    core::arch::wasm32::unreachable();
19}
20
21#[cfg(not(feature = "std"))]
22extern crate alloc;
23
24use cfg_if::cfg_if;
25
26#[cfg(feature = "std")]
27pub use eosio_chaintester;
28
29#[cfg(feature = "std")]
30pub use eosio_chaintester::{
31    ChainTester,
32};
33
34cfg_if! {
35    if #[cfg(feature = "std")] {
36        pub use std::{
37            borrow,
38            boxed,
39            format,
40            string,
41            vec,
42            rc,
43        };
44
45        /// Collection types.
46        pub mod collections {
47            pub use self::{
48                binary_heap::BinaryHeap,
49                btree_map::BTreeMap,
50                btree_set::BTreeSet,
51                linked_list::LinkedList,
52                vec_deque::VecDeque,
53                Bound,
54            };
55            pub use std::collections::*;
56        }
57    } else {
58        pub use alloc::{
59            borrow,
60            boxed,
61            format,
62            string,
63            vec,
64            rc,
65        };
66
67        /// Collection types.
68        pub mod collections {
69            pub use self::{
70                BTreeMap,
71                BTreeSet,
72                BinaryHeap,
73                LinkedList,
74                VecDeque,
75            };
76            pub use alloc::collections::*;
77            pub use core::ops::Bound;
78        }
79    }
80}
81
82
83///
84pub mod vmapi;
85///
86pub mod structs;
87pub use self::structs::*;
88
89///
90pub mod transaction;
91pub use self::transaction::{
92    TransactionExtension,
93    Transaction,
94};
95
96///
97pub mod serializer;
98pub use serializer::{
99    Encoder,
100    Decoder,
101};
102
103///
104pub mod db;
105
106///
107#[macro_use]
108pub mod print;
109
110///
111pub mod mi;
112
113///
114pub mod mi_not_generic;
115
116///
117mod asset;
118pub use asset::{
119    Asset,
120    Symbol,
121};
122
123mod privileged;
124
125///
126pub mod crypto;
127pub use crypto::{
128    assert_sha256,
129    assert_sha1,
130    assert_sha512,
131    assert_ripemd160,
132
133    sha256,
134    sha1,
135    sha512,
136    ripemd160,
137
138    recover_key,
139    assert_recover_key,
140};
141
142pub use self::vmapi::eosio::{
143    get_active_producers,
144    check_transaction_authorization,
145    check_permission_authorization,
146    get_permission_last_used,
147    get_account_creation_time,
148
149    read_action_data,
150    action_data_size,
151    require_recipient,
152    require_auth,
153    has_auth,
154    require_auth2,
155    is_account,
156    send_inline,
157    send_context_free_inline,
158
159    publication_time,
160    current_receiver,
161    check,
162    eosio_assert_code,
163    eosio_exit,
164    current_time,
165    is_feature_activated,
166    get_sender,
167
168    get_resource_limits,
169    set_resource_limits,
170    set_proposed_producers,
171    set_proposed_producers_ex,
172    is_privileged,
173    set_privileged,
174    set_blockchain_parameters,
175    get_blockchain_parameters,
176    preactivate_feature,
177
178    send_deferred,
179    cancel_deferred,
180    read_transaction,
181    transaction_size,
182    tapos_block_num,
183    tapos_block_prefix,
184    expiration,
185    get_action,
186    get_context_free_data,
187};
188
189///
190#[macro_use]
191pub mod name;
192
193pub use name::{
194    SAME_PAYER,
195    ACTIVE,
196    OWNER,
197    CODE,
198};
199
200///
201pub mod action;
202
203pub use action::{
204    PermissionLevel,
205    Action,
206};
207
208///
209pub mod utils;
210///
211pub mod varint;
212
213///
214pub mod binary_extension;
215pub use binary_extension::BinaryExtension;
216
217///
218pub mod intrinsic_abi_types;
219pub use intrinsic_abi_types::*;
220
221pub use eosio_macro::{
222    contract,
223    // chain,
224};
225
226#[cfg(feature = "std")]
227pub use eosio_scale_info;
228
229#[cfg(feature = "std")]
230pub mod abi;