updated to async
This commit is contained in:
parent
1da8801084
commit
13a2f3a330
@ -39,10 +39,10 @@ export class ExchangeSwapQuoteConsumer implements SwapQuoteConsumer<ExchangeMark
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public getCalldataOrThrow(quote: SwapQuote, opts: Partial<SwapQuoteGetOutputOpts>): CalldataInfo {
|
public async getCalldataOrThrowAsync(quote: SwapQuote, opts: Partial<SwapQuoteGetOutputOpts>): Promise<CalldataInfo> {
|
||||||
assert.isValidSwapQuote('quote', quote);
|
assert.isValidSwapQuote('quote', quote);
|
||||||
|
|
||||||
const { params, to, ethAmount, methodAbi } = this.getSmartContractParamsOrThrow(quote, opts);
|
const { params, to, ethAmount, methodAbi } = await this.getSmartContractParamsOrThrowAsync(quote, opts);
|
||||||
const abiEncoder = new AbiEncoder.Method(methodAbi);
|
const abiEncoder = new AbiEncoder.Method(methodAbi);
|
||||||
const args = [
|
const args = [
|
||||||
params.orders,
|
params.orders,
|
||||||
@ -58,7 +58,7 @@ export class ExchangeSwapQuoteConsumer implements SwapQuoteConsumer<ExchangeMark
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public getSmartContractParamsOrThrow(quote: SwapQuote, opts: Partial<SwapQuoteGetOutputOpts>): SmartContractParamsInfo<ExchangeMarketBuySmartContractParams> {
|
public async getSmartContractParamsOrThrowAsync(quote: SwapQuote, opts: Partial<SwapQuoteGetOutputOpts>): Promise<SmartContractParamsInfo<ExchangeMarketBuySmartContractParams>> {
|
||||||
assert.isValidSwapQuote('quote', quote);
|
assert.isValidSwapQuote('quote', quote);
|
||||||
|
|
||||||
const { orders, makerAssetFillAmount } = quote;
|
const { orders, makerAssetFillAmount } = quote;
|
||||||
|
@ -19,7 +19,7 @@ import {
|
|||||||
import { affiliateFeeUtils } from '../utils/affiliate_fee_utils';
|
import { affiliateFeeUtils } from '../utils/affiliate_fee_utils';
|
||||||
import { assert } from '../utils/assert';
|
import { assert } from '../utils/assert';
|
||||||
import { assetDataUtils } from '../utils/asset_data_utils';
|
import { assetDataUtils } from '../utils/asset_data_utils';
|
||||||
import { SwapQuoteConsumerUtils } from '../utils/swap_quote_consumer_utils';
|
import { swapQuoteConsumerUtils } from '../utils/swap_quote_consumer_utils';
|
||||||
import { utils } from '../utils/utils';
|
import { utils } from '../utils/utils';
|
||||||
|
|
||||||
export class ForwarderSwapQuoteConsumer implements SwapQuoteConsumer<ForwarderMarketBuySmartContractParams> {
|
export class ForwarderSwapQuoteConsumer implements SwapQuoteConsumer<ForwarderMarketBuySmartContractParams> {
|
||||||
@ -165,7 +165,7 @@ export class ForwarderSwapQuoteConsumer implements SwapQuoteConsumer<ForwarderMa
|
|||||||
|
|
||||||
const { orders, feeOrders, makerAssetFillAmount, worstCaseQuoteInfo } = swapQuoteWithAffiliateFee;
|
const { orders, feeOrders, makerAssetFillAmount, worstCaseQuoteInfo } = swapQuoteWithAffiliateFee;
|
||||||
|
|
||||||
const finalTakerAddress = await SwapQuoteConsumerUtils.getTakerAddressOrThrowAsync(this.provider, opts);
|
const finalTakerAddress = await swapQuoteConsumerUtils.getTakerAddressOrThrowAsync(this.provider, opts);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const txHash = await this._contractWrappers.forwarder.marketBuyOrdersWithEthAsync(
|
const txHash = await this._contractWrappers.forwarder.marketBuyOrdersWithEthAsync(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user