flashbotsrpc

package module
v0.0.0-...-d8e91b4 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: MIT Imports: 20 Imported by: 0

README

Flashbots RPC client

Test status

Fork of ethrpc with additional Flashbots RPC methods:

  • FlashbotsCallBundle (eth_callBundle)
  • FlashbotsSendBundle (eth_sendBundle)
  • FlashbotsGetUserStats (flashbots_getUserStats)
  • FlashbotsSendPrivateTransaction (eth_sendPrivateTransaction)
  • FlashbotsCancelPrivateTransaction (eth_cancelPrivateTransaction)
  • FlashbotsSimulateBlock: simulate a full block

Usage

Add library to your project:

go get github.com/romosaic/flashbotsrpc

Create a new private key here for testing (you probably want to use an existing one):

privateKey, _ := crypto.GenerateKey()
Simulate transactions with eth_callBundle:
callBundleArgs := flashbotsrpc.FlashbotsCallBundleParam{
    Txs:              []string{"YOUR_RAW_TX"},
    BlockNumber:      fmt.Sprintf("0x%x", 13281018),
    StateBlockNumber: "latest",
}

result, err := rpc.FlashbotsCallBundle(privateKey, callBundleArgs)
if err != nil {
    log.Fatal(err)
}
fmt.Printf("%+v\n", result)
Get Flashbots user stats:
rpc := flashbotsrpc.New("https://relay.flashbots.net")
result, err := rpc.FlashbotsGetUserStats(privateKey, 13281018)
if err != nil {
    log.Fatal(err)
}
fmt.Printf("%+v\n", result)
Send a transaction bundle to Flashbots with eth_sendBundle:
sendBundleArgs := flashbotsrpc.FlashbotsSendBundleRequest{
    Txs:         []string{"YOUR_RAW_TX"},
    BlockNumber: fmt.Sprintf("0x%x", 13281018),
}

result, err := rpc.FlashbotsSendBundle(privateKey, sendBundleArgs)
if err != nil {
    log.Fatal(err)
}
fmt.Printf("%+v\n", result)
Send a transaction bundle to a list of Builder endpoints with eth_sendBundle (full example [/examples/broadcastbundle]):
urls := []string{
	"https://relay.flashbots.net",
    // Refer to https://www.mev.to/builders for builder endpoints 
}
rpc := flashbotsrpc.NewBuilderBroadcastRPC(urls)

sendBundleArgs := flashbotsrpc.FlashbotsSendBundleRequest{
    Txs:         []string{"YOUR_RAW_TX"},
    BlockNumber: fmt.Sprintf("0x%x", 13281018),
}

results := rpc.BroadcastBundle(privateKey, sendBundleArgs)
for _, result := range results {
    if result.Err != nil {
        log.Fatal(result.Err)
    }
    fmt.Printf("%+v\n", result.BundleResponse)
}
More examples

You can find example code in the /examples/ directory.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRelayErrorResponse = errors.New("relay error response")

ErrRelayErrorResponse means it's a standard Flashbots relay error response - probably a user error rather than JSON or network error

Functions

func BigToHex

func BigToHex(bigInt big.Int) string

BigToHex covert big.Int to hexadecimal representation

func Eth1

func Eth1() *big.Int

Eth1 returns 1 ethereum value (10^18 wei)

func IntToHex

func IntToHex(i int) string

IntToHex convert int to hexadecimal representation

func ParseBigInt

func ParseBigInt(value string) (big.Int, error)

ParseBigInt parse hex string value to big.Int

func ParseInt

func ParseInt(value string) (int, error)

ParseInt parse hex string value to int

func TxToRlp

func TxToRlp(tx *types.Transaction) string

func WithDebug

func WithDebug(enabled bool) func(rpc *FlashbotsRPC)

WithDebug set debug flag

func WithHttpClient

func WithHttpClient(client httpClient) func(rpc *FlashbotsRPC)

WithHttpClient set custom http client

func WithLogger

func WithLogger(l logger) func(rpc *FlashbotsRPC)

WithLogger set custom logger

Types

type Block

