Documentation ¶
Overview ¶
Package core contains everything needed to configure and run a 0x Mesh node.
Index ¶
- Constants
- Variables
- type App
- func (app *App) AddOrders(signedOrdersRaw []*json.RawMessage) (*zeroex.ValidationResults, error)
- func (app *App) AddPeer(peerInfo peerstore.PeerInfo) error
- func (app *App) GetMessagesToShare(max int) ([][]byte, error)
- func (app *App) GetOrders(page, perPage int, snapshotID string) (*rpc.GetOrdersResponse, error)
- func (app *App) GetStats() (*rpc.GetStatsResponse, error)
- func (app *App) HandleMessages(messages []*p2p.Message) error
- func (app *App) Start(ctx context.Context) error
- func (app *App) SubscribeToOrderEvents(sink chan<- []*zeroex.OrderEvent) event.Subscription
- type Config
- type ErrSnapshotNotFound
Constants ¶
const ROInvalidSchemaCode = "InvalidSchema"
Variables ¶
var ( ROInternalError = zeroex.RejectedOrderStatus{ Code: "InternalError", Message: "an unexpected internal error has occurred", } ROMaxOrderSizeExceeded = zeroex.RejectedOrderStatus{ Code: "MaxOrderSizeExceeded", Message: fmt.Sprintf("order exceeds the maximum encoded size of %d bytes", maxOrderSizeInBytes), } ROOrderAlreadyStoredAndUnfillable = zeroex.RejectedOrderStatus{ Code: "OrderAlreadyStoredAndUnfillable", Message: "order is already stored and is unfillable. Mesh keeps unfillable orders in storage for a little while incase a block re-org makes them fillable again", } ROIncorrectNetwork = zeroex.RejectedOrderStatus{ Code: "OrderForIncorrectNetwork", Message: "order was created for a different network than the one this Mesh node is configured to support", } ROSenderAddressNotAllowed = zeroex.RejectedOrderStatus{ Code: "SenderAddressNotAllowed", Message: "orders with a senderAddress are not currently supported", } )
RejectedOrderStatus values
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
func (*App) AddOrders ¶
func (app *App) AddOrders(signedOrdersRaw []*json.RawMessage) (*zeroex.ValidationResults, error)
AddOrders can be used to add orders to Mesh. It validates the given orders and if they are valid, will store and eventually broadcast the orders to peers.
func (*App) GetOrders ¶
GetOrders retrieves paginated orders from the Mesh DB at a specific snapshot in time. Passing an empty string as `snapshotID` creates a new snapshot and returns the first set of results. To fetch all orders, continue to make requests supplying the `snapshotID` returned from the first request. After 1 minute of not received further requests referencing a specific snapshot, the snapshot expires and can no longer be used.
func (*App) GetStats ¶
func (app *App) GetStats() (*rpc.GetStatsResponse, error)
GetStats retrieves stats about the Mesh node
func (*App) SubscribeToOrderEvents ¶
func (app *App) SubscribeToOrderEvents(sink chan<- []*zeroex.OrderEvent) event.Subscription
SubscribeToOrderEvents let's one subscribe to order events emitted by the OrderWatcher
type Config ¶
type Config struct { // Verbosity is the logging verbosity: 0=panic, 1=fatal, 2=error, 3=warn, 4=info, 5=debug 6=trace Verbosity int `envvar:"VERBOSITY" default:"2"` // DataDir is the directory to use for persisting all data, including the // database and private key files. DataDir string `envvar:"DATA_DIR" default:"0x_mesh"` // P2PListenPort is the port on which to listen for new peer connections. P2PListenPort int `envvar:"P2P_LISTEN_PORT"` // EthereumRPCURL is the URL of an Etheruem node which supports the JSON RPC // API. EthereumRPCURL string `envvar:"ETHEREUM_RPC_URL" json:"-"` // EthereumNetworkID is the network ID to use when communicating with // Ethereum. EthereumNetworkID int `envvar:"ETHEREUM_NETWORK_ID"` // UseBootstrapList is whether to use the predetermined list of peers to // bootstrap the DHT and peer discovery. UseBootstrapList bool `envvar:"USE_BOOTSTRAP_LIST" default:"true"` // OrderExpirationBuffer is the amount of time before the order's stipulated expiration time // that you'd want it pruned from the Mesh node. OrderExpirationBuffer time.Duration `envvar:"ORDER_EXPIRATION_BUFFER" default:"10s"` // BlockPollingInterval is the polling interval to wait before checking for a new Ethereum block // that might contain transactions that impact the fillability of orders stored by Mesh. Different // networks have different block producing intervals: POW networks are typically slower (e.g., Mainnet) // and POA networks faster (e.g., Kovan) so one should adjust the polling interval accordingly. BlockPollingInterval time.Duration `envvar:"BLOCK_POLLING_INTERVAL" default:"5s"` // EthereumRPCMaxContentLength is the maximum request Content-Length accepted by the backing Ethereum RPC // endpoint used by Mesh. Geth & Infura both limit a request's content length to 1024 * 512 Bytes. Parity // and Alchemy have much higher limits. When batch validating 0x orders, we will fit as many orders into a // request without crossing the max content length. The default value is appropriate for operators using Geth // or Infura. If using Alchemy or Parity, feel free to double the default max in order to reduce the // number of RPC calls made by Mesh. EthereumRPCMaxContentLength int `envvar:"ETHEREUM_RPC_MAX_CONTENT_LENGTH" default:"524288"` }
Config is a set of configuration options for 0x Mesh.
type ErrSnapshotNotFound ¶
type ErrSnapshotNotFound struct {
// contains filtered or unexported fields
}
ErrSnapshotNotFound is the error returned when a snapshot not found with a particular id
func (ErrSnapshotNotFound) Error ¶
func (e ErrSnapshotNotFound) Error() string