コード例 #1
0
async def confirm_blob(
    ctx: wire.GenericContext,
    br_type: str,
    title: str,
    data: bytes | str,
    description: str | None = None,
    hold: bool = False,
    br_code: ButtonRequestType = ButtonRequestType.Other,
    icon: str = ui.ICON_SEND,  # TODO cleanup @ redesign
    icon_color: int = ui.GREEN,  # TODO cleanup @ redesign
    ask_pagination: bool = False,
) -> None:
    result = await interact(
        ctx,
        _RustLayout(
            trezorui2.confirm_text(
                title=title,
                data=str(data),
                description=description,
            )),
        br_type,
        br_code,
    )
    if result is not trezorui2.CONFIRMED:
        raise wire.ActionCancelled
コード例 #2
0
async def show_address(
    ctx: wire.GenericContext,
    address: str,
    *,
    case_sensitive: bool = True,
    address_qr: str | None = None,
    title: str = "Confirm address",
    network: str | None = None,
    multisig_index: int | None = None,
    xpubs: Sequence[str] = (),
    address_extra: str | None = None,
    title_qr: str | None = None,
) -> None:
    result = await interact(
        ctx,
        _RustLayout(
            trezorui2.confirm_text(
                title="ADDRESS",
                data=address,
                description="Confirm address",
            )),
        "show_address",
        ButtonRequestType.Address,
    )
    if result is not trezorui2.CONFIRMED:
        raise wire.ActionCancelled
コード例 #3
0
async def show_success(
    ctx: wire.GenericContext,
    br_type: str,
    content: str,
) -> None:
    result = await interact(
        ctx,
        _RustLayout(
            trezorui2.confirm_text(
                title="Success",
                data=content,
                description="",
            )),
        br_type,
        br_code=ButtonRequestType.Other,
    )
    if result is not trezorui2.CONFIRMED:
        raise wire.ActionCancelled
コード例 #4
0
async def confirm_output(
    ctx: wire.GenericContext,
    address: str,
    amount: str,
    font_amount: int = ui.NORMAL,  # TODO cleanup @ redesign
    title: str = "Confirm sending",
    icon: str = ui.ICON_SEND,
) -> None:
    result = await interact(
        ctx,
        _RustLayout(
            trezorui2.confirm_text(
                title=title,
                data=f"Send {amount} to {address}?",
                description="Confirm Output",
            )),
        "confirm_output",
        ButtonRequestType.Other,
    )
    if result is not trezorui2.CONFIRMED:
        raise wire.ActionCancelled
コード例 #5
0
async def confirm_total(
    ctx: wire.GenericContext,
    total_amount: str,
    fee_amount: str,
    title: str = "Confirm transaction",
    total_label: str = "Total amount:\n",
    fee_label: str = "\nincluding fee:\n",
    icon_color: int = ui.GREEN,
    br_type: str = "confirm_total",
    br_code: ButtonRequestType = ButtonRequestType.SignTx,
) -> None:
    result = await interact(
        ctx,
        _RustLayout(
            trezorui2.confirm_text(
                title=title,
                data=f"{total_label}{total_amount}\n{fee_label}{fee_amount}",
                description="Confirm Output",
            )),
        br_type,
        br_code,
    )
    if result is not trezorui2.CONFIRMED:
        raise wire.ActionCancelled