diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2019-02-05 19:26:58 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-05 19:26:58 +0800 |
commit | 4b4bfee1bcff72aa9a1501d7a14ecf0cd8fe4e32 (patch) | |
tree | adb8287e80568d44dcfa4cdb109ce490bdc7bce9 /packages | |
parent | 09a5b6e7a3cc595249d8dac83b5a7e3fed9d7667 (diff) | |
parent | 3d2ed57c08c7e58ecc6698c87a42bafbe86a9c88 (diff) | |
download | dexon-0x-contracts-4b4bfee1bcff72aa9a1501d7a14ecf0cd8fe4e32.tar.gz dexon-0x-contracts-4b4bfee1bcff72aa9a1501d7a14ecf0cd8fe4e32.tar.zst dexon-0x-contracts-4b4bfee1bcff72aa9a1501d7a14ecf0cd8fe4e32.zip |
Merge pull request #1584 from reserve-protocol/patch
Hook eth_sendRawTransaction in addition to eth_sendTransaction
Diffstat (limited to 'packages')
-rw-r--r-- | packages/sol-tracing-utils/package.json | 1 | ||||
-rw-r--r-- | packages/sol-tracing-utils/src/trace_collection_subprovider.ts | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/packages/sol-tracing-utils/package.json b/packages/sol-tracing-utils/package.json index df800976c..0cd0858d4 100644 --- a/packages/sol-tracing-utils/package.json +++ b/packages/sol-tracing-utils/package.json @@ -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", diff --git a/packages/sol-tracing-utils/src/trace_collection_subprovider.ts b/packages/sol-tracing-utils/src/trace_collection_subprovider.ts index 8279bda54..99f32335c 100644 --- a/packages/sol-tracing-utils/src/trace_collection_subprovider.ts +++ b/packages/sol-tracing-utils/src/trace_collection_subprovider.ts @@ -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'; @@ -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(); |