From 70c14edd148a54ac4c61493f75d6cebbde64a748 Mon Sep 17 00:00:00 2001 From: Tomasz Kurcz Date: Wed, 15 Jan 2025 14:45:08 +0100 Subject: [PATCH] fix: use msgpack impl provided by cosmwasm_std --- packages/cw-storey/Cargo.toml | 2 +- packages/cw-storey/src/encoding.rs | 25 ++----------------------- 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/packages/cw-storey/Cargo.toml b/packages/cw-storey/Cargo.toml index e2edaf6..93979aa 100644 --- a/packages/cw-storey/Cargo.toml +++ b/packages/cw-storey/Cargo.toml @@ -11,7 +11,7 @@ edition = "2021" license = { workspace = true } [dependencies] -cosmwasm-std = "2" +cosmwasm-std = "2.2" rmp-serde = "1.1" serde = "1" diff --git a/packages/cw-storey/src/encoding.rs b/packages/cw-storey/src/encoding.rs index a15dc42..0fd8a30 100644 --- a/packages/cw-storey/src/encoding.rs +++ b/packages/cw-storey/src/encoding.rs @@ -23,7 +23,7 @@ where T: serde::Serialize, { fn encode_impl(self) -> Result, StdError> { - cosmwasm_std_new::to_msgpack_vec(self.0) + cosmwasm_std::to_msgpack_vec(self.0) } } @@ -32,27 +32,6 @@ where T: serde::de::DeserializeOwned, { fn decode_impl(data: &[u8]) -> Result { - cosmwasm_std_new::from_msgpack(data).map(Cover) - } -} - -// TODO: remove this module once the following PR is released on crates.io: -// https://github.com/CosmWasm/cosmwasm/pull/2118 -mod cosmwasm_std_new { - use core::any::type_name; - - use cosmwasm_std::{StdError, StdResult}; - use serde::de::DeserializeOwned; - use serde::Serialize; - - pub(super) fn from_msgpack(value: impl AsRef<[u8]>) -> StdResult { - rmp_serde::from_read(value.as_ref()).map_err(|e| StdError::parse_err(type_name::(), e)) - } - - pub(super) fn to_msgpack_vec(data: &T) -> StdResult> - where - T: Serialize + ?Sized, - { - rmp_serde::to_vec_named(data).map_err(|e| StdError::serialize_err(type_name::(), e)) + cosmwasm_std::from_msgpack(data).map(Cover) } }