From 24ee7facc666d335da0b49b6febdb32cd4fe5d63 Mon Sep 17 00:00:00 2001 From: Ana Loznianu Date: Tue, 28 Nov 2023 15:40:12 +0200 Subject: [PATCH 1/4] Bump to ocean.js 3.2.0 --- package-lock.json | 30 +++++++++++++++--------------- package.json | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9b38f0efb..f430b75c5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index fad2a6454..a9cfa452d 100644 --- a/package.json +++ b/package.json @@ -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", From 66b292f429ce20501216eb0b4112acb61dba717b Mon Sep 17 00:00:00 2001 From: Ana Loznianu Date: Tue, 28 Nov 2023 15:59:06 +0200 Subject: [PATCH 2/4] Added optimism network --- app.config.js | 2 +- src/@images/optimism.svg | 21 +++++++++++++++++++ src/@utils/wallet/index.ts | 13 +++++++++--- .../@shared/NetworkName/NetworkIcon.tsx | 3 +++ 4 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 src/@images/optimism.svg diff --git a/app.config.js b/app.config.js index 19fd3e8d2..85d6887eb 100644 --- a/app.config.js +++ b/app.config.js @@ -11,7 +11,7 @@ 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], diff --git a/src/@images/optimism.svg b/src/@images/optimism.svg new file mode 100644 index 000000000..098392b7f --- /dev/null +++ b/src/@images/optimism.svg @@ -0,0 +1,21 @@ + + + + + + + + diff --git a/src/@utils/wallet/index.ts b/src/@utils/wallet/index.ts index c45cbf3ea..d8de6b5e1 100644 --- a/src/@utils/wallet/index.ts +++ b/src/@utils/wallet/index.ts @@ -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 }) ) diff --git a/src/components/@shared/NetworkName/NetworkIcon.tsx b/src/components/@shared/NetworkName/NetworkIcon.tsx index 38c4be8f8..e5140bbea 100644 --- a/src/components/@shared/NetworkName/NetworkIcon.tsx +++ b/src/components/@shared/NetworkName/NetworkIcon.tsx @@ -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('Optimism') + ? OptimismIcon : EthIcon // ETH icon as fallback return From c964c30cb1d98b705c8d0f4d9b7e5738e46c49c4 Mon Sep 17 00:00:00 2001 From: Ana Loznianu Date: Tue, 28 Nov 2023 16:26:00 +0200 Subject: [PATCH 3/4] Added optimism network --- app.config.js | 4 +-- src/@hooks/useNetworkMetadata/utils.ts | 3 ++ src/@images/optimism.svg | 31 +++++++------------ .../@shared/NetworkName/NetworkIcon.tsx | 2 +- 4 files changed, 17 insertions(+), 23 deletions(-) diff --git a/app.config.js b/app.config.js index 85d6887eb..4629839ab 100644 --- a/app.config.js +++ b/app.config.js @@ -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, 10], + chainIds: [1, 137], // 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, diff --git a/src/@hooks/useNetworkMetadata/utils.ts b/src/@hooks/useNetworkMetadata/utils.ts index 37f795d67..ae7652699 100644 --- a/src/@hooks/useNetworkMetadata/utils.ts +++ b/src/@hooks/useNetworkMetadata/utils.ts @@ -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 diff --git a/src/@images/optimism.svg b/src/@images/optimism.svg index 098392b7f..deb0f7b84 100644 --- a/src/@images/optimism.svg +++ b/src/@images/optimism.svg @@ -1,21 +1,12 @@ - - - - - - - + + + + + + + + + + + diff --git a/src/components/@shared/NetworkName/NetworkIcon.tsx b/src/components/@shared/NetworkName/NetworkIcon.tsx index e5140bbea..5f63f91a5 100644 --- a/src/components/@shared/NetworkName/NetworkIcon.tsx +++ b/src/components/@shared/NetworkName/NetworkIcon.tsx @@ -18,7 +18,7 @@ export function NetworkIcon({ name }: { name: string }): ReactElement { ? BscIcon : name.includes('Energy Web') ? EnergywebIcon - : name.includes('Optimism') + : name.includes('OP Mainnet') ? OptimismIcon : EthIcon // ETH icon as fallback From 422c43b37c111fdae91c67478bc2be4347e7d521 Mon Sep 17 00:00:00 2001 From: Ana Loznianu Date: Wed, 29 Nov 2023 13:24:20 +0200 Subject: [PATCH 4/4] Enabled optimism network by default --- app.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.config.js b/app.config.js index 4629839ab..2bd5f964a 100644 --- a/app.config.js +++ b/app.config.js @@ -11,7 +11,7 @@ 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, 10, 5, 80001, 11155111],