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:576
Instantiates a new Mesh instance.
Parameters:
Name | Type | Description |
| Configuration options for Mesh |
Returns: Mesh
An instance of Mesh
Methods
addOrdersAsync
▸ addOrdersAsync(orders
: SignedOrder[], pinned
: boolean): Promise‹ValidationResults›
Defined in index.ts:650
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 |
| SignedOrder[] | - | An array of orders to add. |
| 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:596
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 |
| Error |
Returns: void
onOrderEvents
▸ onOrderEvents(handler
: function): void
Defined in index.ts:611
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 |
|
Returns: void
startAsync
▸ startAsync(): Promise‹void›
Defined in index.ts:622
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:439
Cancelled
• Cancelled: = "CANCELLED"
Defined in index.ts:442
Expired
• Expired: = "EXPIRED"
Defined in index.ts:443
FillabilityIncreased
• FillabilityIncreased: = "FILLABILITY_INCREASED"
Defined in index.ts:446
Filled
• Filled: = "FILLED"
Defined in index.ts:440
FullyFilled
• FullyFilled: = "FULLY_FILLED"
Defined in index.ts:441
Invalid
• Invalid: = "INVALID"
Defined in index.ts:438
StoppedWatching
• StoppedWatching: = "STOPPED_WATCHING"
Defined in index.ts:447
Unexpired
• Unexpired: = "UNEXPIRED"
Defined in index.ts:444
Unfunded
• Unfunded: = "UNFUNDED"
Defined in index.ts:445
Enumeration: RejectedOrderKind
A set of categories for rejected orders.
Enumeration members
CoordinatorError
• CoordinatorError: = "COORDINATOR_ERROR"
Defined in index.ts:530
MeshError
• MeshError: = "MESH_ERROR"
Defined in index.ts:528
MeshValidation
• MeshValidation: = "MESH_VALIDATION"
Defined in index.ts:529
ZeroExValidation
• ZeroExValidation: = "ZEROEX_VALIDATION"
Defined in index.ts:527
Enumeration: Verbosity
Enumeration members
Debug
• Debug: = 5
Defined in index.ts:149
Error
• Error: = 2
Defined in index.ts:146
Fatal
• Fatal: = 1
Defined in index.ts:145
Info
• Info: = 4
Defined in index.ts:148
Panic
• Panic: = 0
Defined in index.ts:144
Trace
• Trace: = 6
Defined in index.ts:150
Warn
• Warn: = 3
Defined in index.ts:147
Interface: AcceptedOrderInfo
Info for any orders that were accepted.
Hierarchy
AcceptedOrderInfo
Properties
fillableTakerAssetAmount
• fillableTakerAssetAmount: BigNumber
Defined in index.ts:508
isNew
• isNew: boolean
Defined in index.ts:509
orderHash
• orderHash: string
Defined in index.ts:506
signedOrder
• signedOrder: SignedOrder
Defined in index.ts:507
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:420
blockHash
• blockHash: string
Defined in index.ts:415
isRemoved
• isRemoved: string
Defined in index.ts:419
kind
• kind: ContractEventKind
Defined in index.ts:421
logIndex
• logIndex: number
Defined in index.ts:418
parameters
• parameters: ContractEventParameters
Defined in index.ts:422
txHash
• txHash: string
Defined in index.ts:416
txIndex
• txIndex: number
Defined in index.ts:417
Interface: ERC1155ApprovalForAllEvent
Hierarchy
ERC1155ApprovalForAllEvent
Properties
approved
• approved: boolean
Defined in index.ts:296
operator
• operator: string
Defined in index.ts:295
owner
• owner: string
Defined in index.ts:294
Interface: ERC1155TransferBatchEvent
Hierarchy
ERC1155TransferBatchEvent
Properties
from
• from: string
Defined in index.ts:279
ids
• ids: BigNumber[]
Defined in index.ts:281
operator
• operator: string
Defined in index.ts:278
to
• to: string
Defined in index.ts:280
values
• values: BigNumber[]
Defined in index.ts:282
Interface: ERC1155TransferSingleEvent
Hierarchy
ERC1155TransferSingleEvent
Properties
from
• from: string
Defined in index.ts:263
id
• id: BigNumber
Defined in index.ts:265
operator
• operator: string
Defined in index.ts:262
to
• to: string
Defined in index.ts:264
value
• value: BigNumber
Defined in index.ts:266
Interface: ERC20ApprovalEvent
Hierarchy
ERC20ApprovalEvent
Properties
owner
• owner: string
Defined in index.ts:220
spender
• spender: string
Defined in index.ts:221
value
• value: BigNumber
Defined in index.ts:222
Interface: ERC20TransferEvent
Hierarchy
ERC20TransferEvent
Properties
from
• from: string
Defined in index.ts:208
to
• to: string
Defined in index.ts:209
value
• value: BigNumber
Defined in index.ts:210
Interface: ERC721ApprovalEvent
Hierarchy
ERC721ApprovalEvent
Properties
approved
• approved: string
Defined in index.ts:245
owner
• owner: string
Defined in index.ts:244
tokenId
• tokenId: BigNumber
Defined in index.ts:246
Interface: ERC721ApprovalForAllEvent
Hierarchy
ERC721ApprovalForAllEvent
Properties
approved
• approved: boolean
Defined in index.ts:258
operator
• operator: string
Defined in index.ts:257
owner
• owner: string
Defined in index.ts:256
Interface: ERC721TransferEvent
Hierarchy
ERC721TransferEvent
Properties
from
• from: string
Defined in index.ts:232
to
• to: string
Defined in index.ts:233
tokenId
• tokenId: BigNumber
Defined in index.ts:234
Interface: ExchangeCancelEvent
Hierarchy
ExchangeCancelEvent
Properties
feeRecipientAddress
• feeRecipientAddress: string
Defined in index.ts:330
makerAddress
• makerAddress: string
Defined in index.ts:328
makerAssetData
• makerAssetData: string
Defined in index.ts:332
orderHash
• orderHash: string
Defined in index.ts:331
senderAddress
• senderAddress: string
Defined in index.ts:329
takerAssetData
• takerAssetData: string
Defined in index.ts:333
Interface: ExchangeCancelUpToEvent
Hierarchy
ExchangeCancelUpToEvent
Properties
makerAddress
• makerAddress: string
Defined in index.ts:337
orderEpoch
• orderEpoch: BigNumber
Defined in index.ts:339
senderAddress
• senderAddress: string
Defined in index.ts:338
Interface: ExchangeFillEvent
Hierarchy
ExchangeFillEvent
Properties
feeRecipientAddress
• feeRecipientAddress: string
Defined in index.ts:303
makerAddress
• makerAddress: string
Defined in index.ts:300
makerAssetData
• makerAssetData: string
Defined in index.ts:309
makerAssetFilledAmount
• makerAssetFilledAmount: BigNumber
Defined in index.ts:304
makerFeePaid
• makerFeePaid: BigNumber
Defined in index.ts:306
orderHash
• orderHash: string
Defined in index.ts:308
senderAddress
• senderAddress: string
Defined in index.ts:302
takerAddress
• takerAddress: string
Defined in index.ts:301
takerAssetData
• takerAssetData: string
Defined in index.ts:310
takerAssetFilledAmount
• takerAssetFilledAmount: BigNumber
Defined in index.ts:305
takerFeePaid
• takerFeePaid: BigNumber
Defined in index.ts:307
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:469
endState
• endState: OrderEventEndState
Defined in index.ts:467
fillableTakerAssetAmount
• fillableTakerAssetAmount: BigNumber
Defined in index.ts:468
orderHash
• orderHash: string
Defined in index.ts:465
signedOrder
• signedOrder: SignedOrder
Defined in index.ts:466
timestampMs
• timestampMs: number
Defined in index.ts:464
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:519
orderHash
• orderHash: string
Defined in index.ts:517
signedOrder
• signedOrder: SignedOrder
Defined in index.ts:518
status
• status: RejectedOrderStatus
Defined in index.ts:520
Interface: RejectedOrderStatus
Provides more information about why an order was rejected.
Hierarchy
RejectedOrderStatus
Properties
code
• code: string
Defined in index.ts:537
message
• message: string
Defined in index.ts:538
Interface: ValidationResults
Indicates which orders where accepted, which were rejected, and why.
Hierarchy
ValidationResults
Properties
accepted
• accepted: AcceptedOrderInfo[]
Defined in index.ts:498
rejected
• rejected: RejectedOrderInfo[]
Defined in index.ts:499
Interface: WethDepositEvent
Hierarchy
WethDepositEvent
Properties
owner
• owner: string
Defined in index.ts:359
value
• value: BigNumber
Defined in index.ts:360
Interface: WethWithdrawalEvent
Hierarchy
WethWithdrawalEvent
Properties
owner
• owner: string
Defined in index.ts:349
value
• value: BigNumber
Defined in index.ts:350
Last updated