Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make order (de)serialize #2174

Merged
merged 2 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ and this project adheres to
Callbacks memo values. ([#2167])
- cosmwasm-std: Add `IbcMsg::WriteAcknowledgement` for async IBC
acknowledgements ([#2130])
- cosmwasm-std: Add derive attributes for `Order` ([#2174])

[#1983]: https://github.com/CosmWasm/cosmwasm/pull/1983
[#2025]: https://github.com/CosmWasm/cosmwasm/pull/2025
Expand All @@ -74,6 +75,7 @@ and this project adheres to
[#2130]: https://github.com/CosmWasm/cosmwasm/pull/2130
[#2166]: https://github.com/CosmWasm/cosmwasm/pull/2166
[#2167]: https://github.com/CosmWasm/cosmwasm/pull/2167
[#2174]: https://github.com/CosmWasm/cosmwasm/pull/2174

### Changed

Expand Down
5 changes: 4 additions & 1 deletion packages/std/src/iterator.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
use crate::StdError;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

/// 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.
pub type Record<V = Vec<u8>> = (Vec<u8>, V);

#[derive(Copy, Clone, PartialEq, Eq)]
#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
// We assign these to integers to provide a stable API for passing over FFI (to wasm and Go)
pub enum Order {
Ascending = 1,
Expand Down