Skip to content

Commit

Permalink
interface
Browse files Browse the repository at this point in the history
  • Loading branch information
aljo242 committed May 14, 2024
1 parent fd76dfc commit 056d7ba
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion sample/sample.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
package sample

import (
"cosmossdk.io/x/tx/signing"
"github.com/cosmos/cosmos-sdk/codec/address"
"github.com/cosmos/gogoproto/proto"
"math/rand"
"strconv"
"testing"
Expand All @@ -26,7 +29,21 @@ import (
type ExtraRegistries func(codectypes.InterfaceRegistry)

func InterfaceRegistry(registries ...ExtraRegistries) codectypes.InterfaceRegistry {
interfaceRegistry := codectypes.NewInterfaceRegistry()
interfaceRegistry, err := codectypes.NewInterfaceRegistryWithOptions(codectypes.InterfaceRegistryOptions{
ProtoFiles: proto.HybridResolver,
SigningOptions: signing.Options{
AddressCodec: address.Bech32Codec{
Bech32Prefix: sdk.GetConfig().GetBech32AccountAddrPrefix(),
},
ValidatorAddressCodec: address.Bech32Codec{
Bech32Prefix: sdk.GetConfig().GetBech32ValidatorAddrPrefix(),
},
},
})

if err != nil {
panic(err)
}

// always register
cryptocodec.RegisterInterfaces(interfaceRegistry)
Expand Down

0 comments on commit 056d7ba

Please sign in to comment.