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:536

Instantiates a new Mesh instance.

Parameters:

Name

Type

Description

config

Config

Configuration options for Mesh

Returns: Mesh

An instance of Mesh

Methods

addOrdersAsync

addOrdersAsync(orders: SignedOrder[], pinned: boolean): Promise‹ValidationResults

Defined in index.ts:610

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.

onError

onError(handler: function): void

Defined in index.ts:556

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:571

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

OrderEvent[]

Returns: void

startAsync

startAsync(): Promise‹void›

Defined in index.ts:582

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:402

Cancelled

Cancelled: = "CANCELLED"

Defined in index.ts:405

Expired

Expired: = "EXPIRED"

Defined in index.ts:406

FillabilityIncreased

FillabilityIncreased: = "FILLABILITY_INCREASED"

Defined in index.ts:408

Filled

Filled: = "FILLED"

Defined in index.ts:403

FullyFilled

FullyFilled: = "FULLY_FILLED"

Defined in index.ts:404

Invalid

Invalid: = "INVALID"

Defined in index.ts:401

StoppedWatching

StoppedWatching: = "STOPPED_WATCHING"

Defined in index.ts:409

Unfunded

Unfunded: = "UNFUNDED"

Defined in index.ts:407

Enumeration: RejectedOrderKind

A set of categories for rejected orders.

Enumeration members

CoordinatorError

CoordinatorError: = "COORDINATOR_ERROR"

Defined in index.ts:490

MeshError

MeshError: = "MESH_ERROR"

Defined in index.ts:488

MeshValidation

MeshValidation: = "MESH_VALIDATION"

Defined in index.ts:489

ZeroExValidation

ZeroExValidation: = "ZEROEX_VALIDATION"

Defined in index.ts:487

Enumeration: Verbosity

Enumeration members

Debug

Debug: = 5

Defined in index.ts:116

Error

Error: = 2

Defined in index.ts:113

Fatal

Fatal: = 1

Defined in index.ts:112

Info

Info: = 4

Defined in index.ts:115

Panic

Panic: = 0

Defined in index.ts:111

Trace

Trace: = 6

Defined in index.ts:117

Warn

Warn: = 3

Defined in index.ts:114

Interface: AcceptedOrderInfo

Info for any orders that were accepted.

Hierarchy

  • AcceptedOrderInfo

Properties

fillableTakerAssetAmount

fillableTakerAssetAmount: BigNumber

Defined in index.ts:468

isNew

isNew: boolean

Defined in index.ts:469

orderHash

orderHash: string

Defined in index.ts:466

signedOrder

signedOrder: SignedOrder

Defined in index.ts:467

Interface: Config

A set of configuration options for Mesh.

Hierarchy

  • Config

Properties

Optional EthereumRPCMaxRequestsPer24HrUTC

EthereumRPCMaxRequestsPer24HrUTC? : undefined | number

Defined in index.ts:69

Optional EthereumRPCMaxRequestsPerSecond

EthereumRPCMaxRequestsPerSecond? : undefined | number

Defined in index.ts:74

Optional blockPollingIntervalSeconds

blockPollingIntervalSeconds? : undefined | number

Defined in index.ts:56

Optional bootstrapList

bootstrapList? : string[]

Defined in index.ts:49

Optional customContractAddresses

customContractAddresses? : ContractAddresses

Defined in index.ts:90

ethereumChainID

ethereumChainID: number

Defined in index.ts:41

Optional ethereumRPCMaxContentLength

ethereumRPCMaxContentLength? : undefined | number

Defined in index.ts:65

ethereumRPCURL

ethereumRPCURL: string

Defined in index.ts:38

Optional maxOrdersInStorage

maxOrdersInStorage? : undefined | number

Defined in index.ts:95

Optional useBootstrapList

useBootstrapList? : undefined | false | true

Defined in index.ts:44

Optional verbosity

verbosity? : Verbosity

Defined in index.ts:35

Interface: ContractAddresses

Hierarchy

  • ContractAddresses

Properties

Optional coordinator

coordinator? : undefined | string

Defined in index.ts:104

Optional coordinatorRegistry

coordinatorRegistry? : undefined | string

Defined in index.ts:105

devUtils

devUtils: string

Defined in index.ts:100

erc1155Proxy

erc1155Proxy: string

Defined in index.ts:103

erc20Proxy

erc20Proxy: string

Defined in index.ts:101

erc721Proxy

erc721Proxy: string

Defined in index.ts:102

exchange

exchange: string

