aboutsummaryrefslogtreecommitdiffstats
path: root/packages/asset-buyer/src/utils/asset_data_utils.ts
diff options
context:
space:
mode:
authorAlex Browne <stephenalexbrowne@gmail.com>2018-10-05 06:51:04 +0800
committerAlex Browne <stephenalexbrowne@gmail.com>2018-10-16 04:36:59 +0800
commit3da032fb24a7b3d27fd388ce4fbc6bd194971201 (patch)
treef7fa75f6b63d53d94cf4b69f2f3b3fa958d68cdd /packages/asset-buyer/src/utils/asset_data_utils.ts
parentd0b37fcab563b854fcec59818b83a80c659d090c (diff)
downloaddexon-0x-contracts-3da032fb24a7b3d27fd388ce4fbc6bd194971201.tar.gz
dexon-0x-contracts-3da032fb24a7b3d27fd388ce4fbc6bd194971201.tar.zst
dexon-0x-contracts-3da032fb24a7b3d27fd388ce4fbc6bd194971201.zip
update asset-buyer to use new artifacts and abi-gen wrappers packages
Diffstat (limited to 'packages/asset-buyer/src/utils/asset_data_utils.ts')
-rw-r--r--packages/asset-buyer/src/utils/asset_data_utils.ts20
1 files changed, 3 insertions, 17 deletions
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;
- },
};