aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/md/docs
diff options
context:
space:
mode:
Diffstat (limited to 'packages/website/md/docs')
-rw-r--r--packages/website/md/docs/asset_buyer/installation.md17
-rw-r--r--packages/website/md/docs/asset_buyer/introduction.md1
-rw-r--r--packages/website/md/docs/asset_buyer/usage.md39
-rw-r--r--packages/website/md/docs/json_schemas/2.0.0/schemas.md52
4 files changed, 89 insertions, 20 deletions
diff --git a/packages/website/md/docs/asset_buyer/installation.md b/packages/website/md/docs/asset_buyer/installation.md
new file mode 100644
index 000000000..483ee2b65
--- /dev/null
+++ b/packages/website/md/docs/asset_buyer/installation.md
@@ -0,0 +1,17 @@
+**Install**
+
+```bash
+yarn add @0xproject/asset-buyer
+```
+
+**Import**
+
+```javascript
+import { AssetBuyer } from '@0xproject/asset-buyer';
+```
+
+or
+
+```javascript
+var AssetBuyer = require('@0xproject/asset-buyer').AssetBuyer;
+```
diff --git a/packages/website/md/docs/asset_buyer/introduction.md b/packages/website/md/docs/asset_buyer/introduction.md
new file mode 100644
index 000000000..a40d20cc9
--- /dev/null
+++ b/packages/website/md/docs/asset_buyer/introduction.md
@@ -0,0 +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).
diff --git a/packages/website/md/docs/asset_buyer/usage.md b/packages/website/md/docs/asset_buyer/usage.md
new file mode 100644
index 000000000..6462d938e
--- /dev/null
+++ b/packages/website/md/docs/asset_buyer/usage.md
@@ -0,0 +1,39 @@
+**Construction**
+
+Connecting to a standard relayer API compliant url:
+
+```typescript
+const provider = web3.currentProvider;
+const apiUrl = 'https://api.relayer.com/v2';
+const assetBuyer = AssetBuyer.getAssetBuyerForStandardRelayerAPIUrl(provider, apiUrl);
+```
+
+Providing your own orders:
+
+```typescript
+const provider = web3.currentProvider;
+const orders = []; // get these from your own API, a relayer, a friend, from anywhere
+const assetBuyer = AssetBuyer.getAssetBuyerForProvidedOrders(provider, orders);
+```
+
+**Get a quote**
+
+A [BuyQuote](#types-BuyQuote) object contains enough information to display buy information to an end user
+
+```typescript
+const erc20TokenAddress = '0x5fa3c....';
+const amountToBuy = new BigNumber(50000000000000000000);
+const buyQuote = await assetBuyer.getBuyQuoteForERC20TokenAddressAsync(erc20TokenAddress, amountToBuy);
+const quoteInfo = buyQuote.worstCaseQuoteInfo;
+console.log(quoteInfo.ethAmount); // the total amount the user needs to pay to buy the desired amount (including ZRX fees)
+console.log(quoteInfo.feeAmount); // a portion of the total ethAmount above that was used to buy affiliate fees
+console.log(quoteInfo.ethPerAssetPrice); // the rate that this quote provides (e.g. 0.0035ETH / REP)
+```
+
+**Perform a buy**
+
+Pass the [BuyQuote](#types-BuyQuote) object from above back to the assetBuyer in order to initiate the buy transaction
+
+```typescript
+const txHash = await assetBuyer.executeBuyQuoteAsync(buyQuote); // the hash of the transaction submitted to the Ethereum network
+```
diff --git a/packages/website/md/docs/json_schemas/2.0.0/schemas.md b/packages/website/md/docs/json_schemas/2.0.0/schemas.md
index 4f3200b1c..ec7cf6f15 100644
--- a/packages/website/md/docs/json_schemas/2.0.0/schemas.md
+++ b/packages/website/md/docs/json_schemas/2.0.0/schemas.md
@@ -1,28 +1,40 @@
+Basic Schemas
+
+* [Address type](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/address.json)
+* [Number type](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/number.json)
+* [Hex type](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/hex.json)
+* [JS number](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/js_number.json)
+
0x Protocol Schemas
-* [Basic types](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/basic_type_schemas.ts) (e.g Ethereum address, number, hex)
-* [Order/SignedOrder](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/order_schemas.ts)
-* [OrderHash](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/order_hash_schema.ts)
+* [Order](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/order_schema.json)
+* [SignedOrder](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/signed_order_schema.json)
+* [OrderHash](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/order_hash_schema.json)
+* [ECSignature](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/ec_signature_schema.json)
0x.js Schemas
-* [BlockRange](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/block_range_schema.ts)
-* [IndexFilter Values](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/index_filter_values_schema.ts)
-* [OrderFillRequests](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/order_fill_requests_schema.ts)
-* [OrderCancellationRequests](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/order_cancel_schema.ts)
-* [OrderFillOrKillRequests](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/order_fill_or_kill_requests_schema.ts)
-* [SignedOrders](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/signed_orders_schema.ts)
-* [Token](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/token_schema.ts)
-* [TxData](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/tx_data_schema.ts)
+* [BlockParam](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/block_param_schema.json)
+* [BlockRange](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/block_range_schema.json)
+* [IndexFilter Values](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/index_filter_values_schema.json)
+* [OrderFillRequests](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/order_fill_requests_schema.json)
+* [OrderCancellationRequests](https://github.com/0xProjet/0x-monorepo/blob/development/packages/json-schemas/schemas/order_cancel_schema.json)
+* [OrderFillOrKillRequests](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/order_fill_or_kill_requests_schema.json)
+* [SignedOrders](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/signed_orders_schema.json)
+* [Token](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/token_schema.json)
+* [TxData](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/tx_data_schema.json)
Standard Relayer API Schemas
-* [Paginated collection](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/paginated_collection_schema.ts)
-* [Error response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_error_response_schema.ts)
-* [Order config payload](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_order_config_payload_schema.ts)
-* [Order config response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_order_config_response_schema.ts)
-* [Orders channel subscribe](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_schema.ts)
-* [Orders channel update](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_orders_channel_update_response_schema.ts)
-* [Orderbook response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_orderbook_response_schema.ts)
-* [Asset pairs response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_asset_pairs_response_schema.ts)
-* [Fee recipients response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_fee_recipients_response_schema.ts)
+* [Paginated collection](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/paginated_collection_schema.json)
+* [Error response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_error_response_schema.json)
+* [Order config payload](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_order_config_payload_schema.json)
+* [Order config response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_order_config_response_schema.json)
+* [Orders channel subscribe payload](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_payload_schema.json)
+* [Orders channel subscribe](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_orders_channel_subscribe_schema.json)
+* [Orders channel update](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_orders_channel_update_response_schema.json)
+* [Orderbook response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_orderbook_response_schema.json)
+* [Asset pairs](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_asset_pairs_schema.json)
+* [Trade info](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_asset_trade_info_schema.json)
+* [Asset pairs response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_asset_pairs_response_schema.json)
+* [Fee recipients response](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_fee_recipients_response_schema.json)