The main class for this package. Has methods for receiving order events and sending orders through the 0x Mesh network.
+ new Mesh (config: Config ): Mesh
Defined in index.ts:641 arrow-up-right
Instantiates a new Mesh instance.
Parameters:
Configuration options for Mesh
Returns: Mesh
An instance of Mesh
▸ addOrdersAsync (orders: SignedOrder[], pinned: boolean): Promise‹ ValidationResults ›
Defined in index.ts:791 arrow-up-right
Validates and adds the given orders to Mesh. If an order is successfully added, Mesh will share it with any peers in the network and start watching it for changes (e.g. filled, canceled, expired). The returned promise will only be rejected if there was an error validating or adding the order; it will not be rejected for any invalid orders (check results.rejected instead).
Parameters:
An array of orders to add.
Whether or not the orders should be pinned. Pinned orders will not be affected by any DDoS prevention or incentive mechanisms and will always stay in storage until they are no longer fillable.
Returns: Promise‹ ValidationResults ›
Validation results for the given orders, indicating which orders were accepted and which were rejected.
▸ getOrdersAsync (perPage: number): Promise‹ GetOrdersResponse ›
Defined in index.ts:720 arrow-up-right
Get all 0x signed orders currently stored in the Mesh node
Parameters:
number of signedOrders to fetch per paginated request
Returns: Promise‹ GetOrdersResponse ›
the snapshotID, snapshotTimestamp and all orders, their hashes and fillableTakerAssetAmounts
getOrdersForPageAsync
▸ getOrdersForPageAsync (page: number, perPage: number, snapshotID?: undefined | string): Promise‹ GetOrdersResponse ›
Defined in index.ts:762 arrow-up-right
Get page of 0x signed orders stored on the Mesh node at the specified snapshot
Parameters:
Page index at which to retrieve orders
Number of signedOrders to fetch per paginated request
The DB snapshot at which to fetch orders. If omitted, a new snapshot is created
Returns: Promise‹ GetOrdersResponse ›
the snapshotID, snapshotTimestamp and all orders, their hashes and fillableTakerAssetAmounts
▸ getStatsAsync (): Promise‹ Stats ›
Defined in index.ts:703 arrow-up-right
Returns various stats about Mesh, including the total number of orders and the number of peers Mesh is connected to.
Returns: Promise‹ Stats ›
▸ onError (handler: function): void
Defined in index.ts:661 arrow-up-right
Registers a handler which will be called in the event of a critical error. Note that the handler will not be called for non-critical errors. In order to ensure no errors are missed, this should be called before startAsync.
Parameters:
▪ handler : function
The handler to be called.
▸ (err: Error): void
Parameters:
Returns: void
▸ onOrderEvents (handler: function): void
Defined in index.ts:676 arrow-up-right
Registers a handler which will be called for any incoming order events. Order events are fired whenver an order is added, canceled, expired, or filled. In order to ensure no events are missed, this should be called before startAsync.
Parameters:
▪ handler : function
The handler to be called.
▸ (events: OrderEvent []): void
Parameters:
Returns: void
▸ startAsync (): Promise‹void›
Defined in index.ts:687 arrow-up-right
Starts the Mesh node in the background. Mesh will automatically find peers in the network and begin receiving orders from them.
Returns: Promise‹void›
Enumeration: OrderEventEndState
Enumeration members
• Added : = "ADDED"
Defined in index.ts:504 arrow-up-right
• Cancelled : = "CANCELLED"
Defined in index.ts:507 arrow-up-right
• Expired : = "EXPIRED"
Defined in index.ts:508 arrow-up-right
FillabilityIncreased
• FillabilityIncreased : = "FILLABILITY_INCREASED"
Defined in index.ts:511 arrow-up-right
• Filled : = "FILLED"
Defined in index.ts:505 arrow-up-right
• FullyFilled : = "FULLY_FILLED"
Defined in index.ts:506 arrow-up-right
• Invalid : = "INVALID"
Defined in index.ts:503 arrow-up-right
StoppedWatching
• StoppedWatching : = "STOPPED_WATCHING"
Defined in index.ts:512 arrow-up-right
• Unexpired : = "UNEXPIRED"
Defined in index.ts:509 arrow-up-right
• Unfunded : = "UNFUNDED"
Defined in index.ts:510 arrow-up-right
Enumeration: RejectedOrderKind
A set of categories for rejected orders.
Enumeration members
CoordinatorError
• CoordinatorError : = "COORDINATOR_ERROR"
Defined in index.ts:595 arrow-up-right
• MeshError : = "MESH_ERROR"
Defined in index.ts:593 arrow-up-right
• MeshValidation : = "MESH_VALIDATION"
Defined in index.ts:594 arrow-up-right
ZeroExValidation
• ZeroExValidation : = "ZEROEX_VALIDATION"
Defined in index.ts:592 arrow-up-right
Enumeration: Verbosity
Enumeration members
• Debug : = 5
Defined in index.ts:212 arrow-up-right
• Error : = 2
Defined in index.ts:209 arrow-up-right
• Fatal : = 1
Defined in index.ts:208 arrow-up-right
• Info : = 4
Defined in index.ts:211 arrow-up-right
• Panic : = 0
Defined in index.ts:207 arrow-up-right
• Trace : = 6
Defined in index.ts:213 arrow-up-right
• Warn : = 3
Defined in index.ts:210 arrow-up-right
Interface: AcceptedOrderInfo
Info for any orders that were accepted.
fillableTakerAssetAmount
• fillableTakerAssetAmount : BigNumber
Defined in index.ts:573 arrow-up-right
• isNew : boolean
Defined in index.ts:574 arrow-up-right
• orderHash : string
Defined in index.ts:571 arrow-up-right
• signedOrder : SignedOrder
Defined in index.ts:572 arrow-up-right
Interface: Config
A set of configuration options for Mesh.
Optional blockPollingIntervalSeconds
• blockPollingIntervalSeconds ? : undefined | number
Defined in index.ts:79 arrow-up-right
Optional bootstrapList
• bootstrapList ? : string[]
Defined in index.ts:72 arrow-up-right
Optional customContractAddresses
• customContractAddresses ? : ContractAddresses
Defined in index.ts:123 arrow-up-right
Optional enableEthereumRPCRateLimiting
• enableEthereumRPCRateLimiting ? : undefined | false | true
Defined in index.ts:96 arrow-up-right
ethereumChainID
• ethereumChainID : number
Defined in index.ts:64 arrow-up-right
Optional ethereumRPCMaxContentLength
• ethereumRPCMaxContentLength ? : undefined | number
Defined in index.ts:88 arrow-up-right
Optional ethereumRPCMaxRequestsPer24HrUTC
• ethereumRPCMaxRequestsPer24HrUTC ? : undefined | number
Defined in index.ts:101 arrow-up-right
Optional ethereumRPCMaxRequestsPerSecond
• ethereumRPCMaxRequestsPerSecond ? : undefined | number
Defined in index.ts:107 arrow-up-right
• ethereumRPCURL : string
Defined in index.ts:61 arrow-up-right
Optional maxOrdersInStorage
• maxOrdersInStorage ? : undefined | number
Defined in index.ts:128 arrow-up-right
Optional useBootstrapList
• useBootstrapList ? : undefined | false | true
Defined in index.ts:67 arrow-up-right
Optional verbosity
• verbosity ? : Verbosity
Defined in index.ts:58 arrow-up-right
Interface: ContractAddresses
Optional coordinator
• coordinator ? : undefined | string
Defined in index.ts:137 arrow-up-right
Optional coordinatorRegistry
• coordinatorRegistry ? : undefined | string
Defined in index.ts:138 arrow-up-right
• devUtils : string
Defined in index.ts:133 arrow-up-right
• erc1155Proxy : string
Defined in index.ts:136 arrow-up-right
• erc20Proxy : string
Defined in index.ts:134 arrow-up-right
• erc721Proxy : string
Defined in index.ts:135 arrow-up-right
• exchange : string
Defined in index.ts:132 arrow-up-right
• weth9 ? : undefined | string
Defined in index.ts:139 arrow-up-right
Optional zrxToken
• zrxToken ? : undefined | string
Defined in index.ts:140 arrow-up-right
Interface: ContractEvent
• address : string
Defined in index.ts:485 arrow-up-right
• blockHash : string
Defined in index.ts:480 arrow-up-right
• isRemoved : string
Defined in index.ts:484 arrow-up-right
• kind : ContractEventKind
Defined in index.ts:486 arrow-up-right
• logIndex : number
Defined in index.ts:483 arrow-up-right
• parameters : ContractEventParameters
Defined in index.ts:487 arrow-up-right
• txHash : string
Defined in index.ts:481 arrow-up-right
• txIndex : number
Defined in index.ts:482 arrow-up-right
Interface: ERC1155ApprovalForAllEvent
ERC1155ApprovalForAllEvent
• approved : boolean
Defined in index.ts:361 arrow-up-right
• operator : string
Defined in index.ts:360 arrow-up-right
• owner : string
Defined in index.ts:359 arrow-up-right
Interface: ERC1155TransferBatchEvent
ERC1155TransferBatchEvent
• from : string
Defined in index.ts:344 arrow-up-right
• ids : BigNumber[]
Defined in index.ts:346 arrow-up-right
• operator : string
Defined in index.ts:343 arrow-up-right
• to : string
Defined in index.ts:345 arrow-up-right
• values : BigNumber[]
Defined in index.ts:347 arrow-up-right
Interface: ERC1155TransferSingleEvent
ERC1155TransferSingleEvent
• from : string
Defined in index.ts:328 arrow-up-right
• id : BigNumber
Defined in index.ts:330 arrow-up-right
• operator : string
Defined in index.ts:327 arrow-up-right
• to : string
Defined in index.ts:329 arrow-up-right
• value : BigNumber
Defined in index.ts:331 arrow-up-right
Interface: ERC20ApprovalEvent
• owner : string
Defined in index.ts:285 arrow-up-right
• spender : string
Defined in index.ts:286 arrow-up-right
• value : BigNumber
Defined in index.ts:287 arrow-up-right
Interface: ERC20TransferEvent
• from : string
Defined in index.ts:273 arrow-up-right
• to : string
Defined in index.ts:274 arrow-up-right
• value : BigNumber
Defined in index.ts:275 arrow-up-right
Interface: ERC721ApprovalEvent
• approved : string
Defined in index.ts:310 arrow-up-right
• owner : string
Defined in index.ts:309 arrow-up-right
• tokenId : BigNumber
Defined in index.ts:311 arrow-up-right
Interface: ERC721ApprovalForAllEvent
ERC721ApprovalForAllEvent
• approved : boolean
Defined in index.ts:323 arrow-up-right
• operator : string
Defined in index.ts:322 arrow-up-right
• owner : string
Defined in index.ts:321 arrow-up-right
Interface: ERC721TransferEvent
• from : string
Defined in index.ts:297 arrow-up-right
• to : string
Defined in index.ts:298 arrow-up-right
• tokenId : BigNumber
Defined in index.ts:299 arrow-up-right
Interface: ExchangeCancelEvent
feeRecipientAddress
• feeRecipientAddress : string
Defined in index.ts:395 arrow-up-right
• makerAddress : string
Defined in index.ts:393 arrow-up-right
• makerAssetData : string
Defined in index.ts:397 arrow-up-right
• orderHash : string
Defined in index.ts:396 arrow-up-right
• senderAddress : string
Defined in index.ts:394 arrow-up-right
• takerAssetData : string
Defined in index.ts:398 arrow-up-right
Interface: ExchangeCancelUpToEvent
• makerAddress : string
Defined in index.ts:402 arrow-up-right
• orderEpoch : BigNumber
Defined in index.ts:404 arrow-up-right
• senderAddress : string
Defined in index.ts:403 arrow-up-right
Interface: ExchangeFillEvent
feeRecipientAddress
• feeRecipientAddress : string
Defined in index.ts:368 arrow-up-right
• makerAddress : string
Defined in index.ts:365 arrow-up-right
• makerAssetData : string
Defined in index.ts:374 arrow-up-right
makerAssetFilledAmount
• makerAssetFilledAmount : BigNumber
Defined in index.ts:369 arrow-up-right
• makerFeePaid : BigNumber
Defined in index.ts:371 arrow-up-right
• orderHash : string
Defined in index.ts:373 arrow-up-right
• senderAddress : string
Defined in index.ts:367 arrow-up-right
• takerAddress : string
Defined in index.ts:366 arrow-up-right
• takerAssetData : string
Defined in index.ts:375 arrow-up-right
takerAssetFilledAmount
• takerAssetFilledAmount : BigNumber
Defined in index.ts:370 arrow-up-right
• takerFeePaid : BigNumber
Defined in index.ts:372 arrow-up-right
Interface: GetOrdersResponse
• ordersInfos : OrderInfo []
Defined in index.ts:203 arrow-up-right
• snapshotID : string
Defined in index.ts:201 arrow-up-right
snapshotTimestamp
• snapshotTimestamp : number
Defined in index.ts:202 arrow-up-right
Interface: LatestBlock
• hash : string
Defined in index.ts:145 arrow-up-right
• number : number
Defined in index.ts:144 arrow-up-right
Interface: OrderEvent
Order events are fired by Mesh whenever an order is added, canceled, expired, or filled.
• contractEvents : ContractEvent []
Defined in index.ts:534 arrow-up-right
• endState : OrderEventEndState
Defined in index.ts:532 arrow-up-right
fillableTakerAssetAmount
• fillableTakerAssetAmount : BigNumber
Defined in index.ts:533 arrow-up-right
• orderHash : string
Defined in index.ts:530 arrow-up-right
• signedOrder : SignedOrder
Defined in index.ts:531 arrow-up-right
• timestampMs : number
Defined in index.ts:529 arrow-up-right
Interface: OrderInfo
fillableTakerAssetAmount
• fillableTakerAssetAmount : BigNumber
Defined in index.ts:191 arrow-up-right
• orderHash : string
Defined in index.ts:189 arrow-up-right
• signedOrder : SignedOrder
Defined in index.ts:190 arrow-up-right
Interface: RejectedOrderInfo
Info for any orders that were rejected, including the reason they were rejected.
• kind : RejectedOrderKind
Defined in index.ts:584 arrow-up-right
• orderHash : string
Defined in index.ts:582 arrow-up-right
• signedOrder : SignedOrder
Defined in index.ts:583 arrow-up-right
• status : RejectedOrderStatus
Defined in index.ts:585 arrow-up-right
Interface: RejectedOrderStatus
Provides more information about why an order was rejected.
• code : string
Defined in index.ts:602 arrow-up-right
• message : string
Defined in index.ts:603 arrow-up-right
Interface: Stats
ethRPCRateLimitExpiredRequests
• ethRPCRateLimitExpiredRequests : number
Defined in index.ts:179 arrow-up-right
ethRPCRequestsSentInCurrentUTCDay
• ethRPCRequestsSentInCurrentUTCDay : number
Defined in index.ts:178 arrow-up-right
ethereumChainID
• ethereumChainID : number
Defined in index.ts:170 arrow-up-right
• latestBlock : LatestBlock
Defined in index.ts:171 arrow-up-right
maxExpirationTime
• maxExpirationTime : BigNumber
Defined in index.ts:176 arrow-up-right
• numOrders : number
Defined in index.ts:173 arrow-up-right
numOrdersIncludingRemoved
• numOrdersIncludingRemoved : number
Defined in index.ts:174 arrow-up-right
• numPeers : number
Defined in index.ts:172 arrow-up-right
numPinnedOrders
• numPinnedOrders : number
Defined in index.ts:175 arrow-up-right
• peerID : string
Defined in index.ts:169 arrow-up-right
• pubSubTopic : string
Defined in index.ts:167 arrow-up-right
• rendezvous : string
Defined in index.ts:168 arrow-up-right
startOfCurrentUTCDay
• startOfCurrentUTCDay : Date
Defined in index.ts:177 arrow-up-right
• version : string
Defined in index.ts:166 arrow-up-right
Interface: ValidationResults
Indicates which orders where accepted, which were rejected, and why.
• accepted : AcceptedOrderInfo []
Defined in index.ts:563 arrow-up-right
• rejected : RejectedOrderInfo []
Defined in index.ts:564 arrow-up-right
Interface: WethDepositEvent
• owner : string
Defined in index.ts:424 arrow-up-right
• value : BigNumber
Defined in index.ts:425 arrow-up-right
Interface: WethWithdrawalEvent
• owner : string
Defined in index.ts:414 arrow-up-right
• value : BigNumber
Defined in index.ts:415 arrow-up-right