Skip to content

Commit

Permalink
feat: hack for old and mobile providers (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
nachomazzara authored Feb 13, 2020
1 parent 319c7c8 commit 2e48bd8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/modules/wallet/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
ENABLE_WALLET_REQUEST,
ENABLE_WALLET_SUCCESS
} from './actions'
import { isMobile } from '../../lib/utils'
import { MANA } from '../../contracts/MANA'
import { Wallet } from './types'

Expand All @@ -29,6 +30,12 @@ export function createWalletSaga(
const { MANA_ADDRESS } = options
function* handleConnectWalletRequest() {
try {
// Hack for old providers and mobile providers which does not have a hack to convert send to sendAsync
const provider = (window as any).ethereum
if (isMobile() && provider && typeof provider.sendAsync === 'function') {
provider.send = provider.sendAsync
}

const eth = Eth.fromCurrentProvider()
if (!eth) {
// this could happen if metamask is not installed
Expand Down

0 comments on commit 2e48bd8

Please sign in to comment.