- {network && !isCorrectNetwork
+ {network && !isOceanNetwork
? '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 824d73f..bb675d1 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, isCorrectNetwork } = this.context
+ const { account, isOceanNetwork } = this.context
return (
- isCorrectNetwork &&
+ isOceanNetwork &&
account && (
{this.props.recent && (
diff --git a/client/src/components/organisms/Web3message.test.tsx b/client/src/components/organisms/Web3message.test.tsx
index 155d4f4..9c5b223 100644
--- a/client/src/components/organisms/Web3message.test.tsx
+++ b/client/src/components/organisms/Web3message.test.tsx
@@ -28,7 +28,7 @@ describe('Web3message', () => {
it('renders with noAccount message', () => {
const { container } = render(
@@ -51,7 +51,7 @@ describe('Web3message', () => {
value={{
...userMock,
isWeb3: true,
- isCorrectNetwork: true
+ isOceanNetwork: true
}}
>
diff --git a/client/src/components/organisms/Web3message.tsx b/client/src/components/organisms/Web3message.tsx
index 0374986..e726ae8 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,
- isCorrectNetwork,
+ isOceanNetwork,
isLogged,
account,
unlockAccounts
@@ -40,7 +40,7 @@ export default class Web3message extends PureComponent {
return !isWeb3
? this.message(content.noweb3)
- : !isCorrectNetwork
+ : !isOceanNetwork
? 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 1d19131..743975a 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
- isCorrectNetwork: boolean
+ isOceanNetwork: boolean
account: string
balance: {
eth: number
@@ -74,7 +74,7 @@ export default class UserProvider extends PureComponent<{}, UserProviderState> {
isLogged: false,
isLoading: true,
isWeb3: false,
- isCorrectNetwork: false,
+ isOceanNetwork: false,
balance: {
eth: 0,
ocn: 0
@@ -151,15 +151,16 @@ export default class UserProvider extends PureComponent<{}, UserProviderState> {
//
// Detecting network with window.web3
//
- let isCorrectNetwork
+ let isOceanNetwork
await window.web3.eth.net.getId((err, netId) => {
if (err) return
const isNile = netId === 8995
const isDuero = netId === 2199
+ const isSpree = netId === 8996
- isCorrectNetwork = isNile || isDuero
+ isOceanNetwork = isNile || isDuero || isSpree
const network = isNile
? 'Nile'
@@ -168,14 +169,14 @@ export default class UserProvider extends PureComponent<{}, UserProviderState> {
: netId.toString()
if (
- isCorrectNetwork !== this.state.isCorrectNetwork ||
+ isOceanNetwork !== this.state.isOceanNetwork ||
network !== this.state.network
) {
- this.setState({ isCorrectNetwork, network })
+ this.setState({ isOceanNetwork, network })
}
})
- if (!isCorrectNetwork) {
+ if (!isOceanNetwork) {
web3 = this.state.web3 // eslint-disable-line
}
@@ -203,19 +204,19 @@ export default class UserProvider extends PureComponent<{}, UserProviderState> {
} catch (e) {
// error in bootstrap process
// show error connecting to ocean
- Logger.log('web3 error', e)
+ Logger.error('web3 error', e.message)
this.setState({ isLoading: false })
}
}
private fetchAccounts = async () => {
- const { ocean, isWeb3, isLogged, isCorrectNetwork } = this.state
+ const { ocean, isWeb3, isLogged, isOceanNetwork } = this.state
if (isWeb3) {
let accounts
// Modern dapp browsers
- if (window.ethereum && !isLogged && isCorrectNetwork) {
+ if (window.ethereum && !isLogged && isOceanNetwork) {
// simply set to empty, and have user click a button somewhere
// to initiate account unlocking
accounts = []
@@ -258,11 +259,12 @@ 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
+ const isDuero = network === 'Duero'
+ const isSpree = network === 'Spree'
+ const isOceanNetwork = isNile || isDuero || isSpree
network !== this.state.network &&
- this.setState({ isCorrectNetwork, network })
+ this.setState({ isOceanNetwork, network })
}
}
diff --git a/client/src/context/index.tsx b/client/src/context/index.tsx
index a64937e..0cdf47d 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,
- isCorrectNetwork: false,
+ isOceanNetwork: false,
account: '',
web3: {},
ocean: {},
diff --git a/client/src/ocean.ts b/client/src/ocean.ts
index 511788a..8ce2ed8 100644
--- a/client/src/ocean.ts
+++ b/client/src/ocean.ts
@@ -72,6 +72,6 @@ export async function requestFromFaucet(account: string) {
})
return response.json()
} catch (error) {
- Logger.error('requestFromFaucet', error)
+ Logger.error('requestFromFaucet', error.message)
}
}
diff --git a/client/src/routes/Details/AssetFile.test.tsx b/client/src/routes/Details/AssetFile.test.tsx
index d1c69c8..2b866d6 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,
- isCorrectNetwork: true,
+ isOceanNetwork: true,
account: '',
web3: {},
ocean: {},
diff --git a/client/src/routes/Details/AssetFile.tsx b/client/src/routes/Details/AssetFile.tsx
index 6de7054..8c3ebb0 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, isCorrectNetwork } = this.context
+ const { isLogged, isOceanNetwork } = 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 || !isCorrectNetwork}
+ disabled={!isLogged || !isOceanNetwork}
>
Get file
diff --git a/client/src/routes/Details/AssetFilesDetails.tsx b/client/src/routes/Details/AssetFilesDetails.tsx
index 5d16575..4199e82 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.isCorrectNetwork || !this.context.isLogged) && (
+ {(!this.context.isOceanNetwork || !this.context.isLogged) && (