-
Notifications
You must be signed in to change notification settings - Fork 142
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
feat(grpc): refactor CreateWallet and add RestoreWallet API endpoint #1256
feat(grpc): refactor CreateWallet and add RestoreWallet API endpoint #1256
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1256 +/- ##
==========================================
- Coverage 76.12% 76.03% -0.09%
==========================================
Files 203 203
Lines 10637 10661 +24
==========================================
+ Hits 8097 8106 +9
- Misses 2149 2164 +15
Partials 391 391 |
wallet/manager.go
Outdated
} | ||
|
||
func (w *Manager) walletExists(walletName string) bool { | ||
walletPath := util.MakeAbs(filepath.Join(w.walletDirectory, walletName)) |
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.
We can avoid repeating this line by defining a function like:
func getWalletPath(walletName string) string { ... }
www/grpc/server_test.go
Outdated
@@ -80,7 +80,7 @@ func setup(t *testing.T, conf *Config) *testData { | |||
server := NewServer( | |||
conf, mockState, | |||
mockSync, mockNet, | |||
mockConsMgr, wallet.NewWalletManager(mockState.Genesis().ChainType()), | |||
mockConsMgr, wallet.NewWalletManager(mockState.Genesis().ChainType(), conf.WalletsDir), |
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.
For test you can use TempDirPath
function
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.
The way we construct temp dir is using os.MkdirTemp
, and it'll return different value every time, so we cannot use TempDirPath
here
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.
So, let's find a solution for that.
Look at the gRPC service as an object that has no knowledge about wallet. (path, chain-type, etc...)
2ff2ece
to
3d8f9ad
Compare
02187ee
to
3d1275d
Compare
Description
This pr remove the mnemonic from CreateWallet request, instead we return the mnemonic
and add RestoreWallet endpoint which takes a mnemonic as a input, and restore it
Related issue(s)
#1210