mirror of
https://github.com/logos-storage/nim-ethers.git
synced 2026-01-12 10:33:07 +00:00
debug logging
This commit is contained in:
parent
458e969397
commit
45959cf608
@ -14,6 +14,9 @@ export basics
|
||||
export provider
|
||||
export events
|
||||
|
||||
logScope:
|
||||
topics = "ethers contract"
|
||||
|
||||
type
|
||||
Contract* = ref object of RootObj
|
||||
provider: Provider
|
||||
@ -256,6 +259,7 @@ proc confirm*(tx: Future[?TransactionResponse],
|
||||
let receipt = await response.confirm(confirmations, timeout)
|
||||
|
||||
if receipt.status != TransactionStatus.Success:
|
||||
echo "[ethers contract] transaction failed, status: ", receipt.status
|
||||
trace "transaction failed", status = receipt.status
|
||||
without blockNumber =? receipt.blockNumber:
|
||||
raiseContractError "Transaction reverted with unknown reason"
|
||||
@ -265,10 +269,13 @@ proc confirm*(tx: Future[?TransactionResponse],
|
||||
raiseContractError "Transaction reverted with unknown reason"
|
||||
|
||||
try:
|
||||
echo "[ethers contract] replaying transaction to get revert reason"
|
||||
trace "replaying transaction to get revert reason"
|
||||
await provider.replay(transaction, blockNumber)
|
||||
echo "transaction replay completed, no revert reason obtained"
|
||||
trace "transaction replay completed, no revert reason obtained"
|
||||
except ProviderError as e:
|
||||
echo "transaction revert reason obtained, reason: ", e.msg
|
||||
trace "transaction revert reason obtained", reason = e.msg
|
||||
# should contain the revert reason
|
||||
raiseContractError e.msg
|
||||
|
||||
@ -19,6 +19,9 @@ export chronicles
|
||||
|
||||
push: {.upraises: [].}
|
||||
|
||||
logScope:
|
||||
topics = "ethers jsonrpc"
|
||||
|
||||
type
|
||||
JsonRpcProvider* = ref object of Provider
|
||||
client: Future[RpcClient]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user