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

Add support for Gaia-X Testnet (#823)

* limit to gaia-x

* hack in nodeUri

* hack in gaia-x network metadata

* network metadata tweaks

* bump packages

* rollback most hacks

* update values

* bump ocean.js to v0.17.3

Co-authored-by: mihaisc <mihai@oceanprotocol.com>
This commit is contained in:
Matthias Kretschmann 2021-08-31 16:56:48 +02:00 committed by GitHub
parent 3bf8be12e4
commit b717219592
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 1281 additions and 1359 deletions

View File

@ -13,7 +13,7 @@ module.exports = {
chainIds: [1, 137, 56],
// List of all supported chainIds. Used to populate the Chains user preferences list.
chainIdsSupported: [1, 3, 4, 137, 80001, 1287, 56],
chainIdsSupported: [1, 3, 4, 137, 80001, 1287, 56, 2021000],
rbacUrl: process.env.GATSBY_RBAC_URL,

2584
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -25,22 +25,22 @@
"graphql:graphTypes": "graphql-codegen --config codegen.yml"
},
"dependencies": {
"@coingecko/cryptoformat": "^0.4.2",
"@coingecko/cryptoformat": "^0.4.4",
"@loadable/component": "^5.15.0",
"@oceanprotocol/art": "^3.0.0",
"@oceanprotocol/lib": "^0.17.0",
"@oceanprotocol/art": "^3.2.0",
"@oceanprotocol/lib": "^0.17.3",
"@oceanprotocol/typographies": "^0.1.0",
"@portis/web3": "^4.0.4",
"@portis/web3": "^4.1.0",
"@sindresorhus/slugify": "^2.1.0",
"@tippyjs/react": "^4.2.5",
"@urql/introspection": "^0.3.0",
"@walletconnect/web3-provider": "^1.5.2",
"@walletconnect/web3-provider": "^1.6.5",
"axios": "^0.21.1",
"chart.js": "^2.9.4",
"classnames": "^2.3.1",
"cross-fetch": "^3.1.4",
"date-fns": "^2.22.1",
"decimal.js": "^10.2.1",
"date-fns": "^2.23.0",
"decimal.js": "^10.3.1",
"dom-confetti": "^0.2.2",
"dotenv": "^10.0.0",
"ethereum-address": "0.0.4",
@ -86,8 +86,8 @@
"swr": "^0.5.6",
"urql": "^2.0.3",
"use-dark-mode": "^2.3.1",
"web3": "^1.5.0",
"web3modal": "^1.9.3",
"web3": "^1.5.2",
"web3modal": "^1.9.4",
"yup": "^0.32.9"
},
"devDependencies": {

View File

@ -16,7 +16,7 @@ export function filterNetworksByType(
type: 'mainnet' | 'testnet',
chainIds: number[],
networksList: { node: EthereumListsChain }[]
) {
): number[] {
const finalNetworks = chainIds.filter((chainId: number) => {
const networkData = getNetworkDataById(networksList, chainId)

View File

@ -28,9 +28,9 @@ function getCredentialList(
(credential) => credential.type === credentialType
)
return credentialByType &&
credentialByType.value &&
credentialByType.value.length > 0
? credentialByType.value
credentialByType.values &&
credentialByType.values.length > 0
? credentialByType.values
: []
}

View File

@ -1,4 +1,5 @@
import { Logger } from '@oceanprotocol/lib'
import { getOceanConfig } from './ocean'
export interface EthereumListsChain {
name: string
@ -19,6 +20,24 @@ export interface NetworkObject {
urlList: string[]
}
const configGaiaX = getOceanConfig(2021000)
export const networkDataGaiaX = {
name: 'GAIA-X Testnet',
chainId: 2021000,
shortName: 'GAIA-X',
chain: 'GAIA-X',
network: 'testnet',
networkId: 2021000,
nativeCurrency: { name: 'Gaia-X', symbol: 'GX', decimals: 18 },
rpc: [configGaiaX.nodeUri],
faucets: [
'https://faucet.gaiaxtestnet.oceanprotocol.com/',
'https://faucet.gx.gaiaxtestnet.oceanprotocol.com/'
],
infoURL: 'https://www.gaia-x.eu'
}
export function getNetworkConfigObject(node: any): NetworkObject {
const networkConfig = {
name: node.chain,
@ -55,9 +74,6 @@ export function getNetworkDisplayName(
case 8996:
displayName = 'Development'
break
case 2021000:
displayName = 'GAIA-X'
break
default:
displayName = data
? `${data.chain} ${data.network === 'mainnet' ? '' : data.network}`
@ -77,7 +93,7 @@ export function getNetworkDataById(
({ node }: { node: EthereumListsChain }) => node.chainId === networkId
)
return networkData[0]?.node
return networkId === 2021000 ? networkDataGaiaX : networkData[0]?.node
}
export async function addCustomNetwork(
@ -106,7 +122,7 @@ export async function addCustomNetwork(
Logger.error(
`Couldn't add ${network.name} (0x${
network.chainId
}) netowrk to MetaMask, error: ${err || added.error}`
}) network to MetaMask, error: ${err || added.error}`
)
} else {
Logger.log(
@ -117,7 +133,7 @@ export async function addCustomNetwork(
)
} else {
Logger.error(
`Couldn't add ${network.name} (0x${network.chainId}) netowrk to MetaMask, error: ${switchError}`
`Couldn't add ${network.name} (0x${network.chainId}) network to MetaMask, error: ${switchError}`
)
}
}