@berachain/wagmi 0.4.2-beta.5 → 0.4.2-beta.6

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";var _chunkPVMPBWIGcjs = require('../../chunk-PVMPBWIG.cjs');var _chunkOLYL3V2Dcjs = require('../../chunk-OLYL3V2D.cjs');var _react = require('react');var _reactquery = require('@tanstack/react-query');var _react3 = require('thirdweb/react');var _wagmi = require('wagmi');var _jsxruntime = require('react/jsx-runtime');var C=new _reactquery.QueryClient;function A({transports:t,defaultChain:r,chains:n,thirdweb:i,children:s,onConnect:c,onConnectError:g,publicJsonRpcUrl:p,...f}){let o=_react.useMemo.call(void 0, ()=>_chunkPVMPBWIGcjs.a.call(void 0, {thirdweb:i,transports:t,defaultChain:r,chains:n}),[r,i,t,n]),h=_chunkOLYL3V2Dcjs.d.call(void 0, {config:o,chain:r,publicJsonRpcUrl:p,onConnect:c,onConnectError:g});return _jsxruntime.jsx.call(void 0, _react3.ThirdwebProvider,{children:_jsxruntime.jsx.call(void 0, _wagmi.WagmiProvider,{config:o.wagmi,reconnectOnMount:!1,children:_jsxruntime.jsx.call(void 0, _reactquery.QueryClientProvider,{client:C,children:_jsxruntime.jsx.call(void 0, _chunkOLYL3V2Dcjs.c,{...f,thirdweb:i,defaultChain:r,config:o,thirdwebResult:h,children:s})})})})}exports.WagmiProvider = A;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";var _chunkPVMPBWIGcjs = require('../../chunk-PVMPBWIG.cjs');var _chunkOLYL3V2Dcjs = require('../../chunk-OLYL3V2D.cjs');var _react = require('react');var _reactquery = require('@tanstack/react-query');var _react3 = require('thirdweb/react');var _wagmi = require('wagmi');var _jsxruntime = require('react/jsx-runtime');var P=new _reactquery.QueryClient;function W({config:e,defaultChain:r,thirdweb:t,children:i,onConnect:m,onConnectError:a,publicJsonRpcUrl:n,...p}){let c=_chunkOLYL3V2Dcjs.d.call(void 0, {config:e,chain:r,publicJsonRpcUrl:n,onConnect:m,onConnectError:a});return _jsxruntime.jsx.call(void 0, _chunkOLYL3V2Dcjs.c,{...p,thirdweb:t,defaultChain:r,config:e,thirdwebResult:c,children:i})}function E({transports:e,defaultChain:r,chains:t,thirdweb:i,children:m,...a}){let n=_react.useMemo.call(void 0, ()=>_chunkPVMPBWIGcjs.a.call(void 0, {thirdweb:i,transports:e,defaultChain:r,chains:t}),[r,i,e,t]);return _jsxruntime.jsx.call(void 0, _react3.ThirdwebProvider,{children:_jsxruntime.jsx.call(void 0, _wagmi.WagmiProvider,{config:n.wagmi,reconnectOnMount:!1,children:_jsxruntime.jsx.call(void 0, _reactquery.QueryClientProvider,{client:P,children:_jsxruntime.jsx.call(void 0, W,{...a,config:n,defaultChain:r,thirdweb:i,children:m})})})})}exports.WagmiProvider = E;
@@ -22,6 +22,6 @@ type WagmiProviderLightWeightProps = PropsWithChildren<{
22
22
  onConnectError?: (error: Error) => void;
23
23
  publicJsonRpcUrl?: string;
24
24
  }>;
25
- declare function WagmiProvider({ transports, defaultChain, chains, thirdweb, children, onConnect, onConnectError, publicJsonRpcUrl, ...baseProps }: WagmiProviderLightWeightProps): react_jsx_runtime.JSX.Element;
25
+ declare function WagmiProvider({ transports, defaultChain, chains, thirdweb, children, ...innerProps }: WagmiProviderLightWeightProps): react_jsx_runtime.JSX.Element;
26
26
 
27
27
  export { WagmiProvider };
@@ -22,6 +22,6 @@ type WagmiProviderLightWeightProps = PropsWithChildren<{
22
22
  onConnectError?: (error: Error) => void;
23
23
  publicJsonRpcUrl?: string;
24
24
  }>;
25
- declare function WagmiProvider({ transports, defaultChain, chains, thirdweb, children, onConnect, onConnectError, publicJsonRpcUrl, ...baseProps }: WagmiProviderLightWeightProps): react_jsx_runtime.JSX.Element;
25
+ declare function WagmiProvider({ transports, defaultChain, chains, thirdweb, children, ...innerProps }: WagmiProviderLightWeightProps): react_jsx_runtime.JSX.Element;
26
26
 
27
27
  export { WagmiProvider };
