You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.5 KiB
52 lines
1.5 KiB
9 years ago
|
'use strict'
|
||
|
var init = require('../init')
|
||
|
var web3Override = {}
|
||
8 years ago
|
web3Override.eth = {}
|
||
|
web3Override.debug = {}
|
||
9 years ago
|
var data = init.readFile(require('path').resolve(__dirname, 'testWeb3.json'))
|
||
7 years ago
|
data = JSON.parse(data)
|
||
9 years ago
|
|
||
8 years ago
|
web3Override.eth.getCode = function (address, callback) {
|
||
9 years ago
|
if (callback) {
|
||
|
callback(null, data.testCodes[address])
|
||
|
} else {
|
||
|
return data.testCodes[address]
|
||
|
}
|
||
|
}
|
||
9 years ago
|
|
||
8 years ago
|
web3Override.debug.traceTransaction = function (txHash, options, callback) {
|
||
9 years ago
|
callback(null, data.testTraces[txHash])
|
||
|
}
|
||
9 years ago
|
|
||
8 years ago
|
web3Override.debug.storageRangeAt = function (blockNumber, txIndex, address, start, maxSize, callback) {
|
||
8 years ago
|
callback(null, { storage: {}, complete: true })
|
||
9 years ago
|
}
|
||
9 years ago
|
|
||
8 years ago
|
web3Override.eth.getTransaction = function (txHash, callback) {
|
||
9 years ago
|
if (callback) {
|
||
|
callback(null, data.testTxs[txHash])
|
||
|
} else {
|
||
|
return data.testTxs[txHash]
|
||
|
}
|
||
|
}
|
||
9 years ago
|
|
||
8 years ago
|
web3Override.eth.getTransactionFromBlock = function (blockNumber, txIndex, callback) {
|
||
9 years ago
|
if (callback) {
|
||
|
callback(null, data.testTxsByBlock[blockNumber + '-' + txIndex])
|
||
|
} else {
|
||
|
return data.testTxsByBlock[blockNumber + '-' + txIndex]
|
||
|
}
|
||
9 years ago
|
}
|
||
|
|
||
8 years ago
|
web3Override.eth.getBlockNumber = function (callback) { callback('web3 modified testing purposes :)') }
|
||
|
|
||
|
web3Override.eth.setProvider = function (provider) {}
|
||
|
|
||
|
web3Override.eth.providers = { 'HttpProvider': function (url) {} }
|
||
|
|
||
|
web3Override.eth.currentProvider = {'host': 'test provider'}
|
||
9 years ago
|
|
||
|
if (typeof (module) !== 'undefined' && typeof (module.exports) !== 'undefined') {
|
||
|
module.exports = web3Override
|
||
9 years ago
|
}
|