bumped version and added to docs
This commit is contained in:
parent
dc3569392c
commit
7ec232a470
@ -16,6 +16,7 @@ export {
|
|||||||
DataItem,
|
DataItem,
|
||||||
StateMutability,
|
StateMutability,
|
||||||
EventParameter,
|
EventParameter,
|
||||||
|
TupleDataItem,
|
||||||
ConstructorStateMutability,
|
ConstructorStateMutability,
|
||||||
} from 'ethereum-types';
|
} from 'ethereum-types';
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ export class ForwarderSwapQuoteConsumer implements SwapQuoteConsumerBase<Forward
|
|||||||
/**
|
/**
|
||||||
* Given a SwapQuote, returns 'SmartContractParamsInfo' for a forwarder extension call. See type definition of CalldataInfo for more information.
|
* Given a SwapQuote, returns 'SmartContractParamsInfo' for a forwarder extension call. See type definition of CalldataInfo for more information.
|
||||||
* @param quote An object that conforms to SwapQuote. See type definition for more information.
|
* @param quote An object that conforms to SwapQuote. See type definition for more information.
|
||||||
* @param opts Options for getting CalldataInfo. See type definition for more information.
|
* @param opts Options for getting SmartContractParams. See type definition for more information.
|
||||||
*/
|
*/
|
||||||
public async getSmartContractParamsOrThrowAsync(
|
public async getSmartContractParamsOrThrowAsync(
|
||||||
quote: SwapQuote,
|
quote: SwapQuote,
|
||||||
|
@ -44,6 +44,11 @@ export class SwapQuoteConsumer implements SwapQuoteConsumerBase<SmartContractPar
|
|||||||
this._forwarderConsumer = new ForwarderSwapQuoteConsumer(supportedProvider, options);
|
this._forwarderConsumer = new ForwarderSwapQuoteConsumer(supportedProvider, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a SwapQuote, returns 'CalldataInfo' for a 0x exchange call. See type definition of CalldataInfo for more information.
|
||||||
|
* @param quote An object that conforms to SwapQuote. See type definition for more information.
|
||||||
|
* @param opts Options for getting SmartContractParams. See type definition for more information.
|
||||||
|
*/
|
||||||
public async getCalldataOrThrowAsync(
|
public async getCalldataOrThrowAsync(
|
||||||
quote: SwapQuote,
|
quote: SwapQuote,
|
||||||
opts: Partial<SwapQuoteGetOutputOpts>,
|
opts: Partial<SwapQuoteGetOutputOpts>,
|
||||||
@ -53,6 +58,11 @@ export class SwapQuoteConsumer implements SwapQuoteConsumerBase<SmartContractPar
|
|||||||
return consumer.getCalldataOrThrowAsync(quote, opts);
|
return consumer.getCalldataOrThrowAsync(quote, opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a SwapQuote, returns 'SmartContractParamsInfo' for a 0x exchange call. See type definition of SmartContractParamsInfo for more information.
|
||||||
|
* @param quote An object that conforms to SwapQuote. See type definition for more information.
|
||||||
|
* @param opts Options for getting SmartContractParams. See type definition for more information.
|
||||||
|
*/
|
||||||
public async getSmartContractParamsOrThrowAsync(
|
public async getSmartContractParamsOrThrowAsync(
|
||||||
quote: SwapQuote,
|
quote: SwapQuote,
|
||||||
opts: Partial<SwapQuoteGetOutputOpts>,
|
opts: Partial<SwapQuoteGetOutputOpts>,
|
||||||
@ -62,6 +72,11 @@ export class SwapQuoteConsumer implements SwapQuoteConsumerBase<SmartContractPar
|
|||||||
return consumer.getSmartContractParamsOrThrowAsync(quote, opts);
|
return consumer.getSmartContractParamsOrThrowAsync(quote, opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a SwapQuote and desired rate (in takerAsset), attempt to execute the swap.
|
||||||
|
* @param quote An object that conforms to SwapQuote. See type definition for more information.
|
||||||
|
* @param opts Options for getting CalldataInfo. See type definition for more information.
|
||||||
|
*/
|
||||||
public async executeSwapQuoteOrThrowAsync(
|
public async executeSwapQuoteOrThrowAsync(
|
||||||
quote: SwapQuote,
|
quote: SwapQuote,
|
||||||
opts: Partial<SwapQuoteExecutionOpts>,
|
opts: Partial<SwapQuoteExecutionOpts>,
|
||||||
|
@ -25,6 +25,9 @@ export const docGenConfigs: DocGenConfigs = {
|
|||||||
'https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/ganache-core/index.d.ts#L8',
|
'https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/ganache-core/index.d.ts#L8',
|
||||||
'lightwallet.keystore':
|
'lightwallet.keystore':
|
||||||
'https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/eth-lightwallet/index.d.ts#L36',
|
'https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/eth-lightwallet/index.d.ts#L36',
|
||||||
|
// HACK: Asset-swapper specifies marketSell and marketBuy quotes with a descriminant MarketOperation Type to ignore the error, linking Buy and Sell to MarketOperation
|
||||||
|
Buy: 'https://github.com/0xProject/0x-monorepo/blob/development/packages/types/src/index.ts',
|
||||||
|
Sell: 'https://github.com/0xProject/0x-monorepo/blob/development/packages/types/src/index.ts',
|
||||||
},
|
},
|
||||||
// If a 0x package re-exports an external package, we should add a link to it's exported items here
|
// If a 0x package re-exports an external package, we should add a link to it's exported items here
|
||||||
EXTERNAL_EXPORT_TO_LINK: {
|
EXTERNAL_EXPORT_TO_LINK: {
|
||||||
|
18
packages/website/md/docs/asset_swapper/installation.md
Normal file
18
packages/website/md/docs/asset_swapper/installation.md
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#### Install
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yarn add @0x/asset-swapper
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Import
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { SwapQuoter, SwapQuoteConsumer } from '@0x/asset-swapper';
|
||||||
|
```
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var SwapQuoter = require('@0x/asset-swapper').SwapQuoter;
|
||||||
|
var SwapQuoteConsumer = require('@0x/asset-swapper').SwapQuoteConsumer;
|
||||||
|
```
|
1
packages/website/md/docs/asset_swapper/introduction.md
Normal file
1
packages/website/md/docs/asset_swapper/introduction.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
Welcome to the [asset-swapper](https://github.com/0xProject/0x-monorepo/tree/development/packages/asset-swapper) documentation! Asset-swapper is a library that provides an easy way to swap any ERC asset for another ERC asset for smart contract integrations, leveraging 0x liquidity.
|
@ -0,0 +1,42 @@
|
|||||||
|
import { DocsInfoConfig, SupportedDocJson } from '@0x/react-docs';
|
||||||
|
import * as React from 'react';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
import { DocPage as DocPageComponent, DocPageProps } from 'ts/pages/documentation/doc_page';
|
||||||
|
import { DocPackages } from 'ts/types';
|
||||||
|
|
||||||
|
import { getMapStateToProps, mapDispatchToProps } from '../utils/documentation_container';
|
||||||
|
|
||||||
|
/* tslint:disable:no-var-requires */
|
||||||
|
const IntroMarkdown = require('md/docs/asset_swapper/introduction');
|
||||||
|
const InstallationMarkdown = require('md/docs/asset_swapper/installation');
|
||||||
|
/* tslint:enable:no-var-requires */
|
||||||
|
|
||||||
|
const markdownSections = {
|
||||||
|
introduction: 'introduction',
|
||||||
|
installation: 'installation',
|
||||||
|
};
|
||||||
|
|
||||||
|
const docsInfoConfig: DocsInfoConfig = {
|
||||||
|
id: DocPackages.AssetSwapper,
|
||||||
|
packageName: '@0x/asset-swapper',
|
||||||
|
type: SupportedDocJson.TypeDoc,
|
||||||
|
displayName: 'AssetSwapper',
|
||||||
|
packageUrl: 'https://github.com/0xProject/0x-monorepo/packages/asset-swapper',
|
||||||
|
markdownMenu: {
|
||||||
|
introduction: [markdownSections.introduction],
|
||||||
|
install: [markdownSections.installation],
|
||||||
|
},
|
||||||
|
sectionNameToMarkdownByVersion: {
|
||||||
|
'0.0.1': {
|
||||||
|
[markdownSections.introduction]: IntroMarkdown,
|
||||||
|
[markdownSections.installation]: InstallationMarkdown,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
markdownSections,
|
||||||
|
};
|
||||||
|
const mapStateToProps = getMapStateToProps(docsInfoConfig);
|
||||||
|
|
||||||
|
export const Documentation: React.ComponentClass<DocPageProps> = connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps,
|
||||||
|
)(DocPageComponent);
|
@ -95,6 +95,9 @@ const LazyEthereumTypesDocumentation = createLazyComponent('Documentation', asyn
|
|||||||
const LazyAssetBuyerDocumentation = createLazyComponent('Documentation', async () =>
|
const LazyAssetBuyerDocumentation = createLazyComponent('Documentation', async () =>
|
||||||
import(/* webpackChunkName: "assetBuyerDocs" */ 'ts/containers/asset_buyer_documentation'),
|
import(/* webpackChunkName: "assetBuyerDocs" */ 'ts/containers/asset_buyer_documentation'),
|
||||||
);
|
);
|
||||||
|
const LazyAssetSwapperDocumentation = createLazyComponent('Documentation', async () =>
|
||||||
|
import(/* webpackChunkName: "assetSwapperDocs" */ 'ts/containers/asset_swapper_documentation'),
|
||||||
|
);
|
||||||
|
|
||||||
const DOCUMENT_TITLE = '0x: The Protocol for Trading Tokens';
|
const DOCUMENT_TITLE = '0x: The Protocol for Trading Tokens';
|
||||||
const DOCUMENT_DESCRIPTION = 'An Open Protocol For Decentralized Exchange On The Ethereum Blockchain';
|
const DOCUMENT_DESCRIPTION = 'An Open Protocol For Decentralized Exchange On The Ethereum Blockchain';
|
||||||
@ -204,6 +207,10 @@ render(
|
|||||||
path={`${WebsitePaths.AssetBuyer}/:version?`}
|
path={`${WebsitePaths.AssetBuyer}/:version?`}
|
||||||
component={LazyAssetBuyerDocumentation}
|
component={LazyAssetBuyerDocumentation}
|
||||||
/>
|
/>
|
||||||
|
<Route
|
||||||
|
path={`${WebsitePaths.AssetSwapper}/:version?`}
|
||||||
|
component={LazyAssetSwapperDocumentation}
|
||||||
|
/>
|
||||||
<Route path={WebsitePaths.Docs} component={DocsHome as any} />
|
<Route path={WebsitePaths.Docs} component={DocsHome as any} />
|
||||||
{/* Legacy endpoints */}
|
{/* Legacy endpoints */}
|
||||||
<Route
|
<Route
|
||||||
|
@ -41,6 +41,7 @@ const docIdToSubpackageName: { [id: string]: string } = {
|
|||||||
[DocPackages.OrderWatcher]: 'order-watcher',
|
[DocPackages.OrderWatcher]: 'order-watcher',
|
||||||
[DocPackages.EthereumTypes]: 'ethereum-types',
|
[DocPackages.EthereumTypes]: 'ethereum-types',
|
||||||
[DocPackages.AssetBuyer]: 'asset-buyer',
|
[DocPackages.AssetBuyer]: 'asset-buyer',
|
||||||
|
[DocPackages.AssetSwapper]: 'asset-swapper',
|
||||||
[DocPackages.Migrations]: 'migrations',
|
[DocPackages.Migrations]: 'migrations',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -172,6 +172,14 @@ const CATEGORY_TO_PACKAGES: ObjectMap<Package[]> = {
|
|||||||
to: WebsitePaths.AssetBuyer,
|
to: WebsitePaths.AssetBuyer,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
description:
|
||||||
|
'Coonvenience package for discovering and performing swaps for any ERC20 Assets',
|
||||||
|
link: {
|
||||||
|
title: '@0x/asset-swapper',
|
||||||
|
to: WebsitePaths.AssetSwapper,
|
||||||
|
},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
[Categories.ZeroExProtocolPython]: [
|
[Categories.ZeroExProtocolPython]: [
|
||||||
{
|
{
|
||||||
|
@ -473,6 +473,7 @@ export enum WebsitePaths {
|
|||||||
OrderUtils = '/docs/order-utils',
|
OrderUtils = '/docs/order-utils',
|
||||||
EthereumTypes = '/docs/ethereum-types',
|
EthereumTypes = '/docs/ethereum-types',
|
||||||
AssetBuyer = '/docs/asset-buyer',
|
AssetBuyer = '/docs/asset-buyer',
|
||||||
|
AssetSwapper = '/docs/asset-swapper',
|
||||||
Migrations = '/docs/migrations',
|
Migrations = '/docs/migrations',
|
||||||
Careers = '/careers',
|
Careers = '/careers',
|
||||||
Credits = '/credits',
|
Credits = '/credits',
|
||||||
@ -497,6 +498,7 @@ export enum DocPackages {
|
|||||||
ContractWrappers = 'CONTRACT_WRAPPERS',
|
ContractWrappers = 'CONTRACT_WRAPPERS',
|
||||||
OrderWatcher = 'ORDER_WATCHER',
|
OrderWatcher = 'ORDER_WATCHER',
|
||||||
AssetBuyer = 'ASSET_BUYER',
|
AssetBuyer = 'ASSET_BUYER',
|
||||||
|
AssetSwapper = 'ASSET_SWAPPER',
|
||||||
Migrations = 'MIGRATIONS',
|
Migrations = 'MIGRATIONS',
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -560,6 +562,7 @@ export enum Key {
|
|||||||
ContractWrappers = 'CONTRACT_WRAPPERS',
|
ContractWrappers = 'CONTRACT_WRAPPERS',
|
||||||
OrderWatcher = 'ORDER_WATCHER',
|
OrderWatcher = 'ORDER_WATCHER',
|
||||||
AssetBuyer = 'ASSET_BUYER',
|
AssetBuyer = 'ASSET_BUYER',
|
||||||
|
AssetSwapper = 'ASSET_SWAPPER',
|
||||||
Blog = 'BLOG',
|
Blog = 'BLOG',
|
||||||
Forum = 'FORUM',
|
Forum = 'FORUM',
|
||||||
Connect = 'CONNECT',
|
Connect = 'CONNECT',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user