mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
SHowing asset network name in the algorithm selection form
This commit is contained in:
parent
5d629382d5
commit
0c64b1e5e7
@ -2,6 +2,7 @@ import { getAccessDetailsForAssets } from './accessDetailsAndPricing'
|
||||
import { PublisherTrustedAlgorithm, Asset } from '@oceanprotocol/lib'
|
||||
import { AssetSelectionAsset } from '@shared/FormInput/InputElement/AssetSelection'
|
||||
import { getServiceByName } from './ddo'
|
||||
import { chainIds } from 'app.config'
|
||||
|
||||
export async function transformAssetToAssetSelection(
|
||||
datasetProviderEndpoint: string,
|
||||
@ -32,7 +33,8 @@ export async function transformAssetToAssetSelection(
|
||||
name: asset.metadata.name,
|
||||
price: asset.accessDetails.price,
|
||||
checked: selected,
|
||||
symbol: asset.datatokens[0].symbol
|
||||
symbol: asset.datatokens[0].symbol,
|
||||
chainId: asset.chainId
|
||||
}
|
||||
selected
|
||||
? algorithmList.unshift(algorithmAsset)
|
||||
|
24
src/@utils/chainIdToNetworkName.ts
Normal file
24
src/@utils/chainIdToNetworkName.ts
Normal file
@ -0,0 +1,24 @@
|
||||
export function chainIdToNetworkName(chainId: number): string {
|
||||
switch (chainId) {
|
||||
case 1:
|
||||
return 'Ethereum'
|
||||
case 137:
|
||||
return 'Polygon'
|
||||
case 56:
|
||||
return 'Binance Smart Chain'
|
||||
case 1285:
|
||||
return 'Moonriver'
|
||||
case 246:
|
||||
return 'Energy Web Chain'
|
||||
case 80001:
|
||||
return 'Mumbai'
|
||||
case 8996:
|
||||
return 'Development'
|
||||
case 5:
|
||||
return 'Görli'
|
||||
case 2021000:
|
||||
return 'GAIA-X'
|
||||
default:
|
||||
return 'Unknown Network'
|
||||
}
|
||||
}
|
@ -9,21 +9,24 @@ describe('@shared/FormInput/InputElement/AssetSelection', () => {
|
||||
name: 'Asset',
|
||||
price: '10',
|
||||
checked: false,
|
||||
symbol: 'OCEAN'
|
||||
symbol: 'OCEAN',
|
||||
chainId: 1
|
||||
},
|
||||
{
|
||||
did: 'did:op:yyy',
|
||||
name: 'Asset',
|
||||
price: '10',
|
||||
checked: true,
|
||||
symbol: 'OCEAN'
|
||||
symbol: 'OCEAN',
|
||||
chainId: 137
|
||||
},
|
||||
{
|
||||
did: 'did:op:zzz',
|
||||
name: 'Asset',
|
||||
price: '0',
|
||||
checked: false,
|
||||
symbol: 'OCEAN'
|
||||
symbol: 'OCEAN',
|
||||
chainId: 5
|
||||
}
|
||||
]
|
||||
|
||||
|
@ -6,6 +6,7 @@ import External from '@images/external.svg'
|
||||
import InputElement from '@shared/FormInput/InputElement'
|
||||
import Loader from '@shared/atoms/Loader'
|
||||
import styles from './index.module.css'
|
||||
import { chainIdToNetworkName } from '@utils/chainIdToNetworkName'
|
||||
|
||||
export interface AssetSelectionAsset {
|
||||
did: string
|
||||
@ -13,6 +14,7 @@ export interface AssetSelectionAsset {
|
||||
price: string
|
||||
checked: boolean
|
||||
symbol: string
|
||||
chainId: number
|
||||
}
|
||||
|
||||
function Empty() {
|
||||
@ -101,7 +103,8 @@ export default function AssetSelection({
|
||||
</h3>
|
||||
|
||||
<Dotdotdot clamp={1} tagName="code" className={styles.did}>
|
||||
{asset.symbol} | {asset.did}
|
||||
{chainIdToNetworkName(asset.chainId)} | {asset.symbol} |{' '}
|
||||
{asset.did}
|
||||
</Dotdotdot>
|
||||
</label>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user