@@ -22,7 +22,6 @@ use crate::{
2222 contract:: { self , arg_parsing, id:: wasm:: get_contract_id, upload} ,
2323 global,
2424 txn_result:: { TxnEnvelopeResult , TxnResult } ,
25- NetworkRunnable ,
2625 } ,
2726 config:: { self , data, locator, network} ,
2827 print:: Print ,
@@ -152,7 +151,7 @@ pub enum Error {
152151impl Cmd {
153152 pub async fn run ( & self , global_args : & global:: Args ) -> Result < ( ) , Error > {
154153 let res = self
155- . run_against_rpc_server ( Some ( global_args) , None )
154+ . execute ( & self . config , global_args. quiet , global_args . no_cache )
156155 . await ?
157156 . to_envelope ( ) ;
158157 match res {
@@ -184,23 +183,16 @@ impl Cmd {
184183 }
185184 Ok ( ( ) )
186185 }
187- }
188-
189- #[ async_trait:: async_trait]
190- impl NetworkRunnable for Cmd {
191- type Error = Error ;
192- type Result = TxnResult < stellar_strkey:: Contract > ;
193186
194187 #[ allow( clippy:: too_many_lines) ]
195188 #[ allow( unused_variables) ]
196- async fn run_against_rpc_server (
189+ pub async fn execute (
197190 & self ,
198- global_args : Option < & global:: Args > ,
199- config : Option < & config:: Args > ,
191+ config : & config:: Args ,
192+ quiet : bool ,
193+ no_cache : bool ,
200194 ) -> Result < TxnResult < stellar_strkey:: Contract > , Error > {
201- let quiet = global_args. is_some_and ( |a| a. quiet ) ;
202195 let print = Print :: new ( quiet) ;
203- let config = config. unwrap_or ( & self . config ) ;
204196 let wasm_hash = if let Some ( wasm) = & self . wasm {
205197 let is_build = self . build_only ;
206198 let hash = if is_build {
@@ -213,7 +205,7 @@ impl NetworkRunnable for Cmd {
213205 ignore_checks : self . ignore_checks ,
214206 build_only : is_build,
215207 }
216- . run_against_rpc_server ( global_args , Some ( config ) )
208+ . execute ( config , quiet , no_cache )
217209 . await ?
218210 . into_result ( )
219211 . expect ( "the value (hash) is expected because it should always be available since build-only is a shared parameter" )
@@ -330,7 +322,7 @@ impl NetworkRunnable for Cmd {
330322
331323 self . resources . print_cost_info ( & get_txn_resp) ?;
332324
333- if global_args . is_none_or ( |a| !a . no_cache ) {
325+ if ! no_cache {
334326 data:: write ( get_txn_resp. clone ( ) . try_into ( ) ?, & network. rpc_uri ( ) ?) ?;
335327 }
336328
0 commit comments