Skip to content

Commit

Permalink
Merge pull request #113 from neutron-org/chore/dont-use-serde-json-wa…
Browse files Browse the repository at this point in the history
…sm-directly

chore: avoid using serde_json_wasm directly
  • Loading branch information
pr0n00gler authored Oct 10, 2023
2 parents 3aab843 + bd59fe3 commit 2de006e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
1 change: 0 additions & 1 deletion contracts/ibc_transfer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ cosmwasm-std = { version = "1.3.0", features = ["staking", "stargate"] }
cw2 = "1.1.0"
schemars = "0.8.10"
serde = { version = "1.0.149", default-features = false, features = ["derive"] }
serde-json-wasm = { version = "0.5.1" }
cw-storage-plus = { version = "1.1.0", features = ["iterator"]}
neutron-sdk = { path = "../../packages/neutron-sdk", default-features = false, version = "0.6.1"}
protobuf = { version = "3.3.0", features = ["with-bytes"] }
Expand Down
11 changes: 5 additions & 6 deletions contracts/ibc_transfer/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use cosmwasm_std::{
coin, entry_point, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Reply, Response,
StdError, StdResult, SubMsg,
coin, entry_point, from_binary, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Reply,
Response, StdError, StdResult, SubMsg,
};
use cw2::set_contract_version;
use neutron_sdk::{
Expand Down Expand Up @@ -112,13 +112,12 @@ fn msg_with_sudo_callback<C: Into<CosmosMsg<T>>, T>(
// and process this payload when an acknowledgement for the SubmitTx message is received in Sudo handler
fn prepare_sudo_payload(mut deps: DepsMut, _env: Env, msg: Reply) -> StdResult<Response> {
let payload = read_reply_payload(deps.storage, msg.id)?;
let resp: MsgIbcTransferResponse = serde_json_wasm::from_slice(
msg.result
let resp: MsgIbcTransferResponse = from_binary(
&msg.result
.into_result()
.map_err(StdError::generic_err)?
.data
.ok_or_else(|| StdError::generic_err("no result"))?
.as_slice(),
.ok_or_else(|| StdError::generic_err("no result"))?,
)
.map_err(|e| StdError::generic_err(format!("failed to parse response: {:?}", e)))?;
let seq_id = resp.sequence_id;
Expand Down

0 comments on commit 2de006e

Please sign in to comment.