async def require_confirm_tx(ctx, to, value):

    text = Text("Confirm sending", ui.ICON_SEND, ui.GREEN)
    text.bold(format_amount(value, helpers.DECIMALS) + " XRP")
    text.normal("to")
    text.mono(*split_address(to))
    return await require_hold_to_confirm(ctx, text, ButtonRequestType.SignTx)
Пример #2
0
async def require_confirm_verify_message(ctx, address, message):
    text = Text("Confirm address")
    text.mono(*split_address(address))
    await require_confirm(ctx, text)

    text = Text("Verify message", new_lines=False)
    text.normal(*split_message(message))
    await require_confirm(ctx, text)
Пример #3
0
async def require_confirm_verify_message(ctx: wire.Context, address: str,
                                         header: str, message: bytes) -> None:
    text = Text("Confirm address", new_lines=False)
    text.mono(*split_address(address))
    await require_confirm(ctx, text)

    text = Text(header, new_lines=False)
    text.mono(*split_message(message))
    await require_confirm(ctx, text)
Пример #4
0
async def show_tx(
    ctx,
    outputs: list,
    outcoins: list,
    change_derivation_paths: list,
    change_coins: list,
    fee: float,
    tx_size: float,
    network_name: str,
) -> bool:
    lines = ("%s ADA" % _micro_ada_to_ada(fee), BR, "Tx size:", "%s bytes" % tx_size)
    if not await confirm_with_pagination(
        ctx, lines, "Confirm fee", ui.ICON_SEND, ui.GREEN
    ):
        return False

    if not await confirm_with_pagination(
        ctx, "%s network" % network_name, "Confirm network", ui.ICON_SEND, ui.GREEN
    ):
        return False

    for index, output in enumerate(outputs):
        if not await confirm_with_pagination(
            ctx, output, "Confirm output", ui.ICON_SEND, ui.GREEN
        ):
            return False

        if not await confirm_with_pagination(
            ctx,
            "%s ADA" % _micro_ada_to_ada(outcoins[index]),
            "Confirm amount",
            ui.ICON_SEND,
            ui.GREEN,
        ):
            return False

    for index, change in enumerate(change_derivation_paths):
        if not await confirm_with_pagination(
            ctx,
            list(split_address(address_n_to_str(change))),
            "Confirm change",
            ui.ICON_SEND,
            ui.GREEN,
        ):
            return False

        if not await confirm_with_pagination(
            ctx,
            "%s ADA" % _micro_ada_to_ada(change_coins[index]),
            "Confirm amount",
            ui.ICON_SEND,
            ui.GREEN,
        ):
            return False

    return True
async def require_confirm_verify_message(ctx: wire.Context, address: str,
                                         coin: str, message: bytes) -> None:
    header = "Verify {} message".format(coin)
    text = Text(header, new_lines=False)
    text.bold("Confirm address:")
    text.br()
    text.mono(*split_address(address))
    await require_confirm(ctx, text)

    text = Text(header, new_lines=False)
    text.mono(*split_message(message))
    await require_confirm(ctx, text)
Пример #6
0
async def require_confirm_tx(ctx, to_bytes, value, chain_id, token=None, tx_type=None):
    if to_bytes:
        to_str = address_from_bytes(to_bytes, networks.by_chain_id(chain_id))
    else:
        to_str = "new contract?"
    text = Text("Confirm sending", ui.ICON_SEND, ui.GREEN, new_lines=False)
    text.bold(format_ethereum_amount(value, token, chain_id, tx_type))
    text.normal(ui.GREY, "to", ui.FG)
    for to_line in split_address(to_str):
        text.br()
        text.mono(to_line)
    # we use SignTx, not ConfirmOutput, for compatibility with T1
    await require_confirm(ctx, text, ButtonRequestType.SignTx)