type Block struct {
	Number           int
	Hash             string
	ParentHash       string
	Nonce            string
	Sha3Uncles       string
	LogsBloom        string
	TransactionsRoot string
	StateRoot        string
	Miner            string
	Difficulty       big.Int
	TotalDifficulty  big.Int
	ExtraData        string
	Size             int
	GasLimit         int
	GasUsed          int
	Timestamp        int
	Uncles           []string
	Transactions     []Transaction
}

Block - block object

type BuilderBroadcastRPC

type BuilderBroadcastRPC struct {
	Debug   bool
	Headers map[string]string // Additional headers to send with the request
	Timeout time.Duration
	// contains filtered or unexported fields
}

func NewBuilderBroadcastRPC

func NewBuilderBroadcastRPC(urls []string, options ...func(rpc *BuilderBroadcastRPC)) *BuilderBroadcastRPC

NewBuilderBroadcastRPC create broadcaster rpc client with given url

type BuilderBroadcastResponse

type BuilderBroadcastResponse struct {
	BundleResponse FlashbotsSendBundleResponse `json:"bundleResponse"`
	Err            error                       `json:"err"`
}

type BuilderPubkeyWithTimestamp

type BuilderPubkeyWithTimestamp struct {
	Pubkey    string    `json:"pubkey"`
	Timestamp time.Time `json:"timestamp"`
}

type EthereumAPI

type EthereumAPI interface {
	Web3ClientVersion() (string, error)
	Web3Sha3(data []byte) (string, error)
	NetVersion() (string, error)
	NetListening() (bool, error)
	NetPeerCount() (int, error)
	EthProtocolVersion() (string, error)
	EthSyncing() (*Syncing, error)
	EthCoinbase() (string, error)
	EthMining() (bool, error)
	EthHashrate() (int, error)
	EthGasPrice() (big.Int, error)
	EthAccounts() ([]string, error)
	EthBlockNumber() (int, error)
	EthGetBalance(address, block string) (big.Int, error)
	EthGetStorageAt(data string, position int, tag string) (string, error)
	EthGetTransactionCount(address, block string) (int, error)
	EthGetBlockTransactionCountByHash(hash string) (int, error)
	EthGetBlockTransactionCountByNumber(number int) (int, error)
	EthGetUncleCountByBlockHash(hash string) (int, error)
	EthGetUncleCountByBlockNumber(number int) (int, error)
	EthGetCode(address, block string) (string, error)
	EthSign(address, data string) (string, error)
	EthSendTransaction(transaction T) (string, error)
	EthSendRawTransaction(data string) (string, error)
	EthCall(transaction T, tag string) (string, error)
	EthEstimateGas(transaction T) (int, error)
	EthGetBlockByHash(hash string, withTransactions bool) (*Block, error)
	EthGetBlockByNumber(number int, withTransactions bool) (*Block, error)
	EthGetTransactionByHash(hash string) (*Transaction, error)
	EthGetTransactionByBlockHashAndIndex(blockHash string, transactionIndex int) (*Transaction, error)
	EthGetTransactionByBlockNumberAndIndex(blockNumber, transactionIndex int) (*Transaction, error)
	EthGetTransactionReceipt(hash string) (*TransactionReceipt, error)
	EthGetCompilers() ([]string, error)
	EthNewFilter(params FilterParams) (string, error)
	EthNewBlockFilter() (string, error)
	EthNewPendingTransactionFilter() (string, error)
	EthUninstallFilter(filterID string) (bool, error)
	EthGetFilterChanges(filterID string) ([]Log, error)
	EthGetFilterLogs(filterID string) ([]Log, error)
	EthGetLogs(params FilterParams) ([]Log, error)
}

type FilterParams

type FilterParams struct {
	FromBlock string     `json:"fromBlock,omitempty"`
	ToBlock   string     `json:"toBlock,omitempty"`
	Address   []string   `json:"address,omitempty"`
	Topics    [][]string `json:"topics,omitempty"`
}

FilterParams - Filter parameters object

type FlashbotsCallBundleParam

