Skip to content
This repository was archived by the owner on Apr 16, 2024. It is now read-only.

Commit a5889ca

Browse files
authored
chore: Remove GetEncodingConfig method (#35)
1 parent 321f3d5 commit a5889ca

File tree

3 files changed

+17
-39
lines changed

3 files changed

+17
-39
lines changed

config/babylon_config.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package config
22

33
import (
44
"fmt"
5+
bbn "github.com/babylonchain/babylon/app"
6+
"github.com/cosmos/cosmos-sdk/types/module"
57
"net/url"
68
"os"
79
"path/filepath"
@@ -44,6 +46,11 @@ func (cfg *BabylonConfig) Validate() error {
4446
}
4547

4648
func (cfg *BabylonConfig) Unwrap() *client.ChainClientConfig {
49+
var moduleBasics []module.AppModuleBasic
50+
for _, mbasic := range bbn.ModuleBasics {
51+
moduleBasics = append(moduleBasics, mbasic)
52+
}
53+
4754
return &client.ChainClientConfig{
4855
Key: cfg.Key,
4956
ChainID: cfg.ChainID,
@@ -58,7 +65,7 @@ func (cfg *BabylonConfig) Unwrap() *client.ChainClientConfig {
5865
Timeout: cfg.Timeout.String(),
5966
OutputFormat: cfg.OutputFormat,
6067
SignModeStr: cfg.SignModeStr,
61-
Modules: ModuleBasics,
68+
Modules: moduleBasics,
6269
}
6370
}
6471

config/babylon_config_test.go

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package config_test
22

33
import (
4+
bbn "github.com/babylonchain/babylon/app"
5+
"github.com/cosmos/cosmos-sdk/types/module"
46
"testing"
57

68
"github.com/babylonchain/rpc-client/config"
@@ -15,8 +17,12 @@ func TestBabylonConfig(t *testing.T) {
1517

1618
// ensure the unwrapped config has Babylon codec formats
1719
lensConfig := defaultConfig.Unwrap()
18-
require.Equal(t, len(config.ModuleBasics), len(lensConfig.Modules))
19-
for i := range config.ModuleBasics {
20-
require.Equal(t, config.ModuleBasics[i].Name(), lensConfig.Modules[i].Name())
20+
lensConfigModulesMap := make(map[string]module.AppModuleBasic, len(lensConfig.Modules))
21+
for i := range lensConfig.Modules {
22+
lensConfigModulesMap[lensConfig.Modules[i].Name()] = lensConfig.Modules[i]
23+
}
24+
require.Equal(t, len(bbn.ModuleBasics), len(lensConfig.Modules))
25+
for modName := range lensConfigModulesMap {
26+
require.Equal(t, bbn.ModuleBasics[modName].Name(), lensConfigModulesMap[modName].Name())
2127
}
2228
}

config/codec.go

-35
This file was deleted.

0 commit comments

Comments
 (0)