diff options
author | Jacob Evans <dekz@dekz.net> | 2018-04-12 08:20:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-12 08:20:52 +0800 |
commit | be73084e04264d44cfbd7cf6b8ba3a993368133d (patch) | |
tree | 68fc540971871fd99d0977957ac20132d6efed60 /packages/website | |
parent | 63b941fbaf08167234cf7871e874c1a96e4347fa (diff) | |
parent | 5eb90697c824f1c98467cdb6cd71dbb94ff70805 (diff) | |
download | dexon-0x-contracts-be73084e04264d44cfbd7cf6b8ba3a993368133d.tar.gz dexon-0x-contracts-be73084e04264d44cfbd7cf6b8ba3a993368133d.tar.zst dexon-0x-contracts-be73084e04264d44cfbd7cf6b8ba3a993368133d.zip |
Merge branch 'development' into feature/subproviders/mnemonic-wallet-subprovider
Diffstat (limited to 'packages/website')
-rw-r--r-- | packages/website/package.json | 20 | ||||
-rw-r--r-- | packages/website/public/images/landing/project_logos/ercdex.png | bin | 5726 -> 3929 bytes | |||
-rw-r--r-- | packages/website/ts/blockchain.ts | 26 | ||||
-rw-r--r-- | packages/website/ts/components/top_bar/top_bar.tsx | 12 | ||||
-rw-r--r-- | packages/website/ts/containers/sol_cov_documentation.ts | 8 | ||||
-rw-r--r-- | packages/website/ts/containers/subproviders_documentation.ts | 12 | ||||
-rw-r--r-- | packages/website/ts/containers/web3_wrapper_documentation.ts | 31 | ||||
-rw-r--r-- | packages/website/ts/containers/zero_ex_js_documentation.ts | 18 | ||||
-rw-r--r-- | packages/website/ts/index.tsx | 13 | ||||
-rw-r--r-- | packages/website/ts/pages/documentation/doc_page.tsx | 8 | ||||
-rw-r--r-- | packages/website/ts/types.ts | 9 | ||||
-rw-r--r-- | packages/website/ts/utils/utils.ts | 8 |
12 files changed, 109 insertions, 56 deletions
diff --git a/packages/website/package.json b/packages/website/package.json index 7d0c68b47..a8011dc8d 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/website", - "version": "0.0.24", + "version": "0.0.25", "private": true, "description": "Website and 0x portal dapp", "scripts": { @@ -8,23 +8,19 @@ "clean": "shx rm -f public/bundle*", "lint": "tslint --project . 'ts/**/*.ts' 'ts/**/*.tsx'", "dev": "webpack-dev-server --content-base public --https", - "update_contracts": "for i in ${npm_package_config_artifacts}; do copyfiles -u 4 ../contracts/build/contracts/$i.json ../website/contracts; done;", "deploy_staging": "npm run build; aws s3 sync ./public/. s3://staging-0xproject --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers", "deploy_live": "npm run build; aws s3 sync ./public/. s3://0xproject.com --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers" }, - "config": { - "artifacts": "Mintable" - }, "author": "Fabio Berger", "license": "Apache-2.0", "dependencies": { - "0x.js": "^0.35.0", - "@0xproject/react-docs": "^0.0.6", - "@0xproject/react-shared": "^0.1.1", - "@0xproject/subproviders": "^0.8.4", - "@0xproject/typescript-typings": "^0.0.3", - "@0xproject/utils": "^0.5.0", - "@0xproject/web3-wrapper": "^0.5.0", + "0x.js": "^0.36.0", + "@0xproject/react-docs": "^0.0.7", + "@0xproject/react-shared": "^0.1.2", + "@0xproject/subproviders": "^0.8.5", + "@0xproject/typescript-typings": "^0.1.0", + "@0xproject/utils": "^0.5.1", + "@0xproject/web3-wrapper": "^0.6.0", "accounting": "^0.4.1", "basscss": "^8.0.3", "blockies": "^0.0.2", diff --git a/packages/website/public/images/landing/project_logos/ercdex.png b/packages/website/public/images/landing/project_logos/ercdex.png Binary files differindex 1367837e0..31d137be7 100644 --- a/packages/website/public/images/landing/project_logos/ercdex.png +++ b/packages/website/public/images/landing/project_logos/ercdex.png diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts index bb1f47dd0..99e4856ce 100644 --- a/packages/website/ts/blockchain.ts +++ b/packages/website/ts/blockchain.ts @@ -20,7 +20,9 @@ import { InjectedWeb3Subprovider, ledgerEthereumBrowserClientFactoryAsync, LedgerSubprovider, - RedundantRPCSubprovider, + LedgerWalletSubprovider, + RedundantSubprovider, + Subprovider, } from '@0xproject/subproviders'; import { Provider } from '@0xproject/types'; import { BigNumber, intervalUtils, logUtils, promisify } from '@0xproject/utils'; @@ -53,6 +55,7 @@ import { utils } from 'ts/utils/utils'; import Web3 = require('web3'); import ProviderEngine = require('web3-provider-engine'); import FilterSubprovider = require('web3-provider-engine/subproviders/filters'); +import RpcSubprovider = require('web3-provider-engine/subproviders/rpc'); import * as MintableArtifacts from '../contracts/Mintable.json'; @@ -97,7 +100,12 @@ export class Blockchain { provider = new ProviderEngine(); provider.addProvider(new InjectedWeb3Subprovider(injectedWeb3.currentProvider)); provider.addProvider(new FilterSubprovider()); - provider.addProvider(new RedundantRPCSubprovider(publicNodeUrlsIfExistsForNetworkId)); + const rpcSubproviders = _.map(publicNodeUrlsIfExistsForNetworkId, publicNodeUrl => { + return new RpcSubprovider({ + rpcUrl: publicNodeUrl, + }); + }); + provider.addProvider(new RedundantSubprovider(rpcSubproviders as Subprovider[])); provider.start(); } else if (doesInjectedWeb3Exist) { // Since no public node for this network, all requests go to injectedWeb3 instance @@ -109,7 +117,12 @@ export class Blockchain { provider = new ProviderEngine(); provider.addProvider(new FilterSubprovider()); const networkId = configs.IS_MAINNET_ENABLED ? constants.NETWORK_ID_MAINNET : constants.NETWORK_ID_KOVAN; - provider.addProvider(new RedundantRPCSubprovider(configs.PUBLIC_NODE_URLS_BY_NETWORK_ID[networkId])); + const rpcSubproviders = _.map(configs.PUBLIC_NODE_URLS_BY_NETWORK_ID[networkId], publicNodeUrl => { + return new RpcSubprovider({ + rpcUrl: publicNodeUrl, + }); + }); + provider.addProvider(new RedundantSubprovider(rpcSubproviders as Subprovider[])); provider.start(); } @@ -194,7 +207,12 @@ export class Blockchain { this._ledgerSubprovider = new LedgerSubprovider(ledgerWalletConfigs); provider.addProvider(this._ledgerSubprovider); provider.addProvider(new FilterSubprovider()); - provider.addProvider(new RedundantRPCSubprovider(configs.PUBLIC_NODE_URLS_BY_NETWORK_ID[networkId])); + const rpcSubproviders = _.map(configs.PUBLIC_NODE_URLS_BY_NETWORK_ID[networkId], publicNodeUrl => { + return new RpcSubprovider({ + rpcUrl: publicNodeUrl, + }); + }); + provider.addProvider(new RedundantSubprovider(rpcSubproviders as Subprovider[])); provider.start(); this.networkId = networkId; this._dispatcher.updateNetworkId(this.networkId); diff --git a/packages/website/ts/components/top_bar/top_bar.tsx b/packages/website/ts/components/top_bar/top_bar.tsx index 4b2e82119..13351dcdc 100644 --- a/packages/website/ts/components/top_bar/top_bar.tsx +++ b/packages/website/ts/components/top_bar/top_bar.tsx @@ -15,7 +15,7 @@ import { TopBarMenuItem } from 'ts/components/top_bar/top_bar_menu_item'; import { DropDown } from 'ts/components/ui/drop_down'; import { Identicon } from 'ts/components/ui/identicon'; import { Dispatcher } from 'ts/redux/dispatcher'; -import { Deco, Key, ProviderType, WebsitePaths } from 'ts/types'; +import { Deco, Key, ProviderType, WebsiteLegacyPaths, WebsitePaths } from 'ts/types'; import { constants } from 'ts/utils/constants'; import { Translate } from 'ts/utils/translate'; @@ -462,7 +462,10 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> { return _.includes(this.props.location.pathname, WebsitePaths.FAQ); } private _isViewing0xjsDocs() { - return _.includes(this.props.location.pathname, WebsitePaths.ZeroExJs); + return ( + _.includes(this.props.location.pathname, WebsitePaths.ZeroExJs) || + _.includes(this.props.location.pathname, WebsiteLegacyPaths.ZeroExJs) + ); } private _isViewingConnectDocs() { return _.includes(this.props.location.pathname, WebsitePaths.Connect); @@ -471,7 +474,10 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> { return _.includes(this.props.location.pathname, WebsitePaths.SmartContracts); } private _isViewingWeb3WrapperDocs() { - return _.includes(this.props.location.pathname, WebsitePaths.Web3Wrapper); + return ( + _.includes(this.props.location.pathname, WebsitePaths.Web3Wrapper) || + _.includes(this.props.location.pathname, WebsiteLegacyPaths.Web3Wrapper) + ); } private _isViewingDeployerDocs() { return _.includes(this.props.location.pathname, WebsitePaths.Deployer); diff --git a/packages/website/ts/containers/sol_cov_documentation.ts b/packages/website/ts/containers/sol_cov_documentation.ts index 2b901ec6f..58755c1e0 100644 --- a/packages/website/ts/containers/sol_cov_documentation.ts +++ b/packages/website/ts/containers/sol_cov_documentation.ts @@ -44,7 +44,7 @@ const docsInfoConfig: DocsInfoConfig = { }, sectionNameToModulePath: { [docSections.coverageSubprovider]: ['"sol-cov/src/coverage_subprovider"'], - [docSections.types]: ['"subproviders/src/types"'], + [docSections.types]: ['"subproviders/src/types"', '"types/src/index"'], }, menuSubsectionToVersionWhenIntroduced: {}, sections: docSections, @@ -52,11 +52,9 @@ const docsInfoConfig: DocsInfoConfig = { 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'], + publicTypes: ['NextCallback', 'OnNextCompleted', 'ErrorCallback', 'JSONRPCRequestPayload'], typeNameToExternalLink: {}, - typeNameToPrefix: { - JSONRPCRequestPayload: 'Web3', - }, + typeNameToPrefix: {}, typeNameToDocSection: {}, }, }; diff --git a/packages/website/ts/containers/subproviders_documentation.ts b/packages/website/ts/containers/subproviders_documentation.ts index 2462c4157..017d708a4 100644 --- a/packages/website/ts/containers/subproviders_documentation.ts +++ b/packages/website/ts/containers/subproviders_documentation.ts @@ -99,6 +99,7 @@ const docsInfoConfig: DocsInfoConfig = { 'ErrorCallback', 'ECSignature', 'JSONRPCRequestPayloadWithMethod', + 'JSONRPCRequestPayload', 'JSONRPCResponsePayload', 'AccountFetchingConfigs', 'LedgerEthereumClientFactoryAsync', @@ -106,19 +107,14 @@ const docsInfoConfig: DocsInfoConfig = { 'LedgerEthereumClient', 'LedgerSubproviderConfigs', 'MnemonicWalletSubproviderConfigs', + 'OnNextCompleted', + 'Provider', ], 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', }, + typeNameToPrefix: {}, }, }; const docsInfo = new DocsInfo(docsInfoConfig); diff --git a/packages/website/ts/containers/web3_wrapper_documentation.ts b/packages/website/ts/containers/web3_wrapper_documentation.ts index 289006f10..9c0ca9b9a 100644 --- a/packages/website/ts/containers/web3_wrapper_documentation.ts +++ b/packages/website/ts/containers/web3_wrapper_documentation.ts @@ -39,7 +39,7 @@ const docsInfoConfig: DocsInfoConfig = { [docSections.installation]: InstallationMarkdown, }, sectionNameToModulePath: { - [docSections.web3Wrapper]: ['"web3-wrapper/src/index"'], + [docSections.web3Wrapper]: ['"web3-wrapper/src/web3_wrapper"'], [docSections.types]: ['"types/src/index"'], }, menuSubsectionToVersionWhenIntroduced: {}, @@ -59,15 +59,36 @@ const docsInfoConfig: DocsInfoConfig = { 'BlockWithoutTransactionData', 'CallData', 'LogEntryEvent', + 'Provider', + 'AbiDefinition', + 'LogTopic', + 'JSONRPCRequestPayload', + 'JSONRPCResponsePayload', + 'BlockParamLiteral', + 'FunctionAbi', + 'EventAbi', + 'JSONRPCErrorCallback', + 'MethodAbi', + 'ConstructorAbi', + 'FallbackAbi', + 'EventParameter', + 'DataItem', + 'StateMutability', + 'Function', + 'Fallback', + 'Constructor', + 'Event', + 'ConstructorStateMutability', + 'TransactionReceiptWithDecodedLogs', + 'DecodedLogArgs', + 'LogWithDecodedArgs', + 'ContractEventArg', ], 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: 'http://mikemcl.github.io/bignumber.js', }, - typeNameToPrefix: { - Provider: 'Web3', - }, + typeNameToPrefix: {}, typeNameToDocSection: { Web3Wrapper: docSections.web3Wrapper, }, diff --git a/packages/website/ts/containers/zero_ex_js_documentation.ts b/packages/website/ts/containers/zero_ex_js_documentation.ts index da8922e79..40853cb9e 100644 --- a/packages/website/ts/containers/zero_ex_js_documentation.ts +++ b/packages/website/ts/containers/zero_ex_js_documentation.ts @@ -168,21 +168,15 @@ const docsInfoConfig: DocsInfoConfig = { 'OrderStateWatcherConfig', 'FilterObject', 'OrderRelevantState', + 'JSONRPCRequestPayload', + 'JSONRPCResponsePayload', + 'JSONRPCErrorCallback', + 'LogEntryEvent', + 'LogEntry', ], - typeNameToPrefix: { - Provider: 'Web3', - DecodedLogEntryEvent: 'Web3', - LogEntryEvent: 'Web3', - CallData: 'Web3', - LogEntry: 'Web3', - }, + typeNameToPrefix: {}, typeNameToExternalLink: { - Web3: constants.URL_WEB3_DOCS, - Provider: constants.URL_WEB3_PROVIDER_DOCS, BigNumber: constants.URL_BIGNUMBERJS_GITHUB, - DecodedLogEntryEvent: constants.URL_WEB3_DECODED_LOG_ENTRY_EVENT, - LogEntryEvent: constants.URL_WEB3_LOG_ENTRY_EVENT, - LogEntry: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L366', }, typeNameToDocSection: { ExchangeWrapper: 'exchange', diff --git a/packages/website/ts/index.tsx b/packages/website/ts/index.tsx index d542bd804..5bc36da32 100644 --- a/packages/website/ts/index.tsx +++ b/packages/website/ts/index.tsx @@ -15,7 +15,7 @@ import { createLazyComponent } from 'ts/lazy_component'; import { trackedTokenStorage } from 'ts/local_storage/tracked_token_storage'; import { tradeHistoryStorage } from 'ts/local_storage/trade_history_storage'; import { reducer, State } from 'ts/redux/reducer'; -import { WebsitePaths } from 'ts/types'; +import { WebsiteLegacyPaths, WebsitePaths } from 'ts/types'; import { analytics } from 'ts/utils/analytics'; import { muiTheme } from 'ts/utils/mui_theme'; import { utils } from 'ts/utils/utils'; @@ -98,6 +98,17 @@ render( path={`${WebsitePaths.SmartContracts}/:version?`} component={LazySmartContractsDocumentation} /> + + {/* Legacy endpoints */} + <Route + path={`${WebsiteLegacyPaths.ZeroExJs}/:version?`} + component={LazyZeroExJSDocumentation} + /> + <Route + path={`${WebsiteLegacyPaths.Web3Wrapper}/:version?`} + component={LazyWeb3WrapperDocumentation} + /> + <Route component={NotFound as any} /> </Switch> </div> diff --git a/packages/website/ts/pages/documentation/doc_page.tsx b/packages/website/ts/pages/documentation/doc_page.tsx index 8ec1a023d..aca20447b 100644 --- a/packages/website/ts/pages/documentation/doc_page.tsx +++ b/packages/website/ts/pages/documentation/doc_page.tsx @@ -8,14 +8,14 @@ import semverSort = require('semver-sort'); import { SidebarHeader } from 'ts/components/sidebar_header'; import { TopBar } from 'ts/components/top_bar/top_bar'; import { Dispatcher } from 'ts/redux/dispatcher'; -import { DocPackages, Environments } from 'ts/types'; +import { DocPackages } from 'ts/types'; import { configs } from 'ts/utils/configs'; import { constants } from 'ts/utils/constants'; import { docUtils } from 'ts/utils/doc_utils'; import { Translate } from 'ts/utils/translate'; import { utils } from 'ts/utils/utils'; -const isDevelopment = configs.ENVIRONMENT === Environments.DEVELOPMENT; +const isDevelopmentOrStaging = utils.isDevelopment() || utils.isStaging(); const DEFAULT_ICON = 'docs.png'; const ZERO_EX_JS_VERSION_MISSING_TOPLEVEL_PATH = '0.32.4'; @@ -106,7 +106,9 @@ export class DocPage extends React.Component<DocPageProps, DocPageState> { } private async _fetchJSONDocsFireAndForgetAsync(preferredVersionIfExists?: string): Promise<void> { const folderName = docIdToSubpackageName[this.props.docsInfo.id]; - const docBucketRoot = isDevelopment ? constants.S3_STAGING_DOC_BUCKET_ROOT : constants.S3_DOC_BUCKET_ROOT; + const docBucketRoot = isDevelopmentOrStaging + ? 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); diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts index dba59f704..c03e5676f 100644 --- a/packages/website/ts/types.ts +++ b/packages/website/ts/types.ts @@ -341,17 +341,22 @@ export enum Docs { SmartContracts, } +export enum WebsiteLegacyPaths { + ZeroExJs = '/docs/0xjs', + Web3Wrapper = '/docs/web3_wrapper', +} + export enum WebsitePaths { Portal = '/portal', Wiki = '/wiki', - ZeroExJs = '/docs/0xjs', + ZeroExJs = '/docs/0x.js', Home = '/', FAQ = '/faq', About = '/about', Whitepaper = '/pdfs/0x_white_paper.pdf', SmartContracts = '/docs/contracts', Connect = '/docs/connect', - Web3Wrapper = '/docs/web3_wrapper', + Web3Wrapper = '/docs/web3-wrapper', Deployer = '/docs/deployer', JSONSchemas = '/docs/json-schemas', SolCov = '/docs/sol-cov', diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts index afe159beb..53d60b3ce 100644 --- a/packages/website/ts/utils/utils.ts +++ b/packages/website/ts/utils/utils.ts @@ -5,7 +5,7 @@ import { BigNumber } from '@0xproject/utils'; import deepEqual = require('deep-equal'); import * as _ from 'lodash'; import * as moment from 'moment'; -import { Order, Providers, ScreenWidths, Side, SideToAssetToken, Token, TokenByAddress } from 'ts/types'; +import { Environments, Order, Providers, ScreenWidths, Side, SideToAssetToken, Token, TokenByAddress } from 'ts/types'; import { configs } from 'ts/utils/configs'; import { constants } from 'ts/utils/constants'; import * as u2f from 'ts/vendor/u2f_api'; @@ -292,4 +292,10 @@ export const utils = { } return parsedProviderName; }, + isDevelopment() { + return configs.ENVIRONMENT === Environments.DEVELOPMENT; + }, + isStaging() { + return _.includes(window.location.href, configs.DOMAIN_STAGING); + }, }; |