prov_cosmwasm_std/
lib.rs

1#![cfg_attr(feature = "backtraces", feature(backtrace))]
2
3// Exposed on all platforms
4
5mod addresses;
6mod assertions;
7mod binary;
8mod coins;
9mod conversion;
10mod deps;
11mod errors;
12mod ibc;
13mod import_helpers;
14#[cfg(feature = "iterator")]
15mod iterator;
16mod math;
17mod query;
18mod results;
19mod sections;
20mod serde;
21mod storage;
22mod timestamp;
23mod traits;
24mod types;
25
26pub use crate::addresses::{Addr, CanonicalAddr};
27pub use crate::binary::Binary;
28pub use crate::coins::{coin, coins, has_coins, Coin};
29pub use crate::deps::{Deps, DepsMut, OwnedDeps};
30pub use crate::errors::{
31    ConversionOverflowError, DivideByZeroError, OverflowError, OverflowOperation,
32    RecoverPubkeyError, StdError, StdResult, SystemError, VerificationError,
33};
34#[cfg(feature = "stargate")]
35pub use crate::ibc::{
36    IbcAcknowledgement, IbcBasicResponse, IbcChannel, IbcChannelCloseMsg, IbcChannelConnectMsg,
37    IbcChannelOpenMsg, IbcEndpoint, IbcMsg, IbcOrder, IbcPacket, IbcPacketAckMsg,
38    IbcPacketReceiveMsg, IbcPacketTimeoutMsg, IbcReceiveResponse, IbcTimeout, IbcTimeoutBlock,
39};
40#[cfg(feature = "iterator")]
41#[allow(deprecated)]
42pub use crate::iterator::Pair;
43#[cfg(feature = "iterator")]
44pub use crate::iterator::{Order, Record};
45pub use crate::math::{
46    Decimal, Decimal256, Decimal256RangeExceeded, DecimalRangeExceeded, Fraction, Isqrt, Uint128,
47    Uint256, Uint512, Uint64,
48};
49pub use crate::query::{
50    AllBalanceResponse, BalanceResponse, BankQuery, ContractInfoResponse, CustomQuery,
51    QueryRequest, WasmQuery,
52};
53#[cfg(feature = "staking")]
54pub use crate::query::{
55    AllDelegationsResponse, AllValidatorsResponse, BondedDenomResponse, Delegation, FullDelegation,
56    StakingQuery, Validator, ValidatorResponse,
57};
58#[cfg(feature = "stargate")]
59pub use crate::query::{ChannelResponse, IbcQuery, ListChannelsResponse, PortIdResponse};
60pub use crate::results::{
61    attr, wasm_execute, wasm_instantiate, Attribute, BankMsg, ContractResult, CosmosMsg, CustomMsg,
62    Empty, Event, QueryResponse, Reply, ReplyOn, Response, SubMsg, SubMsgExecutionResponse,
63    SystemResult, WasmMsg,
64};
65#[cfg(feature = "staking")]
66pub use crate::results::{DistributionMsg, StakingMsg};
67#[cfg(feature = "stargate")]
68pub use crate::results::{GovMsg, VoteOption};
69pub use crate::serde::{from_binary, from_slice, to_binary, to_vec};
70pub use crate::storage::MemoryStorage;
71pub use crate::timestamp::Timestamp;
72pub use crate::traits::{Api, Querier, QuerierResult, QuerierWrapper, Storage};
73pub use crate::types::{BlockInfo, ContractInfo, Env, MessageInfo, TransactionInfo};
74
75// Exposed in wasm build only
76
77#[cfg(target_arch = "wasm32")]
78mod exports;
79#[cfg(target_arch = "wasm32")]
80mod imports;
81#[cfg(target_arch = "wasm32")]
82mod memory; // Used by exports and imports only. This assumes pointers are 32 bit long, which makes it untestable on dev machines.
83
84#[cfg(target_arch = "wasm32")]
85pub use crate::exports::{do_execute, do_instantiate, do_migrate, do_query, do_reply, do_sudo};
86#[cfg(all(feature = "stargate", target_arch = "wasm32"))]
87pub use crate::exports::{
88    do_ibc_channel_close, do_ibc_channel_connect, do_ibc_channel_open, do_ibc_packet_ack,
89    do_ibc_packet_receive, do_ibc_packet_timeout,
90};
91#[cfg(target_arch = "wasm32")]
92pub use crate::imports::{ExternalApi, ExternalQuerier, ExternalStorage};
93
94// Exposed for testing only
95// Both unit tests and integration tests are compiled to native code, so everything in here does not need to compile to Wasm.
96
97#[cfg(not(target_arch = "wasm32"))]
98mod mock;
99#[cfg(not(target_arch = "wasm32"))]
100pub mod testing {
101    #[cfg(feature = "staking")]
102    pub use crate::mock::StakingQuerier;
103    pub use crate::mock::{
104        digit_sum, mock_dependencies, mock_dependencies_with_balance,
105        mock_dependencies_with_balances, mock_env, mock_info, mock_wasmd_attr, riffle_shuffle,
106        BankQuerier, MockApi, MockQuerier, MockQuerierCustomHandlerResult, MockStorage,
107        MOCK_CONTRACT_ADDR,
108    };
109    #[cfg(feature = "stargate")]
110    pub use crate::mock::{
111        mock_ibc_channel, mock_ibc_channel_close_confirm, mock_ibc_channel_close_init,
112        mock_ibc_channel_connect_ack, mock_ibc_channel_connect_confirm, mock_ibc_channel_open_init,
113        mock_ibc_channel_open_try, mock_ibc_packet_ack, mock_ibc_packet_recv,
114        mock_ibc_packet_timeout,
115    };
116}
117
118// Re-exports
119
120pub use prov_cosmwasm_derive::entry_point;