add new providers from web3connect beta.23, add entries to provider name

This commit is contained in:
mmv 2019-10-23 14:08:23 +04:00
parent 8f14494811
commit 51a01ef11a
4 changed files with 822 additions and 57 deletions

View File

@ -31,12 +31,14 @@
"precommit" "precommit"
], ],
"dependencies": { "dependencies": {
"@arkane-network/web3-arkane-provider": "^0.2.5",
"@gnosis.pm/safe-contracts": "^1.0.0", "@gnosis.pm/safe-contracts": "^1.0.0",
"@gnosis.pm/util-contracts": "2.0.4", "@gnosis.pm/util-contracts": "2.0.4",
"@material-ui/core": "4.5.1", "@material-ui/core": "4.5.1",
"@material-ui/icons": "4.5.1", "@material-ui/icons": "4.5.1",
"@portis/web3": "^2.0.0-beta.45", "@portis/web3": "^2.0.0-beta.45",
"@testing-library/jest-dom": "4.1.2", "@testing-library/jest-dom": "4.1.2",
"@toruslabs/torus-embed": "^0.2.3",
"@walletconnect/web3-provider": "^1.0.0-beta.37", "@walletconnect/web3-provider": "^1.0.0-beta.37",
"@welldone-software/why-did-you-render": "3.3.8", "@welldone-software/why-did-you-render": "3.3.8",
"axios": "0.19.0", "axios": "0.19.0",

View File

@ -6,6 +6,9 @@ import Web3Connect from 'web3connect'
import WalletConnectProvider from '@walletconnect/web3-provider' import WalletConnectProvider from '@walletconnect/web3-provider'
import Portis from '@portis/web3' import Portis from '@portis/web3'
import Fortmatic from 'fortmatic' import Fortmatic from 'fortmatic'
import Squarelink from 'squarelink'
import Torus from '@toruslabs/torus-embed'
import Arkane from '@arkane-network/web3-arkane-provider'
import Button from '~/components/layout/Button' import Button from '~/components/layout/Button'
import { fetchProvider } from '~/logic/wallets/store/actions' import { fetchProvider } from '~/logic/wallets/store/actions'
import { getNetwork } from '~/config' import { getNetwork } from '~/config'
@ -31,6 +34,27 @@ const web3Connect = new Web3Connect.Core({
key: 'pk_test_43A53775AE976718', key: 'pk_test_43A53775AE976718',
}, },
}, },
squarelink: {
package: Squarelink, // required
options: {
id: 'dd56d364853963bbbe0f', // required
},
},
torus: {
package: Torus, // required
options: {
enableLogging: false,
buttonPosition: 'bottom-left',
buildEnv: process.env.NODE_ENV,
showTorusButton: true,
},
},
arkane: {
package: Arkane, // required
options: {
clientId: 'ARKANE_CLIENT_ID', // required, replace
},
},
}, },
}) })

View File

@ -17,9 +17,11 @@ export const ETHEREUM_NETWORK = {
export const WALLET_PROVIDER = { export const WALLET_PROVIDER = {
SAFE: 'SAFE', SAFE: 'SAFE',
METAMASK: 'METAMASK', METAMASK: 'METAMASK',
PARITY: 'PARITY',
REMOTE: 'REMOTE', REMOTE: 'REMOTE',
UPORT: 'UPORT', TORUS: 'TORUS',
PORTIS: 'PORTIS',
FORTMATIC: 'FORTMATIC',
SQUARELINK: 'SQUARELINK',
} }
export const ETHEREUM_NETWORK_IDS = { export const ETHEREUM_NETWORK_IDS = {
@ -49,6 +51,7 @@ export const getWeb3 = () => web3 || (window.web3 && new Web3(window.web3.curren
const getProviderName: Function = (web3Provider): string => { const getProviderName: Function = (web3Provider): string => {
let name let name
console.log(web3Provider)
switch (web3Provider.currentProvider.constructor.name) { switch (web3Provider.currentProvider.constructor.name) {
case 'SafeWeb3Provider': case 'SafeWeb3Provider':
@ -56,11 +59,27 @@ const getProviderName: Function = (web3Provider): string => {
break break
case 'MetamaskInpageProvider': case 'MetamaskInpageProvider':
name = WALLET_PROVIDER.METAMASK name = WALLET_PROVIDER.METAMASK
if (web3Provider.currentProvider.isTorus) {
name = WALLET_PROVIDER.TORUS
}
break break
default: default:
name = 'Wallet' name = 'Wallet'
} }
if (web3Provider.currentProvider.isPortis) {
name = WALLET_PROVIDER.PORTIS
}
if (web3Provider.currentProvider.isFortmatic) {
name = WALLET_PROVIDER.FORTMATIC
}
if (web3Provider.currentProvider.isSquarelink) {
name = WALLET_PROVIDER.SQUARELINK
}
return name return name
} }

830
yarn.lock

File diff suppressed because it is too large Load Diff