Skip to content

Commit

Permalink
imp: introduced ibc-proto to support the transfer memo field
Browse files Browse the repository at this point in the history
  • Loading branch information
srdtrk committed Aug 10, 2024
1 parent 8f0e64a commit b3bd8b1
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 3 deletions.
48 changes: 48 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ serde = { version = "1.0", default-features = false, features = ["derive"] }
serde-json-wasm = "1.0"
thiserror = "1.0"
cosmos-sdk-proto = { version = "0.23", default-features = false, features = ["cosmwasm", "std"] }
ibc-proto = { version = "0.47", default-features = false, features = ["std", "serde"] }
semver = "1.0"
cw-ownable = { version = "0.6.0", git = "https://github.com/larry0x/cw-plus-plus.git", rev = "718351d4e9d66edbf3b6dbea2d13b56ef732f51c" }
cw-ica-controller-derive = "0.4.2"
Expand Down
11 changes: 8 additions & 3 deletions src/types/cosmos_msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,15 @@ mod convert_to_any {
MsgClearAdmin, MsgExecuteContract, MsgInstantiateContract, MsgInstantiateContract2,
MsgMigrateContract, MsgUpdateAdmin,
},
ibc::{applications::transfer::v1::MsgTransfer, core::client::v1::Height},
prost::EncodeError,
Any,
};

use ibc_proto::{
cosmos::base::v1beta1::Coin as IbcCoin,
ibc::{apps::transfer::v1::MsgTransfer, core::client::v1::Height},
};

use cosmwasm_std::{BankMsg, GovMsg, IbcMsg, VoteOption, WasmMsg};
#[cfg(feature = "staking")]
use cosmwasm_std::{DistributionMsg, StakingMsg};
Expand Down Expand Up @@ -101,11 +105,11 @@ mod convert_to_any {
to_address,
amount,
timeout,
.. // TODO: support memo with ibc-proto
memo,
} => Any::from_msg(&MsgTransfer {
source_port: "transfer".to_string(),
source_channel: channel_id,
token: Some(ProtoCoin {
token: Some(IbcCoin {
denom: amount.denom,
amount: amount.amount.to_string(),
}),
Expand All @@ -116,6 +120,7 @@ mod convert_to_any {
revision_height: block.height,
}),
timeout_timestamp: timeout.timestamp().map_or(0, |timestamp| timestamp.nanos()),
memo: memo.unwrap_or_default(),
}),
_ => panic!("Unsupported IbcMsg"),
}
Expand Down

0 comments on commit b3bd8b1

Please sign in to comment.