def create(self): network_id = None if (not self.args.skip_check): # check endpoint by getting its network_id w3 = get_web3(self.args.eth_rpc_endpoint) network_id = w3.version.network self._printout("add network with name='%s' with networkId='%s'" % (self.args.network_name, str(network_id))) self.config.add_network(self.args.network_name, self.args.eth_rpc_endpoint, self.args.default_gas_price)
def __init__(self, config, args, out_f=sys.stdout, err_f=sys.stderr, w3=None, ident=None): super(BlockchainCommand, self).__init__(config, args, out_f, err_f) self.w3 = w3 or get_web3(self.get_eth_endpoint()) self.ident = ident or self.get_identity() if (type(self.w3.eth.gasPriceStrategy) != cachedGasPriceStrategy): self.w3.eth.setGasPriceStrategy( cachedGasPriceStrategy(self.get_gas_price_param()))