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:565
Instantiates a new Mesh instance.
Parameters:
Returns: Mesh
An instance of Mesh
Methods
addOrdersAsync
▸ addOrdersAsync(orders
: SignedOrder[], pinned
: boolean): Promise‹ValidationResults›
Defined in index.ts:639
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.
onError
▸ onError(handler
: function): void
Defined in index.ts:585
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
▸ onOrderEvents(handler
: function): void
Defined in index.ts:600
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
▸ startAsync(): Promise‹void›
Defined in index.ts:611
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:430
Cancelled
• Cancelled: = "CANCELLED"
Defined in index.ts:433
Expired
• Expired: = "EXPIRED"
Defined in index.ts:434
FillabilityIncreased
• FillabilityIncreased: = "FILLABILITY_INCREASED"
Defined in index.ts:437
Filled
• Filled: = "FILLED"
Defined in index.ts:431
FullyFilled
• FullyFilled: = "FULLY_FILLED"
Defined in index.ts:432
Invalid
• Invalid: = "INVALID"
Defined in index.ts:429
StoppedWatching
• StoppedWatching: = "STOPPED_WATCHING"
Defined in index.ts:438
Unexpired
• Unexpired: = "UNEXPIRED"
Defined in index.ts:435
Unfunded
• Unfunded: = "UNFUNDED"
Defined in index.ts:436
Enumeration: RejectedOrderKind
A set of categories for rejected orders.
Enumeration members
CoordinatorError
• CoordinatorError: = "COORDINATOR_ERROR"
Defined in index.ts:519
MeshError
• MeshError: = "MESH_ERROR"
Defined in index.ts:517
MeshValidation
• MeshValidation: = "MESH_VALIDATION"
Defined in index.ts:518
ZeroExValidation
• ZeroExValidation: = "ZEROEX_VALIDATION"
Defined in index.ts:516
Enumeration: Verbosity
Enumeration members
Debug
• Debug: = 5
Defined in index.ts:141
Error
• Error: = 2
Defined in index.ts:138
Fatal
• Fatal: = 1
Defined in index.ts:137
Info
• Info: = 4
Defined in index.ts:140
Panic
• Panic: = 0
Defined in index.ts:136
Trace
• Trace: = 6
Defined in index.ts:142
Warn
• Warn: = 3
Defined in index.ts:139
Interface: AcceptedOrderInfo
Info for any orders that were accepted.
Hierarchy
AcceptedOrderInfo
Properties
fillableTakerAssetAmount
• fillableTakerAssetAmount: BigNumber
Defined in index.ts:497
isNew
• isNew: boolean
Defined in index.ts:498
orderHash
• orderHash: string
Defined in index.ts:495
signedOrder
• signedOrder: SignedOrder
Defined in index.ts:496
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:115
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:93
Optional
ethereumRPCMaxRequestsPerSecond
Optional
ethereumRPCMaxRequestsPerSecond• ethereumRPCMaxRequestsPerSecond? : undefined | number
Defined in index.ts:99
ethereumRPCURL
• ethereumRPCURL: string
Defined in index.ts:61
Optional
maxOrdersInStorage
Optional
maxOrdersInStorage• maxOrdersInStorage? : undefined | number
Defined in index.ts:120
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:129
Optional
coordinatorRegistry
Optional
coordinatorRegistry• coordinatorRegistry? : undefined | string
Defined in index.ts:130
devUtils
• devUtils: string
Defined in index.ts:125
erc1155Proxy
• erc1155Proxy: string
Defined in index.ts:128
erc20Proxy
• erc20Proxy: string
Defined in index.ts:126
erc721Proxy
• erc721Proxy: string
Defined in index.ts:127
exchange
• exchange: string
Defined in index.ts:124
Optional
weth9
Optional
weth9• weth9? : undefined | string
Defined in index.ts:131
Optional
zrxToken
Optional
zrxToken• zrxToken? : undefined | string
Defined in index.ts:132
Interface: ContractEvent
Hierarchy
ContractEvent
Properties
address
• address: string
Defined in index.ts:411
blockHash
• blockHash: string
Defined in index.ts:406
isRemoved
• isRemoved: string
Defined in index.ts:410
kind
• kind: ContractEventKind
Defined in index.ts:412
logIndex
• logIndex: number
Defined in index.ts:409
parameters
• parameters: ContractEventParameters
Defined in index.ts:413
txHash
• txHash: string
Defined in index.ts:407
txIndex
• txIndex: number
Defined in index.ts:408
Interface: ERC1155ApprovalForAllEvent
Hierarchy
ERC1155ApprovalForAllEvent
Properties
approved
• approved: boolean
Defined in index.ts:287
operator
• operator: string
Defined in index.ts:286
owner
• owner: string
Defined in index.ts:285
Interface: ERC1155TransferBatchEvent
Hierarchy
ERC1155TransferBatchEvent
Properties
from
• from: string
Defined in index.ts:270
ids
• ids: BigNumber[]
Defined in index.ts:272
operator
• operator: string
Defined in index.ts:269
to
• to: string
Defined in index.ts:271
values
• values: BigNumber[]
Defined in index.ts:273
Interface: ERC1155TransferSingleEvent
Hierarchy
ERC1155TransferSingleEvent
Properties
from
• from: string
Defined in index.ts:254
id
• id: BigNumber
Defined in index.ts:256
operator
• operator: string
Defined in index.ts:253
to
• to: string
Defined in index.ts:255
value
• value: BigNumber
Defined in index.ts:257
Interface: ERC20ApprovalEvent
Hierarchy
ERC20ApprovalEvent
Properties
owner
• owner: string
Defined in index.ts:211
spender
• spender: string
Defined in index.ts:212
value
• value: BigNumber
Defined in index.ts:213
Interface: ERC20TransferEvent
Hierarchy
ERC20TransferEvent
Properties
from
• from: string
Defined in index.ts:199
to
• to: string
Defined in index.ts:200
value
• value: BigNumber
Defined in index.ts:201
Interface: ERC721ApprovalEvent
Hierarchy
ERC721ApprovalEvent
Properties
approved
• approved: string
Defined in index.ts:236
owner
• owner: string
Defined in index.ts:235
tokenId
• tokenId: BigNumber
Defined in index.ts:237
Interface: ERC721ApprovalForAllEvent
Hierarchy
ERC721ApprovalForAllEvent
Properties
approved
• approved: boolean
Defined in index.ts:249
operator
• operator: string
Defined in index.ts:248
owner
• owner: string
Defined in index.ts:247
Interface: ERC721TransferEvent
Hierarchy
ERC721TransferEvent
Properties
from
• from: string
Defined in index.ts:223
to
• to: string
Defined in index.ts:224
tokenId
• tokenId: BigNumber
Defined in index.ts:225
Interface: ExchangeCancelEvent
Hierarchy
ExchangeCancelEvent
Properties
feeRecipientAddress
• feeRecipientAddress: string
Defined in index.ts:321
makerAddress
• makerAddress: string
Defined in index.ts:319
makerAssetData
• makerAssetData: string
Defined in index.ts:323
orderHash
• orderHash: string
Defined in index.ts:322
senderAddress
• senderAddress: string
Defined in index.ts:320
takerAssetData
• takerAssetData: string
Defined in index.ts:324
Interface: ExchangeCancelUpToEvent
Hierarchy
ExchangeCancelUpToEvent
Properties
makerAddress
• makerAddress: string
Defined in index.ts:328
orderEpoch
• orderEpoch: BigNumber
Defined in index.ts:330
senderAddress
• senderAddress: string
Defined in index.ts:329
Interface: ExchangeFillEvent
Hierarchy
ExchangeFillEvent
Properties
feeRecipientAddress
• feeRecipientAddress: string
Defined in index.ts:294
makerAddress
• makerAddress: string
Defined in index.ts:291
makerAssetData
• makerAssetData: string
Defined in index.ts:300
makerAssetFilledAmount
• makerAssetFilledAmount: BigNumber
Defined in index.ts:295
makerFeePaid
• makerFeePaid: BigNumber
Defined in index.ts:297
orderHash
• orderHash: string
Defined in index.ts:299
senderAddress
• senderAddress: string
Defined in index.ts:293
takerAddress
• takerAddress: string
Defined in index.ts:292
takerAssetData
• takerAssetData: string
Defined in index.ts:301
takerAssetFilledAmount
• takerAssetFilledAmount: BigNumber
Defined in index.ts:296
takerFeePaid
• takerFeePaid: BigNumber
Defined in index.ts:298
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:458
endState
• endState: OrderEventEndState
Defined in index.ts:456
fillableTakerAssetAmount
• fillableTakerAssetAmount: BigNumber
Defined in index.ts:457
orderHash
• orderHash: string
Defined in index.ts:454
signedOrder
• signedOrder: SignedOrder
Defined in index.ts:455
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:508
orderHash
• orderHash: string
Defined in index.ts:506
signedOrder
• signedOrder: SignedOrder
Defined in index.ts:507
status
• status: RejectedOrderStatus
Defined in index.ts:509
Interface: RejectedOrderStatus
Provides more information about why an order was rejected.
Hierarchy
RejectedOrderStatus
Properties
code
• code: string
Defined in index.ts:526
message
• message: string
Defined in index.ts:527
Interface: ValidationResults
Indicates which orders where accepted, which were rejected, and why.
Hierarchy
ValidationResults
Properties
accepted
• accepted: AcceptedOrderInfo[]
Defined in index.ts:487
rejected
• rejected: RejectedOrderInfo[]
Defined in index.ts:488
Interface: WethDepositEvent
Hierarchy
WethDepositEvent
Properties
owner
• owner: string
Defined in index.ts:350
value
• value: BigNumber
Defined in index.ts:351
Interface: WethWithdrawalEvent
Hierarchy
WethWithdrawalEvent
Properties
owner
• owner: string
Defined in index.ts:340
value
• value: BigNumber
Defined in index.ts:341
Last updated