Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getProvider() {
const rpcUrl = this.web3.eth.net.currentProvider.host
const provider = ZeroClientProvider({
rpcUrl,
getAccounts: this.getAccounts.bind(this),
processTransaction: this.processTransaction.bind(this)
})
// Disable transaction validation, which interferes with our work.
const hookedWallet = provider._providers[6]
if (!hookedWallet.validateTransaction) {
console.error('The sub provider at [6] is NOT a hooked wallet.')
} else {
// Pass through validate for now
hookedWallet.validateTransaction = (_, cb) => {
cb()
}
}
getProvider() {
const rpcUrl = this.web3.eth.net.currentProvider.host
const provider = ZeroClientProvider({
rpcUrl,
getAccounts: this.getAccounts.bind(this),
processTransaction: this.processTransaction.bind(this)
})
// Disable transaction validation, which interferes with our work.
const hookedWallet = provider._providers[6]
if (!hookedWallet.validateTransaction) {
console.error('The sub provider at [6] is NOT a hooked wallet.')
} else {
// Pass through validate for now
hookedWallet.validateTransaction = (_, cb) => {
cb()
}
}
getProvider() {
const rpcUrl = this.web3.eth.net.currentProvider.host
const provider = ZeroClientProvider({
rpcUrl,
getAccounts: this.getAccounts.bind(this),
processTransaction: this.processTransaction.bind(this)
})
// Disable transaction validation, which interferes with our work.
const hookedWallet = provider._providers[6]
if (!hookedWallet.validateTransaction) {
console.error('The sub provider at [6] is NOT a hooked wallet.')
} else {
// Pass through validate for now
hookedWallet.validateTransaction = (_, cb) => {
cb()
}
}
export default options => {
const engine = new ZeroClientProvider(options);
const cleanserSubprovider = new CleanserSubProvider();
// insert cleanserSubprovider as 1st provider
cleanserSubprovider.setEngine(engine); // set engine b/c we monkey patch this provider. typically called in engine.start()
engine._providers.splice(0, 0, cleanserSubprovider);
// gasPrice
const gasPriceProvider = new GasPriceProvider();
gasPriceProvider.setEngine(engine); // set engine b/c we monkey patch this provider. typically called in engine.start()
engine._providers.splice(7, 0, gasPriceProvider);
// gasPrice
if (REACT_APP_ENVIRONMENT === 'localhost') {
const gasEstimateProvider = new GanacheGasEstimatorProvider();
gasEstimateProvider.setEngine(engine); // set engine b/c we monkey patch this provider. typically called in engine.start()
engine._providers.splice(9, 0, gasEstimateProvider);
getProvider() {
const rpcUrl = this.web3.eth.net.currentProvider.host
const provider = ZeroClientProvider({
rpcUrl,
getAccounts: this.getAccounts.bind(this),
processTransaction: this.processTransaction.bind(this),
signMessage: this.signMessage.bind(this),
signPersonalMessage: this.signPersonalMessage.bind(this)
})
// Disable caching subProviders, because they interfere with the provider
// we're returning.
const providersToRemove = [
'BlockCacheSubprovider',
'InflightCacheSubprovider'
]
provider._providers = provider._providers.filter(
provider => !providersToRemove.includes(provider.constructor.name)
)
getProvider() {
const provider = ZeroClientProvider({
rpcUrl:
this.networkRpcUrl && this.linked
? this.networkRpcUrl
: this.web3.currentProvider.host,
getAccounts: this.getAccounts.bind(this),
//signTransaction: this.signTransaction.bind(this),
//signPersonalMessage: this.signPersonalMessage.bind(this),
processTransaction: this.processTransaction.bind(this)
})
const hookedWallet = provider._providers[6]
if (!hookedWallet.validateTransaction) {
console.log('The sub provider at [6] is NOT a hooked wallet.')
} else {
//we basically make validate a passthrough for now
hookedWallet.validateTransaction = (txParams, cb) => {
getProvider() {
const provider = ZeroClientProvider({
rpcUrl:
this.networkRpcUrl && this.linked
? this.networkRpcUrl
: this.web3.currentProvider.host,
getAccounts: this.getAccounts.bind(this),
//signTransaction: this.signTransaction.bind(this),
//signPersonalMessage: this.signPersonalMessage.bind(this),
processTransaction: this.processTransaction.bind(this)
})
const hookedWallet = provider._providers[6]
if (!hookedWallet.validateTransaction) {
console.log('The sub provider at [6] is NOT a hooked wallet.')
} else {
//we basically make validate a passthrough for now
hookedWallet.validateTransaction = (txParams, cb) => {