type FlashbotsCallBundleParam struct {
	Txs              []string `json:"txs"`                 // Array[String], A list of signed transactions to execute in an atomic bundle
	BlockNumber      string   `json:"blockNumber"`         // String, a hex encoded block number for which this bundle is valid on
	StateBlockNumber string   `json:"stateBlockNumber"`    // String, either a hex encoded number or a block tag for which state to base this simulation on. Can use "latest"
	Timestamp        int64    `json:"timestamp,omitempty"` // Number, the timestamp to use for this bundle simulation, in seconds since the unix epoch
	Timeout          int64    `json:"timeout,omitempty"`
	GasLimit         uint64   `json:"gasLimit,omitempty"`
	Difficulty       uint64   `json:"difficulty,omitempty"`
	BaseFee          uint64   `json:"baseFee,omitempty"`
}

type FlashbotsCallBundleResponse

type FlashbotsCallBundleResponse struct {
	BundleGasPrice    string                      `json:"bundleGasPrice"`    // "43000001459",
	BundleHash        string                      `json:"bundleHash"`        // "0x2ca9c4d2ba00d8144d8e396a4989374443cb20fb490d800f4f883ad4e1b32158",
	CoinbaseDiff      string                      `json:"coinbaseDiff"`      // "2717471092204423",
	EthSentToCoinbase string                      `json:"ethSentToCoinbase"` // "0",
	GasFees           string                      `json:"gasFees"`           // "2717471092204423",
	Results           []FlashbotsCallBundleResult `json:"results"`           // [],
	StateBlockNumber  int64                       `json:"stateBlockNumber"`  // 12960319,
	TotalGasUsed      int64                       `json:"totalGasUsed"`      // 63197
}

type FlashbotsCallBundleResult

type FlashbotsCallBundleResult struct {
	CoinbaseDiff      string `json:"coinbaseDiff"`      // "2717471092204423",
	EthSentToCoinbase string `json:"ethSentToCoinbase"` // "0",
	FromAddress       string `json:"fromAddress"`       // "0x37ff310ab11d1928BB70F37bC5E3cf62Df09a01c",
	GasFees           string `json:"gasFees"`           // "2717471092204423",
	GasPrice          string `json:"gasPrice"`          // "43000001459",
	GasUsed           int64  `json:"gasUsed"`           // 63197,
	ToAddress         string `json:"toAddress"`         // "0xdAC17F958D2ee523a2206206994597C13D831ec7",
	TxHash            string `json:"txHash"`            // "0xe2df005210bdc204a34ff03211606e5d8036740c686e9fe4e266ae91cf4d12df",
	Value             string `json:"value"`             // "0x"
	Error             string `json:"error"`
	Revert            string `json:"revert"`
}

type FlashbotsCancelPrivateTransactionRequest

type FlashbotsCancelPrivateTransactionRequest struct {
	TxHash string `json:"txHash"`
}

cancelPrivateTransaction

type FlashbotsGetBundleStatsParam

type FlashbotsGetBundleStatsParam struct {
	BlockNumber string `json:"blockNumber"` // String, a hex encoded block number for which this bundle is valid on
	BundleHash  string `json:"bundleHash"`  // String, returned by the flashbots api when calling eth_sendBundle
}

type FlashbotsGetBundleStatsResponse

type FlashbotsGetBundleStatsResponse struct {
	IsSimulated            bool                          `json:"isSimulated"`
	IsSentToMiners         bool                          `json:"isSentToMiners"`
	IsHighPriority         bool                          `json:"isHighPriority"`
	SimulatedAt            time.Time                     `json:"simulatedAt"`
	SubmittedAt            time.Time                     `json:"submittedAt"`
	SentToMinersAt         time.Time                     `json:"sentToMinersAt"`
	ConsideredByBuildersAt []*BuilderPubkeyWithTimestamp `json:"consideredByBuildersAt"`
	SealedByBuildersAt     []*BuilderPubkeyWithTimestamp `json:"sealedByBuildersAt"`
}

type FlashbotsGetBundleStatsResponseV2

type FlashbotsGetBundleStatsResponseV2 struct {
	IsSimulated            bool                          `json:"isSimulated"`
	IsHighPriority         bool                          `json:"isHighPriority"`
	SimulatedAt            time.Time                     `json:"simulatedAt"`
	ReceivedAt             time.Time                     `json:"receivedAt"`
	ConsideredByBuildersAt []*BuilderPubkeyWithTimestamp `json:"consideredByBuildersAt"`
	SealedByBuildersAt     []*BuilderPubkeyWithTimestamp `json:"sealedByBuildersAt"`
}

