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

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[]): Promise‹ValidationResults

Defined in index.ts:495

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

Description

orders

SignedOrder[]

An array of orders to add.

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

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

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

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

Cancelled

Cancelled: = "CANCELLED"

Defined in index.ts:295

Expired

Expired: = "EXPIRED"

Defined in index.ts:296

FillabilityIncreased

FillabilityIncreased: = "FILLABILITY_INCREASED"

Defined in index.ts:298

Filled

Filled: = "FILLED"

Defined in index.ts:293

FullyFilled

FullyFilled: = "FULLY_FILLED"

Defined in index.ts:294

Invalid

Invalid: = "INVALID"

Defined in index.ts:291

Unfunded

Unfunded: = "UNFUNDED"

Defined in index.ts:297

Enumeration: RejectedOrderKind

A set of categories for rejected orders.

Enumeration members

CoordinatorError

CoordinatorError: = "COORDINATOR_ERROR"

Defined in index.ts:379

MeshError

MeshError: = "MESH_ERROR"

Defined in index.ts:377

MeshValidation

MeshValidation: = "MESH_VALIDATION"

Defined in index.ts:378

ZeroExValidation

ZeroExValidation: = "ZEROEX_VALIDATION"

Defined in index.ts:376

Enumeration: Verbosity

Enumeration members

Debug

Debug: = 5

Defined in index.ts:77

Error

Error: = 2

Defined in index.ts:74

Fatal

Fatal: = 1

Defined in index.ts:73

Info

Info: = 4

Defined in index.ts:76

Panic

Panic: = 0

Defined in index.ts:72

Trace

Trace: = 6

Defined in index.ts:78

Warn

Warn: = 3

Defined in index.ts:75

Interface: AcceptedOrderInfo

Info for any orders that were accepted.

Hierarchy

  • AcceptedOrderInfo

Properties

fillableTakerAssetAmount

fillableTakerAssetAmount: BigNumber

Defined in index.ts:357

isNew

isNew: boolean

Defined in index.ts:358

orderHash

orderHash: string

Defined in index.ts:355

signedOrder

signedOrder: SignedOrder

Defined in index.ts:356

Interface: Config

A set of configuration options for Mesh.

Hierarchy

  • Config

Properties

Optional blockPollingIntervalSeconds

blockPollingIntervalSeconds? : undefined | number

Defined in index.ts:59

Optional bootstrapList

bootstrapList? : string[]

Defined in index.ts:48

ethereumNetworkID

ethereumNetworkID: number

Defined in index.ts:40

Optional ethereumRPCMaxContentLength

ethereumRPCMaxContentLength? : undefined | number

Defined in index.ts:68

ethereumRPCURL

ethereumRPCURL: string

Defined in index.ts:38

Optional orderExpirationBufferSeconds

orderExpirationBufferSeconds? : undefined | number

Defined in index.ts:52

Optional useBootstrapList

useBootstrapList? : undefined | false | true

Defined in index.ts:43

Optional verbosity

verbosity? : Verbosity

Defined in index.ts:35

Interface: ContractEvent

Hierarchy

  • ContractEvent

Properties

address

address: string

Defined in index.ts:273

blockHash

blockHash: string

Defined in index.ts:268

isRemoved

isRemoved: string

Defined in index.ts:272

kind

kind: ContractEventKind

Defined in index.ts:274

logIndex

logIndex: number

Defined in index.ts:271

parameters

parameters: ContractEventParameters

Defined in index.ts:275

txHash

txHash: string

Defined in index.ts:269

txIndex

txIndex: number

Defined in index.ts:270

Interface: ERC20ApprovalEvent

Hierarchy

  • ERC20ApprovalEvent

Properties

owner

owner: string

Defined in index.ts:141

spender

spender: string

Defined in index.ts:142

value

value: BigNumber

Defined in index.ts:143

Interface: ERC20TransferEvent

Hierarchy

  • ERC20TransferEvent

Properties

from

from: string

Defined in index.ts:129

to

to: string

Defined in index.ts:130

value

value: BigNumber

Defined in index.ts:131

Interface: ERC721ApprovalEvent

Hierarchy

  • ERC721ApprovalEvent

Properties

approved

approved: string

Defined in index.ts:166

owner

owner: string

Defined in index.ts:165

tokenId

tokenId: BigNumber

