Documentation
¶
Index ¶
- type AddressCodec
- type Context
- func (c *Context) AddressCodec() AddressCodec
- func (c *Context) FileResolver() ProtoFileResolver
- func (c *Context) GetSigners(msg proto.Message) ([][]byte, error)
- func (c *Context) TypeResolver() protoregistry.MessageTypeResolver
- func (c *Context) Validate() error
- func (c *Context) ValidatorAddressCodec() AddressCodec
- type CustomGetSigner
- type GetSignersFunc
- type HandlerMap
- type Options
- type ProtoFileResolver
- type SignModeHandler
- type SignerData
- type TxData
- type TypeResolver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddressCodec ¶ added in v1.0.1
type AddressCodec interface {
StringToBytes(string) ([]byte, error)
BytesToString([]byte) (string, error)
}
AddressCodec is the cosmossdk.io/core/address codec interface used by the context.
type Context ¶ added in v0.5.2
type Context struct {
// contains filtered or unexported fields
}
Context is a context for retrieving the list of signers from a message where signers are specified by the cosmos.msg.v1.signer protobuf option. It also contains the ProtoFileResolver and address.Codec's used for resolving message descriptors and converting addresses.
func NewContext ¶ added in v0.5.2
NewContext creates a new Context using the provided options.
func (*Context) AddressCodec ¶ added in v0.5.2
func (c *Context) AddressCodec() AddressCodec
AddressCodec returns the address codec used by the context.
func (*Context) FileResolver ¶ added in v0.5.2
func (c *Context) FileResolver() ProtoFileResolver
FileResolver returns the protobuf file resolver used by the context.
func (*Context) GetSigners ¶ added in v0.5.2
GetSigners returns the signers for a given message.
func (*Context) TypeResolver ¶ added in v0.5.2
func (c *Context) TypeResolver() protoregistry.MessageTypeResolver
TypeResolver returns the protobuf type resolver used by the context.
func (*Context) Validate ¶ added in v0.6.2
Validate performs a dry run of getting all msg's signers. This has 2 benefits: - it will error if any Msg has forgotten the "cosmos.msg.v1.signer" annotation - it will pre-populate the context's internal cache for getSignersFuncs so that calling it in antehandlers will be faster.
func (*Context) ValidatorAddressCodec ¶ added in v0.5.2
func (c *Context) ValidatorAddressCodec() AddressCodec
ValidatorAddressCodec returns the validator address codec used by the context.
type CustomGetSigner ¶ added in v0.8.0
type CustomGetSigner struct {
MsgType protoreflect.FullName
Fn GetSignersFunc
}
CustomGetSigner is a custom GetSignersFunc that is defined for a specific message type.
func (CustomGetSigner) IsManyPerContainerType ¶ added in v0.8.0
func (c CustomGetSigner) IsManyPerContainerType()
type GetSignersFunc ¶ added in v0.8.0
GetSignersFunc returns the signers for a given message.
type HandlerMap ¶ added in v0.2.0
type HandlerMap struct {
// contains filtered or unexported fields
}
HandlerMap aggregates several sign mode handlers together for convenient generation of sign bytes based on sign mode.
func NewHandlerMap ¶ added in v0.2.0
func NewHandlerMap(handlers ...SignModeHandler) *HandlerMap
NewHandlerMap constructs a new sign mode handler map. The first handler is used as the default.
func (*HandlerMap) DefaultMode ¶ added in v0.5.5
func (h *HandlerMap) DefaultMode() signingv1beta1.SignMode
DefaultMode returns the default mode for this handler map.
func (*HandlerMap) GetSignBytes ¶ added in v0.2.0
func (h *HandlerMap) GetSignBytes(ctx context.Context, signMode signingv1beta1.SignMode, signerData SignerData, txData TxData) ([]byte, error)
GetSignBytes returns the sign bytes for the transaction for the requested mode.
func (*HandlerMap) SupportedModes ¶ added in v0.2.0
func (h *HandlerMap) SupportedModes() []signingv1beta1.SignMode
SupportedModes lists the modes supported by this handler map.
type Options ¶ added in v0.5.2
type Options struct {
// FileResolver is the protobuf file resolver to use for resolving message descriptors.
// If it is nil, the global protobuf registry will be used.
FileResolver ProtoFileResolver
// TypeResolver is the protobuf type resolver to use for resolving message types.
TypeResolver TypeResolver
// AddressCodec is the codec for converting addresses between strings and bytes.
AddressCodec AddressCodec
// ValidatorAddressCodec is the codec for converting validator addresses between strings and bytes.
ValidatorAddressCodec AddressCodec
// CustomGetSigners is a map of message types to custom GetSignersFuncs.
CustomGetSigners map[protoreflect.FullName]GetSignersFunc
// MaxRecursionDepth is the maximum depth of nested messages that will be traversed
MaxRecursionDepth int
}
Options are options for creating Context which will be used for signing operations.
func (*Options) DefineCustomGetSigners ¶ added in v0.8.0
func (o *Options) DefineCustomGetSigners(typeName protoreflect.FullName, f GetSignersFunc)
DefineCustomGetSigners defines a custom GetSigners function for a given message type.
NOTE: if a custom signers function is defined, the message type used to define this function MUST be the concrete type passed to GetSigners, otherwise a runtime type error will occur.
type ProtoFileResolver ¶ added in v0.5.0
type ProtoFileResolver interface {
protodesc.Resolver
RangeFiles(func(protoreflect.FileDescriptor) bool)
}
ProtoFileResolver is a protodesc.Resolver that also allows iterating over all files descriptors. It is a subset of the methods supported by protoregistry.Files.
type SignModeHandler ¶ added in v0.2.0
type SignModeHandler interface {
// Mode is the sign mode supported by this handler
Mode() signingv1beta1.SignMode
// GetSignBytes returns the sign bytes for the provided SignerData and TxData, or an error.
GetSignBytes(ctx context.Context, signerData SignerData, txData TxData) ([]byte, error)
}
SignModeHandler is the interface that handlers for each sign mode should implement to generate sign bytes.
type SignerData ¶
type SignerData struct {
// The address of the signer.
//
// In case of multisigs, this should be the multisig's address.
Address string
// ChainID is the chain that this transaction is targeting.
ChainID string
// AccountNumber is the account number of the signer.
//
// In case of multisigs, this should be the multisig account number.
AccountNumber uint64
// Sequence is the account sequence number of the signer that is used
// for replay protection. This field is only useful for Legacy Amino signing,
// since in SIGN_MODE_DIRECT the account sequence is already in the signer
// info.
//
// In case of multisigs, this should be the multisig sequence.
Sequence uint64
// PubKey is the public key of the signer.
//
// In case of multisigs, this should be the pubkey of the member of the
// multisig that is signing the current sign doc.
PubKey *anypb.Any
}
SignerData is the specific information needed to sign a transaction that generally isn't included in the transaction body itself
type TxData ¶ added in v0.2.0
type TxData struct {
// Body is the TxBody that will be part of the transaction.
Body *txv1beta1.TxBody
// AuthInfo is the AuthInfo that will be part of the transaction.
AuthInfo *txv1beta1.AuthInfo
// BodyBytes is the marshaled body bytes that will be part of TxRaw.
BodyBytes []byte
// AuthInfoBytes is the marshaled AuthInfo bytes that will be part of TxRaw.
AuthInfoBytes []byte
// BodyHasUnknownNonCriticals should be set to true if the transaction has been
// decoded and found to have unknown non-critical fields. This is only needed
// for amino JSON signing.
BodyHasUnknownNonCriticals bool
}
TxData is the data about a transaction that is necessary to generate sign bytes.
type TypeResolver ¶ added in v0.9.0
type TypeResolver interface {
protoregistry.MessageTypeResolver
protoregistry.ExtensionTypeResolver
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
internal/aminojsonpb
Code generated by protoc-gen-go-pulsar.
|
Code generated by protoc-gen-go-pulsar. |
|
internal/testpb
Code generated by protoc-gen-go-pulsar.
|
Code generated by protoc-gen-go-pulsar. |
|
internal/cbor
Package cbor implements just enough of the CBOR (Concise Binary Object Representation, RFC 8948) to deterministically encode simple data.
|
Package cbor implements just enough of the CBOR (Concise Binary Object Representation, RFC 8948) to deterministically encode simple data. |
|
internal/textualpb
Package textualpb contains all protobuf definitions and generated codes used internally by Textual.
|
Package textualpb contains all protobuf definitions and generated codes used internally by Textual. |