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

Update encoding.go #330

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions app/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
oracleconfig "github.com/skip-mev/connect/v2/oracle/config"
)

// newTempApp creates a temporary InitiaApp instance for configuration purposes.
func newTempApp() *InitiaApp {
return NewInitiaApp(
log.NewNopLogger(),
Expand All @@ -29,20 +30,22 @@ func newTempApp() *InitiaApp {
)
}

// MakeEncodingConfig generates the encoding configuration for the application.
func MakeEncodingConfig() params.EncodingConfig {
tempApp := newTempApp()
encodingConfig := params.EncodingConfig{
return params.EncodingConfig{
InterfaceRegistry: tempApp.InterfaceRegistry(),
Codec: tempApp.AppCodec(),
TxConfig: tempApp.TxConfig(),
Amino: tempApp.LegacyAmino(),
}

return encodingConfig
}

// AutoCliOpts prepares the AutoCLI options for the application.
func AutoCliOpts() autocli.AppOptions {
tempApp := newTempApp()

// Extract modules with AutoCLI support
modules := make(map[string]appmodule.AppModule, 0)
for _, m := range tempApp.ModuleManager.Modules {
if moduleWithName, ok := m.(module.HasName); ok {
Expand All @@ -62,19 +65,19 @@ func AutoCliOpts() autocli.AppOptions {
}
}

// BasicManager returns the BasicManager for the application.
func BasicManager() module.BasicManager {
tempApp := newTempApp()
return tempApp.BasicModuleManager
}

// EmptyAppOptions is a stub implementing AppOptions
// EmptyAppOptions is a stub implementation of AppOptions.
type EmptyAppOptions struct{}

// Get implements AppOptions
// Get retrieves the value for a given option key.
func (ao EmptyAppOptions) Get(o string) interface{} {
if o == flags.FlagHome {
return DefaultNodeHome
}

return nil
}