How to use the trezor.messages.ButtonRequestType function in trezor

To help you get started, we’ve selected a few trezor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github trezor / trezor-firmware / core / src / apps / common / request_passphrase.py View on Github external
async def request_passphrase_source(ctx: wire.Context) -> int:
    req = ButtonRequest(code=ButtonRequestType.PassphraseType)
    await ctx.call(req, ButtonAck)

    text = Text("Enter passphrase", ui.ICON_CONFIG)
    text.normal("Where do you want to", "enter your passphrase?")
    source = PassphraseSource(text)

    response = await ctx.wait(source)
    assert isinstance(response, int)
    return response
github trezor / trezor-core / src / apps / nem / multisig / layout.py View on Github external
async def _require_confirm_address(ctx, action: str, address: str):
    text = Text("Confirm address", ui.ICON_SEND, icon_color=ui.GREEN)
    text.normal(action)
    text.mono(*split_address(address))
    await require_confirm(ctx, text, ButtonRequestType.ConfirmOutput)
github trezor / trezor-firmware / core / src / apps / eos / layout.py View on Github external
async def require_get_public_key(ctx: wire.Context, public_key: str) -> None:
    text = Text("Confirm public key", ui.ICON_RECEIVE, ui.GREEN)
    text.normal(public_key)
    await require_confirm(ctx, text, ButtonRequestType.PublicKey)
github trezor / trezor-firmware / core / src / apps / tezos / layout.py View on Github external
async def require_confirm_set_delegate(ctx, fee):
    text = Text("Confirm delegation", ui.ICON_SEND, ui.BLUE)
    text.normal("Fee:")
    text.bold(format_tezos_amount(fee))
    await require_hold_to_confirm(ctx, text, ButtonRequestType.SignTx)
github trezor / trezor-core / src / apps / monero / layout / confirms.py View on Github external
async def require_confirm_tx_key(ctx, export_key=False):
    content = Text("Confirm export", ui.ICON_SEND, icon_color=ui.GREEN)
    txt = ["Do you really want to"]
    if export_key:
        txt.append("export tx_key?")
    else:
        txt.append("export tx_der")
        txt.append("for tx_proof?")

    content.normal(*txt)
    return await require_confirm(ctx, content, ButtonRequestType.SignTx)
github trezor / trezor-core / src / apps / lisk / layout.py View on Github external
async def require_confirm_multisig(ctx, multisignature):
    text = Text("Confirm transaction", ui.ICON_SEND, icon_color=ui.GREEN)
    text.normal("Keys group length: %s" % len(multisignature.keys_group))
    text.normal("Life time: %s" % multisignature.life_time)
    text.normal("Min: %s" % multisignature.min)
    return await require_confirm(ctx, text, ButtonRequestType.SignTx)
github trezor / trezor-firmware / core / src / apps / management / set_u2f_counter.py View on Github external
async def set_u2f_counter(ctx: wire.Context, msg: SetU2FCounter) -> Success:
    if msg.u2f_counter is None:
        raise wire.ProcessError("No value provided")

    text = Text("Set U2F counter", ui.ICON_CONFIG)
    text.normal("Do you really want to", "set the U2F counter")
    text.bold("to %d?" % msg.u2f_counter)
    await require_confirm(ctx, text, code=ButtonRequestType.ProtectCall)

    storage.device.set_u2f_counter(msg.u2f_counter)

    return Success(message="U2F counter set")
github trezor / trezor-core / src / apps / common / layout.py View on Github external
async def show_address(ctx, address: str, desc: str = None, network: str = None):
    text = Text(
        desc if desc else "Confirm address", ui.ICON_RECEIVE, icon_color=ui.GREEN
    )
    if network:
        text.normal("%s network" % network)
    text.mono(*split_address(address))
    return await confirm(
        ctx, text, code=ButtonRequestType.Address, cancel="QR", cancel_style=ui.BTN_KEY
    )
github trezor / trezor-core / src / apps / ethereum / layout.py View on Github external
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, icon_color=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)
github trezor / trezor-core / src / apps / nem / transfer / layout.py View on Github external
await require_confirm(ctx, msg, ButtonRequestType.ConfirmOutput)

        if "levy" in definition and "fee" in definition:
            levy_msg = _get_levy_msg(definition, mosaic_quantity, common.network)
            msg = Text("Confirm mosaic", ui.ICON_SEND, icon_color=ui.GREEN)
            msg.normal("Confirm mosaic", "levy fee of")
            msg.bold(levy_msg)
            await require_confirm(ctx, msg, ButtonRequestType.ConfirmOutput)

    else:
        msg = Text("Confirm mosaic", ui.ICON_SEND, icon_color=ui.RED)
        msg.bold("Unknown mosaic!")
        msg.normal("Divisibility and levy")
        msg.normal("cannot be shown for")
        msg.normal("unknown mosaics")
        await require_confirm(ctx, msg, ButtonRequestType.ConfirmOutput)

        msg = Text("Confirm mosaic", ui.ICON_SEND, icon_color=ui.GREEN)
        msg.normal("Confirm transfer of")
        msg.bold("%s raw units" % mosaic_quantity)
        msg.normal("of")
        msg.bold("%s.%s" % (mosaic.namespace, mosaic.mosaic))
        await require_confirm(ctx, msg, ButtonRequestType.ConfirmOutput)