Skip to content

Commit

Permalink
pass *codec.AminoCodec as function argument in keyring.New
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberbono3 committed May 4, 2021
1 parent 059aa39 commit 3a420d2
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions crypto/keyring/keyring.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,21 +165,20 @@ type Options struct {
// NewInMemory creates a transient keyring useful for testing
// purposes and on-the-fly key generation.
// Keybase options can be applied when generating this new Keybase.
func NewInMemory(cdc codec.AminoCodec, opts ...Option) Keyring {
func NewInMemory(cdc *codec.AminoCodec, opts ...Option) Keyring {
return newKeystore(keyring.NewArrayKeyring(nil), cdc, opts...)
}

// New creates a new instance of a keyring.
// Keyring ptions can be applied when generating the new instance.
// Available backends are "os", "file", "kwallet", "memory", "pass", "test".
func New(
appName, backend, rootDir string, userInput io.Reader, opts ...Option,
appName, backend, rootDir string, userInput io.Reader, cdc *codec.AminoCodec, opts ...Option,
) (Keyring, error) {
var (
db keyring.Keyring
err error
)
cdc := codec.NewAminoCodec(codec.NewLegacyAmino()) //?

switch backend {
case BackendMemory:
Expand Down Expand Up @@ -207,11 +206,11 @@ func New(

type keystore struct {
db keyring.Keyring
cdc codec.Marshaler
cdc *codec.AminoCodec
options Options
}

func newKeystore(kr keyring.Keyring, cdc codec.Marshaler, opts ...Option) keystore {
func newKeystore(kr keyring.Keyring, cdc *codec.AminoCodec, opts ...Option) keystore {
// Default options for keybase
options := Options{
SupportedAlgos: SigningAlgoList{hd.Secp256k1},
Expand Down

0 comments on commit 3a420d2

Please sign in to comment.