chore(all)!: use gogoproto/any instead of codec/types/any (#21013)

This commit is contained in:
Facundo Medica
2024-07-22 11:23:51 +00:00
committed by GitHub
parent 71d14f9370
commit 9ab162de6d
48 changed files with 222 additions and 191 deletions
+7 -8
View File
@@ -4,8 +4,7 @@ import (
"fmt"
"github.com/cosmos/gogoproto/proto"
"github.com/cosmos/cosmos-sdk/codec/types"
gogoprotoany "github.com/cosmos/gogoproto/types/any"
)
type Animal interface {
@@ -32,9 +31,9 @@ func (d Dog) Greet() string {
return fmt.Sprintf("Roof, my name is %s", d.Name)
}
var _ types.UnpackInterfacesMessage = HasAnimal{}
var _ gogoprotoany.UnpackInterfacesMessage = HasAnimal{}
func (m HasAnimal) UnpackInterfaces(unpacker types.AnyUnpacker) error {
func (m HasAnimal) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error {
var animal Animal
return unpacker.UnpackAny(m.Animal, &animal)
}
@@ -59,9 +58,9 @@ func (m HasHasAnimal) TheHasAnimal() HasAnimalI {
return m.HasAnimal.GetCachedValue().(HasAnimalI)
}
var _ types.UnpackInterfacesMessage = HasHasAnimal{}
var _ gogoprotoany.UnpackInterfacesMessage = HasHasAnimal{}
func (m HasHasAnimal) UnpackInterfaces(unpacker types.AnyUnpacker) error {
func (m HasHasAnimal) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error {
var animal HasAnimalI
return unpacker.UnpackAny(m.HasAnimal, &animal)
}
@@ -76,9 +75,9 @@ func (m HasHasHasAnimal) TheHasHasAnimal() HasHasAnimalI {
return m.HasHasAnimal.GetCachedValue().(HasHasAnimalI)
}
var _ types.UnpackInterfacesMessage = HasHasHasAnimal{}
var _ gogoprotoany.UnpackInterfacesMessage = HasHasHasAnimal{}
func (m HasHasHasAnimal) UnpackInterfaces(unpacker types.AnyUnpacker) error {
func (m HasHasHasAnimal) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error {
var animal HasHasAnimalI
return unpacker.UnpackAny(m.HasHasAnimal, &animal)
}
+5 -4
View File
@@ -5,6 +5,7 @@ import (
"fmt"
"testing"
gogoprotoany "github.com/cosmos/gogoproto/types/any"
"github.com/cosmos/gogoproto/types/any/test"
"github.com/cosmos/gogoproto/proto"
@@ -49,16 +50,16 @@ func (e QueryImpl) SayHello(_ context.Context, request *SayHelloRequest) (*SayHe
return &SayHelloResponse{Greeting: greeting}, nil
}
var _ types.UnpackInterfacesMessage = &TestAnyRequest{}
var _ gogoprotoany.UnpackInterfacesMessage = &TestAnyRequest{}
func (m *TestAnyRequest) UnpackInterfaces(unpacker types.AnyUnpacker) error {
func (m *TestAnyRequest) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error {
var animal test.Animal
return unpacker.UnpackAny(m.AnyAnimal, &animal)
}
var _ types.UnpackInterfacesMessage = &TestAnyResponse{}
var _ gogoprotoany.UnpackInterfacesMessage = &TestAnyResponse{}
func (m *TestAnyResponse) UnpackInterfaces(unpacker types.AnyUnpacker) error {
func (m *TestAnyResponse) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error {
return m.HasAnimal.UnpackInterfaces(unpacker)
}