Skip to content

Commit

Permalink
Fix pendingTx is none (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
wakiyamap authored Jan 17, 2025
1 parent 806aa3e commit 43ec3dc
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/services/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,21 @@ pub async fn handle_contract_call<S: ToString>(
tx_name.to_string(),
pending_tx.tx_hash()
));
let tx_receipt = pending_tx.await?.unwrap();
ensure!(
tx_receipt.status.unwrap() == 1.into(),
"{} tx failed",
from_name.to_string()
);
return Ok(tx_receipt.transaction_hash);
match pending_tx.await? {
Some(tx_receipt) => {
ensure!(
tx_receipt.status.unwrap() == 1.into(),
"{} tx failed",
from_name.to_string()
);
return Ok(tx_receipt.transaction_hash);
}
None => {
return Err(anyhow::anyhow!(
"Transaction receipt is None. The transaction may not have been mined."
));
}
}
}
Err(e) => {
let error_message = e.to_string();
Expand Down

0 comments on commit 43ec3dc

Please sign in to comment.