Defined in index.ts:99

Optional weth9

weth9? : undefined | string

Defined in index.ts:106

Optional zrxToken

zrxToken? : undefined | string

Defined in index.ts:107

Interface: ContractEvent

Hierarchy

  • ContractEvent

Properties

address

address: string

Defined in index.ts:383

blockHash

blockHash: string

Defined in index.ts:378

isRemoved

isRemoved: string

Defined in index.ts:382

kind

kind: ContractEventKind

Defined in index.ts:384

logIndex

logIndex: number

Defined in index.ts:381

parameters

parameters: ContractEventParameters

Defined in index.ts:385

txHash

txHash: string

Defined in index.ts:379

txIndex

txIndex: number

Defined in index.ts:380

Interface: ERC1155ApprovalForAllEvent

Hierarchy

  • ERC1155ApprovalForAllEvent

Properties

approved

approved: boolean

Defined in index.ts:259

operator

operator: string

Defined in index.ts:258

owner

owner: string

Defined in index.ts:257

Interface: ERC1155TransferBatchEvent

Hierarchy

  • ERC1155TransferBatchEvent

Properties

from

from: string

Defined in index.ts:242

ids

ids: BigNumber[]

Defined in index.ts:244

operator

operator: string

Defined in index.ts:241

to

to: string

Defined in index.ts:243

values

values: BigNumber[]

Defined in index.ts:245

Interface: ERC1155TransferSingleEvent

Hierarchy

  • ERC1155TransferSingleEvent

Properties

from

from: string

Defined in index.ts:226

id

id: BigNumber

Defined in index.ts:228

operator

operator: string

Defined in index.ts:225

to

to: string

Defined in index.ts:227

value

value: BigNumber

Defined in index.ts:229

Interface: ERC20ApprovalEvent

Hierarchy

  • ERC20ApprovalEvent

Properties

owner

owner: string

Defined in index.ts:183

spender

spender: string

Defined in index.ts:184

value

value: BigNumber

Defined in index.ts:185

Interface: ERC20TransferEvent

Hierarchy

  • ERC20TransferEvent

Properties

from

from: string

Defined in index.ts:171

to

to: string

Defined in index.ts:172

value

value: BigNumber

Defined in index.ts:173

Interface: ERC721ApprovalEvent

Hierarchy

  • ERC721ApprovalEvent

Properties

approved

approved: string

Defined in index.ts:208

owner

owner: string

Defined in index.ts:207

tokenId

tokenId: BigNumber

Defined in index.ts:209

Interface: ERC721ApprovalForAllEvent

Hierarchy

  • ERC721ApprovalForAllEvent

Properties

approved

approved: boolean

Defined in index.ts:221

operator

operator: string

Defined in index.ts:220

owner

owner: string

Defined in index.ts:219

Interface: ERC721TransferEvent

Hierarchy

  • ERC721TransferEvent

Properties

from

from: string

Defined in index.ts:195

to

to: string

Defined in index.ts:196

tokenId

tokenId: BigNumber

Defined in index.ts:197

Interface: ExchangeCancelEvent

Hierarchy

  • ExchangeCancelEvent

Properties

feeRecipientAddress

feeRecipientAddress: string

Defined in index.ts:293

makerAddress

makerAddress: string

Defined in index.ts:291

makerAssetData

makerAssetData: string

Defined in index.ts:295

orderHash

orderHash: string

Defined in index.ts:294

senderAddress

senderAddress: string

Defined in index.ts:292

takerAssetData

takerAssetData: string

Defined in index.ts:296

Interface: ExchangeCancelUpToEvent

Hierarchy

  • ExchangeCancelUpToEvent

Properties

makerAddress

makerAddress: string

Defined in index.ts:300

orderEpoch

orderEpoch: BigNumber

Defined in index.ts:302

senderAddress

senderAddress: string

Defined in index.ts:301

Interface: ExchangeFillEvent

Hierarchy

  • ExchangeFillEvent

Properties

feeRecipientAddress

feeRecipientAddress: string

Defined in index.ts:266

makerAddress

makerAddress: string

Defined in index.ts:263

makerAssetData

makerAssetData: string

Defined in index.ts:272

makerAssetFilledAmount

makerAssetFilledAmount: BigNumber

Defined in index.ts:267

makerFeePaid

makerFeePaid: BigNumber

Defined in index.ts:269

orderHash

orderHash: string

Defined in index.ts:271

senderAddress

senderAddress: string

Defined in index.ts:265

takerAddress

