Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
allowUnlimitedContractSize: config.shouldAllowUnlimitedContractSize,
gasLimit: constants.GAS_LIMIT,
logger,
verbose: env.parseBoolean(EnvVars.VerboseGanache),
port: 8545,
network_id: 50,
mnemonic: 'concert load couple harbor equip island argue ramp clarify fence smart topic',
fork: config.fork,
blockTime: config.blockTime,
unlocked_accounts: config.unlocked_accounts,
} as any), // TODO remove any once types are merged in DefinitelyTyped
);
} else {
provider.addProvider(new RPCSubprovider(config.rpcUrl || constants.RPC_URL));
}
providerUtils.startProviderEngine(provider);
return provider;
},
};
(async () => {
for (const rpcUrl of Object.values(networkIdToRpcUrl)) {
const provider = new Web3ProviderEngine();
provider.addProvider(new EmptyWalletSubprovider());
provider.addProvider(new RPCSubprovider(rpcUrl));
providerUtils.startProviderEngine(provider);
await testContractConfigsAsync(provider);
}
})().catch(err => {
logUtils.log(err);
(async () => {
const rpcSubprovider = new RPCSubprovider(args['rpc-url']);
const provider = new Web3ProviderEngine();
provider.addProvider(rpcSubprovider);
providerUtils.startProviderEngine(provider);
const normalizedFromAddress = (args.from as string).toLowerCase();
const txDefaults = {
from: normalizedFromAddress,
};
await runMigrationsAsync(provider, txDefaults);
process.exit(0);
})().catch(err => {
logUtils.log(err);
async getMainnetLedgerProviderAsync(): Promise {
const provider = new Web3ProviderEngine();
const ledgerWalletConfigs = {
networkId: constants.MAINNET_NETWORK_ID,
ledgerEthereumClientFactoryAsync: ledgerEthereumNodeJsClientFactoryAsync,
};
const ledgerSubprovider = new LedgerSubprovider(ledgerWalletConfigs);
provider.addProvider(ledgerSubprovider);
provider.addProvider(new RPCSubprovider(constants.MAINNET_RPC_URL));
providerUtils.startProviderEngine(provider);
return provider;
},
};
const configure = ({ endpoint }) => {
const providerEngine = new Web3ProviderEngine();
providerEngine.addProvider(new RPCSubprovider(endpoint));
providerUtils.startProviderEngine(providerEngine);
wrapper = new Web3Wrapper(providerEngine);
};
const configure = ({ endpoint }) => {
providerEngine = new Web3ProviderEngine();
wrapper = new Web3Wrapper(providerEngine);
providerEngine.addProvider(new RPCSubprovider(endpoint));
providerUtils.startProviderEngine(providerEngine);
};
const determineProvider = (): Web3ProviderEngine => {
const pe = new Web3ProviderEngine();
pe.addProvider(mnemonicWallet);
if (NETWORK_CONFIGS === GANACHE_CONFIGS) {
pe.addProvider(
new GanacheSubprovider({
vmErrorsOnRPCResponse: false,
network_id: GANACHE_CONFIGS.networkId,
mnemonic: MNEMONIC,
}),
);
} else {
pe.addProvider(new RPCSubprovider(NETWORK_CONFIGS.rpcUrl));
}
providerUtils.startProviderEngine(pe);
return pe;
};
import { getContractAddressesForNetworkOrThrow } from '@0x/contract-addresses';
import { RPCSubprovider, Web3ProviderEngine } from '@0x/subproviders';
import { providerUtils } from '@0x/utils';
import * as _ from 'lodash';
import { OrderWatcherWebSocketServer } from './order_watcher/order_watcher_web_socket_server';
const GANACHE_NETWORK_ID = 50;
const DEFAULT_RPC_URL = 'http://localhost:8545';
const provider = new Web3ProviderEngine();
const jsonRpcUrl = process.env.JSON_RPC_URL || DEFAULT_RPC_URL;
const rpcSubprovider = new RPCSubprovider(jsonRpcUrl);
provider.addProvider(rpcSubprovider);
providerUtils.startProviderEngine(provider);
const networkId = process.env.NETWORK_ID !== undefined ? _.parseInt(process.env.NETWORK_ID) : GANACHE_NETWORK_ID;
const contractAddressesString = process.env.contractAddresses;
const contractAddressesIfExists =
contractAddressesString === undefined
? getContractAddressesForNetworkOrThrow(networkId)
: JSON.parse(contractAddressesString);
const orderWatcherConfig: any = {
isVerbose: process.env.IS_VERBOSE === 'true',
};
const orderExpirationCheckingIntervalMs = process.env.ORDER_EXPIRATION_CHECKING_INTERVAL_MS;
if (orderExpirationCheckingIntervalMs !== undefined) {
orderWatcherConfig.orderExpirationCheckingIntervalMs = _.parseInt(orderExpirationCheckingIntervalMs);
}