aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/website/ts')
-rw-r--r--packages/website/ts/components/sidebar_header.tsx5
-rw-r--r--packages/website/ts/components/top_bar/top_bar.tsx117
-rw-r--r--packages/website/ts/containers/deployer_documentation.ts102
-rw-r--r--packages/website/ts/containers/json_schemas_documentation.ts85
-rw-r--r--packages/website/ts/containers/sol_cov_documentation.ts89
-rw-r--r--packages/website/ts/containers/subproviders_documentation.ts137
-rw-r--r--packages/website/ts/containers/web3_wrapper_documentation.ts103
-rw-r--r--packages/website/ts/index.tsx29
-rw-r--r--packages/website/ts/pages/documentation/doc_page.tsx32
-rw-r--r--packages/website/ts/types.ts17
-rw-r--r--packages/website/ts/utils/constants.ts3
-rw-r--r--packages/website/ts/utils/doc_utils.ts60
12 files changed, 743 insertions, 36 deletions
diff --git a/packages/website/ts/components/sidebar_header.tsx b/packages/website/ts/components/sidebar_header.tsx
index 519b23d80..556243430 100644
--- a/packages/website/ts/components/sidebar_header.tsx
+++ b/packages/website/ts/components/sidebar_header.tsx
@@ -6,6 +6,11 @@ const SHOW_DURATION_MS = 4000;
const titleToIcon: { [title: string]: string } = {
'0x.js': 'zeroExJs.png',
+ Web3Wrapper: 'zeroExJs.png',
+ Deployer: 'zeroExJs.png',
+ 'Sol-cov': 'zeroExJs.png',
+ 'JSON Schemas': 'zeroExJs.png',
+ Subproviders: 'zeroExJs.png',
'0x Connect': 'connect.png',
'0x Smart Contracts': 'contracts.png',
Wiki: 'wiki.png',
diff --git a/packages/website/ts/components/top_bar/top_bar.tsx b/packages/website/ts/components/top_bar/top_bar.tsx
index 29c68524c..3a6ceed34 100644
--- a/packages/website/ts/components/top_bar/top_bar.tsx
+++ b/packages/website/ts/components/top_bar/top_bar.tsx
@@ -120,14 +120,36 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
primaryText={this.props.translate.get(Key.StandardRelayerApi, Deco.CapWords)}
/>
</a>,
- <a
- key="subMenuItem-github"
- target="_blank"
- className="text-decoration-none"
- href={constants.URL_GITHUB_ORG}
- >
- <MenuItem style={{ fontSize: styles.menuItem.fontSize }} primaryText="GitHub" />
- </a>,
+ <Link key="subMenuItem-jsonSchema" to={WebsitePaths.JSONSchemas} className="text-decoration-none">
+ <MenuItem
+ style={{ fontSize: styles.menuItem.fontSize }}
+ primaryText={this.props.translate.get(Key.JsonSchemas, Deco.CapWords)}
+ />
+ </Link>,
+ <Link key="subMenuItem-subproviders" to={WebsitePaths.Subproviders} className="text-decoration-none">
+ <MenuItem
+ style={{ fontSize: styles.menuItem.fontSize }}
+ primaryText={this.props.translate.get(Key.Subproviders, Deco.CapWords)}
+ />
+ </Link>,
+ <Link key="subMenuItem-web3Wrapper" to={WebsitePaths.Web3Wrapper} className="text-decoration-none">
+ <MenuItem
+ style={{ fontSize: styles.menuItem.fontSize }}
+ primaryText={this.props.translate.get(Key.Web3Wrapper, Deco.CapWords)}
+ />
+ </Link>,
+ <Link key="subMenuItem-deployer" to={WebsitePaths.Deployer} className="text-decoration-none">
+ <MenuItem
+ style={{ fontSize: styles.menuItem.fontSize }}
+ primaryText={this.props.translate.get(Key.Deployer, Deco.CapWords)}
+ />
+ </Link>,
+ <Link key="subMenuItem-sol-cov" to={WebsitePaths.SolCov} className="text-decoration-none">
+ <MenuItem
+ style={{ fontSize: styles.menuItem.fontSize }}
+ primaryText={this.props.translate.get(Key.SolCov, Deco.CapWords)}
+ />
+ </Link>,
<a
key="subMenuItem-whitePaper"
target="_blank"
@@ -139,6 +161,14 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
primaryText={this.props.translate.get(Key.Whitepaper, Deco.CapWords)}
/>
</a>,
+ <a
+ key="subMenuItem-github"
+ target="_blank"
+ className="text-decoration-none"
+ href={constants.URL_GITHUB_ORG}
+ >
+ <MenuItem style={{ fontSize: styles.menuItem.fontSize }} primaryText="GitHub" />
+ </a>,
];
const bottomBorderStyle = this._shouldDisplayBottomBar() ? styles.bottomBar : {};
const fullWidthClasses = isFullWidthPage ? 'pr4' : '';
@@ -277,6 +307,46 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
</MenuItem>
</Link>
)}
+ {!this._isViewingWeb3WrapperDocs() && (
+ <Link to={WebsitePaths.Web3Wrapper} className="text-decoration-none">
+ <MenuItem className="py2">
+ {this.props.translate.get(Key.Web3Wrapper, Deco.Cap)}{' '}
+ {this.props.translate.get(Key.Docs, Deco.Cap)}
+ </MenuItem>
+ </Link>
+ )}
+ {!this._isViewingDeployerDocs() && (
+ <Link to={WebsitePaths.Deployer} className="text-decoration-none">
+ <MenuItem className="py2">
+ {this.props.translate.get(Key.Deployer, Deco.Cap)}{' '}
+ {this.props.translate.get(Key.Docs, Deco.Cap)}
+ </MenuItem>
+ </Link>
+ )}
+ {!this._isViewingJsonSchemasDocs() && (
+ <Link to={WebsitePaths.JSONSchemas} className="text-decoration-none">
+ <MenuItem className="py2">
+ {this.props.translate.get(Key.JsonSchemas, Deco.Cap)}{' '}
+ {this.props.translate.get(Key.Docs, Deco.Cap)}
+ </MenuItem>
+ </Link>
+ )}
+ {!this._isViewingSolCovDocs() && (
+ <Link to={WebsitePaths.SolCov} className="text-decoration-none">
+ <MenuItem className="py2">
+ {this.props.translate.get(Key.SolCov, Deco.Cap)}{' '}
+ {this.props.translate.get(Key.Docs, Deco.Cap)}
+ </MenuItem>
+ </Link>
+ )}
+ {!this._isViewingSubprovidersDocs() && (
+ <Link to={WebsitePaths.Subproviders} className="text-decoration-none">
+ <MenuItem className="py2">
+ {this.props.translate.get(Key.Subproviders, Deco.Cap)}{' '}
+ {this.props.translate.get(Key.Docs, Deco.Cap)}
+ </MenuItem>
+ </Link>
+ )}
{!this._isViewingPortal() && (
<Link to={`${WebsitePaths.Portal}`} className="text-decoration-none">
<MenuItem className="py2">
@@ -304,7 +374,14 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
}
private _renderDocsMenu(): React.ReactNode {
if (
- (!this._isViewing0xjsDocs() && !this._isViewingSmartContractsDocs() && !this._isViewingConnectDocs()) ||
+ (!this._isViewing0xjsDocs() &&
+ !this._isViewingSmartContractsDocs() &&
+ !this._isViewingWeb3WrapperDocs() &&
+ !this._isViewingDeployerDocs() &&
+ !this._isViewingJsonSchemasDocs() &&
+ !this._isViewingSolCovDocs() &&
+ !this._isViewingSubprovidersDocs() &&
+ !this._isViewingConnectDocs()) ||
_.isUndefined(this.props.menu)
) {
return undefined;
@@ -392,6 +469,21 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
private _isViewingSmartContractsDocs() {
return _.includes(this.props.location.pathname, WebsitePaths.SmartContracts);
}
+ private _isViewingWeb3WrapperDocs() {
+ return _.includes(this.props.location.pathname, WebsitePaths.Web3Wrapper);
+ }
+ private _isViewingDeployerDocs() {
+ return _.includes(this.props.location.pathname, WebsitePaths.Deployer);
+ }
+ private _isViewingJsonSchemasDocs() {
+ return _.includes(this.props.location.pathname, WebsitePaths.JSONSchemas);
+ }
+ private _isViewingSolCovDocs() {
+ return _.includes(this.props.location.pathname, WebsitePaths.SolCov);
+ }
+ private _isViewingSubprovidersDocs() {
+ return _.includes(this.props.location.pathname, WebsitePaths.Subproviders);
+ }
private _isViewingWiki() {
return _.includes(this.props.location.pathname, WebsitePaths.Wiki);
}
@@ -401,7 +493,12 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
this._isViewing0xjsDocs() ||
this._isViewingFAQ() ||
this._isViewingSmartContractsDocs() ||
+ this._isViewingWeb3WrapperDocs() ||
+ this._isViewingDeployerDocs() ||
+ this._isViewingJsonSchemasDocs() ||
+ this._isViewingSolCovDocs() ||
+ this._isViewingSubprovidersDocs() ||
this._isViewingConnectDocs()
);
}
-}
+} // tslint:disable:max-file-line-count
diff --git a/packages/website/ts/containers/deployer_documentation.ts b/packages/website/ts/containers/deployer_documentation.ts
new file mode 100644
index 000000000..4e1c41f8c
--- /dev/null
+++ b/packages/website/ts/containers/deployer_documentation.ts
@@ -0,0 +1,102 @@
+import { constants as docConstants, DocsInfo, DocsInfoConfig, SupportedDocJson } from '@0xproject/react-docs';
+import * as _ from 'lodash';
+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, Environments, WebsitePaths } from 'ts/types';
+import { configs } from 'ts/utils/configs';
+import { constants } from 'ts/utils/constants';
+import { Translate } from 'ts/utils/translate';
+
+/* tslint:disable:no-var-requires */
+const IntroMarkdown = require('md/docs/deployer/introduction');
+const InstallationMarkdown = require('md/docs/deployer/installation');
+const UsageMarkdown = require('md/docs/deployer/usage');
+/* tslint:enable:no-var-requires */
+
+const docSections = {
+ introduction: 'introduction',
+ installation: 'installation',
+ usage: 'usage',
+ compiler: 'compiler',
+ deployer: 'deployer',
+ types: docConstants.TYPES_SECTION_NAME,
+};
+
+const docsInfoConfig: DocsInfoConfig = {
+ id: DocPackages.Deployer,
+ type: SupportedDocJson.TypeDoc,
+ displayName: 'Deployer',
+ packageUrl: 'https://github.com/0xProject/0x-monorepo',
+ menu: {
+ introduction: [docSections.introduction],
+ install: [docSections.installation],
+ usage: [docSections.usage],
+ compiler: [docSections.compiler],
+ deployer: [docSections.deployer],
+ types: [docSections.types],
+ },
+ sectionNameToMarkdown: {
+ [docSections.introduction]: IntroMarkdown,
+ [docSections.installation]: InstallationMarkdown,
+ [docSections.usage]: UsageMarkdown,
+ },
+ sectionNameToModulePath: {
+ [docSections.compiler]: ['"deployer/src/compiler"'],
+ [docSections.deployer]: ['"deployer/src/deployer"'],
+ [docSections.types]: ['"deployer/src/utils/types"', '"types/src/index"'],
+ },
+ menuSubsectionToVersionWhenIntroduced: {},
+ sections: docSections,
+ visibleConstructors: [docSections.compiler, docSections.deployer],
+ typeConfigs: {
+ // Note: This needs to be kept in sync with the types exported in index.ts. Unfortunately there is
+ // currently no way to extract the re-exported types from index.ts via TypeDoc :(
+ publicTypes: [
+ 'CompilerOptions',
+ 'DeployerOptions',
+ 'BaseDeployerOptions',
+ 'UrlDeployerOptions',
+ 'ProviderDeployerOptions',
+ 'TxData',
+ ],
+ typeNameToExternalLink: {
+ Web3: 'https://github.com/ethereum/wiki/wiki/JavaScript-API',
+ BigNumber: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L127',
+ ContractInstance: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L98',
+ },
+ typeNameToPrefix: {
+ ContractInstance: 'Web3',
+ },
+ },
+};
+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/containers/json_schemas_documentation.ts b/packages/website/ts/containers/json_schemas_documentation.ts
new file mode 100644
index 000000000..42e441212
--- /dev/null
+++ b/packages/website/ts/containers/json_schemas_documentation.ts
@@ -0,0 +1,85 @@
+import { constants as docConstants, DocsInfo, DocsInfoConfig, SupportedDocJson } from '@0xproject/react-docs';
+import * as _ from 'lodash';
+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, Environments, WebsitePaths } from 'ts/types';
+import { configs } from 'ts/utils/configs';
+import { constants } from 'ts/utils/constants';
+import { Translate } from 'ts/utils/translate';
+
+/* tslint:disable:no-var-requires */
+const IntroMarkdown = require('md/docs/json_schemas/introduction');
+const InstallationMarkdown = require('md/docs/json_schemas/installation');
+const SchemasMarkdown = require('md/docs/json_schemas/schemas');
+/* tslint:enable:no-var-requires */
+
+const docSections = {
+ introduction: 'introduction',
+ installation: 'installation',
+ schemaValidator: 'schemaValidator',
+ schemas: 'schemas',
+};
+
+const docsInfoConfig: DocsInfoConfig = {
+ id: DocPackages.JSONSchemas,
+ type: SupportedDocJson.TypeDoc,
+ displayName: 'JSON Schemas',
+ packageUrl: 'https://github.com/0xProject/0x-monorepo',
+ menu: {
+ introduction: [docSections.introduction],
+ install: [docSections.installation],
+ schemaValidator: [docSections.schemaValidator],
+ schemas: [docSections.schemas],
+ },
+ sectionNameToMarkdown: {
+ [docSections.introduction]: IntroMarkdown,
+ [docSections.installation]: InstallationMarkdown,
+ [docSections.schemas]: SchemasMarkdown,
+ },
+ sectionNameToModulePath: {
+ [docSections.schemaValidator]: ['"json-schemas/src/schema_validator"'],
+ },
+ menuSubsectionToVersionWhenIntroduced: {},
+ sections: docSections,
+ visibleConstructors: [docSections.schemaValidator],
+ typeConfigs: {
+ // Note: This needs to be kept in sync with the types exported in index.ts. Unfortunately there is
+ // currently no way to extract the re-exported types from index.ts via TypeDoc :(
+ publicTypes: [],
+ typeNameToExternalLink: {
+ Schema:
+ 'https://github.com/tdegrunt/jsonschema/blob/5c2edd4baba149964aec0f23c87ad12c25a50dfb/lib/index.d.ts#L49',
+ },
+ },
+};
+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/containers/sol_cov_documentation.ts b/packages/website/ts/containers/sol_cov_documentation.ts
new file mode 100644
index 000000000..2b901ec6f
--- /dev/null
+++ b/packages/website/ts/containers/sol_cov_documentation.ts
@@ -0,0 +1,89 @@
+import { constants as docConstants, DocsInfo, DocsInfoConfig, SupportedDocJson } from '@0xproject/react-docs';
+import * as _ from 'lodash';
+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, Environments, WebsitePaths } from 'ts/types';
+import { configs } from 'ts/utils/configs';
+import { constants } from 'ts/utils/constants';
+import { Translate } from 'ts/utils/translate';
+
+/* tslint:disable:no-var-requires */
+const IntroMarkdown = require('md/docs/sol_cov/introduction');
+const InstallationMarkdown = require('md/docs/sol_cov/installation');
+const UsageMarkdown = require('md/docs/sol_cov/usage');
+/* tslint:enable:no-var-requires */
+
+const docSections = {
+ introduction: 'introduction',
+ installation: 'installation',
+ usage: 'usage',
+ coverageSubprovider: 'coverageSubprovider',
+ types: docConstants.TYPES_SECTION_NAME,
+};
+
+const docsInfoConfig: DocsInfoConfig = {
+ id: DocPackages.SolCov,
+ type: SupportedDocJson.TypeDoc,
+ displayName: 'Sol-cov',
+ packageUrl: 'https://github.com/0xProject/0x-monorepo',
+ menu: {
+ introduction: [docSections.introduction],
+ install: [docSections.installation],
+ usage: [docSections.usage],
+ coverageSubprovider: [docSections.coverageSubprovider],
+ types: [docSections.types],
+ },
+ sectionNameToMarkdown: {
+ [docSections.introduction]: IntroMarkdown,
+ [docSections.installation]: InstallationMarkdown,
+ [docSections.usage]: UsageMarkdown,
+ },
+ sectionNameToModulePath: {
+ [docSections.coverageSubprovider]: ['"sol-cov/src/coverage_subprovider"'],
+ [docSections.types]: ['"subproviders/src/types"'],
+ },
+ menuSubsectionToVersionWhenIntroduced: {},
+ sections: docSections,
+ visibleConstructors: [docSections.coverageSubprovider],
+ typeConfigs: {
+ // Note: This needs to be kept in sync with the types exported in index.ts. Unfortunately there is
+ // currently no way to extract the re-exported types from index.ts via TypeDoc :(
+ publicTypes: ['NextCallback', 'OnNextCompleted', 'ErrorCallback'],
+ typeNameToExternalLink: {},
+ typeNameToPrefix: {
+ JSONRPCRequestPayload: 'Web3',
+ },
+ typeNameToDocSection: {},
+ },
+};
+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/containers/subproviders_documentation.ts b/packages/website/ts/containers/subproviders_documentation.ts
new file mode 100644
index 000000000..34a3d7da2
--- /dev/null
+++ b/packages/website/ts/containers/subproviders_documentation.ts
@@ -0,0 +1,137 @@
+import { constants as docConstants, DocsInfo, DocsInfoConfig, SupportedDocJson } from '@0xproject/react-docs';
+import * as _ from 'lodash';
+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, Environments, WebsitePaths } from 'ts/types';
+import { configs } from 'ts/utils/configs';
+import { constants } from 'ts/utils/constants';
+import { Translate } from 'ts/utils/translate';
+
+/* tslint:disable:no-var-requires */
+const IntroMarkdown = require('md/docs/subproviders/introduction');
+const InstallationMarkdown = require('md/docs/subproviders/installation');
+/* tslint:enable:no-var-requires */
+
+const docSections = {
+ introduction: 'introduction',
+ installation: 'installation',
+ subprovider: 'subprovider',
+ ledgerSubprovider: 'ledgerSubprovider',
+ factoryMethods: 'factory-methods',
+ emptyWalletSubprovider: 'emptyWalletSubprovider',
+ fakeGasEstimateSubprovider: 'fakeGasEstimateSubprovider',
+ injectedWeb3Subprovider: 'injectedWeb3Subprovider',
+ redundantRPCSubprovider: 'redundantRPCSubprovider',
+ ganacheSubprovider: 'ganacheSubprovider',
+ nonceTrackerSubprovider: 'nonceTrackerSubprovider',
+ types: docConstants.TYPES_SECTION_NAME,
+};
+
+const docsInfoConfig: DocsInfoConfig = {
+ id: DocPackages.Subproviders,
+ type: SupportedDocJson.TypeDoc,
+ displayName: 'Subproviders',
+ packageUrl: 'https://github.com/0xProject/0x-monorepo',
+ menu: {
+ introduction: [docSections.introduction],
+ install: [docSections.installation],
+ subprovider: [docSections.subprovider],
+ ['ledger-subprovider']: [docSections.ledgerSubprovider],
+ ['factory-methods']: [docSections.factoryMethods],
+ ['emptyWallet-subprovider']: [docSections.emptyWalletSubprovider],
+ ['fakeGasEstimate-subprovider']: [docSections.fakeGasEstimateSubprovider],
+ ['injectedWeb3-subprovider']: [docSections.injectedWeb3Subprovider],
+ ['redundantRPC-subprovider']: [docSections.redundantRPCSubprovider],
+ ['ganache-subprovider']: [docSections.ganacheSubprovider],
+ ['nonceTracker-subprovider']: [docSections.nonceTrackerSubprovider],
+ types: [docSections.types],
+ },
+ sectionNameToMarkdown: {
+ [docSections.introduction]: IntroMarkdown,
+ [docSections.installation]: InstallationMarkdown,
+ },
+ sectionNameToModulePath: {
+ [docSections.subprovider]: ['"subproviders/src/subproviders/subprovider"'],
+ [docSections.ledgerSubprovider]: ['"subproviders/src/subproviders/ledger"'],
+ [docSections.factoryMethods]: ['"subproviders/src/index"'],
+ [docSections.emptyWalletSubprovider]: ['"subproviders/src/subproviders/empty_wallet_subprovider"'],
+ [docSections.fakeGasEstimateSubprovider]: ['"subproviders/src/subproviders/fake_gas_estimate_subprovider"'],
+ [docSections.injectedWeb3Subprovider]: ['"subproviders/src/subproviders/injected_web3"'],
+ [docSections.redundantRPCSubprovider]: ['"subproviders/src/subproviders/redundant_rpc"'],
+ [docSections.ganacheSubprovider]: ['"subproviders/src/subproviders/ganache"'],
+ [docSections.nonceTrackerSubprovider]: ['"subproviders/src/subproviders/nonce_tracker"'],
+ [docSections.types]: ['"deployer/src/utils/types"', '"types/src/index"', '"subproviders/src/types"'],
+ },
+ menuSubsectionToVersionWhenIntroduced: {},
+ sections: docSections,
+ visibleConstructors: [
+ docSections.subprovider,
+ docSections.ledgerSubprovider,
+ docSections.emptyWalletSubprovider,
+ docSections.fakeGasEstimateSubprovider,
+ docSections.injectedWeb3Subprovider,
+ docSections.redundantRPCSubprovider,
+ docSections.ganacheSubprovider,
+ docSections.nonceTrackerSubprovider,
+ ],
+ typeConfigs: {
+ // Note: This needs to be kept in sync with the types exported in index.ts. Unfortunately there is
+ // currently no way to extract the re-exported types from index.ts via TypeDoc :(
+ publicTypes: [
+ 'Callback',
+ 'NextCallback',
+ 'ErrorCallback',
+ 'ECSignature',
+ 'JSONRPCRequestPayloadWithMethod',
+ 'JSONRPCResponsePayload',
+ 'AccountFetchingConfigs',
+ 'LedgerEthereumClientFactoryAsync',
+ 'PartialTxParams',
+ 'LedgerEthereumClient',
+ 'LedgerSubproviderConfigs',
+ ],
+ typeNameToExternalLink: {
+ Web3: 'https://github.com/ethereum/wiki/wiki/JavaScript-API',
+ BigNumber: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L127',
+ JSONRPCRequestPayload: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L137',
+ JSONRPCResponsePayload: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L144',
+ Provider: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L150',
+ },
+ typeNameToPrefix: {
+ JSONRPCRequestPayload: 'Web3',
+ JSONRPCResponsePayload: 'Web3',
+ Provider: 'Web3',
+ },
+ },
+};
+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/containers/web3_wrapper_documentation.ts b/packages/website/ts/containers/web3_wrapper_documentation.ts
new file mode 100644
index 000000000..0a0911b80
--- /dev/null
+++ b/packages/website/ts/containers/web3_wrapper_documentation.ts
@@ -0,0 +1,103 @@
+import { constants as docConstants, DocsInfo, DocsInfoConfig, SupportedDocJson } from '@0xproject/react-docs';
+import * as _ from 'lodash';
+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, Environments, WebsitePaths } from 'ts/types';
+import { configs } from 'ts/utils/configs';
+import { constants } from 'ts/utils/constants';
+import { Translate } from 'ts/utils/translate';
+
+/* tslint:disable:no-var-requires */
+const IntroMarkdown = require('md/docs/web3_wrapper/introduction');
+const InstallationMarkdown = require('md/docs/web3_wrapper/installation');
+/* tslint:enable:no-var-requires */
+
+const docSections = {
+ introduction: 'introduction',
+ installation: 'installation',
+ web3Wrapper: 'web3Wrapper',
+ types: docConstants.TYPES_SECTION_NAME,
+};
+
+const docsInfoConfig: DocsInfoConfig = {
+ id: DocPackages.Web3Wrapper,
+ type: SupportedDocJson.TypeDoc,
+ displayName: 'Web3Wrapper',
+ packageUrl: 'https://github.com/0xProject/0x-monorepo',
+ menu: {
+ introduction: [docSections.introduction],
+ install: [docSections.installation],
+ web3Wrapper: [docSections.web3Wrapper],
+ types: [docSections.types],
+ },
+ sectionNameToMarkdown: {
+ [docSections.introduction]: IntroMarkdown,
+ [docSections.installation]: InstallationMarkdown,
+ },
+ sectionNameToModulePath: {
+ [docSections.web3Wrapper]: ['"web3-wrapper/src/index"'],
+ [docSections.types]: ['"types/src/index"'],
+ },
+ menuSubsectionToVersionWhenIntroduced: {},
+ sections: docSections,
+ visibleConstructors: [docSections.web3Wrapper],
+ typeConfigs: {
+ // Note: This needs to be kept in sync with the types exported in index.ts. Unfortunately there is
+ // currently no way to extract the re-exported types from index.ts via TypeDoc :(
+ publicTypes: ['TxData', 'TransactionReceipt', 'RawLogEntry'],
+ typeNameToExternalLink: {
+ Web3: 'https://github.com/ethereum/wiki/wiki/JavaScript-API',
+ Provider: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L150',
+ BigNumber: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L127',
+ LogEntryEvent: 'http://mikemcl.github.io/bignumber.js',
+ CallData: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L348',
+ BlockWithoutTransactionData:
+ 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L314',
+ LogEntry: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L366',
+ FilterObject: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L109',
+ ['Web3.BlockParam']: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L278',
+ ['Web3.ContractAbi']: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L47',
+ },
+ typeNameToPrefix: {
+ Provider: 'Web3',
+ CallData: 'Web3',
+ BlockWithoutTransactionData: 'Web3',
+ LogEntry: 'Web3',
+ FilterObject: 'Web3',
+ },
+ typeNameToDocSection: {
+ Web3Wrapper: docSections.web3Wrapper,
+ },
+ },
+};
+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 b24517e39..0d33e389f 100644
--- a/packages/website/ts/index.tsx
+++ b/packages/website/ts/index.tsx
@@ -45,6 +45,21 @@ const LazySmartContractsDocumentation = createLazyComponent('Documentation', asy
const LazyConnectDocumentation = createLazyComponent('Documentation', async () =>
System.import<any>(/* webpackChunkName: "connectDocs" */ 'ts/containers/connect_documentation'),
);
+const LazyWeb3WrapperDocumentation = createLazyComponent('Documentation', async () =>
+ System.import<any>(/* webpackChunkName: "connectDocs" */ 'ts/containers/web3_wrapper_documentation'),
+);
+const LazyDeployerDocumentation = createLazyComponent('Documentation', async () =>
+ System.import<any>(/* webpackChunkName: "connectDocs" */ 'ts/containers/deployer_documentation'),
+);
+const LazyJSONSchemasDocumentation = createLazyComponent('Documentation', async () =>
+ System.import<any>(/* webpackChunkName: "connectDocs" */ 'ts/containers/json_schemas_documentation'),
+);
+const LazySolCovDocumentation = createLazyComponent('Documentation', async () =>
+ System.import<any>(/* webpackChunkName: "connectDocs" */ 'ts/containers/sol_cov_documentation'),
+);
+const LazySubprovidersDocumentation = createLazyComponent('Documentation', async () =>
+ System.import<any>(/* webpackChunkName: "connectDocs" */ 'ts/containers/subproviders_documentation'),
+);
analytics.init();
// tslint:disable-next-line:no-floating-promises
@@ -65,6 +80,20 @@ render(
<Route path={`${WebsitePaths.Wiki}`} component={Wiki as any} />
<Route path={`${WebsitePaths.ZeroExJs}/:version?`} component={LazyZeroExJSDocumentation} />
<Route path={`${WebsitePaths.Connect}/:version?`} component={LazyConnectDocumentation} />
+ <Route path={`${WebsitePaths.Deployer}/:version?`} component={LazyDeployerDocumentation} />
+ <Route path={`${WebsitePaths.SolCov}/:version?`} component={LazySolCovDocumentation} />
+ <Route
+ path={`${WebsitePaths.JSONSchemas}/:version?`}
+ component={LazyJSONSchemasDocumentation}
+ />
+ <Route
+ path={`${WebsitePaths.Subproviders}/:version?`}
+ component={LazySubprovidersDocumentation}
+ />
+ <Route
+ path={`${WebsitePaths.Web3Wrapper}/:version?`}
+ component={LazyWeb3WrapperDocumentation}
+ />
<Route
path={`${WebsitePaths.SmartContracts}/:version?`}
component={LazySmartContractsDocumentation}
diff --git a/packages/website/ts/pages/documentation/doc_page.tsx b/packages/website/ts/pages/documentation/doc_page.tsx
index 1281219c6..80c47ea5c 100644
--- a/packages/website/ts/pages/documentation/doc_page.tsx
+++ b/packages/website/ts/pages/documentation/doc_page.tsx
@@ -18,16 +18,26 @@ import { utils } from 'ts/utils/utils';
const ZERO_EX_JS_VERSION_MISSING_TOPLEVEL_PATH = '0.32.4';
const isDevelopment = configs.ENVIRONMENT === Environments.DEVELOPMENT;
-const docIdToS3BucketName: { [id: string]: string } = {
- [DocPackages.ZeroExJs]: isDevelopment ? 'staging-0xjs-docs-jsons' : '0xjs-docs-jsons',
- [DocPackages.SmartContracts]: 'smart-contracts-docs-json',
- [DocPackages.Connect]: isDevelopment ? 'staging-connect-docs-jsons' : 'connect-docs-jsons',
+const docIdToS3FolderName: { [id: string]: string } = {
+ [DocPackages.ZeroExJs]: '0xjs',
+ [DocPackages.SmartContracts]: 'smart-contracts',
+ [DocPackages.Connect]: 'connect',
+ [DocPackages.Web3Wrapper]: 'web3-wrapper',
+ [DocPackages.Deployer]: 'deployer',
+ [DocPackages.JSONSchemas]: 'json-schemas',
+ [DocPackages.SolCov]: 'sol-cov',
+ [DocPackages.Subproviders]: 'subproviders',
};
const docIdToSubpackageName: { [id: string]: string } = {
[DocPackages.ZeroExJs]: '0x.js',
[DocPackages.Connect]: 'connect',
[DocPackages.SmartContracts]: 'contracts',
+ [DocPackages.Web3Wrapper]: 'web3-wrapper',
+ [DocPackages.Deployer]: 'deployer',
+ [DocPackages.JSONSchemas]: 'json-schemas',
+ [DocPackages.SolCov]: 'sol-cov',
+ [DocPackages.Subproviders]: 'subproviders',
};
export interface DocPageProps {
@@ -97,25 +107,25 @@ export class DocPage extends React.Component<DocPageProps, DocPageState> {
);
}
private async _fetchJSONDocsFireAndForgetAsync(preferredVersionIfExists?: string): Promise<void> {
- const s3BucketName = docIdToS3BucketName[this.props.docsInfo.id];
- const docsJsonRoot = `${constants.S3_BUCKET_ROOT}/${s3BucketName}`;
- const versionToFileName = await docUtils.getVersionToFileNameAsync(docsJsonRoot);
- const versions = _.keys(versionToFileName);
+ const folderName = docIdToS3FolderName[this.props.docsInfo.id];
+ const docBucketRoot = isDevelopment ? constants.S3_STAGING_DOC_BUCKET_ROOT : constants.S3_DOC_BUCKET_ROOT;
+ const versionToFilePath = await docUtils.getVersionToFilePathAsync(docBucketRoot, folderName);
+ const versions = _.keys(versionToFilePath);
this.props.dispatcher.updateAvailableDocVersions(versions);
const sortedVersions = semverSort.desc(versions);
const latestVersion = sortedVersions[0];
let versionToFetch = latestVersion;
if (!_.isUndefined(preferredVersionIfExists)) {
- const preferredVersionFileNameIfExists = versionToFileName[preferredVersionIfExists];
+ const preferredVersionFileNameIfExists = versionToFilePath[preferredVersionIfExists];
if (!_.isUndefined(preferredVersionFileNameIfExists)) {
versionToFetch = preferredVersionIfExists;
}
}
this.props.dispatcher.updateCurrentDocsVersion(versionToFetch);
- const versionFileNameToFetch = versionToFileName[versionToFetch];
- const versionDocObj = await docUtils.getJSONDocFileAsync(versionFileNameToFetch, docsJsonRoot);
+ const versionFilePathToFetch = versionToFilePath[versionToFetch];
+ const versionDocObj = await docUtils.getJSONDocFileAsync(versionFilePathToFetch, docBucketRoot);
const docAgnosticFormat = this.props.docsInfo.convertToDocAgnosticFormat(versionDocObj);
if (!this._isUnmounted) {
diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts
index b3e4973fa..262c96c76 100644
--- a/packages/website/ts/types.ts
+++ b/packages/website/ts/types.ts
@@ -336,7 +336,7 @@ export enum TokenVisibility {
TRACKED = 'TRACKED',
}
-export interface VersionToFileName {
+export interface VersionToFilePath {
[version: string]: string;
}
@@ -355,12 +355,22 @@ export enum WebsitePaths {
Whitepaper = '/pdfs/0x_white_paper.pdf',
SmartContracts = '/docs/contracts',
Connect = '/docs/connect',
+ Web3Wrapper = '/docs/web3_wrapper',
+ Deployer = '/docs/deployer',
+ JSONSchemas = '/docs/json-schemas',
+ SolCov = '/docs/sol-cov',
+ Subproviders = '/docs/subproviders',
}
export enum DocPackages {
Connect = 'CONNECT',
ZeroExJs = 'ZERO_EX_JS',
SmartContracts = 'SMART_CONTRACTS',
+ Web3Wrapper = 'WEB3_WRAPPER',
+ Deployer = 'DEPLOYER',
+ JSONSchemas = 'JSON_SCHEMAS',
+ SolCov = 'SOL_COV',
+ Subproviders = 'SUBPROVIDERS',
}
export interface TimestampMsRange {
@@ -442,11 +452,16 @@ export enum Key {
About = 'ABOUT',
Careers = 'CAREERS',
Contact = 'CONTACT',
+ Deployer = 'DEPLOYER',
+ JsonSchemas = 'JSON_SCHEMAS',
+ SolCov = 'SOL_COV',
+ Subproviders = 'SUBPROVIDERS',
Blog = 'BLOG',
Forum = 'FORUM',
Connect = 'CONNECT',
Whitepaper = 'WHITEPAPER',
Wiki = 'WIKI',
+ Web3Wrapper = 'WEB3_WRAPPER',
And = 'AND',
Faq = 'FAQ',
SmartContracts = 'SMART_CONTRACTS',
diff --git a/packages/website/ts/utils/constants.ts b/packages/website/ts/utils/constants.ts
index f63e8617e..42a2f44d0 100644
--- a/packages/website/ts/utils/constants.ts
+++ b/packages/website/ts/utils/constants.ts
@@ -29,7 +29,8 @@ export const constants = {
PROVIDER_NAME_GENERIC: 'Injected Web3',
PROVIDER_NAME_PUBLIC: '0x Public',
ROLLBAR_ACCESS_TOKEN: 'a6619002b51c4464928201e6ea94de65',
- S3_BUCKET_ROOT: 'https://s3.amazonaws.com',
+ S3_DOC_BUCKET_ROOT: 'https://s3.amazonaws.com/doc-jsons',
+ S3_STAGING_DOC_BUCKET_ROOT: 'https://s3.amazonaws.com/staging-doc-jsons',
SUCCESS_STATUS: 200,
UNAVAILABLE_STATUS: 503,
TAKER_FEE: new BigNumber(0),
diff --git a/packages/website/ts/utils/doc_utils.ts b/packages/website/ts/utils/doc_utils.ts
index 6b3f5f378..2a599bcbe 100644
--- a/packages/website/ts/utils/doc_utils.ts
+++ b/packages/website/ts/utils/doc_utils.ts
@@ -2,21 +2,21 @@ import { DoxityDocObj, TypeDocNode } from '@0xproject/react-docs';
import { logUtils } from '@0xproject/utils';
import findVersions = require('find-versions');
import * as _ from 'lodash';
-import { S3FileObject, VersionToFileName } from 'ts/types';
+import { S3FileObject, VersionToFilePath } from 'ts/types';
import { utils } from 'ts/utils/utils';
import convert = require('xml-js');
export const docUtils = {
- async getVersionToFileNameAsync(s3DocJsonRoot: string): Promise<VersionToFileName> {
- const versionFileNames = await this.getVersionFileNamesAsync(s3DocJsonRoot);
- const versionToFileName: VersionToFileName = {};
- _.each(versionFileNames, fileName => {
- const [version] = findVersions(fileName);
- versionToFileName[version] = fileName;
+ async getVersionToFilePathAsync(s3DocJsonRoot: string, folderName: string): Promise<VersionToFilePath> {
+ const versionFilePaths = await this.getVersionFileNamesAsync(s3DocJsonRoot, folderName);
+ const versionToFilePath: VersionToFilePath = {};
+ _.each(versionFilePaths, filePath => {
+ const [version] = findVersions(filePath);
+ versionToFilePath[version] = filePath;
});
- return versionToFileName;
+ return versionToFilePath;
},
- async getVersionFileNamesAsync(s3DocJsonRoot: string): Promise<string[]> {
+ async getVersionFileNamesAsync(s3DocJsonRoot: string, folderName: string): Promise<string[]> {
const response = await fetch(s3DocJsonRoot);
if (response.status !== 200) {
// TODO: Show the user an error message when the docs fail to load
@@ -33,13 +33,47 @@ export const docUtils = {
? (responseObj.ListBucketResult.Contents as S3FileObject[])
: [responseObj.ListBucketResult.Contents];
- const versionFileNames = _.map(fileObjs, fileObj => {
+ /*
+ * S3 simply pre-fixes files in "folders" with the folder name. Thus, since we
+ * store docJSONs for multiple packages in a single S3 bucket, we must filter out
+ * the versionFileNames for a given folder here (ignoring folder entries)
+ *
+ * Example S3 response:
+ * <ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
+ * <Name>staging-doc-jsons</Name>
+ * <Prefix/>
+ * <Marker/>
+ * <MaxKeys>1000</MaxKeys>
+ * <IsTruncated>false</IsTruncated>
+ * <Contents>
+ * <Key>0xjs/</Key>
+ * <LastModified>2018-03-16T13:17:46.000Z</LastModified>
+ * <ETag>"d41d8cd98f00b204e9800998ecf8427e"</ETag>
+ * <Size>0</Size>
+ * <StorageClass>STANDARD</StorageClass>
+ * </Contents>
+ * <Contents>
+ * <Key>0xjs/v0.1.0.json</Key>
+ * <LastModified>2018-03-16T13:18:23.000Z</LastModified>
+ * <ETag>"b4f7f74913aab4a5ad1e6a58fcb3b274"</ETag>
+ * <Size>1039050</Size>
+ * <StorageClass>STANDARD</StorageClass>
+ * </Contents>
+ */
+ const relevantObjs = _.filter(fileObjs, fileObj => {
+ const key = fileObj.Key._text;
+ const isInFolderOfInterest = _.includes(key, folderName);
+ const isFileEntry = !_.endsWith(key, '/');
+ return isInFolderOfInterest && isFileEntry;
+ });
+
+ const versionFilePaths = _.map(relevantObjs, fileObj => {
return fileObj.Key._text;
});
- return versionFileNames;
+ return versionFilePaths;
},
- async getJSONDocFileAsync(fileName: string, s3DocJsonRoot: string): Promise<TypeDocNode | DoxityDocObj> {
- const endpoint = `${s3DocJsonRoot}/${fileName}`;
+ async getJSONDocFileAsync(filePath: string, s3DocJsonRoot: string): Promise<TypeDocNode | DoxityDocObj> {
+ const endpoint = `${s3DocJsonRoot}/${filePath}`;
const response = await fetch(endpoint);
if (response.status !== 200) {
// TODO: Show the user an error message when the docs fail to load