transaction

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 32 Imported by: 0

Documentation

Overview

Copyright © 2024 NAME HERE <EMAIL ADDRESS>

Copyright © 2024 NAME HERE <EMAIL ADDRESS>

Copyright © 2024 NAME HERE <EMAIL ADDRESS>

Copyright © 2024 NAME HERE <EMAIL ADDRESS>

Copyright © 2024 NAME HERE <EMAIL ADDRESS>

Copyright © 2024 NAME HERE <EMAIL ADDRESS>

Copyright © 2024 NAME HERE <EMAIL ADDRESS>

Copyright © 2024 NAME HERE <EMAIL ADDRESS>

Copyright © 2024 NAME HERE <EMAIL ADDRESS>

Copyright © 2024 NAME HERE <EMAIL ADDRESS>

Copyright © 2024 NAME HERE <EMAIL ADDRESS>

Copyright © 2024 NAME HERE <EMAIL ADDRESS>

Copyright © 2024 NAME HERE <EMAIL ADDRESS>

Index

Constants

This section is empty.

Variables

View Source
var TxCmd = &cobra.Command{
	Use:   "tx",
	Short: "Manage transactions, including creation, signing, submitting and tracing",
	Long:  ``,
	Run: func(cmd *cobra.Command, args []string) {
		cmd.Help()
	},
}

TxCmd represents the tx command

Functions

func CreateRawTransaction

func CreateRawTransaction(rpcURL, to, data, privateKey string, gasLimit, wei uint64) (string, error)

CreateRawTransaction creates a raw Ethereum transaction.

func GetBlob added in v0.1.4

func GetBlob(blockRootOrSlotNumber, kzgCommitment string) (string, error)

func GetNonce

func GetNonce(address, rpcUrl string) (uint64, uint64, error)

func SendBlobTX

func SendBlobTX(rpcURL, toAddress, data, privateKey, saveBlobDir string) (string, error)

func SendRawTransaction

func SendRawTransaction(rawTx, rpcURL string) (string, string, error)

SendRawTransaction sends a raw Ethereum transaction.

func SendTransaction

func SendTransaction(rpcURL, to, data, privateKey string, gasLimit, wei uint64) (string, error)

SendTransaction sends an Ethereum transaction.

func SignETHMessage

func SignETHMessage(message, privateKey string) (string, error)

SignETHMessage signs a message using the provided private key.

func TryEstimateGas

func TryEstimateGas(rpcUrl, from, to, data string, value uint64) (uint64, error)

TryEstimateGas tries to estimate the gas needed to execute a specific transaction based on the current pending state of the backend blockchain. There is no guarantee that this is the true gas limit requiremen

func VerifySig

func VerifySig(signature, address, message string) (bool, error)

VerifySig verifies the signature against the provided public key bytes and hash.

Types

type SignatureResponse

type SignatureResponse struct {
	Address string `json:"address,omitempty"`
	Msg     string `json:"msg,omitempty"`
	Sig     string `json:"sig,omitempty"`
	Version string `json:"version,omitempty"`
}

SignatureResponse represents the structure of the signature response.

type Trace

type Trace struct {
	Type     string   `json:"type"`
	Depth    int      `json:"depth"`
	From     string   `json:"from"`
	To       string   `json:"to"`
	Value    string   `json:"value,omitempty"`
	Input    string   `json:"input"`
	Parent   *Trace   `json:"-"` // Exclude from JSON marshaling
	Children []*Trace `json:"-"`
}

func TraceTx

func TraceTx(hash, rpcUrl string) (*Trace, error)

type Transaction

type Transaction struct {
	Type                 string   `json:"type"`
	ChainID              string   `json:"chainId"`
	Nonce                string   `json:"nonce"`
	To                   string   `json:"to"`
	Gas                  string   `json:"gas"`
	GasPrice             string   `json:"gasPrice,omitempty"`
	MaxPriorityFeePerGas string   `json:"maxPriorityFeePerGas"`
	MaxFeePerGas         string   `json:"maxFeePerGas"`
	Value                string   `json:"value"`
	Input                string   `json:"input"`
	AccessList           []string `json:"accessList"`
	V                    string   `json:"v"`
	R                    string   `json:"r"`
	S                    string   `json:"s"`
	YParity              string   `json:"yParity"`
	Hash                 string   `json:"hash"`
	TransactionTime      string   `json:"transactionTime,omitempty"`
	TransactionCost      string   `json:"transactionCost,omitempty"`
}

Transaction represents the structure of the transaction JSON.

type TxReceipt

type TxReceipt struct {
	Type              uint64        `json:"type"`
	Root              string        `json:"root"`
	Status            uint64        `json:"status"`
	CumulativeGasUsed uint64        `json:"cumulativeGasUsed"`
	LogsBloom         string        `json:"logsBloom,omitempty"`
	Logs              []interface{} `json:"logs,omitempty"`
	TransactionHash   string        `json:"transactionHash"`
	ContractAddress   string        `json:"contractAddress,omitempty"`
	GasUsed           uint64        `json:"gasUsed"`
	EffectiveGasPrice uint64        `json:"effectiveGasPrice"`
	TransactionCost   uint64        `json:"-"`
	BlockHash         string        `json:"blockHash"`
	BlockNumber       uint64        `json:"blockNumber"`
	TransactionIndex  uint64        `json:"transactionIndex"`
	TransactionURL    string        `json:"-"`
}

func CreateContract

func CreateContract(rpcURL, data, privateKey string, gasLimit, wei uint64) (*TxReceipt, error)

func (*TxReceipt) UnmarshalJSON

func (r *TxReceipt) UnmarshalJSON(data []byte) error

UnmarshalJSON customizes the unmarshalling of a TxReceipt.

Jump to

Keyboard shortcuts

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