aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-06-05 01:54:14 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-06-05 01:54:14 +0800
commit9212d67e2fad159fa7eb3feed751814ea515416c (patch)
treec4668c933f94009e57ba0e060561383078d08e42 /packages/website/ts
parentd50fbac5f937602d7a90343ea8ff88cee5c4542f (diff)
downloaddexon-0x-contracts-9212d67e2fad159fa7eb3feed751814ea515416c.tar
dexon-0x-contracts-9212d67e2fad159fa7eb3feed751814ea515416c.tar.gz
dexon-0x-contracts-9212d67e2fad159fa7eb3feed751814ea515416c.tar.bz2
dexon-0x-contracts-9212d67e2fad159fa7eb3feed751814ea515416c.tar.lz
dexon-0x-contracts-9212d67e2fad159fa7eb3feed751814ea515416c.tar.xz
dexon-0x-contracts-9212d67e2fad159fa7eb3feed751814ea515416c.tar.zst
dexon-0x-contracts-9212d67e2fad159fa7eb3feed751814ea515416c.zip
Add a documentation page for ethereum types
Diffstat (limited to 'packages/website/ts')
-rw-r--r--packages/website/ts/components/top_bar/top_bar.tsx6
-rw-r--r--packages/website/ts/containers/ethereum_types_documentation.ts124
-rw-r--r--packages/website/ts/index.tsx7
-rw-r--r--packages/website/ts/pages/documentation/doc_page.tsx1
-rw-r--r--packages/website/ts/types.ts3
-rw-r--r--packages/website/ts/utils/doc_utils.ts2
6 files changed, 142 insertions, 1 deletions
diff --git a/packages/website/ts/components/top_bar/top_bar.tsx b/packages/website/ts/components/top_bar/top_bar.tsx
index e2d791ae3..3e97dc741 100644
--- a/packages/website/ts/components/top_bar/top_bar.tsx
+++ b/packages/website/ts/components/top_bar/top_bar.tsx
@@ -165,6 +165,12 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
primaryText={this.props.translate.get(Key.SolCov, Deco.CapWords)}
/>
</Link>,
+ <Link key="subMenuItem-ethereum-types" to={WebsitePaths.EthereumTypes} className="text-decoration-none">
+ <MenuItem
+ style={{ fontSize: styles.menuItem.fontSize }}
+ primaryText={this.props.translate.get(Key.EthereumTypes, Deco.CapWords)}
+ />
+ </Link>,
<a
key="subMenuItem-whitePaper"
target="_blank"
diff --git a/packages/website/ts/containers/ethereum_types_documentation.ts b/packages/website/ts/containers/ethereum_types_documentation.ts
new file mode 100644
index 000000000..ab0c88316
--- /dev/null
+++ b/packages/website/ts/containers/ethereum_types_documentation.ts
@@ -0,0 +1,124 @@
+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/ethereum_types/introduction');
+const InstallationMarkdown = require('md/docs/ethereum_types/installation');
+/* tslint:enable:no-var-requires */
+
+const docSections = {
+ introduction: 'introduction',
+ installation: 'installation',
+ types: docConstants.TYPES_SECTION_NAME,
+};
+
+const docsInfoConfig: DocsInfoConfig = {
+ id: DocPackages.EthereumTypes,
+ type: SupportedDocJson.TypeDoc,
+ displayName: 'Ethereum Types',
+ packageUrl: 'https://github.com/0xProject/0x-monorepo/packages/ethereum-types',
+ menu: {
+ introduction: [docSections.introduction],
+ install: [docSections.installation],
+ types: [docSections.types],
+ },
+ sectionNameToMarkdown: {
+ [docSections.introduction]: IntroMarkdown,
+ [docSections.installation]: InstallationMarkdown,
+ },
+ sectionNameToModulePath: {
+ [docSections.types]: ['"index"'],
+ },
+ visibleConstructors: [],
+ menuSubsectionToVersionWhenIntroduced: {},
+ sections: docSections,
+ 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: [
+ 'Provider',
+ 'JSONRPCErrorCallback',
+ 'Provider',
+ 'ContractAbi',
+ 'AbiDefinition',
+ 'FunctionAbi',
+ 'ConstructorStateMutability',
+ 'StateMutability',
+ 'MethodAbi',
+ 'ConstructorAbi',
+ 'FallbackAbi',
+ 'EventParameter',
+ 'EventAbi',
+ 'DataItem',
+ 'OpCode',
+ // 'StructLog',
+ 'TransactionTrace',
+ 'Unit',
+ 'JSONRPCRequestPayload',
+ 'JSONRPCResponsePayload',
+ 'BlockWithoutTransactionData',
+ 'BlockWithTransactionData',
+ 'Transaction',
+ 'TxData',
+ 'CallData',
+ 'FilterObject',
+ 'LogTopic',
+ 'DecodedLogEntry',
+ 'DecodedLogEntryEvent',
+ 'LogEntryEvent',
+ 'LogEntry',
+ 'TxDataPayable',
+ 'TransactionReceipt',
+ 'AbiType',
+ 'ContractEventArg',
+ 'DecodedLogArgs',
+ 'LogWithDecodedArgs',
+ 'RawLog',
+ 'BlockParamLiteral',
+ 'BlockParam',
+ 'RawLogEntry',
+ 'SolidityTypes',
+ 'TransactionReceiptWithDecodedLogs',
+ ],
+ 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 a6bfe7dd2..719604c02 100644
--- a/packages/website/ts/index.tsx
+++ b/packages/website/ts/index.tsx
@@ -69,6 +69,9 @@ const LazySubprovidersDocumentation = createLazyComponent('Documentation', async
const LazyOrderUtilsDocumentation = createLazyComponent('Documentation', async () =>
System.import<any>(/* webpackChunkName: "orderUtilsDocs" */ 'ts/containers/order_utils_documentation'),
);
+const LazyEthereumTypesDocumentation = createLazyComponent('Documentation', async () =>
+ System.import<any>(/* webpackChunkName: "ethereumTypesDocs" */ 'ts/containers/ethereum_types_documentation'),
+);
analytics.init();
// tslint:disable-next-line:no-floating-promises
@@ -116,6 +119,10 @@ render(
path={`${WebsitePaths.SmartContracts}/:version?`}
component={LazySmartContractsDocumentation}
/>
+ <Route
+ path={`${WebsitePaths.EthereumTypes}/:version?`}
+ component={LazyEthereumTypesDocumentation}
+ />
{/* Legacy endpoints */}
<Route
diff --git a/packages/website/ts/pages/documentation/doc_page.tsx b/packages/website/ts/pages/documentation/doc_page.tsx
index 17efc56ed..c25577628 100644
--- a/packages/website/ts/pages/documentation/doc_page.tsx
+++ b/packages/website/ts/pages/documentation/doc_page.tsx
@@ -35,6 +35,7 @@ const docIdToSubpackageName: { [id: string]: string } = {
[DocPackages.SolCov]: 'sol-cov',
[DocPackages.Subproviders]: 'subproviders',
[DocPackages.OrderUtils]: 'order-utils',
+ [DocPackages.EthereumTypes]: 'ethereum-types',
};
export interface DocPageProps {
diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts
index 9567e129b..6bc928048 100644
--- a/packages/website/ts/types.ts
+++ b/packages/website/ts/types.ts
@@ -370,6 +370,7 @@ export enum WebsitePaths {
SolCov = '/docs/sol-cov',
Subproviders = '/docs/subproviders',
OrderUtils = '/docs/order-utils',
+ EthereumTypes = '/docs/ethereum-types',
Jobs = '/jobs',
}
@@ -383,6 +384,7 @@ export enum DocPackages {
SolCov = 'SOL_COV',
Subproviders = 'SUBPROVIDERS',
OrderUtils = 'ORDER_UTILS',
+ EthereumTypes = 'ETHEREUM_TYPES',
}
export enum Key {
@@ -434,6 +436,7 @@ export enum Key {
SolCompiler = 'SOL_COMPILER',
JsonSchemas = 'JSON_SCHEMAS',
SolCov = 'SOL_COV',
+ EthereumTypes = 'ETHEREUM_TYPES',
Subproviders = 'SUBPROVIDERS',
Blog = 'BLOG',
Forum = 'FORUM',
diff --git a/packages/website/ts/utils/doc_utils.ts b/packages/website/ts/utils/doc_utils.ts
index 2a599bcbe..4db7235da 100644
--- a/packages/website/ts/utils/doc_utils.ts
+++ b/packages/website/ts/utils/doc_utils.ts
@@ -8,7 +8,7 @@ import convert = require('xml-js');
export const docUtils = {
async getVersionToFilePathAsync(s3DocJsonRoot: string, folderName: string): Promise<VersionToFilePath> {
- const versionFilePaths = await this.getVersionFileNamesAsync(s3DocJsonRoot, folderName);
+ const versionFilePaths = await docUtils.getVersionFileNamesAsync(s3DocJsonRoot, folderName);
const versionToFilePath: VersionToFilePath = {};
_.each(versionFilePaths, filePath => {
const [version] = findVersions(filePath);