type FlashbotsPrivateTxPreferences

type FlashbotsPrivateTxPreferences struct {
	Fast bool `json:"fast"`
}

type FlashbotsRPC

type FlashbotsRPC struct {
	Debug   bool
	Headers map[string]string // Additional headers to send with the request
	Timeout time.Duration
	// contains filtered or unexported fields
}

FlashbotsRPC - Ethereum rpc client

func New

func New(url string, options ...func(rpc *FlashbotsRPC)) *FlashbotsRPC

New create new rpc client with given url

func NewFlashbotsRPC

func NewFlashbotsRPC(url string, options ...func(rpc *FlashbotsRPC)) *FlashbotsRPC

NewFlashbotsRPC create new rpc client with given url

func (*FlashbotsRPC) Call

func (rpc *FlashbotsRPC) Call(method string, params ...interface{}) (json.RawMessage, error)

Call returns raw response of method call

func (*FlashbotsRPC) CallWithFlashbotsSignature

func (rpc *FlashbotsRPC) CallWithFlashbotsSignature(method string, privKey *ecdsa.PrivateKey, params ...interface{}) (json.RawMessage, error)

CallWithFlashbotsSignature is like Call but also signs the request

func (*FlashbotsRPC) Eth1

func (rpc *FlashbotsRPC) Eth1() *big.Int

Eth1 returns 1 ethereum value (10^18 wei)

func (*FlashbotsRPC) EthAccounts

func (rpc *FlashbotsRPC) EthAccounts() ([]string, error)

EthAccounts returns a list of addresses owned by client.

func (*FlashbotsRPC) EthBlockNumber

func (rpc *FlashbotsRPC) EthBlockNumber() (int, error)

EthBlockNumber returns the number of most recent block.

func (*FlashbotsRPC) EthCall

func (rpc *FlashbotsRPC) EthCall(transaction T, tag string) (string, error)

EthCall executes a new message call immediately without creating a transaction on the block chain.

func (*FlashbotsRPC) EthCoinbase

func (rpc *FlashbotsRPC) EthCoinbase() (string, error)

EthCoinbase returns the client coinbase address

func (*FlashbotsRPC) EthEstimateGas

func (rpc *FlashbotsRPC) EthEstimateGas(transaction T) (int, error)

EthEstimateGas makes a call or transaction, which won't be added to the blockchain and returns the used gas, which can be used for estimating the used gas.

func (*FlashbotsRPC) EthGasPrice

func (rpc *FlashbotsRPC) EthGasPrice() (big.Int, error)

EthGasPrice returns the current price per gas in wei.

func (*FlashbotsRPC) EthGetBalance

func (rpc *FlashbotsRPC) EthGetBalance(address, block string) (big.Int, error)

EthGetBalance returns the balance of the account of given address in wei.

func (*FlashbotsRPC) EthGetBlockByHash

func (rpc *FlashbotsRPC) EthGetBlockByHash(hash string, withTransactions bool) (*Block, error)

EthGetBlockByHash returns information about a block by hash.

func (*FlashbotsRPC) EthGetBlockByNumber

func (rpc *FlashbotsRPC) EthGetBlockByNumber(number int, withTransactions bool) (*Block, error)

EthGetBlockByNumber returns information about a block by block number.

func (*FlashbotsRPC) EthGetBlockTransactionCountByHash

func (rpc *FlashbotsRPC) EthGetBlockTransactionCountByHash(hash string) (int, error)

EthGetBlockTransactionCountByHash returns the number of transactions in a block from a block matching the given block hash.

func (*FlashbotsRPC) EthGetBlockTransactionCountByNumber

func (rpc *FlashbotsRPC) EthGetBlockTransactionCountByNumber(number int) (int, error)

EthGetBlockTransactionCountByNumber returns the number of transactions in a block from a block matching the given block

func (*FlashbotsRPC) EthGetCode

func (rpc *FlashbotsRPC) EthGetCode(address, block string) (string, error)

EthGetCode returns code at a given address.

func (*FlashbotsRPC) EthGetCompilers

