aboutsummaryrefslogtreecommitdiffstats
path: root/packages/pipeline/src/utils/transformers/asset_proxy_id_types.ts
blob: 2cd05a61699c9a57b347d5007e5491465bcae795 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { AssetProxyId } from '@0x/types';

import { AssetType } from '../../types';

/**
 * Converts an assetProxyId to its string equivalent
 * @param assetProxyId Id of AssetProxy
 */
export function convertAssetProxyIdToType(assetProxyId: AssetProxyId): AssetType {
    switch (assetProxyId) {
        case AssetProxyId.ERC20:
            return AssetType.ERC20;
        case AssetProxyId.ERC721:
            return AssetType.ERC721;
        case AssetProxyId.MultiAsset:
            return AssetType.MultiAsset;
        default:
            throw new Error(`${assetProxyId} not a supported assetProxyId`);
    }
}