Integrate keystore with chain/wallet

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
This commit is contained in:
Jakub Sztandera
2019-07-18 17:41:30 +02:00
parent cb9bf4200c
commit 710f87fdf4
4 changed files with 109 additions and 56 deletions
+1 -1
View File
@@ -110,7 +110,7 @@ func (a *API) WalletNew(ctx context.Context, typ string) (address.Address, error
}
func (a *API) WalletList(ctx context.Context) ([]address.Address, error) {
return a.Wallet.ListAddrs(), nil
return a.Wallet.ListAddrs()
}
func (a *API) NetConnect(ctx context.Context, p peer.AddrInfo) error {
+7
View File
@@ -24,6 +24,7 @@ import (
"github.com/filecoin-project/go-lotus/api"
"github.com/filecoin-project/go-lotus/chain"
"github.com/filecoin-project/go-lotus/chain/types"
"github.com/filecoin-project/go-lotus/node/config"
"github.com/filecoin-project/go-lotus/node/hello"
"github.com/filecoin-project/go-lotus/node/modules"
@@ -213,6 +214,10 @@ func Repo(r repo.Repo) Option {
if err != nil {
return Error(err)
}
kstore, err := lr.KeyStore()
if err != nil {
return Error(err)
}
return Options(
Config(cfg),
@@ -227,6 +232,8 @@ func Repo(r repo.Repo) Option {
Override(new(ci.PrivKey), pk),
Override(new(ci.PubKey), ci.PrivKey.GetPublic),
Override(new(peer.ID), peer.IDFromPublicKey),
Override(new(types.KeyStore), kstore),
)
}