Beispiel #1
0
def create_writer(url: str, nid: int, keystore_path: str, password: str, step_limit: int) -> PRepToolsWriter:
    url: str = get_url(url)
    icon_service = IconService(HTTPProvider(url))

    try:
        owner_wallet = KeyWallet.load(keystore_path, password)

    except KeyStoreException as e:
        raise InvalidKeyStoreException(f"{e}")

    return PRepToolsWriter(icon_service, nid, owner_wallet, step_limit)
Beispiel #2
0
def create_writer_by_args(args) -> PRepToolsWriter:
    url, nid, keystore_path = _get_common_args(args)
    password: str = args.password

    if keystore_path is None:
        raise InvalidKeyStoreException("There's no keystore path in cmdline, configure.")

    if password is None:
        password = getpass.getpass("> Password: "******"step_limit", 0x50000000))

    callback = functools.partial(_confirm_callback, yes=args.yes, verbose=args.verbose)
    writer.set_on_send_request(callback)

    return writer