@@ -39,7 +39,7 @@ pub mod internal {
3939 // any `TestContract` frame in progress and then _panics_, unwinding back to
4040 // a panic-catcher it installed when invoking the `TestContract` frame, and
4141 // then extracting E from the frame and returning it to its caller. This
42- // simulates the "crash, but catching the error" behaviour of the WASM case.
42+ // simulates the "crash, but catching the error" behavior of the WASM case.
4343 // This only works if we panic via `escalate_error_to_panic`.
4444 //
4545 // (The reason we don't just panic_any() here and let the panic-catcher do a
@@ -725,7 +725,7 @@ impl Env {
725725 /// Take the return value with a grain of salt. The returned resources mostly
726726 /// correspond only to the operations that have happened during the host
727727 /// invocation, i.e. this won't try to simulate the work that happens in
728- /// production scenarios (e.g. certain XDR rountrips ). This also doesn't try
728+ /// production scenarios (e.g. certain XDR roundtrips ). This also doesn't try
729729 /// to model resources related to the transaction size.
730730 ///
731731 /// The returned value is as useful as the preceding setup, e.g. if a test
@@ -749,7 +749,7 @@ impl Env {
749749 ///
750750 /// Pass the arguments for the contract's constructor, or `()` if none. For
751751 /// contracts with a constructor, use the contract's generated `Args` type
752- /// to construct the arguments with the appropropriate types for invoking
752+ /// to construct the arguments with the appropriate types for invoking
753753 /// the constructor during registration.
754754 ///
755755 /// Returns the address of the registered contract that is the same as the
@@ -1120,15 +1120,15 @@ impl Env {
11201120 self . env_impl
11211121 . switch_to_recording_auth_inherited_from_snapshot ( & prev_auth_manager)
11221122 . unwrap ( ) ;
1123- self . invoke_contract :: < ( ) > (
1123+ let admin_result = self . try_invoke_contract :: < ( ) , Error > (
11241124 & token_id,
11251125 & soroban_sdk_macros:: internal_symbol_short!( "set_admin" ) ,
11261126 ( admin, ) . try_into_val ( self ) . unwrap ( ) ,
11271127 ) ;
11281128 self . env_impl . set_auth_manager ( prev_auth_manager) . unwrap ( ) ;
1129+ admin_result. unwrap ( ) . unwrap ( ) ;
11291130
11301131 let issuer = StellarAssetIssuer :: new ( self . clone ( ) , issuer_id) ;
1131-
11321132 StellarAssetContract :: new ( token_id, issuer, asset)
11331133 }
11341134
@@ -1167,13 +1167,14 @@ impl Env {
11671167 executable : xdr:: ContractExecutable ,
11681168 constructor_args : Vec < Val > ,
11691169 ) -> Address {
1170+ let args_vec: std:: vec:: Vec < xdr:: ScVal > =
1171+ constructor_args. iter ( ) . map ( |v| v. into_val ( self ) ) . collect ( ) ;
1172+ let constructor_args = args_vec. try_into ( ) . unwrap ( ) ;
11701173 let prev_auth_manager = self . env_impl . snapshot_auth_manager ( ) . unwrap ( ) ;
11711174 self . env_impl
11721175 . switch_to_recording_auth_inherited_from_snapshot ( & prev_auth_manager)
11731176 . unwrap ( ) ;
1174- let args_vec: std:: vec:: Vec < xdr:: ScVal > =
1175- constructor_args. iter ( ) . map ( |v| v. into_val ( self ) ) . collect ( ) ;
1176- let contract_id: Address = self
1177+ let create_result = self
11771178 . env_impl
11781179 . invoke_function ( xdr:: HostFunction :: CreateContractV2 (
11791180 xdr:: CreateContractArgsV2 {
@@ -1186,16 +1187,13 @@ impl Env {
11861187 } ,
11871188 ) ,
11881189 executable,
1189- constructor_args : args_vec . try_into ( ) . unwrap ( ) ,
1190+ constructor_args,
11901191 } ,
1191- ) )
1192- . unwrap ( )
1193- . try_into_val ( self )
1194- . unwrap ( ) ;
1192+ ) ) ;
11951193
11961194 self . env_impl . set_auth_manager ( prev_auth_manager) . unwrap ( ) ;
11971195
1198- contract_id
1196+ create_result . unwrap ( ) . try_into_val ( self ) . unwrap ( )
11991197 }
12001198
12011199 /// Set authorizations and signatures in the environment which will be
@@ -1555,7 +1553,7 @@ impl Env {
15551553 /// # fn main() {
15561554 /// let e: Env = Default::default();
15571555 /// let account_contract = NoopAccountContractClient::new(&e, &e.register(NoopAccountContract, ()));
1558- /// // Non-succesful call of `__check_auth` with a `contracterror` error.
1556+ /// // Non-successful call of `__check_auth` with a `contracterror` error.
15591557 /// assert_eq!(
15601558 /// e.try_invoke_contract_check_auth::<NoopAccountError>(
15611559 /// &account_contract.address,
0 commit comments