diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..8b4c4168b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,35 @@ +# See https://help.github.com/ignore-files/ for more about ignoring files. + +# configuration +# (keep `.env.enc` and `.env.sample`, but ignore all other `.env`s) +.env* +!.env.enc +!.env.sample + +# dependencies +node_modules/ + +# testing +coverage/ + +# production +public/ + +# zeit now configuration +.now + +# misc +.DS_Store +.cache + +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +public/apps/ +public/aragon-ui/ + +# ignore package-lock files (only use yarn.lock) +package-lock.json + +.github diff --git a/.env.sample b/.env.sample index e7fa53684..0814776cc 100644 --- a/.env.sample +++ b/.env.sample @@ -1,3 +1,4 @@ ARAGON_PORTIS_DAPP_ID= ARAGON_FORTMATIC_API_KEY= ARAGON_SENTRY_DSN= +ARAGON_WALLETCONNECT_RPC_URL= \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..918d6ec3d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +FROM node:12 + +RUN yarn global add http-server + +WORKDIR /aragon +COPY package.json yarn.lock ./ + +RUN yarn install --frozen-lockfile --non-interactive --ignore-optional \ + && yarn cache clean +COPY . . + +ARG ARAGON_APP_LOCATOR +ARG ARAGON_ETH_NETWORK_TYPE +ARG ARAGON_ENS_REGISTRY_ADDRESS +ARG ARAGON_IPFS_GATEWAY +ARG ARAGON_DEFAULT_ETH_NODE +ARG ARAGON_WALLETCONNECT_RPC_URL +ARG ARAGON_PORTIS_DAPP_ID +ARG ARAGON_FORTMATIC_API_KEY +ARG ARAGON_SENTRY_DSN + +ENV ARAGON_APP_LOCATOR=$ARAGON_APP_LOCATOR +ENV ARAGON_ETH_NETWORK_TYPE=$ARAGON_ETH_NETWORK_TYPE +ENV ARAGON_ENS_REGISTRY_ADDRESS=$ARAGON_ENS_REGISTRY_ADDRESS +ENV ARAGON_IPFS_GATEWAY=$ARAGON_IPFS_GATEWAY +ENV ARAGON_DEFAULT_ETH_NODE=$ARAGON_DEFAULT_ETH_NODE +ENV ARAGON_WALLETCONNECT_RPC_URL=$ARAGON_WALLETCONNECT_RPC_URL +ENV ARAGON_PORTIS_DAPP_ID=$ARAGON_PORTIS_DAPP_ID +ENV ARAGON_FORTMATIC_API_KEY=$ARAGON_FORTMATIC_API_KEY +ENV ARAGON_SENTRY_DSN=$ARAGON_SENTRY_DSN +ENV NODE_OPTIONS=--max_old_space_size=4096 +RUN yarn build + +ENTRYPOINT ["http-server"] diff --git a/build.sh b/build.sh new file mode 100755 index 000000000..f0637b205 --- /dev/null +++ b/build.sh @@ -0,0 +1,34 @@ +#!/bin/bash +source ./.env +set -e +u +set -o pipefail + +: ${TAG:=rinkeby} +IMG="lidofinance/aragon-client" +export DOCKER_CONFIG=$HOME/.lidofinance + +# : ${ARAGON_APP_LOCATOR:=ipfs} +# : ${ARAGON_ETH_NETWORK_TYPE:=main} +# : ${ARAGON_ENS_REGISTRY_ADDRESS:=0x314159265dd8dbb310642f98f50c066173c1259b} +# : ${ARAGON_IPFS_GATEWAY:=https://ipfs.eth.aragon.network/ipfs} +# : ${ARAGON_DEFAULT_ETH_NODE:=wss://mainnet.eth.aragon.network/ws} +# : ${ARAGON_WALLETCONNECT_RPC_URL:=https://mainnet.eth.aragon.network} +# : ${ARAGON_PORTIS_DAPP_ID:=} +# : ${ARAGON_FORTMATIC_API_KEY:=} +# : ${ARAGON_SENTRY_DSN:=} + +echo "Building $IMG:$TAG Docker image..." +docker build \ + --build-arg ARAGON_APP_LOCATOR=$ARAGON_APP_LOCATOR \ + --build-arg ARAGON_ETH_NETWORK_TYPE=$ARAGON_ETH_NETWORK_TYPE \ + --build-arg ARAGON_ENS_REGISTRY_ADDRESS=$ARAGON_ENS_REGISTRY_ADDRESS \ + --build-arg ARAGON_DEFAULT_ETH_NODE=$ARAGON_DEFAULT_ETH_NODE \ + --build-arg ARAGON_IPFS_GATEWAY=$ARAGON_IPFS_GATEWAY \ + --build-arg ARAGON_WALLETCONNECT_RPC_URL=$ARAGON_WALLETCONNECT_RPC_URL \ + --build-arg ARAGON_PORTIS_DAPP_ID=$ARAGON_PORTIS_DAPP_ID \ + --build-arg ARAGON_FORTMATIC_API_KEY=$ARAGON_FORTMATIC_API_KEY \ + --build-arg ARAGON_SENTRY_DSN=$ARAGON_SENTRY_DSN \ + -t $IMG:$TAG . + +echo "Pushing $IMG:$TAG to the Docker Hub" +docker push $IMG:$TAG diff --git a/build_local.sh b/build_local.sh new file mode 100755 index 000000000..fd4b52500 --- /dev/null +++ b/build_local.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +ARAGON_IPFS_GATEWAY=http://localhost:8080/ipfs \ +ARAGON_DEFAULT_ETH_NODE=ws://localhost:8546 \ +ARAGON_APP_LOCATOR=ipfs \ +ARAGON_ETH_NETWORK_TYPE=local \ +ARAGON_ENS_REGISTRY_ADDRESS=0x5f6f7e8cc7346a11ca2def8f827b7a0b612c56a1 \ +TAG=local ./build.sh diff --git a/build_mainnet.sh b/build_mainnet.sh new file mode 100755 index 000000000..a7ebdeed4 --- /dev/null +++ b/build_mainnet.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +ARAGON_ETH_NETWORK_TYPE=main \ +ARAGON_DEFAULT_ETH_NODE=wss://mainnet.infura.io/ws/v3/e03b2755aaf24488aa013b9aed8c4170 \ +ARAGON_WALLETCONNECT_RPC_URL=https://mainnet.infura.io/v3/e03b2755aaf24488aa013b9aed8c4170 \ +TAG=mainnet-infura ./build.sh diff --git a/build_rinkeby.sh b/build_rinkeby.sh new file mode 100755 index 000000000..3e99a9fd8 --- /dev/null +++ b/build_rinkeby.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +ARAGON_ETH_NETWORK_TYPE=rinkeby \ +TAG=rinkeby ./build.sh diff --git a/build_testnet.sh b/build_testnet.sh new file mode 100755 index 000000000..66f01ae7f --- /dev/null +++ b/build_testnet.sh @@ -0,0 +1,11 @@ +#!/bin/bash + + +ARAGON_IPFS_GATEWAY=https://goerli.lido.fi/ipfs \ +ARAGON_DEFAULT_ETH_NODE=wss://goerli-light.eth.linkpool.io/ws \ +ARAGON_WALLETCONNECT_RPC_URL=https://goerli-light.eth.linkpool.io \ +ARAGON_APP_LOCATOR=ipfs \ +ARAGON_ETH_NETWORK_TYPE=goerli \ +ARAGON_ENS_REGISTRY_ADDRESS=0x043e6dbc5cad60874727d21ecc2aaebf50a0de80 \ +TAG=testnet ./build.sh + diff --git a/package.json b/package.json index 8f7c93940..fac3002ef 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "dependencies": { "@aragon/templates-tokens": "^1.2.1", "@aragon/ui": "^1.5.0", - "@aragon/wrapper": "^5.0.0-rc.28", + "@1hive/wrapper": "^5.0.0", "@sentry/browser": "^5.17.0", "@ungap/event-target": "^0.1.0", "clipboard-polyfill": "^2.8.6", @@ -98,8 +98,8 @@ "rimraf": "^2.6.2" }, "resolutions": { - "@aragon/wrapper/web3": "1.2.6", - "@aragon/wrapper/web3-eth-abi": "1.2.6" + "@1hive/wrapper/web3": "1.2.6", + "@1hive/wrapper/web3-eth-abi": "1.2.6" }, "scripts": { "bundlewatch": "bundlewatch", @@ -110,6 +110,7 @@ "start:staging": "cross-env ARAGON_ENS_REGISTRY_ADDRESS=0xfe03625ea880a8cba336f9b5ad6e15b0a3b5a939 npm start", "start:ropsten": "cross-env ARAGON_ETH_NETWORK_TYPE=ropsten npm start", "start:xdai": "cross-env ARAGON_ETH_NETWORK_TYPE=xdai npm start", + "start:polygon": "cross-env ARAGON_ETH_NETWORK_TYPE=polygon npm start", "build": "node scripts/build", "build:local": "node scripts/build-local", "build:mainnet": "cross-env ARAGON_ETH_NETWORK_TYPE=main npm run build", @@ -117,6 +118,7 @@ "build:staging": "cross-env ARAGON_ENS_REGISTRY_ADDRESS=0xfe03625ea880a8cba336f9b5ad6e15b0a3b5a939 npm run build", "build:ropsten": "cross-env ARAGON_ETH_NETWORK_TYPE=ropsten npm run build", "build:xdai": "cross-env ARAGON_ETH_NETWORK_TYPE=xdai npm run build", + "build:polygon": "cross-env ARAGON_ETH_NETWORK_TYPE=polygon npm run build", "lint": "eslint ./src", "test": "npm run lint && npm run jest", "jest": "jest", diff --git a/scripts/build b/scripts/build index 994382739..8ac9e7928 100755 --- a/scripts/build +++ b/scripts/build @@ -19,6 +19,6 @@ process.env.ARAGON_PACKAGE_VERSION = commitSha ? `${version}-${commitSha}` : version execute( - `parcel build src/index.html --out-dir ./${buildDir} --public-url ./ --no-cache`, + `parcel build src/index.html --out-dir ./${buildDir} --public-url ./ --no-cache --no-source-maps`, { stdio: 'inherit' } ) diff --git a/src/App.js b/src/App.js index 3078e61c6..9bc93f5c6 100644 --- a/src/App.js +++ b/src/App.js @@ -45,12 +45,11 @@ const INITIAL_DAO_STATE = { } const SELECTOR_NETWORKS = [ - ['main', 'Ethereum Mainnet', 'https://client.aragon.org/'], - [ - 'rinkeby', - 'Ethereum Testnet (Rinkeby)', - 'https://rinkeby.client.aragon.org/', - ], + [100, 'xdai', 'xDai Network', '.'], // the dots are used to direct the app to the same page, as a refresh + [137, 'polygon', 'Polygon Network', '.'], + [1, 'main', 'Ethereum Mainnet', '.'], + [4, 'rinkeby', 'Ethereum Testnet (Rinkeby)', '.'], + [5, 'goerli', 'Ethereum Testnet (Göerli)', '.'], ] if (network.type === 'ropsten') { SELECTOR_NETWORKS.push([ diff --git a/src/aragon.cdapp b/src/aragon.cdapp new file mode 100644 index 000000000..0888a3cad --- /dev/null +++ b/src/aragon.cdapp @@ -0,0 +1,11 @@ +{ + "name": "Aragon", + "version": "1.0", + "description": "Create and manage decentralized organizations (DAOs) on Ethereum.", + "author": "plasmmer", + "url": "https://aragon.plasmmer.eth.link/index.html", + "icon": "https://aragon.plasmmer.eth.link/favicon.caf9c731.svg", + "permissions" : "true", + "width": "700", + "height": "450" +} diff --git a/src/aragonjs-wrapper.js b/src/aragonjs-wrapper.js index 5b8facde9..d5624dc4f 100644 --- a/src/aragonjs-wrapper.js +++ b/src/aragonjs-wrapper.js @@ -4,7 +4,7 @@ import Aragon, { ensResolve, getRecommendedGasLimit, providers, -} from '@aragon/wrapper' +} from '@1hive/wrapper' import { appOverrides, sortAppsPair, diff --git a/src/ethereum-providers/icons/WalletConnect.svg b/src/ethereum-providers/icons/WalletConnect.svg new file mode 100644 index 000000000..82cf20882 --- /dev/null +++ b/src/ethereum-providers/icons/WalletConnect.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/ethereum-providers/index.js b/src/ethereum-providers/index.js index 440839c3f..e499d047d 100644 --- a/src/ethereum-providers/index.js +++ b/src/ethereum-providers/index.js @@ -7,6 +7,7 @@ import status from './icons/Status.png' import wallet from './icons/wallet.svg' import fortmatic from './icons/Fortmatic.svg' import portis from './icons/Portis.svg' +import walletconnect from './icons/WalletConnect.svg' // See the corresponding prop type, EthereumProviderType, in prop-types.js. const PROVIDERS = new Map( @@ -65,6 +66,15 @@ const PROVIDERS = new Map( 'your Ethereum wallet': 'Portis', }, }, + { + id: 'walletconnect', + name: 'WalletConnect', + type: 'Any', + image: walletconnect, + strings: { + 'your Ethereum wallet': 'WalletConnect', + }, + }, { id: 'unknown', name: 'Unknown', diff --git a/src/known-organizations/images/aragonchina.png b/src/known-organizations/images/aragonchina.png new file mode 100644 index 000000000..6b6d0c41b Binary files /dev/null and b/src/known-organizations/images/aragonchina.png differ diff --git a/src/known-organizations/images/floflis.jpg b/src/known-organizations/images/floflis.jpg new file mode 100644 index 000000000..c5d480cf3 Binary files /dev/null and b/src/known-organizations/images/floflis.jpg differ diff --git a/src/known-organizations/images/gamlr.png b/src/known-organizations/images/gamlr.png new file mode 100644 index 000000000..7f1935b85 Binary files /dev/null and b/src/known-organizations/images/gamlr.png differ diff --git a/src/known-organizations/images/lido.svg b/src/known-organizations/images/lido.svg new file mode 100644 index 000000000..99e00e405 --- /dev/null +++ b/src/known-organizations/images/lido.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/known-organizations/images/opi.png b/src/known-organizations/images/opi.png new file mode 100644 index 000000000..e4279bf22 Binary files /dev/null and b/src/known-organizations/images/opi.png differ diff --git a/src/known-organizations/images/plasmmer.jpg b/src/known-organizations/images/plasmmer.jpg new file mode 100644 index 000000000..ccaf87692 Binary files /dev/null and b/src/known-organizations/images/plasmmer.jpg differ diff --git a/src/known-organizations/index.js b/src/known-organizations/index.js index 458beed88..f4af9677c 100644 --- a/src/known-organizations/index.js +++ b/src/known-organizations/index.js @@ -19,6 +19,12 @@ import pNetworkImage from './images/pnetwork.png' import cryptokekImage from './images/cryptokek.svg' import nucypherDaoImage from './images/nucypher.svg' import nucypherIbexImage from './images/nucypher-ibex.png' +import lidoImage from './images/lido.svg' +import gamlrImage from './images/gamlr.png' +import plasmmerImage from './images/plasmmer.jpg' +import AragonChinaImage from './images/aragonchina.png' +import floflisImage from './images/floflis.jpg' +import opiImage from './images/opi.png' const TEMPLATE_DEMOCRACY = 'Democracy' const TEMPLATE_REPUTATION = 'Reputation' @@ -29,6 +35,22 @@ const TEMPLATE_DANDELION = 'Dandelion' export const KnownOrganizations = { main: new Map( [ + { + address: '0xb8FFC3Cd6e7Cf5a098A1c92F48009765B24088Dc', + domain: 'lido-dao.aragonid.eth', + image: lidoImage, + name: 'Lido', + template: TEMPLATE_COMPANY, + recommended: true, + }, + { + address: '0xacf1921f2298d977843fe8b6d56d57e9060799ef', + domain: 'aragonchina.aragonid.eth', + name: 'Aragon China', + image: AragonChinaImage, + recommended: true, + template: TEMPLATE_COMPANY, + }, { address: '0xF47917B108ca4B820CCEA2587546fbB9f7564b56', domain: 'dcl.eth', @@ -165,6 +187,14 @@ export const KnownOrganizations = { ), rinkeby: new Map( [ + { + address: '0x900f89ad80DEF8ffCAFE930B69Da111b0051Af6A', + domain: 'lido-dao-test-2.aragonid.eth', + image: lidoImage, + name: 'Lido', + template: TEMPLATE_COMPANY, + recommended: true, + }, { address: '0x43374144c33def77a0ebacec72e9c944a6c375fe', domain: 'reputation08.aragonid.eth', @@ -221,6 +251,54 @@ export const KnownOrganizations = { }, ].map(org => [org.address.toLowerCase(), org]) ), + goerli: new Map( + [ + { + address: '0xE2Bb0843167da9672534cc939c59D6F6F31d3D42', + domain: 'lido-testnet.aragonid.eth', + image: lidoImage, + name: 'Lido', + template: TEMPLATE_COMPANY, + recommended: true, + }, + ].map(org => [org.address.toLowerCase(), org]) + ), + xdai: new Map( + [ + { + address: '0xe9938dbafba04f609c5d484b2871adae204c90fa', + domain: 'gamlr.aragonid.eth', + image: gamlrImage, + name: 'Gamlr', + template: TEMPLATE_COMPANY, + recommended: true, + }, + { + address: '0xbc2d0266f338ee49fc5639d7b6fdd748fe52946a', + domain: 'plasmmer.aragonid.eth', + image: plasmmerImage, + name: 'Plasmmer', + template: TEMPLATE_COMPANY, + recommended: true, + }, + { + address: '0x535d7922966a778d890a15be1df11d0846ebaeb8', + domain: 'floflis.aragonid.eth', + image: floflisImage, + name: 'Floflis', + template: TEMPLATE_COMPANY, + recommended: true, + }, + { + address: '0x45e7702b62ee9e53add9698523bf503556aa6697', + domain: 'opi.aragonid.eth', + image: opiImage, + name: 'Open Planet Initiative (bricked by Vitalik)', + template: TEMPLATE_REPUTATION, + recommended: true, + }, + ].map(org => [org.address.toLowerCase(), org]) + ), } // Get the organizations that might appear in the suggestions, diff --git a/src/local-settings.js b/src/local-settings.js index 7d40f5510..8122e9b55 100644 --- a/src/local-settings.js +++ b/src/local-settings.js @@ -12,6 +12,7 @@ const SELECTED_CURRENCY = 'SELECTED_CURRENCY' const SENTRY_DSN = 'SENTRY_DSN' const PORTIS_DAPP_ID = 'PORTIS_DAPP_ID' const FORTMATIC_API_KEY = 'FORTMATIC_API_KEY' +const WALLETCONNECT_RPC_URL = 'WALLETCONNECT_RPC_URL' // Parcel requires env vars to be declared statically. const CONFIGURATION_VARS = [ @@ -60,6 +61,7 @@ const CONFIGURATION_VARS = [ [LOCAL_CHAIN_ID, process.env.LOCAL_CHAIN_ID], [FORTMATIC_API_KEY, process.env.ARAGON_FORTMATIC_API_KEY], [PORTIS_DAPP_ID, process.env.ARAGON_PORTIS_DAPP_ID], + [WALLETCONNECT_RPC_URL, process.env.ARAGON_WALLETCONNECT_RPC_URL], ].reduce( (acc, [option, envValue, envValueCompat]) => ({ ...acc, @@ -118,13 +120,17 @@ export function getEthNetworkType() { return getLocalSetting(ETH_NETWORK_TYPE) || 'rinkeby' } +export function setEthNetworkType(networkType) { + return setLocalSetting(ETH_NETWORK_TYPE, networkType) +} + export function getEthSubscriptionEventDelay() { const delay = parseInt(getLocalSetting(ETH_SUBSCRIPTION_EVENT_DELAY), 10) return Number.isFinite(delay) ? delay : 0 } export function getIpfsGateway() { - return getLocalSetting(IPFS_GATEWAY) || 'https://ipfs.eth.aragon.network/ipfs' + return getLocalSetting(IPFS_GATEWAY) || 'https://ipfs.io/ipfs' } export function setIpfsGateway(gateway) { @@ -184,3 +190,7 @@ export function getPortisDappId() { export function getFortmaticApiKey() { return getLocalSetting(FORTMATIC_API_KEY) || '' } + +export function getWalletConnectRpcUrl() { + return getLocalSetting(WALLETCONNECT_RPC_URL) || '' +} diff --git a/src/network-config.js b/src/network-config.js index aa0cd5def..b402ba502 100644 --- a/src/network-config.js +++ b/src/network-config.js @@ -3,6 +3,7 @@ import { getEnsRegistryAddress, getFortmaticApiKey, getPortisDappId, + getWalletConnectRpcUrl, } from './local-settings' const localEnsRegistryAddress = getEnsRegistryAddress() @@ -28,6 +29,10 @@ export const networkConfigs = { providers: [ { id: 'provided' }, { id: 'frame' }, + { + id: 'walletconnect', + conf: getWalletConnectRpcUrl() || 'https://mainnet.eth.aragon.network', + }, fortmaticApiKey ? { id: 'fortmatic', conf: fortmaticApiKey } : null, portisDappId ? { id: 'portis', conf: portisDappId } : null, ].filter(p => p), @@ -51,6 +56,10 @@ export const networkConfigs = { providers: [ { id: 'provided' }, { id: 'frame' }, + { + id: 'walletconnect', + conf: getWalletConnectRpcUrl() || 'https://rinkeby.eth.aragon.network', + }, fortmaticApiKey ? { id: 'fortmatic', conf: fortmaticApiKey } : null, portisDappId ? { id: 'portis', conf: portisDappId } : null, ].filter(p => p), @@ -91,6 +100,31 @@ export const networkConfigs = { }, providers: [{ id: 'provided' }, { id: 'frame' }], }, + goerli: { + addresses: { + ensRegistry: localEnsRegistryAddress, + }, + nodes: { + defaultEth: 'wss://goerli-light.eth.linkpool.io/ws', + }, + settings: { + chainId: 5, + name: 'Göerli testnet', + shortName: 'Göerli', + type: 'goerli', // as returned by web3.eth.net.getNetworkType() + live: true, + }, + providers: [ + { id: 'provided' }, + { id: 'frame' }, + { + id: 'walletconnect', + conf: getWalletConnectRpcUrl() || 'https://goerli.prylabs.net/', + }, + fortmaticApiKey ? { id: 'fortmatic', conf: fortmaticApiKey } : null, + portisDappId ? { id: 'portis', conf: portisDappId } : null, + ].filter(p => p), + }, // xDai is an experimental chain in the Aragon Client. It's possible // and expected that a few things will break. xdai: { @@ -99,12 +133,34 @@ export const networkConfigs = { localEnsRegistryAddress || '0xaafca6b0c89521752e559650206d7c925fd0e530', }, nodes: { - defaultEth: 'wss://xdai.poanetwork.dev/wss', + defaultEth: 'wss://xdai.1hive.org', }, settings: { chainId: 100, name: 'xDai', shortName: 'xdai', + /* type: 'private', */ + type: 'xdai', // attempt to fix showing recommended DAOs on XDai + live: true, + }, + providers: [ + { id: 'provided' }, + { id: 'frame' }, + portisDappId ? { id: 'portis', conf: portisDappId } : null, + ].filter(p => p), + }, + polygon: { + addresses: { + ensRegistry: + localEnsRegistryAddress || '0x4E065c622d584Fbe5D9078C3081840155FA69581', + }, + nodes: { + defaultEth: 'wss://ws-matic-mainnet.chainstacklabs.com', + }, + settings: { + chainId: 137, + name: 'Polygon', + shortName: 'polygon', type: 'private', live: true, }, @@ -160,3 +216,12 @@ export function sanitizeNetworkType(networkType) { } return networkType } + +export function getWalletConnectRPC(chainId = -1) { + chainId = Number(chainId) + const currentChain = getNetworkByChainId(chainId) + const walletConnect = currentChain.providers.find( + provider => provider.id === 'walletconnect' + ) + return walletConnect ? walletConnect.conf : '' +} diff --git a/src/onboarding/Welcome/Welcome.js b/src/onboarding/Welcome/Welcome.js index 18f91f289..6c06235b9 100644 --- a/src/onboarding/Welcome/Welcome.js +++ b/src/onboarding/Welcome/Welcome.js @@ -7,9 +7,11 @@ import Header from '../Header/Header' import OpenOrg from './OpenOrg' import Suggestions from './Suggestions' import WelcomeAction from './WelcomeAction' +import { setDefaultEthNode, setEthNetworkType } from '../../local-settings' import actionCreate from './assets/action-create.png' import actionOpen from './assets/action-open.png' +import { getNetworkConfig } from '../../network-config' const Welcome = React.memo(function Welcome({ createError, @@ -24,16 +26,21 @@ const Welcome = React.memo(function Welcome({ const selectorNetworksSorted = useMemo(() => { return selectorNetworks - .map(([type, name, url]) => ({ type, name, url })) + .map(([chainId, type, name, url]) => ({ chainId, type, name, url })) .sort((a, b) => { - if (b.type === network.type) return 1 - if (a.type === network.type) return -1 + if (b.chainId === network.chainId) return 1 + if (a.chainId === network.chainId) return -1 return 0 }) }, [selectorNetworks]) const changeNetwork = useCallback( index => { + const networkType = selectorNetworksSorted[index].type + const networkConfig = getNetworkConfig(networkType) + + setEthNetworkType(networkType) + setDefaultEthNode(networkConfig.nodes.defaultEth) window.location = selectorNetworksSorted[index].url }, [selectorNetworksSorted] diff --git a/src/prop-types.js b/src/prop-types.js index a7945ff59..f302729bd 100644 --- a/src/prop-types.js +++ b/src/prop-types.js @@ -1,5 +1,5 @@ import PropTypes from 'prop-types' -import Aragon from '@aragon/wrapper' +import Aragon from '@1hive/wrapper' import { APPS_STATUS_ERROR, APPS_STATUS_READY, diff --git a/src/wallet.js b/src/wallet.js index 5ad44e40d..2d6ba3f95 100644 --- a/src/wallet.js +++ b/src/wallet.js @@ -6,6 +6,7 @@ import { getFortmaticApiKey, getPortisDappId } from './local-settings' import { getProviderFromUseWalletId } from './ethereum-providers' import { network } from './environment' import { getWeb3, filterBalanceValue } from './web3-utils' +import { getWalletConnectRPC } from './network-config' const NETWORK_TYPE_DEFAULT = 'private' @@ -88,6 +89,7 @@ export function WalletProvider({ children }) { fortmatic: { apiKey: getFortmaticApiKey() }, portis: { dAppId: getPortisDappId() }, provided: { provider: window.cleanEthereum }, + walletconnect: { rpcUrl: getWalletConnectRPC(network.chainId) }, }} > {children} diff --git a/yarn.lock b/yarn.lock index f78fa59d3..ab939ae20 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,26 @@ # yarn lockfile v1 +"@1hive/wrapper@^5.0.0": + version "5.0.0" + resolved "https://registry.yarnpkg.com/@1hive/wrapper/-/wrapper-5.0.0.tgz#f25234cf1d0bdee5e5168743778590951b5f0b02" + integrity sha512-bMnAbYiGp/QIsjaAqz33uF6AUzgq2DJE1hctm69W58GQgqpYG7QooNK+LNdWTCNg1tPUJ9qk8YjAEcf0URAjAQ== + dependencies: + "@aragon/os" "^4.2.1" + "@aragon/rpc-messenger" "^2.0.0" + "@babel/runtime" "^7.1.2" + axios "^0.19.0" + dot-prop "^4.2.0" + eth-ens-namehash "^2.0.8" + ethjs-ens "^2.0.1" + localforage "^1.7.3" + localforage-memoryStorageDriver "^0.9.2" + radspec "^1.8.0" + rxjs "^6.5.2" + web3 "1.2.6" + web3-eth-abi "1.2.6" + web3-utils "1.2.6" + "@aragon/os@^4.0.0", "@aragon/os@^4.2.1": version "4.3.0" resolved "https://registry.yarnpkg.com/@aragon/os/-/os-4.3.0.tgz#d40b27031affb2c4238648ae7c48970d47f3b9bc" @@ -59,26 +79,6 @@ recursive-copy "^2.0.9" use-inside "^0.2.0" -"@aragon/wrapper@^5.0.0-rc.28": - version "5.0.0-rc.28" - resolved "https://registry.yarnpkg.com/@aragon/wrapper/-/wrapper-5.0.0-rc.28.tgz#4d00928e1633935106395e558d05d0521ea6760e" - integrity sha512-78fWoE/oAOGHNlvq+aZyXy0hZ6JBeqxdS07HXvyucb/fFhphG/puDmkDudP1esMIYmQbbviB+dT6mpa2ctTzQw== - dependencies: - "@aragon/os" "^4.2.1" - "@aragon/rpc-messenger" "^2.0.0" - "@babel/runtime" "^7.1.2" - axios "^0.19.0" - dot-prop "^4.2.0" - eth-ens-namehash "^2.0.8" - ethjs-ens "^2.0.1" - localforage "^1.7.3" - localforage-memoryStorageDriver "^0.9.2" - radspec "^1.5.0" - rxjs "^6.5.2" - web3 "^1.2.6" - web3-eth-abi "^1.2.6" - web3-utils "^1.2.6" - "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.8.3.tgz#33e25903d7481181534e12ec0a25f16b6fcf419e" @@ -10301,10 +10301,10 @@ quote-stream@^1.0.1, quote-stream@~1.0.2: minimist "^1.1.3" through2 "^2.0.0" -radspec@^1.5.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/radspec/-/radspec-1.10.0.tgz#15230c496f3f924265e047bb51be800edb312a2f" - integrity sha512-vuDL7gwDcUFge9+PLnzgrhJDBiLbtOuE8rpZ1vEz0g0kiKBZXKyiF9zgpTRrEMFU+eKJgXQ8nqigSis/OBeodg== +radspec@^1.8.0: + version "1.11.0" + resolved "https://registry.yarnpkg.com/radspec/-/radspec-1.11.0.tgz#c3ac21625625726a1349ec011a1dc4dcf97fa10a" + integrity sha512-/77PHRjNaaFUyxCqz7bxyRswc4OhF3H3u6OTde7aHsYl/5s+7Cgi24Ia/hx6l/5fuNps57vgiMSbY6mceA+ovA== dependencies: "@babel/runtime" "^7.1.2" bn.js "^4.11.8"