func (rpc *FlashbotsRPC) EthGetCompilers() ([]string, error)

EthGetCompilers returns a list of available compilers in the client.

func (*FlashbotsRPC) EthGetFilterChanges

func (rpc *FlashbotsRPC) EthGetFilterChanges(filterID string) ([]Log, error)

EthGetFilterChanges polling method for a filter, which returns an array of logs which occurred since last poll.

func (*FlashbotsRPC) EthGetFilterLogs

func (rpc *FlashbotsRPC) EthGetFilterLogs(filterID string) ([]Log, error)

EthGetFilterLogs returns an array of all logs matching filter with given id.

func (*FlashbotsRPC) EthGetLogs

func (rpc *FlashbotsRPC) EthGetLogs(params FilterParams) ([]Log, error)

EthGetLogs returns an array of all logs matching a given filter object.

func (*FlashbotsRPC) EthGetStorageAt

func (rpc *FlashbotsRPC) EthGetStorageAt(data string, position int, tag string) (string, error)

EthGetStorageAt returns the value from a storage position at a given address.

func (*FlashbotsRPC) EthGetTransactionByBlockHashAndIndex

func (rpc *FlashbotsRPC) EthGetTransactionByBlockHashAndIndex(blockHash string, transactionIndex int) (*Transaction, error)

EthGetTransactionByBlockHashAndIndex returns information about a transaction by block hash and transaction index position.

func (*FlashbotsRPC) EthGetTransactionByBlockNumberAndIndex

func (rpc *FlashbotsRPC) EthGetTransactionByBlockNumberAndIndex(blockNumber, transactionIndex int) (*Transaction, error)

EthGetTransactionByBlockNumberAndIndex returns information about a transaction by block number and transaction index position.

func (*FlashbotsRPC) EthGetTransactionByHash

func (rpc *FlashbotsRPC) EthGetTransactionByHash(hash string) (*Transaction, error)

EthGetTransactionByHash returns the information about a transaction requested by transaction hash.

func (*FlashbotsRPC) EthGetTransactionCount

func (rpc *FlashbotsRPC) EthGetTransactionCount(address, block string) (int, error)

EthGetTransactionCount returns the number of transactions sent from an address.

func (*FlashbotsRPC) EthGetTransactionReceipt

func (rpc *FlashbotsRPC) EthGetTransactionReceipt(hash string) (*TransactionReceipt, error)

EthGetTransactionReceipt returns the receipt of a transaction by transaction hash. Note That the receipt is not available for pending transactions.

func (*FlashbotsRPC) EthGetUncleCountByBlockHash

func (rpc *FlashbotsRPC) EthGetUncleCountByBlockHash(hash string) (int, error)

EthGetUncleCountByBlockHash returns the number of uncles in a block from a block matching the given block hash.

func (*FlashbotsRPC) EthGetUncleCountByBlockNumber

func (rpc *FlashbotsRPC) EthGetUncleCountByBlockNumber(number int) (int, error)

EthGetUncleCountByBlockNumber returns the number of uncles in a block from a block matching the given block number.

func (*FlashbotsRPC) EthHashrate

func (rpc *FlashbotsRPC) EthHashrate() (int, error)

EthHashrate returns the number of hashes per second that the node is mining with.

func (*FlashbotsRPC) EthMining

func (rpc *FlashbotsRPC) EthMining() (bool, error)

EthMining returns true if client is actively mining new blocks.

func (*FlashbotsRPC) EthNewBlockFilter

func (rpc *FlashbotsRPC) EthNewBlockFilter() (string, error)

EthNewBlockFilter creates a filter in the node, to notify when a new block arrives. To check if the state has changed, call EthGetFilterChanges.

func (*FlashbotsRPC) EthNewFilter

func (rpc *FlashbotsRPC) EthNewFilter(params FilterParams) (string, error)

EthNewFilter creates a new filter object.

func (*FlashbotsRPC) EthNewPendingTransactionFilter

func (rpc *FlashbotsRPC) EthNewPendingTransactionFilter() (string, error)

EthNewPendingTransactionFilter creates a filter in the node, to notify when new pending transactions arrive. To check if the state has changed, call EthGetFilterChanges.

