@@ -14,8 +14,7 @@ use crate::xdr::{
1414use clap:: { arg, command, Parser } ;
1515use rand:: Rng ;
1616
17- use soroban_spec_tools:: contract as contract_spec;
18-
17+ use crate :: commands:: tx:: fetch;
1918use crate :: {
2019 assembled:: simulate_and_assemble_transaction,
2120 commands:: {
@@ -30,6 +29,7 @@ use crate::{
3029 utils:: { self , rpc:: get_remote_wasm_from_hash} ,
3130 wasm,
3231} ;
32+ use soroban_spec_tools:: contract as contract_spec;
3333
3434pub const CONSTRUCTOR_FUNCTION_NAME : & str = "__constructor" ;
3535
@@ -74,52 +74,78 @@ pub struct Cmd {
7474pub enum Error {
7575 #[ error( transparent) ]
7676 Install ( #[ from] upload:: Error ) ,
77+
7778 #[ error( "error parsing int: {0}" ) ]
7879 ParseIntError ( #[ from] ParseIntError ) ,
80+
7981 #[ error( "internal conversion error: {0}" ) ]
8082 TryFromSliceError ( #[ from] TryFromSliceError ) ,
83+
8184 #[ error( "xdr processing error: {0}" ) ]
8285 Xdr ( #[ from] XdrError ) ,
86+
8387 #[ error( "jsonrpc error: {0}" ) ]
8488 JsonRpc ( #[ from] jsonrpsee_core:: Error ) ,
89+
8590 #[ error( "cannot parse salt: {salt}" ) ]
8691 CannotParseSalt { salt : String } ,
92+
8793 #[ error( "cannot parse contract ID {contract_id}: {error}" ) ]
8894 CannotParseContractId {
8995 contract_id : String ,
9096 error : stellar_strkey:: DecodeError ,
9197 } ,
98+
9299 #[ error( "cannot parse WASM hash {wasm_hash}: {error}" ) ]
93100 CannotParseWasmHash {
94101 wasm_hash : String ,
95102 error : stellar_strkey:: DecodeError ,
96103 } ,
104+
97105 #[ error( "Must provide either --wasm or --wash-hash" ) ]
98106 WasmNotProvided ,
107+
99108 #[ error( transparent) ]
100109 Rpc ( #[ from] rpc:: Error ) ,
110+
101111 #[ error( transparent) ]
102112 Config ( #[ from] config:: Error ) ,
113+
103114 #[ error( transparent) ]
104115 StrKey ( #[ from] stellar_strkey:: DecodeError ) ,
116+
105117 #[ error( transparent) ]
106118 Infallible ( #[ from] std:: convert:: Infallible ) ,
119+
107120 #[ error( transparent) ]
108121 WasmId ( #[ from] contract:: id:: wasm:: Error ) ,
122+
109123 #[ error( transparent) ]
110124 Data ( #[ from] data:: Error ) ,
125+
111126 #[ error( transparent) ]
112127 Network ( #[ from] network:: Error ) ,
128+
113129 #[ error( transparent) ]
114130 Wasm ( #[ from] wasm:: Error ) ,
131+
115132 #[ error( transparent) ]
116133 Locator ( #[ from] locator:: Error ) ,
134+
117135 #[ error( transparent) ]
118136 ContractSpec ( #[ from] contract_spec:: Error ) ,
137+
119138 #[ error( transparent) ]
120139 ArgParse ( #[ from] arg_parsing:: Error ) ,
140+
121141 #[ error( "Only ed25519 accounts are allowed" ) ]
122142 OnlyEd25519AccountsAllowed ,
143+
144+ #[ error( transparent) ]
145+ Fee ( #[ from] fetch:: fee:: Error ) ,
146+
147+ #[ error( transparent) ]
148+ Fetch ( #[ from] fetch:: Error ) ,
123149}
124150
125151impl Cmd {
@@ -282,21 +308,22 @@ impl NetworkRunnable for Cmd {
282308
283309 print. infoln ( "Simulating deploy transaction…" ) ;
284310
285- let txn =
311+ let assembled =
286312 simulate_and_assemble_transaction ( & client, & txn, self . fee . resource_config ( ) ) . await ?;
287- let txn = Box :: new ( self . fee . apply_to_assembled_txn ( txn) . transaction ( ) . clone ( ) ) ;
313+ let assembled = self . fee . apply_to_assembled_txn ( assembled) ;
314+
315+ let txn = Box :: new ( assembled. transaction ( ) . clone ( ) ) ;
288316
289317 print. log_transaction ( & txn, & network, true ) ?;
290318 let signed_txn = & config. sign ( * txn) . await ?;
291319 print. globeln ( "Submitting deploy transaction…" ) ;
292320
293- let get_txn_resp = client
294- . send_transaction_polling ( signed_txn)
295- . await ?
296- . try_into ( ) ?;
321+ let get_txn_resp = client. send_transaction_polling ( signed_txn) . await ?;
322+
323+ self . fee . print_cost_info ( & get_txn_resp) ?;
297324
298325 if global_args. is_none_or ( |a| !a. no_cache ) {
299- data:: write ( get_txn_resp, & network. rpc_uri ( ) ?) ?;
326+ data:: write ( get_txn_resp. clone ( ) . try_into ( ) ? , & network. rpc_uri ( ) ?) ?;
300327 }
301328
302329 if let Some ( url) = utils:: explorer_url_for_contract ( & network, & contract_id) {
0 commit comments