Skip to content

Commit

Permalink
fix(app.go): remove unused ipfsClient variable to improve code readab…
Browse files Browse the repository at this point in the history
…ility and reduce complexity

fix(keeper.go): fix import path for curves package to match the correct package location
fix(vault.go): fix return type of NewController function to return a controller instance instead of an error
  • Loading branch information
prnk28 committed Apr 25, 2024
1 parent 29e8c90 commit f491030
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
9 changes: 6 additions & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,6 @@ type ChainApp struct {
// module configurator
configurator module.Configurator
once sync.Once

// network rails
ipfsClient ipfs.IPFSClient
}

// NewChainApp returns a reference to an initialized ChainApp.
Expand Down Expand Up @@ -312,6 +309,11 @@ func NewChainApp(
std.RegisterLegacyAminoCodec(legacyAmino)
std.RegisterInterfaces(interfaceRegistry)

ipfsClient, err := ipfs.NewLocalClient()
if err != nil {
panic(err)
}

// Below we could construct and set an application specific mempool and
// ABCI 1.0 PrepareProposal and ProcessProposal handlers. These defaults are
// already set in the SDK's BaseApp, this shows an example of how to override
Expand Down Expand Up @@ -624,6 +626,7 @@ func NewChainApp(
app.IBCKeeper.ChannelKeeper,
app.BankKeeper,
app.AccountKeeper,
ipfsClient,
)

// Create the svc Middleware Keeper
Expand Down
2 changes: 1 addition & 1 deletion x/idx/keeper/keeper.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package keeper

import (
"github.com/di-dao/crypto/core/curves"
"github.com/di-dao/common/crypto/core/curves"
"github.com/di-dao/sonr/pkg/ipfs"
"github.com/di-dao/sonr/x/idx/types"

Expand Down
17 changes: 6 additions & 11 deletions x/idx/keeper/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,15 @@ type vaultStore struct {
}

// NewController creates a new controller instance.
func (v vaultStore) NewController() error {
func (v vaultStore) NewController() (controller, error) {
valKs, usrKs, err := generateKSS()
if err != nil {
return err
return controller{}, err
}
controller
return nil
}

func (v vaultStore) NewIPNSKey() error {
valKs, usrKs, err := generateKSS()
if err != nil {
return err
controller := controller{
valKS: valKs,
usrKS: usrKs,
}

return nil
return controller, nil
}

0 comments on commit f491030

Please sign in to comment.