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 527239a
Show file tree
Hide file tree
Showing 8 changed files with 504 additions and 738 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.

44 changes: 22 additions & 22 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,42 +106,46 @@ 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]
return (yield UiConfirmOutput(output, coin, output_index, chunkify))
def confirm_output(output: MintlayerTxOutput, coin: CoinInfo, output_index: int, chunkify: bool) -> Awaitable[None]: # type: ignore [awaitable-return-type]
return (
yield UiConfirmOutput( # type: ignore [awaitable-return-type]
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)) # type: ignore [awaitable-return-type]


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


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


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


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


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
tx_req.request_type = MintlayerRequestType.TXINPUT
tx_req.details.request_index = i
ack = yield MintlayerTxAckUtxoInput, tx_req
ack = yield MintlayerTxAckUtxoInput, tx_req # type: ignore [awaitable-return-type]
_clear_tx_request(tx_req)
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 @@ -155,14 +155,14 @@ def request_tx_output(tx_req: MintlayerTxRequest, i: int, tx_hash: bytes | None
else:
tx_req.request_type = MintlayerRequestType.TXOUTPUT
tx_req.details.request_index = i
ack = yield MintlayerTxAckOutput, tx_req
ack = yield MintlayerTxAckOutput, tx_req # type: ignore [awaitable-return-type]
_clear_tx_request(tx_req)
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
yield None, tx_re # type: ignore [awaitable-return-type]q
_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 527239a

Please sign in to comment.