Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Commit

Permalink
Merge pull request #1584 from reserve-protocol/patch
Browse files Browse the repository at this point in the history
Hook eth_sendRawTransaction in addition to eth_sendTransaction
  • Loading branch information
LogvinovLeon authored Feb 5, 2019
2 parents 09a5b6e + 3d2ed57 commit 4b4bfee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/sol-tracing-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"@types/solidity-parser-antlr": "^0.2.0",
"ethereum-types": "^1.1.6",
"ethereumjs-util": "^5.1.1",
"ethers": "~4.0.4",
"glob": "^7.1.2",
"chalk": "^2.3.0",
"istanbul": "^0.4.5",
Expand Down
13 changes: 13 additions & 0 deletions packages/sol-tracing-utils/src/trace_collection_subprovider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Callback, ErrorCallback, NextCallback, Subprovider } from '@0x/subprovi
import { logUtils } from '@0x/utils';
import { CallDataRPC, marshaller, Web3Wrapper } from '@0x/web3-wrapper';
import { JSONRPCRequestPayload, Provider, TxData } from 'ethereum-types';
import { utils } from 'ethers';
import * as _ from 'lodash';
import { Lock } from 'semaphore-async-await';

Expand Down Expand Up @@ -96,6 +97,18 @@ export abstract class TraceCollectionSubprovider extends Subprovider {
}
return;

case 'eth_sendRawTransaction':
if (!this._config.shouldCollectTransactionTraces) {
next();
} else {
const txData = utils.parseTransaction(payload.params[0]);
if (txData.to === null) {
txData.to = constants.NEW_CONTRACT;
}
next(logAsyncErrors(this._onTransactionSentAsync.bind(this, txData)));
}
return;

case 'eth_call':
if (!this._config.shouldCollectCallTraces) {
next();
Expand Down

0 comments on commit 4b4bfee

Please sign in to comment.