Documentation ¶
Index ¶
- Variables
- func CreateEIP712CosmosTx(ctx sdk.Context, appArtela *app.Artela, args EIP712TxArgs) (sdk.Tx, error)
- func CreateEthTx(ctx sdk.Context, appArtela *app.Artela, privKey cryptotypes.PrivKey, ...) (*txs.MsgEthereumTx, error)
- func GasLimit(ctx sdk.Context, from common.Address, data []byte, ...) (uint64, error)
- func GenerateAddress() common.Address
- func NewAccAddressAndKey() (sdk.AccAddress, *ethsecp256k12.PrivKey)
- func NewAddrKey() (common.Address, *ethsecp256k12.PrivKey)
- func NewSigner(sk cryptotypes.PrivKey) keyring.Signer
- func PrepareCosmosTx(ctx sdk.Context, appArtela *app.Artela, args CosmosTxArgs) (authsigning.Tx, error)
- func PrepareEIP712CosmosTx(ctx sdk.Context, appArtela *app.Artela, args EIP712TxArgs) (client.TxBuilder, error)
- func PrepareEthTx(txCfg client.TxConfig, appArtela *app.Artela, priv cryptotypes.PrivKey, ...) (authsigning.Tx, error)
- type CosmosTxArgs
- type EIP712TxArgs
- type InvalidTx
- type Signer
Constants ¶
This section is empty.
Variables ¶
var (
DefaultFee = sdk.NewCoin(utils.BaseDenom, sdk.NewIntFromUint64(uint64(feeAmt))) // 0.01 Artela
)
Functions ¶
func CreateEIP712CosmosTx ¶
func CreateEIP712CosmosTx( ctx sdk.Context, appArtela *app.Artela, args EIP712TxArgs, ) (sdk.Tx, error)
CreateEIP712CosmosTx creates a cosmos txs for typed data according to EIP712. Also, signs the txs with the provided messages and private key. It returns the signed txs and an error
func CreateEthTx ¶
func CreateEthTx( ctx sdk.Context, appArtela *app.Artela, privKey cryptotypes.PrivKey, from sdk.AccAddress, dest sdk.AccAddress, amount *big.Int, nonceIncrement int, ) (*txs.MsgEthereumTx, error)
CreateEthTx is a helper function to create and sign an Ethereum txs.
If the given private key is not nil, it will be used to sign the txs.
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 []byte, queryClientEvm txs.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, *ethsecp256k12.PrivKey)
NewAccAddressAndKey generates a private key and its corresponding Cosmos SDK address.
func NewAddrKey ¶
func NewAddrKey() (common.Address, *ethsecp256k12.PrivKey)
NewAddrKey generates an Ethereum address and its corresponding private key.
func PrepareCosmosTx ¶
func PrepareCosmosTx( ctx sdk.Context, appArtela *app.Artela, args CosmosTxArgs, ) (authsigning.Tx, error)
PrepareCosmosTx creates a cosmos txs and signs it with the provided messages and private key. It returns the signed txs and an error
func PrepareEIP712CosmosTx ¶
func PrepareEIP712CosmosTx( ctx sdk.Context, appArtela *app.Artela, args EIP712TxArgs, ) (client.TxBuilder, error)
PrepareEIP712CosmosTx creates a cosmos txs for typed data according to EIP712. Also, signs the txs with the provided messages and private key. It returns the txs builder with the signed txs and an error
func PrepareEthTx ¶
func PrepareEthTx( txCfg client.TxConfig, appArtela *app.Artela, priv cryptotypes.PrivKey, msgs ...sdk.Msg, ) (authsigning.Tx, error)
PrepareEthTx creates an ethereum txs and signs it with the provided messages and private key. It returns the signed txs and an error
Types ¶
type CosmosTxArgs ¶
type CosmosTxArgs struct { // TxCfg is the client txs config TxCfg client.TxConfig // Priv is the private key that will be used to sign the txs Priv cryptotypes.PrivKey // ChainID is the chain's id on cosmos format, e.g. 'artela_11820-1' ChainID string // Gas to be used on the txs Gas uint64 // GasPrice to use on txs GasPrice *sdkmath.Int // Fees is the fee to be used on the txs (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 txs Msgs []sdk.Msg }
CosmosTxArgs contains the params to create a cosmos txs
type EIP712TxArgs ¶
type EIP712TxArgs struct { CosmosTxArgs CosmosTxArgs UseLegacyExtension bool UseLegacyTypedData bool }
type InvalidTx ¶
type InvalidTx struct{}
InvalidTx defines a type, which satisfies the sdk.Tx interface, but holds no valid txs information.
NOTE: This is used for testing purposes, to serve the edge case of invalid data being passed to functions.
func (InvalidTx) ValidateBasic ¶
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.