mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-15 19:08:07 +00:00
parent
65434fa49a
commit
a074dd3e54
@ -16,10 +16,12 @@ async def require_confirm_tx(ctx, to, value, chain_id, token=None, tx_type=None)
|
||||
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 = 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("to")
|
||||
text.mono(*split_address(to_str))
|
||||
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)
|
||||
|
||||
@ -27,11 +29,13 @@ async def require_confirm_tx(ctx, to, value, chain_id, token=None, tx_type=None)
|
||||
async def require_confirm_fee(
|
||||
ctx, spending, gas_price, gas_limit, chain_id, token=None, tx_type=None
|
||||
):
|
||||
text = Text("Confirm transaction", ui.ICON_SEND, icon_color=ui.GREEN)
|
||||
text = Text(
|
||||
"Confirm transaction", ui.ICON_SEND, icon_color=ui.GREEN, new_lines=False
|
||||
)
|
||||
text.bold(format_ethereum_amount(spending, token, chain_id, tx_type))
|
||||
text.normal("Gas price:")
|
||||
text.normal(ui.GREY, "Gas price:", ui.FG)
|
||||
text.bold(format_ethereum_amount(gas_price, None, chain_id, tx_type))
|
||||
text.normal("Maximum fee:")
|
||||
text.normal(ui.GREY, "Maximum fee:", ui.FG)
|
||||
text.bold(format_ethereum_amount(gas_price * gas_limit, None, chain_id, tx_type))
|
||||
await require_hold_to_confirm(ctx, text, ButtonRequestType.SignTx)
|
||||
|
||||
|
@ -123,22 +123,20 @@ class Text(ui.LazyWidget):
|
||||
self.content = []
|
||||
|
||||
def normal(self, *content):
|
||||
self.content.append(ui.NORMAL)
|
||||
self.content.extend(content)
|
||||
|
||||
def bold(self, *content):
|
||||
self.content.append(ui.BOLD)
|
||||
self.content.extend(content)
|
||||
self.content.append(ui.NORMAL)
|
||||
|
||||
def mono(self, *content):
|
||||
self.content.append(ui.MONO)
|
||||
self.content.extend(content)
|
||||
self.content.append(ui.NORMAL)
|
||||
|
||||
def mono_bold(self, *content):
|
||||
self.content.append(ui.MONO_BOLD)
|
||||
self.content.extend(content)
|
||||
self.content.append(ui.NORMAL)
|
||||
|
||||
def br(self):
|
||||
self.content.append(BR)
|
||||
|
Loading…
Reference in New Issue
Block a user