eip712

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: LGPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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) (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(chainID string, keyType cosmoskr.KeyType, txBuilder client.TxBuilder) error

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

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 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 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