Add more tools to docs

This commit is contained in:
fabioberger
2019-08-16 16:34:09 +02:00
parent 0299abf1b5
commit 0705276ff9
52 changed files with 38025 additions and 41 deletions

View File

@@ -1,5 +1,3 @@
# Version test
> # Class: AssetBuyer
## Hierarchy

View File

@@ -1,6 +1,6 @@
# AssetBuyer
> # Class: AssetBuyer
<!-- ## Hierarchy
## Hierarchy
* **AssetBuyer**
@@ -27,11 +27,11 @@
* [getLiquidityForAssetDataAsync](#getliquidityforassetdataasync)
* [getOrdersAndFillableAmountsAsync](#getordersandfillableamountsasync)
* [getAssetBuyerForProvidedOrders](#static-getassetbuyerforprovidedorders)
* [getAssetBuyerForStandardRelayerAPIUrl](#static-getassetbuyerforstandardrelayerapiurl) -->
* [getAssetBuyerForStandardRelayerAPIUrl](#static-getassetbuyerforstandardrelayerapiurl)
## Constructors
Constructor
### constructor
\+ **new AssetBuyer**(`supportedProvider`: `SupportedProvider`, `orderProvider`: [OrderProvider](#class-assetbuyer)*
@@ -55,7 +55,7 @@ An instance of AssetBuyer
### expiryBufferSeconds
`expiryBufferSeconds: number`
• **expiryBufferSeconds**: *number*
*Defined in [asset_buyer.ts:41](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/asset-buyer/src/asset_buyer.ts#L41)*
@@ -259,7 +259,7 @@ An instance of AssetBuyer
<hr />
# Class: InsufficientAssetLiquidityError
> # Class: InsufficientAssetLiquidityError
Error class representing insufficient asset liquidity
@@ -351,7 +351,7 @@ Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/node_modules/typed
<hr />
# Class: BasicOrderProvider
> # Class: BasicOrderProvider
## Hierarchy
@@ -446,7 +446,7 @@ An instance of OrderProviderResponse. See type for more information.
<hr />
# Class: StandardRelayerAPIOrderProvider
> # Class: StandardRelayerAPIOrderProvider
## Hierarchy
@@ -551,7 +551,7 @@ An instance of OrderProviderResponse. See type for more information.
<hr />
# Enumeration: AssetBuyerError
> # Enumeration: AssetBuyerError
Possible error messages thrown by an AssetBuyer instance or associated static methods.
@@ -652,7 +652,7 @@ ___
<hr />
# Interface: AssetBuyerOpts
> # Interface: AssetBuyerOpts
networkId: The ethereum network id. Defaults to 1 (mainnet).
orderRefreshIntervalMs: The interval in ms that getBuyQuoteAsync should trigger an refresh of orders and order states. Defaults to 10000ms (10s).
@@ -696,7 +696,7 @@ ___
<hr />
# Interface: BuyQuote
> # Interface: BuyQuote
assetData: String that represents a specific asset (for more info: https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md).
assetBuyAmount: The amount of asset to buy.
@@ -780,7 +780,7 @@ ___
<hr />
# Interface: BuyQuoteExecutionOpts
> # Interface: BuyQuoteExecutionOpts
ethAmount: The desired amount of eth to spend. Defaults to buyQuote.worstCaseQuoteInfo.totalEthAmount.
takerAddress: The address to perform the buy. Defaults to the first available address from the provider.
@@ -844,7 +844,7 @@ ___
<hr />
# Interface: BuyQuoteInfo
> # Interface: BuyQuoteInfo
assetEthAmount: The amount of eth required to pay for the requested asset.
feeEthAmount: The amount of eth required to pay the affiliate fee.
@@ -888,7 +888,7 @@ ___
<hr />
# Interface: BuyQuoteRequestOpts
> # Interface: BuyQuoteRequestOpts
feePercentage: The affiliate fee percentage. Defaults to 0.
shouldForceOrderRefresh: If set to true, new orders and state will be fetched instead of waiting for the next orderRefreshIntervalMs. Defaults to false.
@@ -932,7 +932,7 @@ ___
<hr />
# Interface: LiquidityForAssetData
> # Interface: LiquidityForAssetData
Represents available liquidity for a given assetData
@@ -965,7 +965,7 @@ ___
<hr />
# Interface: OrderProvider
> # Interface: OrderProvider
gerOrdersAsync: Given an OrderProviderRequest, get an OrderProviderResponse.
getAvailableMakerAssetDatasAsync: Given a taker asset data string, return all availabled paired maker asset data strings.
@@ -1024,7 +1024,7 @@ Name | Type |
<hr />
# Interface: OrderProviderRequest
> # Interface: OrderProviderRequest
makerAssetData: The assetData representing the desired makerAsset.
takerAssetData: The assetData representing the desired takerAsset.
@@ -1059,7 +1059,7 @@ ___
<hr />
# Interface: OrderProviderResponse
> # Interface: OrderProviderResponse
orders: An array of orders with optional remaining fillable makerAsset amounts. See type for more info.
@@ -1083,7 +1083,7 @@ orders: An array of orders with optional remaining fillable makerAsset amounts.
<hr />
# Interface: OrdersAndFillableAmounts
> # Interface: OrdersAndFillableAmounts
orders: An array of signed orders
remainingFillableMakerAssetAmounts: A list of fillable amounts for the signed orders. The index of an item in the array associates the amount with the corresponding order.
@@ -1117,7 +1117,7 @@ ___
<hr />
# Interface: SignedOrderWithRemainingFillableMakerAssetAmount
> # Interface: SignedOrderWithRemainingFillableMakerAssetAmount
A normal SignedOrder with one extra optional property `remainingFillableMakerAssetAmount`
remainingFillableMakerAssetAmount: The amount of the makerAsset that is available to be filled

View File

@@ -0,0 +1,84 @@
## @0x/asset-swapper
Convenience package for swapping assets represented on the Ethereum blockchain using 0x. The package helps to perform all the off-chain computations to execute a marketBuy or marketSell function execution with 0x exchange contracts, or 0x extension contracts. Given some liquidity (0x signed orders), it helps estimate the cost of buying or selling a certain asset (giving a range) and then provide varying consumable outputs to execute the buy or sell.
Asset-swapper integrates with the [Standard Relayer API](https://github.com/0xProject/standard-relayer-api)(in the future Mesh as well) and takes care of sourcing liquidity, order-pruning, and order-validation. The final result is a library that tells you what assets are available, provides a quote based on specified assets, and provide varying consumable metadata that can be used both on-chain in smart contracts or off-chain through web3 to swap a desired amount of ERC20 for another ERC20 asset.
## Installation
```bash
yarn add @0x/asset-swapper
```
**Import**
```typescript
import { SwapQuoter } from '@0x/asset-swapper';
```
or
```javascript
var SwapQuoter = require('@0x/asset-swapper').SwapQuoter;
var SwapQuoteConsumer = require('@0x/asset-swapper').SwapQuoteConsumer;
```
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
```json
"compilerOptions": {
"typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
}
```
## Contributing
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
```bash
yarn config set workspaces-experimental true
```
Then install dependencies
```bash
yarn install
```
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
PKG=@0x/asset-swapper yarn build
```
Or continuously rebuild on change:
```bash
PKG=@0x/asset-swapper yarn watch
```
### Clean
```bash
yarn clean
```
### Lint
```bash
yarn lint
```
### Run Tests
```bash
yarn test
```

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,84 @@
## @0x/asset-swapper
Convenience package for swapping assets represented on the Ethereum blockchain using 0x. The package helps to perform all the off-chain computations to execute a marketBuy or marketSell function execution with 0x exchange contracts, or 0x extension contracts. Given some liquidity (0x signed orders), it helps estimate the cost of buying or selling a certain asset (giving a range) and then provide varying consumable outputs to execute the buy or sell.
Asset-swapper integrates with the [Standard Relayer API](https://github.com/0xProject/standard-relayer-api)(in the future Mesh as well) and takes care of sourcing liquidity, order-pruning, and order-validation. The final result is a library that tells you what assets are available, provides a quote based on specified assets, and provide varying consumable metadata that can be used both on-chain in smart contracts or off-chain through web3 to swap a desired amount of ERC20 for another ERC20 asset.
## Installation
```bash
yarn add @0x/asset-swapper
```
**Import**
```typescript
import { SwapQuoter } from '@0x/asset-swapper';
```
or
```javascript
var SwapQuoter = require('@0x/asset-swapper').SwapQuoter;
var SwapQuoteConsumer = require('@0x/asset-swapper').SwapQuoteConsumer;
```
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
```json
"compilerOptions": {
"typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
}
```
## Contributing
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
```bash
yarn config set workspaces-experimental true
```
Then install dependencies
```bash
yarn install
```
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
PKG=@0x/asset-swapper yarn build
```
Or continuously rebuild on change:
```bash
PKG=@0x/asset-swapper yarn watch
```
### Clean
```bash
yarn clean
```
### Lint
```bash
yarn lint
```
### Run Tests
```bash
yarn test
```

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,74 @@
## @0x/connect
This repository contains a Javascript library that makes it easy to interact with Relayers that conform to the [Standard Relayer API](https://github.com/0xProject/standard-relayer-api)
## Installation
```bash
yarn add @0x/connect
```
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
```json
"compilerOptions": {
"typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
}
```
## Usage
- [Docs](https://0xproject.com/docs/connect)
- [Tutorials](https://0xproject.com/wiki#connect)
## Contributing
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
```bash
yarn config set workspaces-experimental true
```
Then install dependencies
```bash
yarn install
```
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
PKG=@0x/connect yarn build
```
Or continuously rebuild on change:
```bash
PKG=@0x/connect yarn watch
```
### Clean
```bash
yarn clean
```
### Lint
```bash
yarn lint
```
### Run Tests
```bash
yarn test
```

View File

@@ -0,0 +1,647 @@
> # Class: HttpClient
This class includes all the functionality related to interacting with a set of HTTP endpoints
that implement the standard relayer API v2
## Hierarchy
* **HttpClient**
## Implements
* [Client](#interface-client)
## Index
### Constructors
* [constructor](#constructor)
### Methods
* [getAssetPairsAsync](#getassetpairsasync)
* [getFeeRecipientsAsync](#getfeerecipientsasync)
* [getOrderAsync](#getorderasync)
* [getOrderConfigAsync](#getorderconfigasync)
* [getOrderbookAsync](#getorderbookasync)
* [getOrdersAsync](#getordersasync)
* [submitOrderAsync](#submitorderasync)
## Constructors
### constructor
\+ **new HttpClient**(`url`: string): *[HttpClient](#class-httpclient)*
*Defined in [http_client.ts:44](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/http_client.ts#L44)*
Instantiates a new HttpClient instance
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`url` | string | The relayer API base HTTP url you would like to interact with |
**Returns:** *[HttpClient](#class-httpclient)*
An instance of HttpClient
## Methods
### getAssetPairsAsync
▸ **getAssetPairsAsync**(`requestOpts?`: `RequestOpts` & `AssetPairsRequestOpts` & `PagedRequestOpts`): *`Promise<AssetPairsResponse>`*
*Defined in [http_client.ts:59](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/http_client.ts#L59)*
Retrieve assetData pair info from the API
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`requestOpts?` | `RequestOpts` & `AssetPairsRequestOpts` & `PagedRequestOpts` | Options specifying assetData information to retrieve, page information, and network id. |
**Returns:** *`Promise<AssetPairsResponse>`*
The resulting AssetPairsResponse that match the request
___
### getFeeRecipientsAsync
▸ **getFeeRecipientsAsync**(`requestOpts?`: `RequestOpts` & `PagedRequestOpts`): *`Promise<FeeRecipientsResponse>`*
*Defined in [http_client.ts:160](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/http_client.ts#L160)*
Retrieve the list of fee recipient addresses used by the relayer.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`requestOpts?` | `RequestOpts` & `PagedRequestOpts` | Options specifying page information, and network id. |
**Returns:** *`Promise<FeeRecipientsResponse>`*
The resulting FeeRecipientsResponse
___
### getOrderAsync
▸ **getOrderAsync**(`orderHash`: string, `requestOpts?`: `RequestOpts`): *`Promise<APIOrder>`*
*Defined in [http_client.ts:99](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/http_client.ts#L99)*
Retrieve a specific order from the API
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`orderHash` | string | An orderHash generated from the desired order |
`requestOpts?` | `RequestOpts` | - |
**Returns:** *`Promise<APIOrder>`*
The APIOrder that matches the supplied orderHash
___
### getOrderConfigAsync
▸ **getOrderConfigAsync**(`request`: `OrderConfigRequest`, `requestOpts?`: `RequestOpts`): *`Promise<OrderConfigResponse>`*
*Defined in [http_client.ts:139](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/http_client.ts#L139)*
Retrieve fee information from the API
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`request` | `OrderConfigRequest` | A OrderConfigRequest instance describing the specific fees to retrieve |
`requestOpts?` | `RequestOpts` | Options specifying network id. |
**Returns:** *`Promise<OrderConfigResponse>`*
The resulting OrderConfigResponse that matches the request
___
### getOrderbookAsync
▸ **getOrderbookAsync**(`request`: `OrderbookRequest`, `requestOpts?`: `RequestOpts` & `PagedRequestOpts`): *`Promise<OrderbookResponse>`*
*Defined in [http_client.ts:117](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/http_client.ts#L117)*
Retrieve an orderbook from the API
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`request` | `OrderbookRequest` | An OrderbookRequest instance describing the specific orderbook to retrieve |
`requestOpts?` | `RequestOpts` & `PagedRequestOpts` | Options specifying page information, and network id. |
**Returns:** *`Promise<OrderbookResponse>`*
The resulting OrderbookResponse that matches the request
___
### getOrdersAsync
▸ **getOrdersAsync**(`requestOpts?`: `RequestOpts` & `OrdersRequestOpts` & `PagedRequestOpts`): *`Promise<OrdersResponse>`*
*Defined in [http_client.ts:79](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/http_client.ts#L79)*
Retrieve orders from the API
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`requestOpts?` | `RequestOpts` & `OrdersRequestOpts` & `PagedRequestOpts` | Options specifying orders to retrieve and page information, page information, and network id. |
**Returns:** *`Promise<OrdersResponse>`*
The resulting OrdersResponse that match the request
___
### submitOrderAsync
▸ **submitOrderAsync**(`signedOrder`: `SignedOrder`, `requestOpts?`: `RequestOpts`): *`Promise<void>`*
*Defined in [http_client.ts:177](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/http_client.ts#L177)*
Submit a signed order to the API
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`signedOrder` | `SignedOrder` | A SignedOrder instance to submit |
`requestOpts?` | `RequestOpts` | Options specifying network id. |
**Returns:** *`Promise<void>`*
<hr />
> # Class: WebSocketOrdersChannel
This class includes all the functionality related to interacting with a websocket endpoint
that implements the standard relayer API v0
## Hierarchy
* **WebSocketOrdersChannel**
## Implements
* [OrdersChannel](#interface-orderschannel)
## Index
### Constructors
* [constructor](#constructor)
### Methods
* [close](#close)
* [subscribe](#subscribe)
## Constructors
### constructor
\+ **new WebSocketOrdersChannel**(`client`: `w3cwebsocket`, `handler`: [OrdersChannelHandler](#class-websocketorderschannel)*
*Defined in [ws_orders_channel.ts:21](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/ws_orders_channel.ts#L21)*
Instantiates a new WebSocketOrdersChannel instance
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`client` | `w3cwebsocket` | A WebSocket client |
`handler` | [OrdersChannelHandler](#interface-orderschannelhandler) | An OrdersChannelHandler instance that responds to various channel updates |
**Returns:** *[WebSocketOrdersChannel](#class-websocketorderschannel)*
An instance of WebSocketOrdersChannel
## Methods
### close
▸ **close**(): *void*
*Defined in [ws_orders_channel.ts:66](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/ws_orders_channel.ts#L66)*
Close the websocket and stop receiving updates
**Returns:** *void*
___
### subscribe
▸ **subscribe**(`subscriptionOpts`: `OrdersChannelSubscriptionOpts`): *void*
*Defined in [ws_orders_channel.ts:50](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/ws_orders_channel.ts#L50)*
Subscribe to orderbook snapshots and updates from the websocket
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`subscriptionOpts` | `OrdersChannelSubscriptionOpts` | An OrdersChannelSubscriptionOpts instance describing which assetData pair to subscribe to |
**Returns:** *void*
<hr />
> # Enumeration: HttpRequestType
## Index
### Enumeration members
* [Get](#get)
* [Post](#post)
## Enumeration members
### Get
• **Get**: = "GET"
*Defined in [types.ts:46](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L46)*
___
### Post
• **Post**: = "POST"
*Defined in [types.ts:47](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L47)*
<hr />
> # Interface: Client
## Hierarchy
* **Client**
## Implemented by
* [HttpClient](#class-httpclient)
## Index
### Properties
* [getAssetPairsAsync](#getassetpairsasync)
* [getFeeRecipientsAsync](#getfeerecipientsasync)
* [getOrderAsync](#getorderasync)
* [getOrderConfigAsync](#getorderconfigasync)
* [getOrderbookAsync](#getorderbookasync)
* [getOrdersAsync](#getordersasync)
* [submitOrderAsync](#submitorderasync)
## Properties
### getAssetPairsAsync
• **getAssetPairsAsync**: *function*
*Defined in [types.ts:18](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L18)*
#### Type declaration:
▸ (`requestOpts?`: `AssetPairsRequestOpts` & `PagedRequestOpts`): *`Promise<PaginatedCollection<AssetPairsItem>>`*
**Parameters:**
Name | Type |
------ | ------ |
`requestOpts?` | `AssetPairsRequestOpts` & `PagedRequestOpts` |
___
### getFeeRecipientsAsync
• **getFeeRecipientsAsync**: *function*
*Defined in [types.ts:25](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L25)*
#### Type declaration:
▸ (`requestOpts?`: `PagedRequestOpts`): *`Promise<FeeRecipientsResponse>`*
**Parameters:**
Name | Type |
------ | ------ |
`requestOpts?` | `PagedRequestOpts` |
___
### getOrderAsync
• **getOrderAsync**: *function*
*Defined in [types.ts:22](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L22)*
#### Type declaration:
▸ (`orderHash`: string): *`Promise<APIOrder>`*
**Parameters:**
Name | Type |
------ | ------ |
`orderHash` | string |
___
### getOrderConfigAsync
• **getOrderConfigAsync**: *function*
*Defined in [types.ts:24](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L24)*
#### Type declaration:
▸ (`request`: `OrderConfigRequest`): *`Promise<OrderConfigResponse>`*
**Parameters:**
Name | Type |
------ | ------ |
`request` | `OrderConfigRequest` |
___
### getOrderbookAsync
• **getOrderbookAsync**: *function*
*Defined in [types.ts:23](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L23)*
#### Type declaration:
▸ (`request`: `OrderbookRequest`, `requestOpts?`: `PagedRequestOpts`): *`Promise<OrderbookResponse>`*
**Parameters:**
Name | Type |
------ | ------ |
`request` | `OrderbookRequest` |
`requestOpts?` | `PagedRequestOpts` |
___
### getOrdersAsync
• **getOrdersAsync**: *function*
*Defined in [types.ts:21](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L21)*
#### Type declaration:
▸ (`requestOpts?`: `OrdersRequestOpts` & `PagedRequestOpts`): *`Promise<PaginatedCollection<APIOrder>>`*
**Parameters:**
Name | Type |
------ | ------ |
`requestOpts?` | `OrdersRequestOpts` & `PagedRequestOpts` |
___
### submitOrderAsync
• **submitOrderAsync**: *function*
*Defined in [types.ts:26](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L26)*
#### Type declaration:
▸ (`signedOrder`: `SignedOrder`): *`Promise<void>`*
**Parameters:**
Name | Type |
------ | ------ |
`signedOrder` | `SignedOrder` |
<hr />
> # Interface: HttpRequestOptions
## Hierarchy
* **HttpRequestOptions**
## Index
### Properties
* [params](#optional-params)
* [payload](#optional-payload)
## Properties
### `Optional` params
• **params**? : *undefined | object*
*Defined in [types.ts:41](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L41)*
___
### `Optional` payload
• **payload**? : *undefined | object*
*Defined in [types.ts:42](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L42)*
<hr />
> # Interface: OrdersChannel
## Hierarchy
* **OrdersChannel**
## Implemented by
* [WebSocketOrdersChannel](#class-websocketorderschannel)
## Index
### Properties
* [close](#close)
* [subscribe](#subscribe)
## Properties
### close
• **close**: *function*
*Defined in [types.ts:31](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L31)*
#### Type declaration:
▸ (): *void*
___
### subscribe
• **subscribe**: *function*
*Defined in [types.ts:30](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L30)*
#### Type declaration:
▸ (`subscriptionOpts`: `OrdersChannelSubscriptionOpts`): *void*
**Parameters:**
Name | Type |
------ | ------ |
`subscriptionOpts` | `OrdersChannelSubscriptionOpts` |
<hr />
> # Interface: OrdersChannelHandler
## Hierarchy
* **OrdersChannelHandler**
## Index
### Properties
* [onClose](#onclose)
* [onError](#onerror)
* [onUpdate](#onupdate)
## Properties
### onClose
• **onClose**: *function*
*Defined in [types.ts:37](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L37)*
#### Type declaration:
▸ (`channel`: [OrdersChannel](#interface-orderschannel)): *void*
**Parameters:**
Name | Type |
------ | ------ |
`channel` | [OrdersChannel](#interface-orderschannel) |
___
### onError
• **onError**: *function*
*Defined in [types.ts:36](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L36)*
#### Type declaration:
▸ (`channel`: [OrdersChannel](#interface-orderschannel), `err`: `Error`, `subscriptionOpts?`: `OrdersChannelSubscriptionOpts`): *void*
**Parameters:**
Name | Type |
------ | ------ |
`channel` | [OrdersChannel](#interface-orderschannel) |
`err` | `Error` |
`subscriptionOpts?` | `OrdersChannelSubscriptionOpts` |
___
### onUpdate
• **onUpdate**: *function*
*Defined in [types.ts:35](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L35)*
#### Type declaration:
▸ (`channel`: [OrdersChannel](#interface-orderschannel), `subscriptionOpts`: `OrdersChannelSubscriptionOpts`, `orders`: `APIOrder`[]): *void*
**Parameters:**
Name | Type |
------ | ------ |
`channel` | [OrdersChannel](#interface-orderschannel) |
`subscriptionOpts` | `OrdersChannelSubscriptionOpts` |
`orders` | `APIOrder`[] |
<hr />
> # Interface: OrdersChannelSubscriptionOptsMap
## Hierarchy
* **OrdersChannelSubscriptionOptsMap**
## Indexable
● \[▪ **key**: *string*\]: `OrdersChannelSubscriptionOpts`
<hr />
* [Globals](globals.md)
* [External Modules]()
* [http_client](modules/_http_client_.md)
* [http_client.HttpClient](#class-httpclient)
* [index](modules/_index_.md)
* [orders_channel_factory](modules/_orders_channel_factory_.md)
* [types](modules/_types_.md)
* [types.HttpRequestType](#class-httprequesttype)
* [types.Client](#class-client)
* [types.HttpRequestOptions](#class-httprequestoptions)
* [types.OrdersChannel](#class-orderschannel)
* [types.OrdersChannelHandler](#class-orderschannelhandler)
* [utils/assert](modules/_utils_assert_.md)
* [utils/orders_channel_message_parser](modules/_utils_orders_channel_message_parser_.md)
* [utils/relayer_response_json_parsers](modules/_utils_relayer_response_json_parsers_.md)
* [utils/type_converters](modules/_utils_type_converters_.md)
* [ws_orders_channel](modules/_ws_orders_channel_.md)
* [ws_orders_channel.WebSocketOrdersChannel](#class-websocketorderschannel)
* [ws_orders_channel.OrdersChannelSubscriptionOptsMap](#class-orderschannelsubscriptionoptsmap)
* [Classes]()
* [http_client.HttpClient](#class-httpclient)
* [ws_orders_channel.WebSocketOrdersChannel](#class-websocketorderschannel)
* [Enums]()
* [types.HttpRequestType](#class-httprequesttype)
* [Interfaces]()
* [types.Client](#class-client)
* [types.HttpRequestOptions](#class-httprequestoptions)
* [types.OrdersChannel](#class-orderschannel)
* [types.OrdersChannelHandler](#class-orderschannelhandler)
* [ws_orders_channel.OrdersChannelSubscriptionOptsMap](#class-orderschannelsubscriptionoptsmap)
<hr />

View File

@@ -0,0 +1,74 @@
## @0x/connect
This repository contains a Javascript library that makes it easy to interact with Relayers that conform to the [Standard Relayer API](https://github.com/0xProject/standard-relayer-api)
## Installation
```bash
yarn add @0x/connect
```
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
```json
"compilerOptions": {
"typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
}
```
## Usage
- [Docs](https://0xproject.com/docs/connect)
- [Tutorials](https://0xproject.com/wiki#connect)
## Contributing
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
```bash
yarn config set workspaces-experimental true
```
Then install dependencies
```bash
yarn install
```
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
PKG=@0x/connect yarn build
```
Or continuously rebuild on change:
```bash
PKG=@0x/connect yarn watch
```
### Clean
```bash
yarn clean
```
### Lint
```bash
yarn lint
```
### Run Tests
```bash
yarn test
```

View File

@@ -0,0 +1,647 @@
> # Class: HttpClient
This class includes all the functionality related to interacting with a set of HTTP endpoints
that implement the standard relayer API v2
## Hierarchy
* **HttpClient**
## Implements
* [Client](#interface-client)
## Index
### Constructors
* [constructor](#constructor)
### Methods
* [getAssetPairsAsync](#getassetpairsasync)
* [getFeeRecipientsAsync](#getfeerecipientsasync)
* [getOrderAsync](#getorderasync)
* [getOrderConfigAsync](#getorderconfigasync)
* [getOrderbookAsync](#getorderbookasync)
* [getOrdersAsync](#getordersasync)
* [submitOrderAsync](#submitorderasync)
## Constructors
### constructor
\+ **new HttpClient**(`url`: string): *[HttpClient](#class-httpclient)*
*Defined in [http_client.ts:44](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/http_client.ts#L44)*
Instantiates a new HttpClient instance
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`url` | string | The relayer API base HTTP url you would like to interact with |
**Returns:** *[HttpClient](#class-httpclient)*
An instance of HttpClient
## Methods
### getAssetPairsAsync
▸ **getAssetPairsAsync**(`requestOpts?`: `RequestOpts` & `AssetPairsRequestOpts` & `PagedRequestOpts`): *`Promise<AssetPairsResponse>`*
*Defined in [http_client.ts:59](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/http_client.ts#L59)*
Retrieve assetData pair info from the API
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`requestOpts?` | `RequestOpts` & `AssetPairsRequestOpts` & `PagedRequestOpts` | Options specifying assetData information to retrieve, page information, and network id. |
**Returns:** *`Promise<AssetPairsResponse>`*
The resulting AssetPairsResponse that match the request
___
### getFeeRecipientsAsync
▸ **getFeeRecipientsAsync**(`requestOpts?`: `RequestOpts` & `PagedRequestOpts`): *`Promise<FeeRecipientsResponse>`*
*Defined in [http_client.ts:160](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/http_client.ts#L160)*
Retrieve the list of fee recipient addresses used by the relayer.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`requestOpts?` | `RequestOpts` & `PagedRequestOpts` | Options specifying page information, and network id. |
**Returns:** *`Promise<FeeRecipientsResponse>`*
The resulting FeeRecipientsResponse
___
### getOrderAsync
▸ **getOrderAsync**(`orderHash`: string, `requestOpts?`: `RequestOpts`): *`Promise<APIOrder>`*
*Defined in [http_client.ts:99](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/http_client.ts#L99)*
Retrieve a specific order from the API
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`orderHash` | string | An orderHash generated from the desired order |
`requestOpts?` | `RequestOpts` | - |
**Returns:** *`Promise<APIOrder>`*
The APIOrder that matches the supplied orderHash
___
### getOrderConfigAsync
▸ **getOrderConfigAsync**(`request`: `OrderConfigRequest`, `requestOpts?`: `RequestOpts`): *`Promise<OrderConfigResponse>`*
*Defined in [http_client.ts:139](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/http_client.ts#L139)*
Retrieve fee information from the API
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`request` | `OrderConfigRequest` | A OrderConfigRequest instance describing the specific fees to retrieve |
`requestOpts?` | `RequestOpts` | Options specifying network id. |
**Returns:** *`Promise<OrderConfigResponse>`*
The resulting OrderConfigResponse that matches the request
___
### getOrderbookAsync
▸ **getOrderbookAsync**(`request`: `OrderbookRequest`, `requestOpts?`: `RequestOpts` & `PagedRequestOpts`): *`Promise<OrderbookResponse>`*
*Defined in [http_client.ts:117](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/http_client.ts#L117)*
Retrieve an orderbook from the API
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`request` | `OrderbookRequest` | An OrderbookRequest instance describing the specific orderbook to retrieve |
`requestOpts?` | `RequestOpts` & `PagedRequestOpts` | Options specifying page information, and network id. |
**Returns:** *`Promise<OrderbookResponse>`*
The resulting OrderbookResponse that matches the request
___
### getOrdersAsync
▸ **getOrdersAsync**(`requestOpts?`: `RequestOpts` & `OrdersRequestOpts` & `PagedRequestOpts`): *`Promise<OrdersResponse>`*
*Defined in [http_client.ts:79](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/http_client.ts#L79)*
Retrieve orders from the API
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`requestOpts?` | `RequestOpts` & `OrdersRequestOpts` & `PagedRequestOpts` | Options specifying orders to retrieve and page information, page information, and network id. |
**Returns:** *`Promise<OrdersResponse>`*
The resulting OrdersResponse that match the request
___
### submitOrderAsync
▸ **submitOrderAsync**(`signedOrder`: `SignedOrder`, `requestOpts?`: `RequestOpts`): *`Promise<void>`*
*Defined in [http_client.ts:177](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/http_client.ts#L177)*
Submit a signed order to the API
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`signedOrder` | `SignedOrder` | A SignedOrder instance to submit |
`requestOpts?` | `RequestOpts` | Options specifying network id. |
**Returns:** *`Promise<void>`*
<hr />
> # Class: WebSocketOrdersChannel
This class includes all the functionality related to interacting with a websocket endpoint
that implements the standard relayer API v0
## Hierarchy
* **WebSocketOrdersChannel**
## Implements
* [OrdersChannel](#interface-orderschannel)
## Index
### Constructors
* [constructor](#constructor)
### Methods
* [close](#close)
* [subscribe](#subscribe)
## Constructors
### constructor
\+ **new WebSocketOrdersChannel**(`client`: `w3cwebsocket`, `handler`: [OrdersChannelHandler](#class-websocketorderschannel)*
*Defined in [ws_orders_channel.ts:21](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/ws_orders_channel.ts#L21)*
Instantiates a new WebSocketOrdersChannel instance
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`client` | `w3cwebsocket` | A WebSocket client |
`handler` | [OrdersChannelHandler](#interface-orderschannelhandler) | An OrdersChannelHandler instance that responds to various channel updates |
**Returns:** *[WebSocketOrdersChannel](#class-websocketorderschannel)*
An instance of WebSocketOrdersChannel
## Methods
### close
▸ **close**(): *void*
*Defined in [ws_orders_channel.ts:66](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/ws_orders_channel.ts#L66)*
Close the websocket and stop receiving updates
**Returns:** *void*
___
### subscribe
▸ **subscribe**(`subscriptionOpts`: `OrdersChannelSubscriptionOpts`): *void*
*Defined in [ws_orders_channel.ts:50](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/ws_orders_channel.ts#L50)*
Subscribe to orderbook snapshots and updates from the websocket
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`subscriptionOpts` | `OrdersChannelSubscriptionOpts` | An OrdersChannelSubscriptionOpts instance describing which assetData pair to subscribe to |
**Returns:** *void*
<hr />
> # Enumeration: HttpRequestType
## Index
### Enumeration members
* [Get](#get)
* [Post](#post)
## Enumeration members
### Get
• **Get**: = "GET"
*Defined in [types.ts:46](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L46)*
___
### Post
• **Post**: = "POST"
*Defined in [types.ts:47](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L47)*
<hr />
> # Interface: Client
## Hierarchy
* **Client**
## Implemented by
* [HttpClient](#class-httpclient)
## Index
### Properties
* [getAssetPairsAsync](#getassetpairsasync)
* [getFeeRecipientsAsync](#getfeerecipientsasync)
* [getOrderAsync](#getorderasync)
* [getOrderConfigAsync](#getorderconfigasync)
* [getOrderbookAsync](#getorderbookasync)
* [getOrdersAsync](#getordersasync)
* [submitOrderAsync](#submitorderasync)
## Properties
### getAssetPairsAsync
• **getAssetPairsAsync**: *function*
*Defined in [types.ts:18](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L18)*
#### Type declaration:
▸ (`requestOpts?`: `AssetPairsRequestOpts` & `PagedRequestOpts`): *`Promise<PaginatedCollection<AssetPairsItem>>`*
**Parameters:**
Name | Type |
------ | ------ |
`requestOpts?` | `AssetPairsRequestOpts` & `PagedRequestOpts` |
___
### getFeeRecipientsAsync
• **getFeeRecipientsAsync**: *function*
*Defined in [types.ts:25](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L25)*
#### Type declaration:
▸ (`requestOpts?`: `PagedRequestOpts`): *`Promise<FeeRecipientsResponse>`*
**Parameters:**
Name | Type |
------ | ------ |
`requestOpts?` | `PagedRequestOpts` |
___
### getOrderAsync
• **getOrderAsync**: *function*
*Defined in [types.ts:22](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L22)*
#### Type declaration:
▸ (`orderHash`: string): *`Promise<APIOrder>`*
**Parameters:**
Name | Type |
------ | ------ |
`orderHash` | string |
___
### getOrderConfigAsync
• **getOrderConfigAsync**: *function*
*Defined in [types.ts:24](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L24)*
#### Type declaration:
▸ (`request`: `OrderConfigRequest`): *`Promise<OrderConfigResponse>`*
**Parameters:**
Name | Type |
------ | ------ |
`request` | `OrderConfigRequest` |
___
### getOrderbookAsync
• **getOrderbookAsync**: *function*
*Defined in [types.ts:23](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L23)*
#### Type declaration:
▸ (`request`: `OrderbookRequest`, `requestOpts?`: `PagedRequestOpts`): *`Promise<OrderbookResponse>`*
**Parameters:**
Name | Type |
------ | ------ |
`request` | `OrderbookRequest` |
`requestOpts?` | `PagedRequestOpts` |
___
### getOrdersAsync
• **getOrdersAsync**: *function*
*Defined in [types.ts:21](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L21)*
#### Type declaration:
▸ (`requestOpts?`: `OrdersRequestOpts` & `PagedRequestOpts`): *`Promise<PaginatedCollection<APIOrder>>`*
**Parameters:**
Name | Type |
------ | ------ |
`requestOpts?` | `OrdersRequestOpts` & `PagedRequestOpts` |
___
### submitOrderAsync
• **submitOrderAsync**: *function*
*Defined in [types.ts:26](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L26)*
#### Type declaration:
▸ (`signedOrder`: `SignedOrder`): *`Promise<void>`*
**Parameters:**
Name | Type |
------ | ------ |
`signedOrder` | `SignedOrder` |
<hr />
> # Interface: HttpRequestOptions
## Hierarchy
* **HttpRequestOptions**
## Index
### Properties
* [params](#optional-params)
* [payload](#optional-payload)
## Properties
### `Optional` params
• **params**? : *undefined | object*
*Defined in [types.ts:41](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L41)*
___
### `Optional` payload
• **payload**? : *undefined | object*
*Defined in [types.ts:42](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L42)*
<hr />
> # Interface: OrdersChannel
## Hierarchy
* **OrdersChannel**
## Implemented by
* [WebSocketOrdersChannel](#class-websocketorderschannel)
## Index
### Properties
* [close](#close)
* [subscribe](#subscribe)
## Properties
### close
• **close**: *function*
*Defined in [types.ts:31](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L31)*
#### Type declaration:
▸ (): *void*
___
### subscribe
• **subscribe**: *function*
*Defined in [types.ts:30](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L30)*
#### Type declaration:
▸ (`subscriptionOpts`: `OrdersChannelSubscriptionOpts`): *void*
**Parameters:**
Name | Type |
------ | ------ |
`subscriptionOpts` | `OrdersChannelSubscriptionOpts` |
<hr />
> # Interface: OrdersChannelHandler
## Hierarchy
* **OrdersChannelHandler**
## Index
### Properties
* [onClose](#onclose)
* [onError](#onerror)
* [onUpdate](#onupdate)
## Properties
### onClose
• **onClose**: *function*
*Defined in [types.ts:37](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L37)*
#### Type declaration:
▸ (`channel`: [OrdersChannel](#interface-orderschannel)): *void*
**Parameters:**
Name | Type |
------ | ------ |
`channel` | [OrdersChannel](#interface-orderschannel) |
___
### onError
• **onError**: *function*
*Defined in [types.ts:36](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L36)*
#### Type declaration:
▸ (`channel`: [OrdersChannel](#interface-orderschannel), `err`: `Error`, `subscriptionOpts?`: `OrdersChannelSubscriptionOpts`): *void*
**Parameters:**
Name | Type |
------ | ------ |
`channel` | [OrdersChannel](#interface-orderschannel) |
`err` | `Error` |
`subscriptionOpts?` | `OrdersChannelSubscriptionOpts` |
___
### onUpdate
• **onUpdate**: *function*
*Defined in [types.ts:35](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/connect/src/types.ts#L35)*
#### Type declaration:
▸ (`channel`: [OrdersChannel](#interface-orderschannel), `subscriptionOpts`: `OrdersChannelSubscriptionOpts`, `orders`: `APIOrder`[]): *void*
**Parameters:**
Name | Type |
------ | ------ |
`channel` | [OrdersChannel](#interface-orderschannel) |
`subscriptionOpts` | `OrdersChannelSubscriptionOpts` |
`orders` | `APIOrder`[] |
<hr />
> # Interface: OrdersChannelSubscriptionOptsMap
## Hierarchy
* **OrdersChannelSubscriptionOptsMap**
## Indexable
● \[▪ **key**: *string*\]: `OrdersChannelSubscriptionOpts`
<hr />
* [Globals](globals.md)
* [External Modules]()
* [http_client](modules/_http_client_.md)
* [http_client.HttpClient](#class-httpclient)
* [index](modules/_index_.md)
* [orders_channel_factory](modules/_orders_channel_factory_.md)
* [types](modules/_types_.md)
* [types.HttpRequestType](#class-httprequesttype)
* [types.Client](#class-client)
* [types.HttpRequestOptions](#class-httprequestoptions)
* [types.OrdersChannel](#class-orderschannel)
* [types.OrdersChannelHandler](#class-orderschannelhandler)
* [utils/assert](modules/_utils_assert_.md)
* [utils/orders_channel_message_parser](modules/_utils_orders_channel_message_parser_.md)
* [utils/relayer_response_json_parsers](modules/_utils_relayer_response_json_parsers_.md)
* [utils/type_converters](modules/_utils_type_converters_.md)
* [ws_orders_channel](modules/_ws_orders_channel_.md)
* [ws_orders_channel.WebSocketOrdersChannel](#class-websocketorderschannel)
* [ws_orders_channel.OrdersChannelSubscriptionOptsMap](#class-orderschannelsubscriptionoptsmap)
* [Classes]()
* [http_client.HttpClient](#class-httpclient)
* [ws_orders_channel.WebSocketOrdersChannel](#class-websocketorderschannel)
* [Enums]()
* [types.HttpRequestType](#class-httprequesttype)
* [Interfaces]()
* [types.Client](#class-client)
* [types.HttpRequestOptions](#class-httprequestoptions)
* [types.OrdersChannel](#class-orderschannel)
* [types.OrdersChannelHandler](#class-orderschannelhandler)
* [ws_orders_channel.OrdersChannelSubscriptionOptsMap](#class-orderschannelsubscriptionoptsmap)
<hr />

View File

@@ -0,0 +1,89 @@
## @0x/contract-wrappers
Smart TS wrappers for 0x smart contracts. The wrappers have simplified interfaces, perform client-side validation on transactions and throw helpful error messages.
### Read the [Documentation](https://0xproject.com/docs/0x.js).
## Installation
**Install**
```bash
npm install @0x/contract-wrappers --save
```
**Import**
```javascript
import { ContractWrappers } from '@0x/contract-wrappers';
```
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
```json
"compilerOptions": {
"typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
}
```
## Contributing
We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
```bash
yarn config set workspaces-experimental true
```
Then install dependencies
```bash
yarn install
```
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
PKG=@0x/contract-wrappers yarn build
```
Or continuously rebuild on change:
```bash
PKG=@0x/contract-wrappers yarn watch
```
```bash
yarn build
```
or continuously rebuild on change:
```bash
yarn watch
```
### Clean
```bash
yarn clean
```
### Lint
```bash
yarn lint
```
### Run Tests
```bash
yarn test
```

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,77 @@
## @0x/contract-wrappers
Wrappers for 0x smart contracts, generated using @0x/abi-gen.
## Installation
**Install**
```bash
npm install @0x/contract-wrappers --save
```
**Import**
```typescript
import { ContractWrappers } from '@0x/contract-wrappers';
```
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
```json
"compilerOptions": {
"typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
}
```
## Contributing
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
```bash
yarn config set workspaces-experimental true
```
Then install dependencies
```bash
yarn install
```
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
PKG=@0x/contract-wrappers yarn build
```
### Clean
```bash
yarn clean
```
### Lint
```bash
yarn lint
```
### Run Tests
```bash
yarn test
```
### Documentation
Documentation for this package is generated by TypeDoc, using the Solidity source code for 0x contracts. Each contract corresponds to one global-level module, which contains relevant enums and interfaces for its events and structs. Most significantly, each module exports a class, `<ContractName>Contract`, e.g. `ExchangeContract`, which implements helper methods for all the functions defined in the corresponding contract.
A convention to note is that these contract-specific helper methods are defined as _object literals_, which are separated from methods in the generated documentation. Each contract method has a number of sub-methods, e.g. `sendTransactionAsync`, or `estimateGasAsync`, which are documented separately. This is an example of an expected method call signature: `exchangeContractInstance.fillOrder.sendTransactionAsync(...arguments)`.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,83 @@
## @0x/json-schemas
Contains 0x-related json schemas
### Read the [Documentation](https://0xproject.com/docs/json-schemas).
## Installation
```bash
yarn add @0x/json-schemas
```
**Import**
```typescript
import { SchemaValidator, ValidatorResult, schemas } from '@0x/json-schemas';
```
or
```javascript
var schemas = require('@0x/json-schemas').schemas;
```
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
```json
"compilerOptions": {
"typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
}
```
## Contributing
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
```bash
yarn config set workspaces-experimental true
```
Then install dependencies
```bash
yarn install
```
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
PKG=@0x/json-schemas yarn build
```
Or continuously rebuild on change:
```bash
PKG=@0x/json-schemas yarn watch
```
### Clean
```bash
yarn clean
```
### Lint
```bash
yarn lint
```
### Run Tests
```bash
yarn test
```

View File

@@ -0,0 +1,107 @@
> # Class: SchemaValidator
A validator for [JSON-schemas](http://json-schema.org/)
## Hierarchy
* **SchemaValidator**
## Index
### Constructors
* [constructor](#constructor)
### Methods
* [addSchema](#addschema)
* [isValid](#isvalid)
* [validate](#validate)
## Constructors
### constructor
\+ **new SchemaValidator**(): *[SchemaValidator](#class-schemavalidator)*
*Defined in [schema_validator.ts:15](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/json-schemas/src/schema_validator.ts#L15)*
Instantiates a SchemaValidator instance
**Returns:** *[SchemaValidator](#class-schemavalidator)*
## Methods
### addSchema
▸ **addSchema**(`schema`: `Schema`): *void*
*Defined in [schema_validator.ts:32](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/json-schemas/src/schema_validator.ts#L32)*
Add a schema to the validator. All schemas and sub-schemas must be added to
the validator before the `validate` and `isValid` methods can be called with
instances of that schema.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`schema` | `Schema` | The schema to add |
**Returns:** *void*
___
### isValid
▸ **isValid**(`instance`: any, `schema`: `Schema`): *boolean*
*Defined in [schema_validator.ts:57](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/json-schemas/src/schema_validator.ts#L57)*
Check whether an instance properly adheres to a JSON schema
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`instance` | any | JS object in question |
`schema` | `Schema` | Schema to check against |
**Returns:** *boolean*
Whether or not the instance adheres to the schema
___
### validate
▸ **validate**(`instance`: any, `schema`: `Schema`): *`ValidatorResult`*
*Defined in [schema_validator.ts:46](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/json-schemas/src/schema_validator.ts#L46)*
Validate the JS object conforms to a specific JSON schema
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`instance` | any | JS object in question |
`schema` | `Schema` | Schema to check against |
**Returns:** *`ValidatorResult`*
The results of the validation
<hr />
* [Globals](globals.md)
* [External Modules]()
* [index](modules/_index_.md)
* [schema_validator](modules/_schema_validator_.md)
* [schema_validator.SchemaValidator](#class-schemavalidator)
* [schemas](modules/_schemas_.md)
* [Classes]()
* [schema_validator.SchemaValidator](#class-schemavalidator)
<hr />

View File

@@ -0,0 +1,83 @@
## @0x/json-schemas
Contains 0x-related json schemas
### Read the [Documentation](https://0xproject.com/docs/json-schemas).
## Installation
```bash
yarn add @0x/json-schemas
```
**Import**
```typescript
import { SchemaValidator, ValidatorResult, schemas } from '@0x/json-schemas';
```
or
```javascript
var schemas = require('@0x/json-schemas').schemas;
```
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
```json
"compilerOptions": {
"typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
}
```
## Contributing
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
```bash
yarn config set workspaces-experimental true
```
Then install dependencies
```bash
yarn install
```
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
PKG=@0x/json-schemas yarn build
```
Or continuously rebuild on change:
```bash
PKG=@0x/json-schemas yarn watch
```
### Clean
```bash
yarn clean
```
### Lint
```bash
yarn lint
```
### Run Tests
```bash
yarn test
```

View File

@@ -0,0 +1,107 @@
> # Class: SchemaValidator
A validator for [JSON-schemas](http://json-schema.org/)
## Hierarchy
* **SchemaValidator**
## Index
### Constructors
* [constructor](#constructor)
### Methods
* [addSchema](#addschema)
* [isValid](#isvalid)
* [validate](#validate)
## Constructors
### constructor
\+ **new SchemaValidator**(): *[SchemaValidator](#class-schemavalidator)*
*Defined in [schema_validator.ts:15](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/json-schemas/src/schema_validator.ts#L15)*
Instantiates a SchemaValidator instance
**Returns:** *[SchemaValidator](#class-schemavalidator)*
## Methods
### addSchema
▸ **addSchema**(`schema`: `Schema`): *void*
*Defined in [schema_validator.ts:32](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/json-schemas/src/schema_validator.ts#L32)*
Add a schema to the validator. All schemas and sub-schemas must be added to
the validator before the `validate` and `isValid` methods can be called with
instances of that schema.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`schema` | `Schema` | The schema to add |
**Returns:** *void*
___
### isValid
▸ **isValid**(`instance`: any, `schema`: `Schema`): *boolean*
*Defined in [schema_validator.ts:57](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/json-schemas/src/schema_validator.ts#L57)*
Check whether an instance properly adheres to a JSON schema
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`instance` | any | JS object in question |
`schema` | `Schema` | Schema to check against |
**Returns:** *boolean*
Whether or not the instance adheres to the schema
___
### validate
▸ **validate**(`instance`: any, `schema`: `Schema`): *`ValidatorResult`*
*Defined in [schema_validator.ts:46](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/json-schemas/src/schema_validator.ts#L46)*
Validate the JS object conforms to a specific JSON schema
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`instance` | any | JS object in question |
`schema` | `Schema` | Schema to check against |
**Returns:** *`ValidatorResult`*
The results of the validation
<hr />
* [Globals](globals.md)
* [External Modules]()
* [index](modules/_index_.md)
* [schema_validator](modules/_schema_validator_.md)
* [schema_validator.SchemaValidator](#class-schemavalidator)
* [schemas](modules/_schemas_.md)
* [Classes]()
* [schema_validator.SchemaValidator](#class-schemavalidator)
<hr />

View File

@@ -0,0 +1,104 @@
## Migrations
Migrate the 0x system of smart contracts on the network of your choice using these migrations.
## Contributing
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
```bash
yarn config set workspaces-experimental true
```
Then install dependencies
```bash
yarn install
```
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
PKG=@0x/migrations yarn build
```
Or continuously rebuild on change:
```bash
PKG=@0x/migrations yarn watch
```
### Clean
```bash
yarn clean
```
### Lint
```bash
yarn lint
```
### Migrate
#### V2 smart contracts
In order to migrate the V2 0x smart contracts to TestRPC/Ganache running at `http://localhost:8545`, run:
```bash
yarn migrate:v2
```
### Publish
#### 0x Ganache Snapshot
The 0x Ganache snapshot can be generated and published in this package. In order to build the snapshot for this version of migrations run:
```bash
yarn build:snapshot
```
This will run the migrations in Ganache and output a zip file to be uploaded to the s3 bucket. For example, after running this command you will have created `0x_ganache_snapshot-2.2.2.zip`. To publish the zip file to the s3 bucket run:
```bash
yarn publish:snapshot
```
This snapshot will now be publicly available at http://ganache-snapshots.0x.org.s3.amazonaws.com/0x_ganache_snapshot-latest.zip and also versioned with the package.json version.
#### 0x Ganache Docker Image
We also publish a simple docker image which downloads the latest snapshot, extracts and runs Ganache. This is not required to be built when migrations change as it always downloads and runs the latest zip file. If you have made changes to the Dockerfile then a publish of the image is required. To do this run:
```bash
yarn build:snapshot:docker
yarn publish:snapshot:docker
```
The result is a published docker image to the 0xorg docker registry. To start the docker image run:
```bash
docker run -p 8545:8545 -ti 0xorg/ganache-cli:latest
```
This will pull the latest zip in the s3 bucket, extract and start Ganache with the snapshot.
In the event you need a specific version of the published Ganache snapshot run the following specifying the VERSION environment variable:
```bash
docker run -e VERSION=2.2.2 -p 8545:8545 -ti 0xorg/ganache-cli:latest
```
#### Production
If deploying contract changes to mainnet, `@0x/contract-artifacts` should also be updated and published. The artifacts must be copied from each `contracts/{package-name}/generated-artifacts/{contract}.json`.

View File

@@ -0,0 +1,228 @@
> # Enumeration: ContractName
## Index
### Enumeration members
* [AccountLevels](#accountlevels)
* [Arbitrage](#arbitrage)
* [DummyToken](#dummytoken)
* [EtherDelta](#etherdelta)
* [Exchange](#exchange)
* [MultiSigWalletWithTimeLock](#multisigwalletwithtimelock)
* [MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress](#multisigwalletwithtimelockexceptremoveauthorizedaddress)
* [TokenRegistry](#tokenregistry)
* [TokenTransferProxy](#tokentransferproxy)
* [WETH9](#weth9)
* [ZRXToken](#zrxtoken)
## Enumeration members
### AccountLevels
• **AccountLevels**: = "AccountLevels"
*Defined in [types.ts:26](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L26)*
___
### Arbitrage
• **Arbitrage**: = "Arbitrage"
*Defined in [types.ts:28](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L28)*
___
### DummyToken
• **DummyToken**: = "DummyToken"
*Defined in [types.ts:23](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L23)*
___
### EtherDelta
• **EtherDelta**: = "EtherDelta"
*Defined in [types.ts:27](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L27)*
___
### Exchange
• **Exchange**: = "Exchange"
*Defined in [types.ts:21](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L21)*
___
### MultiSigWalletWithTimeLock
• **MultiSigWalletWithTimeLock**: = "MultiSigWalletWithTimeLock"
*Defined in [types.ts:20](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L20)*
___
### MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress
• **MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress**: = "MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress"
*Defined in [types.ts:25](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L25)*
___
### TokenRegistry
• **TokenRegistry**: = "TokenRegistry"
*Defined in [types.ts:19](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L19)*
___
### TokenTransferProxy
• **TokenTransferProxy**: = "TokenTransferProxy"
*Defined in [types.ts:18](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L18)*
___
### WETH9
• **WETH9**: = "WETH9"
*Defined in [types.ts:24](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L24)*
___
### ZRXToken
• **ZRXToken**: = "ZRXToken"
*Defined in [types.ts:22](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L22)*
<hr />
> # Interface: ERC20Token
## Hierarchy
* **ERC20Token**
## Index
### Properties
* [address](#optional-address)
* [decimals](#decimals)
* [ipfsHash](#ipfshash)
* [name](#name)
* [swarmHash](#swarmhash)
* [symbol](#symbol)
## Properties
### `Optional` address
• **address**? : *undefined | string*
*Defined in [types.ts:4](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L4)*
___
### decimals
• **decimals**: *`BigNumber`*
*Defined in [types.ts:7](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L7)*
___
### ipfsHash
• **ipfsHash**: *string*
*Defined in [types.ts:8](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L8)*
___
### name
• **name**: *string*
*Defined in [types.ts:5](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L5)*
___
### swarmHash
• **swarmHash**: *string*
*Defined in [types.ts:9](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L9)*
___
### symbol
• **symbol**: *string*
*Defined in [types.ts:6](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L6)*
<hr />
> # Interface: ERC721Token
## Hierarchy
* **ERC721Token**
## Index
### Properties
* [name](#name)
* [symbol](#symbol)
## Properties
### name
• **name**: *string*
*Defined in [types.ts:13](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L13)*
___
### symbol
• **symbol**: *string*
*Defined in [types.ts:14](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L14)*
<hr />
* [Globals](globals.md)
* [External Modules]()
* [cli](modules/_cli_.md)
* [index](modules/_index_.md)
* [migrate](modules/_migrate_.md)
* [migrate_snapshot](modules/_migrate_snapshot_.md)
* [migration](modules/_migration_.md)
* [types](modules/_types_.md)
* [types.ContractName](#class-contractname)
* [types.ERC20Token](#class-erc20token)
* [types.ERC721Token](#class-erc721token)
* [utils/constants](modules/_utils_constants_.md)
* [utils/provider_factory](modules/_utils_provider_factory_.md)
* [utils/token_info](modules/_utils_token_info_.md)
* [Enums]()
* [types.ContractName](#class-contractname)
* [Interfaces]()
* [types.ERC20Token](#class-erc20token)
* [types.ERC721Token](#class-erc721token)
<hr />

View File

@@ -0,0 +1,104 @@
## Migrations
Migrate the 0x system of smart contracts on the network of your choice using these migrations.
## Contributing
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
```bash
yarn config set workspaces-experimental true
```
Then install dependencies
```bash
yarn install
```
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
PKG=@0x/migrations yarn build
```
Or continuously rebuild on change:
```bash
PKG=@0x/migrations yarn watch
```
### Clean
```bash
yarn clean
```
### Lint
```bash
yarn lint
```
### Migrate
#### V2 smart contracts
In order to migrate the V2 0x smart contracts to TestRPC/Ganache running at `http://localhost:8545`, run:
```bash
yarn migrate:v2
```
### Publish
#### 0x Ganache Snapshot
The 0x Ganache snapshot can be generated and published in this package. In order to build the snapshot for this version of migrations run:
```bash
yarn build:snapshot
```
This will run the migrations in Ganache and output a zip file to be uploaded to the s3 bucket. For example, after running this command you will have created `0x_ganache_snapshot-2.2.2.zip`. To publish the zip file to the s3 bucket run:
```bash
yarn publish:snapshot
```
This snapshot will now be publicly available at http://ganache-snapshots.0x.org.s3.amazonaws.com/0x_ganache_snapshot-latest.zip and also versioned with the package.json version.
#### 0x Ganache Docker Image
We also publish a simple docker image which downloads the latest snapshot, extracts and runs Ganache. This is not required to be built when migrations change as it always downloads and runs the latest zip file. If you have made changes to the Dockerfile then a publish of the image is required. To do this run:
```bash
yarn build:snapshot:docker
yarn publish:snapshot:docker
```
The result is a published docker image to the 0xorg docker registry. To start the docker image run:
```bash
docker run -p 8545:8545 -ti 0xorg/ganache-cli:latest
```
This will pull the latest zip in the s3 bucket, extract and start Ganache with the snapshot.
In the event you need a specific version of the published Ganache snapshot run the following specifying the VERSION environment variable:
```bash
docker run -e VERSION=2.2.2 -p 8545:8545 -ti 0xorg/ganache-cli:latest
```
#### Production
If deploying contract changes to mainnet, `@0x/contract-artifacts` should also be updated and published. The artifacts must be copied from each `contracts/{package-name}/generated-artifacts/{contract}.json`.

View File

@@ -0,0 +1,228 @@
> # Enumeration: ContractName
## Index
### Enumeration members
* [AccountLevels](#accountlevels)
* [Arbitrage](#arbitrage)
* [DummyToken](#dummytoken)
* [EtherDelta](#etherdelta)
* [Exchange](#exchange)
* [MultiSigWalletWithTimeLock](#multisigwalletwithtimelock)
* [MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress](#multisigwalletwithtimelockexceptremoveauthorizedaddress)
* [TokenRegistry](#tokenregistry)
* [TokenTransferProxy](#tokentransferproxy)
* [WETH9](#weth9)
* [ZRXToken](#zrxtoken)
## Enumeration members
### AccountLevels
• **AccountLevels**: = "AccountLevels"
*Defined in [types.ts:26](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L26)*
___
### Arbitrage
• **Arbitrage**: = "Arbitrage"
*Defined in [types.ts:28](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L28)*
___
### DummyToken
• **DummyToken**: = "DummyToken"
*Defined in [types.ts:23](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L23)*
___
### EtherDelta
• **EtherDelta**: = "EtherDelta"
*Defined in [types.ts:27](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L27)*
___
### Exchange
• **Exchange**: = "Exchange"
*Defined in [types.ts:21](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L21)*
___
### MultiSigWalletWithTimeLock
• **MultiSigWalletWithTimeLock**: = "MultiSigWalletWithTimeLock"
*Defined in [types.ts:20](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L20)*
___
### MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress
• **MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress**: = "MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress"
*Defined in [types.ts:25](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L25)*
___
### TokenRegistry
• **TokenRegistry**: = "TokenRegistry"
*Defined in [types.ts:19](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L19)*
___
### TokenTransferProxy
• **TokenTransferProxy**: = "TokenTransferProxy"
*Defined in [types.ts:18](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L18)*
___
### WETH9
• **WETH9**: = "WETH9"
*Defined in [types.ts:24](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L24)*
___
### ZRXToken
• **ZRXToken**: = "ZRXToken"
*Defined in [types.ts:22](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L22)*
<hr />
> # Interface: ERC20Token
## Hierarchy
* **ERC20Token**
## Index
### Properties
* [address](#optional-address)
* [decimals](#decimals)
* [ipfsHash](#ipfshash)
* [name](#name)
* [swarmHash](#swarmhash)
* [symbol](#symbol)
## Properties
### `Optional` address
• **address**? : *undefined | string*
*Defined in [types.ts:4](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L4)*
___
### decimals
• **decimals**: *`BigNumber`*
*Defined in [types.ts:7](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L7)*
___
### ipfsHash
• **ipfsHash**: *string*
*Defined in [types.ts:8](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L8)*
___
### name
• **name**: *string*
*Defined in [types.ts:5](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L5)*
___
### swarmHash
• **swarmHash**: *string*
*Defined in [types.ts:9](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L9)*
___
### symbol
• **symbol**: *string*
*Defined in [types.ts:6](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L6)*
<hr />
> # Interface: ERC721Token
## Hierarchy
* **ERC721Token**
## Index
### Properties
* [name](#name)
* [symbol](#symbol)
## Properties
### name
• **name**: *string*
*Defined in [types.ts:13](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L13)*
___
### symbol
• **symbol**: *string*
*Defined in [types.ts:14](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/migrations/src/types.ts#L14)*
<hr />
* [Globals](globals.md)
* [External Modules]()
* [cli](modules/_cli_.md)
* [index](modules/_index_.md)
* [migrate](modules/_migrate_.md)
* [migrate_snapshot](modules/_migrate_snapshot_.md)
* [migration](modules/_migration_.md)
* [types](modules/_types_.md)
* [types.ContractName](#class-contractname)
* [types.ERC20Token](#class-erc20token)
* [types.ERC721Token](#class-erc721token)
* [utils/constants](modules/_utils_constants_.md)
* [utils/provider_factory](modules/_utils_provider_factory_.md)
* [utils/token_info](modules/_utils_token_info_.md)
* [Enums]()
* [types.ContractName](#class-contractname)
* [Interfaces]()
* [types.ERC20Token](#class-erc20token)
* [types.ERC721Token](#class-erc721token)
<hr />

View File

@@ -0,0 +1,65 @@
## @0x/order-utils
0x order-related utilities for those developing on top of 0x protocol.
### Read the [Documentation](https://0xproject.com/docs/order-utils).
## Installation
```bash
yarn add @0x/order-utils
```
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
```json
"compilerOptions": {
"typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
}
```
## Contributing
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
```bash
yarn config set workspaces-experimental true
```
Then install dependencies
```bash
yarn install
```
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
PKG=@0x/order-utils yarn build
```
Or continuously rebuild on change:
```bash
PKG=@0x/order-utils yarn watch
```
### Clean
```bash
yarn clean
```
### Lint
```bash
yarn lint
```

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,65 @@
## @0x/order-utils
0x order-related utilities for those developing on top of 0x protocol.
### Read the [Documentation](https://0xproject.com/docs/order-utils).
## Installation
```bash
yarn add @0x/order-utils
```
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
```json
"compilerOptions": {
"typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
}
```
## Contributing
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
```bash
yarn config set workspaces-experimental true
```
Then install dependencies
```bash
yarn install
```
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
PKG=@0x/order-utils yarn build
```
Or continuously rebuild on change:
```bash
PKG=@0x/order-utils yarn watch
```
### Clean
```bash
yarn clean
```
### Lint
```bash
yarn lint
```

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,97 @@
## @0x/sol-compiler
Sol-compiler is a wrapper around [solc-js](https://www.npmjs.com/package/solc) that adds:
- Smart re-compilation: Only recompiles when smart contracts have changed
- Ability to compile an entire project instead of only individual `.sol` files
- Compilation using the Solidity version specified at the top of each individual `.sol` file
- Proper parsing of Solidity version ranges
- Support for the standard [input description](https://solidity.readthedocs.io/en/develop/using-the-compiler.html#input-description) for what information you'd like added to the resulting `artifacts` file (i.e 100% configurable artifacts content).
### Read the [Documentation](https://0xproject.com/docs/sol-compiler).
## Installation
#### CLI Installation
```bash
yarn global add @0x/sol-compiler
```
#### API Installation
```bash
yarn add @0x/sol-compiler
```
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
```json
"compilerOptions": {
"typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
}
```
**Import**
```typescript
import { Compiler } from '@0x/sol-compiler';
```
or
```javascript
var Compiler = require('@0x/sol-compiler').Compiler;
```
## Contributing
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
```bash
yarn config set workspaces-experimental true
```
Then install dependencies
```bash
yarn install
```
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
PKG=@0x/sol-compiler yarn build
```
Or continuously rebuild on change:
```bash
PKG=@0x/sol-compiler yarn watch
```
### Clean
```bash
yarn clean
```
### Lint
```bash
yarn lint
```
### Run Tests
```bash
yarn test
```

View File

@@ -0,0 +1,401 @@
> # Class: Compiler
The Compiler facilitates compiling Solidity smart contracts and saves the results
to artifact files.
## Hierarchy
* **Compiler**
## Index
### Constructors
* [constructor](#constructor)
### Methods
* [compileAsync](#compileasync)
* [getCompilerOutputsAsync](#getcompileroutputsasync)
* [watchAsync](#watchasync)
## Constructors
### constructor
\+ **new Compiler**(`opts?`: `CompilerOptions`): *[Compiler](#class-compiler)*
*Defined in [compiler.ts:94](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/compiler.ts#L94)*
Instantiates a new instance of the Compiler class.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`opts?` | `CompilerOptions` | Optional compiler options |
**Returns:** *[Compiler](#class-compiler)*
An instance of the Compiler class.
## Methods
### compileAsync
▸ **compileAsync**(): *`Promise<void>`*
*Defined in [compiler.ts:132](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/compiler.ts#L132)*
Compiles selected Solidity files found in `contractsDir` and writes JSON artifacts to `artifactsDir`.
**Returns:** *`Promise<void>`*
___
### getCompilerOutputsAsync
▸ **getCompilerOutputsAsync**(): *`Promise<StandardOutput[]>`*
*Defined in [compiler.ts:145](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/compiler.ts#L145)*
Compiles Solidity files specified during instantiation, and returns the
compiler output given by solc. Return value is an array of outputs:
Solidity modules are batched together by version required, and each
element of the returned array corresponds to a compiler version, and
each element contains the output for all of the modules compiled with
that version.
**Returns:** *`Promise<StandardOutput[]>`*
___
### watchAsync
▸ **watchAsync**(): *`Promise<void>`*
*Defined in [compiler.ts:149](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/compiler.ts#L149)*
**Returns:** *`Promise<void>`*
<hr />
> # Class: CompilationError
## Hierarchy
* `Error`
* **CompilationError**
## Index
### Constructors
* [constructor](#constructor)
### Properties
* [errorsCount](#errorscount)
* [message](#message)
* [name](#name)
* [stack](#optional-stack)
* [typeName](#typename)
* [Error](#static-error)
## Constructors
### constructor
\+ **new CompilationError**(`errorsCount`: number): *[CompilationError](#class-compilationerror)*
*Defined in [utils/types.ts:39](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L39)*
**Parameters:**
Name | Type |
------ | ------ |
`errorsCount` | number |
**Returns:** *[CompilationError](#class-compilationerror)*
## Properties
### errorsCount
• **errorsCount**: *number*
*Defined in [utils/types.ts:38](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L38)*
___
### message
• **message**: *string*
*Inherited from void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/node_modules/typedoc/node_modules/typescript/lib/lib.es5.d.ts:974
___
### name
• **name**: *string*
*Inherited from void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/node_modules/typedoc/node_modules/typescript/lib/lib.es5.d.ts:973
___
### `Optional` stack
• **stack**? : *undefined | string*
*Inherited from void*
*Overrides void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/node_modules/typedoc/node_modules/typescript/lib/lib.es5.d.ts:975
___
### typeName
• **typeName**: *string* = "CompilationError"
*Defined in [utils/types.ts:39](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L39)*
___
### `Static` Error
▪ **Error**: *`ErrorConstructor`*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/node_modules/typedoc/node_modules/typescript/lib/lib.es5.d.ts:984
<hr />
> # Enumeration: AbiType
## Index
### Enumeration members
* [Constructor](#constructor)
* [Event](#event)
* [Fallback](#fallback)
* [Function](#function)
## Enumeration members
### Constructor
• **Constructor**: = "constructor"
*Defined in [utils/types.ts:3](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L3)*
___
### Event
• **Event**: = "event"
*Defined in [utils/types.ts:4](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L4)*
___
### Fallback
• **Fallback**: = "fallback"
*Defined in [utils/types.ts:5](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L5)*
___
### Function
• **Function**: = "function"
*Defined in [utils/types.ts:2](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L2)*
<hr />
> # Interface: BinaryPaths
## Hierarchy
* **BinaryPaths**
## Indexable
● \[▪ **key**: *string*\]: string
<hr />
> # Interface: ContractSourceData
## Hierarchy
* **ContractSourceData**
## Indexable
● \[▪ **contractName**: *string*\]: [ContractSpecificSourceData](#class-contractspecificsourcedata)
<hr />
> # Interface: ContractSpecificSourceData
## Hierarchy
* **ContractSpecificSourceData**
## Index
### Properties
* [solcVersionRange](#solcversionrange)
* [sourceHash](#sourcehash)
* [sourceTreeHash](#sourcetreehash)
## Properties
### solcVersionRange
• **solcVersionRange**: *string*
*Defined in [utils/types.ts:21](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L21)*
___
### sourceHash
• **sourceHash**: *`Buffer`*
*Defined in [utils/types.ts:22](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L22)*
___
### sourceTreeHash
• **sourceTreeHash**: *`Buffer`*
*Defined in [utils/types.ts:23](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L23)*
<hr />
> # Interface: SolcErrors
## Hierarchy
* **SolcErrors**
## Indexable
● \[▪ **key**: *string*\]: boolean
<hr />
> # Interface: Token
## Hierarchy
* **Token**
## Index
### Properties
* [address](#optional-address)
* [decimals](#decimals)
* [ipfsHash](#ipfshash)
* [name](#name)
* [swarmHash](#swarmhash)
* [symbol](#symbol)
## Properties
### `Optional` address
• **address**? : *undefined | string*
*Defined in [utils/types.ts:27](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L27)*
___
### decimals
• **decimals**: *number*
*Defined in [utils/types.ts:30](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L30)*
___
### ipfsHash
• **ipfsHash**: *string*
*Defined in [utils/types.ts:31](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L31)*
___
### name
• **name**: *string*
*Defined in [utils/types.ts:28](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L28)*
___
### swarmHash
• **swarmHash**: *string*
*Defined in [utils/types.ts:32](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L32)*
___
### symbol
• **symbol**: *string*
*Defined in [utils/types.ts:29](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L29)*
<hr />
* [Globals](globals.md)
* [External Modules]()
* [cli](modules/_cli_.md)
* [compiler](modules/_compiler_.md)
* [compiler.Compiler](#class-compiler)
* [index](modules/_index_.md)
* [schemas/compiler_options_schema](modules/_schemas_compiler_options_schema_.md)
* [utils/compiler](modules/_utils_compiler_.md)
* [utils/constants](modules/_utils_constants_.md)
* [utils/encoder](modules/_utils_encoder_.md)
* [utils/fs_wrapper](modules/_utils_fs_wrapper_.md)
* [utils/types](modules/_utils_types_.md)
* [utils/types.AbiType](#class-abitype)
* [utils/types.CompilationError](#class-compilationerror)
* [utils/types.BinaryPaths](#class-binarypaths)
* [utils/types.ContractSourceData](#class-contractsourcedata)
* [utils/types.ContractSpecificSourceData](#class-contractspecificsourcedata)
* [utils/types.SolcErrors](#class-solcerrors)
* [utils/types.Token](#class-token)
* [utils/utils](modules/_utils_utils_.md)
* [Classes]()
* [compiler.Compiler](#class-compiler)
* [utils/types.CompilationError](#class-compilationerror)
* [Enums]()
* [utils/types.AbiType](#class-abitype)
* [Interfaces]()
* [utils/types.BinaryPaths](#class-binarypaths)
* [utils/types.ContractSourceData](#class-contractsourcedata)
* [utils/types.ContractSpecificSourceData](#class-contractspecificsourcedata)
* [utils/types.SolcErrors](#class-solcerrors)
* [utils/types.Token](#class-token)
<hr />

View File

@@ -0,0 +1,97 @@
## @0x/sol-compiler
Sol-compiler is a wrapper around [solc-js](https://www.npmjs.com/package/solc) that adds:
- Smart re-compilation: Only recompiles when smart contracts have changed
- Ability to compile an entire project instead of only individual `.sol` files
- Compilation using the Solidity version specified at the top of each individual `.sol` file
- Proper parsing of Solidity version ranges
- Support for the standard [input description](https://solidity.readthedocs.io/en/develop/using-the-compiler.html#input-description) for what information you'd like added to the resulting `artifacts` file (i.e 100% configurable artifacts content).
### Read the [Documentation](https://0xproject.com/docs/sol-compiler).
## Installation
#### CLI Installation
```bash
yarn global add @0x/sol-compiler
```
#### API Installation
```bash
yarn add @0x/sol-compiler
```
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
```json
"compilerOptions": {
"typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
}
```
**Import**
```typescript
import { Compiler } from '@0x/sol-compiler';
```
or
```javascript
var Compiler = require('@0x/sol-compiler').Compiler;
```
## Contributing
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
```bash
yarn config set workspaces-experimental true
```
Then install dependencies
```bash
yarn install
```
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
PKG=@0x/sol-compiler yarn build
```
Or continuously rebuild on change:
```bash
PKG=@0x/sol-compiler yarn watch
```
### Clean
```bash
yarn clean
```
### Lint
```bash
yarn lint
```
### Run Tests
```bash
yarn test
```

View File

@@ -0,0 +1,401 @@
> # Class: Compiler
The Compiler facilitates compiling Solidity smart contracts and saves the results
to artifact files.
## Hierarchy
* **Compiler**
## Index
### Constructors
* [constructor](#constructor)
### Methods
* [compileAsync](#compileasync)
* [getCompilerOutputsAsync](#getcompileroutputsasync)
* [watchAsync](#watchasync)
## Constructors
### constructor
\+ **new Compiler**(`opts?`: `CompilerOptions`): *[Compiler](#class-compiler)*
*Defined in [compiler.ts:94](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/compiler.ts#L94)*
Instantiates a new instance of the Compiler class.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`opts?` | `CompilerOptions` | Optional compiler options |
**Returns:** *[Compiler](#class-compiler)*
An instance of the Compiler class.
## Methods
### compileAsync
▸ **compileAsync**(): *`Promise<void>`*
*Defined in [compiler.ts:132](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/compiler.ts#L132)*
Compiles selected Solidity files found in `contractsDir` and writes JSON artifacts to `artifactsDir`.
**Returns:** *`Promise<void>`*
___
### getCompilerOutputsAsync
▸ **getCompilerOutputsAsync**(): *`Promise<StandardOutput[]>`*
*Defined in [compiler.ts:145](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/compiler.ts#L145)*
Compiles Solidity files specified during instantiation, and returns the
compiler output given by solc. Return value is an array of outputs:
Solidity modules are batched together by version required, and each
element of the returned array corresponds to a compiler version, and
each element contains the output for all of the modules compiled with
that version.
**Returns:** *`Promise<StandardOutput[]>`*
___
### watchAsync
▸ **watchAsync**(): *`Promise<void>`*
*Defined in [compiler.ts:149](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/compiler.ts#L149)*
**Returns:** *`Promise<void>`*
<hr />
> # Class: CompilationError
## Hierarchy
* `Error`
* **CompilationError**
## Index
### Constructors
* [constructor](#constructor)
### Properties
* [errorsCount](#errorscount)
* [message](#message)
* [name](#name)
* [stack](#optional-stack)
* [typeName](#typename)
* [Error](#static-error)
## Constructors
### constructor
\+ **new CompilationError**(`errorsCount`: number): *[CompilationError](#class-compilationerror)*
*Defined in [utils/types.ts:39](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L39)*
**Parameters:**
Name | Type |
------ | ------ |
`errorsCount` | number |
**Returns:** *[CompilationError](#class-compilationerror)*
## Properties
### errorsCount
• **errorsCount**: *number*
*Defined in [utils/types.ts:38](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L38)*
___
### message
• **message**: *string*
*Inherited from void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/node_modules/typedoc/node_modules/typescript/lib/lib.es5.d.ts:974
___
### name
• **name**: *string*
*Inherited from void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/node_modules/typedoc/node_modules/typescript/lib/lib.es5.d.ts:973
___
### `Optional` stack
• **stack**? : *undefined | string*
*Inherited from void*
*Overrides void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/node_modules/typedoc/node_modules/typescript/lib/lib.es5.d.ts:975
___
### typeName
• **typeName**: *string* = "CompilationError"
*Defined in [utils/types.ts:39](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L39)*
___
### `Static` Error
▪ **Error**: *`ErrorConstructor`*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/node_modules/typedoc/node_modules/typescript/lib/lib.es5.d.ts:984
<hr />
> # Enumeration: AbiType
## Index
### Enumeration members
* [Constructor](#constructor)
* [Event](#event)
* [Fallback](#fallback)
* [Function](#function)
## Enumeration members
### Constructor
• **Constructor**: = "constructor"
*Defined in [utils/types.ts:3](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L3)*
___
### Event
• **Event**: = "event"
*Defined in [utils/types.ts:4](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L4)*
___
### Fallback
• **Fallback**: = "fallback"
*Defined in [utils/types.ts:5](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L5)*
___
### Function
• **Function**: = "function"
*Defined in [utils/types.ts:2](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L2)*
<hr />
> # Interface: BinaryPaths
## Hierarchy
* **BinaryPaths**
## Indexable
● \[▪ **key**: *string*\]: string
<hr />
> # Interface: ContractSourceData
## Hierarchy
* **ContractSourceData**
## Indexable
● \[▪ **contractName**: *string*\]: [ContractSpecificSourceData](#class-contractspecificsourcedata)
<hr />
> # Interface: ContractSpecificSourceData
## Hierarchy
* **ContractSpecificSourceData**
## Index
### Properties
* [solcVersionRange](#solcversionrange)
* [sourceHash](#sourcehash)
* [sourceTreeHash](#sourcetreehash)
## Properties
### solcVersionRange
• **solcVersionRange**: *string*
*Defined in [utils/types.ts:21](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L21)*
___
### sourceHash
• **sourceHash**: *`Buffer`*
*Defined in [utils/types.ts:22](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L22)*
___
### sourceTreeHash
• **sourceTreeHash**: *`Buffer`*
*Defined in [utils/types.ts:23](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L23)*
<hr />
> # Interface: SolcErrors
## Hierarchy
* **SolcErrors**
## Indexable
● \[▪ **key**: *string*\]: boolean
<hr />
> # Interface: Token
## Hierarchy
* **Token**
## Index
### Properties
* [address](#optional-address)
* [decimals](#decimals)
* [ipfsHash](#ipfshash)
* [name](#name)
* [swarmHash](#swarmhash)
* [symbol](#symbol)
## Properties
### `Optional` address
• **address**? : *undefined | string*
*Defined in [utils/types.ts:27](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L27)*
___
### decimals
• **decimals**: *number*
*Defined in [utils/types.ts:30](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L30)*
___
### ipfsHash
• **ipfsHash**: *string*
*Defined in [utils/types.ts:31](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L31)*
___
### name
• **name**: *string*
*Defined in [utils/types.ts:28](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L28)*
___
### swarmHash
• **swarmHash**: *string*
*Defined in [utils/types.ts:32](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L32)*
___
### symbol
• **symbol**: *string*
*Defined in [utils/types.ts:29](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-compiler/src/utils/types.ts#L29)*
<hr />
* [Globals](globals.md)
* [External Modules]()
* [cli](modules/_cli_.md)
* [compiler](modules/_compiler_.md)
* [compiler.Compiler](#class-compiler)
* [index](modules/_index_.md)
* [schemas/compiler_options_schema](modules/_schemas_compiler_options_schema_.md)
* [utils/compiler](modules/_utils_compiler_.md)
* [utils/constants](modules/_utils_constants_.md)
* [utils/encoder](modules/_utils_encoder_.md)
* [utils/fs_wrapper](modules/_utils_fs_wrapper_.md)
* [utils/types](modules/_utils_types_.md)
* [utils/types.AbiType](#class-abitype)
* [utils/types.CompilationError](#class-compilationerror)
* [utils/types.BinaryPaths](#class-binarypaths)
* [utils/types.ContractSourceData](#class-contractsourcedata)
* [utils/types.ContractSpecificSourceData](#class-contractspecificsourcedata)
* [utils/types.SolcErrors](#class-solcerrors)
* [utils/types.Token](#class-token)
* [utils/utils](modules/_utils_utils_.md)
* [Classes]()
* [compiler.Compiler](#class-compiler)
* [utils/types.CompilationError](#class-compilationerror)
* [Enums]()
* [utils/types.AbiType](#class-abitype)
* [Interfaces]()
* [utils/types.BinaryPaths](#class-binarypaths)
* [utils/types.ContractSourceData](#class-contractsourcedata)
* [utils/types.ContractSpecificSourceData](#class-contractspecificsourcedata)
* [utils/types.SolcErrors](#class-solcerrors)
* [utils/types.Token](#class-token)
<hr />

View File

@@ -0,0 +1,75 @@
## @0x/sol-coverage
A Solidity code coverage tool.
### Read the [Documentation](https://0xproject.com/docs/sol-coverage).
## Installation
```bash
yarn add @0x/sol-coverage
```
**Import**
```javascript
import { CoverageSubprovider } from '@0x/sol-coverage';
```
or
```javascript
var CoverageSubprovider = require('@0x/sol-coverage').CoverageSubprovider;
```
## Contributing
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
```bash
yarn config set workspaces-experimental true
```
Then install dependencies
```bash
yarn install
```
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
PKG=@0x/sol-coverage yarn build
```
Or continuously rebuild on change:
```bash
PKG=@0x/sol-coverage yarn watch
```
### Clean
```bash
yarn clean
```
### Lint
```bash
yarn lint
```
### Run Tests
```bash
yarn test
```

View File

@@ -0,0 +1,212 @@
> # Class: CoverageSubprovider
This class implements the [web3-provider-engine](https://github.com/MetaMask/provider-engine) subprovider interface.
It's used to compute your code coverage while running solidity tests.
## Hierarchy
* `TraceInfoSubprovider`
* **CoverageSubprovider**
## Index
### Constructors
* [constructor](#constructor)
### Methods
* [emitPayloadAsync](#emitpayloadasync)
* [handleRequest](#handlerequest)
* [setEngine](#setengine)
* [start](#start)
* [stop](#stop)
* [writeCoverageAsync](#writecoverageasync)
## Constructors
### constructor
\+ **new CoverageSubprovider**(`artifactAdapter`: `AbstractArtifactAdapter`, `defaultFromAddress`: string, `partialConfig`: [CoverageSubproviderPartialConfig](#class-coveragesubprovider)*
*Overrides void*
*Defined in [coverage_subprovider.ts:44](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-coverage/src/coverage_subprovider.ts#L44)*
Instantiates a CoverageSubprovider instance
**Parameters:**
Name | Type | Default | Description |
------ | ------ | ------ | ------ |
`artifactAdapter` | `AbstractArtifactAdapter` | - | Adapter for used artifacts format (0x, truffle, giveth, etc.) |
`defaultFromAddress` | string | - | default from address to use when sending transactions |
`partialConfig` | [CoverageSubproviderPartialConfig](#coveragesubproviderpartialconfig) | {} | Partial configuration object |
**Returns:** *[CoverageSubprovider](#class-coveragesubprovider)*
## Methods
### emitPayloadAsync
▸ **emitPayloadAsync**(`payload`: `Partial<JSONRPCRequestPayloadWithMethod>`): *`Promise<JSONRPCResponsePayload>`*
*Inherited from void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/subproviders/lib/src/subproviders/subprovider.d.ts:25
Emits a JSON RPC payload that will then be handled by the ProviderEngine instance
this subprovider is a part of. The payload will cascade down the subprovider middleware
stack until finding the responsible entity for handling the request.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`payload` | `Partial<JSONRPCRequestPayloadWithMethod>` | JSON RPC payload |
**Returns:** *`Promise<JSONRPCResponsePayload>`*
JSON RPC response payload
___
### handleRequest
▸ **handleRequest**(`payload`: `JSONRPCRequestPayload`, `next`: `NextCallback`, `_end`: `ErrorCallback`): *`Promise<void>`*
*Inherited from void*
*Overrides void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/sol-tracing-utils/lib/src/trace_collection_subprovider.d.ts:42
This method conforms to the web3-provider-engine interface.
It is called internally by the ProviderEngine when it is this subproviders
turn to handle a JSON RPC request.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`payload` | `JSONRPCRequestPayload` | JSON RPC payload |
`next` | `NextCallback` | Callback to call if this subprovider decides not to handle the request |
`_end` | `ErrorCallback` | Callback to call if subprovider handled the request and wants to pass back the request. |
**Returns:** *`Promise<void>`*
___
### setEngine
▸ **setEngine**(`engine`: `Web3ProviderEngine`): *void*
*Inherited from void*
*Overrides void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/sol-tracing-utils/lib/src/trace_collection_subprovider.d.ts:49
Set's the subprovider's engine to the ProviderEngine it is added to.
This is only called within the ProviderEngine source code, do not call
directly.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`engine` | `Web3ProviderEngine` | The ProviderEngine this subprovider is added to |
**Returns:** *void*
___
### start
▸ **start**(): *void*
*Inherited from void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/sol-tracing-utils/lib/src/trace_collection_subprovider.d.ts:29
Starts trace collection
**Returns:** *void*
___
### stop
▸ **stop**(): *void*
*Inherited from void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/sol-tracing-utils/lib/src/trace_collection_subprovider.d.ts:33
Stops trace collection
**Returns:** *void*
___
### writeCoverageAsync
▸ **writeCoverageAsync**(): *`Promise<void>`*
*Defined in [coverage_subprovider.ts:78](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-coverage/src/coverage_subprovider.ts#L78)*
Write the test coverage results to a file in Istanbul format.
**Returns:** *`Promise<void>`*
<hr />
> # Interface: CoverageSubproviderConfig
This type defines the schema of the config object that could be passed to CoverageSubprovider
isVerbose: If true - will log any unknown transactions. Defaults to true.
ignoreFilesGlobs: The list of globs matching the file names of the files we want to ignore coverage for. Defaults to [].
## Hierarchy
* **CoverageSubproviderConfig**
## Index
### Properties
* [ignoreFilesGlobs](#ignorefilesglobs)
* [isVerbose](#isverbose)
## Properties
### ignoreFilesGlobs
• **ignoreFilesGlobs**: *string[]*
*Defined in [coverage_subprovider.ts:28](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-coverage/src/coverage_subprovider.ts#L28)*
___
### isVerbose
• **isVerbose**: *boolean*
*Defined in [coverage_subprovider.ts:27](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-coverage/src/coverage_subprovider.ts#L27)*
<hr />
* [Globals](globals.md)
* [External Modules]()
* [coverage_subprovider](modules/_coverage_subprovider_.md)
* [coverage_subprovider.CoverageSubprovider](#class-coveragesubprovider)
* [coverage_subprovider.CoverageSubproviderConfig](#class-coveragesubproviderconfig)
* [index](modules/_index_.md)
* [Classes]()
* [coverage_subprovider.CoverageSubprovider](#class-coveragesubprovider)
* [Interfaces]()
* [coverage_subprovider.CoverageSubproviderConfig](#class-coveragesubproviderconfig)
<hr />

View File

@@ -0,0 +1,75 @@
## @0x/sol-coverage
A Solidity code coverage tool.
### Read the [Documentation](https://0xproject.com/docs/sol-coverage).
## Installation
```bash
yarn add @0x/sol-coverage
```
**Import**
```javascript
import { CoverageSubprovider } from '@0x/sol-coverage';
```
or
```javascript
var CoverageSubprovider = require('@0x/sol-coverage').CoverageSubprovider;
```
## Contributing
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
```bash
yarn config set workspaces-experimental true
```
Then install dependencies
```bash
yarn install
```
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
PKG=@0x/sol-coverage yarn build
```
Or continuously rebuild on change:
```bash
PKG=@0x/sol-coverage yarn watch
```
### Clean
```bash
yarn clean
```
### Lint
```bash
yarn lint
```
### Run Tests
```bash
yarn test
```

View File

@@ -0,0 +1,212 @@
> # Class: CoverageSubprovider
This class implements the [web3-provider-engine](https://github.com/MetaMask/provider-engine) subprovider interface.
It's used to compute your code coverage while running solidity tests.
## Hierarchy
* `TraceInfoSubprovider`
* **CoverageSubprovider**
## Index
### Constructors
* [constructor](#constructor)
### Methods
* [emitPayloadAsync](#emitpayloadasync)
* [handleRequest](#handlerequest)
* [setEngine](#setengine)
* [start](#start)
* [stop](#stop)
* [writeCoverageAsync](#writecoverageasync)
## Constructors
### constructor
\+ **new CoverageSubprovider**(`artifactAdapter`: `AbstractArtifactAdapter`, `defaultFromAddress`: string, `partialConfig`: [CoverageSubproviderPartialConfig](#class-coveragesubprovider)*
*Overrides void*
*Defined in [coverage_subprovider.ts:44](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-coverage/src/coverage_subprovider.ts#L44)*
Instantiates a CoverageSubprovider instance
**Parameters:**
Name | Type | Default | Description |
------ | ------ | ------ | ------ |
`artifactAdapter` | `AbstractArtifactAdapter` | - | Adapter for used artifacts format (0x, truffle, giveth, etc.) |
`defaultFromAddress` | string | - | default from address to use when sending transactions |
`partialConfig` | [CoverageSubproviderPartialConfig](#coveragesubproviderpartialconfig) | {} | Partial configuration object |
**Returns:** *[CoverageSubprovider](#class-coveragesubprovider)*
## Methods
### emitPayloadAsync
▸ **emitPayloadAsync**(`payload`: `Partial<JSONRPCRequestPayloadWithMethod>`): *`Promise<JSONRPCResponsePayload>`*
*Inherited from void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/subproviders/lib/src/subproviders/subprovider.d.ts:25
Emits a JSON RPC payload that will then be handled by the ProviderEngine instance
this subprovider is a part of. The payload will cascade down the subprovider middleware
stack until finding the responsible entity for handling the request.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`payload` | `Partial<JSONRPCRequestPayloadWithMethod>` | JSON RPC payload |
**Returns:** *`Promise<JSONRPCResponsePayload>`*
JSON RPC response payload
___
### handleRequest
▸ **handleRequest**(`payload`: `JSONRPCRequestPayload`, `next`: `NextCallback`, `_end`: `ErrorCallback`): *`Promise<void>`*
*Inherited from void*
*Overrides void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/sol-tracing-utils/lib/src/trace_collection_subprovider.d.ts:42
This method conforms to the web3-provider-engine interface.
It is called internally by the ProviderEngine when it is this subproviders
turn to handle a JSON RPC request.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`payload` | `JSONRPCRequestPayload` | JSON RPC payload |
`next` | `NextCallback` | Callback to call if this subprovider decides not to handle the request |
`_end` | `ErrorCallback` | Callback to call if subprovider handled the request and wants to pass back the request. |
**Returns:** *`Promise<void>`*
___
### setEngine
▸ **setEngine**(`engine`: `Web3ProviderEngine`): *void*
*Inherited from void*
*Overrides void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/sol-tracing-utils/lib/src/trace_collection_subprovider.d.ts:49
Set's the subprovider's engine to the ProviderEngine it is added to.
This is only called within the ProviderEngine source code, do not call
directly.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`engine` | `Web3ProviderEngine` | The ProviderEngine this subprovider is added to |
**Returns:** *void*
___
### start
▸ **start**(): *void*
*Inherited from void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/sol-tracing-utils/lib/src/trace_collection_subprovider.d.ts:29
Starts trace collection
**Returns:** *void*
___
### stop
▸ **stop**(): *void*
*Inherited from void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/sol-tracing-utils/lib/src/trace_collection_subprovider.d.ts:33
Stops trace collection
**Returns:** *void*
___
### writeCoverageAsync
▸ **writeCoverageAsync**(): *`Promise<void>`*
*Defined in [coverage_subprovider.ts:78](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-coverage/src/coverage_subprovider.ts#L78)*
Write the test coverage results to a file in Istanbul format.
**Returns:** *`Promise<void>`*
<hr />
> # Interface: CoverageSubproviderConfig
This type defines the schema of the config object that could be passed to CoverageSubprovider
isVerbose: If true - will log any unknown transactions. Defaults to true.
ignoreFilesGlobs: The list of globs matching the file names of the files we want to ignore coverage for. Defaults to [].
## Hierarchy
* **CoverageSubproviderConfig**
## Index
### Properties
* [ignoreFilesGlobs](#ignorefilesglobs)
* [isVerbose](#isverbose)
## Properties
### ignoreFilesGlobs
• **ignoreFilesGlobs**: *string[]*
*Defined in [coverage_subprovider.ts:28](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-coverage/src/coverage_subprovider.ts#L28)*
___
### isVerbose
• **isVerbose**: *boolean*
*Defined in [coverage_subprovider.ts:27](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-coverage/src/coverage_subprovider.ts#L27)*
<hr />
* [Globals](globals.md)
* [External Modules]()
* [coverage_subprovider](modules/_coverage_subprovider_.md)
* [coverage_subprovider.CoverageSubprovider](#class-coveragesubprovider)
* [coverage_subprovider.CoverageSubproviderConfig](#class-coveragesubproviderconfig)
* [index](modules/_index_.md)
* [Classes]()
* [coverage_subprovider.CoverageSubprovider](#class-coveragesubprovider)
* [Interfaces]()
* [coverage_subprovider.CoverageSubproviderConfig](#class-coveragesubproviderconfig)
<hr />

View File

@@ -0,0 +1,75 @@
## @0x/sol-profiler
Solidity line-by-line gas profiler.
### Read the [Documentation](https://0xproject.com/docs/sol-profiler).
## Installation
```bash
yarn add @0x/sol-profiler
```
**Import**
```javascript
import { ProfilerSubprovider } from '@0x/sol-profiler';
```
or
```javascript
var ProfilerSubprovider = require('@0x/sol-profiler').ProfilerSubprovider;
```
## Contributing
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
```bash
yarn config set workspaces-experimental true
```
Then install dependencies
```bash
yarn install
```
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
PKG=@0x/sol-profiler yarn build
```
Or continuously rebuild on change:
```bash
PKG=@0x/sol-profiler yarn watch
```
### Clean
```bash
yarn clean
```
### Lint
```bash
yarn lint
```
### Run Tests
```bash
yarn test
```

View File

@@ -0,0 +1,175 @@
> # Class: ProfilerSubprovider
This class implements the [web3-provider-engine](https://github.com/MetaMask/provider-engine) subprovider interface.
ProfilerSubprovider is used to profile Solidity code while running tests.
## Hierarchy
* `TraceInfoSubprovider`
* **ProfilerSubprovider**
## Index
### Constructors
* [constructor](#constructor)
### Methods
* [emitPayloadAsync](#emitpayloadasync)
* [handleRequest](#handlerequest)
* [setEngine](#setengine)
* [start](#start)
* [stop](#stop)
* [writeProfilerOutputAsync](#writeprofileroutputasync)
## Constructors
### constructor
\+ **new ProfilerSubprovider**(`artifactAdapter`: `AbstractArtifactAdapter`, `defaultFromAddress`: string, `isVerbose`: boolean): *[ProfilerSubprovider](#class-profilersubprovider)*
*Overrides void*
*Defined in [profiler_subprovider.ts:30](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-profiler/src/profiler_subprovider.ts#L30)*
Instantiates a ProfilerSubprovider instance
**Parameters:**
Name | Type | Default | Description |
------ | ------ | ------ | ------ |
`artifactAdapter` | `AbstractArtifactAdapter` | - | Adapter for used artifacts format (0x, truffle, giveth, etc.) |
`defaultFromAddress` | string | - | default from address to use when sending transactions |
`isVerbose` | boolean | true | If true, we will log any unknown transactions. Otherwise we will ignore them |
**Returns:** *[ProfilerSubprovider](#class-profilersubprovider)*
## Methods
### emitPayloadAsync
▸ **emitPayloadAsync**(`payload`: `Partial<JSONRPCRequestPayloadWithMethod>`): *`Promise<JSONRPCResponsePayload>`*
*Inherited from void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/subproviders/lib/src/subproviders/subprovider.d.ts:25
Emits a JSON RPC payload that will then be handled by the ProviderEngine instance
this subprovider is a part of. The payload will cascade down the subprovider middleware
stack until finding the responsible entity for handling the request.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`payload` | `Partial<JSONRPCRequestPayloadWithMethod>` | JSON RPC payload |
**Returns:** *`Promise<JSONRPCResponsePayload>`*
JSON RPC response payload
___
### handleRequest
▸ **handleRequest**(`payload`: `JSONRPCRequestPayload`, `next`: `NextCallback`, `_end`: `ErrorCallback`): *`Promise<void>`*
*Inherited from void*
*Overrides void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/sol-tracing-utils/lib/src/trace_collection_subprovider.d.ts:42
This method conforms to the web3-provider-engine interface.
It is called internally by the ProviderEngine when it is this subproviders
turn to handle a JSON RPC request.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`payload` | `JSONRPCRequestPayload` | JSON RPC payload |
`next` | `NextCallback` | Callback to call if this subprovider decides not to handle the request |
`_end` | `ErrorCallback` | Callback to call if subprovider handled the request and wants to pass back the request. |
**Returns:** *`Promise<void>`*
___
### setEngine
▸ **setEngine**(`engine`: `Web3ProviderEngine`): *void*
*Inherited from void*
*Overrides void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/sol-tracing-utils/lib/src/trace_collection_subprovider.d.ts:49
Set's the subprovider's engine to the ProviderEngine it is added to.
This is only called within the ProviderEngine source code, do not call
directly.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`engine` | `Web3ProviderEngine` | The ProviderEngine this subprovider is added to |
**Returns:** *void*
___
### start
▸ **start**(): *void*
*Inherited from void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/sol-tracing-utils/lib/src/trace_collection_subprovider.d.ts:29
Starts trace collection
**Returns:** *void*
___
### stop
▸ **stop**(): *void*
*Inherited from void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/sol-tracing-utils/lib/src/trace_collection_subprovider.d.ts:33
Stops trace collection
**Returns:** *void*
___
### writeProfilerOutputAsync
▸ **writeProfilerOutputAsync**(): *`Promise<void>`*
*Defined in [profiler_subprovider.ts:104](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-profiler/src/profiler_subprovider.ts#L104)*
Write the test profiler results to a file in Istanbul format.
**Returns:** *`Promise<void>`*
<hr />
* [Globals](globals.md)
* [External Modules]()
* [cost_utils](modules/_cost_utils_.md)
* [index](modules/_index_.md)
* [profiler_subprovider](modules/_profiler_subprovider_.md)
* [profiler_subprovider.ProfilerSubprovider](#class-profilersubprovider)
* [Classes]()
* [profiler_subprovider.ProfilerSubprovider](#class-profilersubprovider)
<hr />

View File

@@ -0,0 +1,75 @@
## @0x/sol-profiler
Solidity line-by-line gas profiler.
### Read the [Documentation](https://0xproject.com/docs/sol-profiler).
## Installation
```bash
yarn add @0x/sol-profiler
```
**Import**
```javascript
import { ProfilerSubprovider } from '@0x/sol-profiler';
```
or
```javascript
var ProfilerSubprovider = require('@0x/sol-profiler').ProfilerSubprovider;
```
## Contributing
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
```bash
yarn config set workspaces-experimental true
```
Then install dependencies
```bash
yarn install
```
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
PKG=@0x/sol-profiler yarn build
```
Or continuously rebuild on change:
```bash
PKG=@0x/sol-profiler yarn watch
```
### Clean
```bash
yarn clean
```
### Lint
```bash
yarn lint
```
### Run Tests
```bash
yarn test
```

View File

@@ -0,0 +1,175 @@
> # Class: ProfilerSubprovider
This class implements the [web3-provider-engine](https://github.com/MetaMask/provider-engine) subprovider interface.
ProfilerSubprovider is used to profile Solidity code while running tests.
## Hierarchy
* `TraceInfoSubprovider`
* **ProfilerSubprovider**
## Index
### Constructors
* [constructor](#constructor)
### Methods
* [emitPayloadAsync](#emitpayloadasync)
* [handleRequest](#handlerequest)
* [setEngine](#setengine)
* [start](#start)
* [stop](#stop)
* [writeProfilerOutputAsync](#writeprofileroutputasync)
## Constructors
### constructor
\+ **new ProfilerSubprovider**(`artifactAdapter`: `AbstractArtifactAdapter`, `defaultFromAddress`: string, `isVerbose`: boolean): *[ProfilerSubprovider](#class-profilersubprovider)*
*Overrides void*
*Defined in [profiler_subprovider.ts:30](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-profiler/src/profiler_subprovider.ts#L30)*
Instantiates a ProfilerSubprovider instance
**Parameters:**
Name | Type | Default | Description |
------ | ------ | ------ | ------ |
`artifactAdapter` | `AbstractArtifactAdapter` | - | Adapter for used artifacts format (0x, truffle, giveth, etc.) |
`defaultFromAddress` | string | - | default from address to use when sending transactions |
`isVerbose` | boolean | true | If true, we will log any unknown transactions. Otherwise we will ignore them |
**Returns:** *[ProfilerSubprovider](#class-profilersubprovider)*
## Methods
### emitPayloadAsync
▸ **emitPayloadAsync**(`payload`: `Partial<JSONRPCRequestPayloadWithMethod>`): *`Promise<JSONRPCResponsePayload>`*
*Inherited from void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/subproviders/lib/src/subproviders/subprovider.d.ts:25
Emits a JSON RPC payload that will then be handled by the ProviderEngine instance
this subprovider is a part of. The payload will cascade down the subprovider middleware
stack until finding the responsible entity for handling the request.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`payload` | `Partial<JSONRPCRequestPayloadWithMethod>` | JSON RPC payload |
**Returns:** *`Promise<JSONRPCResponsePayload>`*
JSON RPC response payload
___
### handleRequest
▸ **handleRequest**(`payload`: `JSONRPCRequestPayload`, `next`: `NextCallback`, `_end`: `ErrorCallback`): *`Promise<void>`*
*Inherited from void*
*Overrides void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/sol-tracing-utils/lib/src/trace_collection_subprovider.d.ts:42
This method conforms to the web3-provider-engine interface.
It is called internally by the ProviderEngine when it is this subproviders
turn to handle a JSON RPC request.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`payload` | `JSONRPCRequestPayload` | JSON RPC payload |
`next` | `NextCallback` | Callback to call if this subprovider decides not to handle the request |
`_end` | `ErrorCallback` | Callback to call if subprovider handled the request and wants to pass back the request. |
**Returns:** *`Promise<void>`*
___
### setEngine
▸ **setEngine**(`engine`: `Web3ProviderEngine`): *void*
*Inherited from void*
*Overrides void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/sol-tracing-utils/lib/src/trace_collection_subprovider.d.ts:49
Set's the subprovider's engine to the ProviderEngine it is added to.
This is only called within the ProviderEngine source code, do not call
directly.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`engine` | `Web3ProviderEngine` | The ProviderEngine this subprovider is added to |
**Returns:** *void*
___
### start
▸ **start**(): *void*
*Inherited from void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/sol-tracing-utils/lib/src/trace_collection_subprovider.d.ts:29
Starts trace collection
**Returns:** *void*
___
### stop
▸ **stop**(): *void*
*Inherited from void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/sol-tracing-utils/lib/src/trace_collection_subprovider.d.ts:33
Stops trace collection
**Returns:** *void*
___
### writeProfilerOutputAsync
▸ **writeProfilerOutputAsync**(): *`Promise<void>`*
*Defined in [profiler_subprovider.ts:104](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-profiler/src/profiler_subprovider.ts#L104)*
Write the test profiler results to a file in Istanbul format.
**Returns:** *`Promise<void>`*
<hr />
* [Globals](globals.md)
* [External Modules]()
* [cost_utils](modules/_cost_utils_.md)
* [index](modules/_index_.md)
* [profiler_subprovider](modules/_profiler_subprovider_.md)
* [profiler_subprovider.ProfilerSubprovider](#class-profilersubprovider)
* [Classes]()
* [profiler_subprovider.ProfilerSubprovider](#class-profilersubprovider)
<hr />

View File

@@ -0,0 +1,75 @@
## @0x/sol-trace
Prints a stack trace when a revert is encountered.
### Read the [Documentation](https://0xproject.com/docs/sol-trace).
## Installation
```bash
yarn add @0x/sol-trace
```
**Import**
```javascript
import { RevertTraceSubprovider } from '@0x/sol-trace';
```
or
```javascript
var RevertTraceSubprovider = require('@0x/sol-trace').RevertTraceSubprovider;
```
## Contributing
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
```bash
yarn config set workspaces-experimental true
```
Then install dependencies
```bash
yarn install
```
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
PKG=@0x/sol-trace yarn build
```
Or continuously rebuild on change:
```bash
PKG=@0x/sol-trace yarn watch
```
### Clean
```bash
yarn clean
```
### Lint
```bash
yarn lint
```
### Run Tests
```bash
yarn test
```

View File

@@ -0,0 +1,161 @@
> # Class: RevertTraceSubprovider
This class implements the [web3-provider-engine](https://github.com/MetaMask/provider-engine) subprovider interface.
It is used to report call stack traces whenever a revert occurs.
## Hierarchy
* `TraceCollectionSubprovider`
* **RevertTraceSubprovider**
## Index
### Constructors
* [constructor](#constructor)
### Methods
* [emitPayloadAsync](#emitpayloadasync)
* [handleRequest](#handlerequest)
* [setEngine](#setengine)
* [start](#start)
* [stop](#stop)
## Constructors
### constructor
\+ **new RevertTraceSubprovider**(`artifactAdapter`: `AbstractArtifactAdapter`, `defaultFromAddress`: string, `isVerbose`: boolean): *[RevertTraceSubprovider](#class-reverttracesubprovider)*
*Overrides void*
*Defined in [revert_trace_subprovider.ts:27](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-trace/src/revert_trace_subprovider.ts#L27)*
Instantiates a RevertTraceSubprovider instance
**Parameters:**
Name | Type | Default | Description |
------ | ------ | ------ | ------ |
`artifactAdapter` | `AbstractArtifactAdapter` | - | Adapter for used artifacts format (0x, truffle, giveth, etc.) |
`defaultFromAddress` | string | - | default from address to use when sending transactions |
`isVerbose` | boolean | true | If true, we will log any unknown transactions. Otherwise we will ignore them |
**Returns:** *[RevertTraceSubprovider](#class-reverttracesubprovider)*
## Methods
### emitPayloadAsync
▸ **emitPayloadAsync**(`payload`: `Partial<JSONRPCRequestPayloadWithMethod>`): *`Promise<JSONRPCResponsePayload>`*
*Inherited from void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/subproviders/lib/src/subproviders/subprovider.d.ts:25
Emits a JSON RPC payload that will then be handled by the ProviderEngine instance
this subprovider is a part of. The payload will cascade down the subprovider middleware
stack until finding the responsible entity for handling the request.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`payload` | `Partial<JSONRPCRequestPayloadWithMethod>` | JSON RPC payload |
**Returns:** *`Promise<JSONRPCResponsePayload>`*
JSON RPC response payload
___
### handleRequest
▸ **handleRequest**(`payload`: `JSONRPCRequestPayload`, `next`: `NextCallback`, `_end`: `ErrorCallback`): *`Promise<void>`*
*Inherited from void*
*Overrides void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/sol-tracing-utils/lib/src/trace_collection_subprovider.d.ts:42
This method conforms to the web3-provider-engine interface.
It is called internally by the ProviderEngine when it is this subproviders
turn to handle a JSON RPC request.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`payload` | `JSONRPCRequestPayload` | JSON RPC payload |
`next` | `NextCallback` | Callback to call if this subprovider decides not to handle the request |
`_end` | `ErrorCallback` | Callback to call if subprovider handled the request and wants to pass back the request. |
**Returns:** *`Promise<void>`*
___
### setEngine
▸ **setEngine**(`engine`: `Web3ProviderEngine`): *void*
*Inherited from void*
*Overrides void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/sol-tracing-utils/lib/src/trace_collection_subprovider.d.ts:49
Set's the subprovider's engine to the ProviderEngine it is added to.
This is only called within the ProviderEngine source code, do not call
directly.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`engine` | `Web3ProviderEngine` | The ProviderEngine this subprovider is added to |
**Returns:** *void*
___
### start
▸ **start**(): *void*
*Inherited from void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/sol-tracing-utils/lib/src/trace_collection_subprovider.d.ts:29
Starts trace collection
**Returns:** *void*
___
### stop
▸ **stop**(): *void*
*Inherited from void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/sol-tracing-utils/lib/src/trace_collection_subprovider.d.ts:33
Stops trace collection
**Returns:** *void*
<hr />
* [Globals](globals.md)
* [External Modules]()
* [index](modules/_index_.md)
* [revert_trace_subprovider](modules/_revert_trace_subprovider_.md)
* [revert_trace_subprovider.RevertTraceSubprovider](#class-reverttracesubprovider)
* [Classes]()
* [revert_trace_subprovider.RevertTraceSubprovider](#class-reverttracesubprovider)
<hr />

View File

@@ -0,0 +1,75 @@
## @0x/sol-trace
Prints a stack trace when a revert is encountered.
### Read the [Documentation](https://0xproject.com/docs/sol-trace).
## Installation
```bash
yarn add @0x/sol-trace
```
**Import**
```javascript
import { RevertTraceSubprovider } from '@0x/sol-trace';
```
or
```javascript
var RevertTraceSubprovider = require('@0x/sol-trace').RevertTraceSubprovider;
```
## Contributing
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
```bash
yarn config set workspaces-experimental true
```
Then install dependencies
```bash
yarn install
```
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
PKG=@0x/sol-trace yarn build
```
Or continuously rebuild on change:
```bash
PKG=@0x/sol-trace yarn watch
```
### Clean
```bash
yarn clean
```
### Lint
```bash
yarn lint
```
### Run Tests
```bash
yarn test
```

View File

@@ -0,0 +1,161 @@
> # Class: RevertTraceSubprovider
This class implements the [web3-provider-engine](https://github.com/MetaMask/provider-engine) subprovider interface.
It is used to report call stack traces whenever a revert occurs.
## Hierarchy
* `TraceCollectionSubprovider`
* **RevertTraceSubprovider**
## Index
### Constructors
* [constructor](#constructor)
### Methods
* [emitPayloadAsync](#emitpayloadasync)
* [handleRequest](#handlerequest)
* [setEngine](#setengine)
* [start](#start)
* [stop](#stop)
## Constructors
### constructor
\+ **new RevertTraceSubprovider**(`artifactAdapter`: `AbstractArtifactAdapter`, `defaultFromAddress`: string, `isVerbose`: boolean): *[RevertTraceSubprovider](#class-reverttracesubprovider)*
*Overrides void*
*Defined in [revert_trace_subprovider.ts:27](https://github.com/0xProject/0x-monorepo/blob/6dd77d5c8/packages/sol-trace/src/revert_trace_subprovider.ts#L27)*
Instantiates a RevertTraceSubprovider instance
**Parameters:**
Name | Type | Default | Description |
------ | ------ | ------ | ------ |
`artifactAdapter` | `AbstractArtifactAdapter` | - | Adapter for used artifacts format (0x, truffle, giveth, etc.) |
`defaultFromAddress` | string | - | default from address to use when sending transactions |
`isVerbose` | boolean | true | If true, we will log any unknown transactions. Otherwise we will ignore them |
**Returns:** *[RevertTraceSubprovider](#class-reverttracesubprovider)*
## Methods
### emitPayloadAsync
▸ **emitPayloadAsync**(`payload`: `Partial<JSONRPCRequestPayloadWithMethod>`): *`Promise<JSONRPCResponsePayload>`*
*Inherited from void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/subproviders/lib/src/subproviders/subprovider.d.ts:25
Emits a JSON RPC payload that will then be handled by the ProviderEngine instance
this subprovider is a part of. The payload will cascade down the subprovider middleware
stack until finding the responsible entity for handling the request.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`payload` | `Partial<JSONRPCRequestPayloadWithMethod>` | JSON RPC payload |
**Returns:** *`Promise<JSONRPCResponsePayload>`*
JSON RPC response payload
___
### handleRequest
▸ **handleRequest**(`payload`: `JSONRPCRequestPayload`, `next`: `NextCallback`, `_end`: `ErrorCallback`): *`Promise<void>`*
*Inherited from void*
*Overrides void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/sol-tracing-utils/lib/src/trace_collection_subprovider.d.ts:42
This method conforms to the web3-provider-engine interface.
It is called internally by the ProviderEngine when it is this subproviders
turn to handle a JSON RPC request.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`payload` | `JSONRPCRequestPayload` | JSON RPC payload |
`next` | `NextCallback` | Callback to call if this subprovider decides not to handle the request |
`_end` | `ErrorCallback` | Callback to call if subprovider handled the request and wants to pass back the request. |
**Returns:** *`Promise<void>`*
___
### setEngine
▸ **setEngine**(`engine`: `Web3ProviderEngine`): *void*
*Inherited from void*
*Overrides void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/sol-tracing-utils/lib/src/trace_collection_subprovider.d.ts:49
Set's the subprovider's engine to the ProviderEngine it is added to.
This is only called within the ProviderEngine source code, do not call
directly.
**Parameters:**
Name | Type | Description |
------ | ------ | ------ |
`engine` | `Web3ProviderEngine` | The ProviderEngine this subprovider is added to |
**Returns:** *void*
___
### start
▸ **start**(): *void*
*Inherited from void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/sol-tracing-utils/lib/src/trace_collection_subprovider.d.ts:29
Starts trace collection
**Returns:** *void*
___
### stop
▸ **stop**(): *void*
*Inherited from void*
Defined in /Users/rickmorty/Documents/projects/0x/0x-monorepo/packages/sol-tracing-utils/lib/src/trace_collection_subprovider.d.ts:33
Stops trace collection
**Returns:** *void*
<hr />
* [Globals](globals.md)
* [External Modules]()
* [index](modules/_index_.md)
* [revert_trace_subprovider](modules/_revert_trace_subprovider_.md)
* [revert_trace_subprovider.RevertTraceSubprovider](#class-reverttracesubprovider)
* [Classes]()
* [revert_trace_subprovider.RevertTraceSubprovider](#class-reverttracesubprovider)
<hr />

View File

@@ -0,0 +1,100 @@
## @0x/subproviders
A few useful web3 subproviders including a LedgerSubprovider useful for adding Ledger Nano S support.
We have written up a [Wiki](https://0xproject.com/wiki#Web3-Provider-Examples) article detailing some use cases of this subprovider package.
### Read the [Documentation](https://0xproject.com/docs/subproviders).
## Installation
```
yarn add @0x/subproviders
```
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
```json
"compilerOptions": {
"typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
}
```
## Contributing
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
```bash
yarn config set workspaces-experimental true
```
Then install dependencies
```bash
yarn install
```
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
PKG=@0x/subproviders yarn build
```
Or continuously rebuild on change:
```bash
PKG=@0x/subproviders yarn watch
```
### Clean
```bash
yarn clean
```
### Lint
```bash
yarn lint
```
### Run tests
#### Unit tests
```bash
yarn run test:unit
```
#### Integration tests
In order to run the integration tests, make sure you have a Ledger Nano S available.
- Setup your Ledger with the development mnemonic seed: `concert load couple harbor equip island argue ramp clarify fence smart topic`
- Plug it into your computer
- Unlock the device
- Open the on-device Ethereum app
- Make sure "browser support" and "contract data" are disabled
- Start [TestRPC](https://github.com/trufflesuite/ganache-cli) locally at port `8545`
Then run:
```
yarn test:integration
```
**Note:** We assume a derivation path of `m/44'/60'/0'/0` which is already configured in the tests. With this setup and derivation path, your first account should be `0x5409ed021d9299bf6814279a6a1411a7e866a631`, exactly like TestRPC.
#### All tests
```bash
yarn run test:all
```

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,100 @@
## @0x/subproviders
A few useful web3 subproviders including a LedgerSubprovider useful for adding Ledger Nano S support.
We have written up a [Wiki](https://0xproject.com/wiki#Web3-Provider-Examples) article detailing some use cases of this subprovider package.
### Read the [Documentation](https://0xproject.com/docs/subproviders).
## Installation
```
yarn add @0x/subproviders
```
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
```json
"compilerOptions": {
"typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
}
```
## Contributing
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
```bash
yarn config set workspaces-experimental true
```
Then install dependencies
```bash
yarn install
```
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
PKG=@0x/subproviders yarn build
```
Or continuously rebuild on change:
```bash
PKG=@0x/subproviders yarn watch
```
### Clean
```bash
yarn clean
```
### Lint
```bash
yarn lint
```
### Run tests
#### Unit tests
```bash
yarn run test:unit
```
#### Integration tests
In order to run the integration tests, make sure you have a Ledger Nano S available.
- Setup your Ledger with the development mnemonic seed: `concert load couple harbor equip island argue ramp clarify fence smart topic`
- Plug it into your computer
- Unlock the device
- Open the on-device Ethereum app
- Make sure "browser support" and "contract data" are disabled
- Start [TestRPC](https://github.com/trufflesuite/ganache-cli) locally at port `8545`
Then run:
```
yarn test:integration
```
**Note:** We assume a derivation path of `m/44'/60'/0'/0` which is already configured in the tests. With this setup and derivation path, your first account should be `0x5409ed021d9299bf6814279a6a1411a7e866a631`, exactly like TestRPC.
#### All tests
```bash
yarn run test:all
```

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,71 @@
## @0x/web3-wrapper
Web3-wrapper is a JSON-RPC client for Ethereum nodes. It is a type-safe alternative to [Web3.js](https://github.com/ethereum/web3.js/) written in TypeScript.
### Read the [Documentation](https://0xproject.com/docs/web3-wrapper).
## Installation
```bash
yarn add @0x/web3-wrapper
```
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
```json
"compilerOptions": {
"typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
}
```
## Contributing
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
```bash
yarn config set workspaces-experimental true
```
Then install dependencies
```bash
yarn install
```
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
PKG=@0x/web3-wrapper yarn build
```
Or continuously rebuild on change:
```bash
PKG=@0x/web3-wrapper yarn watch
```
### Clean
```bash
yarn clean
```
### Lint
```bash
yarn lint
```
### Run Tests
```bash
yarn test
```

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,71 @@
## @0x/web3-wrapper
Web3-wrapper is a JSON-RPC client for Ethereum nodes. It is a type-safe alternative to [Web3.js](https://github.com/ethereum/web3.js/) written in TypeScript.
### Read the [Documentation](https://0xproject.com/docs/web3-wrapper).
## Installation
```bash
yarn add @0x/web3-wrapper
```
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
```json
"compilerOptions": {
"typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
}
```
## Contributing
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
```bash
yarn config set workspaces-experimental true
```
Then install dependencies
```bash
yarn install
```
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
PKG=@0x/web3-wrapper yarn build
```
Or continuously rebuild on change:
```bash
PKG=@0x/web3-wrapper yarn watch
```
### Clean
```bash
yarn clean
```
### Lint
```bash
yarn lint
```
### Run Tests
```bash
yarn test
```

File diff suppressed because it is too large Load Diff

View File

@@ -22,6 +22,9 @@ export async function indexFilesAsync(indexName: string): Promise<void> {
const files = getFiles(indexName); // Get file objects processed to get their meta information (name, path, versions, etc.)
for (const file of files) {
if (meta[file.name] === undefined) {
continue; // ignore
}
updateMetaFile(file); // Update the meta file shared between algolia and the page rendering the mdx content on the client
await processMdxAsync(indexName, file);
}

View File

@@ -67,28 +67,201 @@
"difficulty": "Intermediate",
"path": "guides/use-networked-liquidity.mdx"
},
"asset-buyer": {
"title": "Asset buyer",
"description": "",
"topics": ["Mesh"],
"difficulty": "Intermediate",
"isCommunity": true,
"0x-js": {
"title": "0x.js",
"description": "The typescript package for interacting with 0x protocol. Includes smart contract wrappers, utilities for manipulating orders and much more.",
"difficulty": "Beginner",
"topics": [],
"isCommunity": false,
"isFeatured": true,
"tags": ["Relayer"],
"type": "Docker images",
"tags": ["Trader", "Relayer", "Protocol Developer"],
"type": "Typescript Libraries"
},
"asset-swapper": {
"title": "@0x/asset-swapper",
"description": "Convenience package for discovering and performing swaps for any ERC20 Assets",
"difficulty": "Intermediate",
"topics": [],
"isCommunity": false,
"isFeatured": false,
"tags": ["Trader", "Protocol Developer"],
"type": "Typescript Libraries",
"path": "tools/@0x/asset-swapper/v1.0.1/reference.mdx",
"versions": ["v1.0.1", "v1.0.0"]
},
"connect": {
"title": "@0x/connect",
"description": "An HTTP/WS client for interacting with the Standard Relayer API",
"difficulty": "Beginner",
"topics": [],
"isCommunity": false,
"isFeatured": false,
"tags": ["Trader", "Relayer"],
"type": "Typescript Libraries",
"path": "tools/@0x/connect/v5.0.16/reference.mdx",
"versions": ["v5.0.16", "v5.0.15"]
},
"migrations": {
"title": "@0x/migrations",
"description": "Migration tool for deploying 0x smart contracts on private testnets",
"difficulty": "Advanced",
"topics": [],
"isCommunity": false,
"isFeatured": false,
"tags": ["Trader", "Relayer"],
"type": "Typescript Libraries",
"path": "tools/@0x/migrations/v4.2.0/reference.mdx",
"versions": ["v4.2.0", "v4.1.11"]
},
"subproviders": {
"title": "@0x/subproviders",
"description": "Web3 provider middlewares (e.g. LedgerSubprovider)",
"difficulty": "Intermediate",
"topics": [],
"isCommunity": false,
"isFeatured": false,
"tags": ["Relayer", "Trader"],
"type": "Typescript Libraries",
"path": "tools/@0x/subproviders/v5.0.1/reference.mdx",
"versions": ["v5.0.1", "v5.0.0"]
},
"asset-buyer": {
"title": "@0x/asset-buyer",
"description": "Convenience package for discovering and buying assets with Ether",
"difficulty": "Intermediate",
"topics": [],
"isCommunity": false,
"isFeatured": false,
"tags": ["Trader", "Protocol Developer"],
"type": "Typescript Libraries",
"path": "tools/@0x/asset-buyer/v6.1.11/reference.mdx",
"versions": ["v6.1.11", "v6.1.10"]
"versions": ["v6.1.11", "v6.1.10"],
"isHidden": true
},
"ethereum-types": {
"title": "Ethereum types",
"description": "",
"topics": ["Mesh"],
"difficulty": "Intermediate",
"isCommunity": true,
"isFeatured": true,
"tags": ["Protocol developer"],
"type": "Command-line tools",
"title": "ethereum-types",
"description": "Typescript types shared across Ethereum-related packages/libraries/tools",
"difficulty": "Beginner",
"topics": [],
"isCommunity": false,
"isFeatured": false,
"tags": [],
"type": "Typescript Libraries",
"path": "tools/ethereum-types/v2.1.4/reference.mdx",
"versions": ["v2.1.4"]
"versions": ["v2.1.4"],
"isHidden": true
},
"contract-wrappers": {
"title": "@0x/contract-wrappers",
"description": "0x smart contract wrappers",
"difficulty": "Beginner",
"topics": [],
"isCommunity": false,
"isFeatured": false,
"tags": ["Trader", "Relayer"],
"type": "Typescript Libraries",
"isHidden": true,
"path": "tools/@0x/contract-wrappers/v11.0.0/reference.mdx",
"versions": ["v11.0.0", "v10.1.0"]
},
"json-schemas": {
"title": "@0x/json-schemas",
"description": "0x-related JSON schemas",
"difficulty": "Intermediate",
"topics": [],
"isCommunity": false,
"isFeatured": false,
"tags": ["Trader", "Relayer"],
"type": "Typescript Libraries",
"isHidden": true,
"path": "tools/@0x/json-schemas/v3.1.13/reference.mdx",
"versions": ["v3.1.13", "v3.1.12"]
},
"order-utils": {
"title": "@0x/order-utils",
"description": "A set of utilities for generating, parsing, signing and validating 0x orders",
"difficulty": "Beginner",
"topics": [],
"isCommunity": false,
"isFeatured": false,
"tags": ["Trader", "Relayer"],
"type": "Typescript Libraries",
"isHidden": true,
"path": "tools/@0x/order-utils/v8.2.5/reference.mdx",
"versions": ["v8.2.5", "v8.2.4"]
},
"sol-compiler": {
"title": "@0x/sol-compiler",
"description": "A wrapper around solc-js that adds smart re-compilation, ability to compile an entire project, Solidity version specific compilation, standard input description support and much more.",
"difficulty": "Advanced",
"topics": [],
"isCommunity": false,
"isFeatured": false,
"tags": ["Protocol Developer"],
"type": "Typescript Libraries",
"isHidden": true,
"path": "tools/@0x/sol-compiler/v3.1.12/reference.mdx",
"versions": ["v3.1.12", "v3.1.11"]
},
"sol-coverage": {
"title": "@0x/sol-coverage",
"description": "A solidity test coverage tool",
"difficulty": "Advanced",
"topics": [],
"isCommunity": false,
"isFeatured": false,
"tags": ["Protocol Developer"],
"type": "Typescript Libraries",
"isHidden": true,
"path": "tools/@0x/sol-coverage/v3.0.9/reference.mdx",
"versions": ["v3.0.9", "v3.0.8"]
},
"sol-profiler": {
"title": "@0x/sol-profiler",
"description": "A solidity gas cost profiler",
"difficulty": "Advanced",
"topics": [],
"isCommunity": false,
"isFeatured": false,
"tags": ["Protocol Developer"],
"type": "Typescript Libraries",
"isHidden": true,
"path": "tools/@0x/sol-profiler/v3.1.11/reference.mdx",
"versions": ["v3.1.11", "v3.1.10"]
},
"sol-trace": {
"title": "@0x/sol-trace",
"description": "A solidity stack trace tool",
"difficulty": "Advanced",
"topics": [],
"isCommunity": false,
"isFeatured": false,
"tags": ["Protocol Developer"],
"type": "Typescript Libraries",
"isHidden": true,
"path": "tools/@0x/sol-trace/v2.0.17/reference.mdx",
"versions": ["v2.0.17", "v2.0.16"]
},
"web3-wrapper": {
"title": "@0x/web3-wrapper",
"description": "An Ethereum JSON RPC client",
"difficulty": "Intermediate",
"isCommunity": false,
"isFeatured": false,
"tags": ["Relayer", "Trader"],
"type": "Typescript Libraries",
"isHidden": true,
"path": "tools/@0x/web3-wrapper/v6.0.10/reference.mdx",
"versions": ["v6.0.10"]
},
"mesh-ts-client": {
"title": "@0x/ts-mesh-client",
"description": "A Typescript/Javascript library for interacting with the Mesh JSON-RPC API over WebSockets",
"difficulty": "Intermediate",
"isCommunity": false,
"isFeatured": true,
"tags": ["Relayer", "Trader"],
"type": "Typescript Libraries",
"path": "https://0x-org.gitbook.io/mesh/json-rpc-clients/typescript"
}
}
}