diff options
author | Fabio Berger <me@fabioberger.com> | 2018-08-03 17:14:01 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-08-03 17:14:01 +0800 |
commit | 6dd656bdfc5e9878a8a6e332b4ea844556f75d56 (patch) | |
tree | c5fb6f39b4e32142047c667006a5beca5c147813 | |
parent | b5d98a280352d8f697876b35741fcf7b60b3b569 (diff) | |
download | dexon-0x-contracts-6dd656bdfc5e9878a8a6e332b4ea844556f75d56.tar.gz dexon-0x-contracts-6dd656bdfc5e9878a8a6e332b4ea844556f75d56.tar.zst dexon-0x-contracts-6dd656bdfc5e9878a8a6e332b4ea844556f75d56.zip |
Add OrderWatcher docs page
-rw-r--r-- | packages/order-watcher/package.json | 9 | ||||
-rw-r--r-- | packages/website/md/docs/order_watcher/installation.md | 17 | ||||
-rw-r--r-- | packages/website/md/docs/order_watcher/introduction.md | 1 | ||||
-rw-r--r-- | packages/website/translations/chinese.json | 1 | ||||
-rw-r--r-- | packages/website/translations/english.json | 1 | ||||
-rw-r--r-- | packages/website/translations/korean.json | 1 | ||||
-rw-r--r-- | packages/website/translations/russian.json | 1 | ||||
-rw-r--r-- | packages/website/translations/spanish.json | 1 | ||||
-rw-r--r-- | packages/website/ts/components/top_bar/top_bar.tsx | 29 | ||||
-rw-r--r-- | packages/website/ts/containers/order_watcher_documentation.ts | 70 | ||||
-rw-r--r-- | packages/website/ts/index.tsx | 12 | ||||
-rw-r--r-- | packages/website/ts/pages/documentation/doc_page.tsx | 1 | ||||
-rw-r--r-- | packages/website/ts/pages/landing/landing.tsx | 2 | ||||
-rw-r--r-- | packages/website/ts/types.ts | 5 |
14 files changed, 139 insertions, 12 deletions
diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json index 2b7507f02..917998739 100644 --- a/packages/order-watcher/package.json +++ b/packages/order-watcher/package.json @@ -25,10 +25,15 @@ "copy_artifacts": "copyfiles -u 2 './src/artifacts/**/*.json' ./lib/src/artifacts", "update_artifacts": "for i in ${npm_package_config_contracts_v2_beta}; do copyfiles -u 4 ../migrations/artifacts/2.0.0-beta-testnet/$i.json src/artifacts; done;", "clean": "shx rm -rf _bundles lib test_temp test/artifacts src/generated_contract_wrappers", - "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit" + "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit", + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" }, "config": { - "contracts_v2_beta": "Exchange WETH9 ERC20Token ERC721Token" + "contracts_v2_beta": "Exchange WETH9 ERC20Token ERC721Token", + "postpublish": { + "assets": [], + "shouldPublishDocs": true + } }, "repository": { "type": "git", diff --git a/packages/website/md/docs/order_watcher/installation.md b/packages/website/md/docs/order_watcher/installation.md new file mode 100644 index 000000000..4b28f583d --- /dev/null +++ b/packages/website/md/docs/order_watcher/installation.md @@ -0,0 +1,17 @@ +**Install** + +```bash +yarn add @0xproject/order-watcher +``` + +**Import** + +```javascript +import { OrderWatcher } from '@0xproject/order-watcher'; +``` + +or + +```javascript +var OrderWatcher = require('@0xproject/order-utils').OrderWatcher; +``` diff --git a/packages/website/md/docs/order_watcher/introduction.md b/packages/website/md/docs/order_watcher/introduction.md new file mode 100644 index 000000000..f922d922f --- /dev/null +++ b/packages/website/md/docs/order_watcher/introduction.md @@ -0,0 +1 @@ +Welcome to the [@0xproject/order-watcher](https://github.com/0xProject/0x-monorepo/tree/development/packages/order-watcher) documentation! OrderWatcher is a daemon that efficiently watches a set of orders, emitting events whenever the validity of an order changes. It can be used by relayers to prune an orderbook, or by traders to keep orders fetched from a Relayer up-to-date. diff --git a/packages/website/translations/chinese.json b/packages/website/translations/chinese.json index 8af9835ab..b590861b7 100644 --- a/packages/website/translations/chinese.json +++ b/packages/website/translations/chinese.json @@ -62,6 +62,7 @@ "ETHEREUM_TYPES": "Ethereum Types", "SUBPROVIDERS": "Subproviders", "CONTRACT_WRAPPERS": "Contract Wrappers", + "ORDER_WATCHER": "OrderWatcher", "0x.js": "0x.js", "BLOG": "博客", "FORUM": "论坛", diff --git a/packages/website/translations/english.json b/packages/website/translations/english.json index b6a8113d3..0ae48d926 100644 --- a/packages/website/translations/english.json +++ b/packages/website/translations/english.json @@ -63,6 +63,7 @@ "ETHEREUM_TYPES": "Ethereum Types", "SUBPROVIDERS": "Subproviders", "CONTRACT_WRAPPERS": "Contract Wrappers", + "ORDER_WATCHER": "OrderWatcher", "0X_JS": "0x.js", "BLOG": "blog", "FORUM": "forum", diff --git a/packages/website/translations/korean.json b/packages/website/translations/korean.json index 1c2b585bf..f61e51e5c 100644 --- a/packages/website/translations/korean.json +++ b/packages/website/translations/korean.json @@ -62,6 +62,7 @@ "ETHEREUM_TYPES": "Ethereum Types", "SUBPROVIDERS": "Subproviders", "CONTRACT_WRAPPERS": "Contract Wrappers", + "ORDER_WATCHER": "OrderWatcher", "0X_JS": "0x.js", "BLOG": "블로그", "FORUM": "포럼", diff --git a/packages/website/translations/russian.json b/packages/website/translations/russian.json index c2df8ee2a..107798a8c 100644 --- a/packages/website/translations/russian.json +++ b/packages/website/translations/russian.json @@ -62,6 +62,7 @@ "ETHEREUM_TYPES": "Ethereum Types", "SUBPROVIDERS": "Subproviders", "CONTRACT_WRAPPERS": "Contract Wrappers", + "ORDER_WATCHER": "OrderWatcher", "0X_JS": "0x.js", "BLOG": "Блог", "FORUM": "Форум", diff --git a/packages/website/translations/spanish.json b/packages/website/translations/spanish.json index a874673cf..3c87b2878 100644 --- a/packages/website/translations/spanish.json +++ b/packages/website/translations/spanish.json @@ -63,6 +63,7 @@ "ETHEREUM_TYPES": "Ethereum Types", "SUBPROVIDERS": "Subproviders", "CONTRACT_WRAPPERS": "Contract Wrappers", + "ORDER_WATCHER": "OrderWatcher", "0X_JS": "0x.js", "BLOG": "blog", "FORUM": "foro", diff --git a/packages/website/ts/components/top_bar/top_bar.tsx b/packages/website/ts/components/top_bar/top_bar.tsx index d2f530fb5..c921867d7 100644 --- a/packages/website/ts/components/top_bar/top_bar.tsx +++ b/packages/website/ts/components/top_bar/top_bar.tsx @@ -84,7 +84,9 @@ const DOC_WEBSITE_PATHS_TO_KEY = { [WebsitePaths.ContractWrappers]: Key.ContractWrappers, [WebsitePaths.Connect]: Key.Connect, [WebsitePaths.ZeroExJs]: Key.ZeroExJs, -} + [WebsitePaths.OrderUtils]: Key.OrderUtils, + [WebsitePaths.OrderWatcher]: Key.OrderWatcher, +}; const DEFAULT_HEIGHT = 68; const EXPANDED_HEIGHT = 75; @@ -166,12 +168,28 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> { primaryText={this.props.translate.get(Key.Web3Wrapper, Deco.CapWords)} /> </Link>, - <Link key="subMenuItem-contractWrappers" to={WebsitePaths.ContractWrappers} className="text-decoration-none"> + <Link + key="subMenuItem-contractWrappers" + to={WebsitePaths.ContractWrappers} + className="text-decoration-none" + > <MenuItem style={{ fontSize: styles.menuItem.fontSize }} primaryText={this.props.translate.get(Key.ContractWrappers, Deco.CapWords)} /> </Link>, + <Link key="subMenuItem-orderUtils" to={WebsitePaths.OrderUtils} className="text-decoration-none"> + <MenuItem + style={{ fontSize: styles.menuItem.fontSize }} + primaryText={this.props.translate.get(Key.OrderUtils, Deco.CapWords)} + /> + </Link>, + <Link key="subMenuItem-orderWatcher" to={WebsitePaths.OrderWatcher} className="text-decoration-none"> + <MenuItem + style={{ fontSize: styles.menuItem.fontSize }} + primaryText={this.props.translate.get(Key.OrderWatcher, Deco.CapWords)} + /> + </Link>, <Link key="subMenuItem-sol-compiler" to={WebsitePaths.SolCompiler} className="text-decoration-none"> <MenuItem style={{ fontSize: styles.menuItem.fontSize }} @@ -359,7 +377,7 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> { {this.props.translate.get(key, Deco.Cap)}{' '} {this.props.translate.get(Key.Docs, Deco.Cap)} </MenuItem> - </Link> + </Link>; } })} {!this._isViewingPortal() && ( @@ -391,10 +409,7 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> { const isViewingDocsPage = _.some(DOC_WEBSITE_PATHS_TO_KEY, (_key, websitePath) => { return this._doesUrlInclude(websitePath); }); - if ( - !isViewingDocsPage || - _.isUndefined(this.props.menu) - ) { + if (!isViewingDocsPage || _.isUndefined(this.props.menu)) { return undefined; } return ( diff --git a/packages/website/ts/containers/order_watcher_documentation.ts b/packages/website/ts/containers/order_watcher_documentation.ts new file mode 100644 index 000000000..29f1adf7c --- /dev/null +++ b/packages/website/ts/containers/order_watcher_documentation.ts @@ -0,0 +1,70 @@ +import { DocsInfo, DocsInfoConfig, SupportedDocJson } from '@0xproject/react-docs'; +import * as React from 'react'; +import { connect } from 'react-redux'; +import { Dispatch } from 'redux'; +import { DocPage as DocPageComponent, DocPageProps } from 'ts/pages/documentation/doc_page'; +import { Dispatcher } from 'ts/redux/dispatcher'; +import { State } from 'ts/redux/reducer'; +import { DocPackages } from 'ts/types'; +import { constants } from 'ts/utils/constants'; +import { Translate } from 'ts/utils/translate'; + +/* tslint:disable:no-var-requires */ +const IntroMarkdown = require('md/docs/order_watcher/introduction'); +const InstallationMarkdown = require('md/docs/order_watcher/installation'); +/* tslint:enable:no-var-requires */ + +const markdownSections = { + introduction: 'introduction', + installation: 'installation', +}; + +const docsInfoConfig: DocsInfoConfig = { + id: DocPackages.OrderWatcher, + type: SupportedDocJson.TypeDoc, + displayName: 'OrderWatcher', + packageUrl: 'https://github.com/0xProject/0x-monorepo', + markdownMenu: { + introduction: [markdownSections.introduction], + install: [markdownSections.installation], + }, + sectionNameToMarkdownByVersion: { + '0.0.1': { + [markdownSections.introduction]: IntroMarkdown, + [markdownSections.installation]: InstallationMarkdown, + }, + }, + markdownSections, + typeConfigs: { + typeNameToExternalLink: { + BigNumber: constants.URL_BIGNUMBERJS_GITHUB, + }, + }, +}; +const docsInfo = new DocsInfo(docsInfoConfig); + +interface ConnectedState { + docsVersion: string; + availableDocVersions: string[]; + docsInfo: DocsInfo; + translate: Translate; +} + +interface ConnectedDispatch { + dispatcher: Dispatcher; +} + +const mapStateToProps = (state: State, _ownProps: DocPageProps): ConnectedState => ({ + docsVersion: state.docsVersion, + availableDocVersions: state.availableDocVersions, + translate: state.translate, + docsInfo, +}); + +const mapDispatchToProps = (dispatch: Dispatch<State>): ConnectedDispatch => ({ + dispatcher: new Dispatcher(dispatch), +}); + +export const Documentation: React.ComponentClass<DocPageProps> = connect(mapStateToProps, mapDispatchToProps)( + DocPageComponent, +); diff --git a/packages/website/ts/index.tsx b/packages/website/ts/index.tsx index 36b2f6b87..cfe8a1c9c 100644 --- a/packages/website/ts/index.tsx +++ b/packages/website/ts/index.tsx @@ -40,6 +40,9 @@ const LazyZeroExJSDocumentation = createLazyComponent('Documentation', async () const LazyContractWrappersDocumentation = createLazyComponent('Documentation', async () => System.import<any>(/* webpackChunkName: "contractWrapperDocs" */ 'ts/containers/contract_wrappers_documentation'), ); +const LazyOrderWatcherDocumentation = createLazyComponent('Documentation', async () => + System.import<any>(/* webpackChunkName: "orderWatcherDocs" */ 'ts/containers/order_watcher_documentation'), +); const LazySmartContractsDocumentation = createLazyComponent('Documentation', async () => System.import<any>(/* webpackChunkName: "smartContractDocs" */ 'ts/containers/smart_contracts_documentation'), ); @@ -83,7 +86,14 @@ render( <Route path={WebsitePaths.About} component={About as any} /> <Route path={WebsitePaths.Wiki} component={Wiki as any} /> <Route path={`${WebsitePaths.ZeroExJs}/:version?`} component={LazyZeroExJSDocumentation} /> - <Route path={`${WebsitePaths.ContractWrappers}/:version?`} component={LazyContractWrappersDocumentation} /> + <Route + path={`${WebsitePaths.ContractWrappers}/:version?`} + component={LazyContractWrappersDocumentation} + /> + <Route + path={`${WebsitePaths.OrderWatcher}/:version?`} + component={LazyOrderWatcherDocumentation} + /> <Route path={`${WebsitePaths.Connect}/:version?`} component={LazyConnectDocumentation} /> <Route path={`${WebsitePaths.SolCompiler}/:version?`} diff --git a/packages/website/ts/pages/documentation/doc_page.tsx b/packages/website/ts/pages/documentation/doc_page.tsx index e7e5f8a8c..9c144b93f 100644 --- a/packages/website/ts/pages/documentation/doc_page.tsx +++ b/packages/website/ts/pages/documentation/doc_page.tsx @@ -34,6 +34,7 @@ const docIdToSubpackageName: { [id: string]: string } = { [DocPackages.SolCov]: 'sol-cov', [DocPackages.Subproviders]: 'subproviders', [DocPackages.OrderUtils]: 'order-utils', + [DocPackages.OrderWatcher]: 'order-watcher', [DocPackages.EthereumTypes]: 'ethereum-types', }; diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx index 2a51ee3c0..78f5fc3c1 100644 --- a/packages/website/ts/pages/landing/landing.tsx +++ b/packages/website/ts/pages/landing/landing.tsx @@ -436,7 +436,7 @@ export class Landing extends React.Component<LandingProps, LandingState> { style={{ fontFamily: 'Roboto Mono' }} > <div>{this.props.translate.get(Key.OffChainOrderRelay, Deco.Cap)}</div> - <div> {this.props.translate.get(Key.OonChainSettlement, Deco.Cap)}</div> + <div> {this.props.translate.get(Key.OnChainSettlement, Deco.Cap)}</div> </div> <div className="pb2 pt2 h5 sm-center sm-px3 sm-mx-auto" diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts index fd82ef7cb..c637171dd 100644 --- a/packages/website/ts/types.ts +++ b/packages/website/ts/types.ts @@ -372,6 +372,7 @@ export enum WebsitePaths { Connect = '/docs/connect', Web3Wrapper = '/docs/web3-wrapper', ContractWrappers = '/docs/contract-wrappers', + OrderWatcher = '/docs/order-watcher', SolCompiler = '/docs/sol-compiler', JSONSchemas = '/docs/json-schemas', SolCov = '/docs/sol-cov', @@ -393,6 +394,7 @@ export enum DocPackages { OrderUtils = 'ORDER_UTILS', EthereumTypes = 'ETHEREUM_TYPES', ContractWrappers = 'CONTRACT_WRAPPERS', + OrderWatcher = 'ORDER_WATCHER', } export enum Key { @@ -409,7 +411,7 @@ export enum Key { TraditionalAssets = 'TRADITIONAL_ASSETS', DigitalGoods = 'DIGITAL_GOODS', OffChainOrderRelay = 'OFFCHAIN_ORDER_RELAY', - OonChainSettlement = 'OONCHAIN_SETTLEMENT', + OnChainSettlement = 'ONCHAIN_SETTLEMENT', OffChainOnChainDescription = 'OFFCHAIN_ONCHAIN_DESCRIPTION', RelayersHeader = 'RELAYERS_HEADER', BenefitsHeader = 'BENEFITS_HEADER', @@ -448,6 +450,7 @@ export enum Key { Subproviders = 'SUBPROVIDERS', ZeroExJs = '0X_JS', ContractWrappers = 'CONTRACT_WRAPPERS', + OrderWatcher = 'ORDER_WATCHER', Blog = 'BLOG', Forum = 'FORUM', Connect = 'CONNECT', |