diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-10-17 02:15:17 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-10-17 02:15:17 +0800 |
commit | dbf5be6c217b49c4b768a9ea9969d44d70fb3dcc (patch) | |
tree | a93d0d6864c3e0f37c2663a6ba9ae0d3e7813fe9 /packages/asset-buyer/src | |
parent | d268e19124f086128aa293c5fe847f81891f7121 (diff) | |
parent | 72f5719b3412da7840a7b85e4dce512ecbaece4d (diff) | |
download | dexon-sol-tools-dbf5be6c217b49c4b768a9ea9969d44d70fb3dcc.tar dexon-sol-tools-dbf5be6c217b49c4b768a9ea9969d44d70fb3dcc.tar.gz dexon-sol-tools-dbf5be6c217b49c4b768a9ea9969d44d70fb3dcc.tar.bz2 dexon-sol-tools-dbf5be6c217b49c4b768a9ea9969d44d70fb3dcc.tar.lz dexon-sol-tools-dbf5be6c217b49c4b768a9ea9969d44d70fb3dcc.tar.xz dexon-sol-tools-dbf5be6c217b49c4b768a9ea9969d44d70fb3dcc.tar.zst dexon-sol-tools-dbf5be6c217b49c4b768a9ea9969d44d70fb3dcc.zip |
Merge branch 'development' of https://github.com/0xProject/0x-monorepo into feature/instant/move-features-over-from-zrx-buyer
Diffstat (limited to 'packages/asset-buyer/src')
-rw-r--r-- | packages/asset-buyer/src/asset_buyer.ts | 4 | ||||
-rw-r--r-- | packages/asset-buyer/src/utils/asset_data_utils.ts | 20 |
2 files changed, 5 insertions, 19 deletions
diff --git a/packages/asset-buyer/src/asset_buyer.ts b/packages/asset-buyer/src/asset_buyer.ts index 50343efde..4739e5a29 100644 --- a/packages/asset-buyer/src/asset_buyer.ts +++ b/packages/asset-buyer/src/asset_buyer.ts @@ -283,13 +283,13 @@ export class AssetBuyer { * Will throw if WETH does not exist for the current network. */ private _getEtherTokenAssetDataOrThrow(): string { - return assetDataUtils.getEtherTokenAssetDataOrThrow(this._contractWrappers); + 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 _getZrxTokenAssetDataOrThrow(): string { - return assetDataUtils.getZrxTokenAssetDataOrThrow(this._contractWrappers); + return this._contractWrappers.exchange.getZRXAssetData(); } } diff --git a/packages/asset-buyer/src/utils/asset_data_utils.ts b/packages/asset-buyer/src/utils/asset_data_utils.ts index d05ff2504..f54462a23 100644 --- a/packages/asset-buyer/src/utils/asset_data_utils.ts +++ b/packages/asset-buyer/src/utils/asset_data_utils.ts @@ -2,25 +2,11 @@ import { ContractWrappers } from '@0xproject/contract-wrappers'; import { assetDataUtils as sharedAssetDataUtils } from '@0xproject/order-utils'; import * as _ from 'lodash'; -import { AssetBuyerError } from '../types'; - export const assetDataUtils = { ...sharedAssetDataUtils, - getEtherTokenAssetDataOrThrow(contractWrappers: ContractWrappers): string { - const etherTokenAddressIfExists = contractWrappers.etherToken.getContractAddressIfExists(); - if (_.isUndefined(etherTokenAddressIfExists)) { - throw new Error(AssetBuyerError.NoEtherTokenContractFound); - } - const etherTokenAssetData = sharedAssetDataUtils.encodeERC20AssetData(etherTokenAddressIfExists); + getEtherTokenAssetData(contractWrappers: ContractWrappers): string { + const etherTokenAddress = contractWrappers.forwarder.etherTokenAddress; + const etherTokenAssetData = sharedAssetDataUtils.encodeERC20AssetData(etherTokenAddress); return etherTokenAssetData; }, - getZrxTokenAssetDataOrThrow(contractWrappers: ContractWrappers): string { - let zrxTokenAssetData: string; - try { - zrxTokenAssetData = contractWrappers.exchange.getZRXAssetData(); - } catch (err) { - throw new Error(AssetBuyerError.NoZrxTokenContractFound); - } - return zrxTokenAssetData; - }, }; |