diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-09-20 00:38:50 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-09-20 00:38:50 +0800 |
commit | a44f77a83811146ad68ee6f56bcda94e56d6a634 (patch) | |
tree | a3d586c9ad3203ba580367f0392fe00758fea18f /packages/asset-buyer/src/asset_buyer.ts | |
parent | a03b1d4d6cc5548f4c2f07a933a4c2cc6be3b053 (diff) | |
download | dexon-0x-contracts-a44f77a83811146ad68ee6f56bcda94e56d6a634.tar.gz dexon-0x-contracts-a44f77a83811146ad68ee6f56bcda94e56d6a634.tar.zst dexon-0x-contracts-a44f77a83811146ad68ee6f56bcda94e56d6a634.zip |
Implement StandardRelayerAPIAssetBuyerManager
Diffstat (limited to 'packages/asset-buyer/src/asset_buyer.ts')
-rw-r--r-- | packages/asset-buyer/src/asset_buyer.ts | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/packages/asset-buyer/src/asset_buyer.ts b/packages/asset-buyer/src/asset_buyer.ts index 81b46d89a..5f57e3d7f 100644 --- a/packages/asset-buyer/src/asset_buyer.ts +++ b/packages/asset-buyer/src/asset_buyer.ts @@ -1,6 +1,6 @@ import { ContractWrappers } from '@0xproject/contract-wrappers'; import { schemas } from '@0xproject/json-schemas'; -import { assetDataUtils, SignedOrder } from '@0xproject/order-utils'; +import { SignedOrder } from '@0xproject/order-utils'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { Provider } from 'ethereum-types'; @@ -19,6 +19,7 @@ import { } from './types'; import { assert } from './utils/assert'; +import { assetDataUtils } from './utils/asset_data_utils'; import { buyQuoteCalculator } from './utils/buy_quote_calculator'; import { orderFetcherResponseProcessor } from './utils/order_fetcher_response_processor'; @@ -284,24 +285,13 @@ export class AssetBuyer { * Will throw if WETH does not exist for the current network. */ private _getEtherTokenAssetData(): string { - const etherTokenAddressIfExists = this._contractWrappers.etherToken.getContractAddressIfExists(); - if (_.isUndefined(etherTokenAddressIfExists)) { - throw new Error(AssetBuyerError.NoEtherTokenContractFound); - } - const etherTokenAssetData = assetDataUtils.encodeERC20AssetData(etherTokenAddressIfExists); - return etherTokenAssetData; + return assetDataUtils.getEtherTokenAssetData(this._contractWrappers); } /** * Get the assetData that represents the ZRX token. * Will throw if ZRX does not exist for the current network. */ private _getZrxTokenAssetData(): string { - let zrxTokenAssetData: string; - try { - zrxTokenAssetData = this._contractWrappers.exchange.getZRXAssetData(); - } catch (err) { - throw new Error(AssetBuyerError.NoZrxTokenContractFound); - } - return zrxTokenAssetData; + return assetDataUtils.getZrxTokenAssetData(this._contractWrappers); } } |