parent
732c21efd9
commit
08f19ed20c
@ -1,38 +0,0 @@ |
||||
'use strict' |
||||
var traceHelper = require('../src/helpers/traceHelper') |
||||
var traceInvokation = require('./resources/contractInvokationTrace') |
||||
|
||||
function TestTraceRetriever () { |
||||
this.storages = {} // contains all intial storage (by addresses)
|
||||
} |
||||
|
||||
TestTraceRetriever.prototype.getTrace = function (txHash, callback) { |
||||
console.log(traceInvokation) |
||||
callback(null, traceInvokation) |
||||
} |
||||
|
||||
/* not used */ |
||||
TestTraceRetriever.prototype.getStorage = function (tx, address, callback) { |
||||
if (traceHelper.isContractCreation(address)) { |
||||
callback(null, {}) |
||||
} else if (this.storages[address]) { |
||||
callback(null, this.storages[address]) |
||||
} else { |
||||
/* |
||||
return storage |
||||
*/ |
||||
/* |
||||
var self = this |
||||
this.web3.debug.storageAt(tx.blockNumber.toString(), tx.transactionIndex, address, function (error, result) { |
||||
self.storages[address] = result |
||||
callback(error, result) |
||||
}) |
||||
*/ |
||||
} |
||||
} |
||||
|
||||
TestTraceRetriever.prototype.debugStorageAtAvailable = function () { |
||||
return false // test scenario does not require web3.
|
||||
} |
||||
|
||||
module.exports = TestTraceRetriever |
@ -0,0 +1,12 @@ |
||||
var init = { |
||||
overrideWeb3: function (web3, web3Override) { |
||||
web3.eth.getCode = web3Override.getCode |
||||
web3.debug.traceTransaction = web3Override.traceTransaction |
||||
web3.debug.storageAt = web3Override.storageAt |
||||
web3.eth.getTransaction = web3Override.getTransaction |
||||
web3.eth.getTransactionFromBlock = web3Override.getTransactionFromBlock |
||||
web3.eth.getBlockNumber = web3Override.getBlockNumber |
||||
} |
||||
} |
||||
|
||||
module.exports = init |
Loading…
Reference in new issue