Documentation ¶
Overview ¶
Copyright 2021 Evmos Foundation This file is part of Evmos' Ethermint library.
The Ethermint library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
The Ethermint library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with the Ethermint library. If not, see https://github.com/xpladev/ethermint/blob/main/LICENSE
Copyright 2021 Evmos Foundation This file is part of Evmos' Ethermint library.
The Ethermint library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
The Ethermint library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with the Ethermint library. If not, see https://github.com/xpladev/ethermint/blob/main/LICENSE
Copyright 2022 Evmos Foundation This file is part of the Ethermint Network packages.
Ethermint is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
The Ethermint packages are distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with the Ethermint packages. If not, see https://github.com/xpladev/ethermint/blob/main/LICENSE
Copyright 2021 Evmos Foundation This file is part of Evmos' Ethermint library.
The Ethermint library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
The Ethermint library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with the Ethermint library. If not, see https://github.com/xpladev/ethermint/blob/main/LICENSE
Index ¶
- Variables
- func CreateEIP712CosmosTx(ctx sdk.Context, appEthermint *app.EthermintApp, args EIP712TxArgs) (sdk.Tx, error)
- func CreateEthTx(ctx sdk.Context, appEthermint *app.EthermintApp, privKey cryptotypes.PrivKey, ...) (*evmtypes.MsgEthereumTx, error)
- func GasLimit(ctx sdk.Context, from common.Address, data evmtypes.HexString, ...) (uint64, error)
- func GenerateAddress() common.Address
- func NewAccAddressAndKey() (sdk.AccAddress, *ethsecp256k1.PrivKey)
- func NewAddrKey() (common.Address, *ethsecp256k1.PrivKey)
- func NewSigner(sk cryptotypes.PrivKey) keyring.Signer
- func PrepareCosmosTx(ctx sdk.Context, appEthermint *app.EthermintApp, args CosmosTxArgs) (authsigning.Tx, error)
- func PrepareEIP712CosmosTx(ctx sdk.Context, appEthermint *app.EthermintApp, args EIP712TxArgs) (client.TxBuilder, error)
- func PrepareEthTx(txCfg client.TxConfig, appEthermint *app.EthermintApp, ...) (authsigning.Tx, error)
- type CosmosTxArgs
- type EIP712TxArgs
- type Signer
Constants ¶
This section is empty.
Variables ¶
var (
DefaultFee = sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewIntFromUint64(uint64(feeAmt)))
)
Functions ¶
func CreateEIP712CosmosTx ¶
func CreateEIP712CosmosTx( ctx sdk.Context, appEthermint *app.EthermintApp, args EIP712TxArgs, ) (sdk.Tx, error)
CreateEIP712CosmosTx creates a cosmos tx for typed data according to EIP712. Also, signs the tx with the provided messages and private key. It returns the signed transaction and an error
func CreateEthTx ¶
func CreateEthTx( ctx sdk.Context, appEthermint *app.EthermintApp, privKey cryptotypes.PrivKey, from sdk.AccAddress, dest sdk.AccAddress, amount *big.Int, nonceIncrement int, ) (*evmtypes.MsgEthereumTx, error)
CreateEthTx is a helper function to create and sign an Ethereum transaction.
If the given private key is not nil, it will be used to sign the transaction.
It offers the ability to increment the nonce by a given amount in case one wants to set up multiple transactions that are supposed to be executed one after another. Should this not be the case, just pass in zero.
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 ¶
GenerateAddress generates an Ethereum address.
func NewAccAddressAndKey ¶
func NewAccAddressAndKey() (sdk.AccAddress, *ethsecp256k1.PrivKey)
NewAccAddressAndKey generates a private key and its corresponding Cosmos SDK address.
func NewAddrKey ¶
func NewAddrKey() (common.Address, *ethsecp256k1.PrivKey)
NewAddrKey generates an Ethereum address and its corresponding private key.
func PrepareCosmosTx ¶
func PrepareCosmosTx( ctx sdk.Context, appEthermint *app.EthermintApp, 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 PrepareEIP712CosmosTx ¶
func PrepareEIP712CosmosTx( ctx sdk.Context, appEthermint *app.EthermintApp, args EIP712TxArgs, ) (client.TxBuilder, error)
PrepareEIP712CosmosTx creates a cosmos tx for typed data according to EIP712. Also, signs the tx with the provided messages and private key. It returns the tx builder with the signed transaction and an error
func PrepareEthTx ¶
func PrepareEthTx( txCfg client.TxConfig, appEthermint *app.EthermintApp, 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. 'ethermint_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 EIP712TxArgs ¶
type EIP712TxArgs struct { CosmosTxArgs CosmosTxArgs UseLegacyTypedData bool UseLegacyExtension bool }
type Signer ¶
type Signer struct {
// contains filtered or unexported fields
}
Signer defines a type that is used on testing for signing MsgEthereumTx
func (Signer) SignByAddress ¶
SignByAddress sign byte messages with a user key providing the address.