Browser-Lite 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 mesh.ts:132
Instantiates a new Mesh instance.
Parameters:
Name
Type
Description
config
Configuration options for Mesh
Returns: Mesh
An instance of Mesh
Properties
Optional
wrapper
Optional
wrapper• wrapper? : MeshWrapper
Defined in mesh.ts:129
Methods
addOrdersAsync
▸ addOrdersAsync(orders
: SignedOrder[], pinned
: boolean): Promise‹ValidationResults›
Defined in mesh.ts:269
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 mesh.ts:207
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(perPage
: number, minOrderHash?
: undefined | string): Promise‹GetOrdersResponse›
Defined in mesh.ts:240
Get page of 0x signed orders stored on the Mesh node at the specified snapshot
Parameters:
Name
Type
Description
perPage
number
Number of signedOrders to fetch per paginated request
minOrderHash?
undefined | string
The minimum order hash for the returned orders. Should be set based on the last hash from the previous response.
Returns: Promise‹GetOrdersResponse›
Up to perPage orders with hash greater than minOrderHash, including order hashes and fillableTakerAssetAmounts
getStatsAsync
▸ getStatsAsync(): Promise‹Stats›
Defined in mesh.ts:190
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 mesh.ts:152
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 mesh.ts:165
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 mesh.ts:174
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: ContractEventKind
Enumeration members
ERC1155ApprovalForAllEvent
• ERC1155ApprovalForAllEvent: = "ERC1155ApprovalForAllEvent"
Defined in types.ts:505
ERC1155TransferBatchEvent
• ERC1155TransferBatchEvent: = "ERC1155TransferBatchEvent"
Defined in types.ts:507
ERC1155TransferSingleEvent
• ERC1155TransferSingleEvent: = "ERC1155TransferSingleEvent"
Defined in types.ts:506
ERC20ApprovalEvent
• ERC20ApprovalEvent: = "ERC20ApprovalEvent"
Defined in types.ts:501
ERC20TransferEvent
• ERC20TransferEvent: = "ERC20TransferEvent"
Defined in types.ts:500
ERC721ApprovalEvent
• ERC721ApprovalEvent: = "ERC721ApprovalEvent"
Defined in types.ts:503
ERC721ApprovalForAllEvent
• ERC721ApprovalForAllEvent: = "ERC721ApprovalForAllEvent"
Defined in types.ts:504
ERC721TransferEvent
• ERC721TransferEvent: = "ERC721TransferEvent"
Defined in types.ts:502
ExchangeCancelEvent
• ExchangeCancelEvent: = "ExchangeCancelEvent"
Defined in types.ts:509
ExchangeCancelUpToEvent
• ExchangeCancelUpToEvent: = "ExchangeCancelUpToEvent"
Defined in types.ts:510
ExchangeFillEvent
• ExchangeFillEvent: = "ExchangeFillEvent"
Defined in types.ts:508
WethDepositEvent
• WethDepositEvent: = "WethDepositEvent"
Defined in types.ts:511
WethWithdrawalEvent
• WethWithdrawalEvent: = "WethWithdrawalEvent"
Defined in types.ts:512
Enumeration: OrderEventEndState
Enumeration members
Added
• Added: = "ADDED"
Defined in types.ts:575
Cancelled
• Cancelled: = "CANCELLED"
Defined in types.ts:578
Expired
• Expired: = "EXPIRED"
Defined in types.ts:579
FillabilityIncreased
• FillabilityIncreased: = "FILLABILITY_INCREASED"
Defined in types.ts:582
Filled
• Filled: = "FILLED"
Defined in types.ts:576
FullyFilled
• FullyFilled: = "FULLY_FILLED"
Defined in types.ts:577
Invalid
• Invalid: = "INVALID"
Defined in types.ts:574
StoppedWatching
• StoppedWatching: = "STOPPED_WATCHING"
Defined in types.ts:583
Unexpired
• Unexpired: = "UNEXPIRED"
Defined in types.ts:580
Unfunded
• Unfunded: = "UNFUNDED"
Defined in types.ts:581
Enumeration: RejectedOrderKind
A set of categories for rejected orders.
Enumeration members
MeshError
• MeshError: = "MESH_ERROR"
Defined in types.ts:714
MeshValidation
• MeshValidation: = "MESH_VALIDATION"
Defined in types.ts:715
ZeroExValidation
• ZeroExValidation: = "ZEROEX_VALIDATION"
Defined in types.ts:713
Enumeration: Verbosity
Enumeration members
Debug
• Debug: = 5
Defined in types.ts:238
Error
• Error: = 2
Defined in types.ts:235
Fatal
• Fatal: = 1
Defined in types.ts:234
Info
• Info: = 4
Defined in types.ts:237
Panic
• Panic: = 0
Defined in types.ts:233
Trace
• Trace: = 6
Defined in types.ts:239
Warn
• Warn: = 3
Defined in types.ts:236
Interface: AcceptedOrderInfo
Info for any orders that were accepted.
Hierarchy
AcceptedOrderInfo
Properties
fillableTakerAssetAmount
• fillableTakerAssetAmount: BigNumber
Defined in types.ts:694
isNew
• isNew: boolean
Defined in types.ts:695
orderHash
• orderHash: string
Defined in types.ts:692
signedOrder
• signedOrder: SignedOrder
Defined in types.ts:693
Interface: Config
A set of configuration options for Mesh.
Hierarchy
Config
Properties
Optional
blockPollingIntervalSeconds
Optional
blockPollingIntervalSeconds• blockPollingIntervalSeconds? : undefined | number
Defined in types.ts:144
Optional
bootstrapList
Optional
bootstrapList• bootstrapList? : string[]
Defined in types.ts:137
Optional
customContractAddresses
Optional
customContractAddresses• customContractAddresses? : ContractAddresses
Defined in types.ts:188
Optional
customOrderFilter
Optional
customOrderFilter• customOrderFilter? : JsonSchema
Defined in types.ts:213
Optional
enableEthereumRPCRateLimiting
Optional
enableEthereumRPCRateLimiting• enableEthereumRPCRateLimiting? : undefined | false | true
Defined in types.ts:161
ethereumChainID
• ethereumChainID: number
Defined in types.ts:129
Optional
ethereumRPCMaxContentLength
Optional
ethereumRPCMaxContentLength• ethereumRPCMaxContentLength? : undefined | number
Defined in types.ts:153
Optional
ethereumRPCMaxRequestsPer24HrUTC
Optional
ethereumRPCMaxRequestsPer24HrUTC• ethereumRPCMaxRequestsPer24HrUTC? : undefined | number
Defined in types.ts:166
Optional
ethereumRPCMaxRequestsPerSecond
Optional
ethereumRPCMaxRequestsPerSecond• ethereumRPCMaxRequestsPerSecond? : undefined | number
Defined in types.ts:172
Optional
ethereumRPCURL
Optional
ethereumRPCURL• ethereumRPCURL? : undefined | string
Defined in types.ts:126
Optional
maxBytesPerSecond
Optional
maxBytesPerSecond• maxBytesPerSecond? : undefined | number
Defined in types.ts:219
Optional
maxOrdersInStorage
Optional
maxOrdersInStorage• maxOrdersInStorage? : undefined | number
Defined in types.ts:193
Optional
useBootstrapList
Optional
useBootstrapList• useBootstrapList? : undefined | false | true
Defined in types.ts:132
Optional
verbosity
Optional
verbosity• verbosity? : Verbosity
Defined in types.ts:123
Optional
web3Provider
Optional
web3Provider• web3Provider? : SupportedProvider
Defined in types.ts:216
Interface: ContractAddresses
Hierarchy
ContractAddresses
Properties
devUtils
• devUtils: string
Defined in types.ts:224
erc1155Proxy
• erc1155Proxy: string
Defined in types.ts:227
erc20Proxy
• erc20Proxy: string
Defined in types.ts:225
erc721Proxy
• erc721Proxy: string
Defined in types.ts:226
exchange
• exchange: string
Defined in types.ts:223
Optional
weth9
Optional
weth9• weth9? : undefined | string
Defined in types.ts:228
Optional
zrxToken
Optional
zrxToken• zrxToken? : undefined | string
Defined in types.ts:229
Interface: ContractEvent
Hierarchy
ContractEvent
Properties
address
• address: string
Defined in types.ts:553
blockHash
• blockHash: string
Defined in types.ts:548
isRemoved
• isRemoved: boolean
Defined in types.ts:552
kind
• kind: ContractEventKind
Defined in types.ts:554
logIndex
• logIndex: number
Defined in types.ts:551
parameters
• parameters: ContractEventParameters
Defined in types.ts:555
txHash
• txHash: string
Defined in types.ts:549
txIndex
• txIndex: number
Defined in types.ts:550
Interface: ERC1155ApprovalForAllEvent
Hierarchy
ERC1155ApprovalForAllEvent
Properties
approved
• approved: boolean
Defined in types.ts:417
operator
• operator: string
Defined in types.ts:416
owner
• owner: string
Defined in types.ts:415
Interface: ERC1155TransferBatchEvent
Hierarchy
ERC1155TransferBatchEvent
Properties
from
• from: string
Defined in types.ts:399
ids
• ids: BigNumber[]
Defined in types.ts:401
operator
• operator: string
Defined in types.ts:398
to
• to: string
Defined in types.ts:400
values
• values: BigNumber[]
Defined in types.ts:402
Interface: ERC1155TransferSingleEvent
Hierarchy
ERC1155TransferSingleEvent
Properties
from
• from: string
Defined in types.ts:382
id
• id: BigNumber
Defined in types.ts:384
operator
• operator: string
Defined in types.ts:381
to
• to: string
Defined in types.ts:383
value
• value: BigNumber
Defined in types.ts:385
Interface: ERC20ApprovalEvent
Hierarchy
ERC20ApprovalEvent
Properties
owner
• owner: string
Defined in types.ts:336
spender
• spender: string
Defined in types.ts:337
value
• value: BigNumber
Defined in types.ts:338
Interface: ERC20TransferEvent
Hierarchy
ERC20TransferEvent
Properties
from
• from: string
Defined in types.ts:323
to
• to: string
Defined in types.ts:324
value
• value: BigNumber
Defined in types.ts:325
Interface: ERC721ApprovalEvent
Hierarchy
ERC721ApprovalEvent
Properties
approved
• approved: string
Defined in types.ts:363
owner
• owner: string
Defined in types.ts:362
tokenId
• tokenId: BigNumber
Defined in types.ts:364
Interface: ERC721ApprovalForAllEvent
Hierarchy
ERC721ApprovalForAllEvent
Properties
approved
• approved: boolean
Defined in types.ts:377
operator
• operator: string
Defined in types.ts:376
owner
• owner: string
Defined in types.ts:375
Interface: ERC721TransferEvent
Hierarchy
ERC721TransferEvent
Properties
from
• from: string
Defined in types.ts:349
to
• to: string
Defined in types.ts:350
tokenId
• tokenId: BigNumber
Defined in types.ts:351
Interface: ExchangeCancelEvent
Hierarchy
ExchangeCancelEvent
Properties
feeRecipientAddress
• feeRecipientAddress: string
Defined in types.ts:458
makerAddress
• makerAddress: string
Defined in types.ts:456
makerAssetData
• makerAssetData: string
Defined in types.ts:460
orderHash
• orderHash: string
Defined in types.ts:459
senderAddress
• senderAddress: string
Defined in types.ts:457
takerAssetData
• takerAssetData: string
Defined in types.ts:461
Interface: ExchangeCancelUpToEvent
Hierarchy
ExchangeCancelUpToEvent
Properties
makerAddress
• makerAddress: string
Defined in types.ts:465
orderEpoch
• orderEpoch: BigNumber
Defined in types.ts:467
orderSenderAddress
• orderSenderAddress: string
Defined in types.ts:466
Interface: ExchangeFillEvent
Hierarchy
ExchangeFillEvent
Properties
feeRecipientAddress
• feeRecipientAddress: string
Defined in types.ts:424
makerAddress
• makerAddress: string
Defined in types.ts:421
makerAssetData
• makerAssetData: string
Defined in types.ts:431
makerAssetFilledAmount
• makerAssetFilledAmount: BigNumber
Defined in types.ts:425
makerFeeAssetData
• makerFeeAssetData: string
Defined in types.ts:433
makerFeePaid
• makerFeePaid: BigNumber
Defined in types.ts:427
orderHash
• orderHash: string
Defined in types.ts:430
protocolFeePaid
• protocolFeePaid: BigNumber
Defined in types.ts:429
senderAddress
• senderAddress: string
Defined in types.ts:423
takerAddress
• takerAddress: string
Defined in types.ts:422
takerAssetData
• takerAssetData: string
Defined in types.ts:432
takerAssetFilledAmount
• takerAssetFilledAmount: BigNumber
Defined in types.ts:426
takerFeeAssetData
• takerFeeAssetData: string
Defined in types.ts:434
takerFeePaid
• takerFeePaid: BigNumber
Defined in types.ts:428
Interface: GetOrdersResponse
Hierarchy
GetOrdersResponse
Properties
ordersInfos
• ordersInfos: OrderInfo[]
Defined in types.ts:45
timestamp
• timestamp: number
Defined in types.ts:44
Interface: JsonSchema
An interface for JSON schema types, which are used for custom order filters.
Hierarchy
JsonSchema
Properties
Optional
$ref
Optional
$ref• $ref? : undefined | string
Defined in types.ts:67
Optional
$schema
Optional
$schema• $schema? : undefined | string
Defined in types.ts:66
Optional
additionalItems
Optional
additionalItems• additionalItems? : boolean | JsonSchema
Defined in types.ts:78
Optional
additionalProperties
Optional
additionalProperties• additionalProperties? : boolean | JsonSchema
Defined in types.ts:86
Optional
allOf
Optional
allOf• allOf? : JsonSchema[]
Defined in types.ts:108
Optional
anyOf
Optional
anyOf• anyOf? : JsonSchema[]
Defined in types.ts:109
Optional
const
Optional
const• const? : any
Defined in types.ts:105
Optional
definitions
Optional
definitions• definitions? : undefined | object
Defined in types.ts:87
Optional
dependencies
Optional
dependencies• dependencies? : undefined | object
Defined in types.ts:96
Optional
description
Optional
description• description? : undefined | string
Defined in types.ts:69
Optional
enum
Optional
enum• enum? : any[]
Defined in types.ts:99
Optional
exclusiveMaximum
Optional
exclusiveMaximum• exclusiveMaximum? : undefined | false | true
Defined in types.ts:72
Optional
exclusiveMinimum
Optional
exclusiveMinimum• exclusiveMinimum? : undefined | false | true
Defined in types.ts:74
Optional
format
Optional
format• format? : undefined | string
Defined in types.ts:107
Optional
id
Optional
id• id? : undefined | string
Defined in types.ts:65
Optional
items
Optional
items• items? : JsonSchema | JsonSchema[]
Defined in types.ts:79
Optional
maxItems
Optional
maxItems• maxItems? : undefined | number
Defined in types.ts:80
Optional
maxLength
Optional
maxLength• maxLength? : undefined | number
Defined in types.ts:75
Optional
maxProperties
Optional
maxProperties• maxProperties? : undefined | number
Defined in types.ts:83
Optional
maximum
Optional
maximum• maximum? : undefined | number
Defined in types.ts:71
Optional
minItems
Optional
minItems• minItems? : undefined | number
Defined in types.ts:81
Optional
minLength
Optional
minLength• minLength? : undefined | number
Defined in types.ts:76
Optional
minProperties
Optional
minProperties• minProperties? : undefined | number
Defined in types.ts:84
Optional
minimum
Optional
minimum• minimum? : undefined | number
Defined in types.ts:73
Optional
multipleOf
Optional
multipleOf• multipleOf? : undefined | number
Defined in types.ts:70
Optional
not
Optional
not• not? : JsonSchema
Defined in types.ts:111
Optional
oneOf
Optional
oneOf• oneOf? : JsonSchema[]
Defined in types.ts:110
Optional
pattern
Optional
pattern• pattern? : string | RegExp
Defined in types.ts:77
Optional
patternProperties
Optional
patternProperties• patternProperties? : undefined | object
Defined in types.ts:93
Optional
properties
Optional
properties• properties? : undefined | object
Defined in types.ts:90
Optional
required
Optional
required• required? : string[]
Defined in types.ts:85
Optional
title
Optional
title• title? : undefined | string
Defined in types.ts:68
Optional
type
Optional
type• type? : string | string[]
Defined in types.ts:106
Optional
uniqueItems
Optional
uniqueItems• uniqueItems? : undefined | false | true
Defined in types.ts:82
Interface: LatestBlock
Hierarchy
LatestBlock
Properties
hash
• hash: string
Defined in types.ts:734
number
• number: BigNumber
Defined in types.ts:733
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 types.ts:606
endState
• endState: OrderEventEndState
Defined in types.ts:604
fillableTakerAssetAmount
• fillableTakerAssetAmount: BigNumber
Defined in types.ts:605
orderHash
• orderHash: string
Defined in types.ts:602
signedOrder
• signedOrder: SignedOrder
Defined in types.ts:603
timestampMs
• timestampMs: number
Defined in types.ts:601
Interface: OrderInfo
Hierarchy
OrderInfo
Properties
fillableTakerAssetAmount
• fillableTakerAssetAmount: BigNumber
Defined in types.ts:58
orderHash
• orderHash: string
Defined in types.ts:56
signedOrder
• signedOrder: SignedOrder
Defined in types.ts:57
Interface: RejectedOrderInfo
Info for any orders that were rejected, including the reason they were rejected.
Hierarchy
RejectedOrderInfo
Properties
kind
• kind: RejectedOrderKind
Defined in types.ts:705
orderHash
• orderHash: string
Defined in types.ts:703
signedOrder
• signedOrder: SignedOrder
Defined in types.ts:704
status
• status: RejectedOrderStatus
Defined in types.ts:706
Interface: RejectedOrderStatus
Provides more information about why an order was rejected.
Hierarchy
RejectedOrderStatus
Properties
code
• code: string
Defined in types.ts:722
message
• message: string
Defined in types.ts:723
Interface: Stats
Hierarchy
Stats
Properties
ethRPCRateLimitExpiredRequests
• ethRPCRateLimitExpiredRequests: number
Defined in types.ts:774
ethRPCRequestsSentInCurrentUTCDay
• ethRPCRequestsSentInCurrentUTCDay: number
Defined in types.ts:773
ethereumChainID
• ethereumChainID: number
Defined in types.ts:765
Optional
latestBlock
Optional
latestBlock• latestBlock? : LatestBlock
Defined in types.ts:766
maxExpirationTime
• maxExpirationTime: BigNumber
Defined in types.ts:771
numOrders
• numOrders: number
Defined in types.ts:768
numOrdersIncludingRemoved
• numOrdersIncludingRemoved: number
Defined in types.ts:769
numPeers
• numPeers: number
Defined in types.ts:767
numPinnedOrders
• numPinnedOrders: number
Defined in types.ts:770
peerID
• peerID: string
Defined in types.ts:764
pubSubTopic
• pubSubTopic: string
Defined in types.ts:761
rendezvous
• rendezvous: string
Defined in types.ts:762
secondaryRendezvous
• secondaryRendezvous: string[]
Defined in types.ts:763
startOfCurrentUTCDay
• startOfCurrentUTCDay: Date
Defined in types.ts:772
version
• version: string
Defined in types.ts:760
Interface: ValidationResults
Indicates which orders where accepted, which were rejected, and why.
Hierarchy
ValidationResults
Properties
accepted
• accepted: AcceptedOrderInfo[]
Defined in types.ts:684
rejected
• rejected: RejectedOrderInfo[]
Defined in types.ts:685
Interface: WethDepositEvent
Hierarchy
WethDepositEvent
Properties
owner
• owner: string
Defined in types.ts:489
value
• value: BigNumber
Defined in types.ts:490
Interface: WethWithdrawalEvent
Hierarchy
WethWithdrawalEvent
Properties
owner
• owner: string
Defined in types.ts:478
value
• value: BigNumber
Defined in types.ts:479
Functions
loadMeshStreamingForURLAsync
▸ loadMeshStreamingWithURLAsync(url
: string
): Promise‹void
›
Defined in index.ts:7
Loads the Wasm module that is provided by fetching a url.
Parameters:
Name
Type
Description
url
string
The URL to query for the Wasm binary
loadMeshStreamingAsync
▸ loadMeshStreamingAsync(response
: Response | Promise<Response>
): Promise‹void
›
Defined in index.ts:15
Loads the Wasm module that is provided by a response.
Parameters:
Name
Type
Description
response
Response | Promise<Response>
The Wasm response that supplies the Wasm binary
Functions
loadMeshStreamingForURLAsync
▸ loadMeshStreamingWithURLAsync(url
: string
): Promise‹void
›
Defined in index.ts:7
Loads the Wasm module that is provided by fetching a url.
Parameters:
Name
Type
Description
url
string
The URL to query for the Wasm binary
loadMeshStreamingAsync
▸ loadMeshStreamingAsync(response
: Response | Promise<Response>
): Promise‹void
›
Defined in index.ts:15
Loads the Wasm module that is provided by a response.
Parameters:
Name
Type
Description
response
Response | Promise<Response>
The Wasm response that supplies the Wasm binary
Last updated