Documentation ¶
Overview ¶
Package any is a helper library to be used as a replacement for some of the official "google.golang.org/protobuf/types/known/anypb"'s functions which prepend the "type.googleapis.com" prefix in type URLs.
In the Cosmos SDK, an Any's TypeURL starts with a `/` character, e.g. "/cosmos.bank.v1beta1.MsgSend". However, if we pack this MsgSend into an anypb.Any using the offical anypb package's helper functions, we get a TypeURL which is "type.googleapis.com/cosmos.bank.v1beta1.MsgSend".
Therefore, the following 3 functions/methods cannot be used within the Cosmos context: - anypb.New - anypb.MarshalFrom - anypb.Any#MarshalFrom as all of them append the unwanted prefix.
This package exposes the `New` and `MarshalFrom` helper functions, which do not prepend any prefix to type URLs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalFrom ¶
MarshalFrom marshals src into dst as the underlying message using the provided marshal options.
If no options are specified, call dst.MarshalFrom instead.
func Unpack ¶
func Unpack(any *anypb.Any, fileResolver protodesc.Resolver, typeResolver protoregistry.MessageTypeResolver) (proto.Message, error)
Unpack unpacks the message inside an any, first using the provided typeResolver (defaults to protoregistry.GlobalTypes), and if that fails, then using the provided fileResolver (defaults to protoregistry.GlobalFiles) with dynamicpb.
Types ¶
This section is empty.