Adding the Swap feature
This MR enables the Ledger swap
function:
-
Add ENABLE_SWAP tag -
Provide the 4 required functions: -
The swap_handle_check_address
function which checks an address. -
The swap_handle_get_printable_amount
function, which gives the print format for an amount. -
The swap_copy_transaction_parameters
function, which backs up transaction parameters. -
The swap_finalize_exchange_sign_transaction
function which finalizes the exchange.
-
-
During a swap
, check that the transaction matches the backed-up parameters.
I made some choices in the implementation:
- In
check_address
: thederivation_type
is set toED25519
(since no parameter defines it). - In
check_address
/copy_transaction_parameters
: theextra_id
must be non-null and empty. - In the
get_printable_amount
function: theticker
and the number of decimals given by the caller are those used for print. Should we instead force the display withtz
and 6 decimals? - In
copy_transaction_parameters
/check_validity
: theticker
and the number of decimals are not taken into account, theamount
/fee
values are just compared without decimals.
Edited by Palmer Sébastien