soroban_sdk/
lib.rs

1//! Soroban SDK supports writing smart contracts for the Wasm-powered [Soroban] smart contract
2//! runtime, deployed on [Stellar].
3//!
4//! ### Docs
5//!
6//! See [developers.stellar.org] for documentation about building smart contracts for [Stellar].
7//!
8//! [developers.stellar.org]: https://developers.stellar.org
9//! [Stellar]: https://stellar.org
10//! [Soroban]: https://stellar.org/soroban
11//!
12//! ### Migrating Major Versions
13//!
14//! See [_migrating] for a summary of how to migrate from one major version to another.
15//!
16//! ### Examples
17//!
18//! ```rust
19//! use soroban_sdk::{contract, contractimpl, vec, symbol_short, BytesN, Env, Symbol, Vec};
20//!
21//! #[contract]
22//! pub struct Contract;
23//!
24//! #[contractimpl]
25//! impl Contract {
26//!     pub fn hello(env: Env, to: Symbol) -> Vec<Symbol> {
27//!         vec![&env, symbol_short!("Hello"), to]
28//!     }
29//! }
30//!
31//! #[test]
32//! fn test() {
33//! # }
34//! # #[cfg(feature = "testutils")]
35//! # fn main() {
36//!     let env = Env::default();
37//!     let contract_id = env.register(Contract, ());
38//!     let client = ContractClient::new(&env, &contract_id);
39//!
40//!     let words = client.hello(&symbol_short!("Dev"));
41//!
42//!     assert_eq!(words, vec![&env, symbol_short!("Hello"), symbol_short!("Dev"),]);
43//! }
44//! # #[cfg(not(feature = "testutils"))]
45//! # fn main() { }
46//! ```
47//!
48//! More examples are available at:
49//! - <https://developers.stellar.org/docs/build/smart-contracts/example-contracts>
50//! - <https://developers.stellar.org/docs/build/guides>
51
52#![cfg_attr(target_family = "wasm", no_std)]
53#![cfg_attr(feature = "docs", feature(doc_cfg))]
54#![allow(dead_code)]
55
56pub mod _migrating;
57
58#[cfg(all(target_family = "wasm", feature = "testutils"))]
59compile_error!("'testutils' feature is not supported on 'wasm' target");
60
61// When used in a no_std contract, provide a panic handler as one is required.
62#[cfg(target_family = "wasm")]
63#[panic_handler]
64fn handle_panic(_: &core::panic::PanicInfo) -> ! {
65    core::arch::wasm32::unreachable()
66}
67
68// Here we provide a `#[global_allocator]` that is a minimal non-freeing bump
69// allocator, appropriate for a WASM blob that runs a single contract call.
70#[cfg(all(feature = "alloc", target_family = "wasm"))]
71mod alloc;
72
73/// __link_sections returns and does nothing, but it contains link sections that
74/// should be ensured end up in the final build of any contract using the SDK.
75///
76/// In Rust's build system sections only get included into the final build if
77/// the object file containing those sections are processed by the linker, but
78/// as an optimization step if no code is called in an object file it is
79/// discarded.  This has the unfortunate effect of causing anything else in
80/// those object files, such as link sections, to be discarded. Placing anything
81/// that must be included in the build inside an exported function ensures the
82/// object files won't be discarded. wasm-bindgen does a similar thing to this,
83/// and so this seems to be a reasonably accepted way to work around this
84/// limitation in the build system.
85///
86/// This has an unfortunate side-effect that all contracts will have a function
87/// in the resulting WASM named `_`, however this function won't be rendered in
88/// the contract specification. The overhead of this is very minimal on file
89/// size.
90///
91/// See https://github.com/stellar/rs-soroban-sdk/issues/383 for more details.
92#[cfg(target_family = "wasm")]
93#[export_name = "_"]
94fn __link_sections() {
95    #[link_section = "contractenvmetav0"]
96    static __ENV_META_XDR: [u8; env::internal::meta::XDR.len()] = env::internal::meta::XDR;
97
98    soroban_sdk_macros::contractmetabuiltin!();
99}
100
101// Re-exports of dependencies used by macros.
102#[doc(hidden)]
103pub mod reexports_for_macros {
104    pub use ::bytes_lit;
105    #[cfg(any(test, feature = "testutils"))]
106    pub use ::ctor;
107}
108
109/// Assert in contract asserts that the contract is currently executing within a
110/// contract. The macro maps to code when testutils are enabled or in tests,
111/// otherwise maps to nothing.
112#[macro_export]
113macro_rules! assert_in_contract {
114    ($env:expr $(,)?) => {{
115        {
116            #[cfg(any(test, feature = "testutils"))]
117            assert!(
118                ($env).in_contract(),
119                "this function is not accessible outside of a contract, wrap \
120                the call with `env.as_contract()` to access it from a \
121                particular contract"
122            );
123        }
124    }};
125}
126
127/// Create a short [Symbol] constant with the given string.
128///
129/// A short symbol's maximum length is 9 characters. For longer symbols, use
130/// [Symbol::new] to create the symbol at runtime.
131///
132/// Valid characters are `a-zA-Z0-9_`.
133///
134/// The [Symbol] is generated at compile time and returned as a const.
135///
136/// ### Examples
137///
138/// ```
139/// use soroban_sdk::{symbol_short, Symbol};
140///
141/// let symbol = symbol_short!("a_str");
142/// assert_eq!(symbol, symbol_short!("a_str"));
143/// ```
144pub use soroban_sdk_macros::symbol_short;
145
146/// Generates conversions from the repr(u32) enum from/into an `Error`.
147///
148/// There are some constraints on the types that are supported:
149/// - Enum must derive `Copy`.
150/// - Enum variants must have an explicit integer literal.
151/// - Enum variants must have a value convertible to u32.
152///
153/// Includes the type in the contract spec so that clients can generate bindings
154/// for the type.
155///
156/// ### Examples
157///
158/// Defining an error and capturing errors using the `try_` variant.
159///
160/// ```
161/// use soroban_sdk::{contract, contracterror, contractimpl, Env};
162///
163/// #[contracterror]
164/// #[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)]
165/// #[repr(u32)]
166/// pub enum Error {
167///     MyError = 1,
168///     AnotherError = 2,
169/// }
170///
171/// #[contract]
172/// pub struct Contract;
173///
174/// #[contractimpl]
175/// impl Contract {
176///     pub fn causeerror(env: Env) -> Result<(), Error> {
177///         Err(Error::MyError)
178///     }
179/// }
180///
181/// #[test]
182/// fn test() {
183/// # }
184/// # #[cfg(feature = "testutils")]
185/// # fn main() {
186///     let env = Env::default();
187///
188///     // Register the contract defined in this crate.
189///     let contract_id = env.register(Contract, ());
190///
191///     // Create a client for calling the contract.
192///     let client = ContractClient::new(&env, &contract_id);
193///
194///     // Invoke contract causeerror function, but use the try_ variant that
195///     // will capture the error so we can inspect.
196///     let result = client.try_causeerror();
197///     assert_eq!(result, Err(Ok(Error::MyError)));
198/// }
199/// # #[cfg(not(feature = "testutils"))]
200/// # fn main() { }
201/// ```
202///
203/// Testing invocations that cause errors with `should_panic` instead of `try_`.
204///
205/// ```should_panic
206/// # use soroban_sdk::{contract, contracterror, contractimpl, Env};
207/// #
208/// # #[contracterror]
209/// # #[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)]
210/// # #[repr(u32)]
211/// # pub enum Error {
212/// #     MyError = 1,
213/// #     AnotherError = 2,
214/// # }
215/// #
216/// # #[contract]
217/// # pub struct Contract;
218/// #
219/// # #[contractimpl]
220/// # impl Contract {
221/// #     pub fn causeerror(env: Env) -> Result<(), Error> {
222/// #         Err(Error::MyError)
223/// #     }
224/// # }
225/// #
226/// #[test]
227/// #[should_panic(expected = "ContractError(1)")]
228/// fn test() {
229/// # panic!("ContractError(1)");
230/// # }
231/// # #[cfg(feature = "testutils")]
232/// # fn main() {
233///     let env = Env::default();
234///
235///     // Register the contract defined in this crate.
236///     let contract_id = env.register(Contract, ());
237///
238///     // Create a client for calling the contract.
239///     let client = ContractClient::new(&env, &contract_id);
240///
241///     // Invoke contract causeerror function.
242///     client.causeerror();
243/// }
244/// # #[cfg(not(feature = "testutils"))]
245/// # fn main() { }
246/// ```
247pub use soroban_sdk_macros::contracterror;
248
249/// Import a contract from its WASM file, generating a client, types, and
250/// constant holding the contract file.
251///
252/// The path given is relative to the workspace root, and not the current
253/// file.
254///
255/// Generates in the current module:
256/// - A `Contract` trait that matches the contracts interface.
257/// - A `ContractClient` struct that has functions for each function in the
258/// contract.
259/// - Types for all contract types defined in the contract.
260///
261/// ### Examples
262///
263/// ```ignore
264/// use soroban_sdk::{contractimpl, BytesN, Env, Symbol};
265///
266/// mod contract_a {
267///     soroban_sdk::contractimport!(file = "contract_a.wasm");
268/// }
269///
270/// pub struct ContractB;
271///
272/// #[contractimpl]
273/// impl ContractB {
274///     pub fn add_with(env: Env, contract_id: BytesN<32>, x: u32, y: u32) -> u32 {
275///         let client = contract_a::ContractClient::new(&env, contract_id);
276///         client.add(&x, &y)
277///     }
278/// }
279///
280/// #[test]
281/// fn test() {
282///     let env = Env::default();
283///
284///     // Register contract A using the imported WASM.
285///     let contract_a_id = env.register_contract_wasm(None, contract_a::WASM);
286///
287///     // Register contract B defined in this crate.
288///     let contract_b_id = env.register(ContractB, ());
289///
290///     // Create a client for calling contract B.
291///     let client = ContractBClient::new(&env, &contract_b_id);
292///
293///     // Invoke contract B via its client.
294///     let sum = client.add_with(&contract_a_id, &5, &7);
295///     assert_eq!(sum, 12);
296/// }
297/// ```
298pub use soroban_sdk_macros::contractimport;
299
300/// Marks a type as being the type that contract functions are attached for.
301///
302/// Use `#[contractimpl]` on impl blocks of this type to make those functions
303/// contract functions.
304///
305/// Note that a crate only ever exports a single contract. While there can be
306/// multiple types in a crate with `#[contract]`, when built as a wasm file and
307/// deployed the combination of all contract functions and all contracts within
308/// a crate will be seen as a single contract.
309///
310/// ### Examples
311///
312/// Define a contract with one function, `hello`, and call it from within a test
313/// using the generated client.
314///
315/// ```
316/// use soroban_sdk::{contract, contractimpl, vec, symbol_short, BytesN, Env, Symbol, Vec};
317///
318/// #[contract]
319/// pub struct HelloContract;
320///
321/// #[contractimpl]
322/// impl HelloContract {
323///     pub fn hello(env: Env, to: Symbol) -> Vec<Symbol> {
324///         vec![&env, symbol_short!("Hello"), to]
325///     }
326/// }
327///
328/// #[test]
329/// fn test() {
330/// # }
331/// # #[cfg(feature = "testutils")]
332/// # fn main() {
333///     let env = Env::default();
334///     let contract_id = env.register(HelloContract, ());
335///     let client = HelloContractClient::new(&env, &contract_id);
336///
337///     let words = client.hello(&symbol_short!("Dev"));
338///
339///     assert_eq!(words, vec![&env, symbol_short!("Hello"), symbol_short!("Dev"),]);
340/// }
341/// # #[cfg(not(feature = "testutils"))]
342/// # fn main() { }
343/// ```
344pub use soroban_sdk_macros::contract;
345
346/// Exports the publicly accessible functions to the Soroban environment.
347///
348/// Functions that are publicly accessible in the implementation are invocable
349/// by other contracts, or directly by transactions, when deployed.
350///
351/// ### Examples
352///
353/// Define a contract with one function, `hello`, and call it from within a test
354/// using the generated client.
355///
356/// ```
357/// use soroban_sdk::{contract, contractimpl, vec, symbol_short, BytesN, Env, Symbol, Vec};
358///
359/// #[contract]
360/// pub struct HelloContract;
361///
362/// #[contractimpl]
363/// impl HelloContract {
364///     pub fn hello(env: Env, to: Symbol) -> Vec<Symbol> {
365///         vec![&env, symbol_short!("Hello"), to]
366///     }
367/// }
368///
369/// #[test]
370/// fn test() {
371/// # }
372/// # #[cfg(feature = "testutils")]
373/// # fn main() {
374///     let env = Env::default();
375///     let contract_id = env.register(HelloContract, ());
376///     let client = HelloContractClient::new(&env, &contract_id);
377///
378///     let words = client.hello(&symbol_short!("Dev"));
379///
380///     assert_eq!(words, vec![&env, symbol_short!("Hello"), symbol_short!("Dev"),]);
381/// }
382/// # #[cfg(not(feature = "testutils"))]
383/// # fn main() { }
384/// ```
385pub use soroban_sdk_macros::contractimpl;
386
387/// Adds a serialized SCMetaEntry::SCMetaV0 to the WASM contracts custom section
388/// under the section name 'contractmetav0'. Contract developers can use this to
389/// append metadata to their contract.
390///
391/// ### Examples
392///
393/// ```
394/// use soroban_sdk::{contract, contractimpl, contractmeta, vec, symbol_short, BytesN, Env, Symbol, Vec};
395///
396/// contractmeta!(key="desc", val="hello world contract");
397///
398/// #[contract]
399/// pub struct HelloContract;
400///
401/// #[contractimpl]
402/// impl HelloContract {
403///     pub fn hello(env: Env, to: Symbol) -> Vec<Symbol> {
404///         vec![&env, symbol_short!("Hello"), to]
405///     }
406/// }
407///
408///
409/// #[test]
410/// fn test() {
411/// # }
412/// # #[cfg(feature = "testutils")]
413/// # fn main() {
414///     let env = Env::default();
415///     let contract_id = env.register(HelloContract, ());
416///     let client = HelloContractClient::new(&env, &contract_id);
417///
418///     let words = client.hello(&symbol_short!("Dev"));
419///
420///     assert_eq!(words, vec![&env, symbol_short!("Hello"), symbol_short!("Dev"),]);
421/// }
422/// # #[cfg(not(feature = "testutils"))]
423/// # fn main() { }
424/// ```
425pub use soroban_sdk_macros::contractmeta;
426
427/// Generates conversions from the struct/enum from/into a `Val`.
428///
429/// There are some constraints on the types that are supported:
430/// - Enums with integer values must have an explicit integer literal for every
431/// variant.
432/// - Enums with unit variants are supported.
433/// - Enums with tuple-like variants with a maximum of one tuple field are
434/// supported. The tuple field must be of a type that is also convertible to and
435/// from `Val`.
436/// - Enums with struct-like variants are not supported.
437/// - Structs are supported. All fields must be of a type that is also
438/// convertible to and from `Val`.
439/// - All variant names, field names, and type names must be 10-characters or
440/// less in length.
441///
442/// Includes the type in the contract spec so that clients can generate bindings
443/// for the type.
444///
445/// ### Examples
446///
447/// Defining a contract type that is a struct and use it in a contract.
448///
449/// ```
450/// #![no_std]
451/// use soroban_sdk::{contract, contractimpl, contracttype, symbol_short, Env, Symbol};
452///
453/// #[contracttype]
454/// #[derive(Clone, Default, Debug, Eq, PartialEq)]
455/// pub struct State {
456///     pub count: u32,
457///     pub last_incr: u32,
458/// }
459///
460/// #[contract]
461/// pub struct Contract;
462///
463/// #[contractimpl]
464/// impl Contract {
465///     /// Increment increments an internal counter, and returns the value.
466///     pub fn increment(env: Env, incr: u32) -> u32 {
467///         // Get the current count.
468///         let mut state = Self::get_state(env.clone());
469///
470///         // Increment the count.
471///         state.count += incr;
472///         state.last_incr = incr;
473///
474///         // Save the count.
475///         env.storage().persistent().set(&symbol_short!("STATE"), &state);
476///
477///         // Return the count to the caller.
478///         state.count
479///     }
480///
481///     /// Return the current state.
482///     pub fn get_state(env: Env) -> State {
483///         env.storage().persistent()
484///             .get(&symbol_short!("STATE"))
485///             .unwrap_or_else(|| State::default()) // If no value set, assume 0.
486///     }
487/// }
488///
489/// #[test]
490/// fn test() {
491/// # }
492/// # #[cfg(feature = "testutils")]
493/// # fn main() {
494///     let env = Env::default();
495///     let contract_id = env.register(Contract, ());
496///     let client = ContractClient::new(&env, &contract_id);
497///
498///     assert_eq!(client.increment(&1), 1);
499///     assert_eq!(client.increment(&10), 11);
500///     assert_eq!(
501///         client.get_state(),
502///         State {
503///             count: 11,
504///             last_incr: 10,
505///         },
506///     );
507/// }
508/// # #[cfg(not(feature = "testutils"))]
509/// # fn main() { }
510/// ```
511///
512/// Defining contract types that are three different types of enums and using
513/// them in a contract.
514///
515/// ```
516/// #![no_std]
517/// use soroban_sdk::{contract, contractimpl, contracttype, symbol_short, Symbol, Env};
518///
519/// /// A tuple enum is stored as a two-element vector containing the name of
520/// /// the enum variant as a Symbol, then the value in the tuple.
521/// #[contracttype]
522/// #[derive(Clone, Debug, Eq, PartialEq)]
523/// pub enum Color {
524///     Red(Intensity),
525///     Blue(Shade),
526/// }
527///
528/// /// A unit enum is stored as a single-element vector containing the name of
529/// /// the enum variant as a Symbol.
530/// #[contracttype]
531/// #[derive(Clone, Debug, Eq, PartialEq)]
532/// pub enum Shade {
533///     Light,
534///     Dark,
535/// }
536///
537/// /// An integer enum is stored as its integer value.
538/// #[contracttype]
539/// #[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)]
540/// #[repr(u32)]
541/// pub enum Intensity {
542///     Low = 1,
543///     High = 2,
544/// }
545///
546/// #[contract]
547/// pub struct Contract;
548///
549/// #[contractimpl]
550/// impl Contract {
551///     /// Set the color.
552///     pub fn set(env: Env, c: Color) {
553///         env.storage().persistent().set(&symbol_short!("COLOR"), &c);
554///     }
555///
556///     /// Get the color.
557///     pub fn get(env: Env) -> Option<Color> {
558///         env.storage().persistent()
559///             .get(&symbol_short!("COLOR"))
560///     }
561/// }
562///
563/// #[test]
564/// fn test() {
565/// # }
566/// # #[cfg(feature = "testutils")]
567/// # fn main() {
568///     let env = Env::default();
569///     let contract_id = env.register(Contract, ());
570///     let client = ContractClient::new(&env, &contract_id);
571///
572///     assert_eq!(client.get(), None);
573///
574///     client.set(&Color::Red(Intensity::High));
575///     assert_eq!(client.get(), Some(Color::Red(Intensity::High)));
576///
577///     client.set(&Color::Blue(Shade::Light));
578///     assert_eq!(client.get(), Some(Color::Blue(Shade::Light)));
579/// }
580/// # #[cfg(not(feature = "testutils"))]
581/// # fn main() { }
582/// ```
583pub use soroban_sdk_macros::contracttype;
584
585/// Generates a type that helps build function args for a contract trait.
586pub use soroban_sdk_macros::contractargs;
587
588/// Generates a client for a contract trait.
589///
590/// Can be used to create clients for contracts that live outside the current
591/// crate, using a trait that has been published as a standard or shared
592/// interface.
593///
594/// Primarily useful when needing to generate a client for someone elses
595/// contract where they have only shared a trait interface.
596///
597/// Note that [`contractimpl`] also automatically generates a client, and so it
598/// is unnecessary to use [`contractclient`] for contracts that live in the
599/// current crate.
600///
601/// Note that [`contractimport`] also automatically generates a client when
602/// importing someone elses contract where they have shared a .wasm file.
603///
604/// ### Examples
605///
606/// ```
607/// use soroban_sdk::{contract, contractclient, contractimpl, vec, symbol_short, BytesN, Env, Symbol, Vec};
608///
609/// #[contractclient(name = "Client")]
610/// pub trait HelloInteface {
611///     fn hello(env: Env, to: Symbol) -> Vec<Symbol>;
612/// }
613///
614/// #[contract]
615/// pub struct HelloContract;
616///
617/// #[contractimpl]
618/// impl HelloContract {
619///     pub fn hello(env: Env, to: Symbol) -> Vec<Symbol> {
620///         vec![&env, symbol_short!("Hello"), to]
621///     }
622/// }
623///
624/// #[test]
625/// fn test() {
626/// # }
627/// # #[cfg(feature = "testutils")]
628/// # fn main() {
629///     let env = Env::default();
630///
631///     // Register the hello contract.
632///     let contract_id = env.register(HelloContract, ());
633///
634///     // Create a client for the hello contract, that was constructed using
635///     // the trait.
636///     let client = Client::new(&env, &contract_id);
637///
638///     let words = client.hello(&symbol_short!("Dev"));
639///
640///     assert_eq!(words, vec![&env, symbol_short!("Hello"), symbol_short!("Dev"),]);
641/// }
642/// # #[cfg(not(feature = "testutils"))]
643/// # fn main() { }
644pub use soroban_sdk_macros::contractclient;
645
646/// Generates a contract spec for a trait or impl.
647///
648/// Note that [`contractimpl`] also generates a contract spec and it is in most
649/// cases not necessary to use this macro.
650#[doc(hidden)]
651pub use soroban_sdk_macros::contractspecfn;
652
653/// Import a contract from its WASM file, generating a constant holding the
654/// contract file.
655///
656/// Note that [`contractimport`] also automatically imports the contract file
657/// into a constant, and so it is usually unnecessary to use [`contractfile`]
658/// directly, unless you specifically want to only load the contract file
659/// without generating a client for it.
660pub use soroban_sdk_macros::contractfile;
661
662/// Panic with the given error.
663///
664/// The first argument in the list must be a reference to an [Env].
665///
666/// The second argument is an error value. The error value will be given to any
667/// calling contract.
668///
669/// Equivalent to `panic!`, but with an error value instead of a string. The
670/// error value will be given to any calling contract.
671///
672/// See [`contracterror`] for how to define an error type.
673#[macro_export]
674macro_rules! panic_with_error {
675    ($env:expr, $error:expr) => {{
676        $env.panic_with_error($error);
677    }};
678}
679
680#[doc(hidden)]
681#[deprecated(note = "use panic_with_error!")]
682#[macro_export]
683macro_rules! panic_error {
684    ($env:expr, $error:expr) => {{
685        $crate::panic_with_error!($env, $error);
686    }};
687}
688
689/// An internal panic! variant that avoids including the string
690/// when building for wasm (since it's just pointless baggage).
691#[cfg(target_family = "wasm")]
692macro_rules! sdk_panic {
693    ($_msg:literal) => {
694        panic!()
695    };
696    () => {
697        panic!()
698    };
699}
700#[cfg(not(target_family = "wasm"))]
701macro_rules! sdk_panic {
702    ($msg:literal) => {
703        panic!($msg)
704    };
705    () => {
706        panic!()
707    };
708}
709
710/// Assert a condition and panic with the given error if it is false.
711///
712/// The first argument in the list must be a reference to an [Env].
713///
714/// The second argument is an expression that if resolves to `false` will cause
715/// a panic with the error in the third argument.
716///
717/// The third argument is an error value. The error value will be given to any
718/// calling contract.
719///
720/// Equivalent to `assert!`, but with an error value instead of a string. The
721/// error value will be given to any calling contract.
722///
723/// See [`contracterror`] for how to define an error type.
724#[macro_export]
725macro_rules! assert_with_error {
726    ($env:expr, $cond:expr, $error:expr) => {{
727        if !($cond) {
728            $crate::panic_with_error!($env, $error);
729        }
730    }};
731}
732
733#[doc(hidden)]
734pub mod unwrap;
735
736mod env;
737
738mod address;
739mod symbol;
740
741pub use env::{ConversionError, Env};
742
743/// Raw value of the Soroban smart contract platform that types can be converted
744/// to and from for storing, or passing between contracts.
745///
746pub use env::Val;
747
748/// Used to do conversions between values in the Soroban environment.
749pub use env::FromVal;
750/// Used to do conversions between values in the Soroban environment.
751pub use env::IntoVal;
752/// Used to do conversions between values in the Soroban environment.
753pub use env::TryFromVal;
754/// Used to do conversions between values in the Soroban environment.
755pub use env::TryIntoVal;
756
757// Used by generated code only.
758#[doc(hidden)]
759pub use env::EnvBase;
760#[doc(hidden)]
761pub use env::Error;
762#[doc(hidden)]
763pub use env::MapObject;
764#[doc(hidden)]
765pub use env::SymbolStr;
766#[doc(hidden)]
767pub use env::VecObject;
768
769mod try_from_val_for_contract_fn;
770#[doc(hidden)]
771#[allow(deprecated)]
772pub use try_from_val_for_contract_fn::TryFromValForContractFn;
773
774#[doc(hidden)]
775#[deprecated(note = "use storage")]
776pub mod data {
777    #[doc(hidden)]
778    #[deprecated(note = "use storage::Storage")]
779    pub use super::storage::Storage as Data;
780}
781pub mod auth;
782mod bytes;
783pub mod crypto;
784pub mod deploy;
785mod error;
786pub use error::InvokeError;
787pub mod events;
788pub use events::Topics;
789pub mod iter;
790pub mod ledger;
791pub mod logs;
792mod map;
793pub mod prng;
794pub mod storage;
795pub mod token;
796mod vec;
797pub use address::Address;
798pub use bytes::{Bytes, BytesN};
799pub use map::Map;
800pub use symbol::Symbol;
801pub use vec::Vec;
802mod num;
803pub use num::{Duration, Timepoint, I256, U256};
804mod string;
805pub use string::String;
806mod tuple;
807
808mod constructor_args;
809pub use constructor_args::ConstructorArgs;
810
811pub mod xdr;
812
813pub mod testutils;
814
815mod arbitrary_extra;
816
817mod tests;