Crate cosmwasm_std

source ·

Modules§

  • This modules is very advanced and will not be used directly by the vast majority of users. We want to offer it to ensure a stable storage key composition system but don’t encourage contract devs to use it directly.
  • 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.

Macros§

  • Asserts that two expressions are approximately equal to each other.
  • Quick check for a guard. If the condition (first argument) is false, then return the second argument x wrapped in Err(x).
  • Quick check for a guard. Like assert_eq!, but rather than panic, it returns the third argument x wrapped in Err(x).
  • Quick check for a guard. Like assert_ne!, but rather than panic, it returns the third argument x wrapped in Err(x).
  • Given an implementation of T == U, implements:

Structs§

Enums§

Traits§

  • 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.
  • Like CustomQuery for better type clarity. Also makes it shorter to use as a trait bound.
  • 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.
  • A fraction p/q with integers p and q.
  • A trait for calculating the integer square root.
  • Storage provides read and write access to a persistent storage. If you only want to provide read access, provide &Storage

Functions§

  • Creates a new Attribute. Attribute::new is an alias for this.
  • A shorthand constructor for Coin
  • A shortcut constructor for a set of one denomination of coins
  • from_binaryDeprecated
  • Deserializes the given JSON bytes to a data structure.
  • from_sliceDeprecated
  • has_coins returns true if the list of coins has at least the required amount
  • Creates a contract address using the predictable address format introduced with wasmd 0.29. When using instantiate2, this is a way to precompute the address. When using instantiate, the contract address will use a different algorithm and cannot be pre-computed as it contains inputs from the chain’s state at the time of message execution.
  • to_binaryDeprecated
  • Serializes the given data structure as JSON bytes.
  • Serializes the given data structure as a JSON string.
  • Serializes the given data structure as a JSON byte vector.
  • to_vecDeprecated
  • Shortcut helper as the construction of WasmMsg::Execute can be quite verbose in contract code
  • Shortcut helper as the construction of WasmMsg::Instantiate can be quite verbose in contract code.

Type Aliases§

  • This serializes either as “null” or a JSON object.
  • A short-hand alias for the two-level query result (1. accessing the contract, 2. executing query in the contract)
  • A record of a key-value storage that is created through an iterator API. The first element (key) is always raw binary data. The second element (value) is binary by default but can be changed to a custom type. This allows contracts to reuse the type when deserializing database records.
  • The return type for init, execute and query. Since the error type cannot be serialized to JSON, this is only available within the contract and its unit tests.

Attribute Macros§

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