commit
a45c1254b6
@ -1,55 +0,0 @@ |
|||||||
export class DummyProvider { |
|
||||||
eth |
|
||||||
debug |
|
||||||
providers |
|
||||||
currentProvider |
|
||||||
|
|
||||||
constructor () { |
|
||||||
this.eth = {} |
|
||||||
this.debug = {} |
|
||||||
this.eth.getCode = (address, cb) => { return this.getCode(address, cb) } |
|
||||||
this.eth.getTransaction = (hash, cb) => { return this.getTransaction(hash, cb) } |
|
||||||
this.eth.getTransactionFromBlock = (blockNumber, txIndex, cb) => { return this.getTransactionFromBlock(blockNumber, txIndex, cb) } |
|
||||||
this.eth.getBlockNumber = (cb) => { return this.getBlockNumber(cb) } |
|
||||||
this.debug.traceTransaction = (hash, options, cb) => { return this.traceTransaction(hash, options, cb) } |
|
||||||
this.debug.storageRangeAt = (blockNumber, txIndex, address, start, end, maxLength, cb) => { return this.storageRangeAt(blockNumber, txIndex, address, start, end, maxLength, cb) } |
|
||||||
this.providers = { HttpProvider: function (url) {} } |
|
||||||
this.currentProvider = { host: '' } |
|
||||||
} |
|
||||||
|
|
||||||
getCode (address, cb) { |
|
||||||
cb(null, '') |
|
||||||
} |
|
||||||
|
|
||||||
setProvider (provider) {} |
|
||||||
|
|
||||||
traceTransaction (txHash, options, cb) { |
|
||||||
if (cb) { |
|
||||||
cb(null, {}) |
|
||||||
} |
|
||||||
return {} |
|
||||||
} |
|
||||||
|
|
||||||
storageRangeAt (blockNumber, txIndex, address, start, end, maxLength, cb) { |
|
||||||
if (cb) { |
|
||||||
cb(null, {}) |
|
||||||
} |
|
||||||
return {} |
|
||||||
} |
|
||||||
|
|
||||||
getBlockNumber (cb) { cb(null, '') } |
|
||||||
|
|
||||||
getTransaction (txHash, cb) { |
|
||||||
if (cb) { |
|
||||||
cb(null, {}) |
|
||||||
} |
|
||||||
return {} |
|
||||||
} |
|
||||||
|
|
||||||
getTransactionFromBlock (blockNumber, txIndex, cb) { |
|
||||||
if (cb) { |
|
||||||
cb(null, {}) |
|
||||||
} |
|
||||||
return {} |
|
||||||
} |
|
||||||
} |
|
@ -1,38 +0,0 @@ |
|||||||
import { Web3VmProvider } from './web3VmProvider' |
|
||||||
import { loadWeb3, extendWeb3 } from '../init' |
|
||||||
|
|
||||||
export class Web3Providers { |
|
||||||
modes |
|
||||||
constructor () { |
|
||||||
this.modes = {} |
|
||||||
} |
|
||||||
|
|
||||||
addProvider (type, obj) { |
|
||||||
if (type === 'INTERNAL') { |
|
||||||
const web3 = loadWeb3() |
|
||||||
this.addWeb3(type, web3) |
|
||||||
} else if (type === 'vm') { |
|
||||||
this.addVM(type, obj) |
|
||||||
} else { |
|
||||||
extendWeb3(obj) |
|
||||||
this.addWeb3(type, obj) |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
get (type, cb) { |
|
||||||
if (this.modes[type]) { |
|
||||||
return cb(null, this.modes[type]) |
|
||||||
} |
|
||||||
cb('error: this provider has not been setup (' + type + ')', null) |
|
||||||
} |
|
||||||
|
|
||||||
addWeb3 (type, web3) { |
|
||||||
this.modes[type] = web3 |
|
||||||
} |
|
||||||
|
|
||||||
addVM (type, vm) { |
|
||||||
const vmProvider = new Web3VmProvider() |
|
||||||
vmProvider.setVM(vm) |
|
||||||
this.modes[type] = vmProvider |
|
||||||
} |
|
||||||
} |
|
Loading…
Reference in new issue