@@ -1 +1 @@
1
- "use client";import{a as m}from"../../chunk-MZZ62TKM.mjs";import{c as a,d}from"../../chunk-FPJ6HXP4.mjs";import{useMemo as v}from"react";import{QueryClient as l,QueryClientProvider as u}from"@tanstack/react-query";import{ThirdwebProvider as P}from"thirdweb/react";import{WagmiProvider as b}from"wagmi";import{jsx as e}from"react/jsx-runtime";var C=new l;function A({transports:t,defaultChain:r,chains:n,thirdweb:i,children:s,onConnect:c,onConnectError:g,publicJsonRpcUrl:p,...f}){let o=v(()=>m({thirdweb:i,transports:t,defaultChain:r,chains:n}),[r,i,t,n]),h=d({config:o,chain:r,publicJsonRpcUrl:p,onConnect:c,onConnectError:g});return e(P,{children:e(b,{config:o.wagmi,reconnectOnMount:!1,children:e(u,{client:C,children:e(a,{...f,thirdweb:i,defaultChain:r,config:o,thirdwebResult:h,children:s})})})})}export{A as WagmiProvider};
1
+ "use client";import{a as d}from"../../chunk-MZZ62TKM.mjs";import{c as g,d as s}from"../../chunk-FPJ6HXP4.mjs";import{useMemo as f}from"react";import{QueryClient as h,QueryClientProvider as u}from"@tanstack/react-query";import{ThirdwebProvider as v}from"thirdweb/react";import{WagmiProvider as l}from"wagmi";import{jsx as o}from"react/jsx-runtime";var P=new h;function W({config:e,defaultChain:r,thirdweb:t,children:i,onConnect:m,onConnectError:a,publicJsonRpcUrl:n,...p}){let c=s({config:e,chain:r,publicJsonRpcUrl:n,onConnect:m,onConnectError:a});return o(g,{...p,thirdweb:t,defaultChain:r,config:e,thirdwebResult:c,children:i})}function E({transports:e,defaultChain:r,chains:t,thirdweb:i,children:m,...a}){let n=f(()=>d({thirdweb:i,transports:e,defaultChain:r,chains:t}),[r,i,e,t]);return o(v,{children:o(l,{config:n.wagmi,reconnectOnMount:!1,children:o(u,{client:P,children:o(W,{...a,config:n,defaultChain:r,thirdweb:i,children:m})})})})}export{E as WagmiProvider};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@berachain/wagmi",
3
- "version": "0.4.2-beta.5",
3
+ "version": "0.4.2-beta.6",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -31,16 +31,50 @@ type WagmiProviderLightWeightProps = PropsWithChildren<{
31
31
 
32
32
  const queryClient = new QueryClient();
33
33
 
34
- export function WagmiProvider({
35
- transports,
34
+ /**
35
+ * Inner component that renders inside the wagmi provider tree,
36
+ * so that useThirdwebLightWeight can safely call wagmi hooks.
37
+ */
38
+ function WagmiProviderInner({
39
+ config,
36
40
  defaultChain,
37
- chains,
38
41
  thirdweb,
39
42
  children,
40
43
  onConnect,
41
44
  onConnectError,
42
45
  publicJsonRpcUrl,
43
46
  ...baseProps
47
+ }: Omit<WagmiProviderLightWeightProps, "transports" | "chains"> & {
48
+ config: ReturnType<typeof getConfig>;
49
+ }) {
50
+ const thirdwebResult = useThirdwebLightWeight({
51
+ config,
52
+ chain: defaultChain,
53
+ publicJsonRpcUrl,
54
+ onConnect,
55
+ onConnectError,
56
+ });
57
+
58
+ return (
59
+ <BeraWagmiProviderBase
60
+ {...baseProps}
61
+ thirdweb={thirdweb}
62
+ defaultChain={defaultChain}
63
+ config={config}
64
+ thirdwebResult={thirdwebResult}
65
+ >
66
+ {children}
67
+ </BeraWagmiProviderBase>
68
+ );
69
+ }
70
+
71
+ export function WagmiProvider({
72
+ transports,
73
+ defaultChain,
74
+ chains,
75
+ thirdweb,
76
+ children,
77
+ ...innerProps
44
78
  }: WagmiProviderLightWeightProps) {
45
79
  const config = useMemo(() => {
46
80
  return getConfig({
@@ -51,14 +85,6 @@ export function WagmiProvider({
51
85
  });
52
86
  }, [defaultChain, thirdweb, transports, chains]);
53
87
 
54
- const thirdwebResult = useThirdwebLightWeight({
55
- config,
56
- chain: defaultChain,
57
- publicJsonRpcUrl,
58
- onConnect,
59
- onConnectError,
60
- });
61
-
62
88
  return (
63
89
  <ThirdwebProvider>
64
90
  <WagmiProviderBase
@@ -67,15 +93,14 @@ export function WagmiProvider({
67
93
  reconnectOnMount={false}
68
94
  >
69
95
  <QueryClientProvider client={queryClient}>
70
- <BeraWagmiProviderBase
71
- {...baseProps}
72
- thirdweb={thirdweb}
73
- defaultChain={defaultChain}
96
+ <WagmiProviderInner
97
+ {...innerProps}
74
98
  config={config}
75
- thirdwebResult={thirdwebResult}
99
+ defaultChain={defaultChain}
100
+ thirdweb={thirdweb}
76
101
  >
77
102
  {children}
78
- </BeraWagmiProviderBase>
103
+ </WagmiProviderInner>
79
104
  </QueryClientProvider>
80
105
  </WagmiProviderBase>
81
106
  </ThirdwebProvider>