txbuilder

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2025 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildBlobTx

func BuildBlobTx(txData *TxMetadata, blobRefs [][]string) (*types.BlobTx, error)

func DynFeeTx

func DynFeeTx(txData *TxMetadata) (*types.DynamicFeeTx, error)

func ParseBlobRefsBytes

func ParseBlobRefsBytes(blobRefs []string, tx *types.BlobTx) ([]byte, error)

func SetCodeTx added in v1.1.0

func SetCodeTx(txData *TxMetadata) (*types.SetCodeTx, error)

Types

type BlobCommitment

type BlobCommitment struct {
	Blob          *kzg4844.Blob
	Commitment    kzg4844.Commitment
	Proof         kzg4844.Proof
	VersionedHash common.Hash
}

func EncodeBlob

func EncodeBlob(data []byte) (*BlobCommitment, error)

type BlockInfo added in v1.1.1

type BlockInfo struct {
	Number     uint64
	Hash       common.Hash
	ParentHash common.Hash
	Timestamp  uint64
}

BlockInfo represents information about a processed block

type Client

type Client struct {
	Timeout time.Duration
	// contains filtered or unexported fields
}

func NewClient

func NewClient(rpchost string) (*Client, error)

func (*Client) GetBalanceAt

func (client *Client) GetBalanceAt(ctx context.Context, wallet common.Address) (*big.Int, error)

func (*Client) GetBlockHeight

func (client *Client) GetBlockHeight(ctx context.Context) (uint64, error)

func (*Client) GetChainId

func (client *Client) GetChainId(ctx context.Context) (*big.Int, error)

func (*Client) GetClientGroup added in v1.1.1

func (client *Client) GetClientGroup() string

func (*Client) GetClientVersion added in v1.1.0

func (client *Client) GetClientVersion(ctx context.Context) (string, error)

func (*Client) GetEthClient

func (client *Client) GetEthClient() *ethclient.Client

func (*Client) GetLastBlockHeight added in v1.1.0

func (client *Client) GetLastBlockHeight() (uint64, time.Time)

func (*Client) GetName

func (client *Client) GetName() string

func (*Client) GetNonceAt

func (client *Client) GetNonceAt(ctx context.Context, wallet common.Address, blockNumber *big.Int) (uint64, error)

func (*Client) GetPendingNonceAt

func (client *Client) GetPendingNonceAt(ctx context.Context, wallet common.Address) (uint64, error)

func (*Client) GetRPCHost

func (client *Client) GetRPCHost() string

func (*Client) GetSuggestedFee

func (client *Client) GetSuggestedFee(ctx context.Context) (*big.Int, *big.Int, error)

func (*Client) GetTransactionReceiptCtx

func (client *Client) GetTransactionReceiptCtx(ctx context.Context, txHash common.Hash) (*types.Receipt, error)

func (*Client) SendTransaction2

func (client *Client) SendTransaction2(ctx context.Context, tx *types.Transaction) error

func (*Client) SendTransactionCtx

func (client *Client) SendTransactionCtx(ctx context.Context, tx *types.Transaction) error

func (*Client) UpdateWallet

func (client *Client) UpdateWallet(ctx context.Context, wallet *Wallet) error

type SendTransactionOptions

type SendTransactionOptions struct {
	Client             *Client
	ClientsStartOffset int

	OnConfirm TxConfirmFn
	LogFn     TxLogFn

	MaxRebroadcasts     int
	RebroadcastInterval time.Duration
}

type TxConfirmFn

type TxConfirmFn func(tx *types.Transaction, receipt *types.Receipt, err error)

type TxInfo added in v1.1.1

type TxInfo struct {
	TxHash     common.Hash
	From       common.Address
	To         *common.Address
	Tx         *types.Transaction
	FromWallet *Wallet
	ToWallet   *Wallet
	Options    *SendTransactionOptions
}

TxInfo represents information about a confirmed transaction

type TxLogFn

type TxLogFn func(client *Client, retry int, rebroadcast int, err error)

type TxMetadata

