Skip to content

Commit d1d12c0

Browse files
author
hard-nett
committed
execute as account
1 parent 37aa47f commit d1d12c0

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

contracts/usb/src/handlers/execute.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use crate::{
22
contract::{Usb, UsbResult},
33
msg::UsbExecuteMsg,
4+
replies::JACKAL_MSG_REPLY_ID,
45
state::{CONFIG, COUNT},
56
UsbError,
67
};
@@ -42,6 +43,7 @@ pub fn execute_handler(
4243
fn send_content(deps: DepsMut, info: MessageInfo, msg: JackalMsg, mut app: Usb) -> UsbResult {
4344
// api for executing account actions
4445
let executor = app.executor(deps.as_ref());
46+
4547
// define msgs to send to jackal as account
4648
let msg = match msg {
4749
JackalMsg::MakeRoot {
@@ -238,7 +240,14 @@ fn send_content(deps: DepsMut, info: MessageInfo, msg: JackalMsg, mut app: Usb)
238240
)?
239241
.into();
240242

241-
Ok(app.response("send_content").add_message(send_as_proxy))
243+
// execute as account, with reply on success
244+
let msg = executor.execute_with_reply_and_data(
245+
send_as_proxy,
246+
cosmwasm_std::ReplyOn::Success,
247+
JACKAL_MSG_REPLY_ID,
248+
)?;
249+
250+
Ok(app.response("send_content").add_submessage(msg))
242251
}
243252

244253
// pub(crate) fn route_msg(app: Usb, sender: Addr, msg: JackalMsg) -> UsbResult<CosmosMsg> {

contracts/usb/src/replies/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ mod instantiate;
33
pub use instantiate::instantiate_reply;
44

55
pub const INSTANTIATE_REPLY_ID: u64 = 1u64;
6+
pub const JACKAL_MSG_REPLY_ID: u64 = 2u64;

0 commit comments

Comments
 (0)