Skip to content

Commit

Permalink
Added op mainnet into the Ocean market (#2007)
Browse files Browse the repository at this point in the history
* Bump to ocean.js 3.2.0

* Added optimism network

* Added optimism network

* Enabled optimism network by default
  • Loading branch information
LoznianuAnamaria authored Nov 29, 2023
1 parent 4ced71c commit 1e09614
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 21 deletions.
4 changes: 2 additions & 2 deletions app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down
30 changes: 15 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions src/@hooks/useNetworkMetadata/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions src/@images/optimism.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 10 additions & 3 deletions src/@utils/wallet/index.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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
})
)
Expand Down
3 changes: 3 additions & 0 deletions src/components/@shared/NetworkName/NetworkIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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} />
Expand Down

1 comment on commit 1e09614

@vercel
Copy link

@vercel vercel bot commented on 1e09614 Nov 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.