@huma-finance/widgets 0.0.47-beta.178 → 0.0.47-beta.181

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": "@huma-finance/widgets",
3
- "version": "0.0.47-beta.178+6c16c1f",
3
+ "version": "0.0.47-beta.181+ef33f9a",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -30,8 +30,8 @@
30
30
  "@ethersproject/experimental": "^5.7.0",
31
31
  "@ethersproject/providers": "^5.6.0",
32
32
  "@ethersproject/units": "^5.6.0",
33
- "@huma-finance/sdk": "^0.0.47-beta.178+6c16c1f",
34
- "@huma-finance/shared": "^0.0.47-beta.178+6c16c1f",
33
+ "@huma-finance/sdk": "^0.0.46",
34
+ "@huma-finance/shared": "^0.0.46",
35
35
  "@mui/icons-material": "^5.3.0",
36
36
  "@mui/material": "^5.0.6",
37
37
  "@mui/styles": "^5.0.2",
@@ -192,5 +192,5 @@
192
192
  "optionalDependencies": {
193
193
  "encoding": "^0.1.13"
194
194
  },
195
- "gitHead": "6c16c1f859d04ff7276615e5317923cd5e6d5e39"
195
+ "gitHead": "ef33f9a761d7201d1566b2ca6200d67e21fe81a1"
196
196
  }
package/src/index.tsx CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  import { ThemeProvider } from '@mui/material'
9
9
  import { Provider as Eip1193Provider } from '@web3-react/types'
10
10
  import { Provider as AtomProvider } from 'jotai'
11
+ import { useEffect, useState } from 'react'
11
12
  import { Provider as ReduxProvider } from 'react-redux'
12
13
 
13
14
  import { ChainSupportProvider } from './components/ChainSupportProvider'
@@ -63,11 +64,17 @@ type WidgetProps = {
63
64
 
64
65
  function Widget(props: WCProps<WidgetProps>) {
65
66
  const { children, provider } = props
67
+ const [chainId, setChainId] = useState<number | undefined>(undefined)
66
68
 
67
- let chainId
68
- if (provider instanceof JsonRpcProvider) {
69
- chainId = provider.network.chainId
70
- }
69
+ useEffect(() => {
70
+ const getChainId = async () => {
71
+ if (provider instanceof JsonRpcProvider) {
72
+ const network = await provider.getNetwork()
73
+ setChainId(network?.chainId)
74
+ }
75
+ }
76
+ getChainId()
77
+ }, [provider])
71
78
 
72
79
  return (
73
80
  <ThemeProvider theme={themeHuma}>