@@ -116,12 +116,13 @@ where
116116 E : Environment ,
117117 Args : scale:: Encode ,
118118 Salt : AsRef < [ u8 ] > ,
119- R : FromAccountId < E > ,
119+ R : scale:: Decode ,
120+ // R: FromAccountId<E>,
120121{
121122 /// Instantiates the contract and returns its account ID back to the caller.
122123 #[ inline]
123124 pub fn instantiate ( & self ) -> Result < R , crate :: Error > {
124- crate :: instantiate_contract ( self ) . map ( FromAccountId :: from_account_id)
125+ crate :: instantiate_contract ( self ) // .map(FromAccountId::from_account_id)
125126 }
126127}
127128
@@ -135,7 +136,7 @@ where
135136 endowment : Endowment ,
136137 exec_input : Args ,
137138 salt : Salt ,
138- return_type : ReturnType < R > ,
139+ return_type : R ,
139140 _phantom : PhantomData < fn ( ) -> E > ,
140141}
141142
@@ -195,11 +196,12 @@ pub fn build_create<E, R>() -> CreateBuilder<
195196 Unset < E :: Balance > ,
196197 Unset < ExecutionInput < EmptyArgumentList > > ,
197198 Unset < state:: Salt > ,
198- R ,
199+ Unset < ReturnType < R > > ,
199200>
200201where
201202 E : Environment ,
202- R : FromAccountId < E > ,
203+ R : scale:: Decode ,
204+ // R: FromAccountId<E>,
203205{
204206 CreateBuilder {
205207 code_hash : Default :: default ( ) ,
@@ -281,6 +283,34 @@ where
281283 }
282284}
283285
286+ impl < E , CodeHash , GasLimit , Endowment , Args , Salt >
287+ CreateBuilder < E , CodeHash , GasLimit , Endowment , Args , Salt , Unset < ReturnType < ( ) > > >
288+ where
289+ E : Environment ,
290+ {
291+ /// Sets the type of the returned value upon the execution of the call.
292+ ///
293+ /// # Note
294+ ///
295+ /// Either use `.returns::<()>` to signal that the call does not return a value
296+ /// or use `.returns::<T>` to signal that the call returns a value of type `T`.
297+ #[ inline]
298+ pub fn returns < R > (
299+ self ,
300+ ) -> CreateBuilder < E , CodeHash , GasLimit , Endowment , Args , Salt , Set < ReturnType < R > > >
301+ {
302+ CreateBuilder {
303+ code_hash : self . code_hash ,
304+ gas_limit : self . gas_limit ,
305+ endowment : self . endowment ,
306+ exec_input : self . exec_input ,
307+ salt : self . salt ,
308+ return_type : Set ( Default :: default ( ) ) ,
309+ _phantom : Default :: default ( ) ,
310+ }
311+ }
312+ }
313+
284314impl < E , CodeHash , GasLimit , Endowment , Salt , R >
285315 CreateBuilder <
286316 E ,
@@ -347,7 +377,7 @@ impl<E, GasLimit, Args, Salt, R>
347377 Set < E :: Balance > ,
348378 Set < ExecutionInput < Args > > ,
349379 Set < Salt > ,
350- R ,
380+ Set < ReturnType < R > > ,
351381 >
352382where
353383 E : Environment ,
@@ -362,7 +392,7 @@ where
362392 endowment : self . endowment . value ( ) ,
363393 exec_input : self . exec_input . value ( ) ,
364394 salt_bytes : self . salt . value ( ) ,
365- _return_type : self . return_type ,
395+ _return_type : Default :: default ( ) ,
366396 }
367397 }
368398}
@@ -375,14 +405,15 @@ impl<E, GasLimit, Args, Salt, R>
375405 Set < E :: Balance > ,
376406 Set < ExecutionInput < Args > > ,
377407 Set < Salt > ,
378- R ,
408+ Set < ReturnType < R > > ,
379409 >
380410where
381411 E : Environment ,
382412 GasLimit : Unwrap < Output = u64 > ,
383413 Args : scale:: Encode ,
384414 Salt : AsRef < [ u8 ] > ,
385- R : FromAccountId < E > ,
415+ R : scale:: Decode ,
416+ // R: FromAccountId<E>,
386417{
387418 /// Instantiates the contract using the given instantiation parameters.
388419 #[ inline]
0 commit comments