diff --git a/client/__mocks__/user-mock.ts b/client/__mocks__/user-mock.ts
index 1f4e32e..b80f205 100644
--- a/client/__mocks__/user-mock.ts
+++ b/client/__mocks__/user-mock.ts
@@ -2,7 +2,7 @@ const userMock = {
isLogged: false,
isLoading: false,
isWeb3: false,
- isNile: false,
+ isCorrectNetwork: false,
account: '',
web3: {},
ocean: {},
@@ -17,7 +17,7 @@ const userMockConnected = {
isLogged: true,
isLoading: false,
isWeb3: true,
- isNile: true,
+ isCorrectNetwork: true,
account: '0xxxxxx',
web3: {},
ocean: {},
diff --git a/client/src/components/molecules/AccountStatus/Indicator.tsx b/client/src/components/molecules/AccountStatus/Indicator.tsx
index dd7c88a..b69ffbb 100644
--- a/client/src/components/molecules/AccountStatus/Indicator.tsx
+++ b/client/src/components/molecules/AccountStatus/Indicator.tsx
@@ -22,7 +22,7 @@ const Indicator = ({
{states =>
!states.isWeb3 ? (
- ) : !states.isLogged || !states.isNile ? (
+ ) : !states.isLogged || !states.isCorrectNetwork ? (
) : states.isLogged ? (
diff --git a/client/src/components/molecules/AccountStatus/Popover.test.tsx b/client/src/components/molecules/AccountStatus/Popover.test.tsx
index 8e6b2a9..12864fd 100644
--- a/client/src/components/molecules/AccountStatus/Popover.test.tsx
+++ b/client/src/components/molecules/AccountStatus/Popover.test.tsx
@@ -36,7 +36,11 @@ describe('Popover', () => {
it('renders with wrong network', () => {
const { container } = render(
null} style={{}} />
diff --git a/client/src/components/molecules/AccountStatus/Popover.tsx b/client/src/components/molecules/AccountStatus/Popover.tsx
index ea18d02..d5606dd 100644
--- a/client/src/components/molecules/AccountStatus/Popover.tsx
+++ b/client/src/components/molecules/AccountStatus/Popover.tsx
@@ -8,7 +8,13 @@ export default class Popover extends PureComponent<{
style: React.CSSProperties
}> {
public render() {
- const { account, balance, network, isWeb3, isNile } = this.context
+ const {
+ account,
+ balance,
+ network,
+ isWeb3,
+ isCorrectNetwork
+ } = this.context
return (
- {network && !isNile
+ {network && !isCorrectNetwork
? 'Please connect to Custom RPC\n https://nile.dev-ocean.com'
: network && `Connected to ${network} network`}
diff --git a/client/src/components/organisms/AssetsUser.tsx b/client/src/components/organisms/AssetsUser.tsx
index e839262..824d73f 100644
--- a/client/src/components/organisms/AssetsUser.tsx
+++ b/client/src/components/organisms/AssetsUser.tsx
@@ -57,10 +57,10 @@ export default class AssetsUser extends PureComponent<
}
public render() {
- const { account, isNile } = this.context
+ const { account, isCorrectNetwork } = this.context
return (
- isNile &&
+ isCorrectNetwork &&
account && (
{this.props.recent && (
diff --git a/client/src/components/organisms/Web3message.test.tsx b/client/src/components/organisms/Web3message.test.tsx
index e38e7c8..155d4f4 100644
--- a/client/src/components/organisms/Web3message.test.tsx
+++ b/client/src/components/organisms/Web3message.test.tsx
@@ -27,7 +27,9 @@ describe('Web3message', () => {
it('renders with noAccount message', () => {
const { container } = render(
-
+
)
@@ -49,7 +51,7 @@ describe('Web3message', () => {
value={{
...userMock,
isWeb3: true,
- isNile: true
+ isCorrectNetwork: true
}}
>
diff --git a/client/src/components/organisms/Web3message.tsx b/client/src/components/organisms/Web3message.tsx
index 6657ab3..0374986 100644
--- a/client/src/components/organisms/Web3message.tsx
+++ b/client/src/components/organisms/Web3message.tsx
@@ -32,7 +32,7 @@ export default class Web3message extends PureComponent {
public render() {
const {
isWeb3,
- isNile,
+ isCorrectNetwork,
isLogged,
account,
unlockAccounts
@@ -40,7 +40,7 @@ export default class Web3message extends PureComponent {
return !isWeb3
? this.message(content.noweb3)
- : !isNile
+ : !isCorrectNetwork
? this.message(content.wrongNetwork)
: !isLogged
? this.message(content.noAccount, '', unlockAccounts)
diff --git a/client/src/context/UserProvider.tsx b/client/src/context/UserProvider.tsx
index f6c1dff..1d19131 100644
--- a/client/src/context/UserProvider.tsx
+++ b/client/src/context/UserProvider.tsx
@@ -46,7 +46,7 @@ interface UserProviderState {
isLogged: boolean
isLoading: boolean
isWeb3: boolean
- isNile: boolean
+ isCorrectNetwork: boolean
account: string
balance: {
eth: number
@@ -74,7 +74,7 @@ export default class UserProvider extends PureComponent<{}, UserProviderState> {
isLogged: false,
isLoading: true,
isWeb3: false,
- isNile: false,
+ isCorrectNetwork: false,
balance: {
eth: 0,
ocn: 0
@@ -151,23 +151,31 @@ export default class UserProvider extends PureComponent<{}, UserProviderState> {
//
// Detecting network with window.web3
//
- let isNile
+ let isCorrectNetwork
await window.web3.eth.net.getId((err, netId) => {
if (err) return
- isNile = netId === 8995
- const network = isNile ? 'Nile' : netId.toString()
+ const isNile = netId === 8995
+ const isDuero = netId === 2199
+
+ isCorrectNetwork = isNile || isDuero
+
+ const network = isNile
+ ? 'Nile'
+ : isDuero
+ ? 'Duero'
+ : netId.toString()
if (
- isNile !== this.state.isNile ||
+ isCorrectNetwork !== this.state.isCorrectNetwork ||
network !== this.state.network
) {
- this.setState({ isNile, network })
+ this.setState({ isCorrectNetwork, network })
}
})
- if (!isNile) {
+ if (!isCorrectNetwork) {
web3 = this.state.web3 // eslint-disable-line
}
@@ -201,13 +209,13 @@ export default class UserProvider extends PureComponent<{}, UserProviderState> {
}
private fetchAccounts = async () => {
- const { ocean, isWeb3, isLogged, isNile } = this.state
+ const { ocean, isWeb3, isLogged, isCorrectNetwork } = this.state
if (isWeb3) {
let accounts
// Modern dapp browsers
- if (window.ethereum && !isLogged && isNile) {
+ if (window.ethereum && !isLogged && isCorrectNetwork) {
// simply set to empty, and have user click a button somewhere
// to initiate account unlocking
accounts = []
@@ -250,8 +258,11 @@ export default class UserProvider extends PureComponent<{}, UserProviderState> {
if (isWeb3) {
const network = await ocean.keeper.getNetworkName()
const isNile = network === 'Nile'
+ const isDuero = network === 'Development'
+ const isCorrectNetwork = isNile || isDuero
- network !== this.state.network && this.setState({ isNile, network })
+ network !== this.state.network &&
+ this.setState({ isCorrectNetwork, network })
}
}
diff --git a/client/src/context/index.tsx b/client/src/context/index.tsx
index eab3aa1..a64937e 100644
--- a/client/src/context/index.tsx
+++ b/client/src/context/index.tsx
@@ -4,7 +4,7 @@ export const User = React.createContext({
isLogged: false,
isLoading: false,
isWeb3: false,
- isNile: false,
+ isCorrectNetwork: false,
account: '',
web3: {},
ocean: {},
diff --git a/client/src/routes/Details/AssetFile.test.tsx b/client/src/routes/Details/AssetFile.test.tsx
index 576e154..d1c69c8 100644
--- a/client/src/routes/Details/AssetFile.test.tsx
+++ b/client/src/routes/Details/AssetFile.test.tsx
@@ -20,7 +20,7 @@ const contextConnectedMock = {
isLogged: true,
isLoading: false,
isWeb3: true,
- isNile: true,
+ isCorrectNetwork: true,
account: '',
web3: {},
ocean: {},
diff --git a/client/src/routes/Details/AssetFile.tsx b/client/src/routes/Details/AssetFile.tsx
index 758aba7..6de7054 100644
--- a/client/src/routes/Details/AssetFile.tsx
+++ b/client/src/routes/Details/AssetFile.tsx
@@ -76,7 +76,7 @@ export default class AssetFile extends PureComponent<
public render() {
const { ddo, file } = this.props
const { isLoading, message, error } = this.state
- const { isLogged, isNile } = this.context
+ const { isLogged, isCorrectNetwork } = this.context
const { index } = file
return (
@@ -102,7 +102,7 @@ export default class AssetFile extends PureComponent<
// https://github.com/oceanprotocol/squid-js/pull/221
// is released
onClick={() => this.purchaseAsset(ddo, index || 0)}
- disabled={!isLogged || !isNile}
+ disabled={!isLogged || !isCorrectNetwork}
>
Get file
diff --git a/client/src/routes/Details/AssetFilesDetails.tsx b/client/src/routes/Details/AssetFilesDetails.tsx
index 17df7f3..5d16575 100644
--- a/client/src/routes/Details/AssetFilesDetails.tsx
+++ b/client/src/routes/Details/AssetFilesDetails.tsx
@@ -19,7 +19,7 @@ export default class AssetFilesDetails extends PureComponent<{
))}
- {(!this.context.isNile || !this.context.isLogged) && (
+ {(!this.context.isCorrectNetwork || !this.context.isLogged) && (
)}
>
diff --git a/client/src/routes/Faucet.tsx b/client/src/routes/Faucet.tsx
index 527774e..76556dd 100644
--- a/client/src/routes/Faucet.tsx
+++ b/client/src/routes/Faucet.tsx
@@ -80,7 +80,9 @@ export default class Faucet extends PureComponent<{}, FaucetState> {
diff --git a/client/src/routes/History.test.tsx b/client/src/routes/History.test.tsx
index 4dd3ab8..5eae99a 100644
--- a/client/src/routes/History.test.tsx
+++ b/client/src/routes/History.test.tsx
@@ -14,7 +14,7 @@ describe('History', () => {
isLogged: false,
isLoading: false,
isWeb3: false,
- isNile: false,
+ isCorrectNetwork: false,
account: '',
web3: {},
ocean: {},
diff --git a/client/src/routes/History.tsx b/client/src/routes/History.tsx
index a895287..2b13c28 100644
--- a/client/src/routes/History.tsx
+++ b/client/src/routes/History.tsx
@@ -8,7 +8,7 @@ export default class History extends Component {
public render() {
return (
- {(!this.context.isLogged || !this.context.isNile) && (
+ {(!this.context.isLogged || !this.context.isCorrectNetwork) && (
)}
diff --git a/client/src/routes/Publish/index.tsx b/client/src/routes/Publish/index.tsx
index eac62f3..4bc1349 100644
--- a/client/src/routes/Publish/index.tsx
+++ b/client/src/routes/Publish/index.tsx
@@ -319,7 +319,7 @@ class Publish extends Component<{}, PublishState> {
title="Publish"
description="Publish a new data set into the Ocean Protocol Network."
>
- {(!this.context.isLogged || !this.context.isNile) && (
+ {(!this.context.isLogged || !this.context.isCorrectNetwork) && (
)}
diff --git a/client/src/routes/Search.test.tsx b/client/src/routes/Search.test.tsx
index b8bf5d8..7663f93 100644
--- a/client/src/routes/Search.test.tsx
+++ b/client/src/routes/Search.test.tsx
@@ -14,7 +14,7 @@ describe('Search', () => {
isLogged: false,
isLoading: false,
isWeb3: false,
- isNile: false,
+ isCorrectNetwork: false,
account: '',
web3: {},
ocean: {