Skip to content

Commit 6c9cb1f

Browse files
committed
Replace subcall -> SubMsg::new
1 parent 30d2b3b commit 6c9cb1f

File tree

4 files changed

+29
-29
lines changed

4 files changed

+29
-29
lines changed

contracts/ibc-reflect/src/contract.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use cosmwasm_std::{
2-
attr, entry_point, from_slice, subcall, to_binary, wasm_execute, BankMsg, Binary,
2+
attr, entry_point, from_slice, to_binary, wasm_execute, BankMsg, Binary,
33
ContractResult, CosmosMsg, Deps, DepsMut, Empty, Env, Event, IbcAcknowledgement,
44
IbcBasicResponse, IbcChannel, IbcOrder, IbcPacket, IbcReceiveResponse, MessageInfo, Order,
55
QueryResponse, Reply, ReplyOn, Response, StdError, StdResult, SubMsg, SubcallResponse, WasmMsg,
@@ -163,7 +163,7 @@ pub fn ibc_channel_connect(
163163
funds: vec![],
164164
label: format!("ibc-reflect-{}", &chan_id),
165165
};
166-
let msg = subcall(msg, INIT_CALLBACK_ID, ReplyOn::Success);
166+
let msg = SubMsg::new(msg, INIT_CALLBACK_ID, ReplyOn::Success);
167167

168168
// store the channel id for the reply handler
169169
pending_channel(deps.storage).save(&chan_id)?;
@@ -306,7 +306,7 @@ fn receive_dispatch(
306306
let wasm_msg = wasm_execute(reflect_addr, &reflect_msg, vec![])?;
307307

308308
// we wrap it in a submessage to properly report errors
309-
let msg = subcall(wasm_msg, RECEIVE_DISPATCH_ID, ReplyOn::Error);
309+
let msg = SubMsg::new(wasm_msg, RECEIVE_DISPATCH_ID, ReplyOn::Error);
310310

311311
Ok(IbcReceiveResponse {
312312
acknowledgement,

packages/std/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ pub use crate::query::{
5252
#[cfg(feature = "stargate")]
5353
pub use crate::query::{ChannelResponse, IbcQuery, ListChannelsResponse, PortIdResponse};
5454
pub use crate::results::{
55-
attr, call, subcall, subcall_with_limit, wasm_execute, wasm_instantiate, Attribute, BankMsg,
56-
ContractResult, CosmosMsg, Empty, Event, QueryResponse, Reply, ReplyOn, Response, SubMsg,
57-
SubcallResponse, SystemResult, WasmMsg,
55+
attr, call, wasm_execute, wasm_instantiate, Attribute, BankMsg, ContractResult, CosmosMsg,
56+
Empty, Event, QueryResponse, Reply, ReplyOn, Response, SubMsg, SubcallResponse, SystemResult,
57+
WasmMsg,
5858
};
5959
#[cfg(feature = "staking")]
6060
pub use crate::results::{DistributionMsg, StakingMsg};

packages/std/src/results/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,5 @@ pub use cosmos_msg::{DistributionMsg, StakingMsg};
1717
pub use empty::Empty;
1818
pub use query::QueryResponse;
1919
pub use response::Response;
20-
pub use subcall::{
21-
call, subcall, subcall_with_limit, Event, Reply, ReplyOn, SubMsg, SubcallResponse,
22-
};
20+
pub use subcall::{call, Event, Reply, ReplyOn, SubMsg, SubcallResponse};
2321
pub use system_result::SystemResult;

packages/std/src/results/subcall.rs

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -82,31 +82,33 @@ where
8282
}
8383
}
8484

85-
/// subcall takes eg. BankMsg::Send{} and sets up for a reply. No gas limit is set.
86-
pub fn subcall<M, T>(msg: M, id: u64, reply_on: ReplyOn) -> SubMsg<T>
85+
impl<T> SubMsg<T>
8786
where
88-
M: Into<CosmosMsg<T>>,
8987
T: Clone + fmt::Debug + PartialEq + JsonSchema,
9088
{
91-
SubMsg {
92-
id,
93-
msg: msg.into(),
94-
reply_on,
95-
gas_limit: None,
89+
/// new takes eg. BankMsg::Send{} and sets up for a reply. No gas limit is set.
90+
pub fn new<M: Into<CosmosMsg<T>>>(msg: M, id: u64, reply_on: ReplyOn) -> Self {
91+
SubMsg {
92+
id,
93+
msg: msg.into(),
94+
reply_on,
95+
gas_limit: None,
96+
}
9697
}
97-
}
9898

99-
/// subcall_with_limit is like subcall but allows setting a gas limit
100-
pub fn subcall_with_limit<M, T>(msg: M, id: u64, reply_on: ReplyOn, gas_limit: u64) -> SubMsg<T>
101-
where
102-
M: Into<CosmosMsg<T>>,
103-
T: Clone + fmt::Debug + PartialEq + JsonSchema,
104-
{
105-
SubMsg {
106-
id,
107-
msg: msg.into(),
108-
reply_on,
109-
gas_limit: Some(gas_limit),
99+
/// new_with_limit is like new but allows setting a gas limit
100+
pub fn new_with_limit<M: Into<CosmosMsg<T>>>(
101+
msg: M,
102+
id: u64,
103+
reply_on: ReplyOn,
104+
gas_limit: u64,
105+
) -> Self {
106+
SubMsg {
107+
id,
108+
msg: msg.into(),
109+
reply_on,
110+
gas_limit: Some(gas_limit),
111+
}
110112
}
111113
}
112114

0 commit comments

Comments
 (0)