txbuilder

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 29 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)

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 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(wallet common.Address) (*big.Int, error)

func (*Client) GetBlockHeight

func (client *Client) GetBlockHeight() (uint64, error)

func (*Client) GetChainId

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

func (*Client) GetEthClient

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

func (*Client) GetName

func (client *Client) GetName() string

func (*Client) GetNonceAt

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

func (*Client) GetPendingNonceAt

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

func (*Client) GetRPCHost

func (client *Client) GetRPCHost() string

func (*Client) GetSuggestedFee

func (client *Client) GetSuggestedFee() (*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(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(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 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
}

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 {
	GetClientFn      func(index int, random bool) *Client
	GetClientCountFn func() int
}

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(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) 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) GetNonce

func (wallet *Wallet) GetNonce() uint64

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(client *Client)

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