-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[r2r] Refactor HW API #1405
[r2r] Refactor HW API #1405
Conversation
* Add an optional expected `device_pubkey` to the `init_trezor` request * Add connected `device_pubkey` to the `init_trezor_status` result * `init_trezor` has to be able to reinitialize a Hardware wallet
* Rename `WaitForTrezorPin` user action to `EnterTrezorPin` * Rename `ReadPublicKeyFromTrezor` in progress status to `WaitingForUserToConfirmPubkey` * Add `ticker` field to the `init_utxo`, `init_qtum` results
* Remove unused error types * Add `crypto::HwRpcError` * Replace HW related errors with `crypto::HwRpcError` for `init_utxo` RPC
* Replace HW related errors with `crypto::HwRpcError` for `init_withdraw` RPC
* Replace HW related errors with `crypto::HwRpcError` within `HDWalletRpcError` and `Mm2InitError` * Add `EnumFromTrait` and `EnumFromInner` derive macros
* Add `common::SerdeInfallible`
* Refactor `get_new_address` to return an error if the last address is not used yet * Split `HDWalletRpcError` into `GetNewAddressRpcError` and `CreateNewAccountRpcError`
* Add `task` RPC namespace, move all `init_*` methods there
* Add `EnterPassphrase` awaiting status * Add `TrezorPassphrase` user action
* Rename `InProgressStatus::WaitingForUserToConfirmPubkey` to `InProgressStatus::FollowHwDeviceInstructions`
* Replace `Ready` status with `Ok` and `Error` * Replace magic pubkey prefixes with `xpub` prefix on `TrezorSession::get_public_key`
* Create at least `min_addresses_number` addresses on coin activation * Allow to generate up to `gap_limit` empty addresses on `get_new_address` RPC * Improve `test_scan_for_new_addresses` test * Add `test_can_get_new_address` test * Implement `Debug` trait for `MmError` manually
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! I have one minor question for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! First review iteration, only some minor issues.
* Refactor `gen_new_addresses_if_required` * Fix deserializing `min_addresses_number` from legacy UTXO request * Remove `KEEP_XPUB_MAGIC` constant
@artemii235 @shamardy this PR is ready for the next review. |
@sergeyboyko0791 It can't be [r2r] because tests do not even compile. Please check your PR's CI status before putting [r2r] mark. UPD There are also conflicts that appeared after merging other PRs. |
@artemii235 now it's ready for the next review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥
#964
EnumFromTrait
andEnumFromInner
derive macrosWaitForTrezorPin
user action toEnterTrezorPin
ReadPublicKeyFromTrezor
in progress status toWaitingForUserToConfirmPubkey
crypto::HwRpcError
forinit_trezor
,init_utxo
,init_qtum
,init_withdraw
,init_scan_for_new_addresses
RPCsinit_trezor
device_pubkey
to theinit_trezor
requestdevice_pubkey
to theinit_trezor_status
resultinit_trezor
has to be able to reinitialize a Hardware walletinit_utxo
,init_qtum
ticker
field to theinit_utxo
,init_qtum
results