react-web3-storage 1.0.7 → 1.0.8

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,16 +1,17 @@
1
1
  {
2
2
  "name": "react-web3-storage",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Simple web3 storage for react dapp",
5
5
  "main": "src/index.js",
6
6
  "author": "Stas Prohetamine",
7
7
  "license": "ISC",
8
8
  "dependencies": {
9
- "promise-queue": "^2.2.5",
10
- "sleep-promise": "^9.1.0",
11
9
  "@reown/appkit": "^1.8.16",
12
10
  "@reown/appkit-adapter-ethers": "^1.8.16",
13
- "ethers": "^6.16.0"
11
+ "ethers": "^6.16.0",
12
+ "md5": "^2.3.0",
13
+ "promise-queue": "^2.2.5",
14
+ "sleep-promise": "^9.1.0"
14
15
  },
15
16
  "peerDependencies": {
16
17
  "@reown/appkit": "^1.8.16",
@@ -20,11 +21,11 @@
20
21
  "react-dom": "^18.0.0 || ^19.0.0"
21
22
  },
22
23
  "devDependencies": {
23
- "react": "^18.0.0 || ^19.0.0",
24
- "react-dom": "^18.0.0 || ^19.0.0",
25
- "tsup": "^8.5.1",
26
24
  "@reown/appkit": "^1.8.16",
27
25
  "@reown/appkit-adapter-ethers": "^1.8.16",
28
- "ethers": "^6.16.0"
26
+ "ethers": "^6.16.0",
27
+ "react": "^18.0.0 || ^19.0.0",
28
+ "react-dom": "^18.0.0 || ^19.0.0",
29
+ "tsup": "^8.5.1"
29
30
  }
30
31
  }
package/src/provider.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { createAppKit, AppKitProvider } from '@reown/appkit/react'
2
2
  import { EthersAdapter } from '@reown/appkit-adapter-ethers'
3
+ import md5 from 'md5'
3
4
 
4
5
  import _config from '../config.js'
5
6
 
@@ -14,6 +15,10 @@ const Provider = ({ children, config }) => {
14
15
  })
15
16
  }
16
17
 
18
+ if (config.host) {
19
+ window.GOBAL_REACT_WEB3_STORAGE_hostHash = md5(config.host) || md5(window.location.host)
20
+ }
21
+
17
22
  if (config.defaultNetwork) {
18
23
  window.GOBAL_REACT_WEB3_STORAGE_networkIndex = _config.blockChainsData.findIndex(({ name }) => config.defaultNetwork === name)
19
24
  }
@@ -19,7 +19,7 @@ const usePrivateStorage = (_id, value = '') => {
19
19
  msg: null
20
20
  })
21
21
 
22
- let id = `${location.host}-${_id}`
22
+ let id = `${window.GOBAL_REACT_WEB3_STORAGE_hostHash}-${_id}`
23
23
 
24
24
  const createSignerPrivate = async () => {
25
25
  try {
@@ -19,7 +19,7 @@ const useReadStorage = (_id, _address, value = '') => {
19
19
  msg: null
20
20
  })
21
21
 
22
- let id = `${location.host}-${_id}`
22
+ let id = `${window.GOBAL_REACT_WEB3_STORAGE_hostHash}-${_id}`
23
23
 
24
24
  const createSignerPrivate = async () => {
25
25
  try {
@@ -19,7 +19,7 @@ const useStorage = (_id, value = '') => {
19
19
  msg: null
20
20
  })
21
21
 
22
- let id = `${location.host}-${_id}`
22
+ let id = `${window.GOBAL_REACT_WEB3_STORAGE_hostHash}-${_id}`
23
23
 
24
24
  const createSignerPrivate = async () => {
25
25
  try {
@@ -23,7 +23,7 @@ const useTableStorage = (_id, _address) => {
23
23
  msg: null
24
24
  })
25
25
 
26
- let id = `${location.host}-${_id}`
26
+ let id = `${window.GOBAL_REACT_WEB3_STORAGE_hostHash}-${_id}`
27
27
 
28
28
  const createSignerPrivate = async () => {
29
29
  if (!walletProvider || !address) {