Documentation ¶
Index ¶
- func CreateEIP712Domain(chainID uint64) apitypes.TypedDataDomain
- func CreateEIP712MessagePayload(data []byte, chain string) (eip712MessagePayload, error)
- func CreateEIP712Types(messagePayload eip712MessagePayload) (apitypes.Types, error)
- func FlattenPayloadMessages(payload gjson.Result) (gjson.Result, int, error)
- func GetEIP712BytesForMsg(signDocBytes []byte) ([]byte, error)
- func GetEIP712TypedDataForMsg(signDocBytes []byte) (apitypes.TypedData, error)
- func GetPopulatedSchemaForMsg(msg gjson.Result) (gjson.Result, error)
- func GetSchemas() []string
- func LegacyGetEIP712BytesForMsg(signDocBytes []byte) ([]byte, error)
- func LegacyGetEIP712TypedDataForMsg(signDocBytes []byte) (apitypes.TypedData, error)
- func LegacyWrapTxToTypedData(cdc codectypes.AnyUnpacker, chainID uint64, msg sdk.Msg, data []byte, ...) (apitypes.TypedData, error)
- func NormalizeEIP712TypedData(typedData apitypes.TypedData) (apitypes.TypedData, error)
- func NormalizeEmptyTypes(typedData apitypes.TypedData, typeObjArr []apitypes.Type, ...) (map[string]interface{}, error)
- func SetEncodingConfig(cfg params.EncodingConfig)
- func UnmarshalBytesToJSONObject(data []byte) (gjson.Result, error)
- func WrapTxToTypedData(chainID uint64, data []byte, chain string) (apitypes.TypedData, error)
- type FeeDelegationOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateEIP712Domain ¶
func CreateEIP712Domain(chainID uint64) apitypes.TypedDataDomain
createEIP712Domain creates the typed data domain for the given chainID.
func CreateEIP712MessagePayload ¶
createEIP712MessagePayload generates the EIP-712 message payload corresponding to the input data.
func CreateEIP712Types ¶
getEIP712Types creates and returns the EIP-712 types for the given message payload.
func FlattenPayloadMessages ¶
FlattenPayloadMessages flattens the input payload's messages, representing them as key-value pairs of "msg{i}": {Msg}, rather than as an array of Msgs. We do this to support messages with different schemas.
func GetEIP712BytesForMsg ¶
GetEIP712BytesForMsg returns the EIP-712 object bytes for the given SignDoc bytes by decoding the bytes into an EIP-712 object, then converting via WrapTxToTypedData. See https://eips.ethereum.org/EIPS/eip-712 for more.
func GetEIP712TypedDataForMsg ¶
GetEIP712TypedDataForMsg returns the EIP-712 TypedData representation for either Amino or Protobuf encoded signature doc bytes.
func GetPopulatedSchemaForMsg ¶
GetPopulatedSchemaForMsg returns a sample JSON object for a given message type with all potentially optional fields populated
func GetSchemas ¶
func GetSchemas() []string
GetSchemas returns all the schemas for the EIP712 types
func LegacyGetEIP712BytesForMsg ¶
LegacyGetEIP712BytesForMsg returns the EIP-712 object bytes for the given SignDoc bytes by decoding the bytes into an EIP-712 object, then converting via LegacyWrapTxToTypedData. See https://eips.ethereum.org/EIPS/eip-712 for more.
func LegacyGetEIP712TypedDataForMsg ¶
LegacyGetEIP712TypedDataForMsg returns the EIP-712 TypedData representation for either Amino or Protobuf encoded signature doc bytes.
func LegacyWrapTxToTypedData ¶
func LegacyWrapTxToTypedData( cdc codectypes.AnyUnpacker, chainID uint64, msg sdk.Msg, data []byte, feeDelegation *FeeDelegationOptions, ) (apitypes.TypedData, error)
LegacyWrapTxToTypedData is an ultimate method that wraps Amino-encoded Cosmos Tx JSON data into an EIP712-compatible TypedData request.
func NormalizeEIP712TypedData ¶
Recursively iterate through message and populate empty fields with default falsy values
func NormalizeEmptyTypes ¶
func NormalizeEmptyTypes(typedData apitypes.TypedData, typeObjArr []apitypes.Type, mapObject map[string]interface{}) (map[string]interface{}, error)
NormalizeEmptyTypes is a recursive function that adds empty values to fields that are omitted when serialized with Proto and Amino. EIP712 doesn't support optional fields, so we add the omitted empty values back in here. This includes empty strings, when a uint64 is 0, and when a bool is false.
func SetEncodingConfig ¶
func SetEncodingConfig(cfg params.EncodingConfig)
SetEncodingConfig set the encoding config to the singleton codecs (Amino and Protobuf). The process of unmarshaling SignDoc bytes into a SignDoc object requires having a codec populated with all relevant message types. As a result, we must call this method on app initialization with the app's encoding config.
func UnmarshalBytesToJSONObject ¶
unmarshalBytesToJSONObject converts a bytestream into a JSON object, then makes sure the JSON is an object.
Types ¶
type FeeDelegationOptions ¶
type FeeDelegationOptions struct {
FeePayer sdk.AccAddress
}