type TxMetadata struct {
	GasTipCap  *uint256.Int // a.k.a. maxPriorityFeePerGas
	GasFeeCap  *uint256.Int // a.k.a. maxFeePerGas
	BlobFeeCap *uint256.Int // a.k.a. maxFeePerBlobGas
	Gas        uint64
	To         *common.Address
	Value      *uint256.Int
	Data       []byte
	AccessList types.AccessList
	AuthList   []types.SetCodeAuthorization
}

type TxPool

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

func NewTxPool

func NewTxPool(options *TxPoolOptions) *TxPool

func (*TxPool) AwaitTransaction

func (pool *TxPool) AwaitTransaction(ctx context.Context, wallet *Wallet, tx *types.Transaction) (*types.Receipt, error)

func (*TxPool) SendTransaction

func (pool *TxPool) SendTransaction(ctx context.Context, wallet *Wallet, tx *types.Transaction, options *SendTransactionOptions) error

type TxPoolOptions

type TxPoolOptions struct {
	Context          context.Context
	GetClientFn      func(index int, random bool) *Client
	GetClientCountFn func() int
	ReorgDepth       int // Number of blocks to keep in memory for reorg tracking
}

type Wallet

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

func NewWallet

func NewWallet(privkey string) (*Wallet, error)

func (*Wallet) AddBalance

func (wallet *Wallet) AddBalance(amount *big.Int)

func (*Wallet) BuildBlobTx

func (wallet *Wallet) BuildBlobTx(txData *types.BlobTx) (*types.Transaction, error)

func (*Wallet) BuildBoundTx

func (wallet *Wallet) BuildBoundTx(ctx context.Context, txData *TxMetadata, buildFn func(transactOpts *bind.TransactOpts) (*types.Transaction, error)) (*types.Transaction, error)

func (*Wallet) BuildDynamicFeeTx

func (wallet *Wallet) BuildDynamicFeeTx(txData *types.DynamicFeeTx) (*types.Transaction, error)

func (*Wallet) BuildSetCodeTx added in v1.1.0

func (wallet *Wallet) BuildSetCodeTx(txData *types.SetCodeTx) (*types.Transaction, error)

func (*Wallet) GetAddress

func (wallet *Wallet) GetAddress() common.Address

func (*Wallet) GetBalance

func (wallet *Wallet) GetBalance() *big.Int

func (*Wallet) GetChainId

func (wallet *Wallet) GetChainId() *big.Int

func (*Wallet) GetConfirmedNonce added in v1.1.0

func (wallet *Wallet) GetConfirmedNonce() uint64

func (*Wallet) GetNextNonce added in v1.1.0

func (wallet *Wallet) GetNextNonce() uint64

func (*Wallet) GetNonce

func (wallet *Wallet) GetNonce() uint64

func (*Wallet) GetPrivateKey added in v1.1.0

func (wallet *Wallet) GetPrivateKey() *ecdsa.PrivateKey

func (*Wallet) ReplaceBlobTx

func (wallet *Wallet) ReplaceBlobTx(txData *types.BlobTx, nonce uint64) (*types.Transaction, error)

func (*Wallet) ReplaceDynamicFeeTx

func (wallet *Wallet) ReplaceDynamicFeeTx(txData *types.DynamicFeeTx, nonce uint64) (*types.Transaction, error)

func (*Wallet) ResetPendingNonce added in v1.0.1

func (wallet *Wallet) ResetPendingNonce(ctx context.Context, client *Client)

func (*Wallet) SetAddress added in v1.1.1

func (wallet *Wallet) SetAddress(address common.Address)

func (*Wallet) SetBalance

func (wallet *Wallet) SetBalance(balance *big.Int)

func (*Wallet) SetChainId

func (wallet *Wallet) SetChainId(chainid *big.Int)

func (*Wallet) SetNonce

func (wallet *Wallet) SetNonce(nonce uint64)

func (*Wallet) SubBalance

func (wallet *Wallet) SubBalance(amount *big.Int)

Jump to

Keyboard shortcuts

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