Skip to content

Commit

Permalink
Merge pull request #116 from lidofinance/fix/is-ledger-connector
Browse files Browse the repository at this point in the history
Fix: return isLedger to useConnectorInfo
  • Loading branch information
alx-khramov authored Jan 15, 2024
2 parents f4a08e2 + 2ec3259 commit c6d5a9f
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
7 changes: 7 additions & 0 deletions packages/reef-knot/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# reef-knot

## 1.15.2

### Patch Changes

- Updated dependencies
- @reef-knot/web3-react@1.13.1

## 1.15.1

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/reef-knot/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reef-knot",
"version": "1.15.1",
"version": "1.15.2",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
Expand Down Expand Up @@ -43,7 +43,7 @@
"dependencies": {
"@reef-knot/connect-wallet-modal": "1.17.0",
"@reef-knot/core-react": "1.8.1",
"@reef-knot/web3-react": "1.13.0",
"@reef-knot/web3-react": "1.13.1",
"@reef-knot/ui-react": "1.0.8",
"@reef-knot/wallets-list": "1.11.1",
"@reef-knot/wallets-helpers": "1.1.5",
Expand Down
6 changes: 6 additions & 0 deletions packages/web3-react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @reef-knot/web3-react

## 1.13.1

### Patch Changes

- fix: return isLedger to useConnectorInfo

## 1.13.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/web3-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reef-knot/web3-react",
"version": "1.13.0",
"version": "1.13.1",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
Expand Down
10 changes: 9 additions & 1 deletion packages/web3-react/src/hooks/useConnectorInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import { useAccount } from 'wagmi';
import { SafeAppConnector } from '@gnosis.pm/safe-apps-web3-react';
import { InjectedConnector } from '@web3-react/injected-connector';
import { WalletLinkConnector } from '@web3-react/walletlink-connector';
import { LedgerHQFrameConnector } from '@reef-knot/ledger-connector';
import {
LedgerHIDConnector,
LedgerHQFrameConnector,
} from '@reef-knot/ledger-connector';
import { useWeb3 } from './useWeb3';
import { PROVIDER_NAMES } from '../constants';
import {
Expand All @@ -19,6 +22,7 @@ type ConnectorInfo = {
providerName?: string;
isConnectedViaWagmi: boolean;
isGnosis: boolean;
isLedger: boolean;
isLedgerLive: boolean;
isWalletLink: boolean;
isCoinbase: boolean;
Expand All @@ -38,6 +42,8 @@ export const useConnectorInfo = (): ConnectorInfo => {

const isConnectedViaWagmi = isConnected && !!wagmiConnector;

const isLedger = wagmiConnector instanceof LedgerHIDConnector;

// === WAGMI connectors END
// === WEB3-REACT connectors BEGIN
const isGnosis = active && connector instanceof SafeAppConnector;
Expand Down Expand Up @@ -73,6 +79,7 @@ export const useConnectorInfo = (): ConnectorInfo => {
if (isDappBrowser) return undefined;

if (isGnosis) return PROVIDER_NAMES.GNOSIS;
if (isLedger) return PROVIDER_NAMES.LEDGER;
if (isLedgerLive) return PROVIDER_NAMES.LEDGER_HQ_LIVE;
if (isImToken) return PROVIDER_NAMES.IM_TOKEN;
if (isTrust) return PROVIDER_NAMES.TRUST;
Expand Down Expand Up @@ -101,6 +108,7 @@ export const useConnectorInfo = (): ConnectorInfo => {
isConnectedViaWagmi,

isGnosis,
isLedger,
isLedgerLive,
isWalletLink,
isCoinbase,
Expand Down

0 comments on commit c6d5a9f

Please sign in to comment.