Defined in index.ts:167

Interface: ERC721ApprovalForAllEvent

Hierarchy

  • ERC721ApprovalForAllEvent

Properties

approved

approved: boolean

Defined in index.ts:179

operator

operator: string

Defined in index.ts:178

owner

owner: string

Defined in index.ts:177

Interface: ERC721TransferEvent

Hierarchy

  • ERC721TransferEvent

Properties

from

from: string

Defined in index.ts:153

to

to: string

Defined in index.ts:154

tokenId

tokenId: BigNumber

Defined in index.ts:155

Interface: ExchangeCancelEvent

Hierarchy

  • ExchangeCancelEvent

Properties

feeRecipientAddress

feeRecipientAddress: string

Defined in index.ts:213

makerAddress

makerAddress: string

Defined in index.ts:211

makerAssetData

makerAssetData: string

Defined in index.ts:215

orderHash

orderHash: string

Defined in index.ts:214

senderAddress

senderAddress: string

Defined in index.ts:212

takerAssetData

takerAssetData: string

Defined in index.ts:216

Interface: ExchangeCancelUpToEvent

Hierarchy

  • ExchangeCancelUpToEvent

Properties

makerAddress

makerAddress: string

Defined in index.ts:220

orderEpoch

orderEpoch: BigNumber

Defined in index.ts:222

senderAddress

senderAddress: string

Defined in index.ts:221

Interface: ExchangeFillEvent

Hierarchy

  • ExchangeFillEvent

Properties

feeRecipientAddress

feeRecipientAddress: string

Defined in index.ts:186

makerAddress

makerAddress: string

Defined in index.ts:183

makerAssetData

makerAssetData: string

Defined in index.ts:192

makerAssetFilledAmount

makerAssetFilledAmount: BigNumber

Defined in index.ts:187

makerFeePaid

makerFeePaid: BigNumber

Defined in index.ts:189

orderHash

orderHash: string

Defined in index.ts:191

senderAddress

senderAddress: string

Defined in index.ts:185

takerAddress

takerAddress: string

Defined in index.ts:184

takerAssetData

takerAssetData: string

Defined in index.ts:193

takerAssetFilledAmount

takerAssetFilledAmount: BigNumber

Defined in index.ts:188

takerFeePaid

takerFeePaid: BigNumber

Defined in index.ts:190

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

endState

endState: OrderEventEndState

Defined in index.ts:316

fillableTakerAssetAmount

fillableTakerAssetAmount: BigNumber

Defined in index.ts:317

orderHash

orderHash: string

Defined in index.ts:314

signedOrder

signedOrder: SignedOrder

Defined in index.ts:315

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

orderHash

orderHash: string

Defined in index.ts:366

signedOrder

signedOrder: SignedOrder

Defined in index.ts:367

status

status: RejectedOrderStatus

Defined in index.ts:369

Interface: RejectedOrderStatus

Provides more information about why an order was rejected.

Hierarchy

  • RejectedOrderStatus

Properties

code

code: string

Defined in index.ts:386

message

message: string

Defined in index.ts:387

Interface: ValidationResults

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

Hierarchy

  • ValidationResults

Properties

accepted

accepted: AcceptedOrderInfo[]

Defined in index.ts:347

rejected

rejected: RejectedOrderInfo[]

Defined in index.ts:348

Interface: WethDepositEvent

Hierarchy

  • WethDepositEvent

Properties

owner

owner: string

Defined in index.ts:242

value

value: BigNumber

Defined in index.ts:243

Interface: WethWithdrawalEvent

Hierarchy

  • WethWithdrawalEvent

Properties

owner

owner: string

Defined in index.ts:232

value

value: BigNumber

Defined in index.ts:233

Contents
Class: Mesh
constructer
addOrdersAsync
onError
onOrderEvents
startAsync
Enumeration: OrderEventEndState
Added
Cancelled
Expired
FillabilityIncreased
Filled
FullyFilled
Invalid
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 blockPollingIntervalSeconds
Optional bootstrapList
ethereumNetworkID
Optional ethereumRPCMaxContentLength
ethereumRPCURL
Optional orderExpirationBufferSeconds
Optional useBootstrapList
Optional verbosity
Interface: ContractEvent
address
blockHash
isRemoved
kind
logIndex
parameters
txHash
txIndex
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