@@ -84,38 +84,17 @@ where
84
84
}
85
85
}
86
86
87
- impl < E , Args > CallParams < E , Args , ( ) >
88
- where
89
- E : Environment ,
90
- Args : scale:: Encode ,
91
- {
92
- /// Invokes the contract with the given built-up call parameters.
93
- ///
94
- /// # Note
95
- ///
96
- /// Prefer [`invoke`](`Self::invoke`) over [`eval`](`Self::eval`) if the
97
- /// called contract message does not return anything because it is more efficient.
98
- pub fn invoke ( & self ) -> Result < ( ) , crate :: Error > {
99
- crate :: invoke_contract ( self )
100
- }
101
- }
102
-
103
- impl < E , Args , R > CallParams < E , Args , ReturnType < R > >
87
+ impl < E , Args , R > CallParams < E , Args , R >
104
88
where
105
89
E : Environment ,
106
90
Args : scale:: Encode ,
107
91
R : scale:: Decode ,
108
92
{
109
- /// Evaluates the contract with the given built-up call parameters.
93
+ /// Invokes the contract with the given built-up call parameters.
110
94
///
111
95
/// Returns the result of the contract execution.
112
- ///
113
- /// # Note
114
- ///
115
- /// Prefer [`invoke`](`Self::invoke`) over [`eval`](`Self::eval`) if the
116
- /// called contract message does not return anything because it is more efficient.
117
- pub fn eval ( & self ) -> Result < R , crate :: Error > {
118
- crate :: eval_contract ( self )
96
+ pub fn invoke ( & self ) -> Result < R , crate :: Error > {
97
+ crate :: invoke_contract ( self )
119
98
}
120
99
}
121
100
@@ -179,7 +158,7 @@ where
179
158
/// # use ::ink_env::{
180
159
/// # Environment,
181
160
/// # DefaultEnvironment,
182
- /// # call::{build_call, Selector, ExecutionInput, utils::ReturnType },
161
+ /// # call::{build_call, Selector, ExecutionInput},
183
162
/// # };
184
163
/// # type AccountId = <DefaultEnvironment as Environment>::AccountId;
185
164
/// let my_return_value: i32 = build_call::<DefaultEnvironment>()
@@ -192,7 +171,7 @@ where
192
171
/// .push_arg(true)
193
172
/// .push_arg(&[0x10; 32])
194
173
/// )
195
- /// .returns::<ReturnType< i32> >()
174
+ /// .returns::<i32>()
196
175
/// .fire()
197
176
/// .unwrap();
198
177
/// ```
@@ -328,18 +307,6 @@ where
328
307
}
329
308
}
330
309
331
- mod seal {
332
- /// Used to prevent users from implementing `IndicateReturnType` for their own types.
333
- pub trait Sealed { }
334
- impl Sealed for ( ) { }
335
- impl < T > Sealed for super :: ReturnType < T > { }
336
- }
337
-
338
- /// Types that can be used in [`CallBuilder::returns`] to signal return type.
339
- pub trait IndicateReturnType : Default + self :: seal:: Sealed { }
340
- impl IndicateReturnType for ( ) { }
341
- impl < T > IndicateReturnType for ReturnType < T > { }
342
-
343
310
impl < E , Callee , GasLimit , TransferredValue , Args >
344
311
CallBuilder < E , Callee , GasLimit , TransferredValue , Args , Unset < ReturnType < ( ) > > >
345
312
where
@@ -350,14 +317,11 @@ where
350
317
/// # Note
351
318
///
352
319
/// Either use `.returns::<()>` to signal that the call does not return a value
353
- /// or use `.returns::<ReturnType<T>>` to signal that the call returns a value of
354
- /// type `T`.
320
+ /// or use `.returns::<T>` to signal that the call returns a value of type `T`.
355
321
#[ inline]
356
322
pub fn returns < R > (
357
323
self ,
358
- ) -> CallBuilder < E , Callee , GasLimit , TransferredValue , Args , Set < R > >
359
- where
360
- R : IndicateReturnType ,
324
+ ) -> CallBuilder < E , Callee , GasLimit , TransferredValue , Args , Set < ReturnType < R > > >
361
325
{
362
326
CallBuilder {
363
327
env : Default :: default ( ) ,
@@ -414,7 +378,7 @@ impl<E, GasLimit, TransferredValue, Args, RetType>
414
378
GasLimit ,
415
379
TransferredValue ,
416
380
Set < ExecutionInput < Args > > ,
417
- Set < RetType > ,
381
+ Set < ReturnType < RetType > > ,
418
382
>
419
383
where
420
384
E : Environment ,
@@ -465,27 +429,6 @@ where
465
429
}
466
430
}
467
431
468
- impl < E , GasLimit , TransferredValue , Args >
469
- CallBuilder <
470
- E ,
471
- Set < E :: AccountId > ,
472
- GasLimit ,
473
- TransferredValue ,
474
- Set < ExecutionInput < Args > > ,
475
- Set < ( ) > ,
476
- >
477
- where
478
- E : Environment ,
479
- GasLimit : Unwrap < Output = u64 > ,
480
- Args : scale:: Encode ,
481
- TransferredValue : Unwrap < Output = E :: Balance > ,
482
- {
483
- /// Invokes the cross-chain function call.
484
- pub fn fire ( self ) -> Result < ( ) , Error > {
485
- self . params ( ) . invoke ( )
486
- }
487
- }
488
-
489
432
impl < E , GasLimit , TransferredValue >
490
433
CallBuilder <
491
434
E ,
@@ -524,6 +467,6 @@ where
524
467
{
525
468
/// Invokes the cross-chain function call and returns the result.
526
469
pub fn fire ( self ) -> Result < R , Error > {
527
- self . params ( ) . eval ( )
470
+ self . params ( ) . invoke ( )
528
471
}
529
472
}
0 commit comments