diff --git a/now.json b/now.json deleted file mode 100644 index 4c1007792..000000000 --- a/now.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "version": 2, - "public": true, - "scope": "aragon", - "github": { - "silent": true - }, - "build": { - "env": { - "ARAGON_FORTMATIC_API_KEY": "@aragon-client-fortmatic-testnet-api-key", - "ARAGON_PORTIS_DAPP_ID": "@aragon-client-portis-dapp-id", - "ARAGON_SENTRY_DSN": "@aragon-client-sentry-dsn", - "ARAGON_ETH_SUBSCRIPTION_EVENT_DELAY": "3000" - } - } -} 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/src/App.js b/src/App.js index ae989bc42..0fca6e42e 100644 --- a/src/App.js +++ b/src/App.js @@ -46,8 +46,11 @@ const INITIAL_DAO_STATE = { } const SELECTOR_NETWORKS = [ - ['main', 'Ethereum Mainnet', 'https://client.aragon.org/'], + [100, 'xdai', 'xDai Network', 'https://aragon.1hive.org/'], + [137, 'polygon', 'Polygon Network', 'https://aragon.1hive.org/'], + [1, 'main', 'Ethereum Mainnet', 'https://client.aragon.org/'], [ + 4, 'rinkeby', 'Ethereum Testnet (Rinkeby)', 'https://rinkeby.client.aragon.org/', 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/local-settings.js b/src/local-settings.js index 7d40f5510..8639b1b21 100644 --- a/src/local-settings.js +++ b/src/local-settings.js @@ -118,13 +118,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) { diff --git a/src/network-config.js b/src/network-config.js index aa0cd5def..0ec0508ec 100644 --- a/src/network-config.js +++ b/src/network-config.js @@ -99,7 +99,7 @@ export const networkConfigs = { localEnsRegistryAddress || '0xaafca6b0c89521752e559650206d7c925fd0e530', }, nodes: { - defaultEth: 'wss://xdai.poanetwork.dev/wss', + defaultEth: 'wss://rpc.gnosischain.com/wss', }, settings: { chainId: 100, @@ -114,6 +114,27 @@ export const networkConfigs = { portisDappId ? { id: 'portis', conf: portisDappId } : null, ].filter(p => p), }, + polygon: { + addresses: { + ensRegistry: + localEnsRegistryAddress || '0x4E065c622d584Fbe5D9078C3081840155FA69581', + }, + nodes: { + defaultEth: 'wss://rpc-mainnet.matic.network', + }, + settings: { + chainId: 137, + name: 'Polygon', + shortName: 'polygon', + type: 'private', + live: true, + }, + providers: [ + { id: 'provided' }, + { id: 'frame' }, + portisDappId ? { id: 'portis', conf: portisDappId } : null, + ].filter(p => p), + }, unknown: { addresses: { ensRegistry: localEnsRegistryAddress, 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/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"