eip712

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2025 License: Apache-2.0 Imports: 37 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthWeb3        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowWeb3          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupWeb3 = fmt.Errorf("proto: unexpected end of group")
)

Functions

func FlattenPayloadMessages

func FlattenPayloadMessages(payload gjson.Result) (gjson.Result, int, error)

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

func GetEIP712BytesForMsg(signDocBytes []byte) ([]byte, error)

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

func GetEIP712TypedDataForMsg(signDocBytes []byte) (apitypes.TypedData, error)

GetEIP712TypedDataForMsg returns the EIP-712 TypedData representation for either Amino or Protobuf encoded signature doc bytes.

func LegacyGetEIP712BytesForMsg

func LegacyGetEIP712BytesForMsg(signDocBytes []byte) ([]byte, error)

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

func LegacyGetEIP712TypedDataForMsg(signDocBytes []byte, eip155ChainID uint64) (apitypes.TypedData, error)

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 PreprocessLedgerTx

func PreprocessLedgerTx(evmChainID uint64, keyType cosmoskr.KeyType, txBuilder client.TxBuilder) error

PreprocessLedgerTx reformats Ledger-signed Cosmos transactions to match the fork expected by Cosmos EVM by including the signature in a Web3Tx extension and sending a blank signature in the body.

func RegisterInterfaces added in v0.5.0

func RegisterInterfaces(registry codectypes.InterfaceRegistry)

RegisterInterfaces registers the CometBFT concrete client-related implementations and interfaces.

func SetEncodingConfig

func SetEncodingConfig(cdc *codec.LegacyAmino, interfaceRegistry types.InterfaceRegistry, evmChainID uint64)

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 WrapTxToTypedData

func WrapTxToTypedData(
	chainID uint64,
	data []byte,
) (apitypes.TypedData, error)

WrapTxToTypedData wraps an Amino-encoded Cosmos Tx JSON SignDoc bytestream into an EIP712-compatible TypedData request.

Types

type ExtensionOptionsWeb3Tx added in v0.5.0

type ExtensionOptionsWeb3Tx struct {
	// typed_data_chain_id is used only in EIP712 Domain and should match
	// Ethereum network ID in a Web3 provider (e.g. Metamask).
	TypedDataChainID uint64 `protobuf:"varint,1,opt,name=typed_data_chain_id,json=typedDataChainId,proto3" json:"typedDataChainID,omitempty"`
	// fee_payer is an account address for the fee payer. It will be validated
	// during EIP712 signature checking.
	FeePayer string `protobuf:"bytes,2,opt,name=fee_payer,json=feePayer,proto3" json:"feePayer,omitempty"`
	// fee_payer_sig is a signature data from the fee paying account,
	// allows to perform fee delegation when using EIP712 Domain.
	FeePayerSig []byte `protobuf:"bytes,3,opt,name=fee_payer_sig,json=feePayerSig,proto3" json:"feePayerSig,omitempty"`
}

ExtensionOptionsWeb3Tx is an extension option that specifies the typed chain id, the fee payer as well as its signature data.

func (*ExtensionOptionsWeb3Tx) Descriptor added in v0.5.0

func (*ExtensionOptionsWeb3Tx) Descriptor() ([]byte, []int)

func (*ExtensionOptionsWeb3Tx) Marshal added in v0.5.0

func (m *ExtensionOptionsWeb3Tx) Marshal() (dAtA []byte, err error)

func (*ExtensionOptionsWeb3Tx) MarshalTo added in v0.5.0

func (m *ExtensionOptionsWeb3Tx) MarshalTo(dAtA []byte) (int, error)

func (*ExtensionOptionsWeb3Tx) MarshalToSizedBuffer added in v0.5.0

func (m *ExtensionOptionsWeb3Tx) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ExtensionOptionsWeb3Tx) ProtoMessage added in v0.5.0

func (*ExtensionOptionsWeb3Tx) ProtoMessage()

func (*ExtensionOptionsWeb3Tx) Reset added in v0.5.0

func (m *ExtensionOptionsWeb3Tx) Reset()

func (*ExtensionOptionsWeb3Tx) Size added in v0.5.0

func (m *ExtensionOptionsWeb3Tx) Size() (n int)

func (*ExtensionOptionsWeb3Tx) String added in v0.5.0

func (m *ExtensionOptionsWeb3Tx) String() string

func (*ExtensionOptionsWeb3Tx) Unmarshal added in v0.5.0

func (m *ExtensionOptionsWeb3Tx) Unmarshal(dAtA []byte) error

func (*ExtensionOptionsWeb3Tx) XXX_DiscardUnknown added in v0.5.0

func (m *ExtensionOptionsWeb3Tx) XXX_DiscardUnknown()

func (*ExtensionOptionsWeb3Tx) XXX_Marshal added in v0.5.0

func (m *ExtensionOptionsWeb3Tx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ExtensionOptionsWeb3Tx) XXX_Merge added in v0.5.0

func (m *ExtensionOptionsWeb3Tx) XXX_Merge(src proto.Message)

func (*ExtensionOptionsWeb3Tx) XXX_Size added in v0.5.0

func (m *ExtensionOptionsWeb3Tx) XXX_Size() int

func (*ExtensionOptionsWeb3Tx) XXX_Unmarshal added in v0.5.0

func (m *ExtensionOptionsWeb3Tx) XXX_Unmarshal(b []byte) error

type FeeDelegationOptions

type FeeDelegationOptions struct {
	FeePayer sdk.AccAddress
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL