def set_local_nodeos_address_if_none(): if not setup.nodeos_address(): setup.set_nodeos_address( "http://" + config.http_server_address()) setup.is_local_address = True return setup.is_local_address
def register_testnet_(url, alias, account_name, owner_key, active_key): setup.set_nodeos_address(url) manager.verify_testnet_production() #testnet.testnets() account = create_master_account(None, account_name=account_name, owner_key=owner_key, active_key=active_key) if account: testnet.add_to_mapping( account_name if account_name else account.name, owner_key if owner_key else account.owner_key.key_private, active_key if active_key else account.active_key.key_private, url, alias) testnet.testnets()
def register_testnet_via_faucet_(faucet, url, alias): setup.set_nodeos_address(url) manager.verify_testnet_production() account_name = cleos.account_name() path = faucet + "/" + CREATE_ACCOUNT_URL + "?" + account_name attempt = 0 response = None while True: TRACE(''' Registering account: {} '''.format(path)) try: request = Request(path, headers=HEADERS) response = urlopen(request).read() if isinstance(response, bytes): response = response.decode("utf-8") response = json.loads(response) break except Exception as e: response = None attempt = attempt + 1 if attempt == MAX_ATTEMPTS: raise errors.Error(''' Request failed: {} Error message is {} '''.format(path, str(e))) else: account_name = cleos.account_name() path = faucet + "/" + CREATE_ACCOUNT_URL + "?" + account_name time.sleep(DELAY_IN_SECONDDS) if response["account"] != account_name: raise errors.Error(''' Account names do not match: ``{}`` vs ``{}`` '''.format(response["account"], account_name)) owner_key = response["keys"]["owner_key"]["private"] active_key = response["keys"]["active_key"]["private"] INFO(''' Account ``{}`` successfully registered. '''.format(account_name)) path = faucet + "/" + GET_TOKEN_URL + "?" + account_name attempt = 0 success = 0 while True: TRACE(''' Funding account: {} '''.format(path)) try: request = Request(path, headers=HEADERS) response = urlopen(request).read() if isinstance(response, bytes): response = response.decode("utf-8") response = json.loads(response) success = success + 1 if success == MAX_ATTEMPTS: break except Exception as e: attempt = attempt + 1 if attempt == MAX_ATTEMPTS: if success == 0: raise errors.Error(''' Request failed: {} Error message is {} '''.format(path, str(e))) break time.sleep(DELAY_IN_SECONDDS) INFO(''' Account ``{}`` successfully funded. '''.format(account_name)) testnet.add_to_mapping(url, account_name, owner_key, active_key, alias) testnet.testnets()
def wasm(src_file, wasm_file, options=[]): '''Given a source file and an output file path, make a corresponding wasm file. ''' cl = [config.eosio_cpp()] cl.extend(options) cl.extend(["-o", wasm_file, src_file]) import eosfactory.core.teos as teos teos.process(cl) ############################################################################### # test ############################################################################### setup.set_nodeos_address(url()) def test(): stop() nodeos([ "--http-server-address", config.http_server_address(), "--data-dir", config.data_dir(), "--config-dir", config.config_dir(), "--chain-state-db-size-mb", config.chain_state_db_size_mb(), "--contracts-console", "--verbose-http-errors", "--enable-stale-production", "--producer-name eosio", "--signature-provider " + config.eosio_key_public() + "=KEY:" + config.eosio_key_private(), "--plugin eosio::producer_plugin", "--plugin eosio::chain_api_plugin", "--plugin eosio::http_plugin", "--plugin eosio::history_api_plugin",
def configure(self, prefix=None): setup.set_nodeos_address(self.url, prefix)
def configure(self, prefix=None): '''Set the testnet to be the listener to EOSFactory. ''' setup.set_nodeos_address(self.url, prefix)