@@ -56,24 +56,24 @@ async fn main() -> Result<()> {
5656 let data: Vec < u8 > = FromHex :: from_hex ( contract_bytecode) ?;
5757 let tx = TransactionRequest :: default ( ) . with_deploy_code ( data) ;
5858
59- let deploy_result = provider. send_transaction ( tx) . await ?. get_receipt ( ) . await ?;
59+ // Deploy the contract.
60+ let receipt = provider. send_transaction ( tx) . await ?. get_receipt ( ) . await ?;
6061
61- let contract_address =
62- deploy_result. contract_address ( ) . expect ( "Failed to get contract address" ) ;
62+ let contract_address = receipt. contract_address ( ) . expect ( "Failed to get contract address" ) ;
6363 let contract = Counter :: new ( contract_address, & provider) ;
6464 println ! ( "Deployed contract at address: {}" , contract. address( ) ) ;
6565
6666 // Set number
6767 let builder = contract. setNumber ( U256 :: from ( 42 ) ) ;
68- let receipt = builder. send ( ) . await ?. get_receipt ( ) . await ?;
68+ let tx_hash = builder. send ( ) . await ?. watch ( ) . await ?;
6969
70- println ! ( "Set number to 42: {}" , receipt . transaction_hash ) ;
70+ println ! ( "Set number to 42: {}" , tx_hash ) ;
7171
7272 // Increment the number to 43.
7373 let builder = contract. increment ( ) ;
74- let receipt = builder. send ( ) . await ?. get_receipt ( ) . await ?;
74+ let tx_hash = builder. send ( ) . await ?. watch ( ) . await ?;
7575
76- println ! ( "Incremented number: {}" , receipt . transaction_hash ) ;
76+ println ! ( "Incremented number: {}" , tx_hash ) ;
7777
7878 // Retrieve the number, which should be 43.
7979 let Counter :: numberReturn { _0 } = contract. number ( ) . call ( ) . await ?;
0 commit comments