Skip to content

Commit

Permalink
fix confirm total after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
OBorce committed Sep 15, 2024
1 parent 653acc9 commit 15d3e95
Show file tree
Hide file tree
Showing 8 changed files with 492 additions and 730 deletions.
39 changes: 25 additions & 14 deletions core/embed/rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 10 additions & 14 deletions core/src/apps/mintlayer/sign_tx/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
)

from apps.common.coininfo import CoinInfo
from apps.common.paths import Bip32Path

TX_HASH_SIZE = const(32)

Expand Down Expand Up @@ -64,21 +63,18 @@ def __init__(
fee: int,
fee_rate: float,
coin: CoinInfo,
address_n: Bip32Path | None,
):
self.spending = spending
self.fee = fee
self.fee_rate = fee_rate
self.coin = coin
self.address_n = address_n

def confirm_dialog(self) -> Awaitable[Any]:
return layout.confirm_total(
self.spending,
self.fee,
self.fee_rate,
self.coin,
self.address_n,
)


Expand Down Expand Up @@ -110,31 +106,31 @@ def confirm_dialog(self) -> Awaitable[Any]:
return layout.confirm_multiple_accounts()


def confirm_output(output: MintlayerTxOutput, coin: CoinInfo, output_index: int, chunkify: bool) -> Awaitable[None]: # type: ignore [awaitable-is-generator]
def confirm_output(output: MintlayerTxOutput, coin: CoinInfo, output_index: int, chunkify: bool) -> Awaitable[None]: # type: ignore [awaitable-return-type]
return (yield UiConfirmOutput(output, coin, output_index, chunkify))


def confirm_total(spending: int, fee: int, fee_rate: float, coin: CoinInfo, address_n: Bip32Path | None) -> Awaitable[None]: # type: ignore [awaitable-is-generator]
return (yield UiConfirmTotal(spending, fee, fee_rate, coin, address_n))
def confirm_total(spending: int, fee: int, fee_rate: float, coin: CoinInfo) -> Awaitable[None]: # type: ignore [awaitalble-return-type]
return (yield UiConfirmTotal(spending, fee, fee_rate, coin))


def confirm_change_count_over_threshold(change_count: int) -> Awaitable[Any]: # type: ignore [awaitable-is-generator]
def confirm_change_count_over_threshold(change_count: int) -> Awaitable[Any]: # type: ignore [awaitalble-return-type]
return (yield UiConfirmChangeCountOverThreshold(change_count))


def confirm_unverified_external_input() -> Awaitable[Any]: # type: ignore [awaitable-is-generator]
def confirm_unverified_external_input() -> Awaitable[Any]: # type: ignore [awaitalble-return-type]
return (yield UiConfirmUnverifiedExternalInput())


def confirm_foreign_address(address_n: list) -> Awaitable[Any]: # type: ignore [awaitable-is-generator]
def confirm_foreign_address(address_n: list) -> Awaitable[Any]: # type: ignore [awaitalble-return-type]
return (yield UiConfirmForeignAddress(address_n))


def confirm_multiple_accounts() -> Awaitable[Any]: # type: ignore [awaitable-is-generator]
def confirm_multiple_accounts() -> Awaitable[Any]: # type: ignore [awaitalble-return-type]
return (yield UiConfirmMultipleAccounts())


def request_tx_input(tx_req: MintlayerTxRequest, i: int) -> Awaitable[MintlayerTxInput]: # type: ignore [awaitable-is-generator]
def request_tx_input(tx_req: MintlayerTxRequest, i: int) -> Awaitable[MintlayerTxInput]: # type: ignore [awaitalble-return-type]
from trezor.messages import MintlayerTxAckUtxoInput

assert tx_req.details is not None
Expand All @@ -145,7 +141,7 @@ def request_tx_input(tx_req: MintlayerTxRequest, i: int) -> Awaitable[MintlayerT
return _sanitize_tx_input(ack.tx.input)


def request_tx_output(tx_req: MintlayerTxRequest, i: int, tx_hash: bytes | None = None) -> Awaitable[MintlayerTxOutput]: # type: ignore [awaitable-is-generator]
def request_tx_output(tx_req: MintlayerTxRequest, i: int, tx_hash: bytes | None = None) -> Awaitable[MintlayerTxOutput]: # type: ignore [awaitalble-return-type]
from trezor.messages import MintlayerTxAckOutput

assert tx_req.details is not None
Expand All @@ -160,7 +156,7 @@ def request_tx_output(tx_req: MintlayerTxRequest, i: int, tx_hash: bytes | None
return _sanitize_tx_output(ack.tx.output)


def request_tx_finish(tx_req: MintlayerTxRequest) -> Awaitable[None]: # type: ignore [awaitable-is-generator]
def request_tx_finish(tx_req: MintlayerTxRequest) -> Awaitable[None]: # type: ignore [awaitable-return-type]
tx_req.request_type = MintlayerRequestType.TXFINISHED
yield None, tx_req
_clear_tx_request(tx_req)
Expand Down
2 changes: 0 additions & 2 deletions core/src/apps/mintlayer/sign_tx/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,12 @@ async def confirm_total(
fee: int,
fee_rate: float,
coin: CoinInfo,
address_n: Bip32Path | None,
) -> None:

await layouts.confirm_total(
format_coin_amount(spending.to_bytes(16, "big"), None),
format_coin_amount(fee.to_bytes(16, "big"), None),
fee_rate_amount=format_fee_rate(fee_rate, coin) if fee_rate >= 0 else None,
account_label=account_label(coin, address_n),
)


Expand Down
1 change: 0 additions & 1 deletion core/src/apps/mintlayer/sign_tx/signer.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ async def signer(self) -> None:
fee,
fee_rate,
coin,
None,
)

# Make sure proper progress is shown, in case dialog was not required
Expand Down
Loading

0 comments on commit 15d3e95

Please sign in to comment.