Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
} = {
maxConcurrency: Number.MAX_SAFE_INTEGER,
},
) {
this.maxConcurrency = maxConcurrency;
this.logger = logger || new Utils.SimpleLogger();
this.maxRetries = maxRetries;
this.retryDelay = retryDelay;
web3Connection = web3Connection || {};
try {
this.eth = new web3Eth(
web3Connection.web3Provider ||
new web3Eth.providers.HttpProvider(config.getDefaultEthereumProvider()),
);
} catch (error) {
throw Error(`Can't initialize web3-eth ${error}`);
}
// Checks if networkId is defined
// If not defined we use default value from config
this.networkName =
typeof web3Connection.networkId === 'undefined'
? config.getDefaultEthereumNetwork()
: EthereumUtils.getEthereumNetworkNameFromId(web3Connection.networkId);
// If networkName is undefined, it means the network doesn't exist
if (typeof this.networkName === 'undefined') {
throw Error(`The network id ${web3Connection.networkId} doesn't exist`);
}
import * as fs from 'fs';
import * as path from 'path';
import * as Eth from 'web3-eth';
// Websocket could be the problem
// HTTP is faster, but same error
const eth = new Eth(new Eth.providers.HttpProvider('http://localhost:8545'));
const rawABI = fs.readFileSync(
path.join(process.cwd(), 'out', 'factory', 'FundFactory.abi'),
{ encoding: 'utf-8' },
);
const ABI = JSON.parse(rawABI);
const fundFactoryAddress = '0x801cd3BCa02ffB46Ee5cf43B023Aa3619089d16b';
const contract = new eth.Contract(ABI, fundFactoryAddress);
const args = [
['0x9a8D6f20b917eA9542EEE886c78fE41C638A3d45'],
[],
['0x4b1a08B5DBcf3386f22DB1d694beF84d8EF4B340'],
[
'0xc0dd7a9D5470216eaf97DD2CEcAc259da1f7Af2E',
'0x2B83156799AB55F5581263Cd544372B9af2c2Cfe',
const makeHttpProvider = endpoint =>
new web3Eth.providers.HttpProvider(endpoint);
const makeIpcProvider = endpoint => new web3Eth.providers.IpcProvider(endpoint);
const makeWsProvider = endpoint =>
new web3Eth.providers.WebsocketProvider(endpoint);