Documentation ¶
Index ¶
- Variables
- func BuildErc20ApproveCallData(spender common.Address, amount *big.Int) []byte
- func BuildErc20BalanceOfCallData(address common.Address) []byte
- func BuildErc20BurnCallData(from common.Address, amount *big.Int) []byte
- func BuildErc20MintCallData(to common.Address, amount *big.Int) []byte
- func BuildErc20TransferCallData(to common.Address, amount *big.Int) []byte
- func BuildErc20TransferFromCallData(from common.Address, to common.Address, amount *big.Int) []byte
- func EvmContractMethodId(signature string) []byte
- func EvmToSdkAddress(addr common.Address) sdk.AccAddress
- func FilterEventsByType(events []abci.Event, eventType string) []abci.Event
- func FilterTxEventsByType(txs []*abci.ResponseDeliverTx, eventType string) []abci.Event
- func GetAccAddress(privKey cryptotypes.PrivKey) sdk.AccAddress
- func KavaHomePath() string
- func PrettyPrintCoins(coins sdk.Coins) string
- func SdkToEvmAddress(addr sdk.AccAddress) common.Address
- func Sign(txConfig sdkclient.TxConfig, privKey cryptotypes.PrivKey, ...) (authsigning.Tx, []byte, error)
- func WaitForEvmTxReceipt(client *ethclient.Client, txHash common.Hash, timeout time.Duration) (*ethtypes.Receipt, error)
- func WaitForSdkTxCommit(txClient txtypes.ServiceClient, txHash string, timeout time.Duration) (*sdk.TxResponse, error)
- type ErrEvmFailedToBroadcast
- type ErrEvmFailedToSign
- type EvmSigner
- type EvmTxRequest
- type EvmTxResponse
- type KavaMsgRequest
- type KavaMsgResponse
- type KavaSigner
Constants ¶
This section is empty.
Variables ¶
var ( ErrEvmBroadcastTimeout = errors.New("timed out waiting for tx to be committed to block") // ErrEvmTxFailed is returned when a tx is committed to a block, but the receipt status is 0. // this means the tx failed. we don't have debug_traceTransaction RPC command so the best way // to determine the problem is to attempt to make the tx manually. ErrEvmTxFailed = errors.New("transaction was committed but failed. likely an execution revert by contract code") )
var ( ErrSdkBroadcastTimeout = errors.New("timed out waiting for tx to be committed to block") ErrUnsuccessfulTx = errors.New("tx committed but returned nonzero code") )
Functions ¶
func BuildErc20ApproveCallData ¶ added in v0.24.0
func BuildErc20BurnCallData ¶ added in v0.24.0
func BuildErc20MintCallData ¶ added in v0.24.0
func BuildErc20TransferFromCallData ¶ added in v0.24.0
func EvmContractMethodId ¶
EvmContractMethodId encodes a method signature to the method id used in eth calldata.
func EvmToSdkAddress ¶
func EvmToSdkAddress(addr common.Address) sdk.AccAddress
func FilterEventsByType ¶ added in v0.25.0
FilterEventsByType returns a slice of events that match the given type.
func FilterTxEventsByType ¶ added in v0.25.0
func FilterTxEventsByType(txs []*abci.ResponseDeliverTx, eventType string) []abci.Event
FilterTxEventsByType returns a slice of events that match the given type from any and all txs in a slice of ResponseDeliverTx.
func GetAccAddress ¶
func GetAccAddress(privKey cryptotypes.PrivKey) sdk.AccAddress
func KavaHomePath ¶ added in v0.25.0
func KavaHomePath() string
KavaHomePath returns the OS-specific filepath for the kava home directory Assumes network is running with kvtool installed from the sub-repository in tests/e2e/kvtool
func PrettyPrintCoins ¶ added in v0.25.0
func SdkToEvmAddress ¶
func SdkToEvmAddress(addr sdk.AccAddress) common.Address
func Sign ¶
func Sign( txConfig sdkclient.TxConfig, privKey cryptotypes.PrivKey, txBuilder sdkclient.TxBuilder, signerData authsigning.SignerData, ) (authsigning.Tx, []byte, error)
Sign signs a populated TxBuilder and returns a signed Tx and raw transaction bytes
func WaitForEvmTxReceipt ¶
func WaitForEvmTxReceipt(client *ethclient.Client, txHash common.Hash, timeout time.Duration) (*ethtypes.Receipt, error)
WaitForEvmTxReceipt polls for a tx receipt and errors on timeout. If the receipt comes back, but with status 0 (failed), an error is returned.
func WaitForSdkTxCommit ¶
func WaitForSdkTxCommit(txClient txtypes.ServiceClient, txHash string, timeout time.Duration) (*sdk.TxResponse, error)
WaitForSdkTxCommit polls the chain until the tx hash is found or times out. Returns an error immediately if tx hash is empty
Types ¶
type ErrEvmFailedToBroadcast ¶
type ErrEvmFailedToBroadcast struct{ Err error }
func (ErrEvmFailedToBroadcast) Error ¶
func (e ErrEvmFailedToBroadcast) Error() string
type ErrEvmFailedToSign ¶
type ErrEvmFailedToSign struct{ Err error }
func (ErrEvmFailedToSign) Error ¶
func (e ErrEvmFailedToSign) Error() string
type EvmSigner ¶
type EvmSigner struct { Auth *bind.TransactOpts EvmClient *ethclient.Client // contains filtered or unexported fields }
EvmSigner manages signing and broadcasting requests to transfer Erc20 tokens Will work for calling all contracts that have func signature `transfer(address,uint256)`
func NewEvmSigner ¶
func (*EvmSigner) Run ¶
func (s *EvmSigner) Run(requests <-chan EvmTxRequest) <-chan EvmTxResponse
type EvmTxRequest ¶
type EvmTxRequest struct { Tx *ethtypes.Transaction Data interface{} }
type EvmTxResponse ¶
type EvmTxResponse struct { Request EvmTxRequest TxHash common.Hash Err error }
type KavaMsgRequest ¶
type KavaMsgResponse ¶
type KavaMsgResponse struct { Request KavaMsgRequest Tx authsigning.Tx TxBytes []byte Result sdk.TxResponse Err error }
type KavaSigner ¶
type KavaSigner struct {
// contains filtered or unexported fields
}
KavaSigner broadcasts msgs to a single kava node
func NewKavaSigner ¶
func NewKavaSigner( chainID string, encodingConfig params.EncodingConfig, authClient authtypes.QueryClient, txClient txtypes.ServiceClient, privKey cryptotypes.PrivKey, inflightTxLimit uint64) *KavaSigner
func (*KavaSigner) Address ¶
func (s *KavaSigner) Address() sdk.AccAddress
Address returns the address of the Signer
func (*KavaSigner) Run ¶
func (s *KavaSigner) Run(requests <-chan KavaMsgRequest) (<-chan KavaMsgResponse, error)