Пример #7
0
    def make_input_output_pages(msg: BinanceInputOutput, direction):
        pages = []
        for coin in msg.coins:
            coin_page = Text("Confirm " + direction,
                             ui.ICON_SEND,
                             icon_color=ui.GREEN)
            coin_page.bold(
                format_amount(coin.amount, helpers.DECIMALS) + " " +
                coin.denom)
            coin_page.normal("to")
            coin_page.mono(*split_address(msg.address))
            pages.append(coin_page)

        return pages
Пример #8
0
async def require_confirm_tx(ctx,
                             to,
                             value,
                             chain_id,
                             token=None,
                             tx_type=None):
    if to:
        to_str = _ethereum_address_hex(to, networks.by_chain_id(chain_id))
    else:
        to_str = "new contract?"
    text = Text("Confirm sending", ui.ICON_SEND, icon_color=ui.GREEN)
    text.bold(format_ethereum_amount(value, token, chain_id, tx_type))
    text.normal("to")
    text.mono(*split_address(to_str))
    # we use SignTx, not ConfirmOutput, for compatibility with T1
    await require_confirm(ctx, text, ButtonRequestType.SignTx)
Пример #9
0
async def require_confirm_tx(ctx, to, value):
    text = Text("Confirm sending", ui.ICON_SEND, ui.GREEN)
    text.bold(format_coin_amount(value))
    text.normal("to")
    text.mono(*split_address(to))
    await require_confirm(ctx, text, ButtonRequestType.SignTx)
Пример #10
0
async def _require_confirm_transfer(ctx, recipient, value):
    text = Text("Confirm transfer", ui.ICON_SEND, ui.GREEN)
    text.bold("Send %s XEM" % format_amount(value, NEM_MAX_DIVISIBILITY))
    text.normal("to")
    text.mono(*split_address(recipient))
    await require_confirm(ctx, text, ButtonRequestType.ConfirmOutput)
Пример #11
0
def _get_mosaic_properties(definition: NEMMosaicDefinition):
    properties = []

    # description
    if definition.description:
        t = Text("Confirm properties", ui.ICON_SEND, new_lines=False)
        t.bold("Description:")
        t.br()
        t.normal(*definition.description.split(" "))
        properties.append(t)

    # transferable
    if definition.transferable:
        transferable = "Yes"
    else:
        transferable = "No"
    t = Text("Confirm properties", ui.ICON_SEND)
    t.bold("Transferable?")
    t.normal(transferable)
    properties.append(t)

    # mutable_supply
    if definition.mutable_supply:
        imm = "mutable"
    else:
        imm = "immutable"
    if definition.supply:
        t = Text("Confirm properties", ui.ICON_SEND)
        t.bold("Initial supply:")
        t.normal(str(definition.supply), imm)
    else:
        t = Text("Confirm properties", ui.ICON_SEND)
        t.bold("Initial supply:")
        t.normal(imm)
    properties.append(t)

    # levy
    if definition.levy:

        t = Text("Confirm properties", ui.ICON_SEND)
        t.bold("Levy recipient:")
        t.mono(*split_address(definition.levy_address))
        properties.append(t)

        t = Text("Confirm properties", ui.ICON_SEND)
        t.bold("Levy fee:")
        t.normal(str(definition.fee))
        t.bold("Levy divisibility:")
        t.normal(str(definition.divisibility))
        properties.append(t)

        t = Text("Confirm properties", ui.ICON_SEND)
        t.bold("Levy namespace:")
        t.normal(definition.levy_namespace)
        t.bold("Levy mosaic:")
        t.normal(definition.levy_mosaic)
        properties.append(t)

        if definition.levy == NEMMosaicLevy.MosaicLevy_Absolute:
            levy_type = "absolute"
        else:
            levy_type = "percentile"
        t = Text("Confirm properties", ui.ICON_SEND)
        t.bold("Levy type:")
        t.normal(levy_type)
        properties.append(t)

    return properties
Пример #12
0
async def _require_confirm_address(ctx, action: str, address: str):
    text = Text("Confirm address", ui.ICON_SEND, ui.GREEN)
    text.normal(action)
    text.mono(*split_address(address))
    await require_confirm(ctx, text, ButtonRequestType.ConfirmOutput)