-
Notifications
You must be signed in to change notification settings - Fork 558
/
codec.go
40 lines (32 loc) · 1020 Bytes
/
codec.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package util
import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdk "github.com/cosmos/cosmos-sdk/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
osmosisApp "github.com/osmosis-labs/osmosis/v10/app"
"github.com/osmosis-labs/osmosis/v10/app/params"
)
var (
EncodingConfig params.EncodingConfig
Cdc codec.Codec
)
func init() {
EncodingConfig, Cdc = initEncodingConfigAndCdc()
}
func initEncodingConfigAndCdc() (params.EncodingConfig, codec.Codec) {
encodingConfig := osmosisApp.MakeEncodingConfig()
encodingConfig.InterfaceRegistry.RegisterImplementations(
(*sdk.Msg)(nil),
&stakingtypes.MsgCreateValidator{},
)
encodingConfig.InterfaceRegistry.RegisterImplementations(
(*cryptotypes.PubKey)(nil),
&secp256k1.PubKey{},
&ed25519.PubKey{},
)
cdc := encodingConfig.Marshaler
return encodingConfig, cdc
}