Skip to content
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

cli: implement wallet import/export functionality #685

Merged
merged 13 commits into from
Feb 21, 2020
Merged

Conversation

fyrchik
Copy link
Contributor

@fyrchik fyrchik commented Feb 20, 2020

Support some of the capabilities outlined in #26 .

  • import WIF
  • import WIF + multisig
  • export WIF

Fix some minor bugs.

They are set during account creation and open+decrypt is
expected to put account in the same state.
When we are opening a file, it is expected that
it will be rewritten, not appended to a already existing wallet.
@codecov
Copy link

codecov bot commented Feb 20, 2020

Codecov Report

Merging #685 into master will increase coverage by 0.03%.
The diff coverage is 78%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #685      +/-   ##
==========================================
+ Coverage   65.01%   65.05%   +0.03%     
==========================================
  Files         125      125              
  Lines       10820    10869      +49     
==========================================
+ Hits         7035     7071      +36     
- Misses       3505     3516      +11     
- Partials      280      282       +2
Impacted Files Coverage Δ
pkg/smartcontract/param_context.go 76.02% <0%> (-4.23%) ⬇️
pkg/wallet/account.go 93.33% <100%> (+0.88%) ⬆️
pkg/wallet/wallet.go 78.46% <33.33%> (-2.19%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cad1f07...2fc6375. Read the comment docs.

Also do not ignore errors from `terminal.ReadPassword`.
(*Account).ConvertMultisig() will convert an existing account
into a multisig one.
cli/wallet/wallet.go Outdated Show resolved Hide resolved
cli/wallet/wallet.go Outdated Show resolved Hide resolved
@roman-khimov
Copy link
Member

One thing we're missing here: newAccountFromPrivateKey should also generate a simple CHECKSIG contract, that actually was one of the issues with our testnet CN, it had a key in the wallet, but it didn't have a contract accociated with it and then GetAccount() failed to find the key because its operation is based on contracts.

@roman-khimov
Copy link
Member

Other than that it's fine, we may probably tune the cli part of it, but the main thing is that all of the functionality is there.

@fyrchik
Copy link
Contributor Author

fyrchik commented Feb 21, 2020

@roman-khimov is it somehow different from what is done in 5a727ca ?

One positional argument can be provided. If so, it is
interpreted as address and only WIFs corresponding to it
are exported. If address is provided '--decrypt' flag can be
specified to export unencrypted WIFs.
@roman-khimov
Copy link
Member

Yeah, that's what it is, somehow I've missed that this change actually fixes newAccountFromPrivateKey.

@roman-khimov roman-khimov added this to the v0.74.0 milestone Feb 21, 2020
@roman-khimov roman-khimov merged commit ef31d0d into master Feb 21, 2020
@roman-khimov roman-khimov deleted the feature/wallet branch February 21, 2020 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Completely new functionality wallet NEP-6 wallet and accounts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants