1
1
use std:: str:: FromStr ;
2
2
3
3
use abstract_sdk:: {
4
+ feature_objects:: { AnsHost , VersionControlContract } ,
4
5
features:: AccountIdentification ,
5
- std:: {
6
- ibc_client:: state:: { ACCOUNTS , CONFIG } ,
7
- ibc_host:: { HostAction , InternalAction } ,
8
- objects:: { ans_host:: AnsHost , version_control:: VersionControlContract , ChannelEntry } ,
9
- ICS20 ,
10
- } ,
11
6
Resolve ,
12
7
} ;
13
8
use abstract_std:: {
14
- ibc:: CallbackInfo ,
15
9
ibc_client:: {
16
- state:: { IbcInfrastructure , IBC_INFRA , REVERSE_POLYTONE_NOTE } ,
10
+ state:: { IbcInfrastructure , ACCOUNTS , CONFIG , IBC_INFRA , REVERSE_POLYTONE_NOTE } ,
17
11
IbcClientCallback ,
18
12
} ,
19
- ibc_host, manager ,
20
- manager:: ModuleInstallConfig ,
21
- objects:: { chain_name:: ChainName , AccountId , AssetEntry } ,
13
+ ibc_host:: { self , HostAction , InternalAction } ,
14
+ manager:: { self , ModuleInstallConfig } ,
15
+ objects:: { chain_name:: ChainName , AccountId , AssetEntry , ChannelEntry } ,
22
16
version_control:: AccountBase ,
17
+ ICS20 ,
23
18
} ;
24
19
use cosmwasm_std:: {
25
20
to_json_binary, wasm_execute, Coin , CosmosMsg , Deps , DepsMut , Empty , Env , IbcMsg , MessageInfo ,
26
- QueryRequest , Storage ,
21
+ Storage ,
27
22
} ;
28
23
use polytone:: callbacks:: CallbackRequest ;
29
24
@@ -169,38 +164,14 @@ fn send_remote_host_action(
169
164
Ok ( note_message. into ( ) )
170
165
}
171
166
172
- /// Perform a ICQ on a remote chain
173
- fn send_remote_host_query (
174
- deps : Deps ,
175
- host_chain : ChainName ,
176
- queries : Vec < QueryRequest < Empty > > ,
177
- callback_request : CallbackRequest ,
178
- ) -> IbcClientResult < CosmosMsg < Empty > > {
179
- // Send this message via the Polytone infra
180
- let note_contract = IBC_INFRA . load ( deps. storage , & host_chain) ?. polytone_note ;
181
-
182
- let note_message = wasm_execute (
183
- note_contract. to_string ( ) ,
184
- & polytone_note:: msg:: ExecuteMsg :: Query {
185
- msgs : queries,
186
- callback : callback_request,
187
- timeout_seconds : PACKET_LIFETIME . into ( ) ,
188
- } ,
189
- vec ! [ ] ,
190
- ) ?;
191
-
192
- Ok ( note_message. into ( ) )
193
- }
194
-
195
167
/// Sends a packet with an optional callback.
196
168
/// This is the top-level function to do IBC related actions.
197
169
pub fn execute_send_packet (
198
170
deps : DepsMut ,
199
- env : Env ,
171
+ _env : Env ,
200
172
info : MessageInfo ,
201
173
host_chain : String ,
202
174
action : HostAction ,
203
- callback_info : Option < CallbackInfo > ,
204
175
) -> IbcClientResult {
205
176
let host_chain = ChainName :: from_str ( & host_chain) ?;
206
177
@@ -219,44 +190,18 @@ pub fn execute_send_packet(
219
190
return Err ( IbcClientError :: ForbiddenInternalCall { } ) ;
220
191
}
221
192
222
- let callback_request = callback_info. map ( |c| CallbackRequest {
223
- receiver : env. contract . address . to_string ( ) ,
224
- msg : to_json_binary ( & IbcClientCallback :: UserRemoteAction ( c) ) . unwrap ( ) ,
225
- } ) ;
226
-
227
193
let note_message = send_remote_host_action (
228
194
deps. as_ref ( ) ,
229
195
account_id,
230
196
account_base,
231
197
host_chain,
232
198
action,
233
- callback_request ,
199
+ None ,
234
200
) ?;
235
201
236
202
Ok ( IbcClientResponse :: action ( "handle_send_msgs" ) . add_message ( note_message) )
237
203
}
238
204
239
- // Top-level function for performing queries.
240
- pub fn execute_send_query (
241
- deps : DepsMut ,
242
- env : Env ,
243
- host_chain : String ,
244
- queries : Vec < QueryRequest < Empty > > ,
245
- callback_info : CallbackInfo ,
246
- ) -> IbcClientResult {
247
- let host_chain = ChainName :: from_str ( & host_chain) ?;
248
-
249
- let callback_request = CallbackRequest {
250
- receiver : env. contract . address . to_string ( ) ,
251
- msg : to_json_binary ( & IbcClientCallback :: UserRemoteAction ( callback_info) ) . unwrap ( ) ,
252
- } ;
253
-
254
- let note_message =
255
- send_remote_host_query ( deps. as_ref ( ) , host_chain, queries, callback_request) ?;
256
-
257
- Ok ( IbcClientResponse :: action ( "handle_send_msgs" ) . add_message ( note_message) )
258
- }
259
-
260
205
/// Registers an Abstract Account on a remote chain.
261
206
pub fn execute_register_account (
262
207
deps : DepsMut ,
0 commit comments