From 17a076b9d74669cecbc7627d9edac9254b8cdbf4 Mon Sep 17 00:00:00 2001 From: Infinity Wallet <64919828+InfinityWallet@users.noreply.github.com> Date: Wed, 19 Jul 2023 06:22:13 +0100 Subject: [PATCH] Add Infinity Wallet support (#244) * Add Infinity Wallet * Update Infinity Wallet * Update logos.tsx --------- Co-authored-by: arons1 Co-authored-by: Lochie Axon --- packages/connectkit/src/assets/logos.tsx | 102 ++++++++++++++++++ packages/connectkit/src/utils/index.ts | 15 ++- .../src/wallets/connectors/infinityWallet.tsx | 31 ++++++ packages/connectkit/src/wallets/index.ts | 3 + .../src/wallets/useDefaultWallets.tsx | 1 + 5 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 packages/connectkit/src/wallets/connectors/infinityWallet.tsx diff --git a/packages/connectkit/src/assets/logos.tsx b/packages/connectkit/src/assets/logos.tsx index 8eb548ef..b8cb955e 100644 --- a/packages/connectkit/src/assets/logos.tsx +++ b/packages/connectkit/src/assets/logos.tsx @@ -863,6 +863,107 @@ export const Dawn = ({ ...props }) => ( ); +export const InfinityWallet = ({...props}) => ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +); + const Rabby = ({ ...props }) => ( { const isFrame = Boolean(ethereum.isFrame); if (isFrame) return false; + const isInfinityWallet = Boolean(ethereum.isInfinityWallet); + if (isInfinityWallet) return false; + const isRabby = Boolean(ethereum.isRabby); if (isRabby) return false; @@ -191,10 +194,19 @@ const isPhantom = () => { return false; }; -const isRabby = () => { +const isInfinityWallet = () => { if (typeof window === 'undefined') return false; const { ethereum } = window; + return !!( + ethereum?.isInfinityWallet || + (ethereum?.providers && + ethereum?.providers.find((provider) => provider.isInfinityWallet)) + ); +}; +const isRabby = () => { + if (typeof window === 'undefined') return false; + const { ethereum } = window; return !!( ethereum?.isRabby || (ethereum?.providers && @@ -288,6 +300,7 @@ export { isCoinbaseWallet, isFrame, isPhantom, + isInfinityWallet, isRabby, isFordefi, isTrust, diff --git a/packages/connectkit/src/wallets/connectors/infinityWallet.tsx b/packages/connectkit/src/wallets/connectors/infinityWallet.tsx new file mode 100644 index 00000000..78b97f1d --- /dev/null +++ b/packages/connectkit/src/wallets/connectors/infinityWallet.tsx @@ -0,0 +1,31 @@ +import { WalletProps } from './../wallet'; + +import { isInfinityWallet } from '../../utils'; +import Logos from './../../assets/logos'; + +export const infinityWallet = (): WalletProps => { + const isInstalled = isInfinityWallet(); + + return { + id: 'infinityWallet', + name: 'Infinity Wallet', + logos: { + default: , + mobile: , + transparent: , + appIcon: , + connectorButton: , + }, + logoBackground: '#08a1d5', + scannable: false, + downloadUrls: { + download: 'https://infinitywallet.io/download', + website: 'https://infinitywallet.io/download', + chrome: 'https://infinitywallet.io/download', + firefox: 'https://infinitywallet.io/download', + brave: 'https://infinitywallet.io/download', + edge: 'https://infinitywallet.io/download', + }, + installed: Boolean(isInstalled), + }; +}; diff --git a/packages/connectkit/src/wallets/index.ts b/packages/connectkit/src/wallets/index.ts index 274abf47..b92a3def 100644 --- a/packages/connectkit/src/wallets/index.ts +++ b/packages/connectkit/src/wallets/index.ts @@ -1,6 +1,7 @@ import { injected } from './connectors/injected'; import { walletConnect } from './connectors/walletConnect'; import { metaMask } from './connectors/metaMask'; +import { infinityWallet } from './connectors/infinityWallet'; import { coinbaseWallet } from './connectors/coinbaseWallet'; import { rainbow } from './connectors/rainbow'; import { argent } from './connectors/argent'; @@ -24,11 +25,13 @@ import { fordefi } from './connectors/fordefi'; import { tokenPocket } from './connectors/tokenPocket'; import { talisman } from './connectors/talisman'; + export const getWallets = () => { return [ injected(), walletConnect(), metaMask(), + infinityWallet(), coinbaseWallet(), argent(), trust(), diff --git a/packages/connectkit/src/wallets/useDefaultWallets.tsx b/packages/connectkit/src/wallets/useDefaultWallets.tsx index 2e060ff1..8db88ef2 100644 --- a/packages/connectkit/src/wallets/useDefaultWallets.tsx +++ b/packages/connectkit/src/wallets/useDefaultWallets.tsx @@ -19,6 +19,7 @@ function useDefaultWallets(): WalletProps[] | any { 'argent', 'trust', 'ledger', + 'infinityWallet', 'family', 'imToken', 'rainbow',