mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
init network switcher component
This commit is contained in:
parent
70a3339f8b
commit
8023e30061
@ -26,7 +26,13 @@
|
||||
"error",
|
||||
{ "multiline": { "delimiter": "none" } }
|
||||
],
|
||||
"@typescript-eslint/no-explicit-any": "off"
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"react/no-unescaped-entities": 0,
|
||||
"react/self-closing-comp": 0,
|
||||
"react/void-dom-elements-no-children": 0,
|
||||
"react/jsx-indent": 0,
|
||||
"react/jsx-indent-props": 0,
|
||||
"react/jsx-max-props-per-line": 0
|
||||
},
|
||||
"env": {
|
||||
"es6": true,
|
||||
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"semi": false,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none"
|
||||
"trailingComma": "none",
|
||||
"tabWidth": 2
|
||||
}
|
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"typescript.tsdk": "node_modules/typescript/lib"
|
||||
}
|
@ -5,9 +5,12 @@ import Footer from './components/organisms/Footer'
|
||||
import Spinner from './components/atoms/Spinner'
|
||||
import { User } from './context'
|
||||
import Routes from './Routes'
|
||||
import {commonsNetwork} from './components/molecules/NetworkSwitcher'
|
||||
import './styles/global.scss'
|
||||
import styles from './App.module.scss'
|
||||
|
||||
console.log(commonsNetwork)
|
||||
|
||||
export default class App extends Component {
|
||||
public render() {
|
||||
return (
|
||||
@ -25,7 +28,6 @@ export default class App extends Component {
|
||||
<Routes />
|
||||
)}
|
||||
</main>
|
||||
|
||||
<Footer />
|
||||
</>
|
||||
</Router>
|
||||
@ -34,4 +36,5 @@ export default class App extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
App.contextType = User
|
||||
|
12
client/src/components/molecules/NetworkSwitcher.tsx
Normal file
12
client/src/components/molecules/NetworkSwitcher.tsx
Normal file
@ -0,0 +1,12 @@
|
||||
import { CONNECTIONS } from '../../config'
|
||||
|
||||
/* TEMP NETWORK SWITCHER */
|
||||
|
||||
const urlParams = new URLSearchParams(window.location.search)
|
||||
const network = urlParams.get('network') || 'pacific'
|
||||
const idx = Object.keys(CONNECTIONS).indexOf(network)
|
||||
const commonsNetwork = Object.values(CONNECTIONS)[idx]
|
||||
|
||||
|
||||
|
||||
export { commonsNetwork }
|
@ -3,6 +3,7 @@ import { VersionNumbersState } from '.'
|
||||
import VersionTableRow from './VersionTableRow'
|
||||
import styles from './VersionTable.module.scss'
|
||||
import VersionNumber from './VersionNumber'
|
||||
import { useParams } from 'react-router-dom'
|
||||
|
||||
import {
|
||||
serviceUri,
|
||||
@ -11,9 +12,11 @@ import {
|
||||
brizoUri,
|
||||
brizoAddress,
|
||||
secretStoreUri,
|
||||
faucetUri
|
||||
faucetUri,
|
||||
CONNECTIONS
|
||||
} from '../../../config'
|
||||
|
||||
|
||||
const commonsConfig = {
|
||||
serviceUri,
|
||||
nodeUri,
|
||||
@ -42,10 +45,7 @@ export const VersionTableContracts = ({
|
||||
<strong>Keeper Contracts</strong>
|
||||
</td>
|
||||
<td>
|
||||
<VersionNumber
|
||||
name="Keeper Contracts"
|
||||
version={keeperVersion}
|
||||
/>
|
||||
<VersionNumber name="Keeper Contracts" version={keeperVersion} />
|
||||
</td>
|
||||
</tr>
|
||||
{contracts &&
|
||||
@ -54,12 +54,11 @@ export const VersionTableContracts = ({
|
||||
.sort((a, b) => a.localeCompare(b))
|
||||
.map(key => {
|
||||
const submarineLink = `https://submarine.${
|
||||
network === 'pacific'
|
||||
? 'oceanprotocol'
|
||||
: `${network}.dev-ocean`
|
||||
network === 'pacific' ? 'oceanprotocol' : `${network}.dev-ocean`
|
||||
}.com/address/${contracts[key]}`
|
||||
|
||||
return (
|
||||
|
||||
<tr key={key}>
|
||||
<td>
|
||||
<code className={styles.label}>{key}</code>
|
||||
|
@ -40,3 +40,30 @@ export const ipfsGatewayUri =
|
||||
process.env.REACT_APP_IPFS_GATEWAY_URI || 'https://gateway.ipfs.io'
|
||||
export const ipfsNodeUri =
|
||||
process.env.REACT_APP_IPFS_NODE_URI || 'https://ipfs.infura.io:5001'
|
||||
|
||||
export const CONNECTIONS = {
|
||||
pacific: {
|
||||
nodeUri: 'https://pacific.oceanprotocol.com',
|
||||
aquariusUri: 'https://aquarius.commons.oceanprotocol.com',
|
||||
brizoUri: 'https://brizo.commons.oceanprotocol.com',
|
||||
brizoAddress: '0x008c25ed3594e094db4592f4115d5fa74c4f41ea',
|
||||
secretStoreUri: 'https://secret-store.oceanprotocol.com',
|
||||
faucetUri: 'https://faucet.oceanprotocol.com'
|
||||
},
|
||||
nile: {
|
||||
nodeUri: 'https://nile.dev-ocean.com',
|
||||
aquariusUri: 'https://aquarius.nile.dev-ocean.com',
|
||||
brizoUri: 'https://brizo.nile.dev-ocean.com',
|
||||
brizoAddress: '0x4aaab179035dc57b35e2ce066919048686f82972',
|
||||
secretStoreUri: 'https://secret-store.nile.dev-ocean.com',
|
||||
faucetUri: 'https://faucet.nile.dev-ocean.com'
|
||||
},
|
||||
duero: {
|
||||
nodeUri: 'https://duero.dev-ocean.com',
|
||||
aquariusUri: 'https://aquarius.duero.dev-ocean.com',
|
||||
brizoUri: 'https://brizo.duero.dev-ocean.com',
|
||||
brizoAddress: '0x9d4ed58293f71122ad6a733c1603927a150735d0',
|
||||
secretStoreUri: 'https://secret-store.duero.dev-ocean.com',
|
||||
faucetUri: 'https://faucet.duero.dev-ocean.com'
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ export { renderToDOM }
|
||||
|
||||
renderToDOM()
|
||||
|
||||
|
||||
// If you want your app to work offline and load faster, you can change
|
||||
// unregister() to register() below. Note this comes with some pitfalls.
|
||||
// Learn more about service workers: http://bit.ly/CRA-PWA
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { Ocean, Logger } from '@oceanprotocol/squid'
|
||||
import Web3 from 'web3'
|
||||
import { User } from './context'
|
||||
|
||||
import {
|
||||
aquariusUri,
|
||||
@ -11,6 +12,8 @@ import {
|
||||
verbose
|
||||
} from './config'
|
||||
|
||||
|
||||
|
||||
export async function provideOcean(web3Provider: Web3) {
|
||||
const config = {
|
||||
web3Provider,
|
||||
|
@ -74,8 +74,7 @@ export default class Files extends PureComponent<FilesProps, FilesStates> {
|
||||
|
||||
this.setState({
|
||||
isFormShown: form === 'url' ? !this.state.isFormShown : false,
|
||||
isIpfsFormShown:
|
||||
form === 'ipfs' ? !this.state.isIpfsFormShown : false
|
||||
isIpfsFormShown: form === 'ipfs' ? !this.state.isIpfsFormShown : false
|
||||
})
|
||||
}
|
||||
|
||||
@ -194,9 +193,7 @@ export default class Files extends PureComponent<FilesProps, FilesStates> {
|
||||
<Button
|
||||
key={shortid.generate()}
|
||||
link
|
||||
onClick={(e: Event) =>
|
||||
this.toggleForm(e, button.id)
|
||||
}
|
||||
onClick={(e: Event) => this.toggleForm(e, button.id)}
|
||||
>
|
||||
{isActive ? button.titleActive : button.title}
|
||||
</Button>
|
||||
@ -204,10 +201,7 @@ export default class Files extends PureComponent<FilesProps, FilesStates> {
|
||||
})}
|
||||
|
||||
{isFormShown && (
|
||||
<ItemForm
|
||||
placeholder={placeholder}
|
||||
addFile={this.addFile}
|
||||
/>
|
||||
<ItemForm placeholder={placeholder} addFile={this.addFile} />
|
||||
)}
|
||||
|
||||
{isIpfsFormShown && (
|
||||
|
Loading…
Reference in New Issue
Block a user