react-web3-storage 1.0.4 → 1.0.5

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/config.js CHANGED
@@ -8,6 +8,12 @@ const blockChainsData = [
8
8
  token: '0x5FbDB2315678afecb367f032d93F642f64180aa3',
9
9
  receiver: '0xcbEAF3BDe82155F56486Fb5a1072cb8baAf547cc',
10
10
  publicRpc: 'http://192.168.50.246:8545'
11
+ },
12
+ {
13
+ network: bsc,
14
+ name: 'bnb',
15
+ token: '0xD566886eB93500e2BA464bd48c8D5A2556569253',
16
+ receiver: '0x9449448eae234EDC73958A35A205F9648D7Bd208'
11
17
  }
12
18
  ]
13
19
  .filter(({ name }) => name === 'unknown' ? process.env.NODE_ENV === 'development' : true)
@@ -16,13 +22,6 @@ const blockChainsData = [
16
22
  const config = {
17
23
  networks: blockChainsData.map(({ network }) => network),
18
24
  blockChainsData,
19
- metadata: {
20
- name: 'React Web3 Storage',
21
- description: 'Example DApp with React Web3 Storage',
22
- url: 'https://prohetamine.github.io/react-web3-storage/',
23
- icons: ['https://prohetamine.github.io/react-web3-storage/icon.svg']
24
- },
25
- projectId: '1febfd92481d4ea997711d2ac4a363c0',
26
25
  address: blockChainsData.reduce((ctx, { name, token, receiver }) => {
27
26
  ctx[name] = {
28
27
  token,
package/package.json CHANGED
@@ -1,10 +1,13 @@
1
1
  {
2
2
  "name": "react-web3-storage",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
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
+ "scripts": {
9
+ "postinstall": "npm i"
10
+ },
8
11
  "dependencies": {
9
12
  "promise-queue": "^2.2.5",
10
13
  "sleep-promise": "^9.1.0"
package/src/index.js CHANGED
@@ -4,6 +4,7 @@ import useStorage from './use-storage.js'
4
4
  import useReadStorage from './use-read-storage.js'
5
5
  import useTableStorage from './use-table-storage.js'
6
6
  import useApp from './use-app.js'
7
+ import config from '../config.js'
7
8
 
8
9
  export {
9
10
  Provider,
@@ -11,5 +12,6 @@ export {
11
12
  useStorage,
12
13
  useReadStorage,
13
14
  useTableStorage,
14
- useApp
15
+ useApp,
16
+ config
15
17
  }
package/src/provider.js CHANGED
@@ -1,18 +1,19 @@
1
- import React from 'react';
2
1
  import { createAppKit, AppKitProvider } from '@reown/appkit/react'
3
2
  import { EthersAdapter } from '@reown/appkit-adapter-ethers'
4
3
 
5
- import config from '../config.js'
4
+ import _config from '../config.js'
6
5
 
6
+ const Provider = ({ children, config }) => {
7
+ if (!window.REACT_WEB3_createdAppKit) {
8
+ window.REACT_WEB3_createdAppKit = true
7
9
  createAppKit({
8
10
  projectId: config.projectId,
9
11
  adapters: [new EthersAdapter()],
10
- networks: config.networks,
12
+ networks: _config.networks,
11
13
  metadata: config.metadata
12
14
  })
13
-
15
+ }
14
16
 
15
- const Provider = ({ children, config }) => {
16
17
  return AppKitProvider({ children, ...config })
17
18
  }
18
19
 
package/src/use-app.js CHANGED
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import { useAppKit, useAppKitAccount } from '@reown/appkit/react'
3
2
 
4
3
  const useApp = () => {
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import { useAppKit, useAppKitAccount, useAppKitProvider } from '@reown/appkit/react'
3
2
  import { BrowserProvider, Contract } from 'ethers'
4
3
  import config from '../config.js'
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import { useAppKit, useAppKitAccount, useAppKitProvider } from '@reown/appkit/react'
3
2
  import { BrowserProvider, Contract, Wallet, JsonRpcProvider } from 'ethers'
4
3
  import config from '../config.js'
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import { useAppKit, useAppKitAccount, useAppKitProvider } from '@reown/appkit/react'
3
2
  import { BrowserProvider, Contract } from 'ethers'
4
3
  import config from '../config.js'
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import { useAppKit, useAppKitAccount, useAppKitProvider } from '@reown/appkit/react'
3
2
  import { BrowserProvider, Contract, Wallet, JsonRpcProvider } from 'ethers'
4
3
  import config from '../config.js'