diff options
Diffstat (limited to 'packages')
22 files changed, 103 insertions, 51 deletions
diff --git a/packages/0x.js/CHANGELOG.json b/packages/0x.js/CHANGELOG.json index 6d5dc0dd2..96bef0ebe 100644 --- a/packages/0x.js/CHANGELOG.json +++ b/packages/0x.js/CHANGELOG.json @@ -13,7 +13,7 @@ "changes": [ { "note": - "Removed `ZeroExError.TransactionMiningTimeout` and moved it to '@0xproject/web3_wrapper' `Web3WrapperErrors.TransactionMiningTimeout`", + "Removed `ZeroExError.TransactionMiningTimeout` and moved it to '@0xproject/web3-wrapper' `Web3WrapperErrors.TransactionMiningTimeout`", "pr": 485 } ], diff --git a/packages/0x.js/README.md b/packages/0x.js/README.md index cfa353504..72e5cc5fd 100644 --- a/packages/0x.js/README.md +++ b/packages/0x.js/README.md @@ -2,7 +2,7 @@ A TypeScript/Javascript library for interacting with the 0x protocol. -### Read the [Documentation](https://0xproject.com/docs/0xjs). +### Read the [Documentation](https://0xproject.com/docs/0x.js). ## Installation diff --git a/packages/dev-utils/CHANGELOG.json b/packages/dev-utils/CHANGELOG.json index 64ef4b000..a9e8e5a4a 100644 --- a/packages/dev-utils/CHANGELOG.json +++ b/packages/dev-utils/CHANGELOG.json @@ -24,7 +24,7 @@ "note": "Reduce npm package size by adding an `.npmignore` file." }, { - "note": "Move `@0xproject/web3_wrapper` to dependencies from devDependencies." + "note": "Move `@0xproject/web3-wrapper` to dependencies from devDependencies." } ], "timestamp": 1521298800 diff --git a/packages/dev-utils/CHANGELOG.md b/packages/dev-utils/CHANGELOG.md index 2e3953750..1f8062693 100644 --- a/packages/dev-utils/CHANGELOG.md +++ b/packages/dev-utils/CHANGELOG.md @@ -16,7 +16,7 @@ CHANGELOG ## v0.3.1 - _March 17, 2018_ * Reduce npm package size by adding an `.npmignore` file. - * Move `@0xproject/web3_wrapper` to dependencies from devDependencies. + * Move `@0xproject/web3-wrapper` to dependencies from devDependencies. ## v0.3.0 - _March 17, 2018_ diff --git a/packages/react-docs/src/components/documentation.tsx b/packages/react-docs/src/components/documentation.tsx index 14fe175cf..800892dc8 100644 --- a/packages/react-docs/src/components/documentation.tsx +++ b/packages/react-docs/src/components/documentation.tsx @@ -337,7 +337,7 @@ export class Documentation extends React.Component<DocumentationProps, Documenta return ( <div key={`property-${property.name}-${property.type.name}`} className="pb3"> <code className={`hljs ${constants.TYPE_TO_SYNTAX[this.props.docsInfo.type]}`}> - {property.name}: + {property.name}:{' '} <Type type={property.type} sectionName={sectionName} docsInfo={this.props.docsInfo} /> </code> {property.source && ( diff --git a/packages/react-docs/src/components/interface.tsx b/packages/react-docs/src/components/interface.tsx index 541e164e3..bdfdf47c4 100644 --- a/packages/react-docs/src/components/interface.tsx +++ b/packages/react-docs/src/components/interface.tsx @@ -19,7 +19,7 @@ export function Interface(props: InterfaceProps) { return ( <span key={`property-${property.name}-${property.type}-${type.name}`}> {property.name}:{' '} - {property.type.typeDocType !== TypeDocTypes.Reflection ? ( + {property.type && property.type.typeDocType !== TypeDocTypes.Reflection ? ( <Type type={property.type} sectionName={props.sectionName} docsInfo={props.docsInfo} /> ) : ( <Signature @@ -27,7 +27,6 @@ export function Interface(props: InterfaceProps) { returnType={property.type.method.returnType} parameters={property.type.method.parameters} typeParameter={property.type.method.typeParameter} - callPath={property.type.method.callPath} sectionName={props.sectionName} shouldHideMethodName={true} shouldUseArrowSyntax={true} diff --git a/packages/react-docs/src/components/signature.tsx b/packages/react-docs/src/components/signature.tsx index 83fb1e246..1d3c90261 100644 --- a/packages/react-docs/src/components/signature.tsx +++ b/packages/react-docs/src/components/signature.tsx @@ -91,6 +91,7 @@ function renderParameters( ) { const params = _.map(parameters, (p: Parameter) => { const isOptional = p.isOptional; + const hasDefaultValue = !_.isUndefined(p.defaultValue); const type = ( <Type type={p.type} @@ -103,6 +104,7 @@ function renderParameters( <span key={`param-${p.type}-${p.name}`}> {p.name} {isOptional && '?'}: {type} + {hasDefaultValue && ` = ${p.defaultValue}`} </span> ); }); diff --git a/packages/react-docs/src/components/type.tsx b/packages/react-docs/src/components/type.tsx index fd4562ce3..2b7b49672 100644 --- a/packages/react-docs/src/components/type.tsx +++ b/packages/react-docs/src/components/type.tsx @@ -109,7 +109,6 @@ export function Type(props: TypeProps): any { returnType={type.method.returnType} parameters={type.method.parameters} typeParameter={type.method.typeParameter} - callPath={type.method.callPath} sectionName={props.sectionName} shouldHideMethodName={true} shouldUseArrowSyntax={true} diff --git a/packages/react-docs/src/types.ts b/packages/react-docs/src/types.ts index 2a300c164..3b4a57ad5 100644 --- a/packages/react-docs/src/types.ts +++ b/packages/react-docs/src/types.ts @@ -140,6 +140,7 @@ export interface Parameter { comment: string; isOptional: boolean; type: Type; + defaultValue?: string; } export interface TypeParameter { diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts index 02f5b4049..9c89b135a 100644 --- a/packages/react-docs/src/utils/typedoc_utils.ts +++ b/packages/react-docs/src/utils/typedoc_utils.ts @@ -14,6 +14,7 @@ import { Type, TypeDocNode, TypeDocType, + TypeDocTypes, TypeParameter, TypescriptFunction, TypescriptMethod, @@ -221,9 +222,16 @@ export const typeDocUtils = { const childrenIfExist = !_.isUndefined(entity.children) ? _.map(entity.children, (child: TypeDocNode) => { - const childTypeIfExists = !_.isUndefined(child.type) + let childTypeIfExists = !_.isUndefined(child.type) ? typeDocUtils._convertType(child.type, sections, sectionName, docId) : undefined; + if (child.kindString === KindString.Method) { + childTypeIfExists = { + name: child.name, + typeDocType: TypeDocTypes.Reflection, + method: this._convertMethod(child, isConstructor, sections, sectionName, docId), + }; + } const c: CustomTypeChild = { name: child.name, type: childTypeIfExists, @@ -387,6 +395,7 @@ export const typeDocUtils = { name: entity.name, comment, isOptional, + defaultValue: entity.defaultValue, type, }; return parameter; diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json index 6444fb876..82d0df30c 100644 --- a/packages/sol-cov/package.json +++ b/packages/sol-cov/package.json @@ -24,7 +24,8 @@ "assets": [], "docPublishConfigs": { "extraFileIncludes": [ - "../subproviders/src/types.ts" + "../subproviders/src/types.ts", + "../types/src/index.ts" ], "s3BucketPath": "s3://doc-jsons/sol-cov/", "s3StagingBucketPath": "s3://staging-doc-jsons/sol-cov/" diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index 442fbb2d6..2e7e629b5 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -1,7 +1,9 @@ import { BigNumber } from 'bignumber.js'; +export type JSONRPCErrorCallback = (err: Error | null, result?: JSONRPCResponsePayload) => void; + export interface Provider { - sendAsync(payload: JSONRPCRequestPayload, callback: (err: Error, result: JSONRPCResponsePayload) => void): void; + sendAsync(payload: JSONRPCRequestPayload, callback: JSONRPCErrorCallback): void; } export type ContractAbi = AbiDefinition[]; diff --git a/packages/web3-wrapper/README.md b/packages/web3-wrapper/README.md index a38f49e6e..d752a9de0 100644 --- a/packages/web3-wrapper/README.md +++ b/packages/web3-wrapper/README.md @@ -2,7 +2,7 @@ Wrapped version of web3 with a nicer interface that is used across 0x projects and packages. -### Read the [Documentation](https://0xproject.com/docs/web3_wrapper). +### Read the [Documentation](https://0xproject.com/docs/web3-wrapper). ## Installation 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 7aa05f9a5..4a956acea 100644 --- a/packages/website/ts/containers/subproviders_documentation.ts +++ b/packages/website/ts/containers/subproviders_documentation.ts @@ -91,25 +91,21 @@ const docsInfoConfig: DocsInfoConfig = { 'ErrorCallback', 'ECSignature', 'JSONRPCRequestPayloadWithMethod', + 'JSONRPCRequestPayload', 'JSONRPCResponsePayload', 'AccountFetchingConfigs', 'LedgerEthereumClientFactoryAsync', 'PartialTxParams', 'LedgerEthereumClient', 'LedgerSubproviderConfigs', + '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 b0adad536..9c0ca9b9a 100644 --- a/packages/website/ts/containers/web3_wrapper_documentation.ts +++ b/packages/website/ts/containers/web3_wrapper_documentation.ts @@ -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); + }, }; |