tx

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: LGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultFee = sdk.NewCoin(config.BaseDenom, sdk.NewIntFromUint64(uint64(feeAmt))) // 0.01 EVMOS
)

Functions

func GasLimit

func GasLimit(ctx sdk.Context, from common.Address, data evmtypes.HexString, queryClientEvm evmtypes.QueryClient) (uint64, error)

GasLimit estimates the gas limit for the provided parameters. To achieve this, need to provide the corresponding QueryClient to call the `eth_estimateGas` rpc method. If not provided, returns a default value

func GenerateAddress

func GenerateAddress() common.Address

GenerateAddress generates an Ethereum address.

func NewAddrKey

func NewAddrKey() (common.Address, *ethsecp256k1.PrivKey)

NewAddrKey generates an Ethereum address and its corresponding private key.

func NewSigner

func NewSigner(sk cryptotypes.PrivKey) keyring.Signer

func PrepareCosmosTx

func PrepareCosmosTx(
	ctx sdk.Context,
	appSettlus *app.App,
	args CosmosTxArgs,
) (authsigning.Tx, error)

PrepareCosmosTx creates a cosmos tx and signs it with the provided messages and private key. It returns the signed transaction and an error

func PrepareEthTx

func PrepareEthTx(
	txCfg client.TxConfig,
	appSettlus *app.App,
	priv cryptotypes.PrivKey,
	msgs ...sdk.Msg,
) (authsigning.Tx, error)

PrepareEthTx creates an ethereum tx and signs it with the provided messages and private key. It returns the signed transaction and an error

Types

type CosmosTxArgs

type CosmosTxArgs struct {
	// TxCfg is the client transaction config
	TxCfg client.TxConfig
	// Priv is the private key that will be used to sign the tx
	Priv cryptotypes.PrivKey
	// ChainID is the chain's id on cosmos format, e.g. 'evmos_9000-1'
	ChainID string
	// Gas to be used on the tx
	Gas uint64
	// GasPrice to use on tx
	GasPrice *sdkmath.Int
	// Fees is the fee to be used on the tx (amount and denom)
	Fees sdk.Coins
	// FeeGranter is the account address of the fee granter
	FeeGranter sdk.AccAddress
	// Msgs slice of messages to include on the tx
	Msgs []sdk.Msg
}

CosmosTxArgs contains the params to create a cosmos tx

type InvalidTx

type InvalidTx struct{}

InvalidTx defines a type, which satisfies the sdk.Tx interface, but holds no valid transaction information.

NOTE: This is used for testing purposes, to serve the edge case of invalid data being passed to functions.

func (InvalidTx) GetMsgs

func (InvalidTx) GetMsgs() []sdk.Msg

func (InvalidTx) ValidateBasic

func (InvalidTx) ValidateBasic() error

type Signer

type Signer struct {
	// contains filtered or unexported fields
}

Signer defines a type that is used on testing for signing MsgEthereumTx

func (Signer) Sign

func (s Signer) Sign(_ string, msg []byte) ([]byte, cryptotypes.PubKey, error)

Sign signs the message using the underlying private key

func (Signer) SignByAddress

func (s Signer) SignByAddress(address sdk.Address, msg []byte) ([]byte, cryptotypes.PubKey, error)

SignByAddress sign byte messages with a user key providing the address.

Jump to

Keyboard shortcuts

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