func (*FlashbotsRPC) EthProtocolVersion

func (rpc *FlashbotsRPC) EthProtocolVersion() (string, error)

EthProtocolVersion returns the current ethereum protocol version.

func (*FlashbotsRPC) EthSendRawTransaction

func (rpc *FlashbotsRPC) EthSendRawTransaction(data string) (string, error)

EthSendRawTransaction creates new message call transaction or a contract creation for signed transactions.

func (*FlashbotsRPC) EthSendTransaction

func (rpc *FlashbotsRPC) EthSendTransaction(transaction T) (string, error)

EthSendTransaction creates new message call transaction or a contract creation, if the data field contains code.

func (*FlashbotsRPC) EthSign

func (rpc *FlashbotsRPC) EthSign(address, data string) (string, error)

EthSign signs data with a given address. Calculates an Ethereum specific signature with: sign(keccak256("\x19Ethereum Signed Message:\n" + len(message) + message)))

func (*FlashbotsRPC) EthSyncing

func (rpc *FlashbotsRPC) EthSyncing() (*Syncing, error)

EthSyncing returns an object with data about the sync status or false.

func (*FlashbotsRPC) EthUninstallFilter

func (rpc *FlashbotsRPC) EthUninstallFilter(filterID string) (bool, error)

EthUninstallFilter uninstalls a filter with given id.

func (*FlashbotsRPC) FlashbotsCancelPrivateTransaction

func (rpc *FlashbotsRPC) FlashbotsCancelPrivateTransaction(privKey *ecdsa.PrivateKey, param FlashbotsCancelPrivateTransactionRequest) (cancelled bool, err error)

Try to cancel a private transaction at the Flashbots relay. If this call returns true this means the cancel was initiated, but it's not guaranteed that the transaction is actually cancelled, only that it won't be sent to miners anymore. A transaction that was already sent to miners might still be included in the next block.

Possible errors: 'tx not found', 'tx was already cancelled', 'tx has already expired'

func (*FlashbotsRPC) FlashbotsGetBundleStats

func (rpc *FlashbotsRPC) FlashbotsGetBundleStats(privKey *ecdsa.PrivateKey, param FlashbotsGetBundleStatsParam) (res FlashbotsGetBundleStatsResponse, err error)

func (*FlashbotsRPC) FlashbotsGetBundleStatsV2

func (rpc *FlashbotsRPC) FlashbotsGetBundleStatsV2(privKey *ecdsa.PrivateKey, param FlashbotsGetBundleStatsParam) (res FlashbotsGetBundleStatsResponseV2, err error)

func (*FlashbotsRPC) FlashbotsSendPrivateTransaction

func (rpc *FlashbotsRPC) FlashbotsSendPrivateTransaction(privKey *ecdsa.PrivateKey, param FlashbotsSendPrivateTransactionRequest) (txHash string, err error)

Sends a rawTx to the Flashbots relay. It will be sent to miners as bundle for 25 blocks, after which the transaction is failed.

func (*FlashbotsRPC) FlashbotsSimulateBlock

func (rpc *FlashbotsRPC) FlashbotsSimulateBlock(privKey *ecdsa.PrivateKey, block *types.Block, maxTx int) (res FlashbotsCallBundleResponse, err error)

Simulate a full Ethereum block. numTx is the maximum number of tx to include, used for troubleshooting (default: 0 - all transactions)

func (*FlashbotsRPC) NetListening

func (rpc *FlashbotsRPC) NetListening() (bool, error)

NetListening returns true if client is actively listening for network connections.

func (*FlashbotsRPC) NetPeerCount

func (rpc *FlashbotsRPC) NetPeerCount() (int, error)

NetPeerCount returns number of peers currently connected to the client.

func (*FlashbotsRPC) NetVersion

func (rpc *FlashbotsRPC) NetVersion() (string, error)

NetVersion returns the current network protocol version.

func (*FlashbotsRPC) RawCall

func (rpc *FlashbotsRPC) RawCall(method string, params ...interface{}) (json.RawMessage, error)

RawCall returns raw response of method call (Deprecated)

func (*FlashbotsRPC) URL

func (rpc *FlashbotsRPC) URL() string

