File tree Expand file tree Collapse file tree 2 files changed +19
-17
lines changed Expand file tree Collapse file tree 2 files changed +19
-17
lines changed Original file line number Diff line number Diff line change 11[package ]
22name = " fortuna"
3- version = " 3.2.1 "
3+ version = " 3.2.2 "
44edition = " 2021"
55
66[dependencies ]
Original file line number Diff line number Diff line change 88 state:: PebbleHashChain ,
99 } ,
1010 anyhow:: Result ,
11- ethers:: signers:: {
12- LocalWallet ,
13- Signer ,
11+ ethers:: {
12+ signers:: {
13+ LocalWallet ,
14+ Signer ,
15+ } ,
16+ types:: U256 ,
1417 } ,
1518 std:: sync:: Arc ,
1619} ;
@@ -52,19 +55,18 @@ pub async fn register_provider(opts: &RegisterProviderOptions) -> Result<()> {
5255 seed : random,
5356 chain_length : commitment_length,
5457 } ;
55-
56- if let Some ( r) = contract
57- . register (
58- fee_in_wei,
59- commitment,
60- bincode:: serialize ( & commitment_metadata) ?. into ( ) ,
61- commitment_length,
62- bincode:: serialize ( & opts. uri ) ?. into ( ) ,
63- )
64- . send ( )
65- . await ?
66- . await ?
67- {
58+ let call = contract. register (
59+ fee_in_wei,
60+ commitment,
61+ bincode:: serialize ( & commitment_metadata) ?. into ( ) ,
62+ commitment_length,
63+ bincode:: serialize ( & opts. uri ) ?. into ( ) ,
64+ ) ;
65+ let mut gas_estimate = call. estimate_gas ( ) . await ?;
66+ let gas_multiplier = U256 :: from ( 2 ) ; //TODO: smarter gas estimation
67+ gas_estimate = gas_estimate * gas_multiplier;
68+ let call_with_gas = call. gas ( gas_estimate) ;
69+ if let Some ( r) = call_with_gas. send ( ) . await ?. await ? {
6870 tracing:: info!( "Registered provider: {:?}" , r) ;
6971 }
7072
You can’t perform that action at this time.
0 commit comments