@1001-digital/components 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1001-digital/components",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "type": "module",
5
5
  "sideEffects": [
6
6
  "*.css"
@@ -24,18 +24,19 @@ export const useBlockExplorer = (key?: string) =>
24
24
 
25
25
  export const useEnsureChainIdCheck = () => {
26
26
  const chainId = useMainChainId()
27
- const { mutate: switchChain } = useSwitchChain()
27
+ const { mutateAsync: switchChain } = useSwitchChain()
28
28
  const { chainId: currentChainId } = useConnection()
29
29
 
30
30
  return async () => {
31
- if (chainId !== currentChainId.value) {
32
- switchChain({ chainId })
33
- }
34
-
35
31
  if (chainId === currentChainId.value) {
36
32
  return true
37
33
  }
38
34
 
39
- return false
35
+ try {
36
+ await switchChain({ chainId })
37
+ return true
38
+ } catch {
39
+ return false
40
+ }
40
41
  }
41
42
  }