URL returns client url

func (*FlashbotsRPC) Web3ClientVersion

func (rpc *FlashbotsRPC) Web3ClientVersion() (string, error)

Web3ClientVersion returns the current client version.

func (*FlashbotsRPC) Web3Sha3

func (rpc *FlashbotsRPC) Web3Sha3(data []byte) (string, error)

Web3Sha3 returns Keccak-256 (not the standardized SHA3-256) of the given data.

type FlashbotsSendBundleRequest

type FlashbotsSendBundleRequest struct {
	Txs          []string  `json:"txs"`                         // Array[String], A list of signed transactions to execute in an atomic bundle
	BlockNumber  string    `json:"blockNumber"`                 // String, a hex encoded block number for which this bundle is valid on
	MinTimestamp *uint64   `json:"minTimestamp,omitempty"`      // (Optional) Number, the minimum timestamp for which this bundle is valid, in seconds since the unix epoch
	MaxTimestamp *uint64   `json:"maxTimestamp,omitempty"`      // (Optional) Number, the maximum timestamp for which this bundle is valid, in seconds since the unix epoch
	RevertingTxs *[]string `json:"revertingTxHashes,omitempty"` // (Optional) Array[String], A list of tx hashes that are allowed to revert
}

sendBundle

type FlashbotsSendBundleResponse

type FlashbotsSendBundleResponse struct {
	BundleHash string `json:"bundleHash"`
}

type FlashbotsSendPrivateTransactionRequest

type FlashbotsSendPrivateTransactionRequest struct {
	Tx          string                         `json:"tx"`
	Preferences *FlashbotsPrivateTxPreferences `json:"preferences,omitempty"`
}

sendPrivateTransaction

type FlashbotsUserStats

type FlashbotsUserStats struct {
	IsHighPriority       bool   `json:"is_high_priority"`
	AllTimeMinerPayments string `json:"all_time_miner_payments"`
	AllTimeGasSimulated  string `json:"all_time_gas_simulated"`
	Last7dMinerPayments  string `json:"last_7d_miner_payments"`
	Last7dGasSimulated   string `json:"last_7d_gas_simulated"`
	Last1dMinerPayments  string `json:"last_1d_miner_payments"`
	Last1dGasSimulated   string `json:"last_1d_gas_simulated"`
}

type Log

type Log struct {
	Removed          bool
	LogIndex         int
	TransactionIndex int
	TransactionHash  string
	BlockNumber      int
	BlockHash        string
	Address          string
	Data             string
	Topics           []string
}

Log - log object

func (*Log) UnmarshalJSON

func (log *Log) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type RelayErrorResponse

type RelayErrorResponse struct {
	Error string `json:"error"`
}

type RpcError

type RpcError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

RpcError - ethereum error

func (RpcError) Error

func (err RpcError) Error() string

type Syncing

type Syncing struct {
	IsSyncing     bool
	StartingBlock int
	CurrentBlock  int
	HighestBlock  int
}

Syncing - object with syncing data info

func (*Syncing) UnmarshalJSON

func (s *Syncing) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type T

type T struct {
	From     string
	To       string
	Gas      int
	GasPrice *big.Int
	Value    *big.Int
	Data     string
	Nonce    int
}

T - input transaction object

func (T) MarshalJSON

func (t T) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Unmarshaler interface.

type Transaction

type Transaction struct {
	Hash             string
	Nonce            int
	BlockHash        string
	BlockNumber      *int
	TransactionIndex *int
	From             string
	To               string
	Value            big.Int
	Gas              int
	GasPrice         big.Int
	Input            string
}

Transaction - transaction object

func (*Transaction) UnmarshalJSON

func (t *Transaction) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type TransactionReceipt

type TransactionReceipt struct {
	TransactionHash   string
	TransactionIndex  int
	BlockHash         string
	BlockNumber       int
	CumulativeGasUsed int
	GasUsed           int
	ContractAddress   string
	Logs              []Log
	LogsBloom         string
	Root              string
	Status            string
}

TransactionReceipt - transaction receipt object

func (*TransactionReceipt) UnmarshalJSON

func (t *TransactionReceipt) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

Jump to

Keyboard shortcuts

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