示例#1
0
def setup():
    assert hasattr(pyhmy, "__version__")
    assert pyhmy.__version__.major == 20, "wrong pyhmy version"
    assert pyhmy.__version__.minor == 1, "wrong pyhmy version"
    assert pyhmy.__version__.micro >= 14, "wrong pyhmy version, update please"
    env = cli.download("./bin/hmy", replace=False)
    cli.environment.update(env)
    cli.set_binary("./bin/hmy")
示例#2
0
def setup():
    # hmy cli currently not used, but piped for future use.
    assert hasattr(pyhmy, "__version__")
    assert pyhmy.__version__.major == 20, "wrong pyhmy version"
    assert pyhmy.__version__.minor == 1, "wrong pyhmy version"
    assert pyhmy.__version__.micro >= 14, "wrong pyhmy version, update please"
    env = hmy.download(f"{file_dir}/bin/hmy", replace=False)
    hmy.environment.update(env)
    hmy.set_binary(f"{file_dir}/bin/hmy")
示例#3
0
 def transfer(self,
              from_address,
              to_address,
              amount,
              from_shard=0,
              to_shard=0):
     cli.set_binary(HmyClient._hmyBinaryDir)
     return cli.single_call(
         f'hmy transfer --node={HmyClient._networkUrl} --from {from_address} --to {to_address} --from-shard {from_shard} --to-shard {to_shard} --amount {amount}'
     )
示例#4
0
文件: test_cli.py 项目: difengJ/pyhmy
def test_bad_bin_set():
    bad_file_path = os.path.realpath(f"{TEMP_DIR}/test_bad_bin_set/hmy")
    shutil.rmtree(Path(bad_file_path).parent, ignore_errors=True)
    os.makedirs(Path(bad_file_path).parent, exist_ok=True)
    Path(bad_file_path).touch()
    is_set = cli.set_binary(bad_file_path)
    assert not is_set
    assert cli.get_binary_path() != bad_file_path
示例#5
0
def setup():
    assert hasattr(pyhmy, "__version__")
    assert pyhmy.__version__.major == 20, "wrong pyhmy version"
    assert pyhmy.__version__.minor == 1, "wrong pyhmy version"
    assert pyhmy.__version__.micro >= 14, "wrong pyhmy version, update please"
    env = cli.download("./bin/hmy", replace=False)
    cli.environment.update(env)
    cli.set_binary("./bin/hmy")
    if os.path.exists(private_keys_dir):
        shutil.rmtree(private_keys_dir)
        os.makedirs(private_keys_dir)
    if os.path.exists(pops_keys_dir):
        shutil.rmtree(pops_keys_dir)
        os.makedirs(pops_keys_dir)
    if os.path.exists(internal_keys_dir):
        shutil.rmtree(internal_keys_dir)
        os.makedirs(internal_keys_dir)
示例#6
0
 def regiterNewUser(self, telegram_user_id):
     cli.set_binary(HmyClient._hmyBinaryDir)
     return cli.single_call(f'hmy keys add {telegram_user_id}')
示例#7
0
def setup():
    cli.environment.update(cli.download("./bin/hmy", replace=False))
    cli.set_binary("./bin/hmy")
示例#8
0
import sys
sys.path.append("../")
from pyhmy import cli
import os

#set up binnary path
env = cli.download("./bin/test", replace=False)
cli.environment.update(env)
new_path = os.getcwd() + "/bin/test"
cli.set_binary(new_path)
print("The binary path is %s"%(cli.get_binary_path()))

#get a dict of account names
name_dict = cli.get_accounts_keystore()
print(name_dict)

#get keystore path
print("Your accounts are store in %s"%(cli.get_account_keystore_path()))

if "difeng" not in name_dict.keys():
    #create a user
    cli.single_call("hmy keys add difeng")
    print("difeng has been successfully created")

if "dfxx" not in name_dict.keys():
    #create a user
    cli.single_call("hmy keys add dfxx")
    print("dfxx has been successfully created")

if "test1" not in name_dict.keys():
    #create a user
示例#9
0
文件: test_cli.py 项目: difengJ/pyhmy
def test_bin_set():
    cli.set_binary(BINARY_FILE_PATH)
    cli_binary_path = cli.get_binary_path()
    assert os.path.realpath(cli_binary_path) == os.path.realpath(BINARY_FILE_PATH)