Skip to content

Commit

Permalink
🪛 Add eth_sendTransaction calls to call history (#715)
Browse files Browse the repository at this point in the history
  • Loading branch information
yivlad authored Apr 27, 2022
1 parent 51e05d8 commit 671f139
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/tame-walls-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ethereum-waffle/provider": patch
---

Include eth_sendTransaction when recording call history
7 changes: 4 additions & 3 deletions waffle-provider/src/CallHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,13 @@ export class CallHistory {
/**
* A method can be:
* - `eth_call` - a query to the node,
* - `eth_sendRawTransaction` - a transaction,
* - `eth_sendRawTransaction` - a raw transaction,
* - `eth_sendTransaction` - a transaction,
* - `eth_estimateGas` - gas estimation, typically precedes `eth_sendRawTransaction`.
*/
if (method === 'eth_call') { // Record a query.
if (method === 'eth_call' || method === 'eth_sendTransaction') { // Record a query or a transaction.
callHistory.recordedCalls.push(toRecordedCall(args[0]?.params?.[0]));
} else if (method === 'eth_sendRawTransaction') { // Record a transaction.
} else if (method === 'eth_sendRawTransaction') { // Record a raw transaction.
const parsedTx = parseTransaction(args[0]?.params?.[0]);
callHistory.recordedCalls.push(toRecordedCall(parsedTx));
}
Expand Down

0 comments on commit 671f139

Please sign in to comment.