aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-06-07 07:36:11 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-06-07 07:36:11 +0800
commite0d5b9daf84cba31bbbcd2cfbe1f64623eace61a (patch)
tree84929c7ae4e95896dacfb69517aaaba97ec8ad85 /packages/website
parenta97d77064aacda3de74b04894f110b05298c5ca8 (diff)
parent785b9811f30869f01242ce9ff81c282bf7f5352f (diff)
downloaddexon-sol-tools-e0d5b9daf84cba31bbbcd2cfbe1f64623eace61a.tar
dexon-sol-tools-e0d5b9daf84cba31bbbcd2cfbe1f64623eace61a.tar.gz
dexon-sol-tools-e0d5b9daf84cba31bbbcd2cfbe1f64623eace61a.tar.bz2
dexon-sol-tools-e0d5b9daf84cba31bbbcd2cfbe1f64623eace61a.tar.lz
dexon-sol-tools-e0d5b9daf84cba31bbbcd2cfbe1f64623eace61a.tar.xz
dexon-sol-tools-e0d5b9daf84cba31bbbcd2cfbe1f64623eace61a.tar.zst
dexon-sol-tools-e0d5b9daf84cba31bbbcd2cfbe1f64623eace61a.zip
Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into feature/improve-linting
Diffstat (limited to 'packages/website')
-rw-r--r--packages/website/md/docs/ethereum_types/installation.md11
-rw-r--r--packages/website/md/docs/ethereum_types/introduction.md1
-rw-r--r--packages/website/translations/chinese.json1
-rw-r--r--packages/website/translations/english.json1
-rw-r--r--packages/website/translations/korean.json1
-rw-r--r--packages/website/translations/russian.json1
-rw-r--r--packages/website/translations/spanish.json1
-rw-r--r--packages/website/ts/components/top_bar/top_bar.tsx17
-rw-r--r--packages/website/ts/components/wallet/wallet.tsx23
-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
14 files changed, 184 insertions, 10 deletions
diff --git a/packages/website/md/docs/ethereum_types/installation.md b/packages/website/md/docs/ethereum_types/installation.md
new file mode 100644
index 000000000..5371cfa47
--- /dev/null
+++ b/packages/website/md/docs/ethereum_types/installation.md
@@ -0,0 +1,11 @@
+**Install**
+
+```bash
+yarn add ethereum-types
+```
+
+**Import**
+
+```typescript
+import { Provider } from 'ethereum-types';
+```
diff --git a/packages/website/md/docs/ethereum_types/introduction.md b/packages/website/md/docs/ethereum_types/introduction.md
new file mode 100644
index 000000000..43484cdd1
--- /dev/null
+++ b/packages/website/md/docs/ethereum_types/introduction.md
@@ -0,0 +1 @@
+Welcome to the [ethereum-types](https://github.com/0xProject/0x-monorepo/packages/ethereum-types) documentation! This package provides ethereum specific (but not library-specific) types that are meant to be shared between other ethereum packages.
diff --git a/packages/website/translations/chinese.json b/packages/website/translations/chinese.json
index 966457a93..3e9f21370 100644
--- a/packages/website/translations/chinese.json
+++ b/packages/website/translations/chinese.json
@@ -59,6 +59,7 @@
"SOL_COMPILER": "Solidity Compiler",
"JSON_SCHEMAS": "JSON Schemas",
"SOL_COV": "Solidity Coverage",
+ "ETHEREUM_TYPES": "Ethereum Types",
"SUBPROVIDERS": "Subproviders",
"BLOG": "博客",
"FORUM": "论坛",
diff --git a/packages/website/translations/english.json b/packages/website/translations/english.json
index f3acea3be..04fb0507a 100644
--- a/packages/website/translations/english.json
+++ b/packages/website/translations/english.json
@@ -60,6 +60,7 @@
"SOL_COMPILER": "Solidity Compiler",
"JSON_SCHEMAS": "JSON Schemas",
"SOL_COV": "Solidity Coverage",
+ "ETHEREUM_TYPES": "Ethereum Types",
"SUBPROVIDERS": "Subproviders",
"BLOG": "blog",
"FORUM": "forum",
diff --git a/packages/website/translations/korean.json b/packages/website/translations/korean.json
index 7414207f7..c38de6677 100644
--- a/packages/website/translations/korean.json
+++ b/packages/website/translations/korean.json
@@ -59,6 +59,7 @@
"SOL_COMPILER": "Solidity Compiler",
"JSON_SCHEMAS": "JSON Schemas",
"SOL_COV": "Solidity Coverage",
+ "ETHEREUM_TYPES": "Ethereum Types",
"SUBPROVIDERS": "Subproviders",
"BLOG": "블로그",
"FORUM": "포럼",
diff --git a/packages/website/translations/russian.json b/packages/website/translations/russian.json
index 75ab02a27..a7e06d646 100644
--- a/packages/website/translations/russian.json
+++ b/packages/website/translations/russian.json
@@ -59,6 +59,7 @@
"SOL_COMPILER": "Solidity Compiler",
"JSON_SCHEMAS": "JSON Schemas",
"SOL_COV": "Solidity Coverage",
+ "ETHEREUM_TYPES": "Ethereum Types",
"SUBPROVIDERS": "Subproviders",
"BLOG": "Блог",
"FORUM": "Форум",
diff --git a/packages/website/translations/spanish.json b/packages/website/translations/spanish.json
index 8f537ea40..5a8920f61 100644
--- a/packages/website/translations/spanish.json
+++ b/packages/website/translations/spanish.json
@@ -60,6 +60,7 @@
"SOL_COMPILER": "Solidity Compiler",
"JSON_SCHEMAS": "JSON Schemas",
"SOL_COV": "Solidity Coverage",
+ "ETHEREUM_TYPES": "Ethereum Types",
"SUBPROVIDERS": "Subproviders",
"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 8fcf5bbae..05cc6e3ad 100644
--- a/packages/website/ts/components/top_bar/top_bar.tsx
+++ b/packages/website/ts/components/top_bar/top_bar.tsx
@@ -162,6 +162,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"
@@ -376,6 +382,14 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
</MenuItem>
</Link>
)}
+ {!this._isViewingEthereumTypesDocs() && (
+ <Link to={WebsitePaths.EthereumTypes} className="text-decoration-none">
+ <MenuItem className="py2">
+ {this.props.translate.get(Key.EthereumTypes, 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">
@@ -502,6 +516,9 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
private _isViewingSubprovidersDocs(): boolean {
return _.includes(this.props.location.pathname, WebsitePaths.Subproviders);
}
+ private _isViewingEthereumTypesDocs(): boolean {
+ return _.includes(this.props.location.pathname, WebsitePaths.EthereumTypes);
+ }
private _isViewingWiki(): boolean {
return _.includes(this.props.location.pathname, WebsitePaths.Wiki);
}
diff --git a/packages/website/ts/components/wallet/wallet.tsx b/packages/website/ts/components/wallet/wallet.tsx
index 4f099d636..977902103 100644
--- a/packages/website/ts/components/wallet/wallet.tsx
+++ b/packages/website/ts/components/wallet/wallet.tsx
@@ -124,7 +124,7 @@ const styles: Styles = {
const ETHER_ICON_PATH = '/images/ether.png';
const ICON_DIMENSION = 28;
-const TOKEN_AMOUNT_DISPLAY_PRECISION = 3;
+const TOKEN_AMOUNT_DISPLAY_PRECISION = 5;
const BODY_ITEM_KEY = 'BODY';
const HEADER_ITEM_KEY = 'HEADER';
const FOOTER_ITEM_KEY = 'FOOTER';
@@ -434,14 +434,19 @@ export class Wallet extends React.Component<WalletProps, WalletState> {
symbol: string,
isLoading: boolean = false,
): React.ReactNode {
- const unitAmount = Web3Wrapper.toUnitAmount(amount, decimals);
- const formattedAmount = unitAmount.toPrecision(TOKEN_AMOUNT_DISPLAY_PRECISION);
- const result = `${formattedAmount} ${symbol}`;
- return (
- <PlaceHolder hideChildren={isLoading}>
- <div style={styles.amountLabel}>{result}</div>
- </PlaceHolder>
- );
+ if (isLoading) {
+ return (
+ <PlaceHolder hideChildren={isLoading}>
+ <div style={styles.amountLabel}>0.00 XXX</div>
+ </PlaceHolder>
+ );
+ } else {
+ const unitAmount = Web3Wrapper.toUnitAmount(amount, decimals);
+ const precision = Math.min(TOKEN_AMOUNT_DISPLAY_PRECISION, unitAmount.decimalPlaces());
+ const formattedAmount = unitAmount.toFixed(precision);
+ const result = `${formattedAmount} ${symbol}`;
+ return <div style={styles.amountLabel}>{result}</div>;
+ }
}
private _renderValue(
amount: BigNumber,
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..28d3d92dc
--- /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', // TODO: This type breaks the docs so we don't render it for now
+ '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 4dffa13f1..8159bbd49 100644
--- a/packages/website/ts/pages/documentation/doc_page.tsx
+++ b/packages/website/ts/pages/documentation/doc_page.tsx
@@ -33,6 +33,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 5481e90be..15444e517 100644
--- a/packages/website/ts/types.ts
+++ b/packages/website/ts/types.ts
@@ -369,6 +369,7 @@ export enum WebsitePaths {
SolCov = '/docs/sol-cov',
Subproviders = '/docs/subproviders',
OrderUtils = '/docs/order-utils',
+ EthereumTypes = '/docs/ethereum-types',
Jobs = '/jobs',
}
@@ -382,6 +383,7 @@ export enum DocPackages {
SolCov = 'SOL_COV',
Subproviders = 'SUBPROVIDERS',
OrderUtils = 'ORDER_UTILS',
+ EthereumTypes = 'ETHEREUM_TYPES',
}
export enum Key {
@@ -433,6 +435,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 019a29f5c..7768835fb 100644
--- a/packages/website/ts/utils/doc_utils.ts
+++ b/packages/website/ts/utils/doc_utils.ts
@@ -7,7 +7,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);