rpctypes

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2025 License: MIT Imports: 13 Imported by: 3

Documentation

Overview

Package rpctypes implement types commonly used in the Flashbots codebase for receiving and senging requests

Index

Constants

View Source
const (
	BundleTxLimit     = 100
	MevBundleTxLimit  = 50
	MevBundleMaxDepth = 1
	BundleVersionV1   = "v1"
	BundleVersionV2   = "v2"
)
View Source
const (
	RevertModeAllow = "allow"
	RevertModeDrop  = "drop"
	RevertModeFail  = "fail"
)

Variables

View Source
var (
	ErrBundleNoTxs              = errors.New("bundle with no txs")
	ErrBundleTooManyTxs         = errors.New("too many txs in bundle")
	ErrMevBundleUnmatchedTx     = errors.New("mev bundle with unmatched tx")
	ErrMevBundleTooDeep         = errors.New("mev bundle too deep")
	ErrUnsupportedBundleVersion = errors.New("unsupported bundle version")
)

Functions

This section is empty.

Types

type BidSubsisideBlockArgs

type BidSubsisideBlockArgs uint64

func (*BidSubsisideBlockArgs) UniqueKey

func (b *BidSubsisideBlockArgs) UniqueKey() uuid.UUID

type EthCancelBundleArgs

type EthCancelBundleArgs struct {
	ReplacementUUID string          `json:"replacementUuid"`
	SigningAddress  *common.Address `json:"signingAddress"`
}

func (*EthCancelBundleArgs) UniqueKey

func (b *EthCancelBundleArgs) UniqueKey() uuid.UUID

type EthSendBundleArgs

type EthSendBundleArgs struct {
	Txs               []hexutil.Bytes `json:"txs"`
	BlockNumber       *hexutil.Uint64 `json:"blockNumber"`
	MinTimestamp      *uint64         `json:"minTimestamp,omitempty"`
	MaxTimestamp      *uint64         `json:"maxTimestamp,omitempty"`
	RevertingTxHashes []common.Hash   `json:"revertingTxHashes,omitempty"`
	ReplacementUUID   *string         `json:"replacementUuid,omitempty"`
	Version           *string         `json:"version,omitempty"`

	// fields available only when receiving from the Flashbots or other builders, not users
	ReplacementNonce *uint64         `json:"replacementNonce,omitempty"`
	SigningAddress   *common.Address `json:"signingAddress,omitempty"`

	DroppingTxHashes []common.Hash   `json:"droppingTxHashes,omitempty"` // not supported (from beaverbuild)
	UUID             *string         `json:"uuid,omitempty"`             // not supported (from beaverbuild)
	RefundPercent    *uint64         `json:"refundPercent,omitempty"`    // not supported (from beaverbuild)
	RefundRecipient  *common.Address `json:"refundRecipient,omitempty"`  // not supported (from beaverbuild)
	RefundTxHashes   []string        `json:"refundTxHashes,omitempty"`   // not supported (from titanbuilder)
}

func (*EthSendBundleArgs) UniqueKey

func (b *EthSendBundleArgs) UniqueKey() uuid.UUID

func (*EthSendBundleArgs) Validate

func (b *EthSendBundleArgs) Validate() (common.Hash, uuid.UUID, error)

type EthSendRawTransactionArgs

type EthSendRawTransactionArgs hexutil.Bytes

func (EthSendRawTransactionArgs) MarshalText

func (tx EthSendRawTransactionArgs) MarshalText() ([]byte, error)

func (*EthSendRawTransactionArgs) UniqueKey

func (tx *EthSendRawTransactionArgs) UniqueKey() uuid.UUID

func (*EthSendRawTransactionArgs) UnmarshalJSON

func (tx *EthSendRawTransactionArgs) UnmarshalJSON(input []byte) error

func (*EthSendRawTransactionArgs) UnmarshalText

func (tx *EthSendRawTransactionArgs) UnmarshalText(input []byte) error

type MevBundleBody

type MevBundleBody struct {
	Hash       *common.Hash       `json:"hash,omitempty"`
	Tx         *hexutil.Bytes     `json:"tx,omitempty"`
	Bundle     *MevSendBundleArgs `json:"bundle,omitempty"`
	CanRevert  bool               `json:"canRevert,omitempty"`
	RevertMode string             `json:"revertMode,omitempty"`
}

type MevBundleInclusion

type MevBundleInclusion struct {
	BlockNumber hexutil.Uint64 `json:"block"`
	MaxBlock    hexutil.Uint64 `json:"maxBlock"`
}

type MevBundleMetadata

type MevBundleMetadata struct {
	// Signer should be set by infra that verifies user signatures and not user
	Signer           *common.Address `json:"signer,omitempty"`
	ReplacementNonce *int            `json:"replacementNonce,omitempty"`
	// Used for cancelling. When true the only thing we care about is signer,replacement_nonce and RawShareBundle::replacement_uuid
	Cancelled *bool `json:"cancelled,omitempty"`
}

type MevBundleValidity

type MevBundleValidity struct {
	Refund       []RefundConstraint `json:"refund,omitempty"`
	RefundConfig []RefundConfig     `json:"refundConfig,omitempty"`
}

type MevSendBundleArgs

type MevSendBundleArgs struct {
	Version         string             `json:"version"`
	ReplacementUUID string             `json:"replacementUuid,omitempty"`
	Inclusion       MevBundleInclusion `json:"inclusion"`
	// when empty its considered cancel
	Body     []MevBundleBody    `json:"body"`
	Validity MevBundleValidity  `json:"validity"`
	Metadata *MevBundleMetadata `json:"metadata,omitempty"`

	// must be empty
	Privacy *json.RawMessage `json:"privacy,omitempty"`
}

func (*MevSendBundleArgs) UniqueKey

func (b *MevSendBundleArgs) UniqueKey() uuid.UUID

func (*MevSendBundleArgs) Validate

func (b *MevSendBundleArgs) Validate() (common.Hash, error)

type RefundConfig

type RefundConfig struct {
	Address common.Address `json:"address"`
	Percent int            `json:"percent"`
}

type RefundConstraint

type RefundConstraint struct {
	BodyIdx int `json:"bodyIdx"`
	Percent int `json:"percent"`
}

Jump to

Keyboard shortcuts

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