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
Collaborator

fyrchik commented Feb 20, 2020

Support some of the capabilities outlined in #26 .

  • import WIF
  • import WIF + multisig
  • export WIF

Fix some minor bugs.

fyrchik added 5 commits Feb 20, 2020
When we are opening a file, it is expected that
it will be rewritten, not appended to a already existing wallet.
They are set during account creation and open+decrypt is
expected to put account in the same state.
@fyrchik fyrchik requested a review from roman-khimov Feb 20, 2020
@codecov

This comment has been minimized.

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.

@fyrchik fyrchik force-pushed the feature/wallet branch 2 times, most recently from 6e6245a to 5cd597b Feb 20, 2020
@fyrchik fyrchik force-pushed the feature/wallet branch 2 times, most recently from b8ea002 to 946cbf6 Feb 21, 2020
fyrchik added 2 commits Feb 20, 2020
(*Account).ConvertMultisig() will convert an existing account
into a multisig one.
@fyrchik fyrchik force-pushed the feature/wallet branch from 946cbf6 to a7995bf Feb 21, 2020
cli/wallet/wallet.go Outdated Show resolved Hide resolved
cli/wallet/wallet.go Outdated Show resolved Hide resolved
@roman-khimov

This comment has been minimized.

Copy link
Collaborator

roman-khimov commented Feb 21, 2020

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

This comment has been minimized.

Copy link
Collaborator

roman-khimov commented Feb 21, 2020

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

This comment has been minimized.

Copy link
Collaborator Author

fyrchik commented Feb 21, 2020

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

@fyrchik fyrchik force-pushed the feature/wallet branch from 5c837e7 to ba39aa0 Feb 21, 2020
fyrchik added 4 commits Feb 20, 2020
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.
@fyrchik fyrchik force-pushed the feature/wallet branch from ba39aa0 to 2fc6375 Feb 21, 2020
@roman-khimov

This comment has been minimized.

Copy link
Collaborator

roman-khimov commented Feb 21, 2020

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
9 checks passed
9 checks passed
GolangCI No issues found!
Details
ci/circleci: build_cli Your tests passed on CircleCI!
Details
ci/circleci: build_image Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: test_1_12 Your tests passed on CircleCI!
Details
ci/circleci: test_1_13 Your tests passed on CircleCI!
Details
ci/circleci: vet Your tests passed on CircleCI!
Details
codecov/patch 78% of diff hit (target 65.01%)
Details
codecov/project 65.05% (+0.03%) compared to cad1f07
Details
@roman-khimov roman-khimov deleted the feature/wallet branch Feb 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.