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