From dd9c4b6e5d0f10bdaaae61f40bdf017e83e5f606 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Wed, 15 Aug 2018 14:13:07 -0700 Subject: Initial skeleton of forwarder-helper package --- packages/forwarder-helper/.npmignore | 8 +++ packages/forwarder-helper/CHANGELOG.json | 1 + packages/forwarder-helper/CHANGELOG.md | 0 packages/forwarder-helper/README.md | 83 ++++++++++++++++++++++ packages/forwarder-helper/package.json | 78 ++++++++++++++++++++ .../forwarder-helper/src/forwarder_helper_impl.ts | 0 packages/forwarder-helper/src/globals.d.ts | 6 ++ packages/forwarder-helper/src/index.ts | 0 .../src/monorepo_scripts/postpublish.ts | 8 +++ .../src/monorepo_scripts/stage_docs.ts | 8 +++ packages/forwarder-helper/src/types.ts | 0 .../test/forwarder_helper_impl_test.ts | 12 ++++ packages/forwarder-helper/test/utils/chai_setup.ts | 13 ++++ packages/forwarder-helper/tsconfig.json | 7 ++ packages/forwarder-helper/tslint.json | 3 + 15 files changed, 227 insertions(+) create mode 100644 packages/forwarder-helper/.npmignore create mode 100644 packages/forwarder-helper/CHANGELOG.json create mode 100644 packages/forwarder-helper/CHANGELOG.md create mode 100644 packages/forwarder-helper/README.md create mode 100644 packages/forwarder-helper/package.json create mode 100644 packages/forwarder-helper/src/forwarder_helper_impl.ts create mode 100644 packages/forwarder-helper/src/globals.d.ts create mode 100644 packages/forwarder-helper/src/index.ts create mode 100644 packages/forwarder-helper/src/monorepo_scripts/postpublish.ts create mode 100644 packages/forwarder-helper/src/monorepo_scripts/stage_docs.ts create mode 100644 packages/forwarder-helper/src/types.ts create mode 100644 packages/forwarder-helper/test/forwarder_helper_impl_test.ts create mode 100644 packages/forwarder-helper/test/utils/chai_setup.ts create mode 100644 packages/forwarder-helper/tsconfig.json create mode 100644 packages/forwarder-helper/tslint.json (limited to 'packages') diff --git a/packages/forwarder-helper/.npmignore b/packages/forwarder-helper/.npmignore new file mode 100644 index 000000000..5333847e7 --- /dev/null +++ b/packages/forwarder-helper/.npmignore @@ -0,0 +1,8 @@ +.* +yarn-error.log +/src/ +/scripts/ +/schemas/ +test/ +tsconfig.json +/lib/src/monorepo_scripts/ diff --git a/packages/forwarder-helper/CHANGELOG.json b/packages/forwarder-helper/CHANGELOG.json new file mode 100644 index 000000000..fe51488c7 --- /dev/null +++ b/packages/forwarder-helper/CHANGELOG.json @@ -0,0 +1 @@ +[] diff --git a/packages/forwarder-helper/CHANGELOG.md b/packages/forwarder-helper/CHANGELOG.md new file mode 100644 index 000000000..e69de29bb diff --git a/packages/forwarder-helper/README.md b/packages/forwarder-helper/README.md new file mode 100644 index 000000000..c74526910 --- /dev/null +++ b/packages/forwarder-helper/README.md @@ -0,0 +1,83 @@ +## @0xproject/forwarder-helper + +Provides convenience objects to help work with the Forwarder Contract + +### Read the [Documentation](https://0xproject.com/docs/forwarder-helper). + +## Installation + +```bash +yarn add @0xproject/forwarder-helper +``` + +**Import** + +```typescript +import { forwarderHelperFactory } from '@0xproject/forwarder-helper'; +``` + +or + +```javascript +var forwarderHelperFactory = require('@0xproject/forwarder-helper').forwarderHelperFactory; +``` + +If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`: + +```json +"compilerOptions": { + "typeRoots": ["node_modules/@0xproject/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=@0xproject/forwarder-helper yarn build +``` + +Or continuously rebuild on change: + +```bash +PKG=@0xproject/forwarder-helper yarn watch +``` + +### Clean + +```bash +yarn clean +``` + +### Lint + +```bash +yarn lint +``` + +### Run Tests + +```bash +yarn test +``` diff --git a/packages/forwarder-helper/package.json b/packages/forwarder-helper/package.json new file mode 100644 index 000000000..7f7b595c2 --- /dev/null +++ b/packages/forwarder-helper/package.json @@ -0,0 +1,78 @@ +{ + "name": "@0xproject/forwarder-helper", + "version": "1.0.0-rc.1", + "engines": { + "node": ">=6.12" + }, + "description": "Convenience object for working with the forwarder contract", + "main": "lib/src/index.js", + "types": "lib/src/index.d.ts", + "scripts": { + "watch_without_deps": "tsc -w", + "lint": "tslint --project .", + "test": "yarn run_mocha", + "rebuild_and_test": "run-s clean build test", + "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", + "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", + "test:circleci": "yarn test:coverage", + "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --exit", + "clean": "shx rm -rf lib test_temp scripts", + "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", + "manual:postpublish": "yarn build; node ./scripts/postpublish.js", + "docs:stage": "node scripts/stage_docs.js", + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES", + "upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json" + }, + "config": { + "postpublish": { + "assets": [], + "docPublishConfigs": { + "extraFileIncludes": [ + "../types/src/index.ts", + "../ethereum-types/src/index.ts" + ], + "s3BucketPath": "s3://doc-jsons/forwarder-helper/", + "s3StagingBucketPath": "s3://staging-doc-jsons/forwarder-helper/" + } + } + }, + "repository": { + "type": "git", + "url": "https://github.com/0xProject/0x-monorepo.git" + }, + "author": "", + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/0xProject/0x-monorepo/issues" + }, + "homepage": "https://github.com/0xProject/0x-monorepo/packages/forwarder-helper/README.md", + "dependencies": { + "@0xproject/typescript-typings": "^1.0.4", + "@types/node": "^8.0.53" + }, + "devDependencies": { + "@0xproject/monorepo-scripts": "^1.0.5", + "@0xproject/tslint-config": "^1.0.5", + "@0xproject/utils": "^1.0.5", + "@types/lodash.foreach": "^4.5.3", + "@types/lodash.values": "^4.3.3", + "@types/mocha": "^2.2.42", + "chai": "^4.0.1", + "chai-as-promised": "^7.1.0", + "chai-bignumber": "^2.0.1", + "copyfiles": "^1.2.0", + "dirty-chai": "^2.0.1", + "lodash.foreach": "^4.5.0", + "make-promises-safe": "^1.1.0", + "mocha": "^4.1.0", + "npm-run-all": "^4.1.2", + "nyc": "^11.0.1", + "shx": "^0.2.2", + "tslint": "5.11.0", + "typedoc": "0xProject/typedoc", + "typescript": "3.0.1" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/packages/forwarder-helper/src/forwarder_helper_impl.ts b/packages/forwarder-helper/src/forwarder_helper_impl.ts new file mode 100644 index 000000000..e69de29bb diff --git a/packages/forwarder-helper/src/globals.d.ts b/packages/forwarder-helper/src/globals.d.ts new file mode 100644 index 000000000..94e63a32d --- /dev/null +++ b/packages/forwarder-helper/src/globals.d.ts @@ -0,0 +1,6 @@ +declare module '*.json' { + const json: any; + /* tslint:disable */ + export default json; + /* tslint:enable */ +} diff --git a/packages/forwarder-helper/src/index.ts b/packages/forwarder-helper/src/index.ts new file mode 100644 index 000000000..e69de29bb diff --git a/packages/forwarder-helper/src/monorepo_scripts/postpublish.ts b/packages/forwarder-helper/src/monorepo_scripts/postpublish.ts new file mode 100644 index 000000000..dcb99d0f7 --- /dev/null +++ b/packages/forwarder-helper/src/monorepo_scripts/postpublish.ts @@ -0,0 +1,8 @@ +import { postpublishUtils } from '@0xproject/monorepo-scripts'; + +import * as packageJSON from '../package.json'; +import * as tsConfigJSON from '../tsconfig.json'; + +const cwd = `${__dirname}/..`; +// tslint:disable-next-line:no-floating-promises +postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/forwarder-helper/src/monorepo_scripts/stage_docs.ts b/packages/forwarder-helper/src/monorepo_scripts/stage_docs.ts new file mode 100644 index 000000000..e732ac8eb --- /dev/null +++ b/packages/forwarder-helper/src/monorepo_scripts/stage_docs.ts @@ -0,0 +1,8 @@ +import { postpublishUtils } from '@0xproject/monorepo-scripts'; + +import * as packageJSON from '../package.json'; +import * as tsConfigJSON from '../tsconfig.json'; + +const cwd = `${__dirname}/..`; +// tslint:disable-next-line:no-floating-promises +postpublishUtils.publishDocsToStagingAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/forwarder-helper/src/types.ts b/packages/forwarder-helper/src/types.ts new file mode 100644 index 000000000..e69de29bb diff --git a/packages/forwarder-helper/test/forwarder_helper_impl_test.ts b/packages/forwarder-helper/test/forwarder_helper_impl_test.ts new file mode 100644 index 000000000..1d3347d48 --- /dev/null +++ b/packages/forwarder-helper/test/forwarder_helper_impl_test.ts @@ -0,0 +1,12 @@ +import * as chai from 'chai'; +import 'mocha'; + +import { chaiSetup } from './utils/chai_setup'; + +chaiSetup.configure(); +const expect = chai.expect; + +describe('ForwarderHelperImpl', () => { + describe('#getMarketBuyOrdersInfo', () => {}); + describe('#getMarketSellOrdersInfo', () => {}); +}); diff --git a/packages/forwarder-helper/test/utils/chai_setup.ts b/packages/forwarder-helper/test/utils/chai_setup.ts new file mode 100644 index 000000000..1a8733093 --- /dev/null +++ b/packages/forwarder-helper/test/utils/chai_setup.ts @@ -0,0 +1,13 @@ +import * as chai from 'chai'; +import chaiAsPromised = require('chai-as-promised'); +import ChaiBigNumber = require('chai-bignumber'); +import * as dirtyChai from 'dirty-chai'; + +export const chaiSetup = { + configure(): void { + chai.config.includeStack = true; + chai.use(ChaiBigNumber()); + chai.use(dirtyChai); + chai.use(chaiAsPromised); + }, +}; diff --git a/packages/forwarder-helper/tsconfig.json b/packages/forwarder-helper/tsconfig.json new file mode 100644 index 000000000..e35816553 --- /dev/null +++ b/packages/forwarder-helper/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig", + "compilerOptions": { + "outDir": "lib" + }, + "include": ["./src/**/*", "./test/**/*"] +} diff --git a/packages/forwarder-helper/tslint.json b/packages/forwarder-helper/tslint.json new file mode 100644 index 000000000..ffaefe83a --- /dev/null +++ b/packages/forwarder-helper/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": ["@0xproject/tslint-config"] +} -- cgit From 90f2813d0e3cf61c63b308d5cfe738b7beba8c94 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Wed, 15 Aug 2018 14:51:32 -0700 Subject: Flesh out types --- packages/forwarder-helper/package.json | 2 + packages/forwarder-helper/src/types.ts | 80 ++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) (limited to 'packages') diff --git a/packages/forwarder-helper/package.json b/packages/forwarder-helper/package.json index 7f7b595c2..ad2b5f7cf 100644 --- a/packages/forwarder-helper/package.json +++ b/packages/forwarder-helper/package.json @@ -47,7 +47,9 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/forwarder-helper/README.md", "dependencies": { + "@0xproject/types": "^0.8.2", "@0xproject/typescript-typings": "^1.0.4", + "@0xproject/utils": "^1.0.5", "@types/node": "^8.0.53" }, "devDependencies": { diff --git a/packages/forwarder-helper/src/types.ts b/packages/forwarder-helper/src/types.ts index e69de29bb..23eaa1281 100644 --- a/packages/forwarder-helper/src/types.ts +++ b/packages/forwarder-helper/src/types.ts @@ -0,0 +1,80 @@ +import { SignedOrder } from '@0xproject/types'; +import { BigNumber } from '@0xproject/utils'; + +export interface ForwarderHelper { + /** + * Given a MarketBuyOrdersInfoRequest, returns a MarketBuyOrdersInfo containing all information relevant to fulfilling the request + * using the ForwarderContract marketBuyOrdersWithEth function. + * @param request An object that conforms to MarketBuyOrdersInfoRequest. See type definition for more information. + * @return An object that conforms to MarketBuyOrdersInfo that satisfies the request. See type definition for more information. + */ + getMarketBuyOrdersInfo: (request: MarketBuyOrdersInfoRequest) => MarketBuyOrdersInfo; + /** + * Given a MarketSellOrdersInfoRequest, returns a MarketSellOrdersInfo containing all information relevant to fulfilling the request + * using the ForwarderContract marketSellOrdersWithEth function. + * @param request An object that conforms to MarketSellOrdersInfoRequest. See type definition for more information. + * @return An object that conforms to MarketSellOrdersInfo that satisfies the request. See type definition for more information. + */ + getMarketSellOrdersInfo: (request: MarketSellOrdersInfoRequest) => MarketSellOrdersInfo; +} + +export enum ForwarderHelperError { + InsufficientLiquidity = 'INSUFFICIENT_LIQUIDITY', + InsufficientZrxLiquidity = 'INSUFFICIENT_ZRX_LIQUIDITY', +} + +/** + * makerAssetFillAmount: The amount of makerAsset requesting to be filled + * feePercentage: Optional affiliate percentage amount factoring into eth amount calculations + * acceptableEthAmountRange: maximum difference between min and max eth cost + */ +export interface MarketBuyOrdersInfoRequest { + makerAssetFillAmount: BigNumber; + feePercentage?: BigNumber; + acceptableEthAmountRange?: BigNumber; +} + +/** + * makerAssetFillAmount: The amount of makerAsset requesting to be filled + * orders: An array of objects conforming to SignedOrder. These orders can be used to cover the requested makerAssetFillAmount plus slippage + * feeOrders: An array of objects conforming to SignedOrder. These orders can be used to cover the fees for the orders param above + * minEthAmount: Amount of eth in wei to send with the tx for the most optimistic case + * maxEthAmount: Amount of eth in wei to send with the tx for the worst case + * feePercentage: Affiliate fee percentage used to calculate the eth amounts above. Passed thru directly from the request + */ +export interface MarketBuyOrdersInfo { + makerAssetFillAmount: BigNumber; + orders: SignedOrder[]; + feeOrders: SignedOrder[]; + feePercentage?: BigNumber; + minEthAmount: BigNumber; + maxEthAmount: BigNumber; +} + +/** + * ethAmount: The amount of eth used to fill + * feePercentage: Optional affiliate percentage amount factoring into eth amount calculations + * acceptableFillAmountRange: maximum difference between min and max asset filled + */ +export interface MarketSellOrdersInfoRequest { + ethAmount: BigNumber; + feePercentage?: BigNumber; + acceptableFillAmountRange?: BigNumber; +} + +/** + * ethAmount: The amount of eth used to fill + * orders: An array of objects conforming to SignedOrder. These orders can be used to cover the requested ethAmount plus slippage + * feeOrders: An array of objects conforming to SignedOrder. These orders can be used to cover the fees for the orders param above + * minFillAmount: Amount of asset purchased in the worst case + * maxFillAmount: Amount of asset purchased in the best case + * feePercentage: Affiliate fee percentage used to calculate the eth amounts above. Passed thru directly from the request + */ +export interface MarketSellOrdersInfo { + ethAmount: BigNumber; + orders: SignedOrder[]; + feeOrders: SignedOrder[]; + minFillAmount: BigNumber; + maxFillAmount: BigNumber; + feePercentage?: BigNumber; +} -- cgit From 2ef867f398db381ebd8ec715bd108b46d8fa60f3 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Wed, 15 Aug 2018 15:20:25 -0700 Subject: Add stubs for ForwarderHelper interface in ForwarderHelperImpl --- packages/forwarder-helper/package.json | 18 +++----- .../forwarder-helper/src/forwarder_helper_impl.ts | 50 ++++++++++++++++++++++ packages/forwarder-helper/src/types.ts | 2 +- 3 files changed, 58 insertions(+), 12 deletions(-) (limited to 'packages') diff --git a/packages/forwarder-helper/package.json b/packages/forwarder-helper/package.json index ad2b5f7cf..e79154a52 100644 --- a/packages/forwarder-helper/package.json +++ b/packages/forwarder-helper/package.json @@ -15,22 +15,21 @@ "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", "test:circleci": "yarn test:coverage", - "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --exit", + "run_mocha": + "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --exit", "clean": "shx rm -rf lib test_temp scripts", "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", "manual:postpublish": "yarn build; node ./scripts/postpublish.js", "docs:stage": "node scripts/stage_docs.js", "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES", - "upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json" + "upload_docs_json": + "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json" }, "config": { "postpublish": { "assets": [], "docPublishConfigs": { - "extraFileIncludes": [ - "../types/src/index.ts", - "../ethereum-types/src/index.ts" - ], + "extraFileIncludes": ["../types/src/index.ts", "../ethereum-types/src/index.ts"], "s3BucketPath": "s3://doc-jsons/forwarder-helper/", "s3StagingBucketPath": "s3://staging-doc-jsons/forwarder-helper/" } @@ -47,7 +46,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/forwarder-helper/README.md", "dependencies": { - "@0xproject/types": "^0.8.2", + "@0xproject/order-utils": "^1.0.1-rc.3", + "@0xproject/types": "^1.0.1-rc.4", "@0xproject/typescript-typings": "^1.0.4", "@0xproject/utils": "^1.0.5", "@types/node": "^8.0.53" @@ -55,16 +55,12 @@ "devDependencies": { "@0xproject/monorepo-scripts": "^1.0.5", "@0xproject/tslint-config": "^1.0.5", - "@0xproject/utils": "^1.0.5", - "@types/lodash.foreach": "^4.5.3", - "@types/lodash.values": "^4.3.3", "@types/mocha": "^2.2.42", "chai": "^4.0.1", "chai-as-promised": "^7.1.0", "chai-bignumber": "^2.0.1", "copyfiles": "^1.2.0", "dirty-chai": "^2.0.1", - "lodash.foreach": "^4.5.0", "make-promises-safe": "^1.1.0", "mocha": "^4.1.0", "npm-run-all": "^4.1.2", diff --git a/packages/forwarder-helper/src/forwarder_helper_impl.ts b/packages/forwarder-helper/src/forwarder_helper_impl.ts index e69de29bb..1069bca73 100644 --- a/packages/forwarder-helper/src/forwarder_helper_impl.ts +++ b/packages/forwarder-helper/src/forwarder_helper_impl.ts @@ -0,0 +1,50 @@ +import { SignedOrder } from '@0xproject/types'; +import { BigNumber } from '@0xproject/utils'; + +import { + ForwarderHelper, + MarketBuyOrdersInfo, + MarketBuyOrdersInfoRequest, + MarketSellOrdersInfo, + MarketSellOrdersInfoRequest, +} from './types'; + +export class ForwarderHelperImpl implements ForwarderHelper { + private _orders: SignedOrder[]; + private _feeOrders: SignedOrder[]; + private _remainingFillableMakerAssetAmountsIfExists?: BigNumber[]; + private _remainingFillableFeeAmountsIfExists?: BigNumber[]; + constructor( + orders: SignedOrder[], + feeOrders: SignedOrder[] = [] as SignedOrder[], + remainingFillableMakerAssetAmounts?: BigNumber[], + remainingFillableFeeAmounts?: BigNumber[], + ) { + this._orders = orders; + this._feeOrders = feeOrders; + this._remainingFillableMakerAssetAmountsIfExists = remainingFillableMakerAssetAmounts; + this._remainingFillableFeeAmountsIfExists = remainingFillableFeeAmounts; + } + public getMarketBuyOrdersInfo(request: MarketBuyOrdersInfoRequest): MarketBuyOrdersInfo { + const { makerAssetFillAmount, feePercentage, acceptableEthAmountRange } = request; + return { + makerAssetFillAmount, + orders: this._orders, + feeOrders: this._feeOrders, + minEthAmount: new BigNumber(0), + maxEthAmount: new BigNumber(0), + feePercentage, + }; + } + public getMarketSellOrdersInfo(request: MarketSellOrdersInfoRequest): MarketSellOrdersInfo { + const { ethAmount, feePercentage, acceptableFillAmountRange } = request; + return { + ethAmount, + orders: this._orders, + feeOrders: this._feeOrders, + minFillAmount: new BigNumber(0), + maxFillAmount: new BigNumber(0), + feePercentage, + }; + } +} diff --git a/packages/forwarder-helper/src/types.ts b/packages/forwarder-helper/src/types.ts index 23eaa1281..c6d4083a9 100644 --- a/packages/forwarder-helper/src/types.ts +++ b/packages/forwarder-helper/src/types.ts @@ -46,9 +46,9 @@ export interface MarketBuyOrdersInfo { makerAssetFillAmount: BigNumber; orders: SignedOrder[]; feeOrders: SignedOrder[]; - feePercentage?: BigNumber; minEthAmount: BigNumber; maxEthAmount: BigNumber; + feePercentage?: BigNumber; } /** -- cgit From 3c973ba9f64197fcc1a66f319e3d1aa33d96b6d7 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Fri, 17 Aug 2018 00:15:52 -0700 Subject: Remove marketSell and add to marketBuy implementation --- packages/forwarder-helper/src/constants.ts | 5 ++ .../forwarder-helper/src/forwarder_helper_impl.ts | 60 +++++++++++++--------- packages/forwarder-helper/src/types.ts | 37 ------------- packages/order-utils/CHANGELOG.json | 4 ++ packages/order-utils/src/market_utils.ts | 4 +- 5 files changed, 48 insertions(+), 62 deletions(-) create mode 100644 packages/forwarder-helper/src/constants.ts (limited to 'packages') diff --git a/packages/forwarder-helper/src/constants.ts b/packages/forwarder-helper/src/constants.ts new file mode 100644 index 000000000..0ad30e4c0 --- /dev/null +++ b/packages/forwarder-helper/src/constants.ts @@ -0,0 +1,5 @@ +import { BigNumber } from '@0xproject/utils'; + +export const constants = { + ZERO_AMOUNT: new BigNumber(0), +}; diff --git a/packages/forwarder-helper/src/forwarder_helper_impl.ts b/packages/forwarder-helper/src/forwarder_helper_impl.ts index 1069bca73..0d03c9f76 100644 --- a/packages/forwarder-helper/src/forwarder_helper_impl.ts +++ b/packages/forwarder-helper/src/forwarder_helper_impl.ts @@ -1,13 +1,11 @@ +import { marketUtils } from '@0xproject/order-utils'; import { SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; -import { - ForwarderHelper, - MarketBuyOrdersInfo, - MarketBuyOrdersInfoRequest, - MarketSellOrdersInfo, - MarketSellOrdersInfoRequest, -} from './types'; +import { constants } from './constants'; +import { ForwarderHelper, ForwarderHelperError, MarketBuyOrdersInfo, MarketBuyOrdersInfoRequest } from './types'; + +const SLIPPAGE_PERCENTAGE = new BigNumber(0.2); // 20% slippage protection, possibly move this into request interface export class ForwarderHelperImpl implements ForwarderHelper { private _orders: SignedOrder[]; @@ -26,24 +24,40 @@ export class ForwarderHelperImpl implements ForwarderHelper { this._remainingFillableFeeAmountsIfExists = remainingFillableFeeAmounts; } public getMarketBuyOrdersInfo(request: MarketBuyOrdersInfoRequest): MarketBuyOrdersInfo { - const { makerAssetFillAmount, feePercentage, acceptableEthAmountRange } = request; - return { + const { makerAssetFillAmount, feePercentage } = request; + // TODO: make the slippage percentage customizable + const slippageBufferAmount = makerAssetFillAmount.mul(SLIPPAGE_PERCENTAGE); + const { resultOrders, remainingFillAmount } = marketUtils.findOrdersThatCoverMakerAssetFillAmount( + this._orders, makerAssetFillAmount, - orders: this._orders, - feeOrders: this._feeOrders, - minEthAmount: new BigNumber(0), - maxEthAmount: new BigNumber(0), - feePercentage, - }; - } - public getMarketSellOrdersInfo(request: MarketSellOrdersInfoRequest): MarketSellOrdersInfo { - const { ethAmount, feePercentage, acceptableFillAmountRange } = request; + { + remainingFillableMakerAssetAmounts: this._remainingFillableMakerAssetAmountsIfExists, + slippageBufferAmount, + }, + ); + if (remainingFillAmount.gt(constants.ZERO_AMOUNT)) { + throw new Error(ForwarderHelperError.InsufficientLiquidity); + } + // TODO: update this logic to find the minimum amount of feeOrders to cover the worst case as opposed to + // finding order that cover all fees, this will help with estimating ETH and minimizing gas usage + const { resultFeeOrders, remainingFeeAmount } = marketUtils.findFeeOrdersThatCoverFeesForTargetOrders( + resultOrders, + this._feeOrders, + { + remainingFillableMakerAssetAmounts: this._remainingFillableMakerAssetAmountsIfExists, + remainingFillableFeeAmounts: this._remainingFillableFeeAmountsIfExists, + }, + ); + if (remainingFeeAmount.gt(constants.ZERO_AMOUNT)) { + throw new Error(ForwarderHelperError.InsufficientZrxLiquidity); + } + // TODO: calculate min and max eth usage return { - ethAmount, - orders: this._orders, - feeOrders: this._feeOrders, - minFillAmount: new BigNumber(0), - maxFillAmount: new BigNumber(0), + makerAssetFillAmount, + orders: resultOrders, + feeOrders: resultFeeOrders, + minEthAmount: constants.ZERO_AMOUNT, + maxEthAmount: constants.ZERO_AMOUNT, feePercentage, }; } diff --git a/packages/forwarder-helper/src/types.ts b/packages/forwarder-helper/src/types.ts index c6d4083a9..084c3303e 100644 --- a/packages/forwarder-helper/src/types.ts +++ b/packages/forwarder-helper/src/types.ts @@ -9,13 +9,6 @@ export interface ForwarderHelper { * @return An object that conforms to MarketBuyOrdersInfo that satisfies the request. See type definition for more information. */ getMarketBuyOrdersInfo: (request: MarketBuyOrdersInfoRequest) => MarketBuyOrdersInfo; - /** - * Given a MarketSellOrdersInfoRequest, returns a MarketSellOrdersInfo containing all information relevant to fulfilling the request - * using the ForwarderContract marketSellOrdersWithEth function. - * @param request An object that conforms to MarketSellOrdersInfoRequest. See type definition for more information. - * @return An object that conforms to MarketSellOrdersInfo that satisfies the request. See type definition for more information. - */ - getMarketSellOrdersInfo: (request: MarketSellOrdersInfoRequest) => MarketSellOrdersInfo; } export enum ForwarderHelperError { @@ -26,12 +19,10 @@ export enum ForwarderHelperError { /** * makerAssetFillAmount: The amount of makerAsset requesting to be filled * feePercentage: Optional affiliate percentage amount factoring into eth amount calculations - * acceptableEthAmountRange: maximum difference between min and max eth cost */ export interface MarketBuyOrdersInfoRequest { makerAssetFillAmount: BigNumber; feePercentage?: BigNumber; - acceptableEthAmountRange?: BigNumber; } /** @@ -50,31 +41,3 @@ export interface MarketBuyOrdersInfo { maxEthAmount: BigNumber; feePercentage?: BigNumber; } - -/** - * ethAmount: The amount of eth used to fill - * feePercentage: Optional affiliate percentage amount factoring into eth amount calculations - * acceptableFillAmountRange: maximum difference between min and max asset filled - */ -export interface MarketSellOrdersInfoRequest { - ethAmount: BigNumber; - feePercentage?: BigNumber; - acceptableFillAmountRange?: BigNumber; -} - -/** - * ethAmount: The amount of eth used to fill - * orders: An array of objects conforming to SignedOrder. These orders can be used to cover the requested ethAmount plus slippage - * feeOrders: An array of objects conforming to SignedOrder. These orders can be used to cover the fees for the orders param above - * minFillAmount: Amount of asset purchased in the worst case - * maxFillAmount: Amount of asset purchased in the best case - * feePercentage: Affiliate fee percentage used to calculate the eth amounts above. Passed thru directly from the request - */ -export interface MarketSellOrdersInfo { - ethAmount: BigNumber; - orders: SignedOrder[]; - feeOrders: SignedOrder[]; - minFillAmount: BigNumber; - maxFillAmount: BigNumber; - feePercentage?: BigNumber; -} diff --git a/packages/order-utils/CHANGELOG.json b/packages/order-utils/CHANGELOG.json index 86f0da65a..4acb3d233 100644 --- a/packages/order-utils/CHANGELOG.json +++ b/packages/order-utils/CHANGELOG.json @@ -14,6 +14,10 @@ "note": "Update marketUtils api such that all optional parameters are bundled into one optional param and more defaults are provided", "pr": 954 + }, + { + "note": + "Rename `resultOrders` to `resultFeeOrders` for object returned by `findFeeOrdersThatCoverFeesForTargetOrders` in `marketUtils` api" } ] }, diff --git a/packages/order-utils/src/market_utils.ts b/packages/order-utils/src/market_utils.ts index a0a827546..7eae4c8fc 100644 --- a/packages/order-utils/src/market_utils.ts +++ b/packages/order-utils/src/market_utils.ts @@ -84,7 +84,7 @@ export const marketUtils = { orders: T[], feeOrders: T[], opts?: FindFeeOrdersThatCoverFeesForTargetOrdersOpts, - ): { resultOrders: T[]; remainingFeeAmount: BigNumber } { + ): { resultFeeOrders: T[]; remainingFeeAmount: BigNumber } { assert.doesConformToSchema('orders', orders, schemas.ordersSchema); assert.doesConformToSchema('feeOrders', feeOrders, schemas.ordersSchema); // try to get remainingFillableMakerAssetAmounts from opts, if it's not there, use makerAssetAmount values from orders @@ -137,7 +137,7 @@ export const marketUtils = { }, ); return { - resultOrders, + resultFeeOrders: resultOrders, remainingFeeAmount: remainingFillAmount, }; // TODO: add more orders here to cover rounding -- cgit From e8a1950a7489e83f7f1a1127ee325f0c5c36483c Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Fri, 17 Aug 2018 13:00:54 -0700 Subject: Add ForwarderHelperImplConfig --- packages/forwarder-helper/package.json | 15 ++-- .../forwarder-helper/src/forwarder_helper_impl.ts | 94 +++++++++++++++++----- packages/order-utils/CHANGELOG.json | 3 + packages/order-utils/src/sorting_utils.ts | 2 +- packages/order-utils/test/market_utils_test.ts | 24 +++--- 5 files changed, 100 insertions(+), 38 deletions(-) (limited to 'packages') diff --git a/packages/forwarder-helper/package.json b/packages/forwarder-helper/package.json index e79154a52..d5f6c52b6 100644 --- a/packages/forwarder-helper/package.json +++ b/packages/forwarder-helper/package.json @@ -15,21 +15,22 @@ "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", "test:circleci": "yarn test:coverage", - "run_mocha": - "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --exit", + "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --exit", "clean": "shx rm -rf lib test_temp scripts", "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", "manual:postpublish": "yarn build; node ./scripts/postpublish.js", "docs:stage": "node scripts/stage_docs.js", "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES", - "upload_docs_json": - "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json" + "upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json" }, "config": { "postpublish": { "assets": [], "docPublishConfigs": { - "extraFileIncludes": ["../types/src/index.ts", "../ethereum-types/src/index.ts"], + "extraFileIncludes": [ + "../types/src/index.ts", + "../ethereum-types/src/index.ts" + ], "s3BucketPath": "s3://doc-jsons/forwarder-helper/", "s3StagingBucketPath": "s3://staging-doc-jsons/forwarder-helper/" } @@ -50,11 +51,13 @@ "@0xproject/types": "^1.0.1-rc.4", "@0xproject/typescript-typings": "^1.0.4", "@0xproject/utils": "^1.0.5", - "@types/node": "^8.0.53" + "@types/node": "^8.0.53", + "lodash": "^4.17.10" }, "devDependencies": { "@0xproject/monorepo-scripts": "^1.0.5", "@0xproject/tslint-config": "^1.0.5", + "@types/lodash": "^4.14.116", "@types/mocha": "^2.2.42", "chai": "^4.0.1", "chai-as-promised": "^7.1.0", diff --git a/packages/forwarder-helper/src/forwarder_helper_impl.ts b/packages/forwarder-helper/src/forwarder_helper_impl.ts index 0d03c9f76..8f4ec1c02 100644 --- a/packages/forwarder-helper/src/forwarder_helper_impl.ts +++ b/packages/forwarder-helper/src/forwarder_helper_impl.ts @@ -1,37 +1,93 @@ -import { marketUtils } from '@0xproject/order-utils'; +import { marketUtils, sortingUtils } from '@0xproject/order-utils'; import { SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; +import * as _ from 'lodash'; import { constants } from './constants'; import { ForwarderHelper, ForwarderHelperError, MarketBuyOrdersInfo, MarketBuyOrdersInfoRequest } from './types'; const SLIPPAGE_PERCENTAGE = new BigNumber(0.2); // 20% slippage protection, possibly move this into request interface +interface SignedOrderWithAmount extends SignedOrder { + remainingFillAmount?: BigNumber; +} + +export interface ForwarderHelperImplConfig { + orders: SignedOrder[]; + feeOrders: SignedOrder[]; + remainingFillableMakerAssetAmounts?: BigNumber[]; + remainingFillableFeeAmounts?: BigNumber[]; +} + export class ForwarderHelperImpl implements ForwarderHelper { - private _orders: SignedOrder[]; - private _feeOrders: SignedOrder[]; - private _remainingFillableMakerAssetAmountsIfExists?: BigNumber[]; - private _remainingFillableFeeAmountsIfExists?: BigNumber[]; - constructor( + private _config: ForwarderHelperImplConfig; + private static _createSignedOrderWithAmounts( orders: SignedOrder[], - feeOrders: SignedOrder[] = [] as SignedOrder[], - remainingFillableMakerAssetAmounts?: BigNumber[], - remainingFillableFeeAmounts?: BigNumber[], - ) { - this._orders = orders; - this._feeOrders = feeOrders; - this._remainingFillableMakerAssetAmountsIfExists = remainingFillableMakerAssetAmounts; - this._remainingFillableFeeAmountsIfExists = remainingFillableFeeAmounts; + amounts?: BigNumber[], + ): SignedOrderWithAmount[] { + const ordersAndAmounts = _.map(orders, (order, index) => { + return { + ...order, + remainingFillAmount: _.nth(amounts, index), + }; + }); + return ordersAndAmounts; + } + private static _unbundleSignedOrderWithAmounts( + signedOrderWithAmounts: SignedOrderWithAmount[], + ): { orders: SignedOrder[]; amounts?: BigNumber[] } { + const orders = _.map(signedOrderWithAmounts, order => { + const { remainingFillAmount, ...rest } = order; + return rest; + }); + const amounts = _.map(signedOrderWithAmounts, order => { + const { remainingFillAmount, ...rest } = order; + return remainingFillAmount; + }); + const compactAmounts = _.compact(amounts); + return { + orders, + amounts: compactAmounts.length > 0 ? compactAmounts : undefined, + }; + } + private static _sortConfig(opts: ForwarderHelperImplConfig): ForwarderHelperImplConfig { + const { orders, feeOrders, remainingFillableMakerAssetAmounts, remainingFillableFeeAmounts } = opts; + const orderWithAmounts = ForwarderHelperImpl._createSignedOrderWithAmounts( + orders, + remainingFillableMakerAssetAmounts, + ); + const sortedOrderWithAmounts = sortingUtils.sortOrdersByFeeAdjustedRate(orderWithAmounts); + const unbundledSortedOrderWithAmounts = ForwarderHelperImpl._unbundleSignedOrderWithAmounts( + sortedOrderWithAmounts, + ); + const feeOrderWithAmounts = ForwarderHelperImpl._createSignedOrderWithAmounts( + feeOrders, + remainingFillableFeeAmounts, + ); + const sortedFeeOrderWithAmounts = sortingUtils.sortFeeOrdersByFeeAdjustedRate(feeOrderWithAmounts); + const unbundledSortedFeeOrderWithAmounts = ForwarderHelperImpl._unbundleSignedOrderWithAmounts( + sortedFeeOrderWithAmounts, + ); + return { + orders: unbundledSortedOrderWithAmounts.orders, + feeOrders: unbundledSortedFeeOrderWithAmounts.orders, + remainingFillableMakerAssetAmounts: unbundledSortedOrderWithAmounts.amounts, + remainingFillableFeeAmounts: unbundledSortedFeeOrderWithAmounts.amounts, + }; + } + constructor(opts: ForwarderHelperImplConfig) { + this._config = ForwarderHelperImpl._sortConfig(opts); } public getMarketBuyOrdersInfo(request: MarketBuyOrdersInfoRequest): MarketBuyOrdersInfo { const { makerAssetFillAmount, feePercentage } = request; + const { orders, feeOrders, remainingFillableMakerAssetAmounts, remainingFillableFeeAmounts } = this._config; // TODO: make the slippage percentage customizable const slippageBufferAmount = makerAssetFillAmount.mul(SLIPPAGE_PERCENTAGE); const { resultOrders, remainingFillAmount } = marketUtils.findOrdersThatCoverMakerAssetFillAmount( - this._orders, + orders, makerAssetFillAmount, { - remainingFillableMakerAssetAmounts: this._remainingFillableMakerAssetAmountsIfExists, + remainingFillableMakerAssetAmounts, slippageBufferAmount, }, ); @@ -42,10 +98,10 @@ export class ForwarderHelperImpl implements ForwarderHelper { // finding order that cover all fees, this will help with estimating ETH and minimizing gas usage const { resultFeeOrders, remainingFeeAmount } = marketUtils.findFeeOrdersThatCoverFeesForTargetOrders( resultOrders, - this._feeOrders, + feeOrders, { - remainingFillableMakerAssetAmounts: this._remainingFillableMakerAssetAmountsIfExists, - remainingFillableFeeAmounts: this._remainingFillableFeeAmountsIfExists, + remainingFillableMakerAssetAmounts, + remainingFillableFeeAmounts, }, ); if (remainingFeeAmount.gt(constants.ZERO_AMOUNT)) { diff --git a/packages/order-utils/CHANGELOG.json b/packages/order-utils/CHANGELOG.json index 4acb3d233..c4260bc2f 100644 --- a/packages/order-utils/CHANGELOG.json +++ b/packages/order-utils/CHANGELOG.json @@ -18,6 +18,9 @@ { "note": "Rename `resultOrders` to `resultFeeOrders` for object returned by `findFeeOrdersThatCoverFeesForTargetOrders` in `marketUtils` api" + }, + { + "note": "Make `sortFeeOrdersByFeeAdjustedRate` in `sortingUtils` generic" } ] }, diff --git a/packages/order-utils/src/sorting_utils.ts b/packages/order-utils/src/sorting_utils.ts index 8811bcaf8..cd5163cf6 100644 --- a/packages/order-utils/src/sorting_utils.ts +++ b/packages/order-utils/src/sorting_utils.ts @@ -32,7 +32,7 @@ export const sortingUtils = { * the makerAsset and WETH as the takerAsset. * @return The input orders sorted by rate in ascending order */ - sortFeeOrdersByFeeAdjustedRate(feeOrders: Order[]): Order[] { + sortFeeOrdersByFeeAdjustedRate(feeOrders: T[]): T[] { assert.doesConformToSchema('feeOrders', feeOrders, schemas.ordersSchema); const rateCalculator = rateUtils.getFeeAdjustedRateOfFeeOrder.bind(rateUtils); const sortedOrders = sortOrders(feeOrders, rateCalculator); diff --git a/packages/order-utils/test/market_utils_test.ts b/packages/order-utils/test/market_utils_test.ts index 109420a02..0c0151e57 100644 --- a/packages/order-utils/test/market_utils_test.ts +++ b/packages/order-utils/test/market_utils_test.ts @@ -139,11 +139,11 @@ describe('marketUtils', () => { ); describe('no target orders', () => { it('returns empty and zero remainingFeeAmount', async () => { - const { resultOrders, remainingFeeAmount } = marketUtils.findFeeOrdersThatCoverFeesForTargetOrders( + const { resultFeeOrders, remainingFeeAmount } = marketUtils.findFeeOrdersThatCoverFeesForTargetOrders( [], inputFeeOrders, ); - expect(resultOrders).to.be.empty; + expect(resultFeeOrders).to.be.empty; expect(remainingFeeAmount).to.be.bignumber.equal(constants.ZERO_AMOUNT); }); }); @@ -162,14 +162,14 @@ describe('marketUtils', () => { // generate remainingFillableMakerAssetAmounts that equal the makerAssetAmount const remainingFillableMakerAssetAmounts = [makerAssetAmount, makerAssetAmount, makerAssetAmount]; it('returns empty and non-zero remainingFeeAmount', async () => { - const { resultOrders, remainingFeeAmount } = marketUtils.findFeeOrdersThatCoverFeesForTargetOrders( + const { resultFeeOrders, remainingFeeAmount } = marketUtils.findFeeOrdersThatCoverFeesForTargetOrders( inputOrders, [], { remainingFillableMakerAssetAmounts, }, ); - expect(resultOrders).to.be.empty; + expect(resultFeeOrders).to.be.empty; expect(remainingFeeAmount).to.be.bignumber.equal(new BigNumber(30)); }); }); @@ -183,11 +183,11 @@ describe('marketUtils', () => { 3, ); it('returns empty and zero remainingFeeAmount', async () => { - const { resultOrders, remainingFeeAmount } = marketUtils.findFeeOrdersThatCoverFeesForTargetOrders( + const { resultFeeOrders, remainingFeeAmount } = marketUtils.findFeeOrdersThatCoverFeesForTargetOrders( inputOrders, inputFeeOrders, ); - expect(resultOrders).to.be.empty; + expect(resultFeeOrders).to.be.empty; expect(remainingFeeAmount).to.be.bignumber.equal(constants.ZERO_AMOUNT); }); }); @@ -204,11 +204,11 @@ describe('marketUtils', () => { 3, ); it('returns input fee orders and zero remainingFeeAmount', async () => { - const { resultOrders, remainingFeeAmount } = marketUtils.findFeeOrdersThatCoverFeesForTargetOrders( + const { resultFeeOrders, remainingFeeAmount } = marketUtils.findFeeOrdersThatCoverFeesForTargetOrders( inputOrders, inputFeeOrders, ); - expect(resultOrders).to.be.deep.equal(inputFeeOrders); + expect(resultFeeOrders).to.be.deep.equal(inputFeeOrders); expect(remainingFeeAmount).to.be.bignumber.equal(constants.ZERO_AMOUNT); }); }); @@ -230,14 +230,14 @@ describe('marketUtils', () => { // 3. order is completely fillable const remainingFillableMakerAssetAmounts = [constants.ZERO_AMOUNT, new BigNumber(5), makerAssetAmount]; it('returns first two input fee orders and zero remainingFeeAmount', async () => { - const { resultOrders, remainingFeeAmount } = marketUtils.findFeeOrdersThatCoverFeesForTargetOrders( + const { resultFeeOrders, remainingFeeAmount } = marketUtils.findFeeOrdersThatCoverFeesForTargetOrders( inputOrders, inputFeeOrders, { remainingFillableMakerAssetAmounts, }, ); - expect(resultOrders).to.be.deep.equal([inputFeeOrders[0], inputFeeOrders[1]]); + expect(resultFeeOrders).to.be.deep.equal([inputFeeOrders[0], inputFeeOrders[1]]); expect(remainingFeeAmount).to.be.bignumber.equal(constants.ZERO_AMOUNT); }); }); @@ -254,11 +254,11 @@ describe('marketUtils', () => { 3, ); it('returns input fee orders and non-zero remainingFeeAmount', async () => { - const { resultOrders, remainingFeeAmount } = marketUtils.findFeeOrdersThatCoverFeesForTargetOrders( + const { resultFeeOrders, remainingFeeAmount } = marketUtils.findFeeOrdersThatCoverFeesForTargetOrders( inputOrders, inputFeeOrders, ); - expect(resultOrders).to.be.deep.equal(inputFeeOrders); + expect(resultFeeOrders).to.be.deep.equal(inputFeeOrders); expect(remainingFeeAmount).to.be.bignumber.equal(new BigNumber(30)); }); }); -- cgit From 7e0e195c88c407f030754b6050b07698d1868d24 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Fri, 17 Aug 2018 14:00:53 -0700 Subject: Make config public readonly --- packages/forwarder-helper/src/forwarder_helper_impl.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'packages') diff --git a/packages/forwarder-helper/src/forwarder_helper_impl.ts b/packages/forwarder-helper/src/forwarder_helper_impl.ts index 8f4ec1c02..39e84b477 100644 --- a/packages/forwarder-helper/src/forwarder_helper_impl.ts +++ b/packages/forwarder-helper/src/forwarder_helper_impl.ts @@ -20,7 +20,7 @@ export interface ForwarderHelperImplConfig { } export class ForwarderHelperImpl implements ForwarderHelper { - private _config: ForwarderHelperImplConfig; + public readonly config: ForwarderHelperImplConfig; private static _createSignedOrderWithAmounts( orders: SignedOrder[], amounts?: BigNumber[], @@ -76,11 +76,11 @@ export class ForwarderHelperImpl implements ForwarderHelper { }; } constructor(opts: ForwarderHelperImplConfig) { - this._config = ForwarderHelperImpl._sortConfig(opts); + this.config = ForwarderHelperImpl._sortConfig(opts); } public getMarketBuyOrdersInfo(request: MarketBuyOrdersInfoRequest): MarketBuyOrdersInfo { const { makerAssetFillAmount, feePercentage } = request; - const { orders, feeOrders, remainingFillableMakerAssetAmounts, remainingFillableFeeAmounts } = this._config; + const { orders, feeOrders, remainingFillableMakerAssetAmounts, remainingFillableFeeAmounts } = this.config; // TODO: make the slippage percentage customizable const slippageBufferAmount = makerAssetFillAmount.mul(SLIPPAGE_PERCENTAGE); const { resultOrders, remainingFillAmount } = marketUtils.findOrdersThatCoverMakerAssetFillAmount( -- cgit From c2454d142841aa3a78a489f055692233f2fa93de Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Tue, 21 Aug 2018 13:52:27 -0700 Subject: Add more TODO items --- packages/forwarder-helper/src/forwarder_helper_impl.ts | 2 ++ 1 file changed, 2 insertions(+) (limited to 'packages') diff --git a/packages/forwarder-helper/src/forwarder_helper_impl.ts b/packages/forwarder-helper/src/forwarder_helper_impl.ts index 39e84b477..43b2962da 100644 --- a/packages/forwarder-helper/src/forwarder_helper_impl.ts +++ b/packages/forwarder-helper/src/forwarder_helper_impl.ts @@ -56,6 +56,7 @@ export class ForwarderHelperImpl implements ForwarderHelper { orders, remainingFillableMakerAssetAmounts, ); + // TODO: provide a feeRate to the sorting function to more accurately sort based on the current market for ZRX tokens const sortedOrderWithAmounts = sortingUtils.sortOrdersByFeeAdjustedRate(orderWithAmounts); const unbundledSortedOrderWithAmounts = ForwarderHelperImpl._unbundleSignedOrderWithAmounts( sortedOrderWithAmounts, @@ -108,6 +109,7 @@ export class ForwarderHelperImpl implements ForwarderHelper { throw new Error(ForwarderHelperError.InsufficientZrxLiquidity); } // TODO: calculate min and max eth usage + // TODO: optimize orders call data return { makerAssetFillAmount, orders: resultOrders, -- cgit From 05ba049f5937be3a3a47ed90898f6a0267a67fd8 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Tue, 21 Aug 2018 14:45:16 -0700 Subject: Add test for sorting that happens in constructor --- .../test/forwarder_helper_impl_test.ts | 87 +++++++++++++++++++++- 1 file changed, 85 insertions(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/forwarder-helper/test/forwarder_helper_impl_test.ts b/packages/forwarder-helper/test/forwarder_helper_impl_test.ts index 1d3347d48..150ba5f0b 100644 --- a/packages/forwarder-helper/test/forwarder_helper_impl_test.ts +++ b/packages/forwarder-helper/test/forwarder_helper_impl_test.ts @@ -1,12 +1,95 @@ +import { testOrderFactory } from '@0xproject/order-utils/lib/test/utils/test_order_factory'; +import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; +import * as _ from 'lodash'; import 'mocha'; +import { ForwarderHelperImpl, ForwarderHelperImplConfig } from '../src/forwarder_helper_impl'; + import { chaiSetup } from './utils/chai_setup'; chaiSetup.configure(); const expect = chai.expect; describe('ForwarderHelperImpl', () => { - describe('#getMarketBuyOrdersInfo', () => {}); - describe('#getMarketSellOrdersInfo', () => {}); + // rate: 2 takerAsset / makerAsset + const testOrder1 = testOrderFactory.generateTestSignedOrder({ + makerAssetAmount: new BigNumber(100), + takerAssetAmount: new BigNumber(200), + }); + // rate: 1 takerAsset / makerAsset + const testOrder2 = testOrderFactory.generateTestSignedOrder({ + makerAssetAmount: new BigNumber(100), + takerAssetAmount: new BigNumber(100), + }); + // rate: 3 takerAsset / makerAsset + const testOrder3 = testOrderFactory.generateTestSignedOrder({ + makerAssetAmount: new BigNumber(100), + takerAssetAmount: new BigNumber(300), + }); + // rate: 3 WETH / ZRX + const testFeeOrder1 = testOrderFactory.generateTestSignedOrder({ + makerAssetAmount: new BigNumber(100), + takerAssetAmount: new BigNumber(300), + }); + // rate: 2 WETH / ZRX + const testFeeOrder2 = testOrderFactory.generateTestSignedOrder({ + makerAssetAmount: new BigNumber(100), + takerAssetAmount: new BigNumber(200), + }); + // rate: 1 WETH / ZRX + const testFeeOrder3 = testOrderFactory.generateTestSignedOrder({ + makerAssetAmount: new BigNumber(100), + takerAssetAmount: new BigNumber(100), + }); + describe('#constructor', () => { + const inputForwarderHelperConfig: ForwarderHelperImplConfig = { + orders: [testOrder1, testOrder2, testOrder3], + feeOrders: [testFeeOrder1, testFeeOrder2, testFeeOrder3], + remainingFillableMakerAssetAmounts: [new BigNumber(1), new BigNumber(2), new BigNumber(3)], + remainingFillableFeeAmounts: [new BigNumber(4), new BigNumber(5), new BigNumber(6)], + }; + const inputForwarderHelperConfigNoRemainingAmounts: ForwarderHelperImplConfig = { + orders: [testOrder1, testOrder2, testOrder3], + feeOrders: [testFeeOrder1, testFeeOrder2, testFeeOrder3], + }; + it('sorts orders', () => { + const forwarderHelper = new ForwarderHelperImpl(inputForwarderHelperConfig); + expect(forwarderHelper.config.orders).deep.equals([testOrder2, testOrder1, testOrder3]); + }); + it('sorts fee orders', () => { + const forwarderHelper = new ForwarderHelperImpl(inputForwarderHelperConfig); + expect(forwarderHelper.config.feeOrders).deep.equals([testFeeOrder3, testFeeOrder2, testFeeOrder1]); + }); + it('sorts remainingFillableMakerAssetAmounts', () => { + const forwarderHelper = new ForwarderHelperImpl(inputForwarderHelperConfig); + expect(forwarderHelper.config.remainingFillableMakerAssetAmounts).to.be.not.undefined(); + expect(_.nth(forwarderHelper.config.remainingFillableMakerAssetAmounts, 0)).to.bignumber.equal( + new BigNumber(2), + ); + expect(_.nth(forwarderHelper.config.remainingFillableMakerAssetAmounts, 1)).to.bignumber.equal( + new BigNumber(1), + ); + expect(_.nth(forwarderHelper.config.remainingFillableMakerAssetAmounts, 2)).to.bignumber.equal( + new BigNumber(3), + ); + }); + it('sorts remainingFillableFeeAmounts', () => { + const forwarderHelper = new ForwarderHelperImpl(inputForwarderHelperConfig); + expect(forwarderHelper.config.remainingFillableFeeAmounts).to.be.not.undefined(); + expect(_.nth(forwarderHelper.config.remainingFillableFeeAmounts, 0)).to.bignumber.equal(new BigNumber(6)); + expect(_.nth(forwarderHelper.config.remainingFillableFeeAmounts, 1)).to.bignumber.equal(new BigNumber(5)); + expect(_.nth(forwarderHelper.config.remainingFillableFeeAmounts, 2)).to.bignumber.equal(new BigNumber(4)); + }); + it('remainingFillableMakerAssetAmounts is undefined if none provided', () => { + const forwarderHelper = new ForwarderHelperImpl(inputForwarderHelperConfigNoRemainingAmounts); + expect(forwarderHelper.config.remainingFillableMakerAssetAmounts).to.be.undefined(); + }); + it('remainingFillableFeeAmounts is undefined if none provided', () => { + const forwarderHelper = new ForwarderHelperImpl(inputForwarderHelperConfigNoRemainingAmounts); + expect(forwarderHelper.config.remainingFillableFeeAmounts).to.be.undefined(); + }); + }); + // describe('#getMarketBuyOrdersInfo', () => {}); + // describe('#getMarketSellOrdersInfo', () => {}); }); -- cgit From 67d33ec10c3d2467d2d073d22bfe2957353a0cc8 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Tue, 21 Aug 2018 17:07:14 -0700 Subject: Fix rounding bug in marketUtils --- packages/order-utils/CHANGELOG.json | 11 +++++++++-- packages/order-utils/src/market_utils.ts | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'packages') diff --git a/packages/order-utils/CHANGELOG.json b/packages/order-utils/CHANGELOG.json index c4260bc2f..55e0b499e 100644 --- a/packages/order-utils/CHANGELOG.json +++ b/packages/order-utils/CHANGELOG.json @@ -17,10 +17,17 @@ }, { "note": - "Rename `resultOrders` to `resultFeeOrders` for object returned by `findFeeOrdersThatCoverFeesForTargetOrders` in `marketUtils` api" + "Rename `resultOrders` to `resultFeeOrders` for object returned by `findFeeOrdersThatCoverFeesForTargetOrders` in `marketUtils` api", + "pr": 954 + }, + { + "note": "Make `sortFeeOrdersByFeeAdjustedRate` in `sortingUtils` generic", + "pr": 954 }, { - "note": "Make `sortFeeOrdersByFeeAdjustedRate` in `sortingUtils` generic" + "note": + "Update `findFeeOrdersThatCoverFeesForTargetOrders` to round the the nearest integer when calculating required fees", + "pr": 954 } ] }, diff --git a/packages/order-utils/src/market_utils.ts b/packages/order-utils/src/market_utils.ts index 7eae4c8fc..b31a2b135 100644 --- a/packages/order-utils/src/market_utils.ts +++ b/packages/order-utils/src/market_utils.ts @@ -123,7 +123,7 @@ export const marketUtils = { const makerAssetAmountAvailable = remainingFillableMakerAssetAmounts[index]; const feeToFillMakerAssetAmountAvailable = makerAssetAmountAvailable .mul(order.takerFee) - .div(order.makerAssetAmount); + .dividedToIntegerBy(order.makerAssetAmount); return accFees.plus(feeToFillMakerAssetAmountAvailable); }, constants.ZERO_AMOUNT, -- cgit From 68dfd1bb22c1d6d33a46ca1eff5fa6f62cde62ed Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Tue, 21 Aug 2018 17:08:44 -0700 Subject: Add tests for getMarketBuyOrdersInfo --- .../forwarder-helper/src/forwarder_helper_impl.ts | 4 +- packages/forwarder-helper/src/types.ts | 2 +- .../test/forwarder_helper_impl_test.ts | 57 +++++++++++++++++++--- 3 files changed, 52 insertions(+), 11 deletions(-) (limited to 'packages') diff --git a/packages/forwarder-helper/src/forwarder_helper_impl.ts b/packages/forwarder-helper/src/forwarder_helper_impl.ts index 43b2962da..123c925f1 100644 --- a/packages/forwarder-helper/src/forwarder_helper_impl.ts +++ b/packages/forwarder-helper/src/forwarder_helper_impl.ts @@ -83,7 +83,7 @@ export class ForwarderHelperImpl implements ForwarderHelper { const { makerAssetFillAmount, feePercentage } = request; const { orders, feeOrders, remainingFillableMakerAssetAmounts, remainingFillableFeeAmounts } = this.config; // TODO: make the slippage percentage customizable - const slippageBufferAmount = makerAssetFillAmount.mul(SLIPPAGE_PERCENTAGE); + const slippageBufferAmount = makerAssetFillAmount.mul(SLIPPAGE_PERCENTAGE).round(); const { resultOrders, remainingFillAmount } = marketUtils.findOrdersThatCoverMakerAssetFillAmount( orders, makerAssetFillAmount, @@ -93,7 +93,7 @@ export class ForwarderHelperImpl implements ForwarderHelper { }, ); if (remainingFillAmount.gt(constants.ZERO_AMOUNT)) { - throw new Error(ForwarderHelperError.InsufficientLiquidity); + throw new Error(ForwarderHelperError.InsufficientMakerAssetLiquidity); } // TODO: update this logic to find the minimum amount of feeOrders to cover the worst case as opposed to // finding order that cover all fees, this will help with estimating ETH and minimizing gas usage diff --git a/packages/forwarder-helper/src/types.ts b/packages/forwarder-helper/src/types.ts index 084c3303e..fb171cc90 100644 --- a/packages/forwarder-helper/src/types.ts +++ b/packages/forwarder-helper/src/types.ts @@ -12,7 +12,7 @@ export interface ForwarderHelper { } export enum ForwarderHelperError { - InsufficientLiquidity = 'INSUFFICIENT_LIQUIDITY', + InsufficientMakerAssetLiquidity = 'INSUFFICIENT_MAKER_ASSET_LIQUIDITY', InsufficientZrxLiquidity = 'INSUFFICIENT_ZRX_LIQUIDITY', } diff --git a/packages/forwarder-helper/test/forwarder_helper_impl_test.ts b/packages/forwarder-helper/test/forwarder_helper_impl_test.ts index 150ba5f0b..3e2667a01 100644 --- a/packages/forwarder-helper/test/forwarder_helper_impl_test.ts +++ b/packages/forwarder-helper/test/forwarder_helper_impl_test.ts @@ -5,6 +5,7 @@ import * as _ from 'lodash'; import 'mocha'; import { ForwarderHelperImpl, ForwarderHelperImplConfig } from '../src/forwarder_helper_impl'; +import { ForwarderHelperError } from '../src/types'; import { chaiSetup } from './utils/chai_setup'; @@ -26,6 +27,7 @@ describe('ForwarderHelperImpl', () => { const testOrder3 = testOrderFactory.generateTestSignedOrder({ makerAssetAmount: new BigNumber(100), takerAssetAmount: new BigNumber(300), + takerFee: new BigNumber(1), }); // rate: 3 WETH / ZRX const testFeeOrder1 = testOrderFactory.generateTestSignedOrder({ @@ -42,13 +44,13 @@ describe('ForwarderHelperImpl', () => { makerAssetAmount: new BigNumber(100), takerAssetAmount: new BigNumber(100), }); + const inputForwarderHelperConfig: ForwarderHelperImplConfig = { + orders: [testOrder1, testOrder2, testOrder3], + feeOrders: [testFeeOrder1, testFeeOrder2, testFeeOrder3], + remainingFillableMakerAssetAmounts: [new BigNumber(1), new BigNumber(2), new BigNumber(3)], + remainingFillableFeeAmounts: [new BigNumber(4), new BigNumber(5), new BigNumber(6)], + }; describe('#constructor', () => { - const inputForwarderHelperConfig: ForwarderHelperImplConfig = { - orders: [testOrder1, testOrder2, testOrder3], - feeOrders: [testFeeOrder1, testFeeOrder2, testFeeOrder3], - remainingFillableMakerAssetAmounts: [new BigNumber(1), new BigNumber(2), new BigNumber(3)], - remainingFillableFeeAmounts: [new BigNumber(4), new BigNumber(5), new BigNumber(6)], - }; const inputForwarderHelperConfigNoRemainingAmounts: ForwarderHelperImplConfig = { orders: [testOrder1, testOrder2, testOrder3], feeOrders: [testFeeOrder1, testFeeOrder2, testFeeOrder3], @@ -90,6 +92,45 @@ describe('ForwarderHelperImpl', () => { expect(forwarderHelper.config.remainingFillableFeeAmounts).to.be.undefined(); }); }); - // describe('#getMarketBuyOrdersInfo', () => {}); - // describe('#getMarketSellOrdersInfo', () => {}); + describe('#getMarketBuyOrdersInfo', () => { + it('throws if not enough makerAsset liquidity', () => { + const forwarderHelper = new ForwarderHelperImpl(inputForwarderHelperConfig); + expect(() => { + // request for 6 makerAsset units, because we have exactly 6 available we should throw because there is a built in slippage buffer + const info = forwarderHelper.getMarketBuyOrdersInfo({ + makerAssetFillAmount: new BigNumber(6), + }); + }).to.throw(ForwarderHelperError.InsufficientMakerAssetLiquidity); + }); + it('throws if not enough ZRX liquidity', () => { + const inputForwarderHelperConfigNoFees: ForwarderHelperImplConfig = { + orders: [testOrder1, testOrder2, testOrder3], + feeOrders: [], + }; + const forwarderHelper = new ForwarderHelperImpl(inputForwarderHelperConfigNoFees); + expect(() => { + // request for 4 makerAsset units, we need fees but no fee orders exist, show we should throw + const info = forwarderHelper.getMarketBuyOrdersInfo({ + makerAssetFillAmount: new BigNumber(250), + }); + }).to.throw(ForwarderHelperError.InsufficientZrxLiquidity); + }); + it('passes the makerAssetFillAmount from the request to the info response', () => { + const forwarderHelper = new ForwarderHelperImpl(inputForwarderHelperConfig); + const makerAssetFillAmount = new BigNumber(4); + const info = forwarderHelper.getMarketBuyOrdersInfo({ + makerAssetFillAmount, + }); + expect(info.makerAssetFillAmount).to.bignumber.equal(makerAssetFillAmount); + }); + it('passes the feePercentage from the request to the info response', () => { + const forwarderHelper = new ForwarderHelperImpl(inputForwarderHelperConfig); + const feePercentage = new BigNumber(0.2); + const info = forwarderHelper.getMarketBuyOrdersInfo({ + makerAssetFillAmount: new BigNumber(4), + feePercentage, + }); + expect(info.feePercentage).to.bignumber.equal(feePercentage); + }); + }); }); -- cgit From 6cef847a2759864de64d79ea02368bd85039e5ad Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Tue, 21 Aug 2018 17:35:59 -0700 Subject: Write initial forwarderHelperFactory --- packages/forwarder-helper/src/forwarder_helper_factory.ts | 15 +++++++++++++++ packages/forwarder-helper/src/index.ts | 2 ++ 2 files changed, 17 insertions(+) create mode 100644 packages/forwarder-helper/src/forwarder_helper_factory.ts (limited to 'packages') diff --git a/packages/forwarder-helper/src/forwarder_helper_factory.ts b/packages/forwarder-helper/src/forwarder_helper_factory.ts new file mode 100644 index 000000000..f08e3ff04 --- /dev/null +++ b/packages/forwarder-helper/src/forwarder_helper_factory.ts @@ -0,0 +1,15 @@ +import { SignedOrder } from '@0xproject/types'; + +import { ForwarderHelperImpl, ForwarderHelperImplConfig } from './forwarder_helper_impl'; +import { ForwarderHelper } from './types'; + +export const forwarderHelperFactory = { + getForwarderHelperForOrders(orders: SignedOrder[], feeOrders: SignedOrder[] = []): ForwarderHelper { + const config: ForwarderHelperImplConfig = { + orders, + feeOrders, + }; + const helper = new ForwarderHelperImpl(config); + return helper; + }, +}; diff --git a/packages/forwarder-helper/src/index.ts b/packages/forwarder-helper/src/index.ts index e69de29bb..eb3a34bd5 100644 --- a/packages/forwarder-helper/src/index.ts +++ b/packages/forwarder-helper/src/index.ts @@ -0,0 +1,2 @@ +export { forwarderHelperFactory } from './forwarder_helper_factory'; +export { ForwarderHelper, ForwarderHelperError, MarketBuyOrdersInfoRequest, MarketBuyOrdersInfo } from './types'; -- cgit From a5c7ddcff54fcb9e88adfda15167836b00db877d Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Wed, 22 Aug 2018 14:45:44 -0700 Subject: Add more comments --- packages/forwarder-helper/src/forwarder_helper_factory.ts | 6 ++++++ packages/forwarder-helper/src/forwarder_helper_impl.ts | 3 +++ 2 files changed, 9 insertions(+) (limited to 'packages') diff --git a/packages/forwarder-helper/src/forwarder_helper_factory.ts b/packages/forwarder-helper/src/forwarder_helper_factory.ts index f08e3ff04..0fb02e3a6 100644 --- a/packages/forwarder-helper/src/forwarder_helper_factory.ts +++ b/packages/forwarder-helper/src/forwarder_helper_factory.ts @@ -4,6 +4,12 @@ import { ForwarderHelperImpl, ForwarderHelperImplConfig } from './forwarder_help import { ForwarderHelper } from './types'; export const forwarderHelperFactory = { + /** + * Given an array of orders and an array of feeOrders + * @param orders An array of objects conforming to SignedOrder. Each order should specify the same makerAssetData and takerAssetData + * @param orders An array of objects conforming to SignedOrder. Each order should specify ZRX as makerAssetData WETH as takerAssetData + * @return A ForwarderHelper, see type for definition + */ getForwarderHelperForOrders(orders: SignedOrder[], feeOrders: SignedOrder[] = []): ForwarderHelper { const config: ForwarderHelperImplConfig = { orders, diff --git a/packages/forwarder-helper/src/forwarder_helper_impl.ts b/packages/forwarder-helper/src/forwarder_helper_impl.ts index 123c925f1..f21fab9fd 100644 --- a/packages/forwarder-helper/src/forwarder_helper_impl.ts +++ b/packages/forwarder-helper/src/forwarder_helper_impl.ts @@ -52,15 +52,18 @@ export class ForwarderHelperImpl implements ForwarderHelper { } private static _sortConfig(opts: ForwarderHelperImplConfig): ForwarderHelperImplConfig { const { orders, feeOrders, remainingFillableMakerAssetAmounts, remainingFillableFeeAmounts } = opts; + // Bundle orders together with their remainingFillAmounts so that we can sort them together const orderWithAmounts = ForwarderHelperImpl._createSignedOrderWithAmounts( orders, remainingFillableMakerAssetAmounts, ); // TODO: provide a feeRate to the sorting function to more accurately sort based on the current market for ZRX tokens const sortedOrderWithAmounts = sortingUtils.sortOrdersByFeeAdjustedRate(orderWithAmounts); + // Unbundle after sorting const unbundledSortedOrderWithAmounts = ForwarderHelperImpl._unbundleSignedOrderWithAmounts( sortedOrderWithAmounts, ); + // Do the same bundling + unbundling for feeOrder sorting const feeOrderWithAmounts = ForwarderHelperImpl._createSignedOrderWithAmounts( feeOrders, remainingFillableFeeAmounts, -- cgit From b0b3f9e339cc470860f8c1080ab6dad145d70624 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Wed, 22 Aug 2018 14:58:03 -0700 Subject: Add assertions to factory --- packages/forwarder-helper/package.json | 2 ++ packages/forwarder-helper/src/forwarder_helper_factory.ts | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/forwarder-helper/package.json b/packages/forwarder-helper/package.json index d5f6c52b6..3a84e4620 100644 --- a/packages/forwarder-helper/package.json +++ b/packages/forwarder-helper/package.json @@ -47,6 +47,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/forwarder-helper/README.md", "dependencies": { + "@0xproject/assert": "^1.0.5", + "@0xproject/json-schemas": "^1.0.1-rc.4", "@0xproject/order-utils": "^1.0.1-rc.3", "@0xproject/types": "^1.0.1-rc.4", "@0xproject/typescript-typings": "^1.0.4", diff --git a/packages/forwarder-helper/src/forwarder_helper_factory.ts b/packages/forwarder-helper/src/forwarder_helper_factory.ts index 0fb02e3a6..95f11f555 100644 --- a/packages/forwarder-helper/src/forwarder_helper_factory.ts +++ b/packages/forwarder-helper/src/forwarder_helper_factory.ts @@ -1,3 +1,5 @@ +import { assert } from '@0xproject/assert'; +import { schemas } from '@0xproject/json-schemas'; import { SignedOrder } from '@0xproject/types'; import { ForwarderHelperImpl, ForwarderHelperImplConfig } from './forwarder_helper_impl'; @@ -7,10 +9,12 @@ export const forwarderHelperFactory = { /** * Given an array of orders and an array of feeOrders * @param orders An array of objects conforming to SignedOrder. Each order should specify the same makerAssetData and takerAssetData - * @param orders An array of objects conforming to SignedOrder. Each order should specify ZRX as makerAssetData WETH as takerAssetData + * @param feeOrders An array of objects conforming to SignedOrder. Each order should specify ZRX as makerAssetData WETH as takerAssetData * @return A ForwarderHelper, see type for definition */ getForwarderHelperForOrders(orders: SignedOrder[], feeOrders: SignedOrder[] = []): ForwarderHelper { + assert.doesConformToSchema('orders', orders, schemas.signedOrdersSchema); + assert.doesConformToSchema('feeOrders', orders, schemas.signedOrdersSchema); const config: ForwarderHelperImplConfig = { orders, feeOrders, -- cgit From cbcf8e8477cbb9061906866ea70dd885a185f358 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Wed, 22 Aug 2018 15:01:40 -0700 Subject: Add changelog entry and fix order-util changelog PR numbers --- packages/forwarder-helper/CHANGELOG.json | 12 +++++++++++- packages/order-utils/CHANGELOG.json | 6 +++--- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'packages') diff --git a/packages/forwarder-helper/CHANGELOG.json b/packages/forwarder-helper/CHANGELOG.json index fe51488c7..f95e7a2db 100644 --- a/packages/forwarder-helper/CHANGELOG.json +++ b/packages/forwarder-helper/CHANGELOG.json @@ -1 +1,11 @@ -[] +[ + { + "version": "1.0.0-rc.1", + "changes": [ + { + "note": "Add initial forwarderHelperFactory", + "pr": 997 + } + ] + } +] diff --git a/packages/order-utils/CHANGELOG.json b/packages/order-utils/CHANGELOG.json index 55e0b499e..149086857 100644 --- a/packages/order-utils/CHANGELOG.json +++ b/packages/order-utils/CHANGELOG.json @@ -18,16 +18,16 @@ { "note": "Rename `resultOrders` to `resultFeeOrders` for object returned by `findFeeOrdersThatCoverFeesForTargetOrders` in `marketUtils` api", - "pr": 954 + "pr": 997 }, { "note": "Make `sortFeeOrdersByFeeAdjustedRate` in `sortingUtils` generic", - "pr": 954 + "pr": 997 }, { "note": "Update `findFeeOrdersThatCoverFeesForTargetOrders` to round the the nearest integer when calculating required fees", - "pr": 954 + "pr": 997 } ] }, -- cgit From 44ca6c4b71e23162821b923d2c812bbd5dd7b078 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Wed, 22 Aug 2018 15:20:53 -0700 Subject: Fix lint errors --- packages/forwarder-helper/src/forwarder_helper_impl.ts | 2 +- packages/forwarder-helper/test/forwarder_helper_impl_test.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'packages') diff --git a/packages/forwarder-helper/src/forwarder_helper_impl.ts b/packages/forwarder-helper/src/forwarder_helper_impl.ts index f21fab9fd..0e59aa7d6 100644 --- a/packages/forwarder-helper/src/forwarder_helper_impl.ts +++ b/packages/forwarder-helper/src/forwarder_helper_impl.ts @@ -41,7 +41,7 @@ export class ForwarderHelperImpl implements ForwarderHelper { return rest; }); const amounts = _.map(signedOrderWithAmounts, order => { - const { remainingFillAmount, ...rest } = order; + const { remainingFillAmount } = order; return remainingFillAmount; }); const compactAmounts = _.compact(amounts); diff --git a/packages/forwarder-helper/test/forwarder_helper_impl_test.ts b/packages/forwarder-helper/test/forwarder_helper_impl_test.ts index 3e2667a01..3c3b6db92 100644 --- a/packages/forwarder-helper/test/forwarder_helper_impl_test.ts +++ b/packages/forwarder-helper/test/forwarder_helper_impl_test.ts @@ -97,7 +97,7 @@ describe('ForwarderHelperImpl', () => { const forwarderHelper = new ForwarderHelperImpl(inputForwarderHelperConfig); expect(() => { // request for 6 makerAsset units, because we have exactly 6 available we should throw because there is a built in slippage buffer - const info = forwarderHelper.getMarketBuyOrdersInfo({ + forwarderHelper.getMarketBuyOrdersInfo({ makerAssetFillAmount: new BigNumber(6), }); }).to.throw(ForwarderHelperError.InsufficientMakerAssetLiquidity); @@ -110,7 +110,7 @@ describe('ForwarderHelperImpl', () => { const forwarderHelper = new ForwarderHelperImpl(inputForwarderHelperConfigNoFees); expect(() => { // request for 4 makerAsset units, we need fees but no fee orders exist, show we should throw - const info = forwarderHelper.getMarketBuyOrdersInfo({ + forwarderHelper.getMarketBuyOrdersInfo({ makerAssetFillAmount: new BigNumber(250), }); }).to.throw(ForwarderHelperError.InsufficientZrxLiquidity); -- cgit From 572ad4615a3a0fa5649549cbd65eb912ea7a0e92 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Wed, 22 Aug 2018 23:02:44 -0700 Subject: Fix prettier --- packages/forwarder-helper/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) (limited to 'packages') diff --git a/packages/forwarder-helper/CHANGELOG.md b/packages/forwarder-helper/CHANGELOG.md index e69de29bb..8b1378917 100644 --- a/packages/forwarder-helper/CHANGELOG.md +++ b/packages/forwarder-helper/CHANGELOG.md @@ -0,0 +1 @@ + -- cgit From cd5c73550b969fe0a87524143ce617749935427a Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Thu, 23 Aug 2018 10:53:59 -0700 Subject: Update _sortedConfigs naming --- packages/forwarder-helper/src/forwarder_helper_impl.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'packages') diff --git a/packages/forwarder-helper/src/forwarder_helper_impl.ts b/packages/forwarder-helper/src/forwarder_helper_impl.ts index 0e59aa7d6..83dc1f4b3 100644 --- a/packages/forwarder-helper/src/forwarder_helper_impl.ts +++ b/packages/forwarder-helper/src/forwarder_helper_impl.ts @@ -50,8 +50,8 @@ export class ForwarderHelperImpl implements ForwarderHelper { amounts: compactAmounts.length > 0 ? compactAmounts : undefined, }; } - private static _sortConfig(opts: ForwarderHelperImplConfig): ForwarderHelperImplConfig { - const { orders, feeOrders, remainingFillableMakerAssetAmounts, remainingFillableFeeAmounts } = opts; + private static _sortedConfig(config: ForwarderHelperImplConfig): ForwarderHelperImplConfig { + const { orders, feeOrders, remainingFillableMakerAssetAmounts, remainingFillableFeeAmounts } = config; // Bundle orders together with their remainingFillAmounts so that we can sort them together const orderWithAmounts = ForwarderHelperImpl._createSignedOrderWithAmounts( orders, @@ -79,8 +79,8 @@ export class ForwarderHelperImpl implements ForwarderHelper { remainingFillableFeeAmounts: unbundledSortedFeeOrderWithAmounts.amounts, }; } - constructor(opts: ForwarderHelperImplConfig) { - this.config = ForwarderHelperImpl._sortConfig(opts); + constructor(config: ForwarderHelperImplConfig) { + this.config = ForwarderHelperImpl._sortedConfig(config); } public getMarketBuyOrdersInfo(request: MarketBuyOrdersInfoRequest): MarketBuyOrdersInfo { const { makerAssetFillAmount, feePercentage } = request; -- cgit From 2713cca6ac2d177c4cf3eac734ec6b55023e2ce9 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Thu, 23 Aug 2018 11:10:40 -0700 Subject: Remove legacy docs stuff --- packages/forwarder-helper/package.json | 17 +++++------------ .../src/monorepo_scripts/postpublish.ts | 8 -------- .../forwarder-helper/src/monorepo_scripts/stage_docs.ts | 8 -------- 3 files changed, 5 insertions(+), 28 deletions(-) delete mode 100644 packages/forwarder-helper/src/monorepo_scripts/postpublish.ts delete mode 100644 packages/forwarder-helper/src/monorepo_scripts/stage_docs.ts (limited to 'packages') diff --git a/packages/forwarder-helper/package.json b/packages/forwarder-helper/package.json index 3a84e4620..fcb483885 100644 --- a/packages/forwarder-helper/package.json +++ b/packages/forwarder-helper/package.json @@ -15,25 +15,19 @@ "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", "test:circleci": "yarn test:coverage", - "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --exit", + "run_mocha": + "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --exit", "clean": "shx rm -rf lib test_temp scripts", "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", "manual:postpublish": "yarn build; node ./scripts/postpublish.js", "docs:stage": "node scripts/stage_docs.js", "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES", - "upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json" + "upload_docs_json": + "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json" }, "config": { "postpublish": { - "assets": [], - "docPublishConfigs": { - "extraFileIncludes": [ - "../types/src/index.ts", - "../ethereum-types/src/index.ts" - ], - "s3BucketPath": "s3://doc-jsons/forwarder-helper/", - "s3StagingBucketPath": "s3://staging-doc-jsons/forwarder-helper/" - } + "assets": [] } }, "repository": { @@ -57,7 +51,6 @@ "lodash": "^4.17.10" }, "devDependencies": { - "@0xproject/monorepo-scripts": "^1.0.5", "@0xproject/tslint-config": "^1.0.5", "@types/lodash": "^4.14.116", "@types/mocha": "^2.2.42", diff --git a/packages/forwarder-helper/src/monorepo_scripts/postpublish.ts b/packages/forwarder-helper/src/monorepo_scripts/postpublish.ts deleted file mode 100644 index dcb99d0f7..000000000 --- a/packages/forwarder-helper/src/monorepo_scripts/postpublish.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { postpublishUtils } from '@0xproject/monorepo-scripts'; - -import * as packageJSON from '../package.json'; -import * as tsConfigJSON from '../tsconfig.json'; - -const cwd = `${__dirname}/..`; -// tslint:disable-next-line:no-floating-promises -postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/forwarder-helper/src/monorepo_scripts/stage_docs.ts b/packages/forwarder-helper/src/monorepo_scripts/stage_docs.ts deleted file mode 100644 index e732ac8eb..000000000 --- a/packages/forwarder-helper/src/monorepo_scripts/stage_docs.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { postpublishUtils } from '@0xproject/monorepo-scripts'; - -import * as packageJSON from '../package.json'; -import * as tsConfigJSON from '../tsconfig.json'; - -const cwd = `${__dirname}/..`; -// tslint:disable-next-line:no-floating-promises -postpublishUtils.publishDocsToStagingAsync(packageJSON, tsConfigJSON, cwd); -- cgit From 6338b5bd3cbbcef149fb3fdf05116e40ea93aa05 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Thu, 23 Aug 2018 13:47:24 -0700 Subject: Move sorting phase into its own utils file --- .../forwarder-helper/src/forwarder_helper_impl.ts | 67 +--------------- .../utils/forwarder_helper_impl_config_utils.ts | 92 ++++++++++++++++++++++ 2 files changed, 95 insertions(+), 64 deletions(-) create mode 100644 packages/forwarder-helper/src/utils/forwarder_helper_impl_config_utils.ts (limited to 'packages') diff --git a/packages/forwarder-helper/src/forwarder_helper_impl.ts b/packages/forwarder-helper/src/forwarder_helper_impl.ts index 83dc1f4b3..a90edb0bb 100644 --- a/packages/forwarder-helper/src/forwarder_helper_impl.ts +++ b/packages/forwarder-helper/src/forwarder_helper_impl.ts @@ -1,17 +1,14 @@ -import { marketUtils, sortingUtils } from '@0xproject/order-utils'; +import { marketUtils } from '@0xproject/order-utils'; import { SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import { constants } from './constants'; import { ForwarderHelper, ForwarderHelperError, MarketBuyOrdersInfo, MarketBuyOrdersInfoRequest } from './types'; +import { forwarderHelperImplConfigUtils } from './utils/forwarder_helper_impl_config_utils'; const SLIPPAGE_PERCENTAGE = new BigNumber(0.2); // 20% slippage protection, possibly move this into request interface -interface SignedOrderWithAmount extends SignedOrder { - remainingFillAmount?: BigNumber; -} - export interface ForwarderHelperImplConfig { orders: SignedOrder[]; feeOrders: SignedOrder[]; @@ -21,66 +18,8 @@ export interface ForwarderHelperImplConfig { export class ForwarderHelperImpl implements ForwarderHelper { public readonly config: ForwarderHelperImplConfig; - private static _createSignedOrderWithAmounts( - orders: SignedOrder[], - amounts?: BigNumber[], - ): SignedOrderWithAmount[] { - const ordersAndAmounts = _.map(orders, (order, index) => { - return { - ...order, - remainingFillAmount: _.nth(amounts, index), - }; - }); - return ordersAndAmounts; - } - private static _unbundleSignedOrderWithAmounts( - signedOrderWithAmounts: SignedOrderWithAmount[], - ): { orders: SignedOrder[]; amounts?: BigNumber[] } { - const orders = _.map(signedOrderWithAmounts, order => { - const { remainingFillAmount, ...rest } = order; - return rest; - }); - const amounts = _.map(signedOrderWithAmounts, order => { - const { remainingFillAmount } = order; - return remainingFillAmount; - }); - const compactAmounts = _.compact(amounts); - return { - orders, - amounts: compactAmounts.length > 0 ? compactAmounts : undefined, - }; - } - private static _sortedConfig(config: ForwarderHelperImplConfig): ForwarderHelperImplConfig { - const { orders, feeOrders, remainingFillableMakerAssetAmounts, remainingFillableFeeAmounts } = config; - // Bundle orders together with their remainingFillAmounts so that we can sort them together - const orderWithAmounts = ForwarderHelperImpl._createSignedOrderWithAmounts( - orders, - remainingFillableMakerAssetAmounts, - ); - // TODO: provide a feeRate to the sorting function to more accurately sort based on the current market for ZRX tokens - const sortedOrderWithAmounts = sortingUtils.sortOrdersByFeeAdjustedRate(orderWithAmounts); - // Unbundle after sorting - const unbundledSortedOrderWithAmounts = ForwarderHelperImpl._unbundleSignedOrderWithAmounts( - sortedOrderWithAmounts, - ); - // Do the same bundling + unbundling for feeOrder sorting - const feeOrderWithAmounts = ForwarderHelperImpl._createSignedOrderWithAmounts( - feeOrders, - remainingFillableFeeAmounts, - ); - const sortedFeeOrderWithAmounts = sortingUtils.sortFeeOrdersByFeeAdjustedRate(feeOrderWithAmounts); - const unbundledSortedFeeOrderWithAmounts = ForwarderHelperImpl._unbundleSignedOrderWithAmounts( - sortedFeeOrderWithAmounts, - ); - return { - orders: unbundledSortedOrderWithAmounts.orders, - feeOrders: unbundledSortedFeeOrderWithAmounts.orders, - remainingFillableMakerAssetAmounts: unbundledSortedOrderWithAmounts.amounts, - remainingFillableFeeAmounts: unbundledSortedFeeOrderWithAmounts.amounts, - }; - } constructor(config: ForwarderHelperImplConfig) { - this.config = ForwarderHelperImpl._sortedConfig(config); + this.config = forwarderHelperImplConfigUtils.sortedConfig(config); } public getMarketBuyOrdersInfo(request: MarketBuyOrdersInfoRequest): MarketBuyOrdersInfo { const { makerAssetFillAmount, feePercentage } = request; diff --git a/packages/forwarder-helper/src/utils/forwarder_helper_impl_config_utils.ts b/packages/forwarder-helper/src/utils/forwarder_helper_impl_config_utils.ts new file mode 100644 index 000000000..253384f65 --- /dev/null +++ b/packages/forwarder-helper/src/utils/forwarder_helper_impl_config_utils.ts @@ -0,0 +1,92 @@ +import { sortingUtils } from '@0xproject/order-utils'; +import { SignedOrder } from '@0xproject/types'; +import { BigNumber } from '@0xproject/utils'; +import * as _ from 'lodash'; + +import { ForwarderHelperImplConfig } from '../forwarder_helper_impl'; + +interface SignedOrderWithAmount extends SignedOrder { + remainingFillAmount: BigNumber; +} + +export const forwarderHelperImplConfigUtils = { + sortedConfig(config: ForwarderHelperImplConfig): ForwarderHelperImplConfig { + const { orders, feeOrders, remainingFillableMakerAssetAmounts, remainingFillableFeeAmounts } = config; + // TODO: provide a feeRate to the sorting function to more accurately sort based on the current market for ZRX tokens + const orderSorter = (ordersToSort: SignedOrder[]) => { + return sortingUtils.sortOrdersByFeeAdjustedRate(ordersToSort); + }; + const sortOrdersResult = sortOrdersAndRemainingFillAmounts( + orderSorter, + orders, + remainingFillableMakerAssetAmounts, + ); + const feeOrderSorter = (ordersToSort: SignedOrder[]) => { + return sortingUtils.sortFeeOrdersByFeeAdjustedRate(ordersToSort); + }; + const sortFeeOrdersResult = sortOrdersAndRemainingFillAmounts( + feeOrderSorter, + feeOrders, + remainingFillableFeeAmounts, + ); + return { + orders: sortOrdersResult.orders, + feeOrders: sortFeeOrdersResult.orders, + remainingFillableMakerAssetAmounts: sortOrdersResult.remainingFillAmounts, + remainingFillableFeeAmounts: sortFeeOrdersResult.remainingFillAmounts, + }; + }, +}; + +type OrderSorter = (orders: SignedOrder[]) => SignedOrder[]; + +function sortOrdersAndRemainingFillAmounts( + orderSorter: OrderSorter, + orders: SignedOrder[], + remainingFillAmounts?: BigNumber[], +): { orders: SignedOrder[]; remainingFillAmounts?: BigNumber[] } { + if (!_.isUndefined(remainingFillAmounts)) { + // Bundle orders together with their remainingFillAmounts so that we can sort them together + const orderWithAmounts = bundleSignedOrderWithAmounts(orders, remainingFillAmounts); + // Sort + const sortedOrderWithAmounts = orderSorter(orderWithAmounts) as SignedOrderWithAmount[]; + // Unbundle after sorting + const unbundledSortedOrderWithAmounts = unbundleSignedOrderWithAmounts(sortedOrderWithAmounts); + return { + orders: unbundledSortedOrderWithAmounts.orders, + remainingFillAmounts: unbundledSortedOrderWithAmounts.amounts, + }; + } else { + const sortedOrders = orderSorter(orders); + return { + orders: sortedOrders, + }; + } +} + +function bundleSignedOrderWithAmounts(orders: SignedOrder[], amounts: BigNumber[]): SignedOrderWithAmount[] { + const ordersAndAmounts = _.map(orders, (order, index) => { + return { + ...order, + remainingFillAmount: amounts[index], + }; + }); + return ordersAndAmounts; +} + +function unbundleSignedOrderWithAmounts( + signedOrderWithAmounts: SignedOrderWithAmount[], +): { orders: SignedOrder[]; amounts: BigNumber[] } { + const orders = _.map(signedOrderWithAmounts, order => { + const { remainingFillAmount, ...rest } = order; + return rest; + }); + const amounts = _.map(signedOrderWithAmounts, order => { + const { remainingFillAmount } = order; + return remainingFillAmount; + }); + return { + orders, + amounts, + }; +} -- cgit From 6b667f8ecaa2f41bfe24f429748c0a707fb408bb Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Thu, 23 Aug 2018 14:56:39 -0700 Subject: Remove CHANGELOG.md --- packages/forwarder-helper/CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) delete mode 100644 packages/forwarder-helper/CHANGELOG.md (limited to 'packages') diff --git a/packages/forwarder-helper/CHANGELOG.md b/packages/forwarder-helper/CHANGELOG.md deleted file mode 100644 index 8b1378917..000000000 --- a/packages/forwarder-helper/CHANGELOG.md +++ /dev/null @@ -1 +0,0 @@ - -- cgit From 21c37ba62fcc517d0a332b951be874e255763fec Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Thu, 23 Aug 2018 16:15:08 -0700 Subject: Upgrade changelog version to get around test-publis CI job --- packages/forwarder-helper/CHANGELOG.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/forwarder-helper/CHANGELOG.json b/packages/forwarder-helper/CHANGELOG.json index f95e7a2db..be5b244b3 100644 --- a/packages/forwarder-helper/CHANGELOG.json +++ b/packages/forwarder-helper/CHANGELOG.json @@ -1,6 +1,6 @@ [ { - "version": "1.0.0-rc.1", + "version": "1.0.1-rc.1", "changes": [ { "note": "Add initial forwarderHelperFactory", -- cgit From 1040826b8b04d24e053c6afc21e69c4845151d2f Mon Sep 17 00:00:00 2001 From: fragosti Date: Thu, 23 Aug 2018 17:17:45 -0700 Subject: Add documentation for connect v2 --- packages/website/md/docs/connect/2.0.0/introduction.md | 3 +++ packages/website/ts/containers/connect_documentation.ts | 5 +++++ 2 files changed, 8 insertions(+) create mode 100644 packages/website/md/docs/connect/2.0.0/introduction.md (limited to 'packages') diff --git a/packages/website/md/docs/connect/2.0.0/introduction.md b/packages/website/md/docs/connect/2.0.0/introduction.md new file mode 100644 index 000000000..de7ece7ae --- /dev/null +++ b/packages/website/md/docs/connect/2.0.0/introduction.md @@ -0,0 +1,3 @@ +**NOTE:** Release candidate versions are meant to work with V2 of the Standard Relayer API. To interact with V1, select a 1.X version of connect. + +Welcome to the [0x Connect](https://github.com/0xProject/0x-monorepo/tree/development/packages/connect) documentation! 0x Connect is 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). Functionality includes getting supported asset pairs from a relayer, getting orders filtered by different attributes, getting individual orders specified by order hash, getting orderbooks for specific asset pairs, getting fee information, and submitting orders. diff --git a/packages/website/ts/containers/connect_documentation.ts b/packages/website/ts/containers/connect_documentation.ts index 8b13081c6..90137243c 100644 --- a/packages/website/ts/containers/connect_documentation.ts +++ b/packages/website/ts/containers/connect_documentation.ts @@ -10,6 +10,7 @@ import { Translate } from 'ts/utils/translate'; /* tslint:disable:no-var-requires */ const IntroMarkdownV1 = require('md/docs/connect/1.0.0/introduction'); +const IntroMarkdownV2 = require('md/docs/connect/2.0.0/introduction'); const InstallationMarkdownV1 = require('md/docs/connect/1.0.0/installation'); /* tslint:enable:no-var-requires */ @@ -33,6 +34,10 @@ const docsInfoConfig: DocsInfoConfig = { [markdownSections.introduction]: IntroMarkdownV1, [markdownSections.installation]: InstallationMarkdownV1, }, + '2.0.0-rc.1': { + [markdownSections.introduction]: IntroMarkdownV2, + [markdownSections.installation]: InstallationMarkdownV1, + }, }, markdownSections, }; -- cgit From d603d8da4786e34d4d63ef4283d4ba8d841d3f39 Mon Sep 17 00:00:00 2001 From: fragosti Date: Thu, 23 Aug 2018 11:56:08 -0700 Subject: Rename sra-api to sra-spec --- packages/sra-api/.discharge.json | 13 - packages/sra-api/.npmignore | 8 - packages/sra-api/CHANGELOG.json | 21 -- packages/sra-api/CHANGELOG.md | 10 - packages/sra-api/README.md | 93 ------- packages/sra-api/build_scripts/buildJson.ts | 7 - packages/sra-api/package.json | 60 ---- packages/sra-api/public/api.json | 1 - packages/sra-api/public/index.html | 24 -- packages/sra-api/src/api.ts | 310 --------------------- packages/sra-api/src/errors.ts | 24 -- packages/sra-api/src/examples/errors.ts | 11 - packages/sra-api/src/examples/index.ts | 21 -- .../examples/relayerApiAssetDataPairsResponse.ts | 21 -- .../examples/relayerApiFeeRecipientsResponse.ts | 10 - packages/sra-api/src/examples/relayerApiOrder.ts | 19 -- .../src/examples/relayerApiOrderConfigPayload.ts | 10 - .../src/examples/relayerApiOrderConfigResponse.ts | 6 - .../src/examples/relayerApiOrderbookResponse.ts | 54 ---- .../src/examples/relayerApiOrdersResponse.ts | 26 -- packages/sra-api/src/examples/signedOrder.ts | 16 -- packages/sra-api/src/headers.ts | 20 -- packages/sra-api/src/index.ts | 1 - packages/sra-api/src/json-schemas.ts | 63 ----- packages/sra-api/src/md/index.ts | 5 - packages/sra-api/src/md/introduction.md | 214 -------------- packages/sra-api/src/parameters.ts | 39 --- packages/sra-api/src/responses.ts | 24 -- packages/sra-api/tsconfig.json | 7 - packages/sra-api/tslint.json | 3 - packages/sra-spec/.discharge.json | 13 + packages/sra-spec/.npmignore | 8 + packages/sra-spec/CHANGELOG.json | 21 ++ packages/sra-spec/CHANGELOG.md | 10 + packages/sra-spec/README.md | 93 +++++++ packages/sra-spec/build_scripts/buildJson.ts | 7 + packages/sra-spec/package.json | 60 ++++ packages/sra-spec/public/api.json | 1 + packages/sra-spec/public/index.html | 24 ++ packages/sra-spec/src/api.ts | 310 +++++++++++++++++++++ packages/sra-spec/src/errors.ts | 24 ++ packages/sra-spec/src/examples/errors.ts | 11 + packages/sra-spec/src/examples/index.ts | 21 ++ .../examples/relayerApiAssetDataPairsResponse.ts | 21 ++ .../examples/relayerApiFeeRecipientsResponse.ts | 10 + packages/sra-spec/src/examples/relayerApiOrder.ts | 19 ++ .../src/examples/relayerApiOrderConfigPayload.ts | 10 + .../src/examples/relayerApiOrderConfigResponse.ts | 6 + .../src/examples/relayerApiOrderbookResponse.ts | 54 ++++ .../src/examples/relayerApiOrdersResponse.ts | 26 ++ packages/sra-spec/src/examples/signedOrder.ts | 16 ++ packages/sra-spec/src/headers.ts | 20 ++ packages/sra-spec/src/index.ts | 1 + packages/sra-spec/src/json-schemas.ts | 63 +++++ packages/sra-spec/src/md/index.ts | 5 + packages/sra-spec/src/md/introduction.md | 214 ++++++++++++++ packages/sra-spec/src/parameters.ts | 39 +++ packages/sra-spec/src/responses.ts | 24 ++ packages/sra-spec/tsconfig.json | 7 + packages/sra-spec/tslint.json | 3 + 60 files changed, 1141 insertions(+), 1141 deletions(-) delete mode 100644 packages/sra-api/.discharge.json delete mode 100644 packages/sra-api/.npmignore delete mode 100644 packages/sra-api/CHANGELOG.json delete mode 100644 packages/sra-api/CHANGELOG.md delete mode 100644 packages/sra-api/README.md delete mode 100644 packages/sra-api/build_scripts/buildJson.ts delete mode 100644 packages/sra-api/package.json delete mode 100644 packages/sra-api/public/api.json delete mode 100644 packages/sra-api/public/index.html delete mode 100644 packages/sra-api/src/api.ts delete mode 100644 packages/sra-api/src/errors.ts delete mode 100644 packages/sra-api/src/examples/errors.ts delete mode 100644 packages/sra-api/src/examples/index.ts delete mode 100644 packages/sra-api/src/examples/relayerApiAssetDataPairsResponse.ts delete mode 100644 packages/sra-api/src/examples/relayerApiFeeRecipientsResponse.ts delete mode 100644 packages/sra-api/src/examples/relayerApiOrder.ts delete mode 100644 packages/sra-api/src/examples/relayerApiOrderConfigPayload.ts delete mode 100644 packages/sra-api/src/examples/relayerApiOrderConfigResponse.ts delete mode 100644 packages/sra-api/src/examples/relayerApiOrderbookResponse.ts delete mode 100644 packages/sra-api/src/examples/relayerApiOrdersResponse.ts delete mode 100644 packages/sra-api/src/examples/signedOrder.ts delete mode 100644 packages/sra-api/src/headers.ts delete mode 100644 packages/sra-api/src/index.ts delete mode 100644 packages/sra-api/src/json-schemas.ts delete mode 100644 packages/sra-api/src/md/index.ts delete mode 100644 packages/sra-api/src/md/introduction.md delete mode 100644 packages/sra-api/src/parameters.ts delete mode 100644 packages/sra-api/src/responses.ts delete mode 100644 packages/sra-api/tsconfig.json delete mode 100644 packages/sra-api/tslint.json create mode 100644 packages/sra-spec/.discharge.json create mode 100644 packages/sra-spec/.npmignore create mode 100644 packages/sra-spec/CHANGELOG.json create mode 100644 packages/sra-spec/CHANGELOG.md create mode 100644 packages/sra-spec/README.md create mode 100644 packages/sra-spec/build_scripts/buildJson.ts create mode 100644 packages/sra-spec/package.json create mode 100644 packages/sra-spec/public/api.json create mode 100644 packages/sra-spec/public/index.html create mode 100644 packages/sra-spec/src/api.ts create mode 100644 packages/sra-spec/src/errors.ts create mode 100644 packages/sra-spec/src/examples/errors.ts create mode 100644 packages/sra-spec/src/examples/index.ts create mode 100644 packages/sra-spec/src/examples/relayerApiAssetDataPairsResponse.ts create mode 100644 packages/sra-spec/src/examples/relayerApiFeeRecipientsResponse.ts create mode 100644 packages/sra-spec/src/examples/relayerApiOrder.ts create mode 100644 packages/sra-spec/src/examples/relayerApiOrderConfigPayload.ts create mode 100644 packages/sra-spec/src/examples/relayerApiOrderConfigResponse.ts create mode 100644 packages/sra-spec/src/examples/relayerApiOrderbookResponse.ts create mode 100644 packages/sra-spec/src/examples/relayerApiOrdersResponse.ts create mode 100644 packages/sra-spec/src/examples/signedOrder.ts create mode 100644 packages/sra-spec/src/headers.ts create mode 100644 packages/sra-spec/src/index.ts create mode 100644 packages/sra-spec/src/json-schemas.ts create mode 100644 packages/sra-spec/src/md/index.ts create mode 100644 packages/sra-spec/src/md/introduction.md create mode 100644 packages/sra-spec/src/parameters.ts create mode 100644 packages/sra-spec/src/responses.ts create mode 100644 packages/sra-spec/tsconfig.json create mode 100644 packages/sra-spec/tslint.json (limited to 'packages') diff --git a/packages/sra-api/.discharge.json b/packages/sra-api/.discharge.json deleted file mode 100644 index df2cce0f4..000000000 --- a/packages/sra-api/.discharge.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "domain": "sra-api", - "build_command": "yarn build-json", - "upload_directory": "public", - "index_key": "index.html", - "error_key": "index.html", - "trailing_slashes": true, - "cache": 3600, - "aws_profile": "default", - "aws_region": "us-east-1", - "cdn": false, - "dns_configured": true -} diff --git a/packages/sra-api/.npmignore b/packages/sra-api/.npmignore deleted file mode 100644 index e610180ad..000000000 --- a/packages/sra-api/.npmignore +++ /dev/null @@ -1,8 +0,0 @@ -.* -yarn-error.log -/src/ -/schemas/ -test/ -tsconfig.json -/lib/src/monorepo_scripts/ -/public/ \ No newline at end of file diff --git a/packages/sra-api/CHANGELOG.json b/packages/sra-api/CHANGELOG.json deleted file mode 100644 index d6797cc45..000000000 --- a/packages/sra-api/CHANGELOG.json +++ /dev/null @@ -1,21 +0,0 @@ -[ - { - "version": "1.0.1-rc.5", - "changes": [ - { - "note": "Add takerAddress to /orders parameters", - "pr": 974 - } - ] - }, - { - "version": "1.0.1-rc.4", - "changes": [ - { - "note": "Add inital spec for SRA v2", - "pr": 916 - } - ], - "timestamp": 1534210131 - } -] diff --git a/packages/sra-api/CHANGELOG.md b/packages/sra-api/CHANGELOG.md deleted file mode 100644 index ed0d4891b..000000000 --- a/packages/sra-api/CHANGELOG.md +++ /dev/null @@ -1,10 +0,0 @@ - - -CHANGELOG - -## v1.0.1-rc.4 - _August 13, 2018_ - - * Add inital spec for SRA v2 (#916) diff --git a/packages/sra-api/README.md b/packages/sra-api/README.md deleted file mode 100644 index dec66c498..000000000 --- a/packages/sra-api/README.md +++ /dev/null @@ -1,93 +0,0 @@ -## @0xproject/sra-api - -Contains the Standard Relayer API [OpenAPI Spec](https://github.com/OAI/OpenAPI-Specification). - -The package distributes both a javascript object version and a json version. - -A deployed [ReDoc](https://github.com/Rebilly/ReDoc) static site with the API can be found here http://sra-api.s3-website-us-east-1.amazonaws.com/. - -## Usage - -``` -import { api } from '@0xproject/sra-api'; -``` - -## Installation - -``` -yarn install -``` - -## Development - -You can start a development server that will serve a [ReDoc](https://github.com/Rebilly/ReDoc) documentation instance. It uses the `api.json` file from `lib/` (you must have built at least once with `yarn build` or `yarn build-json`) that is based on the `api` object exported from `src`. - -``` -yarn watch_without_deps -``` - -The process will watch for changes, but will not hot-reload so you must refresh the page to see the changes. - -## 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=@0xproject/sra-api yarn build -``` - -Or continuously rebuild on change: - -```bash -PKG=@0xproject/sra-api yarn watch -``` - -### Static Site - -We also [host a static HTML version of the docs on S3](http://sra-api.s3-website-us-east-1.amazonaws.com/) for easy sharing. - -To build and deploy the site run - -``` -yarn deploy-site -``` - -**NOTE: On deploying the site, it will say the site is available at a non-existent URL. Please ignore and use the (now updated) URL above.** - -### Clean - -```bash -yarn clean -``` - -### Lint - -```bash -yarn lint -``` - -### Run Tests - -```bash -yarn test -``` diff --git a/packages/sra-api/build_scripts/buildJson.ts b/packages/sra-api/build_scripts/buildJson.ts deleted file mode 100644 index b92b5172b..000000000 --- a/packages/sra-api/build_scripts/buildJson.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { writeFileSync } from 'fs'; - -import { api } from '../src'; - -const apiJson = JSON.stringify(api); -writeFileSync('lib/api.json', apiJson); -writeFileSync('public/api.json', apiJson); diff --git a/packages/sra-api/package.json b/packages/sra-api/package.json deleted file mode 100644 index a4a0a7b0b..000000000 --- a/packages/sra-api/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "@0xproject/sra-api", - "version": "1.0.1-rc.4", - "engines": { - "node": ">=6.12" - }, - "description": "Standard Relayer API Open API Spec", - "main": "lib/src/index.js", - "types": "lib/src/index.d.ts", - "scripts": { - "serve": "redoc-cli serve lib/api.json --watch", - "watch_without_deps": "run-p build-json:watch serve", - "lint": "tslint --project .", - "test": "swagger-cli validate lib/api.json", - "rebuild_and_test": "run-s clean build test", - "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", - "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", - "test:circleci": "yarn test:coverage", - "clean": "shx rm -rf lib", - "build": "tsc && yarn build-json", - "build-json": "ts-node build_scripts/buildJson.ts", - "build-json:watch": "chokidar 'src/**/*' -c 'yarn build-json' ", - "deploy-site": "discharge deploy" - }, - "repository": { - "type": "git", - "url": "https://github.com/0xProject/0x-monorepo.git" - }, - "author": "Francesco Agosti", - "license": "Apache-2.0", - "bugs": { - "url": "https://github.com/0xProject/0x-monorepo/issues" - }, - "homepage": "https://github.com/0xProject/0x-monorepo/packages/sra-api/README.md", - "dependencies": { - "@0xproject/json-schemas": "^1.0.1-rc.4" - }, - "devDependencies": { - "@0xproject/tslint-config": "^1.0.5", - "@loopback/openapi-v3-types": "^0.8.2", - "@types/mocha": "^2.2.42", - "@types/node": "^10.5.3", - "chai": "^4.0.1", - "chokidar-cli": "^1.2.0", - "dirty-chai": "^2.0.1", - "discharge": "^0.7.1", - "mocha": "^4.0.1", - "npm-run-all": "^4.1.3", - "nyc": "^11.0.1", - "redoc-cli": "^0.6.1", - "shx": "^0.2.2", - "swagger-cli": "^2.1.1", - "ts-node": "^7.0.0", - "tslint": "5.11.0", - "typescript": "2.7.1" - }, - "publishConfig": { - "access": "public" - } -} diff --git a/packages/sra-api/public/api.json b/packages/sra-api/public/api.json deleted file mode 100644 index fc2409abb..000000000 --- a/packages/sra-api/public/api.json +++ /dev/null @@ -1 +0,0 @@ -{"openapi":"3.0.0","info":{"version":"2.0.0","title":"Standard Relayer REST API","description":"# Testing\n\nUse the [sra-report](https://github.com/0xProject/0x-monorepo/tree/development/packages/sra-report) command line tool to test your API for SRA compliance.\n\n# Schemas\n\nThe [JSON schemas](http://json-schema.org/) for the API payloads and responses can be found in [@0xproject/json-schemas](https://github.com/0xProject/0x.js/tree/development/packages/json-schemas). Examples of each payload and response can be found in the library's [test suite](https://github.com/0xProject/0x.js/blob/development/packages/json-schemas/test/schema_test.ts#L1).\n\n```bash\nnpm install @0xproject/json-schemas --save\n```\n\nYou can easily validate your API's payloads and responses using the [@0xproject/json-schemas](https://github.com/0xProject/0x.js/tree/development/packages/json-schemas) package:\n\n```js\nimport {SchemaValidator, ValidatorResult, schemas} from '@0xproject/json-schemas';\n\nconst {relayerApiTokenPairsResponseSchema} = schemas;\nconst validator = new SchemaValidator();\n\nconst tokenPairsResponse = {\n ...\n};\nconst validatorResult: ValidatorResult = validator.validate(tokenPairsResponse, relayerApiTokenPairsResponseSchema);\n```\n\n# Pagination\n\nRequests that return potentially large collections should respond to the **?page** and **?perPage** parameters. For example:\n\n```bash\n$ curl https://api.example-relayer.com/v2/asset_pairs?page=3&perPage=20\n```\n\nPage numbering should be 1-indexed, not 0-indexed. If a query provides an unreasonable (ie. too high) `perPage` value, the response can return a validation error as specified in the [errors section](#section/Errors). If the query specifies a `page` that does not exist (ie. there are not enough `records`), the response should just return an empty `records` array.\n\nAll endpoints that are paginated should return a `total`, `page`, `perPage` and a `records` value in the top level of the collection. The value of `total` should be the total number of records for a given query, whereas `records` should be an array representing the response to the query for that page. `page` and `perPage`, are the same values that were specified in the request. See the note in [miscellaneous](#section/Misc.) about formatting `snake_case` vs. `lowerCamelCase`.\n\nThese requests include the [`/v2/asset_pairs`](#operation/getAssetPairs), [`/v2/orders`](#operation/getOrders), [`/v2/fee_recipients`](#operation/getFeeRecipients) and [`/v2/orderbook`](#operation/getOrderbook) endpoints.\n\n# Network Id\n\nAll requests should be able to specify a **?networkId** query param for all supported networks. For example:\n\n```bash\n$ curl https://api.example-relayer.com/v2/asset_pairs?networkId=1\n```\n\nIf the query param is not provided, it should default to **1** (mainnet).\n\nNetworks and their Ids:\n\n| Network Id | Network Name |\n| ---------- | ------------ |\n| 1 | Mainnet |\n| 42 | Kovan |\n| 3 | Ropsten |\n| 4 | Rinkeby |\n\nIf a certain network is not supported, the response should **400** as specified in the [error response](#section/Errors) section. For example:\n\n```json\n{\n \"code\": 100,\n \"reason\": \"Validation failed\",\n \"validationErrors\": [\n {\n \"field\": \"networkId\",\n \"code\": 1006,\n \"reason\": \"Network id 42 is not supported\"\n }\n ]\n}\n```\n\n# Link Header\n\nA [Link Header](https://tools.ietf.org/html/rfc5988) can be included in a response to provide clients with more context about paging\nFor example:\n\n```bash\nLink: ; rel=\"next\",\n; rel=\"last\"\n```\n\nThis `Link` response header contains one or more Hypermedia link relations.\n\nThe possible `rel` values are:\n\n| Name | Description |\n| ----- | ------------------------------------------------------------- |\n| next | The link relation for the immediate next page of results. |\n| last | The link relation for the last page of results. |\n| first | The link relation for the first page of results. |\n| prev | The link relation for the immediate previous page of results. |\n\n# Rate Limits\n\nRate limit guidance for clients can be optionally returned in the response headers:\n\n| Header Name | Description |\n| --------------------- | ---------------------------------------------------------------------------- |\n| X-RateLimit-Limit | The maximum number of requests you're permitted to make per hour. |\n| X-RateLimit-Remaining | The number of requests remaining in the current rate limit window. |\n| X-RateLimit-Reset | The time at which the current rate limit window resets in UTC epoch seconds. |\n\nFor example:\n\n```bash\n$ curl -i https://api.example-relayer.com/v2/asset_pairs\nHTTP/1.1 200 OK\nDate: Mon, 20 Oct 2017 12:30:06 GMT\nStatus: 200 OK\nX-RateLimit-Limit: 60\nX-RateLimit-Remaining: 56\nX-RateLimit-Reset: 1372700873\n```\n\nWhen a rate limit is exceeded, a status of **429 Too Many Requests** should be returned.\n\n# Errors\n\nUnless the spec defines otherwise, errors to bad requests should respond with HTTP 4xx or status codes.\n\n## Common error codes\n\n| Code | Reason |\n| ---- | --------------------------------------- |\n| 400 | Bad Request – Invalid request format |\n| 404 | Not found |\n| 429 | Too many requests - Rate limit exceeded |\n| 500 | Internal Server Error |\n| 501 | Not Implemented |\n\n## Error reporting format\n\nFor all **400** responses, see the [error response schema](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_error_response_schema.ts#L1).\n\n```json\n{\n \"code\": 101,\n \"reason\": \"Validation failed\",\n \"validationErrors\": [\n {\n \"field\": \"maker\",\n \"code\": 1002,\n \"reason\": \"Invalid address\"\n }\n ]\n}\n```\n\nGeneral error codes:\n\n```bash\n100 - Validation Failed\n101 - Malformed JSON\n102 - Order submission disabled\n103 - Throttled\n```\n\nValidation error codes:\n\n```bash\n1000 - Required field\n1001 - Incorrect format\n1002 - Invalid address\n1003 - Address not supported\n1004 - Value out of range\n1005 - Invalid signature or hash\n1006 - Unsupported option\n```\n\n# Asset Data Encoding\n\nAs we now support multiple [token transfer proxies](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#assetproxy), the identifier of which proxy to use for the token transfer must be encoded, along with the token information. Each proxy in 0x v2 has a unique identifier. If you're using 0x.js there will be helper methods for this [encoding](https://0xproject.com/docs/0x.js#zeroEx-encodeERC20AssetData) and [decoding](https://0xproject.com/docs/0x.js#zeroEx-decodeAssetProxyId).\n\nThe identifier for the Proxy uses a similar scheme to [ABI function selectors](https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI#function-selector).\n\n```js\n// ERC20 Proxy ID 0xf47261b0\nbytes4(keccak256('ERC20Token(address)'));\n// ERC721 Proxy ID 0x08e937fa\nbytes4(keccak256('ERC721Token(address,uint256)'));\n```\n\nAsset data is encoded using [ABI encoding](https://solidity.readthedocs.io/en/develop/abi-spec.html).\n\nFor example, encoding the ERC20 token contract (address: 0x1dc4c1cefef38a777b15aa20260a54e584b16c48) using the ERC20 Transfer Proxy (id: 0xf47261b0) would be:\n\n```bash\n0xf47261b00000000000000000000000001dc4c1cefef38a777b15aa20260a54e584b16c48\n```\n\nEncoding the ERC721 token contract (address: `0x371b13d97f4bf77d724e78c16b7dc74099f40e84`), token id (id: `99`, which hex encoded is `0x63`) and the ERC721 Transfer Proxy (id: 0x08e937fa) would be:\n\n```bash\n0x08e937fa000000000000000000000000371b13d97f4bf77d724e78c16b7dc74099f40e840000000000000000000000000000000000000000000000000000000000000063\n```\n\nFor more information see [the Asset Proxy](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#erc20proxy) section of the v2 spec and the [Ethereum ABI Spec](https://solidity.readthedocs.io/en/develop/abi-spec.html).\n\n# Meta Data in Order Responses\n\nIn v2 of the standard relayer API we added the `metaData` field. It is meant to provide a standard place for relayers to put optional, custom or non-standard fields that may of interest to the consumer of the API.\n\nA good example of such a field is `remainingTakerAssetAmount`, which is a convenience field that communicates how much of a 0x order is potentially left to be filled. Unlike the other fields in a 0x order, it is not guaranteed to be correct as it is derived from whatever mechanism the implementer (ie. the relayer) is using. While convenient for prototyping and low stakes situations, we recommend validating the value of the field by checking the state of the blockchain yourself, such as by using [Order Watcher](https://0xproject.com/wiki#0x-OrderWatcher).\n\n# Misc.\n\n* All requests and responses should be of **application/json** content type\n* All token amounts are sent in amounts of the smallest level of precision (base units). (e.g if a token has 18 decimal places, selling 1 token would show up as selling `'1000000000000000000'` units by this API).\n* All addresses are sent as lower-case (non-checksummed) Ethereum addresses with the `0x` prefix.\n* All parameters are to be written in `lowerCamelCase`.\n","license":{"name":"Apache 2.0","url":"https://www.apache.org/licenses/LICENSE-2.0.html"}},"paths":{"/v2/asset_pairs":{"get":{"description":"Retrieves a list of available asset pairs and the information required to trade them (in any order). Setting only `assetDataA` or `assetDataB` returns pairs filtered by that asset only.","operationId":"getAssetPairs","parameters":[{"name":"assetDataA","in":"query","description":"The assetData value for the first asset in the pair.","example":"0xf47261b04c32345ced77393b3530b1eed0f346429d","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"assetDataB","in":"query","description":"The assetData value for the second asset in the pair.","example":"0x0257179264389b814a946f3e92105513705ca6b990","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}},{"name":"page","in":"query","description":"The number of the page to request in the collection.","example":3,"schema":{"type":"number","default":1}},{"name":"perPage","in":"query","description":"The number of records to return per page.","example":10,"schema":{"type":"number","default":100}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"Returns a collection of available asset pairs with some meta info","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiAssetDataPairsResponseSchema"},"example":{"total":43,"page":1,"perPage":100,"records":[{"assetDataA":{"minAmount":"0","maxAmount":"10000000000000000000","precision":5,"assetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d"},"assetDataB":{"minAmount":"0","maxAmount":"50000000000000000000","precision":5,"assetData":"0x0257179264389b814a946f3e92105513705ca6b990"}}]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/orders":{"get":{"description":"Retrieves a list of orders given query parameters. This endpoint should be [paginated](#section/Pagination). For querying an entire orderbook snapshot, the [orderbook endpoint](#operation/getOrderbook) is recommended. If both makerAssetData and takerAssetData are specified, returned orders will be sorted by price determined by (takerTokenAmount/makerTokenAmount) in ascending order. By default, orders returned by this endpoint are unsorted.","operationId":"getOrders","parameters":[{"name":"makerAssetProxyId","in":"query","description":"The maker [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \"0xf47261b0\" for ERC20, \"0x02571792\" for ERC721).","example":"0xf47261b0","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"takerAssetProxyId","in":"query","description":"The taker asset [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \"0xf47261b0\" for ERC20, \"0x02571792\" for ERC721).","example":"0x02571792","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"makerAssetAddress","in":"query","description":"The contract address for the maker asset.","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"takerAssetAddress","in":"query","description":"The contract address for the taker asset.","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"exchangeAddress","in":"query","description":"Same as exchangeAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"senderAddress","in":"query","description":"Same as senderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"makerAssetData","in":"query","description":"Same as makerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"takerAssetData","in":"query","description":"Same as takerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"traderAssetData","in":"query","description":"Same as traderAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"makerAddress","in":"query","description":"Same as makerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"takerAddress","in":"query","description":"Same as takerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"traderAddress","in":"query","description":"Same as traderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"feeRecipientAddress","in":"query","description":"Same as feeRecipientAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}},{"name":"page","in":"query","description":"The number of the page to request in the collection.","example":3,"schema":{"type":"number","default":1}},{"name":"perPage","in":"query","description":"The number of records to return per page.","example":10,"schema":{"type":"number","default":100}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"A collection of 0x orders with meta-data as specified by query params","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrdersResponseSchema"},"example":{"total":984,"page":1,"perPage":100,"records":[{"order":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"},"metaData":{}}]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/order/{orderHash}":{"get":{"description":"Retrieves the 0x order with meta info that is associated with the hash.","operationId":"getOrder","parameters":[{"name":"orderHash","in":"path","description":"The hash of the desired 0x order.","example":"0xd4b103c42d2512eef3fee775e097f044291615d25f5d71e0ac70dbd49d223591","schema":{"$ref":"#/components/schemas/orderHashSchema"}},{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"The order and meta info associated with the orderHash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrderSchema"},"example":{"order":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"},"metaData":{}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/orderbook":{"get":{"description":"Retrieves the orderbook for a given asset pair. This endpoint should be [paginated](#section/Pagination). Bids will be sorted in descending order by price, and asks will be sorted in ascending order by price. Within the price sorted orders, the orders are further sorted by _taker fee price_ which is defined as the **takerFee** divided by **takerTokenAmount**. After _taker fee price_, orders are to be sorted by expiration in ascending order. The way pagination works for this endpoint is that the **page** and **perPage** query params apply to both `bids` and `asks` collections, and if `page` * `perPage` > `total` for a certain collection, the `records` for that collection should just be empty. ","operationId":"getOrderbook","parameters":[{"name":"baseAssetData","in":"query","description":"assetData (makerAssetData or takerAssetData) designated as the base currency in the [currency pair calculation](https://en.wikipedia.org/wiki/Currency_pair) of price.","required":true,"example":"0xf47261b04c32345ced77393b3530b1eed0f346429d","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"quoteAssetData","in":"query","description":"assetData (makerAssetData or takerAssetData) designated as the quote currency in the currency pair calculation of price (required).","required":true,"example":"0xf47261b04c32345ced77393b3530b1eed0f346429d","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}},{"name":"page","in":"query","description":"The number of the page to request in the collection.","example":3,"schema":{"type":"number","default":1}},{"name":"perPage","in":"query","description":"The number of records to return per page.","example":10,"schema":{"type":"number","default":100}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"The sorted order book for the specified asset pair.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrderbookResponseSchema"},"example":{"bids":{"total":325,"page":2,"perPage":100,"records":[{"order":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"},"metaData":{}}]},"asks":{"total":500,"page":2,"perPage":100,"records":[{"order":{"makerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","takerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"20000000000000000","takerAssetAmount":"10000000000000000","makerFee":"200000000000000","takerFee":"100000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","takerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x013842a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b3518891"},"metaData":{}}]}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/order_config":{"get":{"description":"Relayers have full discretion over the orders that they are willing to host on their orderbooks (e.g what fees they charge, etc...). In order for traders to discover their requirements programmatically, they can send an incomplete order to this endpoint and receive the missing fields, specifc to that order. This gives relayers a large amount of flexibility to tailor fees to unique traders, trading pairs and volume amounts. Submit a partial order and receive information required to complete the order: `senderAddress`, `feeRecipientAddress`, `makerFee`, `takerFee`. ","operationId":"getOrderConfig","parameters":[{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}}],"requestBody":{"description":"The fields of a 0x order the relayer may want to decide what configuration to send back.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrderConfigPayloadSchema"},"example":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","expirationTimeSeconds":"1532560590"}}}},"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"The additional fields necessary in order to submit an order to the relayer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrderConfigResponseSchema"},"example":{"senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","makerFee":"100000000000000","takerFee":"200000000000000"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/fee_recipients":{"get":{"description":"Retrieves a collection of all fee recipient addresses for a relayer. This endpoint should be [paginated](#section/Pagination).","operationId":"getFeeRecipients","parameters":[{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}},{"name":"page","in":"query","description":"The number of the page to request in the collection.","example":3,"schema":{"type":"number","default":1}},{"name":"perPage","in":"query","description":"The number of records to return per page.","example":10,"schema":{"type":"number","default":100}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"A collection of all used fee recipient addresses.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiFeeRecipientsResponseSchema"},"example":{"total":3,"page":1,"perPage":10,"records":["0x6eC92694ea172ebC430C30fa31De87620967A082","0x9e56625509c2f60af937f23b7b532600390e8c8b","0xa2b31dacf30a9c50ca473337c01d8a201ae33e32"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/order":{"post":{"description":"Submit a signed order to the relayer.","operationId":"postOrder","parameters":[{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}}],"requestBody":{"description":"A valid signed 0x order based on the schema.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/signedOrderSchema"},"example":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"}}}},"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"OK","content":{}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}}},"components":{"schemas":{"numberSchema":{"type":"string","pattern":"^\\d+(\\.\\d+)?$"},"addressSchema":{"type":"string","pattern":"^0x[0-9a-f]{40}$"},"hexSchema":{"type":"string","pattern":"^0x(([0-9a-f][0-9a-f])+)?$"},"orderHashSchema":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$"},"orderSchema":{"properties":{"makerAddress":{"$ref":"#/components/schemas/addressSchema"},"takerAddress":{"$ref":"#/components/schemas/addressSchema"},"makerFee":{"$ref":"#/components/schemas/numberSchema"},"takerFee":{"$ref":"#/components/schemas/numberSchema"},"senderAddress":{"$ref":"#/components/schemas/addressSchema"},"makerAssetAmount":{"$ref":"#/components/schemas/numberSchema"},"takerAssetAmount":{"$ref":"#/components/schemas/numberSchema"},"makerAssetData":{"$ref":"#/components/schemas/hexSchema"},"takerAssetData":{"$ref":"#/components/schemas/hexSchema"},"salt":{"$ref":"#/components/schemas/numberSchema"},"exchangeAddress":{"$ref":"#/components/schemas/addressSchema"},"feeRecipientAddress":{"$ref":"#/components/schemas/addressSchema"},"expirationTimeSeconds":{"$ref":"#/components/schemas/numberSchema"}},"required":["makerAddress","takerAddress","makerFee","takerFee","senderAddress","makerAssetAmount","takerAssetAmount","makerAssetData","takerAssetData","salt","exchangeAddress","feeRecipientAddress","expirationTimeSeconds"],"type":"object"},"signedOrderSchema":{"allOf":[{"$ref":"#/components/schemas/orderSchema"},{"properties":{"signature":{"$ref":"#/components/schemas/hexSchema"}},"required":["signature"]}]},"signedOrdersSchema":{"type":"array","items":{"$ref":"#/components/schemas/signedOrderSchema"}},"ordersSchema":{"type":"array","items":{"$ref":"#/components/schemas/orderSchema"}},"paginatedCollectionSchema":{"type":"object","properties":{"total":{"type":"number"},"perPage":{"type":"number"},"page":{"type":"number"}},"required":["total","perPage","page"]},"relayerApiErrorResponseSchema":{"type":"object","properties":{"code":{"type":"integer","minimum":100,"maximum":103},"reason":{"type":"string"},"validationErrors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"integer","minimum":1000,"maximum":1006},"reason":{"type":"string"}},"required":["field","code","reason"]}}},"required":["code","reason"]},"relayerApiFeeRecipientsResponseSchema":{"type":"object","allOf":[{"$ref":"#/components/schemas/paginatedCollectionSchema"},{"properties":{"records":{"id":"#/components/schemas/relayerApiFeeRecipientsSchema","type":"array","items":{"$ref":"#/components/schemas/addressSchema"}}},"required":["records"]}]},"relayerApiOrderSchema":{"type":"object","properties":{"order":{"$ref":"#/components/schemas/orderSchema"},"metaData":{"type":"object"}},"required":["order","metaData"]},"relayerApiOrdersSchema":{"type":"array","items":{"$ref":"#/components/schemas/relayerApiOrderSchema"}},"relayerApiOrderConfigPayloadSchema":{"type":"object","properties":{"makerAddress":{"$ref":"#/components/schemas/addressSchema"},"takerAddress":{"$ref":"#/components/schemas/addressSchema"},"makerAssetAmount":{"$ref":"#/components/schemas/numberSchema"},"takerAssetAmount":{"$ref":"#/components/schemas/numberSchema"},"makerAssetData":{"$ref":"#/components/schemas/hexSchema"},"takerAssetData":{"$ref":"#/components/schemas/hexSchema"},"exchangeAddress":{"$ref":"#/components/schemas/addressSchema"},"expirationTimeSeconds":{"$ref":"#/components/schemas/numberSchema"}},"required":["makerAddress","takerAddress","makerAssetAmount","takerAssetAmount","makerAssetData","takerAssetData","exchangeAddress","expirationTimeSeconds"]},"relayerApiOrderConfigResponseSchema":{"type":"object","properties":{"makerFee":{"$ref":"#/components/schemas/numberSchema"},"takerFee":{"$ref":"#/components/schemas/numberSchema"},"feeRecipientAddress":{"$ref":"#/components/schemas/addressSchema"},"senderAddress":{"$ref":"#/components/schemas/addressSchema"}},"required":["makerFee","takerFee","feeRecipientAddress","senderAddress"]},"relayerApiOrderbookResponseSchema":{"type":"object","properties":{"bids":{"$ref":"#/components/schemas/relayerApiOrdersResponseSchema"},"asks":{"$ref":"#/components/schemas/relayerApiOrdersResponseSchema"}},"required":["bids","asks"]},"relayerApiAssetDataPairsResponseSchema":{"type":"object","allOf":[{"$ref":"#/components/schemas/paginatedCollectionSchema"},{"properties":{"records":{"$ref":"#/components/schemas/relayerApiAssetDataPairsSchema"}},"required":["records"]}]},"relayerApiAssetDataTradeInfoSchema":{"type":"object","properties":{"assetData":{"$ref":"#/components/schemas/hexSchema"},"minAmount":{"$ref":"#/components/schemas/numberSchema"},"maxAmount":{"$ref":"#/components/schemas/numberSchema"},"precision":{"type":"number"}},"required":["assetData"]},"relayerApiOrdersChannelSubscribeSchema":{"type":"object","properties":{"type":{"enum":["subscribe"]},"channel":{"enum":["orders"]},"requestId":{"type":"string"},"payload":{"$ref":"#/components/schemas/relayerApiOrdersChannelSubscribePayload"}},"required":["type","channel","requestId"]},"relayerApiOrdersChannelSubscribePayload":{"type":"object","properties":{"makerAssetProxyId":{"$ref":"#/components/schemas/hexSchema"},"takerAssetProxyId":{"$ref":"#/components/schemas/hexSchema"},"networkId":{"type":"number"},"makerAssetAddress":{"$ref":"#/components/schemas/addressSchema"},"takerAssetAddress":{"$ref":"#/components/schemas/addressSchema"},"makerAssetData":{"$ref":"#/components/schemas/hexSchema"},"takerAssetData":{"$ref":"#/components/schemas/hexSchema"},"traderAssetData":{"$ref":"#/components/schemas/hexSchema"}}},"relayerApiOrdersChannelUpdateSchema":{"type":"object","properties":{"type":{"enum":["update"]},"channel":{"enum":["orders"]},"requestId":{"type":"string"},"payload":{"$ref":"#/components/schemas/relayerApiOrdersSchema"}},"required":["type","channel","requestId"]},"relayerApiOrdersResponseSchema":{"type":"object","allOf":[{"$ref":"#/components/schemas/paginatedCollectionSchema"},{"properties":{"records":{"$ref":"#/components/schemas/relayerApiOrdersSchema"}},"required":["records"]}]},"relayerApiAssetDataPairsSchema":{"type":"array","items":{"properties":{"assetDataA":{"$ref":"#/components/schemas/relayerApiAssetDataTradeInfoSchema"},"assetDataB":{"$ref":"#/components/schemas/relayerApiAssetDataTradeInfoSchema"}},"required":["assetDataA","assetDataB"],"type":"object"}}}}} \ No newline at end of file diff --git a/packages/sra-api/public/index.html b/packages/sra-api/public/index.html deleted file mode 100644 index 868047d4f..000000000 --- a/packages/sra-api/public/index.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - ReDoc - - - - - - - - - - - - - \ No newline at end of file diff --git a/packages/sra-api/src/api.ts b/packages/sra-api/src/api.ts deleted file mode 100644 index f80d343d8..000000000 --- a/packages/sra-api/src/api.ts +++ /dev/null @@ -1,310 +0,0 @@ -import { OpenApiSpec } from '@loopback/openapi-v3-types'; - -import { examples } from './examples'; -import { schemas } from './json-schemas'; -import { md } from './md'; -import { generateParameters } from './parameters'; -import { generateResponses } from './responses'; - -export const api: OpenApiSpec = { - openapi: '3.0.0', - info: { - version: '2.0.0', - title: 'Standard Relayer REST API', - description: md.introduction, - license: { - name: 'Apache 2.0', - url: 'https://www.apache.org/licenses/LICENSE-2.0.html', - }, - }, - paths: { - '/v2/asset_pairs': { - get: { - description: - 'Retrieves a list of available asset pairs and the information required to trade them (in any order). Setting only `assetDataA` or `assetDataB` returns pairs filtered by that asset only.', - operationId: 'getAssetPairs', - parameters: generateParameters( - [ - { - name: 'assetDataA', - in: 'query', - description: 'The assetData value for the first asset in the pair.', - example: '0xf47261b04c32345ced77393b3530b1eed0f346429d', - schema: { - $ref: '#/components/schemas/hexSchema', - }, - }, - { - name: 'assetDataB', - in: 'query', - description: 'The assetData value for the second asset in the pair.', - example: '0x0257179264389b814a946f3e92105513705ca6b990', - schema: { - $ref: '#/components/schemas/hexSchema', - }, - }, - ], - true, - ), - responses: generateResponses( - 'relayerApiAssetDataPairsResponseSchema', - examples.relayerApiAssetDataPairsResponse, - `Returns a collection of available asset pairs with some meta info`, - ), - }, - }, - '/v2/orders': { - get: { - description: - 'Retrieves a list of orders given query parameters. This endpoint should be [paginated](#section/Pagination). For querying an entire orderbook snapshot, the [orderbook endpoint](#operation/getOrderbook) is recommended. If both makerAssetData and takerAssetData are specified, returned orders will be sorted by price determined by (takerTokenAmount/makerTokenAmount) in ascending order. By default, orders returned by this endpoint are unsorted.', - operationId: 'getOrders', - parameters: generateParameters( - [ - { - name: 'makerAssetProxyId', - in: 'query', - description: `The maker [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: "0xf47261b0" for ERC20, "0x02571792" for ERC721).`, - example: '0xf47261b0', - schema: { - $ref: '#/components/schemas/hexSchema', - }, - }, - { - name: 'takerAssetProxyId', - in: 'query', - description: `The taker asset [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: "0xf47261b0" for ERC20, "0x02571792" for ERC721).`, - example: '0x02571792', - schema: { - $ref: '#/components/schemas/hexSchema', - }, - }, - { - name: 'makerAssetAddress', - in: 'query', - description: `The contract address for the maker asset.`, - example: '0xe41d2489571d322189246dafa5ebde1f4699f498', - schema: { - $ref: '#/components/schemas/addressSchema', - }, - }, - { - name: 'takerAssetAddress', - in: 'query', - description: `The contract address for the taker asset.`, - example: '0xe41d2489571d322189246dafa5ebde1f4699f498', - schema: { - $ref: '#/components/schemas/addressSchema', - }, - }, - { - name: 'exchangeAddress', - in: 'query', - description: `Same as exchangeAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)`, - example: '0xe41d2489571d322189246dafa5ebde1f4699f498', - schema: { - $ref: '#/components/schemas/addressSchema', - }, - }, - { - name: 'senderAddress', - in: 'query', - description: `Same as senderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)`, - example: '0xe41d2489571d322189246dafa5ebde1f4699f498', - schema: { - $ref: '#/components/schemas/addressSchema', - }, - }, - { - name: 'makerAssetData', - in: 'query', - description: `Same as makerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)`, - example: '0xe41d2489571d322189246dafa5ebde1f4699f498', - schema: { - $ref: '#/components/schemas/hexSchema', - }, - }, - { - name: 'takerAssetData', - in: 'query', - description: `Same as takerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)`, - example: '0xe41d2489571d322189246dafa5ebde1f4699f498', - schema: { - $ref: '#/components/schemas/hexSchema', - }, - }, - { - name: 'traderAssetData', - in: 'query', - description: `Same as traderAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)`, - example: '0xe41d2489571d322189246dafa5ebde1f4699f498', - schema: { - $ref: '#/components/schemas/hexSchema', - }, - }, - { - name: 'makerAddress', - in: 'query', - description: `Same as makerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)`, - example: '0xe41d2489571d322189246dafa5ebde1f4699f498', - schema: { - $ref: '#/components/schemas/addressSchema', - }, - }, - { - name: 'takerAddress', - in: 'query', - description: `Same as takerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)`, - example: '0xe41d2489571d322189246dafa5ebde1f4699f498', - schema: { - $ref: '#/components/schemas/addressSchema', - }, - }, - { - name: 'traderAddress', - in: 'query', - description: `Same as traderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)`, - example: '0xe41d2489571d322189246dafa5ebde1f4699f498', - schema: { - $ref: '#/components/schemas/addressSchema', - }, - }, - { - name: 'feeRecipientAddress', - in: 'query', - description: `Same as feeRecipientAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)`, - example: '0xe41d2489571d322189246dafa5ebde1f4699f498', - schema: { - $ref: '#/components/schemas/addressSchema', - }, - }, - ], - true, - ), - responses: generateResponses( - 'relayerApiOrdersResponseSchema', - examples.relayerApiOrdersResponse, - `A collection of 0x orders with meta-data as specified by query params`, - ), - }, - }, - '/v2/order/{orderHash}': { - get: { - description: 'Retrieves the 0x order with meta info that is associated with the hash.', - operationId: 'getOrder', - parameters: generateParameters( - [ - { - name: 'orderHash', - in: 'path', - description: 'The hash of the desired 0x order.', - example: '0xd4b103c42d2512eef3fee775e097f044291615d25f5d71e0ac70dbd49d223591', - schema: { - $ref: '#/components/schemas/orderHashSchema', - }, - }, - ], - false, - ), - responses: generateResponses( - 'relayerApiOrderSchema', - examples.relayerApiOrder, - `The order and meta info associated with the orderHash`, - ), - }, - }, - '/v2/orderbook': { - get: { - description: `Retrieves the orderbook for a given asset pair. This endpoint should be [paginated](#section/Pagination). Bids will be sorted in descending order by price, and asks will be sorted in ascending order by price. Within the price sorted orders, the orders are further sorted by _taker fee price_ which is defined as the **takerFee** divided by **takerTokenAmount**. After _taker fee price_, orders are to be sorted by expiration in ascending order. The way pagination works for this endpoint is that the **page** and **perPage** query params apply to both \`bids\` and \`asks\` collections, and if \`page\` * \`perPage\` > \`total\` for a certain collection, the \`records\` for that collection should just be empty. `, - operationId: 'getOrderbook', - parameters: generateParameters( - [ - { - name: 'baseAssetData', - in: 'query', - description: `assetData (makerAssetData or takerAssetData) designated as the base currency in the [currency pair calculation](https://en.wikipedia.org/wiki/Currency_pair) of price.`, - required: true, - example: '0xf47261b04c32345ced77393b3530b1eed0f346429d', - schema: { - $ref: '#/components/schemas/hexSchema', - }, - }, - { - name: 'quoteAssetData', - in: 'query', - description: `assetData (makerAssetData or takerAssetData) designated as the quote currency in the currency pair calculation of price (required).`, - required: true, - example: '0xf47261b04c32345ced77393b3530b1eed0f346429d', - schema: { - $ref: '#/components/schemas/hexSchema', - }, - }, - ], - true, - ), - responses: generateResponses( - 'relayerApiOrderbookResponseSchema', - examples.relayerApiOrderbookResponse, - `The sorted order book for the specified asset pair.`, - ), - }, - }, - '/v2/order_config': { - get: { - description: `Relayers have full discretion over the orders that they are willing to host on their orderbooks (e.g what fees they charge, etc...). In order for traders to discover their requirements programmatically, they can send an incomplete order to this endpoint and receive the missing fields, specifc to that order. This gives relayers a large amount of flexibility to tailor fees to unique traders, trading pairs and volume amounts. Submit a partial order and receive information required to complete the order: \`senderAddress\`, \`feeRecipientAddress\`, \`makerFee\`, \`takerFee\`. `, - operationId: 'getOrderConfig', - parameters: generateParameters([], false), - requestBody: { - description: - 'The fields of a 0x order the relayer may want to decide what configuration to send back.', - content: { - 'application/json': { - schema: { - $ref: '#/components/schemas/relayerApiOrderConfigPayloadSchema', - }, - example: examples.relayerApiOrderConfigPayload, - }, - }, - }, - responses: generateResponses( - 'relayerApiOrderConfigResponseSchema', - examples.relayerApiOrderConfigResponse, - `The additional fields necessary in order to submit an order to the relayer.`, - ), - }, - }, - '/v2/fee_recipients': { - get: { - description: `Retrieves a collection of all fee recipient addresses for a relayer. This endpoint should be [paginated](#section/Pagination).`, - operationId: 'getFeeRecipients', - parameters: generateParameters([], true), - responses: generateResponses( - 'relayerApiFeeRecipientsResponseSchema', - examples.relayerApiFeeRecipientsResponse, - `A collection of all used fee recipient addresses.`, - ), - }, - }, - '/v2/order': { - post: { - description: `Submit a signed order to the relayer.`, - operationId: 'postOrder', - parameters: generateParameters([], false), - requestBody: { - description: 'A valid signed 0x order based on the schema.', - content: { - 'application/json': { - schema: { - $ref: '#/components/schemas/signedOrderSchema', - }, - example: examples.signedOrder, - }, - }, - }, - responses: generateResponses(), - }, - }, - }, - components: { - schemas, - }, -}; diff --git a/packages/sra-api/src/errors.ts b/packages/sra-api/src/errors.ts deleted file mode 100644 index 20c35514f..000000000 --- a/packages/sra-api/src/errors.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { examples } from './examples'; -export const errorResponses = { - '400': { - description: 'Validation error', - content: { - 'application/json': { - schema: { $ref: '#/components/schemas/relayerApiErrorResponseSchema' }, - example: examples.validationError, - }, - }, - }, - '404': { - description: 'Not found', - }, - '429': { - description: 'Too many requests - Rate limit exceeded', - }, - '500': { - description: 'Internal Server Error', - }, - '501': { - description: 'Not implemented.', - }, -}; diff --git a/packages/sra-api/src/examples/errors.ts b/packages/sra-api/src/examples/errors.ts deleted file mode 100644 index 81f29d81c..000000000 --- a/packages/sra-api/src/examples/errors.ts +++ /dev/null @@ -1,11 +0,0 @@ -export const validationError = { - code: 100, - reason: 'Validation failed', - validationErrors: [ - { - field: 'networkId', - code: 1006, - reason: 'Network id 42 is not supported', - }, - ], -}; diff --git a/packages/sra-api/src/examples/index.ts b/packages/sra-api/src/examples/index.ts deleted file mode 100644 index dcf9b13eb..000000000 --- a/packages/sra-api/src/examples/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { validationError } from './errors'; -import { relayerApiAssetDataPairsResponse } from './relayerApiAssetDataPairsResponse'; -import { relayerApiFeeRecipientsResponse } from './relayerApiFeeRecipientsResponse'; -import { relayerApiOrder } from './relayerApiOrder'; -import { relayerApiOrderbookResponse } from './relayerApiOrderbookResponse'; -import { relayerApiOrderConfigPayload } from './relayerApiOrderConfigPayload'; -import { relayerApiOrderConfigResponse } from './relayerApiOrderConfigResponse'; -import { relayerApiOrdersResponse } from './relayerApiOrdersResponse'; -import { signedOrder } from './signedOrder'; - -export const examples = { - validationError, - relayerApiAssetDataPairsResponse, - relayerApiFeeRecipientsResponse, - relayerApiOrder, - relayerApiOrderbookResponse, - relayerApiOrderConfigPayload, - relayerApiOrderConfigResponse, - relayerApiOrdersResponse, - signedOrder, -}; diff --git a/packages/sra-api/src/examples/relayerApiAssetDataPairsResponse.ts b/packages/sra-api/src/examples/relayerApiAssetDataPairsResponse.ts deleted file mode 100644 index 9eead5239..000000000 --- a/packages/sra-api/src/examples/relayerApiAssetDataPairsResponse.ts +++ /dev/null @@ -1,21 +0,0 @@ -export const relayerApiAssetDataPairsResponse = { - total: 43, - page: 1, - perPage: 100, - records: [ - { - assetDataA: { - minAmount: '0', - maxAmount: '10000000000000000000', - precision: 5, - assetData: '0xf47261b04c32345ced77393b3530b1eed0f346429d', - }, - assetDataB: { - minAmount: '0', - maxAmount: '50000000000000000000', - precision: 5, - assetData: '0x0257179264389b814a946f3e92105513705ca6b990', - }, - }, - ], -}; diff --git a/packages/sra-api/src/examples/relayerApiFeeRecipientsResponse.ts b/packages/sra-api/src/examples/relayerApiFeeRecipientsResponse.ts deleted file mode 100644 index 0182af629..000000000 --- a/packages/sra-api/src/examples/relayerApiFeeRecipientsResponse.ts +++ /dev/null @@ -1,10 +0,0 @@ -export const relayerApiFeeRecipientsResponse = { - total: 3, - page: 1, - perPage: 10, - records: [ - '0x6eC92694ea172ebC430C30fa31De87620967A082', - '0x9e56625509c2f60af937f23b7b532600390e8c8b', - '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', - ], -}; diff --git a/packages/sra-api/src/examples/relayerApiOrder.ts b/packages/sra-api/src/examples/relayerApiOrder.ts deleted file mode 100644 index 31181d677..000000000 --- a/packages/sra-api/src/examples/relayerApiOrder.ts +++ /dev/null @@ -1,19 +0,0 @@ -export const relayerApiOrder = { - order: { - makerAddress: '0x9e56625509c2f60af937f23b7b532600390e8c8b', - takerAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', - feeRecipientAddress: '0xb046140686d052fff581f63f8136cce132e857da', - senderAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', - makerAssetAmount: '10000000000000000', - takerAssetAmount: '20000000000000000', - makerFee: '100000000000000', - takerFee: '200000000000000', - expirationTimeSeconds: '1532560590', - salt: '1532559225', - makerAssetData: '0xf47261b04c32345ced77393b3530b1eed0f346429d', - takerAssetData: '0x0257179264389b814a946f3e92105513705ca6b990', - exchangeAddress: '0x12459c951127e0c374ff9105dda097662a027093', - signature: '0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33', - }, - metaData: {}, -}; diff --git a/packages/sra-api/src/examples/relayerApiOrderConfigPayload.ts b/packages/sra-api/src/examples/relayerApiOrderConfigPayload.ts deleted file mode 100644 index 5251d5b4d..000000000 --- a/packages/sra-api/src/examples/relayerApiOrderConfigPayload.ts +++ /dev/null @@ -1,10 +0,0 @@ -export const relayerApiOrderConfigPayload = { - makerAddress: '0x9e56625509c2f60af937f23b7b532600390e8c8b', - takerAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', - makerAssetAmount: '10000000000000000', - takerAssetAmount: '20000000000000000', - makerAssetData: '0xf47261b04c32345ced77393b3530b1eed0f346429d', - takerAssetData: '0x0257179264389b814a946f3e92105513705ca6b990', - exchangeAddress: '0x12459c951127e0c374ff9105dda097662a027093', - expirationTimeSeconds: '1532560590', -}; diff --git a/packages/sra-api/src/examples/relayerApiOrderConfigResponse.ts b/packages/sra-api/src/examples/relayerApiOrderConfigResponse.ts deleted file mode 100644 index a3c531c0a..000000000 --- a/packages/sra-api/src/examples/relayerApiOrderConfigResponse.ts +++ /dev/null @@ -1,6 +0,0 @@ -export const relayerApiOrderConfigResponse = { - senderAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', - feeRecipientAddress: '0xb046140686d052fff581f63f8136cce132e857da', - makerFee: '100000000000000', - takerFee: '200000000000000', -}; diff --git a/packages/sra-api/src/examples/relayerApiOrderbookResponse.ts b/packages/sra-api/src/examples/relayerApiOrderbookResponse.ts deleted file mode 100644 index 40c09eff9..000000000 --- a/packages/sra-api/src/examples/relayerApiOrderbookResponse.ts +++ /dev/null @@ -1,54 +0,0 @@ -export const relayerApiOrderbookResponse = { - bids: { - total: 325, - page: 2, - perPage: 100, - records: [ - { - order: { - makerAddress: '0x9e56625509c2f60af937f23b7b532600390e8c8b', - takerAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', - feeRecipientAddress: '0xb046140686d052fff581f63f8136cce132e857da', - senderAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', - makerAssetAmount: '10000000000000000', - takerAssetAmount: '20000000000000000', - makerFee: '100000000000000', - takerFee: '200000000000000', - expirationTimeSeconds: '1532560590', - salt: '1532559225', - makerAssetData: '0xf47261b04c32345ced77393b3530b1eed0f346429d', - takerAssetData: '0x0257179264389b814a946f3e92105513705ca6b990', - exchangeAddress: '0x12459c951127e0c374ff9105dda097662a027093', - signature: '0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33', - }, - metaData: {}, - }, - ], - }, - asks: { - total: 500, - page: 2, - perPage: 100, - records: [ - { - order: { - makerAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', - takerAddress: '0x9e56625509c2f60af937f23b7b532600390e8c8b', - feeRecipientAddress: '0xb046140686d052fff581f63f8136cce132e857da', - senderAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', - makerAssetAmount: '20000000000000000', - takerAssetAmount: '10000000000000000', - makerFee: '200000000000000', - takerFee: '100000000000000', - expirationTimeSeconds: '1532560590', - salt: '1532559225', - makerAssetData: '0x0257179264389b814a946f3e92105513705ca6b990', - takerAssetData: '0xf47261b04c32345ced77393b3530b1eed0f346429d', - exchangeAddress: '0x12459c951127e0c374ff9105dda097662a027093', - signature: '0x013842a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b3518891', - }, - metaData: {}, - }, - ], - }, -}; diff --git a/packages/sra-api/src/examples/relayerApiOrdersResponse.ts b/packages/sra-api/src/examples/relayerApiOrdersResponse.ts deleted file mode 100644 index ac16e7e34..000000000 --- a/packages/sra-api/src/examples/relayerApiOrdersResponse.ts +++ /dev/null @@ -1,26 +0,0 @@ -export const relayerApiOrdersResponse = { - total: 984, - page: 1, - perPage: 100, - records: [ - { - order: { - makerAddress: '0x9e56625509c2f60af937f23b7b532600390e8c8b', - takerAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', - feeRecipientAddress: '0xb046140686d052fff581f63f8136cce132e857da', - senderAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', - makerAssetAmount: '10000000000000000', - takerAssetAmount: '20000000000000000', - makerFee: '100000000000000', - takerFee: '200000000000000', - expirationTimeSeconds: '1532560590', - salt: '1532559225', - makerAssetData: '0xf47261b04c32345ced77393b3530b1eed0f346429d', - takerAssetData: '0x0257179264389b814a946f3e92105513705ca6b990', - exchangeAddress: '0x12459c951127e0c374ff9105dda097662a027093', - signature: '0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33', - }, - metaData: {}, - }, - ], -}; diff --git a/packages/sra-api/src/examples/signedOrder.ts b/packages/sra-api/src/examples/signedOrder.ts deleted file mode 100644 index 440566027..000000000 --- a/packages/sra-api/src/examples/signedOrder.ts +++ /dev/null @@ -1,16 +0,0 @@ -export const signedOrder = { - makerAddress: '0x9e56625509c2f60af937f23b7b532600390e8c8b', - takerAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', - feeRecipientAddress: '0xb046140686d052fff581f63f8136cce132e857da', - senderAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', - makerAssetAmount: '10000000000000000', - takerAssetAmount: '20000000000000000', - makerFee: '100000000000000', - takerFee: '200000000000000', - expirationTimeSeconds: '1532560590', - salt: '1532559225', - makerAssetData: '0xf47261b04c32345ced77393b3530b1eed0f346429d', - takerAssetData: '0x0257179264389b814a946f3e92105513705ca6b990', - exchangeAddress: '0x12459c951127e0c374ff9105dda097662a027093', - signature: '0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33', -}; diff --git a/packages/sra-api/src/headers.ts b/packages/sra-api/src/headers.ts deleted file mode 100644 index 152254c9f..000000000 --- a/packages/sra-api/src/headers.ts +++ /dev/null @@ -1,20 +0,0 @@ -export const headers = { - 'X-Rate-Limit-Limit': { - description: `The maximum number of requests you're permitted to make per hour.`, - schema: { - type: 'integer', - }, - }, - 'X-Rate-Limit-Remaining': { - description: 'The number of requests remaining in the current rate limit window.', - schema: { - type: 'integer', - }, - }, - 'X-Rate-Limit-Reset': { - description: 'The time at which the current rate limit window resets in UTC epoch seconds.', - schema: { - type: 'integer', - }, - }, -}; diff --git a/packages/sra-api/src/index.ts b/packages/sra-api/src/index.ts deleted file mode 100644 index 4d73f3cd3..000000000 --- a/packages/sra-api/src/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { api } from './api'; diff --git a/packages/sra-api/src/json-schemas.ts b/packages/sra-api/src/json-schemas.ts deleted file mode 100644 index 173a04bfb..000000000 --- a/packages/sra-api/src/json-schemas.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { schemas as jsonSchemas } from '@0xproject/json-schemas'; - -// Only include schemas we actually need -const { - numberSchema, - addressSchema, - hexSchema, - orderHashSchema, - orderSchema, - signedOrderSchema, - signedOrdersSchema, - ordersSchema, - paginatedCollectionSchema, - relayerApiErrorResponseSchema, - relayerApiFeeRecipientsResponseSchema, - relayerApiOrderSchema, - relayerApiOrdersSchema, - relayerApiOrderConfigPayloadSchema, - relayerApiOrderConfigResponseSchema, - relayerApiOrderbookResponseSchema, - relayerApiAssetDataPairsResponseSchema, - relayerApiAssetDataTradeInfoSchema, - relayerApiOrdersChannelSubscribeSchema, - relayerApiOrdersChannelSubscribePayload, - relayerApiOrdersChannelUpdateSchema, - relayerApiOrdersResponseSchema, - relayerApiAssetDataPairsSchema, -} = jsonSchemas; - -const usedSchemas = { - numberSchema, - addressSchema, - hexSchema, - orderHashSchema, - orderSchema, - signedOrderSchema, - signedOrdersSchema, - ordersSchema, - paginatedCollectionSchema, - relayerApiErrorResponseSchema, - relayerApiFeeRecipientsResponseSchema, - relayerApiOrderSchema, - relayerApiOrdersSchema, - relayerApiOrderConfigPayloadSchema, - relayerApiOrderConfigResponseSchema, - relayerApiOrderbookResponseSchema, - relayerApiAssetDataPairsResponseSchema, - relayerApiAssetDataTradeInfoSchema, - relayerApiOrdersChannelSubscribeSchema, - relayerApiOrdersChannelSubscribePayload, - relayerApiOrdersChannelUpdateSchema, - relayerApiOrdersResponseSchema, - relayerApiAssetDataPairsSchema, -}; - -// We need to replace the `$ref`s to be OpenAPI compliant. -const openApiSchemas = JSON.parse( - JSON.stringify(usedSchemas).replace(/(\/\w+)/g, match => `#/components/schemas${match}`), -); -// The json schema used by OpenAPI does not accept ids -Object.keys(openApiSchemas).forEach(key => delete openApiSchemas[key].id); - -export const schemas = openApiSchemas; diff --git a/packages/sra-api/src/md/index.ts b/packages/sra-api/src/md/index.ts deleted file mode 100644 index 076c3c45c..000000000 --- a/packages/sra-api/src/md/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { readFileSync } from 'fs'; - -export const md = { - introduction: readFileSync('src/md/introduction.md').toString(), -}; diff --git a/packages/sra-api/src/md/introduction.md b/packages/sra-api/src/md/introduction.md deleted file mode 100644 index 6f733c9ab..000000000 --- a/packages/sra-api/src/md/introduction.md +++ /dev/null @@ -1,214 +0,0 @@ -# Testing - -Use the [sra-report](https://github.com/0xProject/0x-monorepo/tree/development/packages/sra-report) command line tool to test your API for SRA compliance. - -# Schemas - -The [JSON schemas](http://json-schema.org/) for the API payloads and responses can be found in [@0xproject/json-schemas](https://github.com/0xProject/0x.js/tree/development/packages/json-schemas). Examples of each payload and response can be found in the library's [test suite](https://github.com/0xProject/0x.js/blob/development/packages/json-schemas/test/schema_test.ts#L1). - -```bash -npm install @0xproject/json-schemas --save -``` - -You can easily validate your API's payloads and responses using the [@0xproject/json-schemas](https://github.com/0xProject/0x.js/tree/development/packages/json-schemas) package: - -```js -import {SchemaValidator, ValidatorResult, schemas} from '@0xproject/json-schemas'; - -const {relayerApiTokenPairsResponseSchema} = schemas; -const validator = new SchemaValidator(); - -const tokenPairsResponse = { - ... -}; -const validatorResult: ValidatorResult = validator.validate(tokenPairsResponse, relayerApiTokenPairsResponseSchema); -``` - -# Pagination - -Requests that return potentially large collections should respond to the **?page** and **?perPage** parameters. For example: - -```bash -$ curl https://api.example-relayer.com/v2/asset_pairs?page=3&perPage=20 -``` - -Page numbering should be 1-indexed, not 0-indexed. If a query provides an unreasonable (ie. too high) `perPage` value, the response can return a validation error as specified in the [errors section](#section/Errors). If the query specifies a `page` that does not exist (ie. there are not enough `records`), the response should just return an empty `records` array. - -All endpoints that are paginated should return a `total`, `page`, `perPage` and a `records` value in the top level of the collection. The value of `total` should be the total number of records for a given query, whereas `records` should be an array representing the response to the query for that page. `page` and `perPage`, are the same values that were specified in the request. See the note in [miscellaneous](#section/Misc.) about formatting `snake_case` vs. `lowerCamelCase`. - -These requests include the [`/v2/asset_pairs`](#operation/getAssetPairs), [`/v2/orders`](#operation/getOrders), [`/v2/fee_recipients`](#operation/getFeeRecipients) and [`/v2/orderbook`](#operation/getOrderbook) endpoints. - -# Network Id - -All requests should be able to specify a **?networkId** query param for all supported networks. For example: - -```bash -$ curl https://api.example-relayer.com/v2/asset_pairs?networkId=1 -``` - -If the query param is not provided, it should default to **1** (mainnet). - -Networks and their Ids: - -| Network Id | Network Name | -| ---------- | ------------ | -| 1 | Mainnet | -| 42 | Kovan | -| 3 | Ropsten | -| 4 | Rinkeby | - -If a certain network is not supported, the response should **400** as specified in the [error response](#section/Errors) section. For example: - -```json -{ - "code": 100, - "reason": "Validation failed", - "validationErrors": [ - { - "field": "networkId", - "code": 1006, - "reason": "Network id 42 is not supported" - } - ] -} -``` - -# Link Header - -A [Link Header](https://tools.ietf.org/html/rfc5988) can be included in a response to provide clients with more context about paging -For example: - -```bash -Link: ; rel="next", -; rel="last" -``` - -This `Link` response header contains one or more Hypermedia link relations. - -The possible `rel` values are: - -| Name | Description | -| ----- | ------------------------------------------------------------- | -| next | The link relation for the immediate next page of results. | -| last | The link relation for the last page of results. | -| first | The link relation for the first page of results. | -| prev | The link relation for the immediate previous page of results. | - -# Rate Limits - -Rate limit guidance for clients can be optionally returned in the response headers: - -| Header Name | Description | -| --------------------- | ---------------------------------------------------------------------------- | -| X-RateLimit-Limit | The maximum number of requests you're permitted to make per hour. | -| X-RateLimit-Remaining | The number of requests remaining in the current rate limit window. | -| X-RateLimit-Reset | The time at which the current rate limit window resets in UTC epoch seconds. | - -For example: - -```bash -$ curl -i https://api.example-relayer.com/v2/asset_pairs -HTTP/1.1 200 OK -Date: Mon, 20 Oct 2017 12:30:06 GMT -Status: 200 OK -X-RateLimit-Limit: 60 -X-RateLimit-Remaining: 56 -X-RateLimit-Reset: 1372700873 -``` - -When a rate limit is exceeded, a status of **429 Too Many Requests** should be returned. - -# Errors - -Unless the spec defines otherwise, errors to bad requests should respond with HTTP 4xx or status codes. - -## Common error codes - -| Code | Reason | -| ---- | --------------------------------------- | -| 400 | Bad Request – Invalid request format | -| 404 | Not found | -| 429 | Too many requests - Rate limit exceeded | -| 500 | Internal Server Error | -| 501 | Not Implemented | - -## Error reporting format - -For all **400** responses, see the [error response schema](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_error_response_schema.ts#L1). - -```json -{ - "code": 101, - "reason": "Validation failed", - "validationErrors": [ - { - "field": "maker", - "code": 1002, - "reason": "Invalid address" - } - ] -} -``` - -General error codes: - -```bash -100 - Validation Failed -101 - Malformed JSON -102 - Order submission disabled -103 - Throttled -``` - -Validation error codes: - -```bash -1000 - Required field -1001 - Incorrect format -1002 - Invalid address -1003 - Address not supported -1004 - Value out of range -1005 - Invalid signature or hash -1006 - Unsupported option -``` - -# Asset Data Encoding - -As we now support multiple [token transfer proxies](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#assetproxy), the identifier of which proxy to use for the token transfer must be encoded, along with the token information. Each proxy in 0x v2 has a unique identifier. If you're using 0x.js there will be helper methods for this [encoding](https://0xproject.com/docs/0x.js#zeroEx-encodeERC20AssetData) and [decoding](https://0xproject.com/docs/0x.js#zeroEx-decodeAssetProxyId). - -The identifier for the Proxy uses a similar scheme to [ABI function selectors](https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI#function-selector). - -```js -// ERC20 Proxy ID 0xf47261b0 -bytes4(keccak256('ERC20Token(address)')); -// ERC721 Proxy ID 0x08e937fa -bytes4(keccak256('ERC721Token(address,uint256)')); -``` - -Asset data is encoded using [ABI encoding](https://solidity.readthedocs.io/en/develop/abi-spec.html). - -For example, encoding the ERC20 token contract (address: 0x1dc4c1cefef38a777b15aa20260a54e584b16c48) using the ERC20 Transfer Proxy (id: 0xf47261b0) would be: - -```bash -0xf47261b00000000000000000000000001dc4c1cefef38a777b15aa20260a54e584b16c48 -``` - -Encoding the ERC721 token contract (address: `0x371b13d97f4bf77d724e78c16b7dc74099f40e84`), token id (id: `99`, which hex encoded is `0x63`) and the ERC721 Transfer Proxy (id: 0x08e937fa) would be: - -```bash -0x08e937fa000000000000000000000000371b13d97f4bf77d724e78c16b7dc74099f40e840000000000000000000000000000000000000000000000000000000000000063 -``` - -For more information see [the Asset Proxy](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#erc20proxy) section of the v2 spec and the [Ethereum ABI Spec](https://solidity.readthedocs.io/en/develop/abi-spec.html). - -# Meta Data in Order Responses - -In v2 of the standard relayer API we added the `metaData` field. It is meant to provide a standard place for relayers to put optional, custom or non-standard fields that may of interest to the consumer of the API. - -A good example of such a field is `remainingTakerAssetAmount`, which is a convenience field that communicates how much of a 0x order is potentially left to be filled. Unlike the other fields in a 0x order, it is not guaranteed to be correct as it is derived from whatever mechanism the implementer (ie. the relayer) is using. While convenient for prototyping and low stakes situations, we recommend validating the value of the field by checking the state of the blockchain yourself, such as by using [Order Watcher](https://0xproject.com/wiki#0x-OrderWatcher). - -# Misc. - -* All requests and responses should be of **application/json** content type -* All token amounts are sent in amounts of the smallest level of precision (base units). (e.g if a token has 18 decimal places, selling 1 token would show up as selling `'1000000000000000000'` units by this API). -* All addresses are sent as lower-case (non-checksummed) Ethereum addresses with the `0x` prefix. -* All parameters are to be written in `lowerCamelCase`. diff --git a/packages/sra-api/src/parameters.ts b/packages/sra-api/src/parameters.ts deleted file mode 100644 index 48ffb036d..000000000 --- a/packages/sra-api/src/parameters.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { ParameterObject } from '@loopback/openapi-v3-types'; -export const paginationParameters: ParameterObject[] = [ - { - name: 'page', - in: 'query', - description: 'The number of the page to request in the collection.', - example: 3, - schema: { - type: 'number', - default: 1, - }, - }, - { - name: 'perPage', - in: 'query', - description: 'The number of records to return per page.', - example: 10, - schema: { - type: 'number', - default: 100, - }, - }, -]; - -export const networkdIdParameter: ParameterObject = { - name: 'networkId', - in: 'query', - description: 'The id of the Ethereum network', - example: 42, - schema: { - type: 'number', - default: 1, - }, -}; - -export const generateParameters = (parameters: ParameterObject[], isPaginated: boolean = false): ParameterObject[] => { - const optionalParameters = isPaginated ? paginationParameters : []; - return [...parameters, networkdIdParameter, ...optionalParameters]; -}; diff --git a/packages/sra-api/src/responses.ts b/packages/sra-api/src/responses.ts deleted file mode 100644 index cd7352058..000000000 --- a/packages/sra-api/src/responses.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { ResponsesObject } from '@loopback/openapi-v3-types'; - -import { errorResponses } from './errors'; -import { headers } from './headers'; - -export const generateResponses = (schemaName?: string, example?: any, description: string = 'OK'): ResponsesObject => { - const responses = { - '200': { - headers, - description, - content: {}, - }, - ...errorResponses, - }; - if (schemaName) { - responses['200'].content = { - 'application/json': { - schema: { $ref: `#/components/schemas/${schemaName}` }, - example, - }, - }; - } - return responses; -}; diff --git a/packages/sra-api/tsconfig.json b/packages/sra-api/tsconfig.json deleted file mode 100644 index e60028885..000000000 --- a/packages/sra-api/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "../../tsconfig", - "compilerOptions": { - "outDir": "lib" - }, - "include": ["./src/**/*", "./test/*"] -} diff --git a/packages/sra-api/tslint.json b/packages/sra-api/tslint.json deleted file mode 100644 index ffaefe83a..000000000 --- a/packages/sra-api/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": ["@0xproject/tslint-config"] -} diff --git a/packages/sra-spec/.discharge.json b/packages/sra-spec/.discharge.json new file mode 100644 index 000000000..80ede84f3 --- /dev/null +++ b/packages/sra-spec/.discharge.json @@ -0,0 +1,13 @@ +{ + "domain": "sra-spec", + "build_command": "yarn build-json", + "upload_directory": "public", + "index_key": "index.html", + "error_key": "index.html", + "trailing_slashes": true, + "cache": 3600, + "aws_profile": "default", + "aws_region": "us-east-1", + "cdn": false, + "dns_configured": true +} diff --git a/packages/sra-spec/.npmignore b/packages/sra-spec/.npmignore new file mode 100644 index 000000000..e610180ad --- /dev/null +++ b/packages/sra-spec/.npmignore @@ -0,0 +1,8 @@ +.* +yarn-error.log +/src/ +/schemas/ +test/ +tsconfig.json +/lib/src/monorepo_scripts/ +/public/ \ No newline at end of file diff --git a/packages/sra-spec/CHANGELOG.json b/packages/sra-spec/CHANGELOG.json new file mode 100644 index 000000000..d6797cc45 --- /dev/null +++ b/packages/sra-spec/CHANGELOG.json @@ -0,0 +1,21 @@ +[ + { + "version": "1.0.1-rc.5", + "changes": [ + { + "note": "Add takerAddress to /orders parameters", + "pr": 974 + } + ] + }, + { + "version": "1.0.1-rc.4", + "changes": [ + { + "note": "Add inital spec for SRA v2", + "pr": 916 + } + ], + "timestamp": 1534210131 + } +] diff --git a/packages/sra-spec/CHANGELOG.md b/packages/sra-spec/CHANGELOG.md new file mode 100644 index 000000000..ed0d4891b --- /dev/null +++ b/packages/sra-spec/CHANGELOG.md @@ -0,0 +1,10 @@ + + +CHANGELOG + +## v1.0.1-rc.4 - _August 13, 2018_ + + * Add inital spec for SRA v2 (#916) diff --git a/packages/sra-spec/README.md b/packages/sra-spec/README.md new file mode 100644 index 000000000..7eee6396b --- /dev/null +++ b/packages/sra-spec/README.md @@ -0,0 +1,93 @@ +## @0xproject/sra-spec + +Contains the Standard Relayer API [OpenAPI Spec](https://github.com/OAI/OpenAPI-Specification). + +The package distributes both a javascript object version and a json version. + +A deployed [ReDoc](https://github.com/Rebilly/ReDoc) static site with the API can be found here http://sra-spec.s3-website-us-east-1.amazonaws.com/. + +## Usage + +``` +import { api } from '@0xproject/sra-spec'; +``` + +## Installation + +``` +yarn install +``` + +## Development + +You can start a development server that will serve a [ReDoc](https://github.com/Rebilly/ReDoc) documentation instance. It uses the `api.json` file from `lib/` (you must have built at least once with `yarn build` or `yarn build-json`) that is based on the `api` object exported from `src`. + +``` +yarn watch_without_deps +``` + +The process will watch for changes, but will not hot-reload so you must refresh the page to see the changes. + +## 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=@0xproject/sra-spec yarn build +``` + +Or continuously rebuild on change: + +```bash +PKG=@0xproject/sra-spec yarn watch +``` + +### Static Site + +We also [host a static HTML version of the docs on S3](http://sra-spec.s3-website-us-east-1.amazonaws.com/) for easy sharing. + +To build and deploy the site run + +``` +yarn deploy-site +``` + +**NOTE: On deploying the site, it will say the site is available at a non-existent URL. Please ignore and use the (now updated) URL above.** + +### Clean + +```bash +yarn clean +``` + +### Lint + +```bash +yarn lint +``` + +### Run Tests + +```bash +yarn test +``` diff --git a/packages/sra-spec/build_scripts/buildJson.ts b/packages/sra-spec/build_scripts/buildJson.ts new file mode 100644 index 000000000..b92b5172b --- /dev/null +++ b/packages/sra-spec/build_scripts/buildJson.ts @@ -0,0 +1,7 @@ +import { writeFileSync } from 'fs'; + +import { api } from '../src'; + +const apiJson = JSON.stringify(api); +writeFileSync('lib/api.json', apiJson); +writeFileSync('public/api.json', apiJson); diff --git a/packages/sra-spec/package.json b/packages/sra-spec/package.json new file mode 100644 index 000000000..e52e72749 --- /dev/null +++ b/packages/sra-spec/package.json @@ -0,0 +1,60 @@ +{ + "name": "@0xproject/sra-spec", + "version": "1.0.1-rc.4", + "engines": { + "node": ">=6.12" + }, + "description": "Standard Relayer API Open API Spec", + "main": "lib/src/index.js", + "types": "lib/src/index.d.ts", + "scripts": { + "serve": "redoc-cli serve lib/api.json --watch", + "watch_without_deps": "run-p build-json:watch serve", + "lint": "tslint --project .", + "test": "swagger-cli validate lib/api.json", + "rebuild_and_test": "run-s clean build test", + "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", + "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", + "test:circleci": "yarn test:coverage", + "clean": "shx rm -rf lib", + "build": "tsc && yarn build-json", + "build-json": "ts-node build_scripts/buildJson.ts", + "build-json:watch": "chokidar 'src/**/*' -c 'yarn build-json' ", + "deploy-site": "discharge deploy" + }, + "repository": { + "type": "git", + "url": "https://github.com/0xProject/0x-monorepo.git" + }, + "author": "Francesco Agosti", + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/0xProject/0x-monorepo/issues" + }, + "homepage": "https://github.com/0xProject/0x-monorepo/packages/sra-spec/README.md", + "dependencies": { + "@0xproject/json-schemas": "^1.0.1-rc.4" + }, + "devDependencies": { + "@0xproject/tslint-config": "^1.0.5", + "@loopback/openapi-v3-types": "^0.8.2", + "@types/mocha": "^2.2.42", + "@types/node": "^10.5.3", + "chai": "^4.0.1", + "chokidar-cli": "^1.2.0", + "dirty-chai": "^2.0.1", + "discharge": "^0.7.1", + "mocha": "^4.0.1", + "npm-run-all": "^4.1.3", + "nyc": "^11.0.1", + "redoc-cli": "^0.6.1", + "shx": "^0.2.2", + "swagger-cli": "^2.1.1", + "ts-node": "^7.0.0", + "tslint": "5.11.0", + "typescript": "2.7.1" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/packages/sra-spec/public/api.json b/packages/sra-spec/public/api.json new file mode 100644 index 000000000..fc2409abb --- /dev/null +++ b/packages/sra-spec/public/api.json @@ -0,0 +1 @@ +{"openapi":"3.0.0","info":{"version":"2.0.0","title":"Standard Relayer REST API","description":"# Testing\n\nUse the [sra-report](https://github.com/0xProject/0x-monorepo/tree/development/packages/sra-report) command line tool to test your API for SRA compliance.\n\n# Schemas\n\nThe [JSON schemas](http://json-schema.org/) for the API payloads and responses can be found in [@0xproject/json-schemas](https://github.com/0xProject/0x.js/tree/development/packages/json-schemas). Examples of each payload and response can be found in the library's [test suite](https://github.com/0xProject/0x.js/blob/development/packages/json-schemas/test/schema_test.ts#L1).\n\n```bash\nnpm install @0xproject/json-schemas --save\n```\n\nYou can easily validate your API's payloads and responses using the [@0xproject/json-schemas](https://github.com/0xProject/0x.js/tree/development/packages/json-schemas) package:\n\n```js\nimport {SchemaValidator, ValidatorResult, schemas} from '@0xproject/json-schemas';\n\nconst {relayerApiTokenPairsResponseSchema} = schemas;\nconst validator = new SchemaValidator();\n\nconst tokenPairsResponse = {\n ...\n};\nconst validatorResult: ValidatorResult = validator.validate(tokenPairsResponse, relayerApiTokenPairsResponseSchema);\n```\n\n# Pagination\n\nRequests that return potentially large collections should respond to the **?page** and **?perPage** parameters. For example:\n\n```bash\n$ curl https://api.example-relayer.com/v2/asset_pairs?page=3&perPage=20\n```\n\nPage numbering should be 1-indexed, not 0-indexed. If a query provides an unreasonable (ie. too high) `perPage` value, the response can return a validation error as specified in the [errors section](#section/Errors). If the query specifies a `page` that does not exist (ie. there are not enough `records`), the response should just return an empty `records` array.\n\nAll endpoints that are paginated should return a `total`, `page`, `perPage` and a `records` value in the top level of the collection. The value of `total` should be the total number of records for a given query, whereas `records` should be an array representing the response to the query for that page. `page` and `perPage`, are the same values that were specified in the request. See the note in [miscellaneous](#section/Misc.) about formatting `snake_case` vs. `lowerCamelCase`.\n\nThese requests include the [`/v2/asset_pairs`](#operation/getAssetPairs), [`/v2/orders`](#operation/getOrders), [`/v2/fee_recipients`](#operation/getFeeRecipients) and [`/v2/orderbook`](#operation/getOrderbook) endpoints.\n\n# Network Id\n\nAll requests should be able to specify a **?networkId** query param for all supported networks. For example:\n\n```bash\n$ curl https://api.example-relayer.com/v2/asset_pairs?networkId=1\n```\n\nIf the query param is not provided, it should default to **1** (mainnet).\n\nNetworks and their Ids:\n\n| Network Id | Network Name |\n| ---------- | ------------ |\n| 1 | Mainnet |\n| 42 | Kovan |\n| 3 | Ropsten |\n| 4 | Rinkeby |\n\nIf a certain network is not supported, the response should **400** as specified in the [error response](#section/Errors) section. For example:\n\n```json\n{\n \"code\": 100,\n \"reason\": \"Validation failed\",\n \"validationErrors\": [\n {\n \"field\": \"networkId\",\n \"code\": 1006,\n \"reason\": \"Network id 42 is not supported\"\n }\n ]\n}\n```\n\n# Link Header\n\nA [Link Header](https://tools.ietf.org/html/rfc5988) can be included in a response to provide clients with more context about paging\nFor example:\n\n```bash\nLink: ; rel=\"next\",\n; rel=\"last\"\n```\n\nThis `Link` response header contains one or more Hypermedia link relations.\n\nThe possible `rel` values are:\n\n| Name | Description |\n| ----- | ------------------------------------------------------------- |\n| next | The link relation for the immediate next page of results. |\n| last | The link relation for the last page of results. |\n| first | The link relation for the first page of results. |\n| prev | The link relation for the immediate previous page of results. |\n\n# Rate Limits\n\nRate limit guidance for clients can be optionally returned in the response headers:\n\n| Header Name | Description |\n| --------------------- | ---------------------------------------------------------------------------- |\n| X-RateLimit-Limit | The maximum number of requests you're permitted to make per hour. |\n| X-RateLimit-Remaining | The number of requests remaining in the current rate limit window. |\n| X-RateLimit-Reset | The time at which the current rate limit window resets in UTC epoch seconds. |\n\nFor example:\n\n```bash\n$ curl -i https://api.example-relayer.com/v2/asset_pairs\nHTTP/1.1 200 OK\nDate: Mon, 20 Oct 2017 12:30:06 GMT\nStatus: 200 OK\nX-RateLimit-Limit: 60\nX-RateLimit-Remaining: 56\nX-RateLimit-Reset: 1372700873\n```\n\nWhen a rate limit is exceeded, a status of **429 Too Many Requests** should be returned.\n\n# Errors\n\nUnless the spec defines otherwise, errors to bad requests should respond with HTTP 4xx or status codes.\n\n## Common error codes\n\n| Code | Reason |\n| ---- | --------------------------------------- |\n| 400 | Bad Request – Invalid request format |\n| 404 | Not found |\n| 429 | Too many requests - Rate limit exceeded |\n| 500 | Internal Server Error |\n| 501 | Not Implemented |\n\n## Error reporting format\n\nFor all **400** responses, see the [error response schema](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_error_response_schema.ts#L1).\n\n```json\n{\n \"code\": 101,\n \"reason\": \"Validation failed\",\n \"validationErrors\": [\n {\n \"field\": \"maker\",\n \"code\": 1002,\n \"reason\": \"Invalid address\"\n }\n ]\n}\n```\n\nGeneral error codes:\n\n```bash\n100 - Validation Failed\n101 - Malformed JSON\n102 - Order submission disabled\n103 - Throttled\n```\n\nValidation error codes:\n\n```bash\n1000 - Required field\n1001 - Incorrect format\n1002 - Invalid address\n1003 - Address not supported\n1004 - Value out of range\n1005 - Invalid signature or hash\n1006 - Unsupported option\n```\n\n# Asset Data Encoding\n\nAs we now support multiple [token transfer proxies](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#assetproxy), the identifier of which proxy to use for the token transfer must be encoded, along with the token information. Each proxy in 0x v2 has a unique identifier. If you're using 0x.js there will be helper methods for this [encoding](https://0xproject.com/docs/0x.js#zeroEx-encodeERC20AssetData) and [decoding](https://0xproject.com/docs/0x.js#zeroEx-decodeAssetProxyId).\n\nThe identifier for the Proxy uses a similar scheme to [ABI function selectors](https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI#function-selector).\n\n```js\n// ERC20 Proxy ID 0xf47261b0\nbytes4(keccak256('ERC20Token(address)'));\n// ERC721 Proxy ID 0x08e937fa\nbytes4(keccak256('ERC721Token(address,uint256)'));\n```\n\nAsset data is encoded using [ABI encoding](https://solidity.readthedocs.io/en/develop/abi-spec.html).\n\nFor example, encoding the ERC20 token contract (address: 0x1dc4c1cefef38a777b15aa20260a54e584b16c48) using the ERC20 Transfer Proxy (id: 0xf47261b0) would be:\n\n```bash\n0xf47261b00000000000000000000000001dc4c1cefef38a777b15aa20260a54e584b16c48\n```\n\nEncoding the ERC721 token contract (address: `0x371b13d97f4bf77d724e78c16b7dc74099f40e84`), token id (id: `99`, which hex encoded is `0x63`) and the ERC721 Transfer Proxy (id: 0x08e937fa) would be:\n\n```bash\n0x08e937fa000000000000000000000000371b13d97f4bf77d724e78c16b7dc74099f40e840000000000000000000000000000000000000000000000000000000000000063\n```\n\nFor more information see [the Asset Proxy](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#erc20proxy) section of the v2 spec and the [Ethereum ABI Spec](https://solidity.readthedocs.io/en/develop/abi-spec.html).\n\n# Meta Data in Order Responses\n\nIn v2 of the standard relayer API we added the `metaData` field. It is meant to provide a standard place for relayers to put optional, custom or non-standard fields that may of interest to the consumer of the API.\n\nA good example of such a field is `remainingTakerAssetAmount`, which is a convenience field that communicates how much of a 0x order is potentially left to be filled. Unlike the other fields in a 0x order, it is not guaranteed to be correct as it is derived from whatever mechanism the implementer (ie. the relayer) is using. While convenient for prototyping and low stakes situations, we recommend validating the value of the field by checking the state of the blockchain yourself, such as by using [Order Watcher](https://0xproject.com/wiki#0x-OrderWatcher).\n\n# Misc.\n\n* All requests and responses should be of **application/json** content type\n* All token amounts are sent in amounts of the smallest level of precision (base units). (e.g if a token has 18 decimal places, selling 1 token would show up as selling `'1000000000000000000'` units by this API).\n* All addresses are sent as lower-case (non-checksummed) Ethereum addresses with the `0x` prefix.\n* All parameters are to be written in `lowerCamelCase`.\n","license":{"name":"Apache 2.0","url":"https://www.apache.org/licenses/LICENSE-2.0.html"}},"paths":{"/v2/asset_pairs":{"get":{"description":"Retrieves a list of available asset pairs and the information required to trade them (in any order). Setting only `assetDataA` or `assetDataB` returns pairs filtered by that asset only.","operationId":"getAssetPairs","parameters":[{"name":"assetDataA","in":"query","description":"The assetData value for the first asset in the pair.","example":"0xf47261b04c32345ced77393b3530b1eed0f346429d","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"assetDataB","in":"query","description":"The assetData value for the second asset in the pair.","example":"0x0257179264389b814a946f3e92105513705ca6b990","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}},{"name":"page","in":"query","description":"The number of the page to request in the collection.","example":3,"schema":{"type":"number","default":1}},{"name":"perPage","in":"query","description":"The number of records to return per page.","example":10,"schema":{"type":"number","default":100}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"Returns a collection of available asset pairs with some meta info","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiAssetDataPairsResponseSchema"},"example":{"total":43,"page":1,"perPage":100,"records":[{"assetDataA":{"minAmount":"0","maxAmount":"10000000000000000000","precision":5,"assetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d"},"assetDataB":{"minAmount":"0","maxAmount":"50000000000000000000","precision":5,"assetData":"0x0257179264389b814a946f3e92105513705ca6b990"}}]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/orders":{"get":{"description":"Retrieves a list of orders given query parameters. This endpoint should be [paginated](#section/Pagination). For querying an entire orderbook snapshot, the [orderbook endpoint](#operation/getOrderbook) is recommended. If both makerAssetData and takerAssetData are specified, returned orders will be sorted by price determined by (takerTokenAmount/makerTokenAmount) in ascending order. By default, orders returned by this endpoint are unsorted.","operationId":"getOrders","parameters":[{"name":"makerAssetProxyId","in":"query","description":"The maker [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \"0xf47261b0\" for ERC20, \"0x02571792\" for ERC721).","example":"0xf47261b0","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"takerAssetProxyId","in":"query","description":"The taker asset [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \"0xf47261b0\" for ERC20, \"0x02571792\" for ERC721).","example":"0x02571792","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"makerAssetAddress","in":"query","description":"The contract address for the maker asset.","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"takerAssetAddress","in":"query","description":"The contract address for the taker asset.","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"exchangeAddress","in":"query","description":"Same as exchangeAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"senderAddress","in":"query","description":"Same as senderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"makerAssetData","in":"query","description":"Same as makerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"takerAssetData","in":"query","description":"Same as takerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"traderAssetData","in":"query","description":"Same as traderAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"makerAddress","in":"query","description":"Same as makerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"takerAddress","in":"query","description":"Same as takerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"traderAddress","in":"query","description":"Same as traderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"feeRecipientAddress","in":"query","description":"Same as feeRecipientAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}},{"name":"page","in":"query","description":"The number of the page to request in the collection.","example":3,"schema":{"type":"number","default":1}},{"name":"perPage","in":"query","description":"The number of records to return per page.","example":10,"schema":{"type":"number","default":100}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"A collection of 0x orders with meta-data as specified by query params","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrdersResponseSchema"},"example":{"total":984,"page":1,"perPage":100,"records":[{"order":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"},"metaData":{}}]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/order/{orderHash}":{"get":{"description":"Retrieves the 0x order with meta info that is associated with the hash.","operationId":"getOrder","parameters":[{"name":"orderHash","in":"path","description":"The hash of the desired 0x order.","example":"0xd4b103c42d2512eef3fee775e097f044291615d25f5d71e0ac70dbd49d223591","schema":{"$ref":"#/components/schemas/orderHashSchema"}},{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"The order and meta info associated with the orderHash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrderSchema"},"example":{"order":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"},"metaData":{}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/orderbook":{"get":{"description":"Retrieves the orderbook for a given asset pair. This endpoint should be [paginated](#section/Pagination). Bids will be sorted in descending order by price, and asks will be sorted in ascending order by price. Within the price sorted orders, the orders are further sorted by _taker fee price_ which is defined as the **takerFee** divided by **takerTokenAmount**. After _taker fee price_, orders are to be sorted by expiration in ascending order. The way pagination works for this endpoint is that the **page** and **perPage** query params apply to both `bids` and `asks` collections, and if `page` * `perPage` > `total` for a certain collection, the `records` for that collection should just be empty. ","operationId":"getOrderbook","parameters":[{"name":"baseAssetData","in":"query","description":"assetData (makerAssetData or takerAssetData) designated as the base currency in the [currency pair calculation](https://en.wikipedia.org/wiki/Currency_pair) of price.","required":true,"example":"0xf47261b04c32345ced77393b3530b1eed0f346429d","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"quoteAssetData","in":"query","description":"assetData (makerAssetData or takerAssetData) designated as the quote currency in the currency pair calculation of price (required).","required":true,"example":"0xf47261b04c32345ced77393b3530b1eed0f346429d","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}},{"name":"page","in":"query","description":"The number of the page to request in the collection.","example":3,"schema":{"type":"number","default":1}},{"name":"perPage","in":"query","description":"The number of records to return per page.","example":10,"schema":{"type":"number","default":100}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"The sorted order book for the specified asset pair.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrderbookResponseSchema"},"example":{"bids":{"total":325,"page":2,"perPage":100,"records":[{"order":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"},"metaData":{}}]},"asks":{"total":500,"page":2,"perPage":100,"records":[{"order":{"makerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","takerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"20000000000000000","takerAssetAmount":"10000000000000000","makerFee":"200000000000000","takerFee":"100000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","takerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x013842a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b3518891"},"metaData":{}}]}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/order_config":{"get":{"description":"Relayers have full discretion over the orders that they are willing to host on their orderbooks (e.g what fees they charge, etc...). In order for traders to discover their requirements programmatically, they can send an incomplete order to this endpoint and receive the missing fields, specifc to that order. This gives relayers a large amount of flexibility to tailor fees to unique traders, trading pairs and volume amounts. Submit a partial order and receive information required to complete the order: `senderAddress`, `feeRecipientAddress`, `makerFee`, `takerFee`. ","operationId":"getOrderConfig","parameters":[{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}}],"requestBody":{"description":"The fields of a 0x order the relayer may want to decide what configuration to send back.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrderConfigPayloadSchema"},"example":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","expirationTimeSeconds":"1532560590"}}}},"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"The additional fields necessary in order to submit an order to the relayer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrderConfigResponseSchema"},"example":{"senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","makerFee":"100000000000000","takerFee":"200000000000000"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/fee_recipients":{"get":{"description":"Retrieves a collection of all fee recipient addresses for a relayer. This endpoint should be [paginated](#section/Pagination).","operationId":"getFeeRecipients","parameters":[{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}},{"name":"page","in":"query","description":"The number of the page to request in the collection.","example":3,"schema":{"type":"number","default":1}},{"name":"perPage","in":"query","description":"The number of records to return per page.","example":10,"schema":{"type":"number","default":100}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"A collection of all used fee recipient addresses.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiFeeRecipientsResponseSchema"},"example":{"total":3,"page":1,"perPage":10,"records":["0x6eC92694ea172ebC430C30fa31De87620967A082","0x9e56625509c2f60af937f23b7b532600390e8c8b","0xa2b31dacf30a9c50ca473337c01d8a201ae33e32"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/order":{"post":{"description":"Submit a signed order to the relayer.","operationId":"postOrder","parameters":[{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}}],"requestBody":{"description":"A valid signed 0x order based on the schema.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/signedOrderSchema"},"example":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"}}}},"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"OK","content":{}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}}},"components":{"schemas":{"numberSchema":{"type":"string","pattern":"^\\d+(\\.\\d+)?$"},"addressSchema":{"type":"string","pattern":"^0x[0-9a-f]{40}$"},"hexSchema":{"type":"string","pattern":"^0x(([0-9a-f][0-9a-f])+)?$"},"orderHashSchema":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$"},"orderSchema":{"properties":{"makerAddress":{"$ref":"#/components/schemas/addressSchema"},"takerAddress":{"$ref":"#/components/schemas/addressSchema"},"makerFee":{"$ref":"#/components/schemas/numberSchema"},"takerFee":{"$ref":"#/components/schemas/numberSchema"},"senderAddress":{"$ref":"#/components/schemas/addressSchema"},"makerAssetAmount":{"$ref":"#/components/schemas/numberSchema"},"takerAssetAmount":{"$ref":"#/components/schemas/numberSchema"},"makerAssetData":{"$ref":"#/components/schemas/hexSchema"},"takerAssetData":{"$ref":"#/components/schemas/hexSchema"},"salt":{"$ref":"#/components/schemas/numberSchema"},"exchangeAddress":{"$ref":"#/components/schemas/addressSchema"},"feeRecipientAddress":{"$ref":"#/components/schemas/addressSchema"},"expirationTimeSeconds":{"$ref":"#/components/schemas/numberSchema"}},"required":["makerAddress","takerAddress","makerFee","takerFee","senderAddress","makerAssetAmount","takerAssetAmount","makerAssetData","takerAssetData","salt","exchangeAddress","feeRecipientAddress","expirationTimeSeconds"],"type":"object"},"signedOrderSchema":{"allOf":[{"$ref":"#/components/schemas/orderSchema"},{"properties":{"signature":{"$ref":"#/components/schemas/hexSchema"}},"required":["signature"]}]},"signedOrdersSchema":{"type":"array","items":{"$ref":"#/components/schemas/signedOrderSchema"}},"ordersSchema":{"type":"array","items":{"$ref":"#/components/schemas/orderSchema"}},"paginatedCollectionSchema":{"type":"object","properties":{"total":{"type":"number"},"perPage":{"type":"number"},"page":{"type":"number"}},"required":["total","perPage","page"]},"relayerApiErrorResponseSchema":{"type":"object","properties":{"code":{"type":"integer","minimum":100,"maximum":103},"reason":{"type":"string"},"validationErrors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"integer","minimum":1000,"maximum":1006},"reason":{"type":"string"}},"required":["field","code","reason"]}}},"required":["code","reason"]},"relayerApiFeeRecipientsResponseSchema":{"type":"object","allOf":[{"$ref":"#/components/schemas/paginatedCollectionSchema"},{"properties":{"records":{"id":"#/components/schemas/relayerApiFeeRecipientsSchema","type":"array","items":{"$ref":"#/components/schemas/addressSchema"}}},"required":["records"]}]},"relayerApiOrderSchema":{"type":"object","properties":{"order":{"$ref":"#/components/schemas/orderSchema"},"metaData":{"type":"object"}},"required":["order","metaData"]},"relayerApiOrdersSchema":{"type":"array","items":{"$ref":"#/components/schemas/relayerApiOrderSchema"}},"relayerApiOrderConfigPayloadSchema":{"type":"object","properties":{"makerAddress":{"$ref":"#/components/schemas/addressSchema"},"takerAddress":{"$ref":"#/components/schemas/addressSchema"},"makerAssetAmount":{"$ref":"#/components/schemas/numberSchema"},"takerAssetAmount":{"$ref":"#/components/schemas/numberSchema"},"makerAssetData":{"$ref":"#/components/schemas/hexSchema"},"takerAssetData":{"$ref":"#/components/schemas/hexSchema"},"exchangeAddress":{"$ref":"#/components/schemas/addressSchema"},"expirationTimeSeconds":{"$ref":"#/components/schemas/numberSchema"}},"required":["makerAddress","takerAddress","makerAssetAmount","takerAssetAmount","makerAssetData","takerAssetData","exchangeAddress","expirationTimeSeconds"]},"relayerApiOrderConfigResponseSchema":{"type":"object","properties":{"makerFee":{"$ref":"#/components/schemas/numberSchema"},"takerFee":{"$ref":"#/components/schemas/numberSchema"},"feeRecipientAddress":{"$ref":"#/components/schemas/addressSchema"},"senderAddress":{"$ref":"#/components/schemas/addressSchema"}},"required":["makerFee","takerFee","feeRecipientAddress","senderAddress"]},"relayerApiOrderbookResponseSchema":{"type":"object","properties":{"bids":{"$ref":"#/components/schemas/relayerApiOrdersResponseSchema"},"asks":{"$ref":"#/components/schemas/relayerApiOrdersResponseSchema"}},"required":["bids","asks"]},"relayerApiAssetDataPairsResponseSchema":{"type":"object","allOf":[{"$ref":"#/components/schemas/paginatedCollectionSchema"},{"properties":{"records":{"$ref":"#/components/schemas/relayerApiAssetDataPairsSchema"}},"required":["records"]}]},"relayerApiAssetDataTradeInfoSchema":{"type":"object","properties":{"assetData":{"$ref":"#/components/schemas/hexSchema"},"minAmount":{"$ref":"#/components/schemas/numberSchema"},"maxAmount":{"$ref":"#/components/schemas/numberSchema"},"precision":{"type":"number"}},"required":["assetData"]},"relayerApiOrdersChannelSubscribeSchema":{"type":"object","properties":{"type":{"enum":["subscribe"]},"channel":{"enum":["orders"]},"requestId":{"type":"string"},"payload":{"$ref":"#/components/schemas/relayerApiOrdersChannelSubscribePayload"}},"required":["type","channel","requestId"]},"relayerApiOrdersChannelSubscribePayload":{"type":"object","properties":{"makerAssetProxyId":{"$ref":"#/components/schemas/hexSchema"},"takerAssetProxyId":{"$ref":"#/components/schemas/hexSchema"},"networkId":{"type":"number"},"makerAssetAddress":{"$ref":"#/components/schemas/addressSchema"},"takerAssetAddress":{"$ref":"#/components/schemas/addressSchema"},"makerAssetData":{"$ref":"#/components/schemas/hexSchema"},"takerAssetData":{"$ref":"#/components/schemas/hexSchema"},"traderAssetData":{"$ref":"#/components/schemas/hexSchema"}}},"relayerApiOrdersChannelUpdateSchema":{"type":"object","properties":{"type":{"enum":["update"]},"channel":{"enum":["orders"]},"requestId":{"type":"string"},"payload":{"$ref":"#/components/schemas/relayerApiOrdersSchema"}},"required":["type","channel","requestId"]},"relayerApiOrdersResponseSchema":{"type":"object","allOf":[{"$ref":"#/components/schemas/paginatedCollectionSchema"},{"properties":{"records":{"$ref":"#/components/schemas/relayerApiOrdersSchema"}},"required":["records"]}]},"relayerApiAssetDataPairsSchema":{"type":"array","items":{"properties":{"assetDataA":{"$ref":"#/components/schemas/relayerApiAssetDataTradeInfoSchema"},"assetDataB":{"$ref":"#/components/schemas/relayerApiAssetDataTradeInfoSchema"}},"required":["assetDataA","assetDataB"],"type":"object"}}}}} \ No newline at end of file diff --git a/packages/sra-spec/public/index.html b/packages/sra-spec/public/index.html new file mode 100644 index 000000000..868047d4f --- /dev/null +++ b/packages/sra-spec/public/index.html @@ -0,0 +1,24 @@ + + + + ReDoc + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/sra-spec/src/api.ts b/packages/sra-spec/src/api.ts new file mode 100644 index 000000000..f80d343d8 --- /dev/null +++ b/packages/sra-spec/src/api.ts @@ -0,0 +1,310 @@ +import { OpenApiSpec } from '@loopback/openapi-v3-types'; + +import { examples } from './examples'; +import { schemas } from './json-schemas'; +import { md } from './md'; +import { generateParameters } from './parameters'; +import { generateResponses } from './responses'; + +export const api: OpenApiSpec = { + openapi: '3.0.0', + info: { + version: '2.0.0', + title: 'Standard Relayer REST API', + description: md.introduction, + license: { + name: 'Apache 2.0', + url: 'https://www.apache.org/licenses/LICENSE-2.0.html', + }, + }, + paths: { + '/v2/asset_pairs': { + get: { + description: + 'Retrieves a list of available asset pairs and the information required to trade them (in any order). Setting only `assetDataA` or `assetDataB` returns pairs filtered by that asset only.', + operationId: 'getAssetPairs', + parameters: generateParameters( + [ + { + name: 'assetDataA', + in: 'query', + description: 'The assetData value for the first asset in the pair.', + example: '0xf47261b04c32345ced77393b3530b1eed0f346429d', + schema: { + $ref: '#/components/schemas/hexSchema', + }, + }, + { + name: 'assetDataB', + in: 'query', + description: 'The assetData value for the second asset in the pair.', + example: '0x0257179264389b814a946f3e92105513705ca6b990', + schema: { + $ref: '#/components/schemas/hexSchema', + }, + }, + ], + true, + ), + responses: generateResponses( + 'relayerApiAssetDataPairsResponseSchema', + examples.relayerApiAssetDataPairsResponse, + `Returns a collection of available asset pairs with some meta info`, + ), + }, + }, + '/v2/orders': { + get: { + description: + 'Retrieves a list of orders given query parameters. This endpoint should be [paginated](#section/Pagination). For querying an entire orderbook snapshot, the [orderbook endpoint](#operation/getOrderbook) is recommended. If both makerAssetData and takerAssetData are specified, returned orders will be sorted by price determined by (takerTokenAmount/makerTokenAmount) in ascending order. By default, orders returned by this endpoint are unsorted.', + operationId: 'getOrders', + parameters: generateParameters( + [ + { + name: 'makerAssetProxyId', + in: 'query', + description: `The maker [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: "0xf47261b0" for ERC20, "0x02571792" for ERC721).`, + example: '0xf47261b0', + schema: { + $ref: '#/components/schemas/hexSchema', + }, + }, + { + name: 'takerAssetProxyId', + in: 'query', + description: `The taker asset [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: "0xf47261b0" for ERC20, "0x02571792" for ERC721).`, + example: '0x02571792', + schema: { + $ref: '#/components/schemas/hexSchema', + }, + }, + { + name: 'makerAssetAddress', + in: 'query', + description: `The contract address for the maker asset.`, + example: '0xe41d2489571d322189246dafa5ebde1f4699f498', + schema: { + $ref: '#/components/schemas/addressSchema', + }, + }, + { + name: 'takerAssetAddress', + in: 'query', + description: `The contract address for the taker asset.`, + example: '0xe41d2489571d322189246dafa5ebde1f4699f498', + schema: { + $ref: '#/components/schemas/addressSchema', + }, + }, + { + name: 'exchangeAddress', + in: 'query', + description: `Same as exchangeAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)`, + example: '0xe41d2489571d322189246dafa5ebde1f4699f498', + schema: { + $ref: '#/components/schemas/addressSchema', + }, + }, + { + name: 'senderAddress', + in: 'query', + description: `Same as senderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)`, + example: '0xe41d2489571d322189246dafa5ebde1f4699f498', + schema: { + $ref: '#/components/schemas/addressSchema', + }, + }, + { + name: 'makerAssetData', + in: 'query', + description: `Same as makerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)`, + example: '0xe41d2489571d322189246dafa5ebde1f4699f498', + schema: { + $ref: '#/components/schemas/hexSchema', + }, + }, + { + name: 'takerAssetData', + in: 'query', + description: `Same as takerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)`, + example: '0xe41d2489571d322189246dafa5ebde1f4699f498', + schema: { + $ref: '#/components/schemas/hexSchema', + }, + }, + { + name: 'traderAssetData', + in: 'query', + description: `Same as traderAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)`, + example: '0xe41d2489571d322189246dafa5ebde1f4699f498', + schema: { + $ref: '#/components/schemas/hexSchema', + }, + }, + { + name: 'makerAddress', + in: 'query', + description: `Same as makerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)`, + example: '0xe41d2489571d322189246dafa5ebde1f4699f498', + schema: { + $ref: '#/components/schemas/addressSchema', + }, + }, + { + name: 'takerAddress', + in: 'query', + description: `Same as takerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)`, + example: '0xe41d2489571d322189246dafa5ebde1f4699f498', + schema: { + $ref: '#/components/schemas/addressSchema', + }, + }, + { + name: 'traderAddress', + in: 'query', + description: `Same as traderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)`, + example: '0xe41d2489571d322189246dafa5ebde1f4699f498', + schema: { + $ref: '#/components/schemas/addressSchema', + }, + }, + { + name: 'feeRecipientAddress', + in: 'query', + description: `Same as feeRecipientAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)`, + example: '0xe41d2489571d322189246dafa5ebde1f4699f498', + schema: { + $ref: '#/components/schemas/addressSchema', + }, + }, + ], + true, + ), + responses: generateResponses( + 'relayerApiOrdersResponseSchema', + examples.relayerApiOrdersResponse, + `A collection of 0x orders with meta-data as specified by query params`, + ), + }, + }, + '/v2/order/{orderHash}': { + get: { + description: 'Retrieves the 0x order with meta info that is associated with the hash.', + operationId: 'getOrder', + parameters: generateParameters( + [ + { + name: 'orderHash', + in: 'path', + description: 'The hash of the desired 0x order.', + example: '0xd4b103c42d2512eef3fee775e097f044291615d25f5d71e0ac70dbd49d223591', + schema: { + $ref: '#/components/schemas/orderHashSchema', + }, + }, + ], + false, + ), + responses: generateResponses( + 'relayerApiOrderSchema', + examples.relayerApiOrder, + `The order and meta info associated with the orderHash`, + ), + }, + }, + '/v2/orderbook': { + get: { + description: `Retrieves the orderbook for a given asset pair. This endpoint should be [paginated](#section/Pagination). Bids will be sorted in descending order by price, and asks will be sorted in ascending order by price. Within the price sorted orders, the orders are further sorted by _taker fee price_ which is defined as the **takerFee** divided by **takerTokenAmount**. After _taker fee price_, orders are to be sorted by expiration in ascending order. The way pagination works for this endpoint is that the **page** and **perPage** query params apply to both \`bids\` and \`asks\` collections, and if \`page\` * \`perPage\` > \`total\` for a certain collection, the \`records\` for that collection should just be empty. `, + operationId: 'getOrderbook', + parameters: generateParameters( + [ + { + name: 'baseAssetData', + in: 'query', + description: `assetData (makerAssetData or takerAssetData) designated as the base currency in the [currency pair calculation](https://en.wikipedia.org/wiki/Currency_pair) of price.`, + required: true, + example: '0xf47261b04c32345ced77393b3530b1eed0f346429d', + schema: { + $ref: '#/components/schemas/hexSchema', + }, + }, + { + name: 'quoteAssetData', + in: 'query', + description: `assetData (makerAssetData or takerAssetData) designated as the quote currency in the currency pair calculation of price (required).`, + required: true, + example: '0xf47261b04c32345ced77393b3530b1eed0f346429d', + schema: { + $ref: '#/components/schemas/hexSchema', + }, + }, + ], + true, + ), + responses: generateResponses( + 'relayerApiOrderbookResponseSchema', + examples.relayerApiOrderbookResponse, + `The sorted order book for the specified asset pair.`, + ), + }, + }, + '/v2/order_config': { + get: { + description: `Relayers have full discretion over the orders that they are willing to host on their orderbooks (e.g what fees they charge, etc...). In order for traders to discover their requirements programmatically, they can send an incomplete order to this endpoint and receive the missing fields, specifc to that order. This gives relayers a large amount of flexibility to tailor fees to unique traders, trading pairs and volume amounts. Submit a partial order and receive information required to complete the order: \`senderAddress\`, \`feeRecipientAddress\`, \`makerFee\`, \`takerFee\`. `, + operationId: 'getOrderConfig', + parameters: generateParameters([], false), + requestBody: { + description: + 'The fields of a 0x order the relayer may want to decide what configuration to send back.', + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/relayerApiOrderConfigPayloadSchema', + }, + example: examples.relayerApiOrderConfigPayload, + }, + }, + }, + responses: generateResponses( + 'relayerApiOrderConfigResponseSchema', + examples.relayerApiOrderConfigResponse, + `The additional fields necessary in order to submit an order to the relayer.`, + ), + }, + }, + '/v2/fee_recipients': { + get: { + description: `Retrieves a collection of all fee recipient addresses for a relayer. This endpoint should be [paginated](#section/Pagination).`, + operationId: 'getFeeRecipients', + parameters: generateParameters([], true), + responses: generateResponses( + 'relayerApiFeeRecipientsResponseSchema', + examples.relayerApiFeeRecipientsResponse, + `A collection of all used fee recipient addresses.`, + ), + }, + }, + '/v2/order': { + post: { + description: `Submit a signed order to the relayer.`, + operationId: 'postOrder', + parameters: generateParameters([], false), + requestBody: { + description: 'A valid signed 0x order based on the schema.', + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/signedOrderSchema', + }, + example: examples.signedOrder, + }, + }, + }, + responses: generateResponses(), + }, + }, + }, + components: { + schemas, + }, +}; diff --git a/packages/sra-spec/src/errors.ts b/packages/sra-spec/src/errors.ts new file mode 100644 index 000000000..20c35514f --- /dev/null +++ b/packages/sra-spec/src/errors.ts @@ -0,0 +1,24 @@ +import { examples } from './examples'; +export const errorResponses = { + '400': { + description: 'Validation error', + content: { + 'application/json': { + schema: { $ref: '#/components/schemas/relayerApiErrorResponseSchema' }, + example: examples.validationError, + }, + }, + }, + '404': { + description: 'Not found', + }, + '429': { + description: 'Too many requests - Rate limit exceeded', + }, + '500': { + description: 'Internal Server Error', + }, + '501': { + description: 'Not implemented.', + }, +}; diff --git a/packages/sra-spec/src/examples/errors.ts b/packages/sra-spec/src/examples/errors.ts new file mode 100644 index 000000000..81f29d81c --- /dev/null +++ b/packages/sra-spec/src/examples/errors.ts @@ -0,0 +1,11 @@ +export const validationError = { + code: 100, + reason: 'Validation failed', + validationErrors: [ + { + field: 'networkId', + code: 1006, + reason: 'Network id 42 is not supported', + }, + ], +}; diff --git a/packages/sra-spec/src/examples/index.ts b/packages/sra-spec/src/examples/index.ts new file mode 100644 index 000000000..dcf9b13eb --- /dev/null +++ b/packages/sra-spec/src/examples/index.ts @@ -0,0 +1,21 @@ +import { validationError } from './errors'; +import { relayerApiAssetDataPairsResponse } from './relayerApiAssetDataPairsResponse'; +import { relayerApiFeeRecipientsResponse } from './relayerApiFeeRecipientsResponse'; +import { relayerApiOrder } from './relayerApiOrder'; +import { relayerApiOrderbookResponse } from './relayerApiOrderbookResponse'; +import { relayerApiOrderConfigPayload } from './relayerApiOrderConfigPayload'; +import { relayerApiOrderConfigResponse } from './relayerApiOrderConfigResponse'; +import { relayerApiOrdersResponse } from './relayerApiOrdersResponse'; +import { signedOrder } from './signedOrder'; + +export const examples = { + validationError, + relayerApiAssetDataPairsResponse, + relayerApiFeeRecipientsResponse, + relayerApiOrder, + relayerApiOrderbookResponse, + relayerApiOrderConfigPayload, + relayerApiOrderConfigResponse, + relayerApiOrdersResponse, + signedOrder, +}; diff --git a/packages/sra-spec/src/examples/relayerApiAssetDataPairsResponse.ts b/packages/sra-spec/src/examples/relayerApiAssetDataPairsResponse.ts new file mode 100644 index 000000000..9eead5239 --- /dev/null +++ b/packages/sra-spec/src/examples/relayerApiAssetDataPairsResponse.ts @@ -0,0 +1,21 @@ +export const relayerApiAssetDataPairsResponse = { + total: 43, + page: 1, + perPage: 100, + records: [ + { + assetDataA: { + minAmount: '0', + maxAmount: '10000000000000000000', + precision: 5, + assetData: '0xf47261b04c32345ced77393b3530b1eed0f346429d', + }, + assetDataB: { + minAmount: '0', + maxAmount: '50000000000000000000', + precision: 5, + assetData: '0x0257179264389b814a946f3e92105513705ca6b990', + }, + }, + ], +}; diff --git a/packages/sra-spec/src/examples/relayerApiFeeRecipientsResponse.ts b/packages/sra-spec/src/examples/relayerApiFeeRecipientsResponse.ts new file mode 100644 index 000000000..0182af629 --- /dev/null +++ b/packages/sra-spec/src/examples/relayerApiFeeRecipientsResponse.ts @@ -0,0 +1,10 @@ +export const relayerApiFeeRecipientsResponse = { + total: 3, + page: 1, + perPage: 10, + records: [ + '0x6eC92694ea172ebC430C30fa31De87620967A082', + '0x9e56625509c2f60af937f23b7b532600390e8c8b', + '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', + ], +}; diff --git a/packages/sra-spec/src/examples/relayerApiOrder.ts b/packages/sra-spec/src/examples/relayerApiOrder.ts new file mode 100644 index 000000000..31181d677 --- /dev/null +++ b/packages/sra-spec/src/examples/relayerApiOrder.ts @@ -0,0 +1,19 @@ +export const relayerApiOrder = { + order: { + makerAddress: '0x9e56625509c2f60af937f23b7b532600390e8c8b', + takerAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', + feeRecipientAddress: '0xb046140686d052fff581f63f8136cce132e857da', + senderAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', + makerAssetAmount: '10000000000000000', + takerAssetAmount: '20000000000000000', + makerFee: '100000000000000', + takerFee: '200000000000000', + expirationTimeSeconds: '1532560590', + salt: '1532559225', + makerAssetData: '0xf47261b04c32345ced77393b3530b1eed0f346429d', + takerAssetData: '0x0257179264389b814a946f3e92105513705ca6b990', + exchangeAddress: '0x12459c951127e0c374ff9105dda097662a027093', + signature: '0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33', + }, + metaData: {}, +}; diff --git a/packages/sra-spec/src/examples/relayerApiOrderConfigPayload.ts b/packages/sra-spec/src/examples/relayerApiOrderConfigPayload.ts new file mode 100644 index 000000000..5251d5b4d --- /dev/null +++ b/packages/sra-spec/src/examples/relayerApiOrderConfigPayload.ts @@ -0,0 +1,10 @@ +export const relayerApiOrderConfigPayload = { + makerAddress: '0x9e56625509c2f60af937f23b7b532600390e8c8b', + takerAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', + makerAssetAmount: '10000000000000000', + takerAssetAmount: '20000000000000000', + makerAssetData: '0xf47261b04c32345ced77393b3530b1eed0f346429d', + takerAssetData: '0x0257179264389b814a946f3e92105513705ca6b990', + exchangeAddress: '0x12459c951127e0c374ff9105dda097662a027093', + expirationTimeSeconds: '1532560590', +}; diff --git a/packages/sra-spec/src/examples/relayerApiOrderConfigResponse.ts b/packages/sra-spec/src/examples/relayerApiOrderConfigResponse.ts new file mode 100644 index 000000000..a3c531c0a --- /dev/null +++ b/packages/sra-spec/src/examples/relayerApiOrderConfigResponse.ts @@ -0,0 +1,6 @@ +export const relayerApiOrderConfigResponse = { + senderAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', + feeRecipientAddress: '0xb046140686d052fff581f63f8136cce132e857da', + makerFee: '100000000000000', + takerFee: '200000000000000', +}; diff --git a/packages/sra-spec/src/examples/relayerApiOrderbookResponse.ts b/packages/sra-spec/src/examples/relayerApiOrderbookResponse.ts new file mode 100644 index 000000000..40c09eff9 --- /dev/null +++ b/packages/sra-spec/src/examples/relayerApiOrderbookResponse.ts @@ -0,0 +1,54 @@ +export const relayerApiOrderbookResponse = { + bids: { + total: 325, + page: 2, + perPage: 100, + records: [ + { + order: { + makerAddress: '0x9e56625509c2f60af937f23b7b532600390e8c8b', + takerAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', + feeRecipientAddress: '0xb046140686d052fff581f63f8136cce132e857da', + senderAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', + makerAssetAmount: '10000000000000000', + takerAssetAmount: '20000000000000000', + makerFee: '100000000000000', + takerFee: '200000000000000', + expirationTimeSeconds: '1532560590', + salt: '1532559225', + makerAssetData: '0xf47261b04c32345ced77393b3530b1eed0f346429d', + takerAssetData: '0x0257179264389b814a946f3e92105513705ca6b990', + exchangeAddress: '0x12459c951127e0c374ff9105dda097662a027093', + signature: '0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33', + }, + metaData: {}, + }, + ], + }, + asks: { + total: 500, + page: 2, + perPage: 100, + records: [ + { + order: { + makerAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', + takerAddress: '0x9e56625509c2f60af937f23b7b532600390e8c8b', + feeRecipientAddress: '0xb046140686d052fff581f63f8136cce132e857da', + senderAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', + makerAssetAmount: '20000000000000000', + takerAssetAmount: '10000000000000000', + makerFee: '200000000000000', + takerFee: '100000000000000', + expirationTimeSeconds: '1532560590', + salt: '1532559225', + makerAssetData: '0x0257179264389b814a946f3e92105513705ca6b990', + takerAssetData: '0xf47261b04c32345ced77393b3530b1eed0f346429d', + exchangeAddress: '0x12459c951127e0c374ff9105dda097662a027093', + signature: '0x013842a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b3518891', + }, + metaData: {}, + }, + ], + }, +}; diff --git a/packages/sra-spec/src/examples/relayerApiOrdersResponse.ts b/packages/sra-spec/src/examples/relayerApiOrdersResponse.ts new file mode 100644 index 000000000..ac16e7e34 --- /dev/null +++ b/packages/sra-spec/src/examples/relayerApiOrdersResponse.ts @@ -0,0 +1,26 @@ +export const relayerApiOrdersResponse = { + total: 984, + page: 1, + perPage: 100, + records: [ + { + order: { + makerAddress: '0x9e56625509c2f60af937f23b7b532600390e8c8b', + takerAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', + feeRecipientAddress: '0xb046140686d052fff581f63f8136cce132e857da', + senderAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', + makerAssetAmount: '10000000000000000', + takerAssetAmount: '20000000000000000', + makerFee: '100000000000000', + takerFee: '200000000000000', + expirationTimeSeconds: '1532560590', + salt: '1532559225', + makerAssetData: '0xf47261b04c32345ced77393b3530b1eed0f346429d', + takerAssetData: '0x0257179264389b814a946f3e92105513705ca6b990', + exchangeAddress: '0x12459c951127e0c374ff9105dda097662a027093', + signature: '0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33', + }, + metaData: {}, + }, + ], +}; diff --git a/packages/sra-spec/src/examples/signedOrder.ts b/packages/sra-spec/src/examples/signedOrder.ts new file mode 100644 index 000000000..440566027 --- /dev/null +++ b/packages/sra-spec/src/examples/signedOrder.ts @@ -0,0 +1,16 @@ +export const signedOrder = { + makerAddress: '0x9e56625509c2f60af937f23b7b532600390e8c8b', + takerAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', + feeRecipientAddress: '0xb046140686d052fff581f63f8136cce132e857da', + senderAddress: '0xa2b31dacf30a9c50ca473337c01d8a201ae33e32', + makerAssetAmount: '10000000000000000', + takerAssetAmount: '20000000000000000', + makerFee: '100000000000000', + takerFee: '200000000000000', + expirationTimeSeconds: '1532560590', + salt: '1532559225', + makerAssetData: '0xf47261b04c32345ced77393b3530b1eed0f346429d', + takerAssetData: '0x0257179264389b814a946f3e92105513705ca6b990', + exchangeAddress: '0x12459c951127e0c374ff9105dda097662a027093', + signature: '0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33', +}; diff --git a/packages/sra-spec/src/headers.ts b/packages/sra-spec/src/headers.ts new file mode 100644 index 000000000..152254c9f --- /dev/null +++ b/packages/sra-spec/src/headers.ts @@ -0,0 +1,20 @@ +export const headers = { + 'X-Rate-Limit-Limit': { + description: `The maximum number of requests you're permitted to make per hour.`, + schema: { + type: 'integer', + }, + }, + 'X-Rate-Limit-Remaining': { + description: 'The number of requests remaining in the current rate limit window.', + schema: { + type: 'integer', + }, + }, + 'X-Rate-Limit-Reset': { + description: 'The time at which the current rate limit window resets in UTC epoch seconds.', + schema: { + type: 'integer', + }, + }, +}; diff --git a/packages/sra-spec/src/index.ts b/packages/sra-spec/src/index.ts new file mode 100644 index 000000000..4d73f3cd3 --- /dev/null +++ b/packages/sra-spec/src/index.ts @@ -0,0 +1 @@ +export { api } from './api'; diff --git a/packages/sra-spec/src/json-schemas.ts b/packages/sra-spec/src/json-schemas.ts new file mode 100644 index 000000000..173a04bfb --- /dev/null +++ b/packages/sra-spec/src/json-schemas.ts @@ -0,0 +1,63 @@ +import { schemas as jsonSchemas } from '@0xproject/json-schemas'; + +// Only include schemas we actually need +const { + numberSchema, + addressSchema, + hexSchema, + orderHashSchema, + orderSchema, + signedOrderSchema, + signedOrdersSchema, + ordersSchema, + paginatedCollectionSchema, + relayerApiErrorResponseSchema, + relayerApiFeeRecipientsResponseSchema, + relayerApiOrderSchema, + relayerApiOrdersSchema, + relayerApiOrderConfigPayloadSchema, + relayerApiOrderConfigResponseSchema, + relayerApiOrderbookResponseSchema, + relayerApiAssetDataPairsResponseSchema, + relayerApiAssetDataTradeInfoSchema, + relayerApiOrdersChannelSubscribeSchema, + relayerApiOrdersChannelSubscribePayload, + relayerApiOrdersChannelUpdateSchema, + relayerApiOrdersResponseSchema, + relayerApiAssetDataPairsSchema, +} = jsonSchemas; + +const usedSchemas = { + numberSchema, + addressSchema, + hexSchema, + orderHashSchema, + orderSchema, + signedOrderSchema, + signedOrdersSchema, + ordersSchema, + paginatedCollectionSchema, + relayerApiErrorResponseSchema, + relayerApiFeeRecipientsResponseSchema, + relayerApiOrderSchema, + relayerApiOrdersSchema, + relayerApiOrderConfigPayloadSchema, + relayerApiOrderConfigResponseSchema, + relayerApiOrderbookResponseSchema, + relayerApiAssetDataPairsResponseSchema, + relayerApiAssetDataTradeInfoSchema, + relayerApiOrdersChannelSubscribeSchema, + relayerApiOrdersChannelSubscribePayload, + relayerApiOrdersChannelUpdateSchema, + relayerApiOrdersResponseSchema, + relayerApiAssetDataPairsSchema, +}; + +// We need to replace the `$ref`s to be OpenAPI compliant. +const openApiSchemas = JSON.parse( + JSON.stringify(usedSchemas).replace(/(\/\w+)/g, match => `#/components/schemas${match}`), +); +// The json schema used by OpenAPI does not accept ids +Object.keys(openApiSchemas).forEach(key => delete openApiSchemas[key].id); + +export const schemas = openApiSchemas; diff --git a/packages/sra-spec/src/md/index.ts b/packages/sra-spec/src/md/index.ts new file mode 100644 index 000000000..076c3c45c --- /dev/null +++ b/packages/sra-spec/src/md/index.ts @@ -0,0 +1,5 @@ +import { readFileSync } from 'fs'; + +export const md = { + introduction: readFileSync('src/md/introduction.md').toString(), +}; diff --git a/packages/sra-spec/src/md/introduction.md b/packages/sra-spec/src/md/introduction.md new file mode 100644 index 000000000..6f733c9ab --- /dev/null +++ b/packages/sra-spec/src/md/introduction.md @@ -0,0 +1,214 @@ +# Testing + +Use the [sra-report](https://github.com/0xProject/0x-monorepo/tree/development/packages/sra-report) command line tool to test your API for SRA compliance. + +# Schemas + +The [JSON schemas](http://json-schema.org/) for the API payloads and responses can be found in [@0xproject/json-schemas](https://github.com/0xProject/0x.js/tree/development/packages/json-schemas). Examples of each payload and response can be found in the library's [test suite](https://github.com/0xProject/0x.js/blob/development/packages/json-schemas/test/schema_test.ts#L1). + +```bash +npm install @0xproject/json-schemas --save +``` + +You can easily validate your API's payloads and responses using the [@0xproject/json-schemas](https://github.com/0xProject/0x.js/tree/development/packages/json-schemas) package: + +```js +import {SchemaValidator, ValidatorResult, schemas} from '@0xproject/json-schemas'; + +const {relayerApiTokenPairsResponseSchema} = schemas; +const validator = new SchemaValidator(); + +const tokenPairsResponse = { + ... +}; +const validatorResult: ValidatorResult = validator.validate(tokenPairsResponse, relayerApiTokenPairsResponseSchema); +``` + +# Pagination + +Requests that return potentially large collections should respond to the **?page** and **?perPage** parameters. For example: + +```bash +$ curl https://api.example-relayer.com/v2/asset_pairs?page=3&perPage=20 +``` + +Page numbering should be 1-indexed, not 0-indexed. If a query provides an unreasonable (ie. too high) `perPage` value, the response can return a validation error as specified in the [errors section](#section/Errors). If the query specifies a `page` that does not exist (ie. there are not enough `records`), the response should just return an empty `records` array. + +All endpoints that are paginated should return a `total`, `page`, `perPage` and a `records` value in the top level of the collection. The value of `total` should be the total number of records for a given query, whereas `records` should be an array representing the response to the query for that page. `page` and `perPage`, are the same values that were specified in the request. See the note in [miscellaneous](#section/Misc.) about formatting `snake_case` vs. `lowerCamelCase`. + +These requests include the [`/v2/asset_pairs`](#operation/getAssetPairs), [`/v2/orders`](#operation/getOrders), [`/v2/fee_recipients`](#operation/getFeeRecipients) and [`/v2/orderbook`](#operation/getOrderbook) endpoints. + +# Network Id + +All requests should be able to specify a **?networkId** query param for all supported networks. For example: + +```bash +$ curl https://api.example-relayer.com/v2/asset_pairs?networkId=1 +``` + +If the query param is not provided, it should default to **1** (mainnet). + +Networks and their Ids: + +| Network Id | Network Name | +| ---------- | ------------ | +| 1 | Mainnet | +| 42 | Kovan | +| 3 | Ropsten | +| 4 | Rinkeby | + +If a certain network is not supported, the response should **400** as specified in the [error response](#section/Errors) section. For example: + +```json +{ + "code": 100, + "reason": "Validation failed", + "validationErrors": [ + { + "field": "networkId", + "code": 1006, + "reason": "Network id 42 is not supported" + } + ] +} +``` + +# Link Header + +A [Link Header](https://tools.ietf.org/html/rfc5988) can be included in a response to provide clients with more context about paging +For example: + +```bash +Link: ; rel="next", +; rel="last" +``` + +This `Link` response header contains one or more Hypermedia link relations. + +The possible `rel` values are: + +| Name | Description | +| ----- | ------------------------------------------------------------- | +| next | The link relation for the immediate next page of results. | +| last | The link relation for the last page of results. | +| first | The link relation for the first page of results. | +| prev | The link relation for the immediate previous page of results. | + +# Rate Limits + +Rate limit guidance for clients can be optionally returned in the response headers: + +| Header Name | Description | +| --------------------- | ---------------------------------------------------------------------------- | +| X-RateLimit-Limit | The maximum number of requests you're permitted to make per hour. | +| X-RateLimit-Remaining | The number of requests remaining in the current rate limit window. | +| X-RateLimit-Reset | The time at which the current rate limit window resets in UTC epoch seconds. | + +For example: + +```bash +$ curl -i https://api.example-relayer.com/v2/asset_pairs +HTTP/1.1 200 OK +Date: Mon, 20 Oct 2017 12:30:06 GMT +Status: 200 OK +X-RateLimit-Limit: 60 +X-RateLimit-Remaining: 56 +X-RateLimit-Reset: 1372700873 +``` + +When a rate limit is exceeded, a status of **429 Too Many Requests** should be returned. + +# Errors + +Unless the spec defines otherwise, errors to bad requests should respond with HTTP 4xx or status codes. + +## Common error codes + +| Code | Reason | +| ---- | --------------------------------------- | +| 400 | Bad Request – Invalid request format | +| 404 | Not found | +| 429 | Too many requests - Rate limit exceeded | +| 500 | Internal Server Error | +| 501 | Not Implemented | + +## Error reporting format + +For all **400** responses, see the [error response schema](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_error_response_schema.ts#L1). + +```json +{ + "code": 101, + "reason": "Validation failed", + "validationErrors": [ + { + "field": "maker", + "code": 1002, + "reason": "Invalid address" + } + ] +} +``` + +General error codes: + +```bash +100 - Validation Failed +101 - Malformed JSON +102 - Order submission disabled +103 - Throttled +``` + +Validation error codes: + +```bash +1000 - Required field +1001 - Incorrect format +1002 - Invalid address +1003 - Address not supported +1004 - Value out of range +1005 - Invalid signature or hash +1006 - Unsupported option +``` + +# Asset Data Encoding + +As we now support multiple [token transfer proxies](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#assetproxy), the identifier of which proxy to use for the token transfer must be encoded, along with the token information. Each proxy in 0x v2 has a unique identifier. If you're using 0x.js there will be helper methods for this [encoding](https://0xproject.com/docs/0x.js#zeroEx-encodeERC20AssetData) and [decoding](https://0xproject.com/docs/0x.js#zeroEx-decodeAssetProxyId). + +The identifier for the Proxy uses a similar scheme to [ABI function selectors](https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI#function-selector). + +```js +// ERC20 Proxy ID 0xf47261b0 +bytes4(keccak256('ERC20Token(address)')); +// ERC721 Proxy ID 0x08e937fa +bytes4(keccak256('ERC721Token(address,uint256)')); +``` + +Asset data is encoded using [ABI encoding](https://solidity.readthedocs.io/en/develop/abi-spec.html). + +For example, encoding the ERC20 token contract (address: 0x1dc4c1cefef38a777b15aa20260a54e584b16c48) using the ERC20 Transfer Proxy (id: 0xf47261b0) would be: + +```bash +0xf47261b00000000000000000000000001dc4c1cefef38a777b15aa20260a54e584b16c48 +``` + +Encoding the ERC721 token contract (address: `0x371b13d97f4bf77d724e78c16b7dc74099f40e84`), token id (id: `99`, which hex encoded is `0x63`) and the ERC721 Transfer Proxy (id: 0x08e937fa) would be: + +```bash +0x08e937fa000000000000000000000000371b13d97f4bf77d724e78c16b7dc74099f40e840000000000000000000000000000000000000000000000000000000000000063 +``` + +For more information see [the Asset Proxy](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#erc20proxy) section of the v2 spec and the [Ethereum ABI Spec](https://solidity.readthedocs.io/en/develop/abi-spec.html). + +# Meta Data in Order Responses + +In v2 of the standard relayer API we added the `metaData` field. It is meant to provide a standard place for relayers to put optional, custom or non-standard fields that may of interest to the consumer of the API. + +A good example of such a field is `remainingTakerAssetAmount`, which is a convenience field that communicates how much of a 0x order is potentially left to be filled. Unlike the other fields in a 0x order, it is not guaranteed to be correct as it is derived from whatever mechanism the implementer (ie. the relayer) is using. While convenient for prototyping and low stakes situations, we recommend validating the value of the field by checking the state of the blockchain yourself, such as by using [Order Watcher](https://0xproject.com/wiki#0x-OrderWatcher). + +# Misc. + +* All requests and responses should be of **application/json** content type +* All token amounts are sent in amounts of the smallest level of precision (base units). (e.g if a token has 18 decimal places, selling 1 token would show up as selling `'1000000000000000000'` units by this API). +* All addresses are sent as lower-case (non-checksummed) Ethereum addresses with the `0x` prefix. +* All parameters are to be written in `lowerCamelCase`. diff --git a/packages/sra-spec/src/parameters.ts b/packages/sra-spec/src/parameters.ts new file mode 100644 index 000000000..48ffb036d --- /dev/null +++ b/packages/sra-spec/src/parameters.ts @@ -0,0 +1,39 @@ +import { ParameterObject } from '@loopback/openapi-v3-types'; +export const paginationParameters: ParameterObject[] = [ + { + name: 'page', + in: 'query', + description: 'The number of the page to request in the collection.', + example: 3, + schema: { + type: 'number', + default: 1, + }, + }, + { + name: 'perPage', + in: 'query', + description: 'The number of records to return per page.', + example: 10, + schema: { + type: 'number', + default: 100, + }, + }, +]; + +export const networkdIdParameter: ParameterObject = { + name: 'networkId', + in: 'query', + description: 'The id of the Ethereum network', + example: 42, + schema: { + type: 'number', + default: 1, + }, +}; + +export const generateParameters = (parameters: ParameterObject[], isPaginated: boolean = false): ParameterObject[] => { + const optionalParameters = isPaginated ? paginationParameters : []; + return [...parameters, networkdIdParameter, ...optionalParameters]; +}; diff --git a/packages/sra-spec/src/responses.ts b/packages/sra-spec/src/responses.ts new file mode 100644 index 000000000..cd7352058 --- /dev/null +++ b/packages/sra-spec/src/responses.ts @@ -0,0 +1,24 @@ +import { ResponsesObject } from '@loopback/openapi-v3-types'; + +import { errorResponses } from './errors'; +import { headers } from './headers'; + +export const generateResponses = (schemaName?: string, example?: any, description: string = 'OK'): ResponsesObject => { + const responses = { + '200': { + headers, + description, + content: {}, + }, + ...errorResponses, + }; + if (schemaName) { + responses['200'].content = { + 'application/json': { + schema: { $ref: `#/components/schemas/${schemaName}` }, + example, + }, + }; + } + return responses; +}; diff --git a/packages/sra-spec/tsconfig.json b/packages/sra-spec/tsconfig.json new file mode 100644 index 000000000..e60028885 --- /dev/null +++ b/packages/sra-spec/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig", + "compilerOptions": { + "outDir": "lib" + }, + "include": ["./src/**/*", "./test/*"] +} diff --git a/packages/sra-spec/tslint.json b/packages/sra-spec/tslint.json new file mode 100644 index 000000000..ffaefe83a --- /dev/null +++ b/packages/sra-spec/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": ["@0xproject/tslint-config"] +} -- cgit From a75c298de01e46a048e92272dec97c80625aa4e0 Mon Sep 17 00:00:00 2001 From: fragosti Date: Thu, 23 Aug 2018 17:31:11 -0700 Subject: Point to new s3 bucket --- packages/sra-spec/public/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/sra-spec/public/index.html b/packages/sra-spec/public/index.html index 868047d4f..e75ae7f04 100644 --- a/packages/sra-spec/public/index.html +++ b/packages/sra-spec/public/index.html @@ -18,7 +18,7 @@ - + \ No newline at end of file -- cgit From 8f6a96740eebd0ddbb0ff1eed0d13f78891f4871 Mon Sep 17 00:00:00 2001 From: fragosti Date: Fri, 24 Aug 2018 08:25:34 -0700 Subject: Remove superflous id from relayer api fee recipients json schema --- .../json-schemas/schemas/relayer_api_fee_recipients_response_schema.ts | 1 - 1 file changed, 1 deletion(-) (limited to 'packages') diff --git a/packages/json-schemas/schemas/relayer_api_fee_recipients_response_schema.ts b/packages/json-schemas/schemas/relayer_api_fee_recipients_response_schema.ts index 4f96e5a2d..5f6bc0530 100644 --- a/packages/json-schemas/schemas/relayer_api_fee_recipients_response_schema.ts +++ b/packages/json-schemas/schemas/relayer_api_fee_recipients_response_schema.ts @@ -6,7 +6,6 @@ export const relayerApiFeeRecipientsResponseSchema = { { properties: { records: { - id: '/relayerApiFeeRecipientsSchema', type: 'array', items: { $ref: '/addressSchema' }, }, -- cgit From c1b4fe999cbe9e40b9358058d6c59c8c8625494e Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 24 Aug 2018 17:41:33 +0100 Subject: Excessive command --- packages/0x.js/package.json | 1 - 1 file changed, 1 deletion(-) (limited to 'packages') diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index 54a896bfc..bb0799f4b 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -20,7 +20,6 @@ "build:all": "run-p build:umd:prod build:commonjs", "lint": "tslint --project . --exclude **/src/generated_contract_wrappers/**/*", "test:circleci": "run-s test:coverage", - "test": "yarn run_mocha", "rebuild_and_test": "run-s build test", "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", -- cgit From fb6d5118116268b68051191f9d44dad815ccad16 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 24 Aug 2018 17:44:14 +0100 Subject: Added missing entry for RC package --- packages/fill-scenarios/CHANGELOG.json | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'packages') diff --git a/packages/fill-scenarios/CHANGELOG.json b/packages/fill-scenarios/CHANGELOG.json index 06f12a85f..ae53b709a 100644 --- a/packages/fill-scenarios/CHANGELOG.json +++ b/packages/fill-scenarios/CHANGELOG.json @@ -1,4 +1,12 @@ [ + { + "version": "1.0.1-rc.4", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "1.0.1-rc.3", "changes": [ -- cgit From 029ea52979f9ba7347d20ec4fab962e1b79ee01f Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 24 Aug 2018 18:58:12 +0100 Subject: Small fixes to publish script --- packages/monorepo-scripts/src/publish.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/monorepo-scripts/src/publish.ts b/packages/monorepo-scripts/src/publish.ts index d9e09bdeb..7e2e64536 100644 --- a/packages/monorepo-scripts/src/publish.ts +++ b/packages/monorepo-scripts/src/publish.ts @@ -18,7 +18,6 @@ import { DocGenerateAndUploadUtils } from './utils/doc_generate_and_upload_utils import { publishReleaseNotesAsync } from './utils/github_release_utils'; import { utils } from './utils/utils'; -const DOC_GEN_COMMAND = 'docs:json'; const NPM_NAMESPACE = '@0xproject/'; const TODAYS_TIMESTAMP = moment().unix(); @@ -88,7 +87,7 @@ async function confirmAsync(message: string): Promise { function getPackagesWithDocs(allUpdatedPackages: Package[]): Package[] { const rootPackageJsonPath = `${constants.monorepoRootPath}/package.json`; const rootPackageJson = JSON.parse(fs.readFileSync(rootPackageJsonPath).toString()); - const packagesWithDocPagesStringIfExist = _.get(rootPackageJson, 'configs.packagesWithDocPages', undefined); + const packagesWithDocPagesStringIfExist = _.get(rootPackageJson, 'config.packagesWithDocPages', undefined); if (_.isUndefined(packagesWithDocPagesStringIfExist)) { return []; // None to generate & publish } -- cgit From 2d1c88c20dcfb46e79c3873dbcd4e31865588ae5 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 24 Aug 2018 18:58:34 +0100 Subject: Updated api.json --- packages/sra-api/public/api.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/sra-api/public/api.json b/packages/sra-api/public/api.json index fc2409abb..9701555ca 100644 --- a/packages/sra-api/public/api.json +++ b/packages/sra-api/public/api.json @@ -1 +1 @@ -{"openapi":"3.0.0","info":{"version":"2.0.0","title":"Standard Relayer REST API","description":"# Testing\n\nUse the [sra-report](https://github.com/0xProject/0x-monorepo/tree/development/packages/sra-report) command line tool to test your API for SRA compliance.\n\n# Schemas\n\nThe [JSON schemas](http://json-schema.org/) for the API payloads and responses can be found in [@0xproject/json-schemas](https://github.com/0xProject/0x.js/tree/development/packages/json-schemas). Examples of each payload and response can be found in the library's [test suite](https://github.com/0xProject/0x.js/blob/development/packages/json-schemas/test/schema_test.ts#L1).\n\n```bash\nnpm install @0xproject/json-schemas --save\n```\n\nYou can easily validate your API's payloads and responses using the [@0xproject/json-schemas](https://github.com/0xProject/0x.js/tree/development/packages/json-schemas) package:\n\n```js\nimport {SchemaValidator, ValidatorResult, schemas} from '@0xproject/json-schemas';\n\nconst {relayerApiTokenPairsResponseSchema} = schemas;\nconst validator = new SchemaValidator();\n\nconst tokenPairsResponse = {\n ...\n};\nconst validatorResult: ValidatorResult = validator.validate(tokenPairsResponse, relayerApiTokenPairsResponseSchema);\n```\n\n# Pagination\n\nRequests that return potentially large collections should respond to the **?page** and **?perPage** parameters. For example:\n\n```bash\n$ curl https://api.example-relayer.com/v2/asset_pairs?page=3&perPage=20\n```\n\nPage numbering should be 1-indexed, not 0-indexed. If a query provides an unreasonable (ie. too high) `perPage` value, the response can return a validation error as specified in the [errors section](#section/Errors). If the query specifies a `page` that does not exist (ie. there are not enough `records`), the response should just return an empty `records` array.\n\nAll endpoints that are paginated should return a `total`, `page`, `perPage` and a `records` value in the top level of the collection. The value of `total` should be the total number of records for a given query, whereas `records` should be an array representing the response to the query for that page. `page` and `perPage`, are the same values that were specified in the request. See the note in [miscellaneous](#section/Misc.) about formatting `snake_case` vs. `lowerCamelCase`.\n\nThese requests include the [`/v2/asset_pairs`](#operation/getAssetPairs), [`/v2/orders`](#operation/getOrders), [`/v2/fee_recipients`](#operation/getFeeRecipients) and [`/v2/orderbook`](#operation/getOrderbook) endpoints.\n\n# Network Id\n\nAll requests should be able to specify a **?networkId** query param for all supported networks. For example:\n\n```bash\n$ curl https://api.example-relayer.com/v2/asset_pairs?networkId=1\n```\n\nIf the query param is not provided, it should default to **1** (mainnet).\n\nNetworks and their Ids:\n\n| Network Id | Network Name |\n| ---------- | ------------ |\n| 1 | Mainnet |\n| 42 | Kovan |\n| 3 | Ropsten |\n| 4 | Rinkeby |\n\nIf a certain network is not supported, the response should **400** as specified in the [error response](#section/Errors) section. For example:\n\n```json\n{\n \"code\": 100,\n \"reason\": \"Validation failed\",\n \"validationErrors\": [\n {\n \"field\": \"networkId\",\n \"code\": 1006,\n \"reason\": \"Network id 42 is not supported\"\n }\n ]\n}\n```\n\n# Link Header\n\nA [Link Header](https://tools.ietf.org/html/rfc5988) can be included in a response to provide clients with more context about paging\nFor example:\n\n```bash\nLink: ; rel=\"next\",\n; rel=\"last\"\n```\n\nThis `Link` response header contains one or more Hypermedia link relations.\n\nThe possible `rel` values are:\n\n| Name | Description |\n| ----- | ------------------------------------------------------------- |\n| next | The link relation for the immediate next page of results. |\n| last | The link relation for the last page of results. |\n| first | The link relation for the first page of results. |\n| prev | The link relation for the immediate previous page of results. |\n\n# Rate Limits\n\nRate limit guidance for clients can be optionally returned in the response headers:\n\n| Header Name | Description |\n| --------------------- | ---------------------------------------------------------------------------- |\n| X-RateLimit-Limit | The maximum number of requests you're permitted to make per hour. |\n| X-RateLimit-Remaining | The number of requests remaining in the current rate limit window. |\n| X-RateLimit-Reset | The time at which the current rate limit window resets in UTC epoch seconds. |\n\nFor example:\n\n```bash\n$ curl -i https://api.example-relayer.com/v2/asset_pairs\nHTTP/1.1 200 OK\nDate: Mon, 20 Oct 2017 12:30:06 GMT\nStatus: 200 OK\nX-RateLimit-Limit: 60\nX-RateLimit-Remaining: 56\nX-RateLimit-Reset: 1372700873\n```\n\nWhen a rate limit is exceeded, a status of **429 Too Many Requests** should be returned.\n\n# Errors\n\nUnless the spec defines otherwise, errors to bad requests should respond with HTTP 4xx or status codes.\n\n## Common error codes\n\n| Code | Reason |\n| ---- | --------------------------------------- |\n| 400 | Bad Request – Invalid request format |\n| 404 | Not found |\n| 429 | Too many requests - Rate limit exceeded |\n| 500 | Internal Server Error |\n| 501 | Not Implemented |\n\n## Error reporting format\n\nFor all **400** responses, see the [error response schema](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_error_response_schema.ts#L1).\n\n```json\n{\n \"code\": 101,\n \"reason\": \"Validation failed\",\n \"validationErrors\": [\n {\n \"field\": \"maker\",\n \"code\": 1002,\n \"reason\": \"Invalid address\"\n }\n ]\n}\n```\n\nGeneral error codes:\n\n```bash\n100 - Validation Failed\n101 - Malformed JSON\n102 - Order submission disabled\n103 - Throttled\n```\n\nValidation error codes:\n\n```bash\n1000 - Required field\n1001 - Incorrect format\n1002 - Invalid address\n1003 - Address not supported\n1004 - Value out of range\n1005 - Invalid signature or hash\n1006 - Unsupported option\n```\n\n# Asset Data Encoding\n\nAs we now support multiple [token transfer proxies](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#assetproxy), the identifier of which proxy to use for the token transfer must be encoded, along with the token information. Each proxy in 0x v2 has a unique identifier. If you're using 0x.js there will be helper methods for this [encoding](https://0xproject.com/docs/0x.js#zeroEx-encodeERC20AssetData) and [decoding](https://0xproject.com/docs/0x.js#zeroEx-decodeAssetProxyId).\n\nThe identifier for the Proxy uses a similar scheme to [ABI function selectors](https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI#function-selector).\n\n```js\n// ERC20 Proxy ID 0xf47261b0\nbytes4(keccak256('ERC20Token(address)'));\n// ERC721 Proxy ID 0x08e937fa\nbytes4(keccak256('ERC721Token(address,uint256)'));\n```\n\nAsset data is encoded using [ABI encoding](https://solidity.readthedocs.io/en/develop/abi-spec.html).\n\nFor example, encoding the ERC20 token contract (address: 0x1dc4c1cefef38a777b15aa20260a54e584b16c48) using the ERC20 Transfer Proxy (id: 0xf47261b0) would be:\n\n```bash\n0xf47261b00000000000000000000000001dc4c1cefef38a777b15aa20260a54e584b16c48\n```\n\nEncoding the ERC721 token contract (address: `0x371b13d97f4bf77d724e78c16b7dc74099f40e84`), token id (id: `99`, which hex encoded is `0x63`) and the ERC721 Transfer Proxy (id: 0x08e937fa) would be:\n\n```bash\n0x08e937fa000000000000000000000000371b13d97f4bf77d724e78c16b7dc74099f40e840000000000000000000000000000000000000000000000000000000000000063\n```\n\nFor more information see [the Asset Proxy](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#erc20proxy) section of the v2 spec and the [Ethereum ABI Spec](https://solidity.readthedocs.io/en/develop/abi-spec.html).\n\n# Meta Data in Order Responses\n\nIn v2 of the standard relayer API we added the `metaData` field. It is meant to provide a standard place for relayers to put optional, custom or non-standard fields that may of interest to the consumer of the API.\n\nA good example of such a field is `remainingTakerAssetAmount`, which is a convenience field that communicates how much of a 0x order is potentially left to be filled. Unlike the other fields in a 0x order, it is not guaranteed to be correct as it is derived from whatever mechanism the implementer (ie. the relayer) is using. While convenient for prototyping and low stakes situations, we recommend validating the value of the field by checking the state of the blockchain yourself, such as by using [Order Watcher](https://0xproject.com/wiki#0x-OrderWatcher).\n\n# Misc.\n\n* All requests and responses should be of **application/json** content type\n* All token amounts are sent in amounts of the smallest level of precision (base units). (e.g if a token has 18 decimal places, selling 1 token would show up as selling `'1000000000000000000'` units by this API).\n* All addresses are sent as lower-case (non-checksummed) Ethereum addresses with the `0x` prefix.\n* All parameters are to be written in `lowerCamelCase`.\n","license":{"name":"Apache 2.0","url":"https://www.apache.org/licenses/LICENSE-2.0.html"}},"paths":{"/v2/asset_pairs":{"get":{"description":"Retrieves a list of available asset pairs and the information required to trade them (in any order). Setting only `assetDataA` or `assetDataB` returns pairs filtered by that asset only.","operationId":"getAssetPairs","parameters":[{"name":"assetDataA","in":"query","description":"The assetData value for the first asset in the pair.","example":"0xf47261b04c32345ced77393b3530b1eed0f346429d","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"assetDataB","in":"query","description":"The assetData value for the second asset in the pair.","example":"0x0257179264389b814a946f3e92105513705ca6b990","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}},{"name":"page","in":"query","description":"The number of the page to request in the collection.","example":3,"schema":{"type":"number","default":1}},{"name":"perPage","in":"query","description":"The number of records to return per page.","example":10,"schema":{"type":"number","default":100}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"Returns a collection of available asset pairs with some meta info","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiAssetDataPairsResponseSchema"},"example":{"total":43,"page":1,"perPage":100,"records":[{"assetDataA":{"minAmount":"0","maxAmount":"10000000000000000000","precision":5,"assetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d"},"assetDataB":{"minAmount":"0","maxAmount":"50000000000000000000","precision":5,"assetData":"0x0257179264389b814a946f3e92105513705ca6b990"}}]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/orders":{"get":{"description":"Retrieves a list of orders given query parameters. This endpoint should be [paginated](#section/Pagination). For querying an entire orderbook snapshot, the [orderbook endpoint](#operation/getOrderbook) is recommended. If both makerAssetData and takerAssetData are specified, returned orders will be sorted by price determined by (takerTokenAmount/makerTokenAmount) in ascending order. By default, orders returned by this endpoint are unsorted.","operationId":"getOrders","parameters":[{"name":"makerAssetProxyId","in":"query","description":"The maker [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \"0xf47261b0\" for ERC20, \"0x02571792\" for ERC721).","example":"0xf47261b0","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"takerAssetProxyId","in":"query","description":"The taker asset [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \"0xf47261b0\" for ERC20, \"0x02571792\" for ERC721).","example":"0x02571792","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"makerAssetAddress","in":"query","description":"The contract address for the maker asset.","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"takerAssetAddress","in":"query","description":"The contract address for the taker asset.","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"exchangeAddress","in":"query","description":"Same as exchangeAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"senderAddress","in":"query","description":"Same as senderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"makerAssetData","in":"query","description":"Same as makerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"takerAssetData","in":"query","description":"Same as takerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"traderAssetData","in":"query","description":"Same as traderAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"makerAddress","in":"query","description":"Same as makerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"takerAddress","in":"query","description":"Same as takerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"traderAddress","in":"query","description":"Same as traderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"feeRecipientAddress","in":"query","description":"Same as feeRecipientAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}},{"name":"page","in":"query","description":"The number of the page to request in the collection.","example":3,"schema":{"type":"number","default":1}},{"name":"perPage","in":"query","description":"The number of records to return per page.","example":10,"schema":{"type":"number","default":100}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"A collection of 0x orders with meta-data as specified by query params","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrdersResponseSchema"},"example":{"total":984,"page":1,"perPage":100,"records":[{"order":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"},"metaData":{}}]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/order/{orderHash}":{"get":{"description":"Retrieves the 0x order with meta info that is associated with the hash.","operationId":"getOrder","parameters":[{"name":"orderHash","in":"path","description":"The hash of the desired 0x order.","example":"0xd4b103c42d2512eef3fee775e097f044291615d25f5d71e0ac70dbd49d223591","schema":{"$ref":"#/components/schemas/orderHashSchema"}},{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"The order and meta info associated with the orderHash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrderSchema"},"example":{"order":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"},"metaData":{}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/orderbook":{"get":{"description":"Retrieves the orderbook for a given asset pair. This endpoint should be [paginated](#section/Pagination). Bids will be sorted in descending order by price, and asks will be sorted in ascending order by price. Within the price sorted orders, the orders are further sorted by _taker fee price_ which is defined as the **takerFee** divided by **takerTokenAmount**. After _taker fee price_, orders are to be sorted by expiration in ascending order. The way pagination works for this endpoint is that the **page** and **perPage** query params apply to both `bids` and `asks` collections, and if `page` * `perPage` > `total` for a certain collection, the `records` for that collection should just be empty. ","operationId":"getOrderbook","parameters":[{"name":"baseAssetData","in":"query","description":"assetData (makerAssetData or takerAssetData) designated as the base currency in the [currency pair calculation](https://en.wikipedia.org/wiki/Currency_pair) of price.","required":true,"example":"0xf47261b04c32345ced77393b3530b1eed0f346429d","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"quoteAssetData","in":"query","description":"assetData (makerAssetData or takerAssetData) designated as the quote currency in the currency pair calculation of price (required).","required":true,"example":"0xf47261b04c32345ced77393b3530b1eed0f346429d","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}},{"name":"page","in":"query","description":"The number of the page to request in the collection.","example":3,"schema":{"type":"number","default":1}},{"name":"perPage","in":"query","description":"The number of records to return per page.","example":10,"schema":{"type":"number","default":100}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"The sorted order book for the specified asset pair.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrderbookResponseSchema"},"example":{"bids":{"total":325,"page":2,"perPage":100,"records":[{"order":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"},"metaData":{}}]},"asks":{"total":500,"page":2,"perPage":100,"records":[{"order":{"makerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","takerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"20000000000000000","takerAssetAmount":"10000000000000000","makerFee":"200000000000000","takerFee":"100000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","takerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x013842a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b3518891"},"metaData":{}}]}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/order_config":{"get":{"description":"Relayers have full discretion over the orders that they are willing to host on their orderbooks (e.g what fees they charge, etc...). In order for traders to discover their requirements programmatically, they can send an incomplete order to this endpoint and receive the missing fields, specifc to that order. This gives relayers a large amount of flexibility to tailor fees to unique traders, trading pairs and volume amounts. Submit a partial order and receive information required to complete the order: `senderAddress`, `feeRecipientAddress`, `makerFee`, `takerFee`. ","operationId":"getOrderConfig","parameters":[{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}}],"requestBody":{"description":"The fields of a 0x order the relayer may want to decide what configuration to send back.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrderConfigPayloadSchema"},"example":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","expirationTimeSeconds":"1532560590"}}}},"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"The additional fields necessary in order to submit an order to the relayer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrderConfigResponseSchema"},"example":{"senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","makerFee":"100000000000000","takerFee":"200000000000000"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/fee_recipients":{"get":{"description":"Retrieves a collection of all fee recipient addresses for a relayer. This endpoint should be [paginated](#section/Pagination).","operationId":"getFeeRecipients","parameters":[{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}},{"name":"page","in":"query","description":"The number of the page to request in the collection.","example":3,"schema":{"type":"number","default":1}},{"name":"perPage","in":"query","description":"The number of records to return per page.","example":10,"schema":{"type":"number","default":100}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"A collection of all used fee recipient addresses.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiFeeRecipientsResponseSchema"},"example":{"total":3,"page":1,"perPage":10,"records":["0x6eC92694ea172ebC430C30fa31De87620967A082","0x9e56625509c2f60af937f23b7b532600390e8c8b","0xa2b31dacf30a9c50ca473337c01d8a201ae33e32"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/order":{"post":{"description":"Submit a signed order to the relayer.","operationId":"postOrder","parameters":[{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}}],"requestBody":{"description":"A valid signed 0x order based on the schema.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/signedOrderSchema"},"example":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"}}}},"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"OK","content":{}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}}},"components":{"schemas":{"numberSchema":{"type":"string","pattern":"^\\d+(\\.\\d+)?$"},"addressSchema":{"type":"string","pattern":"^0x[0-9a-f]{40}$"},"hexSchema":{"type":"string","pattern":"^0x(([0-9a-f][0-9a-f])+)?$"},"orderHashSchema":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$"},"orderSchema":{"properties":{"makerAddress":{"$ref":"#/components/schemas/addressSchema"},"takerAddress":{"$ref":"#/components/schemas/addressSchema"},"makerFee":{"$ref":"#/components/schemas/numberSchema"},"takerFee":{"$ref":"#/components/schemas/numberSchema"},"senderAddress":{"$ref":"#/components/schemas/addressSchema"},"makerAssetAmount":{"$ref":"#/components/schemas/numberSchema"},"takerAssetAmount":{"$ref":"#/components/schemas/numberSchema"},"makerAssetData":{"$ref":"#/components/schemas/hexSchema"},"takerAssetData":{"$ref":"#/components/schemas/hexSchema"},"salt":{"$ref":"#/components/schemas/numberSchema"},"exchangeAddress":{"$ref":"#/components/schemas/addressSchema"},"feeRecipientAddress":{"$ref":"#/components/schemas/addressSchema"},"expirationTimeSeconds":{"$ref":"#/components/schemas/numberSchema"}},"required":["makerAddress","takerAddress","makerFee","takerFee","senderAddress","makerAssetAmount","takerAssetAmount","makerAssetData","takerAssetData","salt","exchangeAddress","feeRecipientAddress","expirationTimeSeconds"],"type":"object"},"signedOrderSchema":{"allOf":[{"$ref":"#/components/schemas/orderSchema"},{"properties":{"signature":{"$ref":"#/components/schemas/hexSchema"}},"required":["signature"]}]},"signedOrdersSchema":{"type":"array","items":{"$ref":"#/components/schemas/signedOrderSchema"}},"ordersSchema":{"type":"array","items":{"$ref":"#/components/schemas/orderSchema"}},"paginatedCollectionSchema":{"type":"object","properties":{"total":{"type":"number"},"perPage":{"type":"number"},"page":{"type":"number"}},"required":["total","perPage","page"]},"relayerApiErrorResponseSchema":{"type":"object","properties":{"code":{"type":"integer","minimum":100,"maximum":103},"reason":{"type":"string"},"validationErrors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"integer","minimum":1000,"maximum":1006},"reason":{"type":"string"}},"required":["field","code","reason"]}}},"required":["code","reason"]},"relayerApiFeeRecipientsResponseSchema":{"type":"object","allOf":[{"$ref":"#/components/schemas/paginatedCollectionSchema"},{"properties":{"records":{"id":"#/components/schemas/relayerApiFeeRecipientsSchema","type":"array","items":{"$ref":"#/components/schemas/addressSchema"}}},"required":["records"]}]},"relayerApiOrderSchema":{"type":"object","properties":{"order":{"$ref":"#/components/schemas/orderSchema"},"metaData":{"type":"object"}},"required":["order","metaData"]},"relayerApiOrdersSchema":{"type":"array","items":{"$ref":"#/components/schemas/relayerApiOrderSchema"}},"relayerApiOrderConfigPayloadSchema":{"type":"object","properties":{"makerAddress":{"$ref":"#/components/schemas/addressSchema"},"takerAddress":{"$ref":"#/components/schemas/addressSchema"},"makerAssetAmount":{"$ref":"#/components/schemas/numberSchema"},"takerAssetAmount":{"$ref":"#/components/schemas/numberSchema"},"makerAssetData":{"$ref":"#/components/schemas/hexSchema"},"takerAssetData":{"$ref":"#/components/schemas/hexSchema"},"exchangeAddress":{"$ref":"#/components/schemas/addressSchema"},"expirationTimeSeconds":{"$ref":"#/components/schemas/numberSchema"}},"required":["makerAddress","takerAddress","makerAssetAmount","takerAssetAmount","makerAssetData","takerAssetData","exchangeAddress","expirationTimeSeconds"]},"relayerApiOrderConfigResponseSchema":{"type":"object","properties":{"makerFee":{"$ref":"#/components/schemas/numberSchema"},"takerFee":{"$ref":"#/components/schemas/numberSchema"},"feeRecipientAddress":{"$ref":"#/components/schemas/addressSchema"},"senderAddress":{"$ref":"#/components/schemas/addressSchema"}},"required":["makerFee","takerFee","feeRecipientAddress","senderAddress"]},"relayerApiOrderbookResponseSchema":{"type":"object","properties":{"bids":{"$ref":"#/components/schemas/relayerApiOrdersResponseSchema"},"asks":{"$ref":"#/components/schemas/relayerApiOrdersResponseSchema"}},"required":["bids","asks"]},"relayerApiAssetDataPairsResponseSchema":{"type":"object","allOf":[{"$ref":"#/components/schemas/paginatedCollectionSchema"},{"properties":{"records":{"$ref":"#/components/schemas/relayerApiAssetDataPairsSchema"}},"required":["records"]}]},"relayerApiAssetDataTradeInfoSchema":{"type":"object","properties":{"assetData":{"$ref":"#/components/schemas/hexSchema"},"minAmount":{"$ref":"#/components/schemas/numberSchema"},"maxAmount":{"$ref":"#/components/schemas/numberSchema"},"precision":{"type":"number"}},"required":["assetData"]},"relayerApiOrdersChannelSubscribeSchema":{"type":"object","properties":{"type":{"enum":["subscribe"]},"channel":{"enum":["orders"]},"requestId":{"type":"string"},"payload":{"$ref":"#/components/schemas/relayerApiOrdersChannelSubscribePayload"}},"required":["type","channel","requestId"]},"relayerApiOrdersChannelSubscribePayload":{"type":"object","properties":{"makerAssetProxyId":{"$ref":"#/components/schemas/hexSchema"},"takerAssetProxyId":{"$ref":"#/components/schemas/hexSchema"},"networkId":{"type":"number"},"makerAssetAddress":{"$ref":"#/components/schemas/addressSchema"},"takerAssetAddress":{"$ref":"#/components/schemas/addressSchema"},"makerAssetData":{"$ref":"#/components/schemas/hexSchema"},"takerAssetData":{"$ref":"#/components/schemas/hexSchema"},"traderAssetData":{"$ref":"#/components/schemas/hexSchema"}}},"relayerApiOrdersChannelUpdateSchema":{"type":"object","properties":{"type":{"enum":["update"]},"channel":{"enum":["orders"]},"requestId":{"type":"string"},"payload":{"$ref":"#/components/schemas/relayerApiOrdersSchema"}},"required":["type","channel","requestId"]},"relayerApiOrdersResponseSchema":{"type":"object","allOf":[{"$ref":"#/components/schemas/paginatedCollectionSchema"},{"properties":{"records":{"$ref":"#/components/schemas/relayerApiOrdersSchema"}},"required":["records"]}]},"relayerApiAssetDataPairsSchema":{"type":"array","items":{"properties":{"assetDataA":{"$ref":"#/components/schemas/relayerApiAssetDataTradeInfoSchema"},"assetDataB":{"$ref":"#/components/schemas/relayerApiAssetDataTradeInfoSchema"}},"required":["assetDataA","assetDataB"],"type":"object"}}}}} \ No newline at end of file +{"openapi":"3.0.0","info":{"version":"2.0.0","title":"Standard Relayer REST API","description":"# Testing\n\nUse the [sra-report](https://github.com/0xProject/0x-monorepo/tree/development/packages/sra-report) command line tool to test your API for SRA compliance.\n\n# Schemas\n\nThe [JSON schemas](http://json-schema.org/) for the API payloads and responses can be found in [@0xproject/json-schemas](https://github.com/0xProject/0x.js/tree/development/packages/json-schemas). Examples of each payload and response can be found in the library's [test suite](https://github.com/0xProject/0x.js/blob/development/packages/json-schemas/test/schema_test.ts#L1).\n\n```bash\nnpm install @0xproject/json-schemas --save\n```\n\nYou can easily validate your API's payloads and responses using the [@0xproject/json-schemas](https://github.com/0xProject/0x.js/tree/development/packages/json-schemas) package:\n\n```js\nimport {SchemaValidator, ValidatorResult, schemas} from '@0xproject/json-schemas';\n\nconst {relayerApiTokenPairsResponseSchema} = schemas;\nconst validator = new SchemaValidator();\n\nconst tokenPairsResponse = {\n ...\n};\nconst validatorResult: ValidatorResult = validator.validate(tokenPairsResponse, relayerApiTokenPairsResponseSchema);\n```\n\n# Pagination\n\nRequests that return potentially large collections should respond to the **?page** and **?perPage** parameters. For example:\n\n```bash\n$ curl https://api.example-relayer.com/v2/asset_pairs?page=3&perPage=20\n```\n\nPage numbering should be 1-indexed, not 0-indexed. If a query provides an unreasonable (ie. too high) `perPage` value, the response can return a validation error as specified in the [errors section](#section/Errors). If the query specifies a `page` that does not exist (ie. there are not enough `records`), the response should just return an empty `records` array.\n\nAll endpoints that are paginated should return a `total`, `page`, `perPage` and a `records` value in the top level of the collection. The value of `total` should be the total number of records for a given query, whereas `records` should be an array representing the response to the query for that page. `page` and `perPage`, are the same values that were specified in the request. See the note in [miscellaneous](#section/Misc.) about formatting `snake_case` vs. `lowerCamelCase`.\n\nThese requests include the [`/v2/asset_pairs`](#operation/getAssetPairs), [`/v2/orders`](#operation/getOrders), [`/v2/fee_recipients`](#operation/getFeeRecipients) and [`/v2/orderbook`](#operation/getOrderbook) endpoints.\n\n# Network Id\n\nAll requests should be able to specify a **?networkId** query param for all supported networks. For example:\n\n```bash\n$ curl https://api.example-relayer.com/v2/asset_pairs?networkId=1\n```\n\nIf the query param is not provided, it should default to **1** (mainnet).\n\nNetworks and their Ids:\n\n| Network Id | Network Name |\n| ---------- | ------------ |\n| 1 | Mainnet |\n| 42 | Kovan |\n| 3 | Ropsten |\n| 4 | Rinkeby |\n\nIf a certain network is not supported, the response should **400** as specified in the [error response](#section/Errors) section. For example:\n\n```json\n{\n \"code\": 100,\n \"reason\": \"Validation failed\",\n \"validationErrors\": [\n {\n \"field\": \"networkId\",\n \"code\": 1006,\n \"reason\": \"Network id 42 is not supported\"\n }\n ]\n}\n```\n\n# Link Header\n\nA [Link Header](https://tools.ietf.org/html/rfc5988) can be included in a response to provide clients with more context about paging\nFor example:\n\n```bash\nLink: ; rel=\"next\",\n; rel=\"last\"\n```\n\nThis `Link` response header contains one or more Hypermedia link relations.\n\nThe possible `rel` values are:\n\n| Name | Description |\n| ----- | ------------------------------------------------------------- |\n| next | The link relation for the immediate next page of results. |\n| last | The link relation for the last page of results. |\n| first | The link relation for the first page of results. |\n| prev | The link relation for the immediate previous page of results. |\n\n# Rate Limits\n\nRate limit guidance for clients can be optionally returned in the response headers:\n\n| Header Name | Description |\n| --------------------- | ---------------------------------------------------------------------------- |\n| X-RateLimit-Limit | The maximum number of requests you're permitted to make per hour. |\n| X-RateLimit-Remaining | The number of requests remaining in the current rate limit window. |\n| X-RateLimit-Reset | The time at which the current rate limit window resets in UTC epoch seconds. |\n\nFor example:\n\n```bash\n$ curl -i https://api.example-relayer.com/v2/asset_pairs\nHTTP/1.1 200 OK\nDate: Mon, 20 Oct 2017 12:30:06 GMT\nStatus: 200 OK\nX-RateLimit-Limit: 60\nX-RateLimit-Remaining: 56\nX-RateLimit-Reset: 1372700873\n```\n\nWhen a rate limit is exceeded, a status of **429 Too Many Requests** should be returned.\n\n# Errors\n\nUnless the spec defines otherwise, errors to bad requests should respond with HTTP 4xx or status codes.\n\n## Common error codes\n\n| Code | Reason |\n| ---- | --------------------------------------- |\n| 400 | Bad Request – Invalid request format |\n| 404 | Not found |\n| 429 | Too many requests - Rate limit exceeded |\n| 500 | Internal Server Error |\n| 501 | Not Implemented |\n\n## Error reporting format\n\nFor all **400** responses, see the [error response schema](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_error_response_schema.ts#L1).\n\n```json\n{\n \"code\": 101,\n \"reason\": \"Validation failed\",\n \"validationErrors\": [\n {\n \"field\": \"maker\",\n \"code\": 1002,\n \"reason\": \"Invalid address\"\n }\n ]\n}\n```\n\nGeneral error codes:\n\n```bash\n100 - Validation Failed\n101 - Malformed JSON\n102 - Order submission disabled\n103 - Throttled\n```\n\nValidation error codes:\n\n```bash\n1000 - Required field\n1001 - Incorrect format\n1002 - Invalid address\n1003 - Address not supported\n1004 - Value out of range\n1005 - Invalid signature or hash\n1006 - Unsupported option\n```\n\n# Asset Data Encoding\n\nAs we now support multiple [token transfer proxies](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#assetproxy), the identifier of which proxy to use for the token transfer must be encoded, along with the token information. Each proxy in 0x v2 has a unique identifier. If you're using 0x.js there will be helper methods for this [encoding](https://0xproject.com/docs/0x.js#zeroEx-encodeERC20AssetData) and [decoding](https://0xproject.com/docs/0x.js#zeroEx-decodeAssetProxyId).\n\nThe identifier for the Proxy uses a similar scheme to [ABI function selectors](https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI#function-selector).\n\n```js\n// ERC20 Proxy ID 0xf47261b0\nbytes4(keccak256('ERC20Token(address)'));\n// ERC721 Proxy ID 0x08e937fa\nbytes4(keccak256('ERC721Token(address,uint256)'));\n```\n\nAsset data is encoded using [ABI encoding](https://solidity.readthedocs.io/en/develop/abi-spec.html).\n\nFor example, encoding the ERC20 token contract (address: 0x1dc4c1cefef38a777b15aa20260a54e584b16c48) using the ERC20 Transfer Proxy (id: 0xf47261b0) would be:\n\n```bash\n0xf47261b00000000000000000000000001dc4c1cefef38a777b15aa20260a54e584b16c48\n```\n\nEncoding the ERC721 token contract (address: `0x371b13d97f4bf77d724e78c16b7dc74099f40e84`), token id (id: `99`, which hex encoded is `0x63`) and the ERC721 Transfer Proxy (id: 0x08e937fa) would be:\n\n```bash\n0x08e937fa000000000000000000000000371b13d97f4bf77d724e78c16b7dc74099f40e840000000000000000000000000000000000000000000000000000000000000063\n```\n\nFor more information see [the Asset Proxy](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#erc20proxy) section of the v2 spec and the [Ethereum ABI Spec](https://solidity.readthedocs.io/en/develop/abi-spec.html).\n\n# Meta Data in Order Responses\n\nIn v2 of the standard relayer API we added the `metaData` field. It is meant to provide a standard place for relayers to put optional, custom or non-standard fields that may of interest to the consumer of the API.\n\nA good example of such a field is `remainingTakerAssetAmount`, which is a convenience field that communicates how much of a 0x order is potentially left to be filled. Unlike the other fields in a 0x order, it is not guaranteed to be correct as it is derived from whatever mechanism the implementer (ie. the relayer) is using. While convenient for prototyping and low stakes situations, we recommend validating the value of the field by checking the state of the blockchain yourself, such as by using [Order Watcher](https://0xproject.com/wiki#0x-OrderWatcher).\n\n# Misc.\n\n* All requests and responses should be of **application/json** content type\n* All token amounts are sent in amounts of the smallest level of precision (base units). (e.g if a token has 18 decimal places, selling 1 token would show up as selling `'1000000000000000000'` units by this API).\n* All addresses are sent as lower-case (non-checksummed) Ethereum addresses with the `0x` prefix.\n* All parameters are to be written in `lowerCamelCase`.\n","license":{"name":"Apache 2.0","url":"https://www.apache.org/licenses/LICENSE-2.0.html"}},"paths":{"/v2/asset_pairs":{"get":{"description":"Retrieves a list of available asset pairs and the information required to trade them (in any order). Setting only `assetDataA` or `assetDataB` returns pairs filtered by that asset only.","operationId":"getAssetPairs","parameters":[{"name":"assetDataA","in":"query","description":"The assetData value for the first asset in the pair.","example":"0xf47261b04c32345ced77393b3530b1eed0f346429d","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"assetDataB","in":"query","description":"The assetData value for the second asset in the pair.","example":"0x0257179264389b814a946f3e92105513705ca6b990","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}},{"name":"page","in":"query","description":"The number of the page to request in the collection.","example":3,"schema":{"type":"number","default":1}},{"name":"perPage","in":"query","description":"The number of records to return per page.","example":10,"schema":{"type":"number","default":100}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"Returns a collection of available asset pairs with some meta info","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiAssetDataPairsResponseSchema"},"example":{"total":43,"page":1,"perPage":100,"records":[{"assetDataA":{"minAmount":"0","maxAmount":"10000000000000000000","precision":5,"assetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d"},"assetDataB":{"minAmount":"0","maxAmount":"50000000000000000000","precision":5,"assetData":"0x0257179264389b814a946f3e92105513705ca6b990"}}]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/orders":{"get":{"description":"Retrieves a list of orders given query parameters. This endpoint should be [paginated](#section/Pagination). For querying an entire orderbook snapshot, the [orderbook endpoint](#operation/getOrderbook) is recommended. If both makerAssetData and takerAssetData are specified, returned orders will be sorted by price determined by (takerTokenAmount/makerTokenAmount) in ascending order. By default, orders returned by this endpoint are unsorted.","operationId":"getOrders","parameters":[{"name":"makerAssetProxyId","in":"query","description":"The maker [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \"0xf47261b0\" for ERC20, \"0x02571792\" for ERC721).","example":"0xf47261b0","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"takerAssetProxyId","in":"query","description":"The taker asset [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \"0xf47261b0\" for ERC20, \"0x02571792\" for ERC721).","example":"0x02571792","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"makerAssetAddress","in":"query","description":"The contract address for the maker asset.","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"takerAssetAddress","in":"query","description":"The contract address for the taker asset.","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"exchangeAddress","in":"query","description":"Same as exchangeAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"senderAddress","in":"query","description":"Same as senderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"makerAssetData","in":"query","description":"Same as makerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"takerAssetData","in":"query","description":"Same as takerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"traderAssetData","in":"query","description":"Same as traderAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"makerAddress","in":"query","description":"Same as makerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"takerAddress","in":"query","description":"Same as takerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"traderAddress","in":"query","description":"Same as traderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"feeRecipientAddress","in":"query","description":"Same as feeRecipientAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}},{"name":"page","in":"query","description":"The number of the page to request in the collection.","example":3,"schema":{"type":"number","default":1}},{"name":"perPage","in":"query","description":"The number of records to return per page.","example":10,"schema":{"type":"number","default":100}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"A collection of 0x orders with meta-data as specified by query params","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrdersResponseSchema"},"example":{"total":984,"page":1,"perPage":100,"records":[{"order":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"},"metaData":{}}]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/order/{orderHash}":{"get":{"description":"Retrieves the 0x order with meta info that is associated with the hash.","operationId":"getOrder","parameters":[{"name":"orderHash","in":"path","description":"The hash of the desired 0x order.","example":"0xd4b103c42d2512eef3fee775e097f044291615d25f5d71e0ac70dbd49d223591","schema":{"$ref":"#/components/schemas/orderHashSchema"}},{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"The order and meta info associated with the orderHash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrderSchema"},"example":{"order":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"},"metaData":{}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/orderbook":{"get":{"description":"Retrieves the orderbook for a given asset pair. This endpoint should be [paginated](#section/Pagination). Bids will be sorted in descending order by price, and asks will be sorted in ascending order by price. Within the price sorted orders, the orders are further sorted by _taker fee price_ which is defined as the **takerFee** divided by **takerTokenAmount**. After _taker fee price_, orders are to be sorted by expiration in ascending order. The way pagination works for this endpoint is that the **page** and **perPage** query params apply to both `bids` and `asks` collections, and if `page` * `perPage` > `total` for a certain collection, the `records` for that collection should just be empty. ","operationId":"getOrderbook","parameters":[{"name":"baseAssetData","in":"query","description":"assetData (makerAssetData or takerAssetData) designated as the base currency in the [currency pair calculation](https://en.wikipedia.org/wiki/Currency_pair) of price.","required":true,"example":"0xf47261b04c32345ced77393b3530b1eed0f346429d","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"quoteAssetData","in":"query","description":"assetData (makerAssetData or takerAssetData) designated as the quote currency in the currency pair calculation of price (required).","required":true,"example":"0xf47261b04c32345ced77393b3530b1eed0f346429d","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}},{"name":"page","in":"query","description":"The number of the page to request in the collection.","example":3,"schema":{"type":"number","default":1}},{"name":"perPage","in":"query","description":"The number of records to return per page.","example":10,"schema":{"type":"number","default":100}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"The sorted order book for the specified asset pair.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrderbookResponseSchema"},"example":{"bids":{"total":325,"page":2,"perPage":100,"records":[{"order":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"},"metaData":{}}]},"asks":{"total":500,"page":2,"perPage":100,"records":[{"order":{"makerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","takerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"20000000000000000","takerAssetAmount":"10000000000000000","makerFee":"200000000000000","takerFee":"100000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","takerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x013842a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b3518891"},"metaData":{}}]}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/order_config":{"get":{"description":"Relayers have full discretion over the orders that they are willing to host on their orderbooks (e.g what fees they charge, etc...). In order for traders to discover their requirements programmatically, they can send an incomplete order to this endpoint and receive the missing fields, specifc to that order. This gives relayers a large amount of flexibility to tailor fees to unique traders, trading pairs and volume amounts. Submit a partial order and receive information required to complete the order: `senderAddress`, `feeRecipientAddress`, `makerFee`, `takerFee`. ","operationId":"getOrderConfig","parameters":[{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}}],"requestBody":{"description":"The fields of a 0x order the relayer may want to decide what configuration to send back.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrderConfigPayloadSchema"},"example":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","expirationTimeSeconds":"1532560590"}}}},"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"The additional fields necessary in order to submit an order to the relayer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrderConfigResponseSchema"},"example":{"senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","makerFee":"100000000000000","takerFee":"200000000000000"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/fee_recipients":{"get":{"description":"Retrieves a collection of all fee recipient addresses for a relayer. This endpoint should be [paginated](#section/Pagination).","operationId":"getFeeRecipients","parameters":[{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}},{"name":"page","in":"query","description":"The number of the page to request in the collection.","example":3,"schema":{"type":"number","default":1}},{"name":"perPage","in":"query","description":"The number of records to return per page.","example":10,"schema":{"type":"number","default":100}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"A collection of all used fee recipient addresses.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiFeeRecipientsResponseSchema"},"example":{"total":3,"page":1,"perPage":10,"records":["0x6eC92694ea172ebC430C30fa31De87620967A082","0x9e56625509c2f60af937f23b7b532600390e8c8b","0xa2b31dacf30a9c50ca473337c01d8a201ae33e32"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/order":{"post":{"description":"Submit a signed order to the relayer.","operationId":"postOrder","parameters":[{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}}],"requestBody":{"description":"A valid signed 0x order based on the schema.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/signedOrderSchema"},"example":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"}}}},"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"OK","content":{}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}}},"components":{"schemas":{"numberSchema":{"type":"string","pattern":"^\\d+(\\.\\d+)?$"},"addressSchema":{"type":"string","pattern":"^0x[0-9a-f]{40}$"},"hexSchema":{"type":"string","pattern":"^0x(([0-9a-f][0-9a-f])+)?$"},"orderHashSchema":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$"},"orderSchema":{"properties":{"makerAddress":{"$ref":"#/components/schemas/addressSchema"},"takerAddress":{"$ref":"#/components/schemas/addressSchema"},"makerFee":{"$ref":"#/components/schemas/numberSchema"},"takerFee":{"$ref":"#/components/schemas/numberSchema"},"senderAddress":{"$ref":"#/components/schemas/addressSchema"},"makerAssetAmount":{"$ref":"#/components/schemas/numberSchema"},"takerAssetAmount":{"$ref":"#/components/schemas/numberSchema"},"makerAssetData":{"$ref":"#/components/schemas/hexSchema"},"takerAssetData":{"$ref":"#/components/schemas/hexSchema"},"salt":{"$ref":"#/components/schemas/numberSchema"},"exchangeAddress":{"$ref":"#/components/schemas/addressSchema"},"feeRecipientAddress":{"$ref":"#/components/schemas/addressSchema"},"expirationTimeSeconds":{"$ref":"#/components/schemas/numberSchema"}},"required":["makerAddress","takerAddress","makerFee","takerFee","senderAddress","makerAssetAmount","takerAssetAmount","makerAssetData","takerAssetData","salt","exchangeAddress","feeRecipientAddress","expirationTimeSeconds"],"type":"object"},"signedOrderSchema":{"allOf":[{"$ref":"#/components/schemas/orderSchema"},{"properties":{"signature":{"$ref":"#/components/schemas/hexSchema"}},"required":["signature"]}]},"signedOrdersSchema":{"type":"array","items":{"$ref":"#/components/schemas/signedOrderSchema"}},"ordersSchema":{"type":"array","items":{"$ref":"#/components/schemas/orderSchema"}},"paginatedCollectionSchema":{"type":"object","properties":{"total":{"type":"number"},"perPage":{"type":"number"},"page":{"type":"number"}},"required":["total","perPage","page"]},"relayerApiErrorResponseSchema":{"type":"object","properties":{"code":{"type":"integer","minimum":100,"maximum":103},"reason":{"type":"string"},"validationErrors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"integer","minimum":1000,"maximum":1006},"reason":{"type":"string"}},"required":["field","code","reason"]}}},"required":["code","reason"]},"relayerApiFeeRecipientsResponseSchema":{"type":"object","allOf":[{"$ref":"#/components/schemas/paginatedCollectionSchema"},{"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/addressSchema"}}},"required":["records"]}]},"relayerApiOrderSchema":{"type":"object","properties":{"order":{"$ref":"#/components/schemas/orderSchema"},"metaData":{"type":"object"}},"required":["order","metaData"]},"relayerApiOrdersSchema":{"type":"array","items":{"$ref":"#/components/schemas/relayerApiOrderSchema"}},"relayerApiOrderConfigPayloadSchema":{"type":"object","properties":{"makerAddress":{"$ref":"#/components/schemas/addressSchema"},"takerAddress":{"$ref":"#/components/schemas/addressSchema"},"makerAssetAmount":{"$ref":"#/components/schemas/numberSchema"},"takerAssetAmount":{"$ref":"#/components/schemas/numberSchema"},"makerAssetData":{"$ref":"#/components/schemas/hexSchema"},"takerAssetData":{"$ref":"#/components/schemas/hexSchema"},"exchangeAddress":{"$ref":"#/components/schemas/addressSchema"},"expirationTimeSeconds":{"$ref":"#/components/schemas/numberSchema"}},"required":["makerAddress","takerAddress","makerAssetAmount","takerAssetAmount","makerAssetData","takerAssetData","exchangeAddress","expirationTimeSeconds"]},"relayerApiOrderConfigResponseSchema":{"type":"object","properties":{"makerFee":{"$ref":"#/components/schemas/numberSchema"},"takerFee":{"$ref":"#/components/schemas/numberSchema"},"feeRecipientAddress":{"$ref":"#/components/schemas/addressSchema"},"senderAddress":{"$ref":"#/components/schemas/addressSchema"}},"required":["makerFee","takerFee","feeRecipientAddress","senderAddress"]},"relayerApiOrderbookResponseSchema":{"type":"object","properties":{"bids":{"$ref":"#/components/schemas/relayerApiOrdersResponseSchema"},"asks":{"$ref":"#/components/schemas/relayerApiOrdersResponseSchema"}},"required":["bids","asks"]},"relayerApiAssetDataPairsResponseSchema":{"type":"object","allOf":[{"$ref":"#/components/schemas/paginatedCollectionSchema"},{"properties":{"records":{"$ref":"#/components/schemas/relayerApiAssetDataPairsSchema"}},"required":["records"]}]},"relayerApiAssetDataTradeInfoSchema":{"type":"object","properties":{"assetData":{"$ref":"#/components/schemas/hexSchema"},"minAmount":{"$ref":"#/components/schemas/numberSchema"},"maxAmount":{"$ref":"#/components/schemas/numberSchema"},"precision":{"type":"number"}},"required":["assetData"]},"relayerApiOrdersChannelSubscribeSchema":{"type":"object","properties":{"type":{"enum":["subscribe"]},"channel":{"enum":["orders"]},"requestId":{"type":"string"},"payload":{"$ref":"#/components/schemas/relayerApiOrdersChannelSubscribePayload"}},"required":["type","channel","requestId"]},"relayerApiOrdersChannelSubscribePayload":{"type":"object","properties":{"makerAssetProxyId":{"$ref":"#/components/schemas/hexSchema"},"takerAssetProxyId":{"$ref":"#/components/schemas/hexSchema"},"networkId":{"type":"number"},"makerAssetAddress":{"$ref":"#/components/schemas/addressSchema"},"takerAssetAddress":{"$ref":"#/components/schemas/addressSchema"},"makerAssetData":{"$ref":"#/components/schemas/hexSchema"},"takerAssetData":{"$ref":"#/components/schemas/hexSchema"},"traderAssetData":{"$ref":"#/components/schemas/hexSchema"}}},"relayerApiOrdersChannelUpdateSchema":{"type":"object","properties":{"type":{"enum":["update"]},"channel":{"enum":["orders"]},"requestId":{"type":"string"},"payload":{"$ref":"#/components/schemas/relayerApiOrdersSchema"}},"required":["type","channel","requestId"]},"relayerApiOrdersResponseSchema":{"type":"object","allOf":[{"$ref":"#/components/schemas/paginatedCollectionSchema"},{"properties":{"records":{"$ref":"#/components/schemas/relayerApiOrdersSchema"}},"required":["records"]}]},"relayerApiAssetDataPairsSchema":{"type":"array","items":{"properties":{"assetDataA":{"$ref":"#/components/schemas/relayerApiAssetDataTradeInfoSchema"},"assetDataB":{"$ref":"#/components/schemas/relayerApiAssetDataTradeInfoSchema"}},"required":["assetDataA","assetDataB"],"type":"object"}}}}} \ No newline at end of file -- cgit From b38ef579fb75c777fac2eef3d4bcda2c97014f0b Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 24 Aug 2018 19:11:10 +0100 Subject: Updated CHANGELOGS --- packages/0x.js/CHANGELOG.json | 3 ++- packages/0x.js/CHANGELOG.md | 12 ++++++++---- packages/abi-gen/CHANGELOG.json | 9 +++++++++ packages/abi-gen/CHANGELOG.md | 12 ++++++++---- packages/assert/CHANGELOG.json | 9 +++++++++ packages/assert/CHANGELOG.md | 12 ++++++++---- packages/base-contract/CHANGELOG.json | 9 +++++++++ packages/base-contract/CHANGELOG.md | 12 ++++++++---- packages/connect/CHANGELOG.json | 3 ++- packages/connect/CHANGELOG.md | 11 ++++++++--- packages/contract-wrappers/CHANGELOG.json | 3 ++- packages/contract-wrappers/CHANGELOG.md | 10 ++++++++-- packages/dev-utils/CHANGELOG.json | 9 +++++++++ packages/dev-utils/CHANGELOG.md | 10 +++++++--- packages/ethereum-types/CHANGELOG.json | 9 +++++++++ packages/ethereum-types/CHANGELOG.md | 11 ++++++++--- packages/fill-scenarios/CHANGELOG.json | 3 ++- packages/fill-scenarios/CHANGELOG.md | 8 ++++++-- packages/forwarder-helper/CHANGELOG.json | 3 ++- packages/forwarder-helper/CHANGELOG.md | 10 ++++++++++ packages/json-schemas/CHANGELOG.json | 3 ++- packages/json-schemas/CHANGELOG.md | 10 +++++++--- packages/migrations/CHANGELOG.json | 9 +++++++++ packages/migrations/CHANGELOG.md | 10 +++++++--- packages/order-utils/CHANGELOG.json | 3 ++- packages/order-utils/CHANGELOG.md | 17 ++++++++++++++--- packages/order-watcher/CHANGELOG.json | 3 ++- packages/order-watcher/CHANGELOG.md | 9 +++++++-- packages/react-docs/CHANGELOG.json | 9 +++++++++ packages/react-docs/CHANGELOG.md | 12 ++++++++---- packages/react-shared/CHANGELOG.json | 9 +++++++++ packages/react-shared/CHANGELOG.md | 12 ++++++++---- packages/sol-compiler/CHANGELOG.json | 3 ++- packages/sol-compiler/CHANGELOG.md | 12 +++++++++--- packages/sol-cov/CHANGELOG.json | 3 ++- packages/sol-cov/CHANGELOG.md | 12 ++++++++---- packages/sol-resolver/CHANGELOG.json | 9 +++++++++ packages/sol-resolver/CHANGELOG.md | 12 ++++++++---- packages/sra-api/CHANGELOG.json | 3 ++- packages/sra-api/CHANGELOG.md | 6 +++++- packages/sra-report/CHANGELOG.json | 9 +++++++++ packages/sra-report/CHANGELOG.md | 10 +++++++--- packages/subproviders/CHANGELOG.json | 3 ++- packages/subproviders/CHANGELOG.md | 10 +++++++--- packages/tslint-config/CHANGELOG.json | 9 +++++++++ packages/tslint-config/CHANGELOG.md | 10 +++++++--- packages/types/CHANGELOG.json | 3 ++- packages/types/CHANGELOG.md | 10 +++++++--- packages/typescript-typings/CHANGELOG.json | 9 +++++++++ packages/typescript-typings/CHANGELOG.md | 10 +++++++--- packages/utils/CHANGELOG.json | 9 +++++++++ packages/utils/CHANGELOG.md | 13 +++++++++---- packages/web3-wrapper/CHANGELOG.json | 3 ++- packages/web3-wrapper/CHANGELOG.md | 14 ++++++++++---- 54 files changed, 359 insertions(+), 97 deletions(-) create mode 100644 packages/forwarder-helper/CHANGELOG.md (limited to 'packages') diff --git a/packages/0x.js/CHANGELOG.json b/packages/0x.js/CHANGELOG.json index 0f5a10e43..346938958 100644 --- a/packages/0x.js/CHANGELOG.json +++ b/packages/0x.js/CHANGELOG.json @@ -7,7 +7,8 @@ "Re-organize the exported interface of 0x.js. Remove the `ZeroEx` class, and instead export the same exports as `0x.js`'s sub-packages: `@0xproject/contract-wrappers`, `@0xproject/order-utils` and `@0xproject/order-watcher`", "pr": 963 } - ] + ], + "timestamp": 1535133899 }, { "version": "1.0.1-rc.3", diff --git a/packages/0x.js/CHANGELOG.md b/packages/0x.js/CHANGELOG.md index adeaed9eb..e94907353 100644 --- a/packages/0x.js/CHANGELOG.md +++ b/packages/0x.js/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v1.0.1-rc.3 - _August 13, 2018_ +## v1.0.1-rc.4 - _August 24, 2018_ + + * Re-organize the exported interface of 0x.js. Remove the `ZeroEx` class, and instead export the same exports as `0x.js`'s sub-packages: `@0xproject/contract-wrappers`, `@0xproject/order-utils` and `@0xproject/order-watcher` (#963) + +## v1.0.1-rc.3 - _August 14, 2018_ * Dependencies updated * Update ecSignOrderHashAsync to return the signature as a string for immediate use in contracts (#914) @@ -22,11 +26,11 @@ CHANGELOG * Dependencies updated -## v1.0.0-rc.2 - _July 19, 2018_ +## v1.0.0-rc.2 - _July 20, 2018_ * Remove `zeroEx.assetData` and instead re-export it's static functions directly off `ZeroEx` -## v1.0.0-rc.1 - _July 19, 2018_ +## v1.0.0-rc.1 - _July 20, 2018_ * Remove tokenRegistry wrapper (#863) * Rename `zeroEx.token` to `zeroEx.erc20Token`, and add `zeroEx.erc721Token` (#863) @@ -66,7 +70,7 @@ CHANGELOG * Renamed createOrderStateWatcher to createOrderWatcherAsync since it is now async (#579) * Renamed ZeroExError to ContractWrappersErrors since they now lives in the @0xproject/contract-wrappers subpackage (#579) -## v0.37.2 - _May 4, 2018_ +## v0.37.2 - _May 5, 2018_ * Dependencies updated diff --git a/packages/abi-gen/CHANGELOG.json b/packages/abi-gen/CHANGELOG.json index d7b084fe6..0b6a9a052 100644 --- a/packages/abi-gen/CHANGELOG.json +++ b/packages/abi-gen/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1535133899, + "version": "1.0.6", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1534210131, "version": "1.0.5", diff --git a/packages/abi-gen/CHANGELOG.md b/packages/abi-gen/CHANGELOG.md index 5368ae3f0..477f69e2c 100644 --- a/packages/abi-gen/CHANGELOG.md +++ b/packages/abi-gen/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v1.0.5 - _August 13, 2018_ +## v1.0.6 - _August 24, 2018_ + + * Dependencies updated + +## v1.0.5 - _August 14, 2018_ * Dependencies updated @@ -25,7 +29,7 @@ CHANGELOG * Fix the abi-gen entry point in package.json (#901) -## v1.0.0 - _July 19, 2018_ +## v1.0.0 - _July 20, 2018_ * Convert e_r_c to erc in generated file names (#822) * Remove the output directory before writing to it (#822) @@ -43,7 +47,7 @@ CHANGELOG * Dependencies updated -## v0.3.1 - _May 31, 2018_ +## v0.3.1 - _June 1, 2018_ * Incorrect publish that was unpublished @@ -51,7 +55,7 @@ CHANGELOG * Properly export the executable binary (#588) -## v0.2.13 - _May 4, 2018_ +## v0.2.13 - _May 5, 2018_ * Dependencies updated diff --git a/packages/assert/CHANGELOG.json b/packages/assert/CHANGELOG.json index 1deacb7b5..01fd4c567 100644 --- a/packages/assert/CHANGELOG.json +++ b/packages/assert/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1535133899, + "version": "1.0.6", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1534210131, "version": "1.0.5", diff --git a/packages/assert/CHANGELOG.md b/packages/assert/CHANGELOG.md index cdb5e45d4..ffa34c48c 100644 --- a/packages/assert/CHANGELOG.md +++ b/packages/assert/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v1.0.5 - _August 13, 2018_ +## v1.0.6 - _August 24, 2018_ + + * Dependencies updated + +## v1.0.5 - _August 14, 2018_ * Dependencies updated @@ -25,7 +29,7 @@ CHANGELOG * Dependencies updated -## v1.0.0 - _July 19, 2018_ +## v1.0.0 - _July 20, 2018_ * Fix bug in string enum assertion. We erroneously were checking against the enum keys, not values (#821) @@ -41,7 +45,7 @@ CHANGELOG * Dependencies updated -## v0.2.11 - _May 31, 2018_ +## v0.2.11 - _June 1, 2018_ * Incorrect publish that was unpublished @@ -49,7 +53,7 @@ CHANGELOG * Dependencies updated -## v0.2.9 - _May 4, 2018_ +## v0.2.9 - _May 5, 2018_ * Dependencies updated diff --git a/packages/base-contract/CHANGELOG.json b/packages/base-contract/CHANGELOG.json index 39e3cbe5e..3f01ab0eb 100644 --- a/packages/base-contract/CHANGELOG.json +++ b/packages/base-contract/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1535133899, + "version": "2.0.0", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "2.0.0-rc.1", "changes": [ diff --git a/packages/base-contract/CHANGELOG.md b/packages/base-contract/CHANGELOG.md index 002ad931b..634b3f5a7 100644 --- a/packages/base-contract/CHANGELOG.md +++ b/packages/base-contract/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v2.0.0-rc.1 - _August 13, 2018_ +## v2.0.0 - _August 24, 2018_ + + * Dependencies updated + +## v2.0.0-rc.1 - _August 14, 2018_ * Added strict encoding/decoding checks for sendTransaction and call (#915) @@ -25,7 +29,7 @@ CHANGELOG * Dependencies updated -## v1.0.0 - _July 19, 2018_ +## v1.0.0 - _July 20, 2018_ * Dependencies updated @@ -41,7 +45,7 @@ CHANGELOG * Update EthersJs to fix the `value.toLowerCase()` is not a function bug caused by `ethers.js` breaking patch version https://github.com/ethers-io/ethers.js/issues/201 -## v0.3.3 - _May 31, 2018_ +## v0.3.3 - _June 1, 2018_ * Incorrect publish that was unpublished @@ -49,7 +53,7 @@ CHANGELOG * Dependencies updated -## v0.3.1 - _May 4, 2018_ +## v0.3.1 - _May 5, 2018_ * Dependencies updated diff --git a/packages/connect/CHANGELOG.json b/packages/connect/CHANGELOG.json index 1d0efac95..6cf679b34 100644 --- a/packages/connect/CHANGELOG.json +++ b/packages/connect/CHANGELOG.json @@ -10,7 +10,8 @@ "note": "Stopped exporting `Order` type", "pr": 924 } - ] + ], + "timestamp": 1535133899 }, { "timestamp": 1534210131, diff --git a/packages/connect/CHANGELOG.md b/packages/connect/CHANGELOG.md index f9d84ff9c..a6821f064 100644 --- a/packages/connect/CHANGELOG.md +++ b/packages/connect/CHANGELOG.md @@ -5,7 +5,12 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v1.0.5 - _August 13, 2018_ +## v2.0.0-rc.1 - _August 24, 2018_ + + * Updated for SRA v2 (#974) + * Stopped exporting `Order` type (#924) + +## v1.0.5 - _August 14, 2018_ * Dependencies updated @@ -25,7 +30,7 @@ CHANGELOG * Dependencies updated -## v1.0.0 - _July 19, 2018_ +## v1.0.0 - _July 20, 2018_ * Remove `WebSocketOrderbookChannel` from the public interface and replace with `orderbookChannelFactory` @@ -49,7 +54,7 @@ CHANGELOG * Dependencies updated -## v0.6.12 - _May 4, 2018_ +## v0.6.12 - _May 5, 2018_ * Dependencies updated diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json index 8e86d7d58..3809ad098 100644 --- a/packages/contract-wrappers/CHANGELOG.json +++ b/packages/contract-wrappers/CHANGELOG.json @@ -16,7 +16,8 @@ "note": "Added Transaction Encoder for use with 0x Exchange executeTransaction", "pr": 975 } - ] + ], + "timestamp": 1535133899 }, { "version": "1.0.1-rc.3", diff --git a/packages/contract-wrappers/CHANGELOG.md b/packages/contract-wrappers/CHANGELOG.md index c2ad7218e..b1003edfd 100644 --- a/packages/contract-wrappers/CHANGELOG.md +++ b/packages/contract-wrappers/CHANGELOG.md @@ -5,7 +5,13 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v1.0.1-rc.3 - _August 13, 2018_ +## v1.0.1-rc.4 - _August 24, 2018_ + + * Export missing types: `TransactionEncoder`, `ContractAbi`, `JSONRPCRequestPayload`, `JSONRPCResponsePayload`, `JSONRPCErrorCallback`, `AbiDefinition`, `FunctionAbi`, `EventAbi`, `EventParameter`, `DecodedLogArgs`, `MethodAbi`, `ConstructorAbi`, `FallbackAbi`, `DataItem`, `ConstructorStateMutability`, `StateMutability` & `ExchangeSignatureValidatorApprovalEventArgs` (#924) + * Remove superfluous exported types: `ContractEvent`, `Token`, `OrderFillRequest`, `ContractEventArgs`, `LogEvent`, `OnOrderStateChangeCallback`, `ECSignature`, `OrderStateValid`, `OrderStateInvalid`, `OrderState`, `FilterObject`, `TransactionReceipt` & `TransactionReceiptWithDecodedLogs` (#924) + * Added Transaction Encoder for use with 0x Exchange executeTransaction (#975) + +## v1.0.1-rc.3 - _August 14, 2018_ * Added strict encoding/decoding checks for sendTransaction and call (#915) * Add ForwarderWrapper (#934) @@ -23,7 +29,7 @@ CHANGELOG * Dependencies updated -## v1.0.0-rc.1 - _July 19, 2018_ +## v1.0.0-rc.1 - _July 20, 2018_ * Update blockstream to v5.0 and propogate up caught errors to active subscriptions (#815) * Update to v2 of 0x rpotocol (#822) diff --git a/packages/dev-utils/CHANGELOG.json b/packages/dev-utils/CHANGELOG.json index 51ae117cf..e0f08344b 100644 --- a/packages/dev-utils/CHANGELOG.json +++ b/packages/dev-utils/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1535133899, + "version": "1.0.5", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1534210131, "version": "1.0.4", diff --git a/packages/dev-utils/CHANGELOG.md b/packages/dev-utils/CHANGELOG.md index 1e244ee7d..0e39de926 100644 --- a/packages/dev-utils/CHANGELOG.md +++ b/packages/dev-utils/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v1.0.4 - _August 13, 2018_ +## v1.0.5 - _August 24, 2018_ + + * Dependencies updated + +## v1.0.4 - _August 14, 2018_ * Dependencies updated @@ -21,7 +25,7 @@ CHANGELOG * Dependencies updated -## v1.0.0 - _July 19, 2018_ +## v1.0.0 - _July 20, 2018_ * Dependencies updated @@ -47,7 +51,7 @@ CHANGELOG * Pass SolCompilerArtifactAdapter to CoverageSubprovider (#589) * Move callbackErrorReporter over from 0x.js (#579) -## v0.4.1 - _May 4, 2018_ +## v0.4.1 - _May 5, 2018_ * Dependencies updated diff --git a/packages/ethereum-types/CHANGELOG.json b/packages/ethereum-types/CHANGELOG.json index 64c6e6d27..1db0e2785 100644 --- a/packages/ethereum-types/CHANGELOG.json +++ b/packages/ethereum-types/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1535133899, + "version": "1.0.5", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1534210131, "version": "1.0.4", diff --git a/packages/ethereum-types/CHANGELOG.md b/packages/ethereum-types/CHANGELOG.md index 67fa84437..76dd9ed19 100644 --- a/packages/ethereum-types/CHANGELOG.md +++ b/packages/ethereum-types/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v1.0.4 - _August 13, 2018_ +## v1.0.5 - _August 24, 2018_ + + * Dependencies updated + +## v1.0.4 - _August 14, 2018_ * Dependencies updated @@ -21,11 +25,12 @@ CHANGELOG * Dependencies updated -## v1.0.0 - _July 19, 2018_ +## v1.0.0 - _July 20, 2018_ * Add `TraceParams` interface for `debug_traceTransaction` parameters (#675) * Add `TransactionReceiptStatus` type (#812) + * Add Artifact types: `CompilerSettings`, `CompilerOptions`, `OutputField` (#924) -## v0.0.2 - _May 31, 2018_ +## v0.0.2 - _June 1, 2018_ * Initial publish (#642) diff --git a/packages/fill-scenarios/CHANGELOG.json b/packages/fill-scenarios/CHANGELOG.json index ae53b709a..481273fc4 100644 --- a/packages/fill-scenarios/CHANGELOG.json +++ b/packages/fill-scenarios/CHANGELOG.json @@ -5,7 +5,8 @@ { "note": "Dependencies updated" } - ] + ], + "timestamp": 1535133899 }, { "version": "1.0.1-rc.3", diff --git a/packages/fill-scenarios/CHANGELOG.md b/packages/fill-scenarios/CHANGELOG.md index 7efe163ec..5ae50d1c4 100644 --- a/packages/fill-scenarios/CHANGELOG.md +++ b/packages/fill-scenarios/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v1.0.1-rc.3 - _August 13, 2018_ +## v1.0.1-rc.4 - _August 24, 2018_ + + * Dependencies updated + +## v1.0.1-rc.3 - _August 14, 2018_ * Updated to use latest orderFactory interface, fixed `feeRecipient` spelling error in public interface (#936) * Dependencies updated @@ -22,7 +26,7 @@ CHANGELOG * Dependencies updated -## v1.0.0-rc.1 - _July 19, 2018_ +## v1.0.0-rc.1 - _July 20, 2018_ * Make fill-scenarios compatible with V2 of 0x protocol (#656) diff --git a/packages/forwarder-helper/CHANGELOG.json b/packages/forwarder-helper/CHANGELOG.json index be5b244b3..b99a98b93 100644 --- a/packages/forwarder-helper/CHANGELOG.json +++ b/packages/forwarder-helper/CHANGELOG.json @@ -6,6 +6,7 @@ "note": "Add initial forwarderHelperFactory", "pr": 997 } - ] + ], + "timestamp": 1535133899 } ] diff --git a/packages/forwarder-helper/CHANGELOG.md b/packages/forwarder-helper/CHANGELOG.md new file mode 100644 index 000000000..6d48268e6 --- /dev/null +++ b/packages/forwarder-helper/CHANGELOG.md @@ -0,0 +1,10 @@ + + +CHANGELOG + +## v1.0.1-rc.1 - _August 24, 2018_ + + * Add initial forwarderHelperFactory (#997) diff --git a/packages/json-schemas/CHANGELOG.json b/packages/json-schemas/CHANGELOG.json index f22b78c2a..b17267414 100644 --- a/packages/json-schemas/CHANGELOG.json +++ b/packages/json-schemas/CHANGELOG.json @@ -6,7 +6,8 @@ "note": "Update incorrect relayer api fee recipients response schema", "pr": 974 } - ] + ], + "timestamp": 1535133899 }, { "version": "1.0.1-rc.4", diff --git a/packages/json-schemas/CHANGELOG.md b/packages/json-schemas/CHANGELOG.md index 0ebc3d237..e3fa8078d 100644 --- a/packages/json-schemas/CHANGELOG.md +++ b/packages/json-schemas/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v1.0.1-rc.4 - _August 13, 2018_ +## v1.0.1-rc.5 - _August 24, 2018_ + + * Update incorrect relayer api fee recipients response schema (#974) + +## v1.0.1-rc.4 - _August 14, 2018_ * Allow for additional properties in txData schema (#938) * Change hexSchema to match `0x` (#937) @@ -27,7 +31,7 @@ CHANGELOG * Dependencies updated -## v1.0.0-rc.1 - _July 19, 2018_ +## v1.0.0-rc.1 - _July 20, 2018_ * Update schemas for V2 or 0x Protocol (#615) * Added CallData schema (#821) @@ -53,7 +57,7 @@ CHANGELOG * Dependencies updated -## v0.7.23 - _May 4, 2018_ +## v0.7.23 - _May 5, 2018_ * Dependencies updated diff --git a/packages/migrations/CHANGELOG.json b/packages/migrations/CHANGELOG.json index f92bb48b4..17f185a9d 100644 --- a/packages/migrations/CHANGELOG.json +++ b/packages/migrations/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1535133899, + "version": "1.0.5", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1534210131, "version": "1.0.4", diff --git a/packages/migrations/CHANGELOG.md b/packages/migrations/CHANGELOG.md index 7388c6ebc..0ebd03575 100644 --- a/packages/migrations/CHANGELOG.md +++ b/packages/migrations/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v1.0.4 - _August 13, 2018_ +## v1.0.5 - _August 24, 2018_ + + * Dependencies updated + +## v1.0.4 - _August 14, 2018_ * Dependencies updated @@ -21,7 +25,7 @@ CHANGELOG * Dependencies updated -## v1.0.0 - _July 19, 2018_ +## v1.0.0 - _July 20, 2018_ * Added migrations for 0x Protocol v2 @@ -45,7 +49,7 @@ CHANGELOG * Dependencies updated -## v0.0.5 - _May 4, 2018_ +## v0.0.5 - _May 5, 2018_ * Dependencies updated diff --git a/packages/order-utils/CHANGELOG.json b/packages/order-utils/CHANGELOG.json index 871bc50a1..81782b501 100644 --- a/packages/order-utils/CHANGELOG.json +++ b/packages/order-utils/CHANGELOG.json @@ -39,7 +39,8 @@ "Update `findFeeOrdersThatCoverFeesForTargetOrders` to round the the nearest integer when calculating required fees", "pr": 997 } - ] + ], + "timestamp": 1535133899 }, { "version": "1.0.1-rc.3", diff --git a/packages/order-utils/CHANGELOG.md b/packages/order-utils/CHANGELOG.md index 0df2a6a75..7af51fc61 100644 --- a/packages/order-utils/CHANGELOG.md +++ b/packages/order-utils/CHANGELOG.md @@ -5,7 +5,18 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v1.0.1-rc.3 - _August 13, 2018_ +## v1.0.1-rc.4 - _August 24, 2018_ + + * Remove rounding error being thrown when maker amount is very small (#959) + * Added rateUtils and sortingUtils (#953) + * Update marketUtils api such that all optional parameters are bundled into one optional param and more defaults are provided (#954) + * Instead of exporting signature util methods individually, they are now exported as `signatureUtils` (#924) + * Export types: `SignedOrder`, `Order`, `OrderRelevantState`, `OrderState`, `ECSignature`, `ERC20AssetData`, `ERC721AssetData`, `AssetProxyId`, `SignerType`, `SignatureType`, `OrderStateValid`, `OrderStateInvalid`, `ExchangeContractErrs`, `TradeSide`, `TransferType`, `FindFeeOrdersThatCoverFeesForTargetOrdersOpts`, `FindOrdersThatCoverMakerAssetFillAmountOpts`, `FeeOrdersAndRemainingFeeAmount`, `OrdersAndRemainingFillAmount`, `Provider`, `JSONRPCRequestPayload`, `JSONRPCErrorCallback` and `JSONRPCResponsePayload` (#924) + * Rename `resultOrders` to `resultFeeOrders` for object returned by `findFeeOrdersThatCoverFeesForTargetOrders` in `marketUtils` api (#997) + * Make `sortFeeOrdersByFeeAdjustedRate` in `sortingUtils` generic (#997) + * Update `findFeeOrdersThatCoverFeesForTargetOrders` to round the the nearest integer when calculating required fees (#997) + +## v1.0.1-rc.3 - _August 14, 2018_ * Update ecSignOrderHashAsync to return signature string with signature type byte. Removes messagePrefixOpts. (#914) * Added a synchronous `createOrder` method in `orderFactory`, updated public interfaces to support some optional parameters (#936) @@ -28,7 +39,7 @@ CHANGELOG * Upgrade ethereumjs-abi dep including a fix so that addresses starting with 0 are properly decoded by `decodeERC20AssetData` -## v1.0.0-rc.1 - _July 19, 2018_ +## v1.0.0-rc.1 - _July 20, 2018_ * Refactor to work with V2 of 0x protocol (#636) * Export parseECSignature method (#684) @@ -54,7 +65,7 @@ CHANGELOG * Add orderStateUtils, a module for computing order state needed to decide if an order is still valid -## v0.0.4 - _May 4, 2018_ +## v0.0.4 - _May 5, 2018_ * Dependencies updated diff --git a/packages/order-watcher/CHANGELOG.json b/packages/order-watcher/CHANGELOG.json index ee6d5540a..fe38e2175 100644 --- a/packages/order-watcher/CHANGELOG.json +++ b/packages/order-watcher/CHANGELOG.json @@ -11,7 +11,8 @@ "note": "Remove exporting types: `BlockParamLiteral`, `BlockParam`, `Order`", "pr": 924 } - ] + ], + "timestamp": 1535133899 }, { "version": "1.0.1-rc.3", diff --git a/packages/order-watcher/CHANGELOG.md b/packages/order-watcher/CHANGELOG.md index bb92f2850..73bfd5114 100644 --- a/packages/order-watcher/CHANGELOG.md +++ b/packages/order-watcher/CHANGELOG.md @@ -5,7 +5,12 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v1.0.1-rc.3 - _August 13, 2018_ +## v1.0.1-rc.4 - _August 24, 2018_ + + * Export types: `ExchangeContractErrs`, `OrderRelevantState`, `JSONRPCRequestPayload`, `JSONRPCErrorCallback` and `JSONRPCResponsePayload` (#924) + * Remove exporting types: `BlockParamLiteral`, `BlockParam`, `Order` (#924) + +## v1.0.1-rc.3 - _August 14, 2018_ * Dependencies updated @@ -21,7 +26,7 @@ CHANGELOG * Dependencies updated -## v1.0.0-rc.1 - _July 19, 2018_ +## v1.0.0-rc.1 - _July 20, 2018_ * Add support for ERC721 event watching and Exchange V2 events (#887) diff --git a/packages/react-docs/CHANGELOG.json b/packages/react-docs/CHANGELOG.json index 2b83b7fae..5ca4f4d05 100644 --- a/packages/react-docs/CHANGELOG.json +++ b/packages/react-docs/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1535133899, + "version": "1.0.6", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1534210131, "version": "1.0.5", diff --git a/packages/react-docs/CHANGELOG.md b/packages/react-docs/CHANGELOG.md index 38d2451dd..09d666d75 100644 --- a/packages/react-docs/CHANGELOG.md +++ b/packages/react-docs/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v1.0.5 - _August 13, 2018_ +## v1.0.6 - _August 24, 2018_ + + * Dependencies updated + +## v1.0.5 - _August 14, 2018_ * Dependencies updated @@ -25,7 +29,7 @@ CHANGELOG * Dependencies updated -## v1.0.0 - _July 19, 2018_ +## v1.0.0 - _July 20, 2018_ * Dependencies updated @@ -45,7 +49,7 @@ CHANGELOG * Dependencies updated -## v0.0.13 - _May 31, 2018_ +## v0.0.13 - _June 1, 2018_ * Incorrect publish that was unpublished @@ -53,7 +57,7 @@ CHANGELOG * Dependencies updated -## v0.0.11 - _May 4, 2018_ +## v0.0.11 - _May 5, 2018_ * Dependencies updated diff --git a/packages/react-shared/CHANGELOG.json b/packages/react-shared/CHANGELOG.json index 1268bcc7b..01e97f9e7 100644 --- a/packages/react-shared/CHANGELOG.json +++ b/packages/react-shared/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1535133899, + "version": "1.0.7", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1534210131, "version": "1.0.6", diff --git a/packages/react-shared/CHANGELOG.md b/packages/react-shared/CHANGELOG.md index cfbaf6c70..b70db245c 100644 --- a/packages/react-shared/CHANGELOG.md +++ b/packages/react-shared/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v1.0.6 - _August 13, 2018_ +## v1.0.7 - _August 24, 2018_ + + * Dependencies updated + +## v1.0.6 - _August 14, 2018_ * Dependencies updated @@ -29,7 +33,7 @@ CHANGELOG * Dependencies updated -## v1.0.0 - _July 19, 2018_ +## v1.0.0 - _July 20, 2018_ * Dependencies updated @@ -45,11 +49,11 @@ CHANGELOG * Dependencies updated -## v0.2.0 - _May 4, 2018_ +## v0.2.0 - _May 5, 2018_ * Removed portal specific colors -## v0.1.6 - _May 4, 2018_ +## v0.1.6 - _May 5, 2018_ * Dependencies updated diff --git a/packages/sol-compiler/CHANGELOG.json b/packages/sol-compiler/CHANGELOG.json index a723ea12e..b27253b01 100644 --- a/packages/sol-compiler/CHANGELOG.json +++ b/packages/sol-compiler/CHANGELOG.json @@ -15,7 +15,8 @@ "note": "Export types: `CompilerSettings`, `OutputField`", "pr": 924 } - ] + ], + "timestamp": 1535133899 }, { "timestamp": 1534210131, diff --git a/packages/sol-compiler/CHANGELOG.md b/packages/sol-compiler/CHANGELOG.md index ee9eadeaa..852015ff9 100644 --- a/packages/sol-compiler/CHANGELOG.md +++ b/packages/sol-compiler/CHANGELOG.md @@ -5,7 +5,13 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v1.0.5 - _August 13, 2018_ +## v1.1.0 - _August 24, 2018_ + + * Quicken compilation by sending multiple contracts to the same solcjs invocation, batching them together based on compiler version requirements. (#965) + * Stop exporting types: `ContractArtifact`, `ContractNetworks` (#924) + * Export types: `CompilerSettings`, `OutputField` (#924) + +## v1.0.5 - _August 14, 2018_ * Dependencies updated @@ -25,7 +31,7 @@ CHANGELOG * Dependencies updated -## v1.0.0 - _July 19, 2018_ +## v1.0.0 - _July 20, 2018_ * Dependencies updated @@ -51,7 +57,7 @@ CHANGELOG * Properly export the executable binary (#588) * Add the ability to define a specific solidity version (#589) -## v0.4.3 - _May 4, 2018_ +## v0.4.3 - _May 5, 2018_ * Dependencies updated diff --git a/packages/sol-cov/CHANGELOG.json b/packages/sol-cov/CHANGELOG.json index 166bd9255..597ba4875 100644 --- a/packages/sol-cov/CHANGELOG.json +++ b/packages/sol-cov/CHANGELOG.json @@ -7,7 +7,8 @@ "Export types: `JSONRPCRequestPayload`, `Provider`, `JSONRPCErrorCallback`, `JSONRPCResponsePayload`, `JSONRPCRequestPayloadWithMethod`, `NextCallback`, `ErrorCallback`, `OnNextCompleted` and `Callback`", "pr": 924 } - ] + ], + "timestamp": 1535133899 }, { "version": "2.0.0", diff --git a/packages/sol-cov/CHANGELOG.md b/packages/sol-cov/CHANGELOG.md index d7bdb9614..819b58c95 100644 --- a/packages/sol-cov/CHANGELOG.md +++ b/packages/sol-cov/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v2.0.0 - _August 13, 2018_ +## v2.1.0 - _August 24, 2018_ + + * Export types: `JSONRPCRequestPayload`, `Provider`, `JSONRPCErrorCallback`, `JSONRPCResponsePayload`, `JSONRPCRequestPayloadWithMethod`, `NextCallback`, `ErrorCallback`, `OnNextCompleted` and `Callback` (#924) + +## v2.0.0 - _August 14, 2018_ * Fix a bug when eth_call coverage was not computed because of silent schema validation failures (#938) * Make `TruffleArtifactAdapter` read the `truffle.js` config for `solc` settings (#938) @@ -24,7 +28,7 @@ CHANGELOG * Dependencies updated -## v1.0.0 - _July 19, 2018_ +## v1.0.0 - _July 20, 2018_ * Add artifact adapter as a parameter for `CoverageSubprovider`. Export `AbstractArtifactAdapter` (#589) * Implement `SolCompilerArtifactAdapter` and `TruffleArtifactAdapter` (#589) @@ -57,7 +61,7 @@ CHANGELOG * Dependencies updated -## v0.1.0 - _May 31, 2018_ +## v0.1.0 - _June 1, 2018_ * Incorrect publish that was unpublished @@ -65,7 +69,7 @@ CHANGELOG * Dependencies updated -## v0.0.10 - _May 4, 2018_ +## v0.0.10 - _May 5, 2018_ * Dependencies updated diff --git a/packages/sol-resolver/CHANGELOG.json b/packages/sol-resolver/CHANGELOG.json index 42d4c7ed1..cd1dcbe01 100644 --- a/packages/sol-resolver/CHANGELOG.json +++ b/packages/sol-resolver/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1535133899, + "version": "1.0.6", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "1.0.5", "changes": [ diff --git a/packages/sol-resolver/CHANGELOG.md b/packages/sol-resolver/CHANGELOG.md index 1427ec3fe..64ae2d673 100644 --- a/packages/sol-resolver/CHANGELOG.md +++ b/packages/sol-resolver/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v1.0.5 - _August 13, 2018_ +## v1.0.6 - _August 24, 2018_ + + * Dependencies updated + +## v1.0.5 - _August 14, 2018_ * Fix a bug where RelativeFSResolver would crash when trying to read a directory (#909) * Fix a bug where NpmResolver would crash when trying to read a directory (#961) @@ -26,7 +30,7 @@ CHANGELOG * Dependencies updated -## v1.0.0 - _July 19, 2018_ +## v1.0.0 - _July 20, 2018_ * Fix a bug in FsResolver where it tries to read directories as files (#589) * Fix a bug in NameResolver where it is not ignoring .sol files (#589) @@ -39,7 +43,7 @@ CHANGELOG * Dependencies updated -## v0.0.6 - _May 31, 2018_ +## v0.0.6 - _June 1, 2018_ * Incorrect publish that was unpublished @@ -47,7 +51,7 @@ CHANGELOG * Dependencies updated -## v0.0.4 - _May 4, 2018_ +## v0.0.4 - _May 5, 2018_ * Dependencies updated diff --git a/packages/sra-api/CHANGELOG.json b/packages/sra-api/CHANGELOG.json index d6797cc45..8467f3c68 100644 --- a/packages/sra-api/CHANGELOG.json +++ b/packages/sra-api/CHANGELOG.json @@ -6,7 +6,8 @@ "note": "Add takerAddress to /orders parameters", "pr": 974 } - ] + ], + "timestamp": 1535133899 }, { "version": "1.0.1-rc.4", diff --git a/packages/sra-api/CHANGELOG.md b/packages/sra-api/CHANGELOG.md index ed0d4891b..1a88b0ce1 100644 --- a/packages/sra-api/CHANGELOG.md +++ b/packages/sra-api/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v1.0.1-rc.4 - _August 13, 2018_ +## v1.0.1-rc.5 - _August 24, 2018_ + + * Add takerAddress to /orders parameters (#974) + +## v1.0.1-rc.4 - _August 14, 2018_ * Add inital spec for SRA v2 (#916) diff --git a/packages/sra-report/CHANGELOG.json b/packages/sra-report/CHANGELOG.json index 9711d3935..eecb81312 100644 --- a/packages/sra-report/CHANGELOG.json +++ b/packages/sra-report/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1535133899, + "version": "1.0.6", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1534210131, "version": "1.0.5", diff --git a/packages/sra-report/CHANGELOG.md b/packages/sra-report/CHANGELOG.md index 410221951..3ff6a73ae 100644 --- a/packages/sra-report/CHANGELOG.md +++ b/packages/sra-report/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v1.0.5 - _August 13, 2018_ +## v1.0.6 - _August 24, 2018_ + + * Dependencies updated + +## v1.0.5 - _August 14, 2018_ * Dependencies updated @@ -25,7 +29,7 @@ CHANGELOG * Dependencies updated -## v1.0.0 - _July 19, 2018_ +## v1.0.0 - _July 20, 2018_ * Dependencies updated @@ -57,7 +61,7 @@ CHANGELOG * Properly export the executable binary (#588) -## v0.0.14 - _May 4, 2018_ +## v0.0.14 - _May 5, 2018_ * Dependencies updated diff --git a/packages/subproviders/CHANGELOG.json b/packages/subproviders/CHANGELOG.json index bdda74c27..e11f663e6 100644 --- a/packages/subproviders/CHANGELOG.json +++ b/packages/subproviders/CHANGELOG.json @@ -7,7 +7,8 @@ "Export types: `PartialTxParams`, `JSONRPCRequestPayloadWithMethod`, `ECSignatureString`, `AccountFetchingConfigs`, `LedgerEthereumClientFactoryAsync`, `OnNextCompleted`, `MnemonicWalletSubproviderConfigs`, LedgerGetAddressResult, `JSONRPCRequestPayload`, `Provider`, `JSONRPCResponsePayload` and `JSONRPCErrorCallback`", "pr": 924 } - ] + ], + "timestamp": 1535133899 }, { "timestamp": 1534210131, diff --git a/packages/subproviders/CHANGELOG.md b/packages/subproviders/CHANGELOG.md index 152c0027e..444d1997a 100644 --- a/packages/subproviders/CHANGELOG.md +++ b/packages/subproviders/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v1.0.5 - _August 13, 2018_ +## v2.0.0 - _August 24, 2018_ + + * Export types: `PartialTxParams`, `JSONRPCRequestPayloadWithMethod`, `ECSignatureString`, `AccountFetchingConfigs`, `LedgerEthereumClientFactoryAsync`, `OnNextCompleted`, `MnemonicWalletSubproviderConfigs`, LedgerGetAddressResult, `JSONRPCRequestPayload`, `Provider`, `JSONRPCResponsePayload` and `JSONRPCErrorCallback` (#924) + +## v1.0.5 - _August 14, 2018_ * Dependencies updated @@ -25,7 +29,7 @@ CHANGELOG * Dependencies updated -## v1.0.0 - _July 19, 2018_ +## v1.0.0 - _July 20, 2018_ * Add `RpcSubprovider` with timeout (#874) * Add `EthLightwalletSubprovider` (#775) @@ -46,7 +50,7 @@ CHANGELOG * Dependencies updated -## v0.10.1 - _May 4, 2018_ +## v0.10.1 - _May 5, 2018_ * Dependencies updated diff --git a/packages/tslint-config/CHANGELOG.json b/packages/tslint-config/CHANGELOG.json index 8bad8526a..b70285f05 100644 --- a/packages/tslint-config/CHANGELOG.json +++ b/packages/tslint-config/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1535133899, + "version": "1.0.6", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1534210131, "version": "1.0.5", diff --git a/packages/tslint-config/CHANGELOG.md b/packages/tslint-config/CHANGELOG.md index 136441971..5474a08be 100644 --- a/packages/tslint-config/CHANGELOG.md +++ b/packages/tslint-config/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v1.0.5 - _August 13, 2018_ +## v1.0.6 - _August 24, 2018_ + + * Dependencies updated + +## v1.0.5 - _August 14, 2018_ * Dependencies updated @@ -25,7 +29,7 @@ CHANGELOG * Dependencies updated -## v1.0.0 - _July 19, 2018_ +## v1.0.0 - _July 20, 2018_ * Added a bunch of rules (#883) @@ -37,7 +41,7 @@ CHANGELOG * Dependencies updated -## v0.4.19 - _May 31, 2018_ +## v0.4.19 - _June 1, 2018_ * Incorrect publish that was unpublished diff --git a/packages/types/CHANGELOG.json b/packages/types/CHANGELOG.json index b99a8bc35..fabc80ecf 100644 --- a/packages/types/CHANGELOG.json +++ b/packages/types/CHANGELOG.json @@ -6,7 +6,8 @@ "note": "Add revert reasons for ERC721Token", "pr": 933 } - ] + ], + "timestamp": 1535133899 }, { "version": "1.0.1-rc.4", diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index 9be0c8bca..3bd1d375f 100644 --- a/packages/types/CHANGELOG.md +++ b/packages/types/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v1.0.1-rc.4 - _August 13, 2018_ +## v1.0.1-rc.5 - _August 24, 2018_ + + * Add revert reasons for ERC721Token (#933) + +## v1.0.1-rc.4 - _August 14, 2018_ * Added SignerType to handle different signing prefix scenarios (#914) @@ -25,7 +29,7 @@ CHANGELOG * Dependencies updated -## v1.0.0-rc.1 - _July 19, 2018_ +## v1.0.0-rc.1 - _July 20, 2018_ * Updated types for V2 of 0x protocol * Add `ECSignatureBuffer` @@ -48,7 +52,7 @@ CHANGELOG * Make OpCode type an enum (#589) * Moved ExchangeContractErrs, DoneCallback, Token, OrderRelevantState, OrderStateValid, OrderStateInvalid, OrderState, OrderAddresses and OrderValues types from 0x.js (#579) -## v0.6.3 - _May 4, 2018_ +## v0.6.3 - _May 5, 2018_ * Dependencies updated diff --git a/packages/typescript-typings/CHANGELOG.json b/packages/typescript-typings/CHANGELOG.json index 566d9f24c..8e6b2b3c8 100644 --- a/packages/typescript-typings/CHANGELOG.json +++ b/packages/typescript-typings/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1535133899, + "version": "1.0.5", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "timestamp": 1534210131, "version": "1.0.4", diff --git a/packages/typescript-typings/CHANGELOG.md b/packages/typescript-typings/CHANGELOG.md index 70e6574b2..b3a3f3e38 100644 --- a/packages/typescript-typings/CHANGELOG.md +++ b/packages/typescript-typings/CHANGELOG.md @@ -5,7 +5,11 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v1.0.4 - _August 13, 2018_ +## v1.0.5 - _August 24, 2018_ + + * Dependencies updated + +## v1.0.4 - _August 14, 2018_ * Dependencies updated @@ -21,7 +25,7 @@ CHANGELOG * Dependencies updated -## v1.0.0 - _July 19, 2018_ +## v1.0.0 - _July 20, 2018_ * Add types for `eth-lightwallet` (#775) * Improve 'web3-provider-engine' typings (#768) @@ -46,7 +50,7 @@ CHANGELOG * Dependencies updated -## v0.3.1 - _May 4, 2018_ +## v0.3.1 - _May 5, 2018_ * Dependencies updated diff --git a/packages/utils/CHANGELOG.json b/packages/utils/CHANGELOG.json index 796a99a5a..6edafb946 100644 --- a/packages/utils/CHANGELOG.json +++ b/packages/utils/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "timestamp": 1535133899, + "version": "1.0.6", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, { "version": "1.0.5", "changes": [ diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index bdde2687d..a2d4d115b 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/CHANGELOG.md @@ -5,9 +5,14 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v1.0.5 - _August 13, 2018_ +## v1.0.6 - _August 24, 2018_ + + * Dependencies updated + +## v1.0.5 - _August 14, 2018_ * Increased BigNumber decimal precision from 20 to 78 (#807) + * Store different ABIs for events with same function signature and different amount of indexed arguments (#933) ## v1.0.4 - _July 26, 2018_ @@ -25,7 +30,7 @@ CHANGELOG * Add `AbortController` polyfill to `fetchAsync` (#903) -## v1.0.0 - _July 19, 2018_ +## v1.0.0 - _July 20, 2018_ * Add `fetchAsync` which adds a default timeout to all requests (#874) @@ -43,7 +48,7 @@ CHANGELOG * Dependencies updated -## v0.7.0 - _May 31, 2018_ +## v0.7.0 - _June 1, 2018_ * Incorrect publish that was unpublished @@ -51,7 +56,7 @@ CHANGELOG * Dependencies updated -## v0.6.1 - _May 4, 2018_ +## v0.6.1 - _May 5, 2018_ * Dependencies updated diff --git a/packages/web3-wrapper/CHANGELOG.json b/packages/web3-wrapper/CHANGELOG.json index b9cde2f95..e2bbcaeb8 100644 --- a/packages/web3-wrapper/CHANGELOG.json +++ b/packages/web3-wrapper/CHANGELOG.json @@ -15,7 +15,8 @@ "note": "Export `AbiDecoder` class", "pr": 924 } - ] + ], + "timestamp": 1535133899 }, { "version": "1.2.0", diff --git a/packages/web3-wrapper/CHANGELOG.md b/packages/web3-wrapper/CHANGELOG.md index 0955993f4..3bfe07d3b 100644 --- a/packages/web3-wrapper/CHANGELOG.md +++ b/packages/web3-wrapper/CHANGELOG.md @@ -5,7 +5,13 @@ Edit the package's CHANGELOG.json file only. CHANGELOG -## v1.2.0 - _August 13, 2018_ +## v2.0.0 - _August 24, 2018_ + + * Export types: `BlockParam`, `TxData`, `Provider`, `TransactionReceipt`, `Transaction`, `TraceParams`, `TransactionTrace``, BlockWithoutTransactionDat`a, `LogEntry`, `FilterObject`, `CallData`, `TransactionReceiptWithDecodedLogs`, `BlockWithTransactionData``, LogTopi`c, `JSONRPCRequestPayload`, `TransactionReceiptStatus`, `DecodedLogArgs`, `StructLog`, `JSONRPCErrorCallback``, BlockParamLitera`l, `ContractEventArg`, `DecodedLogEntry`, `LogEntryEvent`, `OpCode`, `TxDataPayable`, `JSONRPCResponsePayload``, RawLogEntr`y, `DecodedLogEntryEvent`, `LogWithDecodedArgs`, `AbiDefinition`, `RawLog`, `FunctionAbi`, `EventAbi`, `EventParameter``, MethodAb`i, `ConstructorAbi`, `FallbackAbi`, `DataItem`, `ConstructorStateMutability` and `StateMutability` (#924) + * Stop exporting types: `CallTxDataBaseRPC` and `AbstractBlockRPC` (#924) + * Export `AbiDecoder` class (#924) + +## v1.2.0 - _August 14, 2018_ * Export marshaller to convert between RPC and user-space data formats (#938) * Export RPC types (#938) @@ -26,7 +32,7 @@ CHANGELOG * Dependencies updated -## v1.0.0 - _July 19, 2018_ +## v1.0.0 - _July 20, 2018_ * Stop exporting `marshaller` utility file. (#902) * Export `marshaller` utility file. (#829) @@ -45,7 +51,7 @@ CHANGELOG * Dependencies updated -## v0.7.0 - _June 3, 2018_ +## v0.7.0 - _June 4, 2018_ * Add `web3Wrapper.getContractCodeAsync` (#675) * Add `web3Wrapper.getTransactionTraceAsync` (#675) @@ -60,7 +66,7 @@ CHANGELOG * Dependencies updated -## v0.6.3 - _May 4, 2018_ +## v0.6.3 - _May 5, 2018_ * Dependencies updated -- cgit From 7f585a15f526e0a61fd822cdefb7087fc6bb8934 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 24 Aug 2018 19:11:27 +0100 Subject: Publish - 0x.js@1.0.1-rc.4 - @0xproject/abi-gen@1.0.6 - @0xproject/assert@1.0.6 - @0xproject/base-contract@2.0.0 - @0xproject/connect@2.0.0-rc.1 - @0xproject/contract-wrappers@1.0.1-rc.4 - contracts@2.1.41 - @0xproject/dev-utils@1.0.5 - ethereum-types@1.0.5 - @0xproject/fill-scenarios@1.0.1-rc.4 - @0xproject/forwarder-helper@1.0.1-rc.1 - @0xproject/json-schemas@1.0.1-rc.5 - @0xproject/metacoin@0.0.16 - @0xproject/migrations@1.0.5 - @0xproject/monorepo-scripts@1.0.6 - @0xproject/order-utils@1.0.1-rc.4 - @0xproject/order-watcher@1.0.1-rc.4 - @0xproject/react-docs@1.0.6 - @0xproject/react-shared@1.0.7 - @0xproject/sol-compiler@1.1.0 - @0xproject/sol-cov@2.1.0 - @0xproject/sol-resolver@1.0.6 - @0xproject/sra-api@1.0.1-rc.5 - @0xproject/sra-report@1.0.6 - @0xproject/subproviders@2.0.0 - @0xproject/testnet-faucets@1.0.42 - @0xproject/tslint-config@1.0.6 - @0xproject/types@1.0.1-rc.5 - @0xproject/typescript-typings@1.0.5 - @0xproject/utils@1.0.6 - @0xproject/web3-wrapper@2.0.0 - @0xproject/website@0.0.45 --- packages/0x.js/package.json | 34 +++++++++++++-------------- packages/abi-gen/package.json | 10 ++++---- packages/assert/package.json | 10 ++++---- packages/base-contract/package.json | 12 +++++----- packages/connect/package.json | 14 +++++------ packages/contract-wrappers/package.json | 32 ++++++++++++------------- packages/contracts/package.json | 40 ++++++++++++++------------------ packages/dev-utils/package.json | 16 ++++++------- packages/ethereum-types/package.json | 4 ++-- packages/fill-scenarios/package.json | 20 ++++++++-------- packages/forwarder-helper/package.json | 22 ++++++++---------- packages/json-schemas/package.json | 12 ++++++---- packages/metacoin/package.json | 26 ++++++++++----------- packages/migrations/package.json | 26 ++++++++++----------- packages/monorepo-scripts/package.json | 2 +- packages/order-utils/package.json | 22 +++++++++--------- packages/order-watcher/package.json | 32 ++++++++++++------------- packages/react-docs/package.json | 10 ++++---- packages/react-shared/package.json | 6 ++--- packages/sol-compiler/package.json | 22 +++++++++--------- packages/sol-cov/package.json | 23 ++++++++++-------- packages/sol-resolver/package.json | 8 +++---- packages/sra-api/package.json | 6 ++--- packages/sra-report/package.json | 10 ++++---- packages/subproviders/package.json | 16 ++++++------- packages/testnet-faucets/package.json | 14 +++++------ packages/tslint-config/package.json | 2 +- packages/types/package.json | 6 ++--- packages/typescript-typings/package.json | 4 ++-- packages/utils/package.json | 10 ++++---- packages/web3-wrapper/package.json | 14 +++++------ packages/website/package.json | 10 ++++---- 32 files changed, 247 insertions(+), 248 deletions(-) (limited to 'packages') diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index bb0799f4b..b5cb6c7e4 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -1,6 +1,6 @@ { "name": "0x.js", - "version": "1.0.1-rc.3", + "version": "1.0.1-rc.4", "engines": { "node": ">=6.12" }, @@ -42,11 +42,11 @@ }, "license": "Apache-2.0", "devDependencies": { - "@0xproject/abi-gen": "^1.0.5", - "@0xproject/dev-utils": "^1.0.4", - "@0xproject/migrations": "^1.0.4", - "@0xproject/monorepo-scripts": "^1.0.5", - "@0xproject/tslint-config": "^1.0.5", + "@0xproject/abi-gen": "^1.0.6", + "@0xproject/dev-utils": "^1.0.5", + "@0xproject/migrations": "^1.0.5", + "@0xproject/monorepo-scripts": "^1.0.6", + "@0xproject/tslint-config": "^1.0.6", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", "@types/node": "^8.0.53", @@ -73,17 +73,17 @@ "webpack": "^3.1.0" }, "dependencies": { - "@0xproject/assert": "^1.0.5", - "@0xproject/base-contract": "^2.0.0-rc.1", - "@0xproject/contract-wrappers": "^1.0.1-rc.3", - "@0xproject/order-utils": "^1.0.1-rc.3", - "@0xproject/order-watcher": "1.0.1-rc.3", - "@0xproject/subproviders": "^1.0.5", - "@0xproject/types": "^1.0.1-rc.4", - "@0xproject/typescript-typings": "^1.0.4", - "@0xproject/utils": "^1.0.5", - "@0xproject/web3-wrapper": "^1.2.0", - "ethereum-types": "^1.0.4", + "@0xproject/assert": "^1.0.6", + "@0xproject/base-contract": "^2.0.0", + "@0xproject/contract-wrappers": "^1.0.1-rc.4", + "@0xproject/order-utils": "^1.0.1-rc.4", + "@0xproject/order-watcher": "^1.0.1-rc.4", + "@0xproject/subproviders": "^2.0.0", + "@0xproject/types": "^1.0.1-rc.5", + "@0xproject/typescript-typings": "^1.0.5", + "@0xproject/utils": "^1.0.6", + "@0xproject/web3-wrapper": "^2.0.0", + "ethereum-types": "^1.0.5", "ethers": "3.0.22", "lodash": "^4.17.5", "web3-provider-engine": "14.0.6" diff --git a/packages/abi-gen/package.json b/packages/abi-gen/package.json index 5d5fc146d..61a35ef09 100644 --- a/packages/abi-gen/package.json +++ b/packages/abi-gen/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/abi-gen", - "version": "1.0.5", + "version": "1.0.6", "engines": { "node": ">=6.12" }, @@ -31,10 +31,10 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen/README.md", "dependencies": { - "@0xproject/typescript-typings": "^1.0.4", - "@0xproject/utils": "^1.0.5", + "@0xproject/typescript-typings": "^1.0.5", + "@0xproject/utils": "^1.0.6", "chalk": "^2.3.0", - "ethereum-types": "^1.0.4", + "ethereum-types": "^1.0.5", "glob": "^7.1.2", "handlebars": "^4.0.11", "lodash": "^4.17.5", @@ -45,7 +45,7 @@ "yargs": "^10.0.3" }, "devDependencies": { - "@0xproject/tslint-config": "^1.0.5", + "@0xproject/tslint-config": "^1.0.6", "@types/glob": "5.0.35", "@types/handlebars": "^4.0.36", "@types/mkdirp": "^0.5.1", diff --git a/packages/assert/package.json b/packages/assert/package.json index 43e9380ec..c67a19013 100644 --- a/packages/assert/package.json +++ b/packages/assert/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/assert", - "version": "1.0.5", + "version": "1.0.6", "engines": { "node": ">=6.12" }, @@ -29,7 +29,7 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/assert/README.md", "devDependencies": { - "@0xproject/tslint-config": "^1.0.5", + "@0xproject/tslint-config": "^1.0.6", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", "@types/valid-url": "^1.0.2", @@ -45,9 +45,9 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/json-schemas": "^1.0.1-rc.4", - "@0xproject/typescript-typings": "^1.0.4", - "@0xproject/utils": "^1.0.5", + "@0xproject/json-schemas": "^1.0.1-rc.5", + "@0xproject/typescript-typings": "^1.0.5", + "@0xproject/utils": "^1.0.6", "lodash": "^4.17.5", "valid-url": "^1.0.9" }, diff --git a/packages/base-contract/package.json b/packages/base-contract/package.json index df4b76e88..221222928 100644 --- a/packages/base-contract/package.json +++ b/packages/base-contract/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/base-contract", - "version": "2.0.0-rc.1", + "version": "2.0.0", "engines": { "node": ">=6.12" }, @@ -29,7 +29,7 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/base-contract/README.md", "devDependencies": { - "@0xproject/tslint-config": "^1.0.5", + "@0xproject/tslint-config": "^1.0.6", "@types/lodash": "4.14.104", "chai": "^4.0.1", "copyfiles": "^2.0.0", @@ -41,10 +41,10 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/typescript-typings": "^1.0.4", - "@0xproject/utils": "^1.0.5", - "@0xproject/web3-wrapper": "^1.2.0", - "ethereum-types": "^1.0.4", + "@0xproject/typescript-typings": "^1.0.5", + "@0xproject/utils": "^1.0.6", + "@0xproject/web3-wrapper": "^2.0.0", + "ethereum-types": "^1.0.5", "ethers": "3.0.22", "lodash": "^4.17.5" }, diff --git a/packages/connect/package.json b/packages/connect/package.json index f5772cf4d..116db0469 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/connect", - "version": "1.0.5", + "version": "2.0.0-rc.1", "engines": { "node": ">=6.12" }, @@ -44,11 +44,11 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/connect/README.md", "dependencies": { - "@0xproject/assert": "^1.0.5", - "@0xproject/json-schemas": "^1.0.1-rc.4", - "@0xproject/types": "^1.0.1-rc.4", - "@0xproject/typescript-typings": "^1.0.4", - "@0xproject/utils": "^1.0.5", + "@0xproject/assert": "^1.0.6", + "@0xproject/json-schemas": "^1.0.1-rc.5", + "@0xproject/types": "^1.0.1-rc.5", + "@0xproject/typescript-typings": "^1.0.5", + "@0xproject/utils": "^1.0.6", "lodash": "^4.17.5", "query-string": "^5.0.1", "sinon": "^4.0.0", @@ -56,7 +56,7 @@ "websocket": "^1.0.25" }, "devDependencies": { - "@0xproject/tslint-config": "^1.0.5", + "@0xproject/tslint-config": "^1.0.6", "@types/fetch-mock": "^6.0.3", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json index 67cca9ec0..63fe6a5e5 100644 --- a/packages/contract-wrappers/package.json +++ b/packages/contract-wrappers/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/contract-wrappers", - "version": "1.0.1-rc.3", + "version": "1.0.1-rc.4", "description": "Smart TS wrappers for 0x smart contracts", "keywords": [ "0xproject", @@ -44,11 +44,11 @@ "node": ">=6.0.0" }, "devDependencies": { - "@0xproject/abi-gen": "^1.0.5", - "@0xproject/dev-utils": "^1.0.4", - "@0xproject/migrations": "^1.0.4", - "@0xproject/subproviders": "^1.0.5", - "@0xproject/tslint-config": "^1.0.5", + "@0xproject/abi-gen": "^1.0.6", + "@0xproject/dev-utils": "^1.0.5", + "@0xproject/migrations": "^1.0.5", + "@0xproject/subproviders": "^2.0.0", + "@0xproject/tslint-config": "^1.0.6", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", "@types/node": "^8.0.53", @@ -74,16 +74,16 @@ "web3-provider-engine": "14.0.6" }, "dependencies": { - "@0xproject/assert": "^1.0.5", - "@0xproject/base-contract": "^2.0.0-rc.1", - "@0xproject/fill-scenarios": "^1.0.1-rc.3", - "@0xproject/json-schemas": "^1.0.1-rc.4", - "@0xproject/order-utils": "^1.0.1-rc.3", - "@0xproject/types": "^1.0.1-rc.4", - "@0xproject/typescript-typings": "^1.0.4", - "@0xproject/utils": "^1.0.5", - "@0xproject/web3-wrapper": "^1.2.0", - "ethereum-types": "^1.0.4", + "@0xproject/assert": "^1.0.6", + "@0xproject/base-contract": "^2.0.0", + "@0xproject/fill-scenarios": "^1.0.1-rc.4", + "@0xproject/json-schemas": "^1.0.1-rc.5", + "@0xproject/order-utils": "^1.0.1-rc.4", + "@0xproject/types": "^1.0.1-rc.5", + "@0xproject/typescript-typings": "^1.0.5", + "@0xproject/utils": "^1.0.6", + "@0xproject/web3-wrapper": "^2.0.0", + "ethereum-types": "^1.0.5", "ethereumjs-blockstream": "5.0.0", "ethereumjs-util": "^5.1.1", "ethers": "3.0.22", diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 8421c3104..10ab09767 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "contracts", - "version": "2.1.40", + "version": "2.1.41", "engines": { "node": ">=6.12" }, @@ -20,14 +20,11 @@ "test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov", "test:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html", "test:trace": "SOLIDITY_REVERT_TRACE=true run-s build run_mocha", - "run_mocha": - "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit", + "run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit", "compile": "sol-compiler --contracts-dir src", "clean": "shx rm -rf lib generated_contract_wrappers", - "generate_contract_wrappers": - "abi-gen --abis ${npm_package_config_abis} --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output generated_contract_wrappers --backend ethers", - "lint": - "tslint --project . --exclude **/src/generated_contract_wrappers/**/* --exclude **/lib/**/* && yarn lint-contracts", + "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output generated_contract_wrappers --backend ethers", + "lint": "tslint --project . --exclude **/src/generated_contract_wrappers/**/* --exclude **/lib/**/* && yarn lint-contracts", "coverage:report:text": "istanbul report text", "coverage:report:html": "istanbul report html && open coverage/index.html", "profiler:report:html": "istanbul report html && open coverage/index.html", @@ -36,8 +33,7 @@ "lint-contracts": "solhint src/2.0.0/**/**/**/**/*.sol" }, "config": { - "abis": - "../migrations/artifacts/2.0.0/@(AssetProxyOwner|DummyERC20Token|DummyERC721Receiver|DummyERC721Token|DummyNoReturnERC20Token|ERC20Proxy|ERC721Proxy|Forwarder|Exchange|ExchangeWrapper|IAssetData|IAssetProxy|InvalidERC721Receiver|MixinAuthorizable|MultiSigWallet|MultiSigWalletWithTimeLock|OrderValidator|TestAssetProxyOwner|TestAssetProxyDispatcher|TestConstants|TestExchangeInternals|TestLibBytes|TestLibs|TestSignatureValidator|Validator|Wallet|TokenRegistry|Whitelist|WETH9|ZRXToken).json" + "abis": "../migrations/artifacts/2.0.0/@(AssetProxyOwner|DummyERC20Token|DummyERC721Receiver|DummyERC721Token|DummyNoReturnERC20Token|ERC20Proxy|ERC721Proxy|Forwarder|Exchange|ExchangeWrapper|IAssetData|IAssetProxy|InvalidERC721Receiver|MixinAuthorizable|MultiSigWallet|MultiSigWalletWithTimeLock|OrderValidator|TestAssetProxyOwner|TestAssetProxyDispatcher|TestConstants|TestExchangeInternals|TestLibBytes|TestLibs|TestSignatureValidator|Validator|Wallet|TokenRegistry|Whitelist|WETH9|ZRXToken).json" }, "repository": { "type": "git", @@ -50,12 +46,12 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/contracts/README.md", "devDependencies": { - "@0xproject/abi-gen": "^1.0.5", - "@0xproject/dev-utils": "^1.0.4", - "@0xproject/sol-cov": "^2.0.0", - "@0xproject/subproviders": "^1.0.5", - "@0xproject/tslint-config": "^1.0.5", - "@0xproject/sol-compiler": "^1.0.5", + "@0xproject/abi-gen": "^1.0.6", + "@0xproject/dev-utils": "^1.0.5", + "@0xproject/sol-compiler": "^1.1.0", + "@0xproject/sol-cov": "^2.1.0", + "@0xproject/subproviders": "^2.0.0", + "@0xproject/tslint-config": "^1.0.6", "@types/bn.js": "^4.11.0", "@types/ethereumjs-abi": "^0.6.0", "@types/lodash": "4.14.104", @@ -77,15 +73,15 @@ "yargs": "^10.0.3" }, "dependencies": { - "@0xproject/base-contract": "^2.0.0-rc.1", - "@0xproject/order-utils": "^1.0.1-rc.3", - "@0xproject/types": "^1.0.1-rc.4", - "@0xproject/typescript-typings": "^1.0.4", - "@0xproject/utils": "^1.0.5", - "@0xproject/web3-wrapper": "^1.2.0", + "@0xproject/base-contract": "^2.0.0", + "@0xproject/order-utils": "^1.0.1-rc.4", + "@0xproject/types": "^1.0.1-rc.5", + "@0xproject/typescript-typings": "^1.0.5", + "@0xproject/utils": "^1.0.6", + "@0xproject/web3-wrapper": "^2.0.0", "@types/js-combinatorics": "^0.5.29", "bn.js": "^4.11.8", - "ethereum-types": "^1.0.4", + "ethereum-types": "^1.0.5", "ethereumjs-abi": "0.6.5", "ethereumjs-util": "^5.1.1", "ethers": "3.0.22", diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index 6bdf3a37d..a13161320 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/dev-utils", - "version": "1.0.4", + "version": "1.0.5", "engines": { "node": ">=6.12" }, @@ -29,7 +29,7 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/dev-utils/README.md", "devDependencies": { - "@0xproject/tslint-config": "^1.0.5", + "@0xproject/tslint-config": "^1.0.6", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", "chai": "^4.0.1", @@ -43,12 +43,12 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/subproviders": "^1.0.5", - "@0xproject/types": "^1.0.1-rc.4", - "@0xproject/typescript-typings": "^1.0.4", - "@0xproject/utils": "^1.0.5", - "@0xproject/web3-wrapper": "^1.2.0", - "ethereum-types": "^1.0.4", + "@0xproject/subproviders": "^2.0.0", + "@0xproject/types": "^1.0.1-rc.5", + "@0xproject/typescript-typings": "^1.0.5", + "@0xproject/utils": "^1.0.6", + "@0xproject/web3-wrapper": "^2.0.0", + "ethereum-types": "^1.0.5", "lodash": "^4.17.5" }, "publishConfig": { diff --git a/packages/ethereum-types/package.json b/packages/ethereum-types/package.json index 73325da4b..9e4d287a4 100644 --- a/packages/ethereum-types/package.json +++ b/packages/ethereum-types/package.json @@ -1,6 +1,6 @@ { "name": "ethereum-types", - "version": "1.0.4", + "version": "1.0.5", "engines": { "node": ">=6.12" }, @@ -29,7 +29,7 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/ethereum-types/README.md", "devDependencies": { - "@0xproject/tslint-config": "^1.0.5", + "@0xproject/tslint-config": "^1.0.6", "copyfiles": "^2.0.0", "make-promises-safe": "^1.1.0", "shx": "^0.2.2", diff --git a/packages/fill-scenarios/package.json b/packages/fill-scenarios/package.json index d15682911..74a95fa43 100644 --- a/packages/fill-scenarios/package.json +++ b/packages/fill-scenarios/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/fill-scenarios", - "version": "1.0.1-rc.3", + "version": "1.0.1-rc.4", "description": "0x order fill scenario generator", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -27,8 +27,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/fill-scenarios/README.md", "devDependencies": { - "@0xproject/abi-gen": "^1.0.5", - "@0xproject/tslint-config": "^1.0.5", + "@0xproject/abi-gen": "^1.0.6", + "@0xproject/tslint-config": "^1.0.6", "@types/lodash": "4.14.104", "copyfiles": "^2.0.0", "make-promises-safe": "^1.1.0", @@ -38,13 +38,13 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/base-contract": "^2.0.0-rc.1", - "@0xproject/order-utils": "^1.0.1-rc.3", - "@0xproject/types": "^1.0.1-rc.4", - "@0xproject/typescript-typings": "^1.0.4", - "@0xproject/utils": "^1.0.5", - "@0xproject/web3-wrapper": "^1.2.0", - "ethereum-types": "^1.0.4", + "@0xproject/base-contract": "^2.0.0", + "@0xproject/order-utils": "^1.0.1-rc.4", + "@0xproject/types": "^1.0.1-rc.5", + "@0xproject/typescript-typings": "^1.0.5", + "@0xproject/utils": "^1.0.6", + "@0xproject/web3-wrapper": "^2.0.0", + "ethereum-types": "^1.0.5", "ethers": "3.0.22", "lodash": "^4.17.5" }, diff --git a/packages/forwarder-helper/package.json b/packages/forwarder-helper/package.json index fcb483885..b03041304 100644 --- a/packages/forwarder-helper/package.json +++ b/packages/forwarder-helper/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/forwarder-helper", - "version": "1.0.0-rc.1", + "version": "1.0.1-rc.1", "engines": { "node": ">=6.12" }, @@ -15,15 +15,13 @@ "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", "test:circleci": "yarn test:coverage", - "run_mocha": - "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --exit", + "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --exit", "clean": "shx rm -rf lib test_temp scripts", "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", "manual:postpublish": "yarn build; node ./scripts/postpublish.js", "docs:stage": "node scripts/stage_docs.js", "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES", - "upload_docs_json": - "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json" + "upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json" }, "config": { "postpublish": { @@ -41,17 +39,17 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/forwarder-helper/README.md", "dependencies": { - "@0xproject/assert": "^1.0.5", - "@0xproject/json-schemas": "^1.0.1-rc.4", - "@0xproject/order-utils": "^1.0.1-rc.3", - "@0xproject/types": "^1.0.1-rc.4", - "@0xproject/typescript-typings": "^1.0.4", - "@0xproject/utils": "^1.0.5", + "@0xproject/assert": "^1.0.6", + "@0xproject/json-schemas": "^1.0.1-rc.5", + "@0xproject/order-utils": "^1.0.1-rc.4", + "@0xproject/types": "^1.0.1-rc.5", + "@0xproject/typescript-typings": "^1.0.5", + "@0xproject/utils": "^1.0.6", "@types/node": "^8.0.53", "lodash": "^4.17.10" }, "devDependencies": { - "@0xproject/tslint-config": "^1.0.5", + "@0xproject/tslint-config": "^1.0.6", "@types/lodash": "^4.14.116", "@types/mocha": "^2.2.42", "chai": "^4.0.1", diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json index c67d15d6c..af4c08672 100644 --- a/packages/json-schemas/package.json +++ b/packages/json-schemas/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/json-schemas", - "version": "1.0.1-rc.4", + "version": "1.0.1-rc.5", "engines": { "node": ">=6.12" }, @@ -23,7 +23,9 @@ "config": { "postpublish": { "assets": [], - "docOmitExports": ["schemas"] + "docOmitExports": [ + "schemas" + ] } }, "repository": { @@ -37,14 +39,14 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/json-schemas/README.md", "dependencies": { - "@0xproject/typescript-typings": "^1.0.4", + "@0xproject/typescript-typings": "^1.0.5", "@types/node": "^8.0.53", "jsonschema": "^1.2.0", "lodash.values": "^4.3.0" }, "devDependencies": { - "@0xproject/tslint-config": "^1.0.5", - "@0xproject/utils": "^1.0.5", + "@0xproject/tslint-config": "^1.0.6", + "@0xproject/utils": "^1.0.6", "@types/lodash.foreach": "^4.5.3", "@types/lodash.values": "^4.3.3", "@types/mocha": "^2.2.42", diff --git a/packages/metacoin/package.json b/packages/metacoin/package.json index 3337570b6..7731c1ca3 100644 --- a/packages/metacoin/package.json +++ b/packages/metacoin/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/metacoin", - "version": "0.0.15", + "version": "0.0.16", "engines": { "node": ">=6.12" }, @@ -29,25 +29,25 @@ "author": "", "license": "Apache-2.0", "dependencies": { - "@0xproject/abi-gen": "^1.0.5", - "@0xproject/base-contract": "^2.0.0-rc.1", - "@0xproject/sol-cov": "^2.0.0", - "@0xproject/subproviders": "^1.0.5", - "@0xproject/tslint-config": "^1.0.5", - "@0xproject/types": "^1.0.1-rc.4", - "@0xproject/typescript-typings": "^1.0.4", - "@0xproject/utils": "^1.0.5", - "@0xproject/web3-wrapper": "^1.2.0", + "@0xproject/abi-gen": "^1.0.6", + "@0xproject/base-contract": "^2.0.0", + "@0xproject/sol-cov": "^2.1.0", + "@0xproject/subproviders": "^2.0.0", + "@0xproject/tslint-config": "^1.0.6", + "@0xproject/types": "^1.0.1-rc.5", + "@0xproject/typescript-typings": "^1.0.5", + "@0xproject/utils": "^1.0.6", + "@0xproject/web3-wrapper": "^2.0.0", "@types/mocha": "^5.2.2", "copyfiles": "^2.0.0", - "ethereum-types": "^1.0.4", + "ethereum-types": "^1.0.5", "ethers": "3.0.22", "lodash": "^4.17.5", "run-s": "^0.0.0" }, "devDependencies": { - "@0xproject/dev-utils": "^1.0.4", - "@0xproject/sol-compiler": "^1.0.5", + "@0xproject/dev-utils": "^1.0.5", + "@0xproject/sol-compiler": "^1.1.0", "chai": "^4.0.1", "chai-as-promised": "^7.1.0", "chai-bignumber": "^2.0.1", diff --git a/packages/migrations/package.json b/packages/migrations/package.json index f48b13adb..57f856ce5 100644 --- a/packages/migrations/package.json +++ b/packages/migrations/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/migrations", - "version": "1.0.4", + "version": "1.0.5", "engines": { "node": ">=6.12" }, @@ -35,10 +35,10 @@ }, "license": "Apache-2.0", "devDependencies": { - "@0xproject/abi-gen": "^1.0.5", - "@0xproject/dev-utils": "^1.0.4", - "@0xproject/tslint-config": "^1.0.5", - "@0xproject/types": "^1.0.1-rc.4", + "@0xproject/abi-gen": "^1.0.6", + "@0xproject/dev-utils": "^1.0.5", + "@0xproject/tslint-config": "^1.0.6", + "@0xproject/types": "^1.0.1-rc.5", "@types/yargs": "^10.0.0", "copyfiles": "^2.0.0", "make-promises-safe": "^1.1.0", @@ -49,15 +49,15 @@ "yargs": "^10.0.3" }, "dependencies": { - "@0xproject/base-contract": "^2.0.0-rc.1", - "@0xproject/order-utils": "^1.0.1-rc.3", - "@0xproject/sol-compiler": "^1.0.5", - "@0xproject/subproviders": "^1.0.5", - "@0xproject/typescript-typings": "^1.0.4", - "@0xproject/utils": "^1.0.5", - "@0xproject/web3-wrapper": "^1.2.0", + "@0xproject/base-contract": "^2.0.0", + "@0xproject/order-utils": "^1.0.1-rc.4", + "@0xproject/sol-compiler": "^1.1.0", + "@0xproject/subproviders": "^2.0.0", + "@0xproject/typescript-typings": "^1.0.5", + "@0xproject/utils": "^1.0.6", + "@0xproject/web3-wrapper": "^2.0.0", "@ledgerhq/hw-app-eth": "^4.3.0", - "ethereum-types": "^1.0.4", + "ethereum-types": "^1.0.5", "ethers": "3.0.22", "lodash": "^4.17.5" }, diff --git a/packages/monorepo-scripts/package.json b/packages/monorepo-scripts/package.json index 551695129..6a4d0bb45 100644 --- a/packages/monorepo-scripts/package.json +++ b/packages/monorepo-scripts/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@0xproject/monorepo-scripts", - "version": "1.0.5", + "version": "1.0.6", "engines": { "node": ">=6.12" }, diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json index 0d82affef..0a35251d7 100644 --- a/packages/order-utils/package.json +++ b/packages/order-utils/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/order-utils", - "version": "1.0.1-rc.3", + "version": "1.0.1-rc.4", "engines": { "node": ">=6.12" }, @@ -40,8 +40,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/order-utils/README.md", "devDependencies": { - "@0xproject/dev-utils": "^1.0.4", - "@0xproject/tslint-config": "^1.0.5", + "@0xproject/dev-utils": "^1.0.5", + "@0xproject/tslint-config": "^1.0.6", "@types/bn.js": "^4.11.0", "@types/lodash": "4.14.104", "chai": "^4.0.1", @@ -59,16 +59,16 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/assert": "^1.0.5", - "@0xproject/base-contract": "^2.0.0-rc.1", - "@0xproject/json-schemas": "^1.0.1-rc.4", - "@0xproject/types": "^1.0.1-rc.4", - "@0xproject/typescript-typings": "^1.0.4", - "@0xproject/utils": "^1.0.5", - "@0xproject/web3-wrapper": "^1.2.0", + "@0xproject/assert": "^1.0.6", + "@0xproject/base-contract": "^2.0.0", + "@0xproject/json-schemas": "^1.0.1-rc.5", + "@0xproject/types": "^1.0.1-rc.5", + "@0xproject/typescript-typings": "^1.0.5", + "@0xproject/utils": "^1.0.6", + "@0xproject/web3-wrapper": "^2.0.0", "@types/node": "^8.0.53", "bn.js": "^4.11.8", - "ethereum-types": "^1.0.4", + "ethereum-types": "^1.0.5", "ethereumjs-abi": "0.6.5", "ethereumjs-util": "^5.1.1", "ethers": "3.0.22", diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json index 121f3f3f4..70db15783 100644 --- a/packages/order-watcher/package.json +++ b/packages/order-watcher/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/order-watcher", - "version": "1.0.1-rc.3", + "version": "1.0.1-rc.4", "description": "An order watcher daemon that watches for order validity", "keywords": [ "0x", @@ -43,10 +43,10 @@ "node": ">=6.0.0" }, "devDependencies": { - "@0xproject/abi-gen": "^1.0.5", - "@0xproject/dev-utils": "^1.0.4", - "@0xproject/migrations": "^1.0.4", - "@0xproject/tslint-config": "^1.0.5", + "@0xproject/abi-gen": "^1.0.6", + "@0xproject/dev-utils": "^1.0.5", + "@0xproject/migrations": "^1.0.5", + "@0xproject/tslint-config": "^1.0.6", "@types/bintrees": "^1.0.2", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", @@ -71,18 +71,18 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/assert": "^1.0.5", - "@0xproject/base-contract": "^2.0.0-rc.1", - "@0xproject/contract-wrappers": "^1.0.1-rc.3", - "@0xproject/fill-scenarios": "^1.0.1-rc.3", - "@0xproject/json-schemas": "^1.0.1-rc.4", - "@0xproject/order-utils": "^1.0.1-rc.3", - "@0xproject/types": "^1.0.1-rc.4", - "@0xproject/typescript-typings": "^1.0.4", - "@0xproject/utils": "^1.0.5", - "@0xproject/web3-wrapper": "^1.2.0", + "@0xproject/assert": "^1.0.6", + "@0xproject/base-contract": "^2.0.0", + "@0xproject/contract-wrappers": "^1.0.1-rc.4", + "@0xproject/fill-scenarios": "^1.0.1-rc.4", + "@0xproject/json-schemas": "^1.0.1-rc.5", + "@0xproject/order-utils": "^1.0.1-rc.4", + "@0xproject/types": "^1.0.1-rc.5", + "@0xproject/typescript-typings": "^1.0.5", + "@0xproject/utils": "^1.0.6", + "@0xproject/web3-wrapper": "^2.0.0", "bintrees": "^1.0.2", - "ethereum-types": "^1.0.4", + "ethereum-types": "^1.0.5", "ethereumjs-blockstream": "5.0.0", "ethers": "3.0.22", "lodash": "^4.17.5" diff --git a/packages/react-docs/package.json b/packages/react-docs/package.json index aeface8d7..47b266e8e 100644 --- a/packages/react-docs/package.json +++ b/packages/react-docs/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/react-docs", - "version": "1.0.5", + "version": "1.0.6", "engines": { "node": ">=6.12" }, @@ -24,8 +24,8 @@ "url": "https://github.com/0xProject/0x-monorepo.git" }, "devDependencies": { - "@0xproject/dev-utils": "^1.0.4", - "@0xproject/tslint-config": "^1.0.5", + "@0xproject/dev-utils": "^1.0.5", + "@0xproject/tslint-config": "^1.0.6", "@types/compare-versions": "^3.0.0", "copyfiles": "^2.0.0", "make-promises-safe": "^1.1.0", @@ -34,8 +34,8 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/react-shared": "^1.0.6", - "@0xproject/utils": "^1.0.5", + "@0xproject/react-shared": "^1.0.7", + "@0xproject/utils": "^1.0.6", "@types/lodash": "4.14.104", "@types/material-ui": "0.18.0", "@types/node": "^8.0.53", diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index d73d6c162..27927bbc8 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/react-shared", - "version": "1.0.6", + "version": "1.0.7", "engines": { "node": ">=6.12" }, @@ -24,8 +24,8 @@ "url": "https://github.com/0xProject/0x-monorepo.git" }, "devDependencies": { - "@0xproject/dev-utils": "^1.0.4", - "@0xproject/tslint-config": "^1.0.5", + "@0xproject/dev-utils": "^1.0.5", + "@0xproject/tslint-config": "^1.0.6", "copyfiles": "^2.0.0", "make-promises-safe": "^1.1.0", "shx": "^0.2.2", diff --git a/packages/sol-compiler/package.json b/packages/sol-compiler/package.json index ee7dffe30..f7e901819 100644 --- a/packages/sol-compiler/package.json +++ b/packages/sol-compiler/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sol-compiler", - "version": "1.0.5", + "version": "1.1.0", "engines": { "node": ">=6.12" }, @@ -42,8 +42,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/sol-compiler/README.md", "devDependencies": { - "@0xproject/dev-utils": "^1.0.4", - "@0xproject/tslint-config": "^1.0.5", + "@0xproject/dev-utils": "^1.0.5", + "@0xproject/tslint-config": "^1.0.6", "@types/mkdirp": "^0.5.2", "@types/require-from-string": "^1.2.0", "@types/semver": "^5.5.0", @@ -65,16 +65,16 @@ "zeppelin-solidity": "1.8.0" }, "dependencies": { - "@0xproject/assert": "^1.0.5", - "@0xproject/json-schemas": "^1.0.1-rc.4", - "@0xproject/sol-resolver": "^1.0.5", - "@0xproject/types": "^1.0.1-rc.4", - "@0xproject/typescript-typings": "^1.0.4", - "@0xproject/utils": "^1.0.5", - "@0xproject/web3-wrapper": "^1.2.0", + "@0xproject/assert": "^1.0.6", + "@0xproject/json-schemas": "^1.0.1-rc.5", + "@0xproject/sol-resolver": "^1.0.6", + "@0xproject/types": "^1.0.1-rc.5", + "@0xproject/typescript-typings": "^1.0.5", + "@0xproject/utils": "^1.0.6", + "@0xproject/web3-wrapper": "^2.0.0", "@types/yargs": "^11.0.0", "chalk": "^2.3.0", - "ethereum-types": "^1.0.4", + "ethereum-types": "^1.0.5", "ethereumjs-util": "^5.1.1", "lodash": "^4.17.5", "mkdirp": "^0.5.1", diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json index 2bf09e63a..00bb300ad 100644 --- a/packages/sol-cov/package.json +++ b/packages/sol-cov/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sol-cov", - "version": "2.0.0", + "version": "2.1.0", "engines": { "node": ">=6.12" }, @@ -26,7 +26,10 @@ "config": { "postpublish": { "assets": [], - "docOmitExports": ["ProfilerSubprovider", "RevertTraceSubprovider"] + "docOmitExports": [ + "ProfilerSubprovider", + "RevertTraceSubprovider" + ] } }, "repository": { @@ -39,14 +42,14 @@ }, "homepage": "https://github.com/0xProject/0x.js/packages/sol-cov/README.md", "dependencies": { - "@0xproject/dev-utils": "^1.0.4", - "@0xproject/sol-compiler": "^1.0.5", - "@0xproject/subproviders": "^1.0.5", - "@0xproject/typescript-typings": "^1.0.4", - "@0xproject/utils": "^1.0.5", - "@0xproject/web3-wrapper": "^1.2.0", + "@0xproject/dev-utils": "^1.0.5", + "@0xproject/sol-compiler": "^1.1.0", + "@0xproject/subproviders": "^2.0.0", + "@0xproject/typescript-typings": "^1.0.5", + "@0xproject/utils": "^1.0.6", + "@0xproject/web3-wrapper": "^2.0.0", "@types/solidity-parser-antlr": "^0.2.1", - "ethereum-types": "^1.0.4", + "ethereum-types": "^1.0.5", "ethereumjs-util": "^5.1.1", "glob": "^7.1.2", "istanbul": "^0.4.5", @@ -58,7 +61,7 @@ "solidity-parser-antlr": "^0.2.12" }, "devDependencies": { - "@0xproject/tslint-config": "^1.0.5", + "@0xproject/tslint-config": "^1.0.6", "@types/istanbul": "^0.4.30", "@types/loglevel": "^1.5.3", "@types/mkdirp": "^0.5.1", diff --git a/packages/sol-resolver/package.json b/packages/sol-resolver/package.json index c1b037942..031e9dbdd 100644 --- a/packages/sol-resolver/package.json +++ b/packages/sol-resolver/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sol-resolver", - "version": "1.0.5", + "version": "1.0.6", "engines": { "node": ">=6.12" }, @@ -23,7 +23,7 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/resolver/README.md", "devDependencies": { - "@0xproject/tslint-config": "^1.0.5", + "@0xproject/tslint-config": "^1.0.6", "copyfiles": "^2.0.0", "make-promises-safe": "^1.1.0", "shx": "^0.2.2", @@ -31,8 +31,8 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/types": "^1.0.1-rc.4", - "@0xproject/typescript-typings": "^1.0.4", + "@0xproject/types": "^1.0.1-rc.5", + "@0xproject/typescript-typings": "^1.0.5", "lodash": "^4.17.5" }, "publishConfig": { diff --git a/packages/sra-api/package.json b/packages/sra-api/package.json index a4a0a7b0b..1f06f8219 100644 --- a/packages/sra-api/package.json +++ b/packages/sra-api/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sra-api", - "version": "1.0.1-rc.4", + "version": "1.0.1-rc.5", "engines": { "node": ">=6.12" }, @@ -33,10 +33,10 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/sra-api/README.md", "dependencies": { - "@0xproject/json-schemas": "^1.0.1-rc.4" + "@0xproject/json-schemas": "^1.0.1-rc.5" }, "devDependencies": { - "@0xproject/tslint-config": "^1.0.5", + "@0xproject/tslint-config": "^1.0.6", "@loopback/openapi-v3-types": "^0.8.2", "@types/mocha": "^2.2.42", "@types/node": "^10.5.3", diff --git a/packages/sra-report/package.json b/packages/sra-report/package.json index 682508a6f..4311d77fe 100644 --- a/packages/sra-report/package.json +++ b/packages/sra-report/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/sra-report", - "version": "1.0.5", + "version": "1.0.6", "engines": { "node": ">=6.12" }, @@ -34,20 +34,20 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/sra-report/README.md", "dependencies": { - "@0xproject/assert": "^1.0.5", + "@0xproject/assert": "^1.0.6", "@0xproject/connect": "1.0.4", "@0xproject/json-schemas": "^0.8.3", "@0xproject/order-utils": "^0.0.9", "@0xproject/types": "^0.8.2", - "@0xproject/typescript-typings": "^1.0.4", - "@0xproject/utils": "^1.0.5", + "@0xproject/typescript-typings": "^1.0.5", + "@0xproject/utils": "^1.0.6", "chalk": "^2.3.0", "lodash": "^4.17.5", "newman": "^3.9.3", "yargs": "^10.0.3" }, "devDependencies": { - "@0xproject/tslint-config": "^1.0.5", + "@0xproject/tslint-config": "^1.0.6", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.48", "@types/nock": "^9.1.2", diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json index 521785998..cf30cc416 100644 --- a/packages/subproviders/package.json +++ b/packages/subproviders/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/subproviders", - "version": "1.0.5", + "version": "2.0.0", "engines": { "node": ">=6.12" }, @@ -29,18 +29,18 @@ } }, "dependencies": { - "@0xproject/assert": "^1.0.5", - "@0xproject/types": "^1.0.1-rc.4", - "@0xproject/typescript-typings": "^1.0.4", - "@0xproject/utils": "^1.0.5", - "@0xproject/web3-wrapper": "^1.2.0", + "@0xproject/assert": "^1.0.6", + "@0xproject/types": "^1.0.1-rc.5", + "@0xproject/typescript-typings": "^1.0.5", + "@0xproject/utils": "^1.0.6", + "@0xproject/web3-wrapper": "^2.0.0", "@ledgerhq/hw-app-eth": "^4.3.0", "@ledgerhq/hw-transport-u2f": "^4.3.0", "@types/hdkey": "^0.7.0", "bip39": "^2.5.0", "bn.js": "^4.11.8", "eth-lightwallet": "^3.0.1", - "ethereum-types": "^1.0.4", + "ethereum-types": "^1.0.5", "ethereumjs-tx": "^1.3.5", "ethereumjs-util": "^5.1.1", "ganache-core": "0xProject/ganache-core#monorepo-dep", @@ -51,7 +51,7 @@ "web3-provider-engine": "14.0.6" }, "devDependencies": { - "@0xproject/tslint-config": "^1.0.5", + "@0xproject/tslint-config": "^1.0.6", "@types/bip39": "^2.4.0", "@types/bn.js": "^4.11.0", "@types/ethereumjs-tx": "^1.0.0", diff --git a/packages/testnet-faucets/package.json b/packages/testnet-faucets/package.json index 769fdf371..6dc351c29 100644 --- a/packages/testnet-faucets/package.json +++ b/packages/testnet-faucets/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@0xproject/testnet-faucets", - "version": "1.0.41", + "version": "1.0.42", "engines": { "node": ">=6.12" }, @@ -19,12 +19,12 @@ "license": "Apache-2.0", "dependencies": { "0x.js": "0.38.5", - "@0xproject/subproviders": "^1.0.5", - "@0xproject/typescript-typings": "^1.0.4", - "@0xproject/utils": "^1.0.5", - "@0xproject/web3-wrapper": "^1.2.0", + "@0xproject/subproviders": "^2.0.0", + "@0xproject/typescript-typings": "^1.0.5", + "@0xproject/utils": "^1.0.6", + "@0xproject/web3-wrapper": "^2.0.0", "body-parser": "^1.17.1", - "ethereum-types": "^1.0.4", + "ethereum-types": "^1.0.5", "ethereumjs-tx": "^1.3.5", "ethereumjs-util": "^5.1.1", "express": "^4.15.2", @@ -32,7 +32,7 @@ "rollbar": "^0.6.5" }, "devDependencies": { - "@0xproject/tslint-config": "^1.0.5", + "@0xproject/tslint-config": "^1.0.6", "@types/body-parser": "^1.16.1", "@types/express": "^4.0.35", "@types/lodash": "4.14.104", diff --git a/packages/tslint-config/package.json b/packages/tslint-config/package.json index f6b18cde3..330314974 100644 --- a/packages/tslint-config/package.json +++ b/packages/tslint-config/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/tslint-config", - "version": "1.0.5", + "version": "1.0.6", "engines": { "node": ">=6.12" }, diff --git a/packages/types/package.json b/packages/types/package.json index 8d5eb1123..6078f422a 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/types", - "version": "1.0.1-rc.4", + "version": "1.0.1-rc.5", "engines": { "node": ">=6.12" }, @@ -23,7 +23,7 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/types/README.md", "devDependencies": { - "@0xproject/tslint-config": "^1.0.5", + "@0xproject/tslint-config": "^1.0.6", "copyfiles": "^2.0.0", "make-promises-safe": "^1.1.0", "shx": "^0.2.2", @@ -33,7 +33,7 @@ "dependencies": { "@types/node": "^8.0.53", "bignumber.js": "~4.1.0", - "ethereum-types": "^1.0.4" + "ethereum-types": "^1.0.5" }, "publishConfig": { "access": "public" diff --git a/packages/typescript-typings/package.json b/packages/typescript-typings/package.json index 0070df4fb..c047a5328 100644 --- a/packages/typescript-typings/package.json +++ b/packages/typescript-typings/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/typescript-typings", - "version": "1.0.4", + "version": "1.0.5", "engines": { "node": ">=6.12" }, @@ -27,7 +27,7 @@ "@types/bn.js": "^4.11.0", "@types/react": "*", "bignumber.js": "~4.1.0", - "ethereum-types": "^1.0.4", + "ethereum-types": "^1.0.5", "popper.js": "1.14.3" }, "devDependencies": { diff --git a/packages/utils/package.json b/packages/utils/package.json index 4568352e1..b4795cefd 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/utils", - "version": "1.0.5", + "version": "1.0.6", "engines": { "node": ">=6.12" }, @@ -28,7 +28,7 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/utils/README.md", "devDependencies": { - "@0xproject/tslint-config": "^1.0.5", + "@0xproject/tslint-config": "^1.0.6", "@types/lodash": "4.14.104", "@types/mocha": "^2.2.42", "chai": "^4.0.1", @@ -41,13 +41,13 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/types": "^1.0.1-rc.4", - "@0xproject/typescript-typings": "^1.0.4", + "@0xproject/types": "^1.0.1-rc.5", + "@0xproject/typescript-typings": "^1.0.5", "@types/node": "^8.0.53", "abortcontroller-polyfill": "^1.1.9", "bignumber.js": "~4.1.0", "detect-node": "2.0.3", - "ethereum-types": "^1.0.4", + "ethereum-types": "^1.0.5", "ethereumjs-util": "^5.1.1", "ethers": "3.0.22", "isomorphic-fetch": "^2.2.1", diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json index 3b347ac6f..fe8e82d15 100644 --- a/packages/web3-wrapper/package.json +++ b/packages/web3-wrapper/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/web3-wrapper", - "version": "1.2.0", + "version": "2.0.0", "engines": { "node": ">=6.12" }, @@ -35,7 +35,7 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/web3-wrapper/README.md", "devDependencies": { - "@0xproject/tslint-config": "^1.0.5", + "@0xproject/tslint-config": "^1.0.6", "@types/lodash": "4.14.104", "chai": "^4.0.1", "chai-as-promised": "^7.1.0", @@ -53,11 +53,11 @@ "typescript": "3.0.1" }, "dependencies": { - "@0xproject/assert": "^1.0.5", - "@0xproject/json-schemas": "^1.0.1-rc.4", - "@0xproject/typescript-typings": "^1.0.4", - "@0xproject/utils": "^1.0.5", - "ethereum-types": "^1.0.4", + "@0xproject/assert": "^1.0.6", + "@0xproject/json-schemas": "^1.0.1-rc.5", + "@0xproject/typescript-typings": "^1.0.5", + "@0xproject/utils": "^1.0.6", + "ethereum-types": "^1.0.5", "ethereumjs-util": "^5.1.1", "ethers": "3.0.22", "lodash": "^4.17.5" diff --git a/packages/website/package.json b/packages/website/package.json index 57cc4ce4b..bd6b18866 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/website", - "version": "0.0.44", + "version": "0.0.45", "engines": { "node": ">=6.12" }, @@ -20,13 +20,13 @@ "dependencies": { "@0xproject/contract-wrappers": "^0.0.5", "@0xproject/order-utils": "^0.0.9", - "@0xproject/react-docs": "^1.0.5", + "@0xproject/react-docs": "^1.0.6", "@0xproject/react-shared": "^0.2.3", - "@0xproject/subproviders": "^1.0.5", + "@0xproject/subproviders": "^2.0.0", "@0xproject/types": "^0.8.1", "@0xproject/typescript-typings": "^0.4.3", - "@0xproject/utils": "^1.0.5", - "@0xproject/web3-wrapper": "^1.2.0", + "@0xproject/utils": "^1.0.6", + "@0xproject/web3-wrapper": "^2.0.0", "accounting": "^0.4.1", "basscss": "^8.0.3", "blockies": "^0.0.2", -- cgit From 7bcaac4e1080ae6c5d1b482992c7878b4be3174f Mon Sep 17 00:00:00 2001 From: fragosti Date: Fri, 24 Aug 2018 11:11:56 -0700 Subject: Ignore api.json in public --- packages/sra-spec/.gitignore | 1 + packages/sra-spec/public/api.json | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 packages/sra-spec/.gitignore delete mode 100644 packages/sra-spec/public/api.json (limited to 'packages') diff --git a/packages/sra-spec/.gitignore b/packages/sra-spec/.gitignore new file mode 100644 index 000000000..f029c576c --- /dev/null +++ b/packages/sra-spec/.gitignore @@ -0,0 +1 @@ +public/api.json diff --git a/packages/sra-spec/public/api.json b/packages/sra-spec/public/api.json deleted file mode 100644 index fc2409abb..000000000 --- a/packages/sra-spec/public/api.json +++ /dev/null @@ -1 +0,0 @@ -{"openapi":"3.0.0","info":{"version":"2.0.0","title":"Standard Relayer REST API","description":"# Testing\n\nUse the [sra-report](https://github.com/0xProject/0x-monorepo/tree/development/packages/sra-report) command line tool to test your API for SRA compliance.\n\n# Schemas\n\nThe [JSON schemas](http://json-schema.org/) for the API payloads and responses can be found in [@0xproject/json-schemas](https://github.com/0xProject/0x.js/tree/development/packages/json-schemas). Examples of each payload and response can be found in the library's [test suite](https://github.com/0xProject/0x.js/blob/development/packages/json-schemas/test/schema_test.ts#L1).\n\n```bash\nnpm install @0xproject/json-schemas --save\n```\n\nYou can easily validate your API's payloads and responses using the [@0xproject/json-schemas](https://github.com/0xProject/0x.js/tree/development/packages/json-schemas) package:\n\n```js\nimport {SchemaValidator, ValidatorResult, schemas} from '@0xproject/json-schemas';\n\nconst {relayerApiTokenPairsResponseSchema} = schemas;\nconst validator = new SchemaValidator();\n\nconst tokenPairsResponse = {\n ...\n};\nconst validatorResult: ValidatorResult = validator.validate(tokenPairsResponse, relayerApiTokenPairsResponseSchema);\n```\n\n# Pagination\n\nRequests that return potentially large collections should respond to the **?page** and **?perPage** parameters. For example:\n\n```bash\n$ curl https://api.example-relayer.com/v2/asset_pairs?page=3&perPage=20\n```\n\nPage numbering should be 1-indexed, not 0-indexed. If a query provides an unreasonable (ie. too high) `perPage` value, the response can return a validation error as specified in the [errors section](#section/Errors). If the query specifies a `page` that does not exist (ie. there are not enough `records`), the response should just return an empty `records` array.\n\nAll endpoints that are paginated should return a `total`, `page`, `perPage` and a `records` value in the top level of the collection. The value of `total` should be the total number of records for a given query, whereas `records` should be an array representing the response to the query for that page. `page` and `perPage`, are the same values that were specified in the request. See the note in [miscellaneous](#section/Misc.) about formatting `snake_case` vs. `lowerCamelCase`.\n\nThese requests include the [`/v2/asset_pairs`](#operation/getAssetPairs), [`/v2/orders`](#operation/getOrders), [`/v2/fee_recipients`](#operation/getFeeRecipients) and [`/v2/orderbook`](#operation/getOrderbook) endpoints.\n\n# Network Id\n\nAll requests should be able to specify a **?networkId** query param for all supported networks. For example:\n\n```bash\n$ curl https://api.example-relayer.com/v2/asset_pairs?networkId=1\n```\n\nIf the query param is not provided, it should default to **1** (mainnet).\n\nNetworks and their Ids:\n\n| Network Id | Network Name |\n| ---------- | ------------ |\n| 1 | Mainnet |\n| 42 | Kovan |\n| 3 | Ropsten |\n| 4 | Rinkeby |\n\nIf a certain network is not supported, the response should **400** as specified in the [error response](#section/Errors) section. For example:\n\n```json\n{\n \"code\": 100,\n \"reason\": \"Validation failed\",\n \"validationErrors\": [\n {\n \"field\": \"networkId\",\n \"code\": 1006,\n \"reason\": \"Network id 42 is not supported\"\n }\n ]\n}\n```\n\n# Link Header\n\nA [Link Header](https://tools.ietf.org/html/rfc5988) can be included in a response to provide clients with more context about paging\nFor example:\n\n```bash\nLink: ; rel=\"next\",\n; rel=\"last\"\n```\n\nThis `Link` response header contains one or more Hypermedia link relations.\n\nThe possible `rel` values are:\n\n| Name | Description |\n| ----- | ------------------------------------------------------------- |\n| next | The link relation for the immediate next page of results. |\n| last | The link relation for the last page of results. |\n| first | The link relation for the first page of results. |\n| prev | The link relation for the immediate previous page of results. |\n\n# Rate Limits\n\nRate limit guidance for clients can be optionally returned in the response headers:\n\n| Header Name | Description |\n| --------------------- | ---------------------------------------------------------------------------- |\n| X-RateLimit-Limit | The maximum number of requests you're permitted to make per hour. |\n| X-RateLimit-Remaining | The number of requests remaining in the current rate limit window. |\n| X-RateLimit-Reset | The time at which the current rate limit window resets in UTC epoch seconds. |\n\nFor example:\n\n```bash\n$ curl -i https://api.example-relayer.com/v2/asset_pairs\nHTTP/1.1 200 OK\nDate: Mon, 20 Oct 2017 12:30:06 GMT\nStatus: 200 OK\nX-RateLimit-Limit: 60\nX-RateLimit-Remaining: 56\nX-RateLimit-Reset: 1372700873\n```\n\nWhen a rate limit is exceeded, a status of **429 Too Many Requests** should be returned.\n\n# Errors\n\nUnless the spec defines otherwise, errors to bad requests should respond with HTTP 4xx or status codes.\n\n## Common error codes\n\n| Code | Reason |\n| ---- | --------------------------------------- |\n| 400 | Bad Request – Invalid request format |\n| 404 | Not found |\n| 429 | Too many requests - Rate limit exceeded |\n| 500 | Internal Server Error |\n| 501 | Not Implemented |\n\n## Error reporting format\n\nFor all **400** responses, see the [error response schema](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_error_response_schema.ts#L1).\n\n```json\n{\n \"code\": 101,\n \"reason\": \"Validation failed\",\n \"validationErrors\": [\n {\n \"field\": \"maker\",\n \"code\": 1002,\n \"reason\": \"Invalid address\"\n }\n ]\n}\n```\n\nGeneral error codes:\n\n```bash\n100 - Validation Failed\n101 - Malformed JSON\n102 - Order submission disabled\n103 - Throttled\n```\n\nValidation error codes:\n\n```bash\n1000 - Required field\n1001 - Incorrect format\n1002 - Invalid address\n1003 - Address not supported\n1004 - Value out of range\n1005 - Invalid signature or hash\n1006 - Unsupported option\n```\n\n# Asset Data Encoding\n\nAs we now support multiple [token transfer proxies](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#assetproxy), the identifier of which proxy to use for the token transfer must be encoded, along with the token information. Each proxy in 0x v2 has a unique identifier. If you're using 0x.js there will be helper methods for this [encoding](https://0xproject.com/docs/0x.js#zeroEx-encodeERC20AssetData) and [decoding](https://0xproject.com/docs/0x.js#zeroEx-decodeAssetProxyId).\n\nThe identifier for the Proxy uses a similar scheme to [ABI function selectors](https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI#function-selector).\n\n```js\n// ERC20 Proxy ID 0xf47261b0\nbytes4(keccak256('ERC20Token(address)'));\n// ERC721 Proxy ID 0x08e937fa\nbytes4(keccak256('ERC721Token(address,uint256)'));\n```\n\nAsset data is encoded using [ABI encoding](https://solidity.readthedocs.io/en/develop/abi-spec.html).\n\nFor example, encoding the ERC20 token contract (address: 0x1dc4c1cefef38a777b15aa20260a54e584b16c48) using the ERC20 Transfer Proxy (id: 0xf47261b0) would be:\n\n```bash\n0xf47261b00000000000000000000000001dc4c1cefef38a777b15aa20260a54e584b16c48\n```\n\nEncoding the ERC721 token contract (address: `0x371b13d97f4bf77d724e78c16b7dc74099f40e84`), token id (id: `99`, which hex encoded is `0x63`) and the ERC721 Transfer Proxy (id: 0x08e937fa) would be:\n\n```bash\n0x08e937fa000000000000000000000000371b13d97f4bf77d724e78c16b7dc74099f40e840000000000000000000000000000000000000000000000000000000000000063\n```\n\nFor more information see [the Asset Proxy](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#erc20proxy) section of the v2 spec and the [Ethereum ABI Spec](https://solidity.readthedocs.io/en/develop/abi-spec.html).\n\n# Meta Data in Order Responses\n\nIn v2 of the standard relayer API we added the `metaData` field. It is meant to provide a standard place for relayers to put optional, custom or non-standard fields that may of interest to the consumer of the API.\n\nA good example of such a field is `remainingTakerAssetAmount`, which is a convenience field that communicates how much of a 0x order is potentially left to be filled. Unlike the other fields in a 0x order, it is not guaranteed to be correct as it is derived from whatever mechanism the implementer (ie. the relayer) is using. While convenient for prototyping and low stakes situations, we recommend validating the value of the field by checking the state of the blockchain yourself, such as by using [Order Watcher](https://0xproject.com/wiki#0x-OrderWatcher).\n\n# Misc.\n\n* All requests and responses should be of **application/json** content type\n* All token amounts are sent in amounts of the smallest level of precision (base units). (e.g if a token has 18 decimal places, selling 1 token would show up as selling `'1000000000000000000'` units by this API).\n* All addresses are sent as lower-case (non-checksummed) Ethereum addresses with the `0x` prefix.\n* All parameters are to be written in `lowerCamelCase`.\n","license":{"name":"Apache 2.0","url":"https://www.apache.org/licenses/LICENSE-2.0.html"}},"paths":{"/v2/asset_pairs":{"get":{"description":"Retrieves a list of available asset pairs and the information required to trade them (in any order). Setting only `assetDataA` or `assetDataB` returns pairs filtered by that asset only.","operationId":"getAssetPairs","parameters":[{"name":"assetDataA","in":"query","description":"The assetData value for the first asset in the pair.","example":"0xf47261b04c32345ced77393b3530b1eed0f346429d","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"assetDataB","in":"query","description":"The assetData value for the second asset in the pair.","example":"0x0257179264389b814a946f3e92105513705ca6b990","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}},{"name":"page","in":"query","description":"The number of the page to request in the collection.","example":3,"schema":{"type":"number","default":1}},{"name":"perPage","in":"query","description":"The number of records to return per page.","example":10,"schema":{"type":"number","default":100}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"Returns a collection of available asset pairs with some meta info","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiAssetDataPairsResponseSchema"},"example":{"total":43,"page":1,"perPage":100,"records":[{"assetDataA":{"minAmount":"0","maxAmount":"10000000000000000000","precision":5,"assetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d"},"assetDataB":{"minAmount":"0","maxAmount":"50000000000000000000","precision":5,"assetData":"0x0257179264389b814a946f3e92105513705ca6b990"}}]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/orders":{"get":{"description":"Retrieves a list of orders given query parameters. This endpoint should be [paginated](#section/Pagination). For querying an entire orderbook snapshot, the [orderbook endpoint](#operation/getOrderbook) is recommended. If both makerAssetData and takerAssetData are specified, returned orders will be sorted by price determined by (takerTokenAmount/makerTokenAmount) in ascending order. By default, orders returned by this endpoint are unsorted.","operationId":"getOrders","parameters":[{"name":"makerAssetProxyId","in":"query","description":"The maker [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \"0xf47261b0\" for ERC20, \"0x02571792\" for ERC721).","example":"0xf47261b0","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"takerAssetProxyId","in":"query","description":"The taker asset [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \"0xf47261b0\" for ERC20, \"0x02571792\" for ERC721).","example":"0x02571792","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"makerAssetAddress","in":"query","description":"The contract address for the maker asset.","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"takerAssetAddress","in":"query","description":"The contract address for the taker asset.","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"exchangeAddress","in":"query","description":"Same as exchangeAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"senderAddress","in":"query","description":"Same as senderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"makerAssetData","in":"query","description":"Same as makerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"takerAssetData","in":"query","description":"Same as takerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"traderAssetData","in":"query","description":"Same as traderAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"makerAddress","in":"query","description":"Same as makerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"takerAddress","in":"query","description":"Same as takerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"traderAddress","in":"query","description":"Same as traderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"feeRecipientAddress","in":"query","description":"Same as feeRecipientAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)","example":"0xe41d2489571d322189246dafa5ebde1f4699f498","schema":{"$ref":"#/components/schemas/addressSchema"}},{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}},{"name":"page","in":"query","description":"The number of the page to request in the collection.","example":3,"schema":{"type":"number","default":1}},{"name":"perPage","in":"query","description":"The number of records to return per page.","example":10,"schema":{"type":"number","default":100}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"A collection of 0x orders with meta-data as specified by query params","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrdersResponseSchema"},"example":{"total":984,"page":1,"perPage":100,"records":[{"order":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"},"metaData":{}}]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/order/{orderHash}":{"get":{"description":"Retrieves the 0x order with meta info that is associated with the hash.","operationId":"getOrder","parameters":[{"name":"orderHash","in":"path","description":"The hash of the desired 0x order.","example":"0xd4b103c42d2512eef3fee775e097f044291615d25f5d71e0ac70dbd49d223591","schema":{"$ref":"#/components/schemas/orderHashSchema"}},{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"The order and meta info associated with the orderHash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrderSchema"},"example":{"order":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"},"metaData":{}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/orderbook":{"get":{"description":"Retrieves the orderbook for a given asset pair. This endpoint should be [paginated](#section/Pagination). Bids will be sorted in descending order by price, and asks will be sorted in ascending order by price. Within the price sorted orders, the orders are further sorted by _taker fee price_ which is defined as the **takerFee** divided by **takerTokenAmount**. After _taker fee price_, orders are to be sorted by expiration in ascending order. The way pagination works for this endpoint is that the **page** and **perPage** query params apply to both `bids` and `asks` collections, and if `page` * `perPage` > `total` for a certain collection, the `records` for that collection should just be empty. ","operationId":"getOrderbook","parameters":[{"name":"baseAssetData","in":"query","description":"assetData (makerAssetData or takerAssetData) designated as the base currency in the [currency pair calculation](https://en.wikipedia.org/wiki/Currency_pair) of price.","required":true,"example":"0xf47261b04c32345ced77393b3530b1eed0f346429d","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"quoteAssetData","in":"query","description":"assetData (makerAssetData or takerAssetData) designated as the quote currency in the currency pair calculation of price (required).","required":true,"example":"0xf47261b04c32345ced77393b3530b1eed0f346429d","schema":{"$ref":"#/components/schemas/hexSchema"}},{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}},{"name":"page","in":"query","description":"The number of the page to request in the collection.","example":3,"schema":{"type":"number","default":1}},{"name":"perPage","in":"query","description":"The number of records to return per page.","example":10,"schema":{"type":"number","default":100}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"The sorted order book for the specified asset pair.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrderbookResponseSchema"},"example":{"bids":{"total":325,"page":2,"perPage":100,"records":[{"order":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"},"metaData":{}}]},"asks":{"total":500,"page":2,"perPage":100,"records":[{"order":{"makerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","takerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"20000000000000000","takerAssetAmount":"10000000000000000","makerFee":"200000000000000","takerFee":"100000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","takerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x013842a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b3518891"},"metaData":{}}]}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/order_config":{"get":{"description":"Relayers have full discretion over the orders that they are willing to host on their orderbooks (e.g what fees they charge, etc...). In order for traders to discover their requirements programmatically, they can send an incomplete order to this endpoint and receive the missing fields, specifc to that order. This gives relayers a large amount of flexibility to tailor fees to unique traders, trading pairs and volume amounts. Submit a partial order and receive information required to complete the order: `senderAddress`, `feeRecipientAddress`, `makerFee`, `takerFee`. ","operationId":"getOrderConfig","parameters":[{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}}],"requestBody":{"description":"The fields of a 0x order the relayer may want to decide what configuration to send back.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrderConfigPayloadSchema"},"example":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","expirationTimeSeconds":"1532560590"}}}},"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"The additional fields necessary in order to submit an order to the relayer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiOrderConfigResponseSchema"},"example":{"senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","makerFee":"100000000000000","takerFee":"200000000000000"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/fee_recipients":{"get":{"description":"Retrieves a collection of all fee recipient addresses for a relayer. This endpoint should be [paginated](#section/Pagination).","operationId":"getFeeRecipients","parameters":[{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}},{"name":"page","in":"query","description":"The number of the page to request in the collection.","example":3,"schema":{"type":"number","default":1}},{"name":"perPage","in":"query","description":"The number of records to return per page.","example":10,"schema":{"type":"number","default":100}}],"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"A collection of all used fee recipient addresses.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiFeeRecipientsResponseSchema"},"example":{"total":3,"page":1,"perPage":10,"records":["0x6eC92694ea172ebC430C30fa31De87620967A082","0x9e56625509c2f60af937f23b7b532600390e8c8b","0xa2b31dacf30a9c50ca473337c01d8a201ae33e32"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}},"/v2/order":{"post":{"description":"Submit a signed order to the relayer.","operationId":"postOrder","parameters":[{"name":"networkId","in":"query","description":"The id of the Ethereum network","example":42,"schema":{"type":"number","default":1}}],"requestBody":{"description":"A valid signed 0x order based on the schema.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/signedOrderSchema"},"example":{"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b04c32345ced77393b3530b1eed0f346429d","takerAssetData":"0x0257179264389b814a946f3e92105513705ca6b990","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"}}}},"responses":{"200":{"headers":{"X-Rate-Limit-Limit":{"description":"The maximum number of requests you're permitted to make per hour.","schema":{"type":"integer"}},"X-Rate-Limit-Remaining":{"description":"The number of requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The time at which the current rate limit window resets in UTC epoch seconds.","schema":{"type":"integer"}}},"description":"OK","content":{}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/relayerApiErrorResponseSchema"},"example":{"code":100,"reason":"Validation failed","validationErrors":[{"field":"networkId","code":1006,"reason":"Network id 42 is not supported"}]}}}},"404":{"description":"Not found"},"429":{"description":"Too many requests - Rate limit exceeded"},"500":{"description":"Internal Server Error"},"501":{"description":"Not implemented."}}}}},"components":{"schemas":{"numberSchema":{"type":"string","pattern":"^\\d+(\\.\\d+)?$"},"addressSchema":{"type":"string","pattern":"^0x[0-9a-f]{40}$"},"hexSchema":{"type":"string","pattern":"^0x(([0-9a-f][0-9a-f])+)?$"},"orderHashSchema":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$"},"orderSchema":{"properties":{"makerAddress":{"$ref":"#/components/schemas/addressSchema"},"takerAddress":{"$ref":"#/components/schemas/addressSchema"},"makerFee":{"$ref":"#/components/schemas/numberSchema"},"takerFee":{"$ref":"#/components/schemas/numberSchema"},"senderAddress":{"$ref":"#/components/schemas/addressSchema"},"makerAssetAmount":{"$ref":"#/components/schemas/numberSchema"},"takerAssetAmount":{"$ref":"#/components/schemas/numberSchema"},"makerAssetData":{"$ref":"#/components/schemas/hexSchema"},"takerAssetData":{"$ref":"#/components/schemas/hexSchema"},"salt":{"$ref":"#/components/schemas/numberSchema"},"exchangeAddress":{"$ref":"#/components/schemas/addressSchema"},"feeRecipientAddress":{"$ref":"#/components/schemas/addressSchema"},"expirationTimeSeconds":{"$ref":"#/components/schemas/numberSchema"}},"required":["makerAddress","takerAddress","makerFee","takerFee","senderAddress","makerAssetAmount","takerAssetAmount","makerAssetData","takerAssetData","salt","exchangeAddress","feeRecipientAddress","expirationTimeSeconds"],"type":"object"},"signedOrderSchema":{"allOf":[{"$ref":"#/components/schemas/orderSchema"},{"properties":{"signature":{"$ref":"#/components/schemas/hexSchema"}},"required":["signature"]}]},"signedOrdersSchema":{"type":"array","items":{"$ref":"#/components/schemas/signedOrderSchema"}},"ordersSchema":{"type":"array","items":{"$ref":"#/components/schemas/orderSchema"}},"paginatedCollectionSchema":{"type":"object","properties":{"total":{"type":"number"},"perPage":{"type":"number"},"page":{"type":"number"}},"required":["total","perPage","page"]},"relayerApiErrorResponseSchema":{"type":"object","properties":{"code":{"type":"integer","minimum":100,"maximum":103},"reason":{"type":"string"},"validationErrors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"integer","minimum":1000,"maximum":1006},"reason":{"type":"string"}},"required":["field","code","reason"]}}},"required":["code","reason"]},"relayerApiFeeRecipientsResponseSchema":{"type":"object","allOf":[{"$ref":"#/components/schemas/paginatedCollectionSchema"},{"properties":{"records":{"id":"#/components/schemas/relayerApiFeeRecipientsSchema","type":"array","items":{"$ref":"#/components/schemas/addressSchema"}}},"required":["records"]}]},"relayerApiOrderSchema":{"type":"object","properties":{"order":{"$ref":"#/components/schemas/orderSchema"},"metaData":{"type":"object"}},"required":["order","metaData"]},"relayerApiOrdersSchema":{"type":"array","items":{"$ref":"#/components/schemas/relayerApiOrderSchema"}},"relayerApiOrderConfigPayloadSchema":{"type":"object","properties":{"makerAddress":{"$ref":"#/components/schemas/addressSchema"},"takerAddress":{"$ref":"#/components/schemas/addressSchema"},"makerAssetAmount":{"$ref":"#/components/schemas/numberSchema"},"takerAssetAmount":{"$ref":"#/components/schemas/numberSchema"},"makerAssetData":{"$ref":"#/components/schemas/hexSchema"},"takerAssetData":{"$ref":"#/components/schemas/hexSchema"},"exchangeAddress":{"$ref":"#/components/schemas/addressSchema"},"expirationTimeSeconds":{"$ref":"#/components/schemas/numberSchema"}},"required":["makerAddress","takerAddress","makerAssetAmount","takerAssetAmount","makerAssetData","takerAssetData","exchangeAddress","expirationTimeSeconds"]},"relayerApiOrderConfigResponseSchema":{"type":"object","properties":{"makerFee":{"$ref":"#/components/schemas/numberSchema"},"takerFee":{"$ref":"#/components/schemas/numberSchema"},"feeRecipientAddress":{"$ref":"#/components/schemas/addressSchema"},"senderAddress":{"$ref":"#/components/schemas/addressSchema"}},"required":["makerFee","takerFee","feeRecipientAddress","senderAddress"]},"relayerApiOrderbookResponseSchema":{"type":"object","properties":{"bids":{"$ref":"#/components/schemas/relayerApiOrdersResponseSchema"},"asks":{"$ref":"#/components/schemas/relayerApiOrdersResponseSchema"}},"required":["bids","asks"]},"relayerApiAssetDataPairsResponseSchema":{"type":"object","allOf":[{"$ref":"#/components/schemas/paginatedCollectionSchema"},{"properties":{"records":{"$ref":"#/components/schemas/relayerApiAssetDataPairsSchema"}},"required":["records"]}]},"relayerApiAssetDataTradeInfoSchema":{"type":"object","properties":{"assetData":{"$ref":"#/components/schemas/hexSchema"},"minAmount":{"$ref":"#/components/schemas/numberSchema"},"maxAmount":{"$ref":"#/components/schemas/numberSchema"},"precision":{"type":"number"}},"required":["assetData"]},"relayerApiOrdersChannelSubscribeSchema":{"type":"object","properties":{"type":{"enum":["subscribe"]},"channel":{"enum":["orders"]},"requestId":{"type":"string"},"payload":{"$ref":"#/components/schemas/relayerApiOrdersChannelSubscribePayload"}},"required":["type","channel","requestId"]},"relayerApiOrdersChannelSubscribePayload":{"type":"object","properties":{"makerAssetProxyId":{"$ref":"#/components/schemas/hexSchema"},"takerAssetProxyId":{"$ref":"#/components/schemas/hexSchema"},"networkId":{"type":"number"},"makerAssetAddress":{"$ref":"#/components/schemas/addressSchema"},"takerAssetAddress":{"$ref":"#/components/schemas/addressSchema"},"makerAssetData":{"$ref":"#/components/schemas/hexSchema"},"takerAssetData":{"$ref":"#/components/schemas/hexSchema"},"traderAssetData":{"$ref":"#/components/schemas/hexSchema"}}},"relayerApiOrdersChannelUpdateSchema":{"type":"object","properties":{"type":{"enum":["update"]},"channel":{"enum":["orders"]},"requestId":{"type":"string"},"payload":{"$ref":"#/components/schemas/relayerApiOrdersSchema"}},"required":["type","channel","requestId"]},"relayerApiOrdersResponseSchema":{"type":"object","allOf":[{"$ref":"#/components/schemas/paginatedCollectionSchema"},{"properties":{"records":{"$ref":"#/components/schemas/relayerApiOrdersSchema"}},"required":["records"]}]},"relayerApiAssetDataPairsSchema":{"type":"array","items":{"properties":{"assetDataA":{"$ref":"#/components/schemas/relayerApiAssetDataTradeInfoSchema"},"assetDataB":{"$ref":"#/components/schemas/relayerApiAssetDataTradeInfoSchema"}},"required":["assetDataA","assetDataB"],"type":"object"}}}}} \ No newline at end of file -- cgit