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
// Exposed on all platforms

mod coins;
mod encoding;
mod entry_points;
mod errors;
mod init_handle;
#[cfg(feature = "iterator")]
mod iterator;
mod math;
mod query;
mod serde;
mod storage;
mod traits;
mod types;

pub use crate::coins::{coin, coins, has_coins, Coin};
pub use crate::encoding::Binary;
#[allow(deprecated)]
pub use crate::errors::{
    generic_err, invalid_base64, invalid_utf8, not_found, parse_err, serialize_err, unauthorized,
    underflow, StdError, StdResult, SystemError, SystemResult,
};
pub use crate::init_handle::{
    log, BankMsg, CosmosMsg, HandleResponse, HandleResult, InitResponse, InitResult, LogAttribute,
    MigrateResponse, MigrateResult, StakingMsg, WasmMsg,
};
#[cfg(feature = "iterator")]
pub use crate::iterator::{Order, KV};
pub use crate::math::{Decimal, Uint128};
pub use crate::query::{
    AllBalanceResponse, AllDelegationsResponse, BalanceResponse, BankQuery, BondedDenomResponse,
    Delegation, FullDelegation, QueryRequest, QueryResponse, QueryResult, StakingQuery, Validator,
    ValidatorsResponse, WasmQuery,
};
pub use crate::serde::{from_binary, from_slice, to_binary, to_vec};
pub use crate::storage::MemoryStorage;
pub use crate::traits::{Api, Extern, Querier, QuerierResult, ReadonlyStorage, Storage};
pub use crate::types::{
    BlockInfo, CanonicalAddr, ContractInfo, Empty, Env, HumanAddr, MessageInfo,
};

// Exposed in wasm build only

#[cfg(target_arch = "wasm32")]
mod exports;
#[cfg(target_arch = "wasm32")]
mod imports;
#[cfg(target_arch = "wasm32")]
mod memory; // Used by exports and imports only. This assumes pointers are 32 bit long, which makes it untestable on dev machines.

#[cfg(target_arch = "wasm32")]
pub use crate::exports::{do_handle, do_init, do_migrate, do_query};
#[cfg(target_arch = "wasm32")]
pub use crate::imports::{ExternalApi, ExternalQuerier, ExternalStorage};

// Exposed for testing only
// Both unit tests and integration tests are compiled to native code, so everything in here does not need to compile to Wasm.

#[cfg(not(target_arch = "wasm32"))]
mod mock;
#[cfg(not(target_arch = "wasm32"))]
pub mod testing {
    pub use crate::mock::{
        mock_dependencies, mock_dependencies_with_balances, mock_env, BankQuerier, MockApi,
        MockQuerier, MockQuerierCustomHandlerResult, MockStorage, StakingQuerier,
        MOCK_CONTRACT_ADDR,
    };
}