Browser API documentation
Last updated
Last updated
The main class for this package. Has methods for receiving order events and sending orders through the 0x Mesh network.
Mesh
+ new Mesh(config
: Config): Mesh
Defined in mesh.ts:132
Instantiates a new Mesh instance.
Parameters:
Returns: Mesh
An instance of Mesh
Optional
wrapper• wrapper? : MeshWrapper
Defined in mesh.ts:129
▸ addOrdersAsync(orders
: SignedOrder[], pinned
: boolean): Promise‹ValidationResults›
Defined in mesh.ts:269
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:
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:207
Get all 0x signed orders currently stored in the Mesh node
Parameters:
Returns: Promise‹GetOrdersResponse›
the snapshotID, snapshotTimestamp and all orders, their hashes and fillableTakerAssetAmounts
▸ getOrdersForPageAsync(perPage
: number, minOrderHash?
: undefined | string): Promise‹GetOrdersResponse›
Defined in mesh.ts:240
Get page of 0x signed orders stored on the Mesh node at the specified snapshot
Parameters:
Returns: Promise‹GetOrdersResponse›
Up to perPage orders with hash greater than minOrderHash, including order hashes and fillableTakerAssetAmounts
▸ getStatsAsync(): Promise‹Stats›
Defined in mesh.ts:190
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:152
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:165
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:174
Starts the Mesh node in the background. Mesh will automatically find peers in the network and begin receiving orders from them.
Returns: Promise‹void›
• ERC1155ApprovalForAllEvent: = "ERC1155ApprovalForAllEvent"
Defined in types.ts:505
• ERC1155TransferBatchEvent: = "ERC1155TransferBatchEvent"
Defined in types.ts:507
• ERC1155TransferSingleEvent: = "ERC1155TransferSingleEvent"
Defined in types.ts:506
• ERC20ApprovalEvent: = "ERC20ApprovalEvent"
Defined in types.ts:501
• ERC20TransferEvent: = "ERC20TransferEvent"
Defined in types.ts:500
• ERC721ApprovalEvent: = "ERC721ApprovalEvent"
Defined in types.ts:503
• ERC721ApprovalForAllEvent: = "ERC721ApprovalForAllEvent"
Defined in types.ts:504
• ERC721TransferEvent: = "ERC721TransferEvent"
Defined in types.ts:502
• ExchangeCancelEvent: = "ExchangeCancelEvent"
Defined in types.ts:509
• ExchangeCancelUpToEvent: = "ExchangeCancelUpToEvent"
Defined in types.ts:510
• ExchangeFillEvent: = "ExchangeFillEvent"
Defined in types.ts:508
• WethDepositEvent: = "WethDepositEvent"
Defined in types.ts:511
• WethWithdrawalEvent: = "WethWithdrawalEvent"
Defined in types.ts:512
• Added: = "ADDED"
Defined in types.ts:575
• Cancelled: = "CANCELLED"
Defined in types.ts:578
• Expired: = "EXPIRED"
Defined in types.ts:579
• FillabilityIncreased: = "FILLABILITY_INCREASED"
Defined in types.ts:582
• Filled: = "FILLED"
Defined in types.ts:576
• FullyFilled: = "FULLY_FILLED"
Defined in types.ts:577
• Invalid: = "INVALID"
Defined in types.ts:574
• StoppedWatching: = "STOPPED_WATCHING"
Defined in types.ts:583
• Unexpired: = "UNEXPIRED"
Defined in types.ts:580
• Unfunded: = "UNFUNDED"
Defined in types.ts:581
A set of categories for rejected orders.
• MeshError: = "MESH_ERROR"
Defined in types.ts:713
• MeshValidation: = "MESH_VALIDATION"
Defined in types.ts:714
• ZeroExValidation: = "ZEROEX_VALIDATION"
Defined in types.ts:712
• Debug: = 5
Defined in types.ts:238
• Error: = 2
Defined in types.ts:235
• Fatal: = 1
Defined in types.ts:234
• Info: = 4
Defined in types.ts:237
• Panic: = 0
Defined in types.ts:233
• Trace: = 6
Defined in types.ts:239
• Warn: = 3
Defined in types.ts:236
Info for any orders that were accepted.
AcceptedOrderInfo
• fillableTakerAssetAmount: BigNumber
Defined in types.ts:693
• isNew: boolean
Defined in types.ts:694
• orderHash: string
Defined in types.ts:691
• signedOrder: SignedOrder
Defined in types.ts:692
A set of configuration options for Mesh.
Config
Optional
blockPollingIntervalSeconds• blockPollingIntervalSeconds? : undefined | number
Defined in types.ts:144
Optional
bootstrapList• bootstrapList? : string[]
Defined in types.ts:137
Optional
customContractAddresses• customContractAddresses? : ContractAddresses
Defined in types.ts:188
Optional
customOrderFilter• customOrderFilter? : JsonSchema
Defined in types.ts:213
Optional
enableEthereumRPCRateLimiting• enableEthereumRPCRateLimiting? : undefined | false | true
Defined in types.ts:161
• ethereumChainID: number
Defined in types.ts:129
Optional
ethereumRPCMaxContentLength• ethereumRPCMaxContentLength? : undefined | number
Defined in types.ts:153
Optional
ethereumRPCMaxRequestsPer24HrUTC• ethereumRPCMaxRequestsPer24HrUTC? : undefined | number
Defined in types.ts:166
Optional
ethereumRPCMaxRequestsPerSecond• ethereumRPCMaxRequestsPerSecond? : undefined | number
Defined in types.ts:172
Optional
ethereumRPCURL• ethereumRPCURL? : undefined | string
Defined in types.ts:126
Optional
maxBytesPerSecond• maxBytesPerSecond? : undefined | number
Defined in types.ts:219
Optional
maxOrdersInStorage• maxOrdersInStorage? : undefined | number
Defined in types.ts:193
Optional
useBootstrapList• useBootstrapList? : undefined | false | true
Defined in types.ts:132
Optional
verbosity• verbosity? : Verbosity
Defined in types.ts:123
Optional
web3Provider• web3Provider? : SupportedProvider
Defined in types.ts:216
ContractAddresses
• devUtils: string
Defined in types.ts:224
• erc1155Proxy: string
Defined in types.ts:227
• erc20Proxy: string
Defined in types.ts:225
• erc721Proxy: string
Defined in types.ts:226
• exchange: string
Defined in types.ts:223
Optional
weth9• weth9? : undefined | string
Defined in types.ts:228
Optional
zrxToken• zrxToken? : undefined | string
Defined in types.ts:229
ContractEvent
• address: string
Defined in types.ts:553
• blockHash: string
Defined in types.ts:548
• isRemoved: boolean
Defined in types.ts:552
• kind: ContractEventKind
Defined in types.ts:554
• logIndex: number
Defined in types.ts:551
• parameters: ContractEventParameters
Defined in types.ts:555
• txHash: string
Defined in types.ts:549
• txIndex: number
Defined in types.ts:550
ERC1155ApprovalForAllEvent
• approved: boolean
Defined in types.ts:417
• operator: string
Defined in types.ts:416
• owner: string
Defined in types.ts:415
ERC1155TransferBatchEvent
• from: string
Defined in types.ts:399
• ids: BigNumber[]
Defined in types.ts:401
• operator: string
Defined in types.ts:398
• to: string
Defined in types.ts:400
• values: BigNumber[]
Defined in types.ts:402
ERC1155TransferSingleEvent
• from: string
Defined in types.ts:382
• id: BigNumber
Defined in types.ts:384
• operator: string
Defined in types.ts:381
• to: string
Defined in types.ts:383
• value: BigNumber
Defined in types.ts:385
ERC20ApprovalEvent
• owner: string
Defined in types.ts:336
• spender: string
Defined in types.ts:337
• value: BigNumber
Defined in types.ts:338
ERC20TransferEvent
• from: string
Defined in types.ts:323
• to: string
Defined in types.ts:324
• value: BigNumber
Defined in types.ts:325
ERC721ApprovalEvent
• approved: string
Defined in types.ts:363
• owner: string
Defined in types.ts:362
• tokenId: BigNumber
Defined in types.ts:364
ERC721ApprovalForAllEvent
• approved: boolean
Defined in types.ts:377
• operator: string
Defined in types.ts:376
• owner: string
Defined in types.ts:375
ERC721TransferEvent
• from: string
Defined in types.ts:349
• to: string
Defined in types.ts:350
• tokenId: BigNumber
Defined in types.ts:351
ExchangeCancelEvent
• feeRecipientAddress: string
Defined in types.ts:458
• makerAddress: string
Defined in types.ts:456
• makerAssetData: string
Defined in types.ts:460
• orderHash: string
Defined in types.ts:459
• senderAddress: string
Defined in types.ts:457
• takerAssetData: string
Defined in types.ts:461
ExchangeCancelUpToEvent
• makerAddress: string
Defined in types.ts:465
• orderEpoch: BigNumber
Defined in types.ts:467
• orderSenderAddress: string
Defined in types.ts:466
ExchangeFillEvent
• feeRecipientAddress: string
Defined in types.ts:424
• makerAddress: string
Defined in types.ts:421
• makerAssetData: string
Defined in types.ts:431
• makerAssetFilledAmount: BigNumber
Defined in types.ts:425
• makerFeeAssetData: string
Defined in types.ts:433
• makerFeePaid: BigNumber
Defined in types.ts:427
• orderHash: string
Defined in types.ts:430
• protocolFeePaid: BigNumber
Defined in types.ts:429
• senderAddress: string
Defined in types.ts:423
• takerAddress: string
Defined in types.ts:422
• takerAssetData: string
Defined in types.ts:432
• takerAssetFilledAmount: BigNumber
Defined in types.ts:426
• takerFeeAssetData: string
Defined in types.ts:434
•