1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

bump ocean.js, support more networks (#701)

* bump ocean.js

* fix frontpage empty views

* package-lock fix

* hook dependencies are fun

* bump ocean.js

* network tweaks

* add more chains to user preferences
This commit is contained in:
Matthias Kretschmann 2021-06-30 09:32:09 +02:00 committed by GitHub
parent c81a986261
commit da23e9f3a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 25539 additions and 135 deletions

View File

@ -1,5 +1,6 @@
# Default network, possible values: # Default network, possible values:
# "development", "ropsten", "rinkeby", "mainnet", "polygon", "moonbeamalpha" # "development", "ropsten", "rinkeby", "mainnet", "polygon", "moonbeamalpha",
# "gaiaxtestnet", "mumbai", "bsc"
GATSBY_NETWORK="rinkeby" GATSBY_NETWORK="rinkeby"
#GATSBY_INFURA_PROJECT_ID="xxx" #GATSBY_INFURA_PROJECT_ID="xxx"

25638
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -27,7 +27,7 @@
"@coingecko/cryptoformat": "^0.4.2", "@coingecko/cryptoformat": "^0.4.2",
"@loadable/component": "^5.15.0", "@loadable/component": "^5.15.0",
"@oceanprotocol/art": "^3.0.0", "@oceanprotocol/art": "^3.0.0",
"@oceanprotocol/lib": "^0.15.1", "@oceanprotocol/lib": "^0.16.1",
"@oceanprotocol/typographies": "^0.1.0", "@oceanprotocol/typographies": "^0.1.0",
"@portis/web3": "^4.0.4", "@portis/web3": "^4.0.4",
"@sindresorhus/slugify": "^2.1.0", "@sindresorhus/slugify": "^2.1.0",

View File

@ -34,6 +34,12 @@ export default function Chain(): ReactElement {
title: 'Polygon/Matic', title: 'Polygon/Matic',
text: 'Mainnet' text: 'Mainnet'
}, },
{
name: 'bsc',
checked: isNetworkSelected('bsc'),
title: 'BSC',
text: 'Mainnet'
},
{ {
name: 'moonbeamalpha', name: 'moonbeamalpha',
checked: isNetworkSelected('moonbeamalpha'), checked: isNetworkSelected('moonbeamalpha'),

View File

@ -63,7 +63,7 @@ function SectionQueryResult({
config.metadataCacheUri, config.metadataCacheUri,
source.token source.token
) )
if (result.totalResults <= 15) { if (queryData && result.totalResults > 0 && result.totalResults <= 15) {
const searchDIDs = queryData.split(' ') const searchDIDs = queryData.split(' ')
const sortedAssets = sortElements(result.results, searchDIDs) const sortedAssets = sortElements(result.results, searchDIDs)
// We take more assets than we need from the subgraph (to make sure // We take more assets than we need from the subgraph (to make sure
@ -73,7 +73,6 @@ function SectionQueryResult({
sortedAssets.splice(sortedAssets.length - overflow, overflow) sortedAssets.splice(sortedAssets.length - overflow, overflow)
result.results = sortedAssets result.results = sortedAssets
} }
if (result.results.length === 0) return
setResult(result) setResult(result)
setLoading(false) setLoading(false)
} catch (error) { } catch (error) {
@ -120,7 +119,7 @@ export default function HomePage(): ReactElement {
} }
setQueryAndDids([queryHighest, results]) setQueryAndDids([queryHighest, results])
}) })
}, [config.subgraphUri, loading, web3Loading]) }, [config.subgraphUri, loading, web3Loading, web3Provider])
return ( return (
<Permission eventType="browse"> <Permission eventType="browse">

View File

@ -3,23 +3,21 @@ import {
Logger, Logger,
Ocean, Ocean,
ConfigHelper, ConfigHelper,
ConfigHelperConfig, ConfigHelperConfig
ConfigHelperNetworkId,
ConfigHelperNetworkName
} from '@oceanprotocol/lib' } from '@oceanprotocol/lib'
import contractAddresses from '@oceanprotocol/contracts/artifacts/address.json' import contractAddresses from '@oceanprotocol/contracts/artifacts/address.json'
import { UserBalance } from '../@types/TokenBalance' import { UserBalance } from '../@types/TokenBalance'
export function getOceanConfig( export function getOceanConfig(network: string | number): ConfigHelperConfig {
network: ConfigHelperNetworkName | ConfigHelperNetworkId
): ConfigHelperConfig {
return new ConfigHelper().getConfig( return new ConfigHelper().getConfig(
network, network,
network === 'polygon' || network === 'moonbeamalpha' ||
network === 137 || network === 1287 ||
network === 'moonbeamalpha' || network === 'bsc' ||
network === 1287 network === 56 ||
network === 'gaiaxtestnet' ||
network === 2021000
? undefined ? undefined
: process.env.GATSBY_INFURA_PROJECT_ID : process.env.GATSBY_INFURA_PROJECT_ID
) as ConfigHelperConfig ) as ConfigHelperConfig

View File

@ -32,6 +32,8 @@ export function getNetworkDisplayName(
): string { ): string {
const displayName = data const displayName = data
? `${data.chain} ${data.network === 'mainnet' ? '' : data.network}` ? `${data.chain} ${data.network === 'mainnet' ? '' : data.network}`
: networkId === 2021000
? 'GAIA-X'
: networkId === 8996 : networkId === 8996
? 'Development' ? 'Development'
: 'Unknown' : 'Unknown'