takerAddress: string

Defined in index.ts:264

takerAssetData

takerAssetData: string

Defined in index.ts:273

takerAssetFilledAmount

takerAssetFilledAmount: BigNumber

Defined in index.ts:268

takerFeePaid

takerFeePaid: BigNumber

Defined in index.ts:270

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:429

endState

endState: OrderEventEndState

Defined in index.ts:427

fillableTakerAssetAmount

fillableTakerAssetAmount: BigNumber

Defined in index.ts:428

orderHash

orderHash: string

Defined in index.ts:425

signedOrder

signedOrder: SignedOrder

Defined in index.ts:426

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:479

orderHash

orderHash: string

Defined in index.ts:477

signedOrder

signedOrder: SignedOrder

Defined in index.ts:478

status

status: RejectedOrderStatus

Defined in index.ts:480

Interface: RejectedOrderStatus

Provides more information about why an order was rejected.

Hierarchy

  • RejectedOrderStatus

Properties

code

code: string

Defined in index.ts:497

message

message: string

Defined in index.ts:498

Interface: ValidationResults

Indicates which orders where accepted, which were rejected, and why.

Hierarchy

  • ValidationResults

Properties

accepted

accepted: AcceptedOrderInfo[]

Defined in index.ts:458

rejected

rejected: RejectedOrderInfo[]

Defined in index.ts:459

Interface: WethDepositEvent

Hierarchy

  • WethDepositEvent

Properties

owner

owner: string

Defined in index.ts:322

value

value: BigNumber

Defined in index.ts:323

Interface: WethWithdrawalEvent

Hierarchy

  • WethWithdrawalEvent

Properties

owner

owner: string

Defined in index.ts:312

value

value: BigNumber

Defined in index.ts:313

Contents
Class: Mesh
constructer
addOrdersAsync
onError
onOrderEvents
startAsync
Enumeration: OrderEventEndState
Added
Cancelled
Expired
FillabilityIncreased
Filled
FullyFilled
Invalid
StoppedWatching
Unfunded
Enumeration: RejectedOrderKind
CoordinatorError
MeshError
MeshValidation
ZeroExValidation
Enumeration: Verbosity
Debug
Error
Fatal
Info
Panic
Trace
Warn
Interface: AcceptedOrderInfo
fillableTakerAssetAmount
isNew
orderHash
signedOrder
Interface: Config
Optional EthereumRPCMaxRequestsPer24HrUTC
Optional EthereumRPCMaxRequestsPerSecond
Optional blockPollingIntervalSeconds
Optional bootstrapList
Optional customContractAddresses
ethereumChainID
Optional ethereumRPCMaxContentLength
ethereumRPCURL
Optional maxOrdersInStorage
Optional useBootstrapList
Optional verbosity
Interface: ContractAddresses
Optional coordinator
Optional coordinatorRegistry
devUtils
erc1155Proxy
erc20Proxy
erc721Proxy
exchange
Optional weth9
Optional zrxToken
Interface: ContractEvent
address
blockHash
isRemoved
kind
logIndex
parameters
txHash
txIndex
Interface: ERC1155ApprovalForAllEvent
approved
operator
owner
Interface: ERC1155TransferBatchEvent
from
ids
operator
to
values
Interface: ERC1155TransferSingleEvent
from
id
operator
to
value
Interface: ERC20ApprovalEvent
owner
spender
value
Interface: ERC20TransferEvent
from
to
value
Interface: ERC721ApprovalEvent
approved
owner
tokenId
Interface: ERC721ApprovalForAllEvent
approved
operator
owner
Interface: ERC721TransferEvent
from
to
tokenId
Interface: ExchangeCancelEvent
feeRecipientAddress
makerAddress
makerAssetData
orderHash
senderAddress
takerAssetData
Interface: ExchangeCancelUpToEvent
makerAddress
orderEpoch
senderAddress
Interface: ExchangeFillEvent
feeRecipientAddress
makerAddress
makerAssetData
makerAssetFilledAmount
makerFeePaid
orderHash
senderAddress
takerAddress
takerAssetData
takerAssetFilledAmount
takerFeePaid
Interface: OrderEvent
contractEvents
endState
fillableTakerAssetAmount
orderHash
signedOrder
Interface: RejectedOrderInfo
kind
orderHash
signedOrder
status
Interface: RejectedOrderStatus
code
message
Interface: ValidationResults
accepted
rejected
Interface: WethDepositEvent
owner
value
Interface: WethWithdrawalEvent
owner
value