@huma-finance/widgets 0.0.46 → 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/dist/cjs/index.cjs +1972 -1944
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.js +1973 -1945
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/index.tsx +11 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huma-finance/widgets",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.47-beta.181+ef33f9a",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -192,5 +192,5 @@
|
|
|
192
192
|
"optionalDependencies": {
|
|
193
193
|
"encoding": "^0.1.13"
|
|
194
194
|
},
|
|
195
|
-
"gitHead": "
|
|
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
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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}>
|