Feature: Activate fortmatic (#339)
* Add fortmatic integration to web3connect * add fortmatic * Safe open form improvements: limit calling initContracts to 1 time * update .env.example
This commit is contained in:
parent
02e09cbc49
commit
509000b9e6
|
@ -9,3 +9,7 @@ REACT_APP_GOOGLE_ANALYTICS_ID_MAINNET=
|
|||
|
||||
# For production environments
|
||||
REACT_APP_INTERCOM_ID=
|
||||
REACT_APP_PORTIS_ID=
|
||||
REACT_APP_SQUARELINK_ID=
|
||||
REACT_APP_FORTMATIC_KEY=
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
"dotenv": "^8.2.0",
|
||||
"ethereum-ens": "0.7.8",
|
||||
"final-form": "4.18.6",
|
||||
"fortmatic": "^1.0.1",
|
||||
"history": "4.10.1",
|
||||
"immortal-db": "^1.0.2",
|
||||
"immutable": "^4.0.0-rc.9",
|
||||
|
@ -55,7 +56,7 @@
|
|||
"optimize-css-assets-webpack-plugin": "5.0.3",
|
||||
"polished": "^3.4.2",
|
||||
"qrcode.react": "1.0.0",
|
||||
"query-string": "^6.9.0",
|
||||
"query-string": "6.9.0",
|
||||
"react": "16.12.0",
|
||||
"react-dev-utils": "^10.0.0",
|
||||
"react-dom": "16.12.0",
|
||||
|
@ -101,7 +102,7 @@
|
|||
"@babel/preset-env": "7.7.6",
|
||||
"@babel/preset-flow": "7.7.4",
|
||||
"@babel/preset-react": "7.7.4",
|
||||
"@testing-library/react": "9.3.2",
|
||||
"@testing-library/react": "9.3.3",
|
||||
"autoprefixer": "9.7.3",
|
||||
"babel-core": "^7.0.0-bridge.0",
|
||||
"babel-eslint": "10.0.3",
|
||||
|
@ -112,7 +113,7 @@
|
|||
"babel-plugin-transform-es3-property-literals": "^6.22.0",
|
||||
"babel-polyfill": "^6.26.0",
|
||||
"classnames": "^2.2.6",
|
||||
"css-loader": "3.2.1",
|
||||
"css-loader": "3.3.0",
|
||||
"detect-port": "^1.3.0",
|
||||
"eslint": "6.7.2",
|
||||
"eslint-config-airbnb": "18.0.1",
|
||||
|
@ -139,7 +140,7 @@
|
|||
"prettier-eslint-cli": "5.0.0",
|
||||
"run-with-testrpc": "0.3.1",
|
||||
"style-loader": "1.0.1",
|
||||
"terser-webpack-plugin": "^2.2.2",
|
||||
"terser-webpack-plugin": "2.2.3",
|
||||
"truffle": "5.1.3",
|
||||
"truffle-contract": "4.0.31",
|
||||
"truffle-solidity-loader": "0.1.32",
|
||||
|
|
|
@ -3,6 +3,7 @@ import React from 'react'
|
|||
import Web3Connect from 'web3connect'
|
||||
import Torus from '@toruslabs/torus-embed'
|
||||
import WalletConnectProvider from '@walletconnect/web3-provider'
|
||||
import Fortmatic from 'fortmatic'
|
||||
import Portis from '@portis/web3'
|
||||
import Squarelink from 'squarelink'
|
||||
import Button from '~/components/layout/Button'
|
||||
|
@ -10,8 +11,11 @@ import { fetchProvider } from '~/logic/wallets/store/actions'
|
|||
import { getNetwork } from '~/config'
|
||||
import { store } from '~/store'
|
||||
|
||||
const PORTIS_DAPP_ID = process.env.REACT_APP_NETWORK === 'mainnet' ? process.env.REACT_APP_PORTIS_ID : '852b763d-f28b-4463-80cb-846d7ec5806b'
|
||||
const SQUARELINK_CLIENT_ID = process.env.REACT_APP_NETWORK === 'mainnet' ? process.env.REACT_APP_SQUARELINK_ID : '46ce08fe50913cfa1b78'
|
||||
const isMainnet = process.env.REACT_APP_NETWORK === 'mainnet'
|
||||
|
||||
const PORTIS_DAPP_ID = isMainnet ? process.env.REACT_APP_PORTIS_ID : '852b763d-f28b-4463-80cb-846d7ec5806b'
|
||||
const SQUARELINK_CLIENT_ID = isMainnet ? process.env.REACT_APP_SQUARELINK_ID : '46ce08fe50913cfa1b78'
|
||||
const FORTMATIC_API_KEY = isMainnet ? process.env.REACT_APP_FORTMATIC_KEY : 'pk_test_CAD437AA29BE0A40'
|
||||
|
||||
export const web3Connect = new Web3Connect.Core({
|
||||
network: getNetwork().toLowerCase(),
|
||||
|
@ -34,6 +38,12 @@ export const web3Connect = new Web3Connect.Core({
|
|||
id: SQUARELINK_CLIENT_ID,
|
||||
},
|
||||
},
|
||||
fortmatic: {
|
||||
package: Fortmatic,
|
||||
options: {
|
||||
key: FORTMATIC_API_KEY,
|
||||
},
|
||||
},
|
||||
torus: {
|
||||
package: Torus,
|
||||
options: {
|
||||
|
|
|
@ -15,11 +15,14 @@ import {
|
|||
FIELD_CONFIRMATIONS,
|
||||
FIELD_SAFE_NAME,
|
||||
} from '~/routes/open/components/fields'
|
||||
import { initContracts } from '~/logic/contracts/safeContracts'
|
||||
import { history } from '~/store'
|
||||
import { secondary, sm } from '~/theme/variables'
|
||||
import type { SafePropsType } from '~/routes/open/container/Open'
|
||||
import Welcome from '~/routes/welcome/components/Layout'
|
||||
|
||||
const { useEffect } = React
|
||||
|
||||
const getSteps = () => ['Name', 'Owners and confirmations', 'Review']
|
||||
|
||||
|
||||
|
@ -80,6 +83,13 @@ const Layout = (props: Props) => {
|
|||
const {
|
||||
provider, userAccount, onCallSafeContractSubmit, network, safeProps,
|
||||
} = props
|
||||
|
||||
useEffect(() => {
|
||||
if (provider) {
|
||||
initContracts()
|
||||
}
|
||||
}, [provider])
|
||||
|
||||
const steps = getSteps()
|
||||
|
||||
const initialValues = initialValuesFrom(userAccount, safeProps)
|
||||
|
|
|
@ -8,7 +8,7 @@ import {
|
|||
getAccountsFrom, getThresholdFrom, getNamesFrom, getSafeNameFrom, getOwnersFrom,
|
||||
} from '~/routes/open/utils/safeDataExtractor'
|
||||
import { buildSafe } from '~/routes/safe/store/actions/fetchSafe'
|
||||
import { getGnosisSafeInstanceAt, deploySafeContract, initContracts } from '~/logic/contracts/safeContracts'
|
||||
import { getGnosisSafeInstanceAt, deploySafeContract } from '~/logic/contracts/safeContracts'
|
||||
import { checkReceiptStatus } from '~/logic/wallets/ethTransactions'
|
||||
import { history } from '~/store'
|
||||
import { OPENING_ADDRESS, stillInOpeningView, SAFELIST_ADDRESS } from '~/routes/routes'
|
||||
|
@ -56,8 +56,6 @@ export const createSafe = async (values: Object, userAccount: string, addSafe: A
|
|||
const ownersNames = getNamesFrom(values)
|
||||
const ownerAddresses = getAccountsFrom(values)
|
||||
|
||||
await initContracts()
|
||||
|
||||
const safe = await deploySafeContract(ownerAddresses, numConfirmations, userAccount)
|
||||
await checkReceiptStatus(safe.tx)
|
||||
|
||||
|
@ -85,10 +83,6 @@ export const createSafe = async (values: Object, userAccount: string, addSafe: A
|
|||
}
|
||||
|
||||
class Open extends React.Component<Props> {
|
||||
async componentDidMount() {
|
||||
await initContracts()
|
||||
}
|
||||
|
||||
onCallSafeContractSubmit = async (values) => {
|
||||
try {
|
||||
const { userAccount, addSafe } = this.props
|
||||
|
|
74
yarn.lock
74
yarn.lock
|
@ -957,6 +957,13 @@
|
|||
core-js-pure "^3.0.0"
|
||||
regenerator-runtime "^0.13.2"
|
||||
|
||||
"@babel/runtime@7.3.4":
|
||||
version "7.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.3.4.tgz#73d12ba819e365fcf7fd152aed56d6df97d21c83"
|
||||
integrity sha512-IvfvnMdSaLBateu0jfsYIpZTxAc2cKEXEMiezGGN75QcBcecDUKd3PgLAncT0oOgxKy8dd8hrJKj9MfzgfZd6g==
|
||||
dependencies:
|
||||
regenerator-runtime "^0.12.0"
|
||||
|
||||
"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.1.5", "@babel/runtime@^7.3.1", "@babel/runtime@^7.4.0", "@babel/runtime@^7.4.4", "@babel/runtime@^7.4.5", "@babel/runtime@^7.5.1", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.0", "@babel/runtime@^7.6.2", "@babel/runtime@^7.6.3", "@babel/runtime@^7.7.4":
|
||||
version "7.7.6"
|
||||
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.7.6.tgz#d18c511121aff1b4f2cd1d452f1bac9601dd830f"
|
||||
|
@ -1502,10 +1509,10 @@
|
|||
pretty-format "^24.0.0"
|
||||
redent "^3.0.0"
|
||||
|
||||
"@testing-library/react@9.3.2":
|
||||
version "9.3.2"
|
||||
resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-9.3.2.tgz#418000daa980dafd2d9420cc733d661daece9aa0"
|
||||
integrity sha512-J6ftWtm218tOLS175MF9eWCxGp+X+cUXCpkPIin8KAXWtyZbr9CbqJ8M8QNd6spZxJDAGlw+leLG4MJWLlqVgg==
|
||||
"@testing-library/react@9.3.3":
|
||||
version "9.3.3"
|
||||
resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-9.3.3.tgz#87fe594adb02cba4d0e86369d025ea13ad570d7c"
|
||||
integrity sha512-IuoiJR/NAzu9EuT3Fqs92sRHe/9egCipar92wTnXe3fMloWy0Q7JdAXaszzbv2ogH30ztb6Axp5XW63vOTd4jA==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.6.0"
|
||||
"@testing-library/dom" "^6.3.0"
|
||||
|
@ -4907,10 +4914,10 @@ css-declaration-sorter@^4.0.1:
|
|||
postcss "^7.0.1"
|
||||
timsort "^0.3.0"
|
||||
|
||||
css-loader@3.2.1:
|
||||
version "3.2.1"
|
||||
resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-3.2.1.tgz#62849b45a414b7bde0bfba17325a026471040eae"
|
||||
integrity sha512-q40kYdcBNzMvkIImCL2O+wk8dh+RGwPPV9Dfz3n7XtOYPXqe2Z6VgtvoxjkLHz02gmhepG9sOAJOUlx+3hHsBg==
|
||||
css-loader@3.3.0:
|
||||
version "3.3.0"
|
||||
resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-3.3.0.tgz#65f889807baec3197313965d6cda9899f936734d"
|
||||
integrity sha512-x9Y1vvHe5RR+4tzwFdWExPueK00uqFTCw7mZy+9aE/X1SKWOArm5luaOrtJ4d05IpOwJ6S86b/tVcIdhw1Bu4A==
|
||||
dependencies:
|
||||
camelcase "^5.3.1"
|
||||
cssesc "^3.0.0"
|
||||
|
@ -7455,6 +7462,13 @@ form-data@~2.3.2:
|
|||
combined-stream "^1.0.6"
|
||||
mime-types "^2.1.12"
|
||||
|
||||
fortmatic@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/fortmatic/-/fortmatic-1.0.1.tgz#ecb2c6777cd25658befe5e86c5eeddcb6c4db472"
|
||||
integrity sha512-D48g0talOofK6AdwppO2VL/rRjLZb69Qf6fBR1lYUZ2rqMCM8WbBqoEDgFgJyjO1YV7XCJGbm+mW0/y2RxxbEg==
|
||||
dependencies:
|
||||
"@babel/runtime" "7.3.4"
|
||||
|
||||
forwarded@~0.1.2:
|
||||
version "0.1.2"
|
||||
resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84"
|
||||
|
@ -13095,6 +13109,15 @@ qs@~6.5.2:
|
|||
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"
|
||||
integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==
|
||||
|
||||
query-string@6.9.0:
|
||||
version "6.9.0"
|
||||
resolved "https://registry.yarnpkg.com/query-string/-/query-string-6.9.0.tgz#1c3b727c370cf00f177c99f328fda2108f8fa3dd"
|
||||
integrity sha512-KG4bhCFYapExLsUHrFt+kQVEegF2agm4cpF/VNc6pZVthIfCc/GK8t8VyNIE3nyXG9DK3Tf2EGkxjR6/uRdYsA==
|
||||
dependencies:
|
||||
decode-uri-component "^0.2.0"
|
||||
split-on-first "^1.0.0"
|
||||
strict-uri-encode "^2.0.0"
|
||||
|
||||
query-string@^4.1.0:
|
||||
version "4.3.4"
|
||||
resolved "https://registry.yarnpkg.com/query-string/-/query-string-4.3.4.tgz#bbb693b9ca915c232515b228b1a02b609043dbeb"
|
||||
|
@ -13630,6 +13653,11 @@ regenerator-runtime@^0.11.0:
|
|||
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9"
|
||||
integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==
|
||||
|
||||
regenerator-runtime@^0.12.0:
|
||||
version "0.12.1"
|
||||
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz#fa1a71544764c036f8c49b13a08b2594c9f8a0de"
|
||||
integrity sha512-odxIc1/vDlo4iZcfXqRYFj0vpXFNoGdKMAUieAlFYO6m/nl5e9KR/beGf41z4a1FI+aQgtjhuaSlDxQ0hmkrHg==
|
||||
|
||||
regenerator-runtime@^0.13.2:
|
||||
version "0.13.3"
|
||||
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz#7cf6a77d8f5c6f60eb73c5fc1955b2ceb01e6bf5"
|
||||
|
@ -14373,7 +14401,7 @@ send@0.17.1:
|
|||
range-parser "~1.2.1"
|
||||
statuses "~1.5.0"
|
||||
|
||||
serialize-javascript@^2.1.1:
|
||||
serialize-javascript@^2.1.1, serialize-javascript@^2.1.2:
|
||||
version "2.1.2"
|
||||
resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-2.1.2.tgz#ecec53b0e0317bdc95ef76ab7074b7384785fa61"
|
||||
integrity sha512-rs9OggEUF0V4jUSecXazOYsLfu7OGK2qIn3c7IPBiffz32XniEp/TX9Xmc9LQfK2nQ2QKHvZ2oygKUGU0lG4jQ==
|
||||
|
@ -15313,6 +15341,20 @@ temp@^0.8.3:
|
|||
dependencies:
|
||||
rimraf "~2.6.2"
|
||||
|
||||
terser-webpack-plugin@2.2.3:
|
||||
version "2.2.3"
|
||||
resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-2.2.3.tgz#7b070b40e39ef177ca062a4b6d70c3acdd85defc"
|
||||
integrity sha512-R8cqQDld4BjVKaIR0D9Q0O/QzfgXzME3wXfSxxW23ZGv5xpMDUt1NEnCuG94y1+bKASLvc5TjIHLlNo0eK8GLA==
|
||||
dependencies:
|
||||
cacache "^13.0.1"
|
||||
find-cache-dir "^3.1.0"
|
||||
jest-worker "^24.9.0"
|
||||
schema-utils "^2.6.1"
|
||||
serialize-javascript "^2.1.2"
|
||||
source-map "^0.6.1"
|
||||
terser "^4.4.2"
|
||||
webpack-sources "^1.4.3"
|
||||
|
||||
terser-webpack-plugin@^1.4.1:
|
||||
version "1.4.2"
|
||||
resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-1.4.2.tgz#e23c0d554587d1f473bd0cf68627720e733890a4"
|
||||
|
@ -15328,20 +15370,6 @@ terser-webpack-plugin@^1.4.1:
|
|||
webpack-sources "^1.4.0"
|
||||
worker-farm "^1.7.0"
|
||||
|
||||
terser-webpack-plugin@^2.2.2:
|
||||
version "2.2.2"
|
||||
resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-2.2.2.tgz#2a6e00237125564a455ad69b22e08ee59420473a"
|
||||
integrity sha512-/CHMNswPMAwuD2kd++qys8UmBRmsshPSzHw4BlDwurPtK9YjeK93OV89YWkJulHk972cs07K/7Z92V6PNjWF8A==
|
||||
dependencies:
|
||||
cacache "^13.0.1"
|
||||
find-cache-dir "^3.1.0"
|
||||
jest-worker "^24.9.0"
|
||||
schema-utils "^2.6.1"
|
||||
serialize-javascript "^2.1.1"
|
||||
source-map "^0.6.1"
|
||||
terser "^4.4.2"
|
||||
webpack-sources "^1.4.3"
|
||||
|
||||
terser@^4.1.2, terser@^4.4.2:
|
||||
version "4.4.2"
|
||||
resolved "https://registry.yarnpkg.com/terser/-/terser-4.4.2.tgz#448fffad0245f4c8a277ce89788b458bfd7706e8"
|
||||
|
|
Loading…
Reference in New Issue