Crate cosmwasm_std[][src]

Modules

testing

Macros

create_entry_points

This macro generates the boilerplate required to call into the contract-specific logic from the entry-points to the Wasm module.

create_entry_points_with_migration

This macro is very similar to the create_entry_points macro, except it also requires the migrate method:

Structs

AllBalanceResponse
AllDelegationsResponse

DelegationsResponse is data format returned from StakingRequest::AllDelegations query

Attribute

An key value pair that is used in the context of event attributes in logs

BalanceResponse
Binary

Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.

BlockInfo
BondedDenomResponse

BondedDenomResponse is data format returned from StakingRequest::BondedDenom query

CanonicalAddr
Coin
ContextDeprecated
ContractInfo
Decimal

A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0

Delegation

Delegation is basic (cheap to query) data about a delegation

Deps
DepsMut
Empty

An empty struct that serves as a placeholder in different places, such as contracts that don’t set a custom message.

Env
Event

a full sdk event

FullDelegation

FullDelegation is all the info on the delegation, some (like accumulated_reward and can_redelegate) is expensive to query

HumanAddr
MemoryStorage
MessageInfo

Additional information from MsgInstantiateContract and MsgExecuteContract, which is passed along with the contract execution message into the init and handle entry points.

OwnedDeps

Holds all external dependencies of the contract. Designed to allow easy dependency injection at runtime. This cannot be copied or cloned since it would behave differently for mock storages and a bridge storage in the VM.

QuerierWrapper
Reply

The Result object returned to subcall_response. We always get the same id back and then must handle success and error cases ourselves

Response

A response of a contract entry point, such as init, handle or migrate.

SubMsg

A sub-message that will guarantee a subcall_response callback on success or error Note on error the subcall will revert any partial state changes due to this message, but not revert any state changes in the calling contract (that must be done in the subcall_response entry point)

SubcallResponse

The information we get back from a successful sub-call, with full sdk events

Uint128
Validator
ValidatorsResponse

ValidatorsResponse is data format returned from StakingRequest::Validators query

Enums

BankMsg

The message types of the bank module.

BankQuery
ContractResult

This is the final result type that is created and serialized in a contract for every init/handle/migrate call. The VM then deserializes this type to distinguish between successful and failed executions.

CosmosMsg
QueryRequest
RecoverPubkeyError
StakingMsg

The message types of the staking module.

StakingQuery
StdError

Structured error type for init, handle and query.

SystemError

SystemError is used for errors inside the VM and is API friendly (i.e. serializable).

SystemResult

This is the outer result type returned by a querier to the contract.

VerificationError
WasmMsg

The message types of the wasm module.

WasmQuery

Traits

Api

Api are callbacks to system functions implemented outside of the wasm modules. Currently it just supports address conversion but we could add eg. crypto functions here.

ByteArray

A marker trait for [u8; $N], which is needed as long as https://rust-lang.github.io/rfcs/2000-const-generics.html is not stable.

CustomQuery

A trait that is required to avoid conflicts with other query types like BankQuery and WasmQuery in generic implementations. You need to implement it in your custom query type.

Querier
Storage

Storage provides read and write access to a persistent storage. If you only want to provide read access, provide &Storage

Functions

attr

Creates a new Attribute.

coin

A shorthand constructor for Coin

coins

A shortcut constructor for a set of one denomination of coins

from_binary
from_slice
has_coins

has_coins returns true if the list of coins has at least the required amount

to_binary
to_vec
wasm_execute

Shortcut helper as the construction of WasmMsg::Instantiate can be quite verbose in contract code

wasm_instantiate

Shortcut helper as the construction of WasmMsg::Instantiate can be quite verbose in contract code

Type Definitions

HandleResponseDeprecated
InitResponseDeprecated
MigrateResponseDeprecated
QuerierResult

A short-hand alias for the two-level query result (1. accessing the contract, 2. executing query in the contract)

QueryResponse
StdResult

The return type for init, handle and query. Since the error type cannot be serialized to JSON, this is only available within the contract and its unit tests.

Attribute Macros

entry_point

This attribute macro generates the boilerplate required to call into the contract-specific logic from the entry-points to the Wasm module.