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 mesh.ts:141 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 mesh.ts:291 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 mesh.ts:220 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 mesh.ts:262 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 mesh.ts:203 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 mesh.ts:161 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 mesh.ts:176 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 mesh.ts:187 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: ContractEventKind
Enumeration members
ERC1155ApprovalForAllEvent
• ERC1155ApprovalForAllEvent : = "ERC1155ApprovalForAllEvent"
Defined in types.ts:468 arrow-up-right
ERC1155TransferBatchEvent
• ERC1155TransferBatchEvent : = "ERC1155TransferBatchEvent"
Defined in types.ts:470 arrow-up-right
ERC1155TransferSingleEvent
• ERC1155TransferSingleEvent : = "ERC1155TransferSingleEvent"
Defined in types.ts:469 arrow-up-right
ERC20ApprovalEvent
• ERC20ApprovalEvent : = "ERC20ApprovalEvent"
Defined in types.ts:464 arrow-up-right
ERC20TransferEvent
• ERC20TransferEvent : = "ERC20TransferEvent"
Defined in types.ts:463 arrow-up-right
ERC721ApprovalEvent
• ERC721ApprovalEvent : = "ERC721ApprovalEvent"
Defined in types.ts:466 arrow-up-right
ERC721ApprovalForAllEvent
• ERC721ApprovalForAllEvent : = "ERC721ApprovalForAllEvent"
Defined in types.ts:467 arrow-up-right
ERC721TransferEvent
• ERC721TransferEvent : = "ERC721TransferEvent"
Defined in types.ts:465 arrow-up-right
ExchangeCancelEvent
• ExchangeCancelEvent : = "ExchangeCancelEvent"
Defined in types.ts:472 arrow-up-right
ExchangeCancelUpToEvent
• ExchangeCancelUpToEvent : = "ExchangeCancelUpToEvent"
Defined in types.ts:473 arrow-up-right
ExchangeFillEvent
• ExchangeFillEvent : = "ExchangeFillEvent"
Defined in types.ts:471 arrow-up-right
WethDepositEvent
• WethDepositEvent : = "WethDepositEvent"
Defined in types.ts:474 arrow-up-right
WethWithdrawalEvent
• WethWithdrawalEvent : = "WethWithdrawalEvent"
Defined in types.ts:475 arrow-up-right
Enumeration: OrderEventEndState
Enumeration members
• Added : = "ADDED"
Defined in types.ts:538 arrow-up-right
• Cancelled : = "CANCELLED"
Defined in types.ts:541 arrow-up-right
• Expired : = "EXPIRED"
Defined in types.ts:542 arrow-up-right
FillabilityIncreased
• FillabilityIncreased : = "FILLABILITY_INCREASED"
Defined in types.ts:545 arrow-up-right
• Filled : = "FILLED"
Defined in types.ts:539 arrow-up-right
• FullyFilled : = "FULLY_FILLED"
Defined in types.ts:540 arrow-up-right
• Invalid : = "INVALID"
Defined in types.ts:537 arrow-up-right
StoppedWatching
• StoppedWatching : = "STOPPED_WATCHING"
Defined in types.ts:546 arrow-up-right
• Unexpired : = "UNEXPIRED"
Defined in types.ts:543 arrow-up-right
• Unfunded : = "UNFUNDED"
Defined in types.ts:544 arrow-up-right
Enumeration: RejectedOrderKind
A set of categories for rejected orders.
Enumeration members
CoordinatorError
• CoordinatorError : = "COORDINATOR_ERROR"
Defined in types.ts:630 arrow-up-right
• MeshError : = "MESH_ERROR"
Defined in types.ts:628 arrow-up-right
• MeshValidation : = "MESH_VALIDATION"
Defined in types.ts:629 arrow-up-right
ZeroExValidation
• ZeroExValidation : = "ZEROEX_VALIDATION"
Defined in types.ts:627 arrow-up-right
Enumeration: Verbosity
Enumeration members
• Debug : = 5
Defined in types.ts:211 arrow-up-right
• Error : = 2
Defined in types.ts:208 arrow-up-right
• Fatal : = 1
Defined in types.ts:207 arrow-up-right
• Info : = 4
Defined in types.ts:210 arrow-up-right
• Panic : = 0
Defined in types.ts:206 arrow-up-right
• Trace : = 6
Defined in types.ts:212 arrow-up-right
• Warn : = 3
Defined in types.ts:209 arrow-up-right
Interface: AcceptedOrderInfo
Info for any orders that were accepted.
fillableTakerAssetAmount
• fillableTakerAssetAmount : BigNumber
Defined in types.ts:608 arrow-up-right
• isNew : boolean
Defined in types.ts:609 arrow-up-right
• orderHash : string
Defined in types.ts:606 arrow-up-right
• signedOrder : SignedOrder
Defined in types.ts:607 arrow-up-right
Interface: Config
A set of configuration options for Mesh.
Optional blockPollingIntervalSeconds
• blockPollingIntervalSeconds ? : undefined | number
Defined in types.ts:118 arrow-up-right
Optional bootstrapList
• bootstrapList ? : string[]
Defined in types.ts:111 arrow-up-right
Optional customContractAddresses
• customContractAddresses ? : ContractAddresses
Defined in types.ts:162 arrow-up-right
Optional customOrderFilter
• customOrderFilter ? : JsonSchema
Defined in types.ts:187 arrow-up-right
Optional enableEthereumRPCRateLimiting
• enableEthereumRPCRateLimiting ? : undefined | false | true
Defined in types.ts:135 arrow-up-right
ethereumChainID
• ethereumChainID : number
Defined in types.ts:103 arrow-up-right
Optional ethereumRPCMaxContentLength
• ethereumRPCMaxContentLength ? : undefined | number
Defined in types.ts:127 arrow-up-right
Optional ethereumRPCMaxRequestsPer24HrUTC
• ethereumRPCMaxRequestsPer24HrUTC ? : undefined | number
Defined in types.ts:140 arrow-up-right
Optional ethereumRPCMaxRequestsPerSecond
• ethereumRPCMaxRequestsPerSecond ? : undefined | number
Defined in types.ts:146 arrow-up-right
Optional ethereumRPCURL
• ethereumRPCURL ? : undefined | string
Defined in types.ts:100 arrow-up-right
Optional maxOrdersInStorage
• maxOrdersInStorage ? : undefined | number
Defined in types.ts:167 arrow-up-right
Optional useBootstrapList
• useBootstrapList ? : undefined | false | true
Defined in types.ts:106 arrow-up-right
Optional verbosity
• verbosity ? : Verbosity
Defined in types.ts:97 arrow-up-right
Optional web3Provider
• web3Provider ? : SupportedProvider
Defined in types.ts:190 arrow-up-right
Interface: ContractAddresses
Optional coordinator
• coordinator ? : undefined | string
Defined in types.ts:199 arrow-up-right
Optional coordinatorRegistry
• coordinatorRegistry ? : undefined | string
Defined in types.ts:200 arrow-up-right
• devUtils : string
Defined in types.ts:195 arrow-up-right
• erc1155Proxy : string
Defined in types.ts:198 arrow-up-right
• erc20Proxy : string
Defined in types.ts:196 arrow-up-right
• erc721Proxy : string
Defined in types.ts:197 arrow-up-right
• exchange : string
Defined in types.ts:194 arrow-up-right
• weth9 ? : undefined | string
Defined in types.ts:201 arrow-up-right
Optional zrxToken
• zrxToken ? : undefined | string
Defined in types.ts:202 arrow-up-right
Interface: ContractEvent
• address : string
Defined in types.ts:516 arrow-up-right
• blockHash : string
Defined in types.ts:511 arrow-up-right
• isRemoved : boolean
Defined in types.ts:515 arrow-up-right
• kind : ContractEventKind
Defined in types.ts:517 arrow-up-right
• logIndex : number
Defined in types.ts:514 arrow-up-right
• parameters : ContractEventParameters
Defined in types.ts:518 arrow-up-right
• txHash : string
Defined in types.ts:512 arrow-up-right
• txIndex : number
Defined in types.ts:513 arrow-up-right
Interface: ERC1155ApprovalForAllEvent
ERC1155ApprovalForAllEvent
• approved : boolean
Defined in types.ts:380 arrow-up-right
• operator : string
Defined in types.ts:379 arrow-up-right
• owner : string
Defined in types.ts:378 arrow-up-right
Interface: ERC1155TransferBatchEvent
ERC1155TransferBatchEvent
• from : string
Defined in types.ts:362 arrow-up-right
• ids : BigNumber[]
Defined in types.ts:364 arrow-up-right
• operator : string
Defined in types.ts:361 arrow-up-right
• to : string
Defined in types.ts:363 arrow-up-right
• values : BigNumber[]
Defined in types.ts:365 arrow-up-right
Interface: ERC1155TransferSingleEvent
ERC1155TransferSingleEvent
• from : string
Defined in types.ts:345 arrow-up-right
• id : BigNumber
Defined in types.ts:347 arrow-up-right
• operator : string
Defined in types.ts:344 arrow-up-right
• to : string
Defined in types.ts:346 arrow-up-right
• value : BigNumber
Defined in types.ts:348 arrow-up-right
Interface: ERC20ApprovalEvent
• owner : string
Defined in types.ts:299 arrow-up-right
• spender : string
Defined in types.ts:300 arrow-up-right
• value : BigNumber
Defined in types.ts:301 arrow-up-right
Interface: ERC20TransferEvent
• from : string
Defined in types.ts:286 arrow-up-right
• to : string
Defined in types.ts:287 arrow-up-right
• value : BigNumber
Defined in types.ts:288 arrow-up-right
Interface: ERC721ApprovalEvent
• approved : string
Defined in types.ts:326 arrow-up-right
• owner : string
Defined in types.ts:325 arrow-up-right
• tokenId : BigNumber
Defined in types.ts:327 arrow-up-right
Interface: ERC721ApprovalForAllEvent
ERC721ApprovalForAllEvent
• approved : boolean
Defined in types.ts:340 arrow-up-right
• operator : string
Defined in types.ts:339 arrow-up-right
• owner : string
Defined in types.ts:338 arrow-up-right
Interface: ERC721TransferEvent
• from : string
Defined in types.ts:312 arrow-up-right
• to : string
Defined in types.ts:313 arrow-up-right
• tokenId : BigNumber
Defined in types.ts:314 arrow-up-right
Interface: ExchangeCancelEvent
feeRecipientAddress
• feeRecipientAddress : string
Defined in types.ts:421 arrow-up-right
• makerAddress : string
Defined in types.ts:419 arrow-up-right
• makerAssetData : string
Defined in types.ts:423 arrow-up-right
• orderHash : string
Defined in types.ts:422 arrow-up-right
• senderAddress : string
Defined in types.ts:420 arrow-up-right
• takerAssetData : string
Defined in types.ts:424 arrow-up-right
Interface: ExchangeCancelUpToEvent
• makerAddress : string
Defined in types.ts:428 arrow-up-right
• orderEpoch : BigNumber
Defined in types.ts:430 arrow-up-right
orderSenderAddress
• orderSenderAddress : string
Defined in types.ts:429 arrow-up-right
Interface: ExchangeFillEvent
feeRecipientAddress
• feeRecipientAddress : string
Defined in types.ts:387 arrow-up-right
• makerAddress : string
Defined in types.ts:384 arrow-up-right
• makerAssetData : string
Defined in types.ts:394 arrow-up-right
makerAssetFilledAmount
• makerAssetFilledAmount : BigNumber
Defined in types.ts:388 arrow-up-right
makerFeeAssetData
• makerFeeAssetData : string
Defined in types.ts:396 arrow-up-right
• makerFeePaid : BigNumber
Defined in types.ts:390 arrow-up-right
• orderHash : string
Defined in types.ts:393 arrow-up-right
protocolFeePaid
• protocolFeePaid : BigNumber
Defined in types.ts:392 arrow-up-right
• senderAddress : string
Defined in types.ts:386 arrow-up-right
• takerAddress : string
Defined in types.ts:385 arrow-up-right
• takerAssetData : string
Defined in types.ts:395 arrow-up-right
takerAssetFilledAmount
• takerAssetFilledAmount : BigNumber
Defined in types.ts:389 arrow-up-right
takerFeeAssetData
• takerFeeAssetData : string
Defined in types.ts:397 arrow-up-right
• takerFeePaid : BigNumber
Defined in types.ts:391 arrow-up-right
Interface: GetOrdersResponse
• ordersInfos : OrderInfo []
Defined in types.ts:19 arrow-up-right
• snapshotID : string
Defined in types.ts:17 arrow-up-right
snapshotTimestamp
• snapshotTimestamp : number
Defined in types.ts:18 arrow-up-right
Interface: JsonSchema
An interface for JSON schema types, which are used for custom order filters.
• $ref ? : undefined | string
Defined in types.ts:41 arrow-up-right
Optional $schema
• $schema ? : undefined | string
Defined in types.ts:40 arrow-up-right
Optional additionalItems
• additionalItems ? : boolean | JsonSchema
Defined in types.ts:52 arrow-up-right
Optional additionalProperties
• additionalProperties ? : boolean | JsonSchema
Defined in types.ts:60 arrow-up-right
• allOf ? : JsonSchema []
Defined in types.ts:82 arrow-up-right
• anyOf ? : JsonSchema []
Defined in types.ts:83 arrow-up-right
• const ? : any
Defined in types.ts:79 arrow-up-right
Optional definitions
• definitions ? : undefined | object
Defined in types.ts:61 arrow-up-right
Optional dependencies
• dependencies ? : undefined | object
Defined in types.ts:70 arrow-up-right
Optional description
• description ? : undefined | string
Defined in types.ts:43 arrow-up-right
• enum ? : any[]
Defined in types.ts:73 arrow-up-right
Optional exclusiveMaximum
• exclusiveMaximum ? : undefined | false | true
Defined in types.ts:46 arrow-up-right
Optional exclusiveMinimum
• exclusiveMinimum ? : undefined | false | true
Defined in types.ts:48 arrow-up-right
• format ? : undefined | string
Defined in types.ts:81 arrow-up-right
• id ? : undefined | string
Defined in types.ts:39 arrow-up-right
• items ? : JsonSchema | JsonSchema []
Defined in types.ts:53 arrow-up-right
Optional maxItems
• maxItems ? : undefined | number
Defined in types.ts:54 arrow-up-right
Optional maxLength
• maxLength ? : undefined | number
Defined in types.ts:49 arrow-up-right
Optional maxProperties
• maxProperties ? : undefined | number
Defined in types.ts:57 arrow-up-right
Optional maximum
• maximum ? : undefined | number
Defined in types.ts:45 arrow-up-right
Optional minItems
• minItems ? : undefined | number
Defined in types.ts:55 arrow-up-right
Optional minLength
• minLength ? : undefined | number
Defined in types.ts:50 arrow-up-right
Optional minProperties
• minProperties ? : undefined | number
Defined in types.ts:58 arrow-up-right
Optional minimum
• minimum ? : undefined | number
Defined in types.ts:47 arrow-up-right
Optional multipleOf
• multipleOf ? : undefined | number
Defined in types.ts:44 arrow-up-right
• not ? : JsonSchema
Defined in types.ts:85 arrow-up-right
• oneOf ? : JsonSchema []
Defined in types.ts:84 arrow-up-right
Optional pattern
• pattern ? : string | RegExp
Defined in types.ts:51 arrow-up-right
Optional patternProperties
• patternProperties ? : undefined | object
Defined in types.ts:67 arrow-up-right
Optional properties
• properties ? : undefined | object
Defined in types.ts:64 arrow-up-right
Optional required
• required ? : string[]
Defined in types.ts:59 arrow-up-right
• title ? : undefined | string
Defined in types.ts:42 arrow-up-right
• type ? : string | string[]
Defined in types.ts:80 arrow-up-right
Optional uniqueItems
• uniqueItems ? : undefined | false | true
Defined in types.ts:56 arrow-up-right
Interface: LatestBlock
• hash : string
Defined in types.ts:643 arrow-up-right
• number : number
Defined in types.ts:642 arrow-up-right
Interface: OrderEvent
Order events are fired by Mesh whenever an order is added, canceled, expired, or filled.
• contractEvents : ContractEvent []
Defined in types.ts:569 arrow-up-right
• endState : OrderEventEndState
Defined in types.ts:567 arrow-up-right
fillableTakerAssetAmount
• fillableTakerAssetAmount : BigNumber
Defined in types.ts:568 arrow-up-right
• orderHash : string
Defined in types.ts:565 arrow-up-right
• signedOrder : SignedOrder
Defined in types.ts:566 arrow-up-right
• timestampMs : number
Defined in types.ts:564 arrow-up-right
Interface: OrderInfo
fillableTakerAssetAmount
• fillableTakerAssetAmount : BigNumber
Defined in types.ts:32 arrow-up-right
• orderHash : string
Defined in types.ts:30 arrow-up-right
• signedOrder : SignedOrder
Defined in types.ts:31 arrow-up-right
Interface: RejectedOrderInfo
Info for any orders that were rejected, including the reason they were rejected.
• kind : RejectedOrderKind
Defined in types.ts:619 arrow-up-right
• orderHash : string
Defined in types.ts:617 arrow-up-right
• signedOrder : SignedOrder
Defined in types.ts:618 arrow-up-right
• status : RejectedOrderStatus
Defined in types.ts:620 arrow-up-right
Interface: RejectedOrderStatus
Provides more information about why an order was rejected.
• code : string
Defined in types.ts:637 arrow-up-right
• message : string
Defined in types.ts:638 arrow-up-right
Interface: Stats
ethRPCRateLimitExpiredRequests
• ethRPCRateLimitExpiredRequests : number
Defined in types.ts:680 arrow-up-right
ethRPCRequestsSentInCurrentUTCDay
• ethRPCRequestsSentInCurrentUTCDay : number
Defined in types.ts:679 arrow-up-right
ethereumChainID
• ethereumChainID : number
Defined in types.ts:671 arrow-up-right
• latestBlock : LatestBlock
Defined in types.ts:672 arrow-up-right
maxExpirationTime
• maxExpirationTime : BigNumber
Defined in types.ts:677 arrow-up-right
• numOrders : number
Defined in types.ts:674 arrow-up-right
numOrdersIncludingRemoved
• numOrdersIncludingRemoved : number
Defined in types.ts:675 arrow-up-right
• numPeers : number
Defined in types.ts:673 arrow-up-right
numPinnedOrders
• numPinnedOrders : number
Defined in types.ts:676 arrow-up-right
• peerID : string
Defined in types.ts:670 arrow-up-right
• pubSubTopic : string
Defined in types.ts:667 arrow-up-right
• rendezvous : string
Defined in types.ts:668 arrow-up-right
secondaryRendezvous
• secondaryRendezvous : string[]
Defined in types.ts:669 arrow-up-right
startOfCurrentUTCDay
• startOfCurrentUTCDay : Date
Defined in types.ts:678 arrow-up-right
• version : string
Defined in types.ts:666 arrow-up-right
Interface: ValidationResults
Indicates which orders where accepted, which were rejected, and why.
• accepted : AcceptedOrderInfo []
Defined in types.ts:598 arrow-up-right
• rejected : RejectedOrderInfo []
Defined in types.ts:599 arrow-up-right
Interface: WethDepositEvent
• owner : string
Defined in types.ts:452 arrow-up-right
• value : BigNumber
Defined in types.ts:453 arrow-up-right
Interface: WethWithdrawalEvent
• owner : string
Defined in types.ts:441 arrow-up-right
• value : BigNumber
Defined in types.ts:442 arrow-up-right
loadMeshStreamingForURLAsync
▸ loadMeshStreamingWithURLAsync (url: string): Promise‹ void ›
Defined in index.ts:7 arrow-up-right
Loads the Wasm module that is provided by fetching a url.
Parameters:
The URL to query for the Wasm binary
loadMeshStreamingAsync
▸ loadMeshStreamingAsync (response: Response | Promise<Response>): Promise‹ void ›
Defined in index.ts:15 arrow-up-right
Loads the Wasm module that is provided by a response.
Parameters:
Response | Promise<Response>
The Wasm response that supplies the Wasm binary