Skip to content

Code the handlers

Code the handlers to make the first tests pass

The next step is to code the two first handlers to make the tests swap_ui_only and swap_wrong_refund pass with success

Test swap_ui_only

This test stops before sending the START_SIGNING_TRANSACTION APDU. This means that no coin signature takes place, the only handlers called are swap_handle_check_address() and swap_handle_get_printable_amount().

You can use this test to validate that:

  • swap_handle_check_address() correctly recognizes the valid_destination_1 address.
  • swap_handle_get_printable_amount() correctly formats the amount on screen.

Don't forget to run ragger with the --golden_run option when creating / updating the snapshots.

Test swap_wrong_refund

This test sends an address that does not belong to the device as refund address.

You can use this test to validate that swap_handle_check_address() correctly refuses to recognize the fake_refund address.

Code the last handler and the UI bypass

You can now code the swap_copy_transaction_parameters() handler.

You can now also code the UI bypass in the final transaction signature.

Please refer to the UI bypass documentation carefully.

Please refer to the Coin application error codes to know how to handle the refusal of the final transaction.

All tests should now pass.