Added op mainnet into the Ocean market (#2007)

* Bump to ocean.js 3.2.0

* Added optimism network

* Added optimism network

* Enabled optimism network by default
This commit is contained in:
Ana 2023-11-29 14:20:26 +02:00 committed by GitHub
parent 4ced71c5af
commit 1e09614fb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 46 additions and 21 deletions

View File

@ -11,10 +11,10 @@ module.exports = {
// List of chainIds which metadata cache queries will return by default.
// This preselects the Chains user preferences.
chainIds: [1, 137],
chainIds: [1, 137, 10],
// List of all supported chainIds. Used to populate the Chains user preferences list.
chainIdsSupported: [1, 137, 5, 80001, 11155111],
chainIdsSupported: [1, 137, 10, 5, 80001, 11155111],
customProviderUrl: process.env.NEXT_PUBLIC_PROVIDER_URL,

30
package-lock.json generated
View File

@ -15,7 +15,7 @@
"@coingecko/cryptoformat": "^0.5.4",
"@loadable/component": "^5.15.2",
"@oceanprotocol/art": "^3.2.0",
"@oceanprotocol/lib": "^3.1.3",
"@oceanprotocol/lib": "^3.2.0",
"@oceanprotocol/typographies": "^0.1.0",
"@oceanprotocol/use-dark-mode": "^2.4.3",
"@orbisclub/orbis-sdk": "^0.4.40",
@ -6072,16 +6072,16 @@
"integrity": "sha512-aUQtg4m5hJlQ0u8C29O9TXJWcAenO3G9vP+vf6LNFkpTDOCMycN/F0SzHS89VNrvGUha8oTDEg7FAkfZBPv2WA=="
},
"node_modules/@oceanprotocol/contracts": {
"version": "1.1.14",
"resolved": "https://registry.npmjs.org/@oceanprotocol/contracts/-/contracts-1.1.14.tgz",
"integrity": "sha512-PJih7C6LHaWHHj1qgxZsSkEqKphhJrL3G7WuMOxl4N1daDrF6sooDDU+9dZkcHSVPc7cMjkFqLc5fP58NSAobw=="
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/@oceanprotocol/contracts/-/contracts-2.0.3.tgz",
"integrity": "sha512-D2YtlsgmhBuSmF/Ue8zMWPtXNiB4zgW09NjUQzvDFrloUo0a7yC8r8L84LrVniw+0Nmly/PhLcdm8i018yc34g=="
},
"node_modules/@oceanprotocol/lib": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-3.1.3.tgz",
"integrity": "sha512-A7LStVhJILhDlaxMQM71cLco3+tyrE6croPG4UTX58lSb7IRuikOgWq0uH78p3sC4si1RBXVsfLprcx0HiZ9Gg==",
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-3.2.0.tgz",
"integrity": "sha512-Mfc9L35dZNAqusCgbQtyJZspSNv9OydWNOKkQU+w5PB40TfXmAyb/IpbYsMzQ/j7oJBSeO2Ewh9JNayyVtUgcQ==",
"dependencies": {
"@oceanprotocol/contracts": "^1.1.14",
"@oceanprotocol/contracts": "^2.0.3",
"cross-fetch": "^4.0.0",
"crypto-js": "^4.1.1",
"decimal.js": "^10.4.1",
@ -58939,16 +58939,16 @@
"integrity": "sha512-aUQtg4m5hJlQ0u8C29O9TXJWcAenO3G9vP+vf6LNFkpTDOCMycN/F0SzHS89VNrvGUha8oTDEg7FAkfZBPv2WA=="
},
"@oceanprotocol/contracts": {
"version": "1.1.14",
"resolved": "https://registry.npmjs.org/@oceanprotocol/contracts/-/contracts-1.1.14.tgz",
"integrity": "sha512-PJih7C6LHaWHHj1qgxZsSkEqKphhJrL3G7WuMOxl4N1daDrF6sooDDU+9dZkcHSVPc7cMjkFqLc5fP58NSAobw=="
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/@oceanprotocol/contracts/-/contracts-2.0.3.tgz",
"integrity": "sha512-D2YtlsgmhBuSmF/Ue8zMWPtXNiB4zgW09NjUQzvDFrloUo0a7yC8r8L84LrVniw+0Nmly/PhLcdm8i018yc34g=="
},
"@oceanprotocol/lib": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-3.1.3.tgz",
"integrity": "sha512-A7LStVhJILhDlaxMQM71cLco3+tyrE6croPG4UTX58lSb7IRuikOgWq0uH78p3sC4si1RBXVsfLprcx0HiZ9Gg==",
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-3.2.0.tgz",
"integrity": "sha512-Mfc9L35dZNAqusCgbQtyJZspSNv9OydWNOKkQU+w5PB40TfXmAyb/IpbYsMzQ/j7oJBSeO2Ewh9JNayyVtUgcQ==",
"requires": {
"@oceanprotocol/contracts": "^1.1.14",
"@oceanprotocol/contracts": "^2.0.3",
"cross-fetch": "^4.0.0",
"crypto-js": "^4.1.1",
"decimal.js": "^10.4.1",

View File

@ -30,7 +30,7 @@
"@coingecko/cryptoformat": "^0.5.4",
"@loadable/component": "^5.15.2",
"@oceanprotocol/art": "^3.2.0",
"@oceanprotocol/lib": "^3.1.3",
"@oceanprotocol/lib": "^3.2.0",
"@oceanprotocol/typographies": "^0.1.0",
"@oceanprotocol/use-dark-mode": "^2.4.3",
"@orbisclub/orbis-sdk": "^0.4.40",

View File

@ -28,6 +28,9 @@ export function getNetworkDisplayName(data: EthereumListsChain): string {
case 137:
displayName = 'Polygon'
break
case 10:
displayName = 'OP Mainnet'
break
case 1285:
displayName = 'Moonriver'
break

12
src/@images/optimism.svg Normal file
View File

@ -0,0 +1,12 @@
<svg width="61" height="55" viewBox="0 0 61 55" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_102_46)">
<path d="M60.5 27.5C60.5 42.3642 47.1185 54.5 30.5 54.5C13.8815 54.5 0.5 42.3642 0.5 27.5C0.5 12.6358 13.8815 0.5 30.5 0.5C47.1185 0.5 60.5 12.6358 60.5 27.5Z" stroke="white"/>
<path d="M27.2259 14.4653L27.2258 14.4654L27.2368 14.4704C28.5516 15.0706 29.5876 15.9971 30.3517 17.241L30.3536 17.244C31.1109 18.4575 31.5 19.9167 31.5 21.6425C31.5 22.1496 31.4475 22.8078 31.3384 23.6233C30.9879 25.914 30.5829 28.1587 30.0868 30.318C29.2863 33.7999 27.9355 36.3644 26.04 38.034C24.1738 39.6735 21.6368 40.5 18.3889 40.5C15.7217 40.5 13.5832 39.801 11.9316 38.44C10.3274 37.0827 9.5 35.1224 9.5 32.5233C9.5 31.9745 9.55253 31.3163 9.66143 30.5025C9.95583 28.6501 10.3795 26.4234 10.9332 23.7998C11.7052 20.3045 13.0773 17.7407 15.0077 16.0497C16.9329 14.3633 19.4647 13.5 22.6481 13.5C24.3637 13.5 25.8978 13.8198 27.2259 14.4653ZM18.5693 19.4917L18.5693 19.4917L18.5656 19.4951C17.5589 20.4379 16.8772 21.8495 16.4758 23.6852C16.0463 25.4416 15.6372 27.5666 15.2111 30.0958C15.1142 30.6384 15.0557 31.2054 15.0556 31.8167C15.0461 33.0881 15.3388 34.1304 16.0169 34.8547C16.7006 35.5848 17.6929 35.9041 18.8889 35.9041C20.3093 35.9041 21.524 35.4226 22.5251 34.4859C23.5513 33.5432 24.2533 32.13 24.6552 30.2879C25.1931 27.8382 25.6026 25.7147 25.8825 23.8778C25.9787 23.3163 26.037 22.7298 26.037 22.1192C26.037 20.8701 25.749 19.8394 25.0816 19.1209C24.4077 18.3953 23.429 18.0751 22.2407 18.0751C20.8207 18.0751 19.5885 18.5564 18.5693 19.4917Z" fill="white" stroke="black"/>
<path d="M35.9646 14.0533L35.9671 14.0393L35.9688 14.0252C35.9887 13.8587 36.051 13.7439 36.1674 13.6397L36.1754 13.6324L36.1832 13.6249C36.2861 13.5244 36.3698 13.5 36.4537 13.5H45.0454C47.3547 13.5 49.1452 14.0737 50.4811 15.1554C51.807 16.2355 52.5 17.7865 52.5 19.9041C52.5 20.5056 52.4349 21.1538 52.3182 21.8307C51.797 24.7188 50.7507 26.7747 49.2137 28.0931L49.2137 28.0931L49.2098 28.0965C47.7088 29.4114 45.6187 30.089 42.876 30.089H38.5199H38.0999L38.0274 30.5027L36.547 38.9459C36.5469 38.9462 36.5469 38.9465 36.5468 38.9468C36.5091 39.1561 36.4461 39.269 36.3441 39.3603L36.336 39.3675L36.3282 39.3751C36.2254 39.4756 36.1417 39.5 36.0577 39.5H31.6672C31.6042 39.5 31.5786 39.4895 31.5704 39.4856C31.5661 39.4835 31.5571 39.4787 31.5433 39.4649C31.5056 39.3722 31.4892 39.2617 31.5075 39.109L35.9646 14.0533ZM47.3089 21.9345L47.311 21.9245L47.3126 21.9144C47.3845 21.4639 47.4221 21.0464 47.4221 20.6849C47.4221 19.8676 47.2132 19.1558 46.7423 18.6443C46.2393 18.0767 45.4247 17.863 44.4944 17.863H40.6204H40.2012L40.1281 18.2758L38.9056 25.1799L38.8017 25.7671H39.398H43.0998C44.1298 25.7671 45.0229 25.4377 45.7881 24.7596C46.5785 24.0747 47.0691 23.1234 47.3089 21.9345Z" fill="white" stroke="black"/>
</g>
<defs>
<clipPath id="clip0_102_46">
<rect width="61" height="55" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -1,7 +1,14 @@
import { LoggerInstance } from '@oceanprotocol/lib'
import { createClient, erc20ABI } from 'wagmi'
import { mainnet, polygon, goerli, polygonMumbai, sepolia } from 'wagmi/chains'
import { ethers, Contract, Signer, providers } from 'ethers'
import {
mainnet,
polygon,
optimism,
goerli,
polygonMumbai,
sepolia
} from 'wagmi/chains'
import { ethers, Contract, Signer } from 'ethers'
import { formatEther } from 'ethers/lib/utils'
import { getDefaultClient } from 'connectkit'
import { getNetworkDisplayName } from '@hooks/useNetworkMetadata'
@ -30,7 +37,7 @@ export const wagmiClient = createClient(
appName: 'Ocean Market',
infuraId: process.env.NEXT_PUBLIC_INFURA_PROJECT_ID,
// TODO: mapping between appConfig.chainIdsSupported and wagmi chainId
chains: [mainnet, polygon, goerli, polygonMumbai, sepolia],
chains: [mainnet, polygon, optimism, goerli, polygonMumbai, sepolia],
walletConnectProjectId: process.env.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID
})
)

View File

@ -4,6 +4,7 @@ import PolygonIcon from '@images/polygon.svg'
import MoonbeamIcon from '@images/moonbeam.svg'
import BscIcon from '@images/bsc.svg'
import EnergywebIcon from '@images/energyweb.svg'
import OptimismIcon from '@images/optimism.svg'
import styles from './index.module.css'
export function NetworkIcon({ name }: { name: string }): ReactElement {
@ -17,6 +18,8 @@ export function NetworkIcon({ name }: { name: string }): ReactElement {
? BscIcon
: name.includes('Energy Web')
? EnergywebIcon
: name.includes('OP Mainnet')
? OptimismIcon
: EthIcon // ETH icon as fallback
return <IconMapped className={styles.icon} />