updated comments

added comments to Forwarder Swap Quote Conusmer
This commit is contained in:
David Sun
2019-06-21 09:40:27 -07:00
parent 92a1e5413b
commit 242a2e21b5
2 changed files with 20 additions and 1 deletions

View File

@@ -39,6 +39,11 @@ export class ForwarderSwapQuoteConsumer implements SwapQuoteConsumer<ForwarderMa
});
}
/**
* Given a SwapQuote, returns 'CalldataInfo' 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 opts Options for getting CalldataInfo. See type definition for more information.
*/
public getCalldataOrThrow(quote: SwapQuote, opts: Partial<ForwarderSwapQuoteGetOutputOpts>): CalldataInfo {
assert.isValidForwarderSwapQuote('quote', quote, this._getEtherTokenAssetDataOrThrow());
@@ -62,6 +67,11 @@ export class ForwarderSwapQuoteConsumer implements SwapQuoteConsumer<ForwarderMa
};
}
/**
* 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 opts Options for getting CalldataInfo. See type definition for more information.
*/
public getSmartContractParamsOrThrow(
quote: SwapQuote,
opts: Partial<ForwarderSwapQuoteGetOutputOpts>,
@@ -115,6 +125,11 @@ export class ForwarderSwapQuoteConsumer implements SwapQuoteConsumer<ForwarderMa
};
}
/**
* Given a SwapQuote and desired rate (in Eth), 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(
quote: SwapQuote,
opts: Partial<ForwarderSwapQuoteExecutionOpts>,
@@ -190,6 +205,10 @@ export class ForwarderSwapQuoteConsumer implements SwapQuoteConsumer<ForwarderMa
}
}
/**
* Get the assetData that represents the WETH token.
* Will throw if WETH does not exist for the current network.
*/
private _getEtherTokenAssetDataOrThrow(): string {
return assetDataUtils.getEtherTokenAssetData(this._contractWrappers);
}

View File

@@ -158,7 +158,7 @@ export interface SwapQuote {
/**
* assetEthAmount: The amount of eth required to pay for the requested asset.
* feeEthAmount: The amount of eth required to pay any fee concerned with an extension contract.
* feeEthAmount: The amount of eth required to pay any fee concerned with completing the swap.
* totalEthAmount: The total amount of eth required to complete the buy (filling orders, feeOrders, and paying affiliate fee).
*/
export interface SwapQuoteInfo {