Skip to content
This repository has been archived by the owner on Sep 6, 2023. It is now read-only.

Commit

Permalink
feat(connectors): add fordefi detection
Browse files Browse the repository at this point in the history
  • Loading branch information
rony-arnac committed Jul 9, 2023
1 parent cf1b48d commit 4bb6bdb
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/wise-pens-brake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wagmi/connectors": patch
---

add detection for Fordefi wallet
1 change: 1 addition & 0 deletions packages/connectors/src/metaMask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export class MetaMaskConnector extends InjectedConnector {
if (ethereum.isTokenPocket) return
if (ethereum.isTokenary) return
if (ethereum.isZerion) return
if (ethereum.isFordefi) return
return ethereum
}

Expand Down
1 change: 1 addition & 0 deletions packages/connectors/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ type InjectedProviderFlags = {
isXDEFI?: true
isZerion?: true
isHaloWallet?: true
isFordefi?: true
}

type InjectedProviders = InjectedProviderFlags & {
Expand Down
1 change: 1 addition & 0 deletions packages/connectors/src/utils/getInjectedName.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ describe.each([
{ ethereum: { isXDEFI: true }, expected: 'XDEFI Wallet' },
{ ethereum: { isZerion: true }, expected: 'Zerion' },
{ ethereum: { isMetaMask: true }, expected: 'MetaMask' },
{ ethereum: { isFordefi: true }, expected: 'Fordefi' },
{
ethereum: { providers: [{ isMetaMask: true }, { isCoinbaseWallet: true }] },
expected: ['MetaMask', 'Coinbase Wallet'],
Expand Down
1 change: 1 addition & 0 deletions packages/connectors/src/utils/getInjectedName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export function getInjectedName(ethereum?: WindowProvider) {
if (provider.isXDEFI) return 'XDEFI Wallet'
if (provider.isZerion) return 'Zerion'
if (provider.isMetaMask) return 'MetaMask'
if (provider.isFordefi) return 'Fordefi'
}

// Some injected providers detect multiple other providers and create a list at `window.ethereum.providers`
Expand Down

0 comments on commit 4bb6bdb

Please sign in to comment.