This repository has been archived by the owner on Jul 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Upgrade TypeScript to 4.1.3 - Remove unused connectors - Remove unused contract definitions (should be handled by TypeChain) - Fix type errors - Add missing peer deps
- Loading branch information
1 parent
821940f
commit 63db4e6
Showing
10 changed files
with
47 additions
and
1,616 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,117 +1,27 @@ | ||
import { ReactComponent as BraveIcon } from '../components/icons/wallets/brave.svg'; | ||
import { ReactComponent as MetaMaskIcon } from '../components/icons/wallets/metamask.svg'; | ||
import { ReactComponent as FortmaticIcon } from '../components/icons/wallets/fortmatic.svg'; | ||
import { ReactComponent as PortisIcon } from '../components/icons/wallets/portis.svg'; | ||
import { ReactComponent as SquarelinkIcon } from '../components/icons/wallets/squarelink.svg'; | ||
import { ReactComponent as WalletConnectIcon } from '../components/icons/wallets/walletconnect.svg'; | ||
import { ReactComponent as CoinbaseIcon } from '../components/icons/wallets/coinbase.svg'; | ||
import { ReactComponent as MeetOneIcon } from '../components/icons/wallets/meetone.svg'; | ||
import { Connector } from '../types'; | ||
import { CHAIN_ID } from './constants'; | ||
|
||
export const CONNECTORS: Connector[] = [ | ||
{ | ||
id: 'injected', | ||
subType: 'metamask', | ||
label: 'MetaMask', | ||
icon: MetaMaskIcon, | ||
}, | ||
{ | ||
id: 'injected', | ||
subType: 'brave', | ||
label: 'Brave', | ||
icon: BraveIcon, | ||
}, | ||
{ | ||
id: 'injected', | ||
subType: 'meetOne', | ||
label: 'MEET.ONE', | ||
icon: MeetOneIcon, | ||
}, | ||
{ id: 'fortmatic', label: 'Fortmatic', icon: FortmaticIcon }, | ||
{ id: 'portis', label: 'Portis', icon: PortisIcon }, | ||
// TODO add missing icons | ||
{ id: 'fortmatic', label: 'Fortmatic' }, | ||
{ id: 'portis', label: 'Portis' }, | ||
{ id: 'authereum', label: 'Authereum' }, | ||
{ id: 'squarelink', label: 'Squarelink', icon: SquarelinkIcon }, | ||
{ id: 'squarelink', label: 'Squarelink' }, | ||
{ id: 'torus', label: 'Torus' }, | ||
{ id: 'walletconnect', label: 'WalletConnect', icon: WalletConnectIcon }, | ||
{ id: 'walletlink', label: 'WalletLink', icon: CoinbaseIcon }, | ||
{ id: 'walletconnect', label: 'WalletConnect' }, | ||
{ id: 'walletlink', label: 'WalletLink' }, | ||
{ id: 'frame', label: 'Frame' }, | ||
]; | ||
|
||
const injected = {}; | ||
|
||
if (!process.env.REACT_APP_RPC_URL) { | ||
throw new Error('`REACT_APP_RPC_URL` must be set'); | ||
} | ||
|
||
if (!process.env.REACT_APP_RPC_API_KEY) { | ||
throw new Error('`REACT_APP_RPC_API_KEY` must be set'); | ||
} | ||
|
||
export const RPC_URL = `${process.env.REACT_APP_RPC_URL}${process.env.REACT_APP_RPC_API_KEY}`; | ||
|
||
const walletlink = { | ||
url: RPC_URL, | ||
appLogoUrl: 'https://app.mstable.org/icons/apple-icon-180x180.png', | ||
appName: 'mStable', | ||
}; | ||
|
||
const squarelink = { | ||
options: {}, | ||
clientId: process.env.REACT_APP_SQUARELINK_CLIENT_ID as string, | ||
}; | ||
|
||
const portis = { dAppId: process.env.REACT_APP_PORTIS_DAPP_ID as string }; | ||
|
||
const walletconnect = { | ||
rpcUrl: RPC_URL, | ||
}; | ||
|
||
// These connectors are currently not fully supported by `use-wallet` | ||
// const torus = { | ||
// initOptions: { | ||
// showTorusButton: true, | ||
// }, | ||
// }; | ||
|
||
export const getConnectors = (chainId: number): object => { | ||
switch (chainId) { | ||
case 1: | ||
return { | ||
injected, | ||
portis, | ||
squarelink, | ||
fortmatic: { | ||
apiKey: process.env.REACT_APP_FORTMATIC_API_KEY as string, | ||
}, | ||
walletlink, | ||
walletconnect, | ||
// torus: { | ||
// ...torus, | ||
// chainId, | ||
// }, | ||
}; | ||
case 1337: | ||
return { | ||
injected, | ||
}; | ||
default: | ||
return { | ||
injected, | ||
portis, | ||
squarelink, | ||
fortmatic: { | ||
apiKey: process.env.REACT_APP_FORTMATIC_API_KEY as string, | ||
}, | ||
walletconnect, | ||
// walletlink, // In theory it supports Ropsten; in reality the tx gas is broken :( | ||
// torus: { | ||
// ...torus, | ||
// chainId, | ||
// }, | ||
}; | ||
} | ||
}; | ||
|
||
export const AVAILABLE_CONNECTORS = getConnectors(CHAIN_ID); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.