diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-10-19 01:43:41 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-10-19 01:43:41 +0800 |
commit | a764dfa789ba44e519371b4a1e4569db7f551fb7 (patch) | |
tree | 80cd8aff6fcf941269afdec8022d0dd5759700fa /packages/instant/src/data | |
parent | 5ec4b27200297708298deca97603849a37b2f66a (diff) | |
download | dexon-sol-tools-a764dfa789ba44e519371b4a1e4569db7f551fb7.tar dexon-sol-tools-a764dfa789ba44e519371b4a1e4569db7f551fb7.tar.gz dexon-sol-tools-a764dfa789ba44e519371b4a1e4569db7f551fb7.tar.bz2 dexon-sol-tools-a764dfa789ba44e519371b4a1e4569db7f551fb7.tar.lz dexon-sol-tools-a764dfa789ba44e519371b4a1e4569db7f551fb7.tar.xz dexon-sol-tools-a764dfa789ba44e519371b4a1e4569db7f551fb7.tar.zst dexon-sol-tools-a764dfa789ba44e519371b4a1e4569db7f551fb7.zip |
feat: MVP of passing in sraApiUrl, assetData and other settings from render method
Diffstat (limited to 'packages/instant/src/data')
-rw-r--r-- | packages/instant/src/data/asset_data_network_mapping.ts | 25 | ||||
-rw-r--r-- | packages/instant/src/data/asset_meta_data_map.ts (renamed from packages/instant/src/data/asset_meta_data.ts) | 5 |
2 files changed, 27 insertions, 3 deletions
diff --git a/packages/instant/src/data/asset_data_network_mapping.ts b/packages/instant/src/data/asset_data_network_mapping.ts new file mode 100644 index 000000000..9e14462f8 --- /dev/null +++ b/packages/instant/src/data/asset_data_network_mapping.ts @@ -0,0 +1,25 @@ +import * as _ from 'lodash'; + +import { Network } from '../types'; + +interface AssetDataByNetwork { + [Network.Kovan]?: string; + [Network.Mainnet]?: string; +} + +const sameAssetDatas: AssetDataByNetwork[] = [ + { + [Network.Mainnet]: '0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498', + [Network.Kovan]: '0xf47261b00000000000000000000000002002d3812f58e35f0ea1ffbf80a75a38c32175fa', + }, +]; + +export const assetDataNetworkMapping = { + getAssociatedAssetDataIfExists: (assetData: string, network: Network): string | undefined => { + const assetDataGroupIfExists = _.find(sameAssetDatas, value => value[network] === assetData); + if (_.isUndefined(assetDataGroupIfExists)) { + return; + } + return assetDataGroupIfExists[Network.Mainnet]; + }, +}; diff --git a/packages/instant/src/data/asset_meta_data.ts b/packages/instant/src/data/asset_meta_data_map.ts index e4d3e8f73..7d83865f1 100644 --- a/packages/instant/src/data/asset_meta_data.ts +++ b/packages/instant/src/data/asset_meta_data_map.ts @@ -1,12 +1,11 @@ import { AssetProxyId, ObjectMap } from '@0xproject/types'; -import { zrxAssetData } from '../constants'; import { AssetMetaData } from '../types'; // Map from assetData string to AssetMetaData object // TODO: import this from somewhere else. -export const assetMetaData: ObjectMap<AssetMetaData> = { - [zrxAssetData]: { +export const assetMetaDataMap: ObjectMap<AssetMetaData> = { + '0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498': { assetProxyId: AssetProxyId.ERC20, decimals: 18, primaryColor: 'rgb(54, 50, 60)', |