Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Tally wallet #652

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/assets/images/tally.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 18 additions & 1 deletion src/components/Web3Status/ConnectWalletPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { isMobile } from 'react-device-detect'
import { SUPPORTED_WALLETS } from '../../constants'
import { injected } from '../../connectors'
import MetamaskIcon from '../../assets/images/metamask.png'
import TallyIcon from '../../assets/images/tally.svg'
import { ModalView } from '.'
import Popover from '../Popover'
import { useCloseModals, useModalOpen } from '../../state/application/hooks'
Expand Down Expand Up @@ -93,6 +94,7 @@ export const ConnectWalletPopover = ({ setModal, tryActivation, children }: Conn

function getOptions() {
const isMetamask = window.ethereum && window.ethereum.isMetaMask
const isTally = window.ethereum && window.ethereum.isTally
return Object.keys(SUPPORTED_WALLETS).map(key => {
const option = SUPPORTED_WALLETS[key]
// check for mobile options
Expand Down Expand Up @@ -130,6 +132,17 @@ export const ConnectWalletPopover = ({ setModal, tryActivation, children }: Conn
onClick={closeModals}
/>
)
} else if (option.name === 'Tally') {
return (
<Item
key={key}
id={`connect-${key}`}
name="Install Tally"
icon={TallyIcon}
link={'https://tally.cash/'}
onClick={closeModals}
/>
)
} else {
return null //dont want to return install twice
}
Expand All @@ -138,8 +151,12 @@ export const ConnectWalletPopover = ({ setModal, tryActivation, children }: Conn
else if (option.name === 'MetaMask' && !isMetamask) {
return null
}
// don't return tally if injected provider isn't tally
else if (option.name === 'Tally' && !isTally) {
return null
}
// likewise for generic
else if (option.name === 'Injected' && isMetamask) {
else if (option.name === 'Injected' && (isMetamask || isTally)) {
return null
}
}
Expand Down
9 changes: 9 additions & 0 deletions src/constants/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,15 @@ export const SUPPORTED_WALLETS: { [key: string]: WalletInfo } = {
color: '#010101',
primary: true
},
TALLY: {
connector: injected,
name: 'Tally',
iconName: 'tally.svg',
description: 'Connect using Tally Wallet',
beemeeupnow marked this conversation as resolved.
Show resolved Hide resolved
href: null,
color: '#D59B4B',
mobile: true
},
METAMASK: {
connector: injected,
name: 'MetaMask',
Expand Down
1 change: 1 addition & 0 deletions src/react-app-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ interface EthereumProviderRequestArguments {
interface Window {
ethereum?: {
isMetaMask?: true
isTally?: true
on?: (...args: any[]) => void
removeListener?: (...args: any[]) => void
request?: (args: EthereumProviderRequestArguments) => Promise<unknown>
Expand Down