diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-10-19 06:42:33 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-10-19 06:42:33 +0800 |
commit | c87e68f833a2d8a87846d70a9d4a727b46323eea (patch) | |
tree | eb40dc12694baf607a373f427f32dbd9393ac72f /packages/website/md | |
parent | a764dfa789ba44e519371b4a1e4569db7f551fb7 (diff) | |
parent | 65d85ca5008fe0c307506b388d6ace858122f8ad (diff) | |
download | dexon-0x-contracts-c87e68f833a2d8a87846d70a9d4a727b46323eea.tar dexon-0x-contracts-c87e68f833a2d8a87846d70a9d4a727b46323eea.tar.gz dexon-0x-contracts-c87e68f833a2d8a87846d70a9d4a727b46323eea.tar.bz2 dexon-0x-contracts-c87e68f833a2d8a87846d70a9d4a727b46323eea.tar.lz dexon-0x-contracts-c87e68f833a2d8a87846d70a9d4a727b46323eea.tar.xz dexon-0x-contracts-c87e68f833a2d8a87846d70a9d4a727b46323eea.tar.zst dexon-0x-contracts-c87e68f833a2d8a87846d70a9d4a727b46323eea.zip |
Merge branch 'development' of https://github.com/0xProject/0x-monorepo into feature/instant/beta-render-et-al
Diffstat (limited to 'packages/website/md')
-rw-r--r-- | packages/website/md/docs/asset_buyer/installation.md | 6 | ||||
-rw-r--r-- | packages/website/md/docs/asset_buyer/introduction.md | 2 | ||||
-rw-r--r-- | packages/website/md/docs/connect/1/installation.md (renamed from packages/website/md/docs/connect/1.0.0/installation.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/connect/1/introduction.md (renamed from packages/website/md/docs/connect/1.0.0/introduction.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/connect/2/introduction.md (renamed from packages/website/md/docs/connect/2.0.0/introduction.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/connect/3/installation.md | 15 | ||||
-rw-r--r-- | packages/website/md/docs/contract_wrappers/1/installation.md (renamed from packages/website/md/docs/contract_wrappers/installation.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/contract_wrappers/1/introduction.md (renamed from packages/website/md/docs/contract_wrappers/introduction.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/contract_wrappers/2/installation.md | 11 | ||||
-rw-r--r-- | packages/website/md/docs/json_schemas/1/installation.md (renamed from packages/website/md/docs/json_schemas/1.0.0/installation.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/json_schemas/1/introduction.md (renamed from packages/website/md/docs/json_schemas/1.0.0/introduction.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/json_schemas/1/schemas.md (renamed from packages/website/md/docs/json_schemas/1.0.0/schemas.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/json_schemas/1/usage.md (renamed from packages/website/md/docs/json_schemas/1.0.0/usage.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/json_schemas/2/schemas.md (renamed from packages/website/md/docs/json_schemas/2.0.0/schemas.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/json_schemas/3/installation.md | 17 | ||||
-rw-r--r-- | packages/website/md/docs/json_schemas/3/introduction.md | 3 | ||||
-rw-r--r-- | packages/website/md/docs/json_schemas/3/usage.md | 14 | ||||
-rw-r--r-- | packages/website/md/docs/order_utils/1/installation.md (renamed from packages/website/md/docs/order_utils/1.0.0/installation.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/order_utils/1/introduction.md (renamed from packages/website/md/docs/order_utils/1.0.0/introduction.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/order_utils/2/installation.md | 17 | ||||
-rw-r--r-- | packages/website/md/docs/order_utils/2/introduction.md | 1 | ||||
-rw-r--r-- | packages/website/md/docs/order_watcher/1/installation.md (renamed from packages/website/md/docs/order_watcher/installation.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/order_watcher/1/introduction.md (renamed from packages/website/md/docs/order_watcher/introduction.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/order_watcher/2/installation.md | 17 | ||||
-rw-r--r-- | packages/website/md/docs/order_watcher/2/introduction.md | 1 | ||||
-rw-r--r-- | packages/website/md/docs/smart_contracts/1/introduction.md (renamed from packages/website/md/docs/smart_contracts/1.0.0/introduction.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/smart_contracts/2/introduction.md (renamed from packages/website/md/docs/smart_contracts/2.0.0/introduction.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/sol-compiler/1/installation.md (renamed from packages/website/md/docs/sol-compiler/installation.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/sol-compiler/1/introduction.md (renamed from packages/website/md/docs/sol-compiler/introduction.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/sol-compiler/1/usage.md (renamed from packages/website/md/docs/sol-compiler/usage.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/sol-compiler/2/installation.md | 23 | ||||
-rw-r--r-- | packages/website/md/docs/sol-compiler/2/usage.md | 24 | ||||
-rw-r--r-- | packages/website/md/docs/sol_cov/1/installation.md (renamed from packages/website/md/docs/sol_cov/installation.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/sol_cov/1/introduction.md (renamed from packages/website/md/docs/sol_cov/introduction.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/sol_cov/1/usage.md (renamed from packages/website/md/docs/sol_cov/usage.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/sol_cov/2/installation.md | 17 | ||||
-rw-r--r-- | packages/website/md/docs/sol_cov/2/introduction.md | 1 | ||||
-rw-r--r-- | packages/website/md/docs/sol_cov/2/usage.md | 62 | ||||
-rw-r--r-- | packages/website/md/docs/subproviders/1/installation.md (renamed from packages/website/md/docs/subproviders/installation.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/subproviders/1/introduction.md (renamed from packages/website/md/docs/subproviders/introduction.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/subproviders/1/ledger_node_hid.md (renamed from packages/website/md/docs/subproviders/ledger_node_hid.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/subproviders/2/installation.md | 15 | ||||
-rw-r--r-- | packages/website/md/docs/web3_wrapper/1/installation.md (renamed from packages/website/md/docs/web3_wrapper/installation.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/web3_wrapper/1/introduction.md (renamed from packages/website/md/docs/web3_wrapper/introduction.md) | 0 | ||||
-rw-r--r-- | packages/website/md/docs/web3_wrapper/2/installation.md | 25 |
45 files changed, 267 insertions, 4 deletions
diff --git a/packages/website/md/docs/asset_buyer/installation.md b/packages/website/md/docs/asset_buyer/installation.md index 483ee2b65..76affaa09 100644 --- a/packages/website/md/docs/asset_buyer/installation.md +++ b/packages/website/md/docs/asset_buyer/installation.md @@ -1,17 +1,17 @@ **Install** ```bash -yarn add @0xproject/asset-buyer +yarn add @0x/asset-buyer ``` **Import** ```javascript -import { AssetBuyer } from '@0xproject/asset-buyer'; +import { AssetBuyer } from '@0x/asset-buyer'; ``` or ```javascript -var AssetBuyer = require('@0xproject/asset-buyer').AssetBuyer; +var AssetBuyer = require('@0x/asset-buyer').AssetBuyer; ``` diff --git a/packages/website/md/docs/asset_buyer/introduction.md b/packages/website/md/docs/asset_buyer/introduction.md index a40d20cc9..a59539ac6 100644 --- a/packages/website/md/docs/asset_buyer/introduction.md +++ b/packages/website/md/docs/asset_buyer/introduction.md @@ -1 +1 @@ -Welcome to the [@0xproject/asset-buyer](https://github.com/0xProject/0x-monorepo/tree/development/packages/asset-buyer) documentation! AssetBuyer is a library that provides an easy way to buy any asset with ETH in one click, leveraging 0x liquidity and the [Forwarder contract](https://0xproject.com/docs/contracts#Forwarder). +Welcome to the [asset-buyer](https://github.com/0xProject/0x-monorepo/tree/development/packages/asset-buyer) documentation! AssetBuyer is a library that provides an easy way to buy any asset with ETH in one click, leveraging 0x liquidity and the [Forwarder contract](https://0xproject.com/docs/contracts#Forwarder). diff --git a/packages/website/md/docs/connect/1.0.0/installation.md b/packages/website/md/docs/connect/1/installation.md index 950bf92ca..950bf92ca 100644 --- a/packages/website/md/docs/connect/1.0.0/installation.md +++ b/packages/website/md/docs/connect/1/installation.md diff --git a/packages/website/md/docs/connect/1.0.0/introduction.md b/packages/website/md/docs/connect/1/introduction.md index 4e3039442..4e3039442 100644 --- a/packages/website/md/docs/connect/1.0.0/introduction.md +++ b/packages/website/md/docs/connect/1/introduction.md diff --git a/packages/website/md/docs/connect/2.0.0/introduction.md b/packages/website/md/docs/connect/2/introduction.md index 8e251b327..8e251b327 100644 --- a/packages/website/md/docs/connect/2.0.0/introduction.md +++ b/packages/website/md/docs/connect/2/introduction.md diff --git a/packages/website/md/docs/connect/3/installation.md b/packages/website/md/docs/connect/3/installation.md new file mode 100644 index 000000000..6797d9633 --- /dev/null +++ b/packages/website/md/docs/connect/3/installation.md @@ -0,0 +1,15 @@ +**Install** + +```bash +npm install @0x/connect --save +``` + +**Import** + +```javascript +import { HttpClient } from '@0x/connect'; +``` + +### Wiki + +Check out our [0x Connect introduction tutorial](https://0xproject.com/wiki#Intro-Tutorial) for information on how to integrate relayers into your application. diff --git a/packages/website/md/docs/contract_wrappers/installation.md b/packages/website/md/docs/contract_wrappers/1/installation.md index d5c7fbdba..d5c7fbdba 100644 --- a/packages/website/md/docs/contract_wrappers/installation.md +++ b/packages/website/md/docs/contract_wrappers/1/installation.md diff --git a/packages/website/md/docs/contract_wrappers/introduction.md b/packages/website/md/docs/contract_wrappers/1/introduction.md index ccc81b373..ccc81b373 100644 --- a/packages/website/md/docs/contract_wrappers/introduction.md +++ b/packages/website/md/docs/contract_wrappers/1/introduction.md diff --git a/packages/website/md/docs/contract_wrappers/2/installation.md b/packages/website/md/docs/contract_wrappers/2/installation.md new file mode 100644 index 000000000..50610550a --- /dev/null +++ b/packages/website/md/docs/contract_wrappers/2/installation.md @@ -0,0 +1,11 @@ +**Install** + +```bash +npm install @0x/contract-wrappers --save +``` + +**Import** + +```javascript +import { ContractWrappers } from '@0x/contract-wrappers'; +``` diff --git a/packages/website/md/docs/json_schemas/1.0.0/installation.md b/packages/website/md/docs/json_schemas/1/installation.md index 50a37bae1..50a37bae1 100644 --- a/packages/website/md/docs/json_schemas/1.0.0/installation.md +++ b/packages/website/md/docs/json_schemas/1/installation.md diff --git a/packages/website/md/docs/json_schemas/1.0.0/introduction.md b/packages/website/md/docs/json_schemas/1/introduction.md index 5b2e90387..5b2e90387 100644 --- a/packages/website/md/docs/json_schemas/1.0.0/introduction.md +++ b/packages/website/md/docs/json_schemas/1/introduction.md diff --git a/packages/website/md/docs/json_schemas/1.0.0/schemas.md b/packages/website/md/docs/json_schemas/1/schemas.md index fcf5d8df6..fcf5d8df6 100644 --- a/packages/website/md/docs/json_schemas/1.0.0/schemas.md +++ b/packages/website/md/docs/json_schemas/1/schemas.md diff --git a/packages/website/md/docs/json_schemas/1.0.0/usage.md b/packages/website/md/docs/json_schemas/1/usage.md index 68b801153..68b801153 100644 --- a/packages/website/md/docs/json_schemas/1.0.0/usage.md +++ b/packages/website/md/docs/json_schemas/1/usage.md diff --git a/packages/website/md/docs/json_schemas/2.0.0/schemas.md b/packages/website/md/docs/json_schemas/2/schemas.md index ec7cf6f15..ec7cf6f15 100644 --- a/packages/website/md/docs/json_schemas/2.0.0/schemas.md +++ b/packages/website/md/docs/json_schemas/2/schemas.md diff --git a/packages/website/md/docs/json_schemas/3/installation.md b/packages/website/md/docs/json_schemas/3/installation.md new file mode 100644 index 000000000..a99886113 --- /dev/null +++ b/packages/website/md/docs/json_schemas/3/installation.md @@ -0,0 +1,17 @@ +**Install** + +```bash +yarn add @0x/json-schemas +``` + +**Import** + +```javascript +import { schemas } from '@0x/json-schemas'; +``` + +or + +```javascript +var schemas = require('@0x/json-schemas').schemas; +``` diff --git a/packages/website/md/docs/json_schemas/3/introduction.md b/packages/website/md/docs/json_schemas/3/introduction.md new file mode 100644 index 000000000..0039d014a --- /dev/null +++ b/packages/website/md/docs/json_schemas/3/introduction.md @@ -0,0 +1,3 @@ +Welcome to the [json-schemas](https://github.com/0xProject/0x-monorepo/tree/development/packages/json-schemas) documentation! This package provides JSON schemas for validating 0x Protocol & Standard Relayer API data structures. It provides both the raw JSON schemas and a schema validator class to interact with them from a JS project. + +If you are not using a Javascript-based language for your project, you can use a Javascript environment to render the JSON schemas within this package and use them together with a [JSON Schema](http://json-schema.org/) implementation in your [language of choice](http://json-schema.org/implementations.html) (e.g Python, Haskell, Go, C, C++, Rust, Ruby, Scala, etc...). diff --git a/packages/website/md/docs/json_schemas/3/usage.md b/packages/website/md/docs/json_schemas/3/usage.md new file mode 100644 index 000000000..2b72eeaad --- /dev/null +++ b/packages/website/md/docs/json_schemas/3/usage.md @@ -0,0 +1,14 @@ +The following example shows you how to validate a 0x order using the `@0x/json-schemas` package. + +```javascript +import {SchemaValidator, ValidatorResult, schemas} from '@0x/json-schemas'; + +const {orderSchema} = schemas; +const validator = new SchemaValidator(); + +const order = { + ... +}; +const validatorResult: ValidatorResult = validator.validate(order, orderSchema); // Contains all errors +const isValid: boolean = validator.isValid(order, orderSchema); // Only returns boolean +``` diff --git a/packages/website/md/docs/order_utils/1.0.0/installation.md b/packages/website/md/docs/order_utils/1/installation.md index 68a7cf960..68a7cf960 100644 --- a/packages/website/md/docs/order_utils/1.0.0/installation.md +++ b/packages/website/md/docs/order_utils/1/installation.md diff --git a/packages/website/md/docs/order_utils/1.0.0/introduction.md b/packages/website/md/docs/order_utils/1/introduction.md index d5f3f2925..d5f3f2925 100644 --- a/packages/website/md/docs/order_utils/1.0.0/introduction.md +++ b/packages/website/md/docs/order_utils/1/introduction.md diff --git a/packages/website/md/docs/order_utils/2/installation.md b/packages/website/md/docs/order_utils/2/installation.md new file mode 100644 index 000000000..d4bac6a53 --- /dev/null +++ b/packages/website/md/docs/order_utils/2/installation.md @@ -0,0 +1,17 @@ +**Install** + +```bash +yarn add @0x/order-utils +``` + +**Import** + +```javascript +import { createSignedOrderAsync } from '@0x/order-utils'; +``` + +or + +```javascript +var createSignedOrderAsync = require('@0x/order-utils').createSignedOrderAsync; +``` diff --git a/packages/website/md/docs/order_utils/2/introduction.md b/packages/website/md/docs/order_utils/2/introduction.md new file mode 100644 index 000000000..567896603 --- /dev/null +++ b/packages/website/md/docs/order_utils/2/introduction.md @@ -0,0 +1 @@ +Welcome to the [order-utils](https://github.com/0xProject/0x-monorepo/tree/development/packages/order-utils) documentation! Order utils is a set of utils around creating, signing, validating 0x orders. diff --git a/packages/website/md/docs/order_watcher/installation.md b/packages/website/md/docs/order_watcher/1/installation.md index 4b28f583d..4b28f583d 100644 --- a/packages/website/md/docs/order_watcher/installation.md +++ b/packages/website/md/docs/order_watcher/1/installation.md diff --git a/packages/website/md/docs/order_watcher/introduction.md b/packages/website/md/docs/order_watcher/1/introduction.md index f922d922f..f922d922f 100644 --- a/packages/website/md/docs/order_watcher/introduction.md +++ b/packages/website/md/docs/order_watcher/1/introduction.md diff --git a/packages/website/md/docs/order_watcher/2/installation.md b/packages/website/md/docs/order_watcher/2/installation.md new file mode 100644 index 000000000..883eb40e5 --- /dev/null +++ b/packages/website/md/docs/order_watcher/2/installation.md @@ -0,0 +1,17 @@ +**Install** + +```bash +yarn add @0x/order-watcher +``` + +**Import** + +```javascript +import { OrderWatcher } from '@0x/order-watcher'; +``` + +or + +```javascript +var OrderWatcher = require('@0x/order-utils').OrderWatcher; +``` diff --git a/packages/website/md/docs/order_watcher/2/introduction.md b/packages/website/md/docs/order_watcher/2/introduction.md new file mode 100644 index 000000000..b2d574053 --- /dev/null +++ b/packages/website/md/docs/order_watcher/2/introduction.md @@ -0,0 +1 @@ +Welcome to the [order-watcher](https://github.com/0xProject/0x-monorepo/tree/development/packages/order-watcher) documentation! OrderWatcher is a daemon that efficiently watches a set of orders, emitting events whenever the validity of an order changes. It can be used by relayers to prune an orderbook, or by traders to keep orders fetched from a Relayer up-to-date. diff --git a/packages/website/md/docs/smart_contracts/1.0.0/introduction.md b/packages/website/md/docs/smart_contracts/1/introduction.md index 79a8f00fd..79a8f00fd 100644 --- a/packages/website/md/docs/smart_contracts/1.0.0/introduction.md +++ b/packages/website/md/docs/smart_contracts/1/introduction.md diff --git a/packages/website/md/docs/smart_contracts/2.0.0/introduction.md b/packages/website/md/docs/smart_contracts/2/introduction.md index 4aa31db3d..4aa31db3d 100644 --- a/packages/website/md/docs/smart_contracts/2.0.0/introduction.md +++ b/packages/website/md/docs/smart_contracts/2/introduction.md diff --git a/packages/website/md/docs/sol-compiler/installation.md b/packages/website/md/docs/sol-compiler/1/installation.md index 9c8561d9b..9c8561d9b 100644 --- a/packages/website/md/docs/sol-compiler/installation.md +++ b/packages/website/md/docs/sol-compiler/1/installation.md diff --git a/packages/website/md/docs/sol-compiler/introduction.md b/packages/website/md/docs/sol-compiler/1/introduction.md index fcd80f47b..fcd80f47b 100644 --- a/packages/website/md/docs/sol-compiler/introduction.md +++ b/packages/website/md/docs/sol-compiler/1/introduction.md diff --git a/packages/website/md/docs/sol-compiler/usage.md b/packages/website/md/docs/sol-compiler/1/usage.md index 79c9b32ba..79c9b32ba 100644 --- a/packages/website/md/docs/sol-compiler/usage.md +++ b/packages/website/md/docs/sol-compiler/1/usage.md diff --git a/packages/website/md/docs/sol-compiler/2/installation.md b/packages/website/md/docs/sol-compiler/2/installation.md new file mode 100644 index 000000000..7e7b690fe --- /dev/null +++ b/packages/website/md/docs/sol-compiler/2/installation.md @@ -0,0 +1,23 @@ +#### CLI Installation + +```bash +yarn global add @0x/sol-compiler +``` + +#### API Installation + +```bash +yarn add @0x/sol-compiler +``` + +**Import** + +```typescript +import { Compiler } from '@0x/sol-compiler'; +``` + +or + +```javascript +var Compiler = require('@0x/sol-compiler').Compiler; +``` diff --git a/packages/website/md/docs/sol-compiler/2/usage.md b/packages/website/md/docs/sol-compiler/2/usage.md new file mode 100644 index 000000000..68e5a988f --- /dev/null +++ b/packages/website/md/docs/sol-compiler/2/usage.md @@ -0,0 +1,24 @@ +#### CLI Usage + +```bash +$ sol-compiler +Options: + --version Show version number [boolean] + --contracts-dir path of contracts directory to compile [string] + --artifacts-dir path to write contracts artifacts to [string] + --contracts comma separated list of contracts to compile + [string] [default: "*"] + --help Show help [boolean] +``` + +#### API Usage + +```typescript +import { Compiler } from '@0x/sol-compiler'; + +const compiler = new Compiler(); + +(async () => { + await compiler.compileAllAsync(); +})().catch(console.log); +``` diff --git a/packages/website/md/docs/sol_cov/installation.md b/packages/website/md/docs/sol_cov/1/installation.md index b9ce25a5f..b9ce25a5f 100644 --- a/packages/website/md/docs/sol_cov/installation.md +++ b/packages/website/md/docs/sol_cov/1/installation.md diff --git a/packages/website/md/docs/sol_cov/introduction.md b/packages/website/md/docs/sol_cov/1/introduction.md index 7064a3554..7064a3554 100644 --- a/packages/website/md/docs/sol_cov/introduction.md +++ b/packages/website/md/docs/sol_cov/1/introduction.md diff --git a/packages/website/md/docs/sol_cov/usage.md b/packages/website/md/docs/sol_cov/1/usage.md index c747005fb..c747005fb 100644 --- a/packages/website/md/docs/sol_cov/usage.md +++ b/packages/website/md/docs/sol_cov/1/usage.md diff --git a/packages/website/md/docs/sol_cov/2/installation.md b/packages/website/md/docs/sol_cov/2/installation.md new file mode 100644 index 000000000..1d4557cf5 --- /dev/null +++ b/packages/website/md/docs/sol_cov/2/installation.md @@ -0,0 +1,17 @@ +**Install** + +```bash +yarn add @0x/sol-cov +``` + +**Import** + +```javascript +import { CoverageSubprovider } from '@0x/sol-cov'; +``` + +or + +```javascript +var CoverageSubprovider = require('@0x/sol-cov').CoverageSubprovider; +``` diff --git a/packages/website/md/docs/sol_cov/2/introduction.md b/packages/website/md/docs/sol_cov/2/introduction.md new file mode 100644 index 000000000..ac3256845 --- /dev/null +++ b/packages/website/md/docs/sol_cov/2/introduction.md @@ -0,0 +1 @@ +Welcome to the [sol-cov](https://github.com/0xProject/0x-monorepo/tree/development/packages/sol-cov) documentation! Sol-cov is a Solidity coverage tool for your smart contract tests. diff --git a/packages/website/md/docs/sol_cov/2/usage.md b/packages/website/md/docs/sol_cov/2/usage.md new file mode 100644 index 000000000..d1c76474b --- /dev/null +++ b/packages/website/md/docs/sol_cov/2/usage.md @@ -0,0 +1,62 @@ +Sol-cov uses transaction traces in order to figure out which lines of Solidity source code have been covered by your tests. In order for it to gather these traces, you must add the `CoverageSubprovider` to the [ProviderEngine](https://github.com/MetaMask/provider-engine) instance you use when running your Solidity tests. If you're unfamiliar with ProviderEngine, please read the [Web3 Provider explained](https://0xproject.com/wiki#Web3-Provider-Explained) wiki article. + +The CoverageSubprovider eavesdrops on the `eth_sendTransaction` and `eth_call` RPC calls and collects traces after each call using `debug_traceTransaction`. `eth_call`'s' don't generate traces - so we take a snapshot, re-submit it as a transaction, get the trace and then revert the snapshot. + +Coverage subprovider needs some info about your contracts (`srcMap`, `bytecode`). It gets that info from your project's artifacts. Some frameworks have their own artifact format. Some artifact formats don't actually contain all the neccessary data. + +In order to use `CoverageSubprovider` with your favorite framework you need to pass an `artifactsAdapter` to it. + +### Sol-compiler + +If you are generating your artifacts with [@0x/sol-compiler](https://0xproject.com/docs/sol-compiler) you can use the `SolCompilerArtifactsAdapter` we've implemented for you. + +```typescript +import { SolCompilerArtifactsAdapter } from '@0x/sol-cov'; +const artifactsPath = 'src/artifacts'; +const contractsPath = 'src/contracts'; +const artifactsAdapter = new SolCompilerArtifactsAdapter(artifactsPath, contractsPath); +``` + +### Truffle + +If your project is using [Truffle](https://truffleframework.com/), we've written a `TruffleArtifactsAdapter`for you. + +```typescript +import { TruffleArtifactAdapter } from '@0x/sol-cov'; +const contractsPath = 'src/contracts'; +const artifactAdapter = new TruffleArtifactAdapter(contractsDir); +``` + +Because truffle artifacts don't have all the data we need - we actually will recompile your contracts under the hood. That's why you don't need to pass an `artifactsPath`. + +### Other framework/toolset + +You'll need to write your own artifacts adapter. It should extend `AbstractArtifactsAdapter`. +Look at the code of the two adapters above for examples. + +### Usage + +```typescript +import { CoverageSubprovider } from '@0x/sol-cov'; +import ProviderEngine = require('web3-provider-engine'); + +const provider = new ProviderEngine(); + +const artifactsPath = 'src/artifacts'; +const contractsPath = 'src/contracts'; +const networkId = 50; +// Some calls might not have `from` address specified. Nevertheless - transactions need to be submitted from an address with at least some funds. defaultFromAddress is the address that will be used to submit those calls as transactions from. +const defaultFromAddress = '0x5409ed021d9299bf6814279a6a1411a7e866a631'; +const isVerbose = true; +const coverageSubprovider = new CoverageSubprovider(artifactsAdapter, defaultFromAddress, isVerbose); + +provider.addProvider(coverageSubprovider); +``` + +After your test suite is complete (e.g in the Mocha global `after` hook), you'll need to call: + +```typescript +await coverageSubprovider.writeCoverageAsync(); +``` + +This will create a `coverage.json` file in a `coverage` directory. This file has an [Istanbul format](https://github.com/gotwarlost/istanbul/blob/master/coverage.json.md) - so you can use it with any of the existing Istanbul reporters. diff --git a/packages/website/md/docs/subproviders/installation.md b/packages/website/md/docs/subproviders/1/installation.md index a049ff0ec..a049ff0ec 100644 --- a/packages/website/md/docs/subproviders/installation.md +++ b/packages/website/md/docs/subproviders/1/installation.md diff --git a/packages/website/md/docs/subproviders/introduction.md b/packages/website/md/docs/subproviders/1/introduction.md index 835201064..835201064 100644 --- a/packages/website/md/docs/subproviders/introduction.md +++ b/packages/website/md/docs/subproviders/1/introduction.md diff --git a/packages/website/md/docs/subproviders/ledger_node_hid.md b/packages/website/md/docs/subproviders/1/ledger_node_hid.md index 3089817af..3089817af 100644 --- a/packages/website/md/docs/subproviders/ledger_node_hid.md +++ b/packages/website/md/docs/subproviders/1/ledger_node_hid.md diff --git a/packages/website/md/docs/subproviders/2/installation.md b/packages/website/md/docs/subproviders/2/installation.md new file mode 100644 index 000000000..025dd0dee --- /dev/null +++ b/packages/website/md/docs/subproviders/2/installation.md @@ -0,0 +1,15 @@ +```bash +npm install @0x/subproviders --save +``` + +**Import** + +```typescript +import { LedgerSubprovider } from '@0x/subproviders'; +``` + +or + +```javascript +var LedgerSubprovider = require('@0x/subproviders').LedgerSubprovider; +``` diff --git a/packages/website/md/docs/web3_wrapper/installation.md b/packages/website/md/docs/web3_wrapper/1/installation.md index 92794d9b0..92794d9b0 100644 --- a/packages/website/md/docs/web3_wrapper/installation.md +++ b/packages/website/md/docs/web3_wrapper/1/installation.md diff --git a/packages/website/md/docs/web3_wrapper/introduction.md b/packages/website/md/docs/web3_wrapper/1/introduction.md index 17bd316f1..17bd316f1 100644 --- a/packages/website/md/docs/web3_wrapper/introduction.md +++ b/packages/website/md/docs/web3_wrapper/1/introduction.md diff --git a/packages/website/md/docs/web3_wrapper/2/installation.md b/packages/website/md/docs/web3_wrapper/2/installation.md new file mode 100644 index 000000000..14c4f066c --- /dev/null +++ b/packages/website/md/docs/web3_wrapper/2/installation.md @@ -0,0 +1,25 @@ +**Install** + +```bash +npm install @0x/web3-wrapper --save +``` + +**Import** + +```javascript +import { Web3Wrapper } from '@0x/web3-wrapper'; +``` + +or + +```javascript +var Web3Wrapper = require('@0x/web3-wrapper').Web3Wrapper; +``` + +If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`: + +``` +"include": [ + "./node_modules/web3-typescript-typings/index.d.ts", +] +``` |