Documentation ¶
Index ¶
- type BundleIdentifier
- type BundleStats
- type CallBundleParam
- type CalledBundle
- type Client
- func (c *Client) Call(ctx context.Context, result interface{}, method string, params ...interface{}) error
- func (c *Client) CallBundle(ctx context.Context, req CallBundleParam) (*CalledBundle, error)
- func (c *Client) CancelPrivateTransaction(ctx context.Context, hash common.Hash) (bool, error)
- func (c *Client) GetBundleStats(ctx context.Context, bundle BundleIdentifier) (*BundleStats, error)
- func (c *Client) GetUserStats(ctx context.Context, blockNumber uint64) (*UserStats, error)
- func (c *Client) SendBundle(ctx context.Context, req SendBundleParam) (*SentBundle, error)
- func (c *Client) SendPrivateTransaction(ctx context.Context, tx *types.Transaction, maxBlockNumber uint64, ...) (common.Hash, error)
- type HashSigner
- type RPCError
- type SendBundleParam
- type SentBundle
- type SignerFunc
- type TxResult
- type UserStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BundleIdentifier ¶
BundleIdentifier abstracts bundle identification that can be used to fetch its status using GetBundleStats.
type BundleStats ¶
type CallBundleParam ¶
type CallBundleParam struct { Txs []*types.Transaction BlockNumber uint64 StateBlockNumber rpc.BlockNumber Timestamp time.Time }
type CalledBundle ¶
type CalledBundle struct { BundleHash common.Hash `json:"bundleHash"` BlockNumber uint64 `json:"-"` CoinbaseDiff *big.Int `json:"coinbaseDiff"` ETHSentToCoinbase *big.Int `json:"ethSentToCoinbase"` GasFees *big.Int `json:"gasFees"` TotalGasUsed uint64 `json:"totalGasUsed"` StateBlockNumber uint64 `json:"stateBlockNumber"` Results []TxResult `json:"results"` FirstRevert *TxResult `json:"firstRevert"` }
func (*CalledBundle) Identifier ¶
func (b *CalledBundle) Identifier() (hash common.Hash, blockNumber uint64)
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements the Flashbots RPC client. Use Dial or DialWithSigner to instantiate a new Client.
func Dial ¶
func Dial(uri string, privkey *ecdsa.PrivateKey) (*Client, error)
Dial creates new Flashbots RPC client using private key to sign the payload.
func DialWithSigner ¶
DialWithSigner creates new Flashbots RPC client using an external hash signer.
func DialWithSignerFunc ¶ added in v0.1.2
func DialWithSignerFunc(uri string, signerFn SignerFunc) (*Client, error)
DialWithSignerFunc creates new Flashbots RPC client using custom hash signer function.
func (*Client) Call ¶
func (c *Client) Call(ctx context.Context, result interface{}, method string, params ...interface{}) error
Call arbitrary RPC method with params and optional result interface. If result set to nil it will not decode returned values from the server. Any errors generated from the RPC server will be returned as *RPCError.
func (*Client) CallBundle ¶
func (c *Client) CallBundle(ctx context.Context, req CallBundleParam) (*CalledBundle, error)
CallBundle simulates the transaction bundle and returns the execution result in CalledBundle.
func (*Client) CancelPrivateTransaction ¶
CancelPrivateTransaction cancels the ongoing private transaction inside the Flashbots relay.
func (*Client) GetBundleStats ¶
func (c *Client) GetBundleStats(ctx context.Context, bundle BundleIdentifier) (*BundleStats, error)
GetBundleStats returns the bundle status.
func (*Client) GetUserStats ¶
GetUserStats returns the current user status.
func (*Client) SendBundle ¶
func (c *Client) SendBundle(ctx context.Context, req SendBundleParam) (*SentBundle, error)
SendBundle sends signed transaction bundle to the Flashbots relay. The returned SentBundle can be passed to GetBundleStats to check the bundle status inside the relay.
func (*Client) SendPrivateTransaction ¶
func (c *Client) SendPrivateTransaction( ctx context.Context, tx *types.Transaction, maxBlockNumber uint64, fastMode bool, ) (common.Hash, error)
SendPrivateTransaction sends private transaction to the Flashbots RPC. The returned transaction hash can be used to cancel the transaction using the CancelPrivateTransaction.
type HashSigner ¶
HashSigner abstracts an external hash signer.
type SendBundleParam ¶
type SendBundleParam struct { Txs []*types.Transaction BlockNumber uint64 MinTimestamp time.Time MaxTimestamp time.Time AllowRevertTxs []*types.Transaction }
type SentBundle ¶
func (*SentBundle) Identifier ¶
func (b *SentBundle) Identifier() (hash common.Hash, blockNumber uint64)
type SignerFunc ¶ added in v0.1.2
SignerFunc is a generic hash signer function placeholder to support custom keystore implementation.
type TxResult ¶
type TxResult struct { CoinbaseDiff *big.Int `json:"coinbaseDiff"` ETHSentToCoinbase *big.Int `json:"ethSentToCoinbase"` GasFees *big.Int `json:"gasFees"` GasPrice *big.Int `json:"gasPrice"` GasUsed uint64 `json:"gasUsed"` From common.Address `json:"fromAddress"` To common.Address `json:"toAddress"` Hash common.Hash `json:"txHash"` Value *big.Int `json:"value"` Error string `json:"error"` Revert string `json:"revert"` }
type UserStats ¶
type UserStats struct { IsHighPriority bool `json:"is_high_priority"` AllTimeMinerPayments *big.Int `json:"all_time_miner_payments"` AllTimeGasSimulated *big.Int `json:"all_time_gas_simulated"` Last7DaysMinerPayments *big.Int `json:"last_7d_miner_payments"` Last7DaysGasSimulated *big.Int `json:"last_7d_gas_simulated"` Last1DayMinerPayments *big.Int `json:"last_1d_miner_payments"` Last1DayGasSimulated *big.Int `json:"last_1d_gas_simulated"` }