Skip to content

Commit

Permalink
Merge pull request #50 from XDeFi-tech/fix/get-accounts-loop-on-chain…
Browse files Browse the repository at this point in the history
…-changed-event

fix: [XDEFI-2666] get accounts loop on chain changed event
  • Loading branch information
Amurmurmur authored May 23, 2023
2 parents 999b54a + 0e7120f commit 5a930a0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xdefi/wallets-connector",
"version": "1.5.9",
"version": "1.5.10",
"description": "Cross chain wallets connector with react hooks",
"author": "garageinc",
"license": "MIT",
Expand Down
7 changes: 1 addition & 6 deletions src/components/WalletsModal/ChainCard/ChainCard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react'
import styled, { css } from 'styled-components'
import { ReactComponent as Checkmark } from '../../icons/Checkmark.svg'
import { IChainType } from 'src/constants'

interface IProps {
className?: string
Expand All @@ -26,11 +25,7 @@ export const ChainCard = ({
}

return (
<Container
disabled={disabled}
onClick={disabled ? undefined : handleClick}
title={value === IChainType.bitcoin ? 'Temporary disabled' : undefined}
>
<Container disabled={disabled} onClick={disabled ? undefined : handleClick}>
<ChainImage>
{icon}
{checked ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { PrimaryButton } from '../../PrimaryButton'
import { canInject, IProviderUserOptions } from 'src/helpers'
import { useConnectorActiveIds, useConnectorMultiChains } from 'src/hooks'
import { WalletsContext } from 'src/manager'
import { IChainType } from 'src/constants'

interface IProps {
className?: string
Expand All @@ -28,9 +27,7 @@ export const SelectChainSection = ({
onSelect
}: IProps) => {
const isTablet = useMediaQuery('(max-width: 768px)')
const [selectedChains, setSelectedChain] = useState<string[]>(
CHAIN_VALUES.filter((x) => x !== IChainType.bitcoin)
)
const [selectedChains, setSelectedChain] = useState<string[]>(CHAIN_VALUES)

const handleClick = (value: string) => {
const isExist = selectedChains.find((chainName) => chainName === value)
Expand Down Expand Up @@ -127,10 +124,6 @@ export const SelectChainSection = ({

const isDisabled = useCallback(
(chain) => {
if (chain.value === IChainType.bitcoin) {
// TODO Remove when fixed
return true
}
return Boolean(
providerInjectedChains &&
providerInjectedChains.some((chainName) => chain.value === chainName)
Expand Down
4 changes: 2 additions & 2 deletions src/wallets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class WalletsConnector {
}
})
ethereum.on('disconnect', () => {
this.disconnect(providerId)
console.log('Ethereum provider is disconnected')
})
ethereum.on('chainChanged', (chainId: string) =>
this.setActiveChain(providerId, chainId)
Expand Down Expand Up @@ -166,7 +166,7 @@ export class WalletsConnector {
...getChainData(parseInt(chainId, 16))
}
}
this.loadProviderAccounts(providerId, c)
this.setConfigs(providerId, c)
}

private loadProviderAccounts = async (
Expand Down

0 comments on commit 5a930a0

Please sign in to comment.