@berachain/wagmi 0.4.0-beta.3 → 0.4.0-beta.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/dist/{BeraWagmi-ByydBpB4.d.ts → BeraWagmi-4q0Ls6Dc.d.ts} +2 -5
- package/dist/{BeraWagmi-BdZ9nENq.d.cts → BeraWagmi-Bcm59a7m.d.cts} +2 -5
- package/dist/chunk-PPRCI25K.mjs +1 -0
- package/dist/chunk-ZCJIFG7W.cjs +1 -0
- package/dist/context/index.cjs +1 -1
- package/dist/context/index.d.cts +1 -2
- package/dist/context/index.d.ts +1 -2
- package/dist/context/index.mjs +1 -1
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.cts +2 -2
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.mjs +1 -1
- package/dist/hooks/thirdweb/index.cjs +1 -1
- package/dist/hooks/thirdweb/index.d.cts +1 -1
- package/dist/hooks/thirdweb/index.d.ts +1 -1
- package/dist/hooks/thirdweb/index.mjs +1 -1
- package/package.json +2 -1
- package/src/context/BeraWagmi.tsx +7 -9
- package/src/context/WagmiProvider.tsx +0 -1
- package/src/context/useThirdweb.tsx +21 -8
- package/src/hooks/thirdweb/index.ts +0 -1
- package/dist/chunk-2DC2R4UF.mjs +0 -1
- package/dist/chunk-52QNT47H.cjs +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { WalletConnectionOption } from 'thirdweb/wallets';
|
|
2
|
+
import { Profile, WalletConnectionOption } from 'thirdweb/wallets';
|
|
3
3
|
import { Address, Chain } from 'viem';
|
|
4
4
|
import { UseWalletClientReturnType } from 'wagmi';
|
|
5
5
|
import { getConfig, ThirdwebConfig } from './config/index.js';
|
|
@@ -24,6 +24,7 @@ interface BeraWagmiApi {
|
|
|
24
24
|
isEmbeddedWallet: boolean;
|
|
25
25
|
connectorName: string | null;
|
|
26
26
|
connectionId: string;
|
|
27
|
+
profiles: Profile[] | undefined;
|
|
27
28
|
/**
|
|
28
29
|
* Wallet to display.
|
|
29
30
|
*
|
|
@@ -69,10 +70,6 @@ interface BeraWagmiApi {
|
|
|
69
70
|
* This is used to disable EIP-5792 temporarily.
|
|
70
71
|
*/
|
|
71
72
|
onSmartAccountRejection(): void;
|
|
72
|
-
/**
|
|
73
|
-
* List of external chains that are whitelisted for that app.
|
|
74
|
-
*/
|
|
75
|
-
chains: Chain[];
|
|
76
73
|
defaultChainId: ChainId;
|
|
77
74
|
}
|
|
78
75
|
declare enum ChainId {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { WalletConnectionOption } from 'thirdweb/wallets';
|
|
2
|
+
import { Profile, WalletConnectionOption } from 'thirdweb/wallets';
|
|
3
3
|
import { Address, Chain } from 'viem';
|
|
4
4
|
import { UseWalletClientReturnType } from 'wagmi';
|
|
5
5
|
import { getConfig, ThirdwebConfig } from './config/index.cjs';
|
|
@@ -24,6 +24,7 @@ interface BeraWagmiApi {
|
|
|
24
24
|
isEmbeddedWallet: boolean;
|
|
25
25
|
connectorName: string | null;
|
|
26
26
|
connectionId: string;
|
|
27
|
+
profiles: Profile[] | undefined;
|
|
27
28
|
/**
|
|
28
29
|
* Wallet to display.
|
|
29
30
|
*
|
|
@@ -69,10 +70,6 @@ interface BeraWagmiApi {
|
|
|
69
70
|
* This is used to disable EIP-5792 temporarily.
|
|
70
71
|
*/
|
|
71
72
|
onSmartAccountRejection(): void;
|
|
72
|
-
/**
|
|
73
|
-
* List of external chains that are whitelisted for that app.
|
|
74
|
-
*/
|
|
75
|
-
chains: Chain[];
|
|
76
73
|
defaultChainId: ChainId;
|
|
77
74
|
}
|
|
78
75
|
declare enum ChainId {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{usePublicClient as he}from"wagmi";import{useContext as V}from"react";import{createContext as H}from"react";import{jsx as Q}from"react/jsx-runtime";var I=H(void 0);function N({children:e,address:n,defaultChainId:o}){return Q(I.Provider,{value:{address:n,defaultChainId:o},children:e})}function E(){let e=V(I);if(!e)throw new Error("LightweightAccountContext not found");let{address:n,defaultChainId:o}=e;return{isConnected:!!n,address:n,defaultChainId:o}}import{useBlockNumber as $e,useChains as et,useConfig as tt,useEnsAvatar as z,useEnsName as D,useSwitchChain as nt,useTransactionReceipt as ot}from"wagmi";import{createContext as ae,useContext as se,useMemo as T}from"react";import ce from"swr/immutable";import{normalize as de}from"viem/ens";import{useAccount as le,useDisconnect as ue,usePublicClient as pe,useWalletClient as me}from"wagmi";import{useMemo as R}from"react";import{defineChain as M}from"thirdweb";import{ConnectButton as X,useActiveAccount as Y,useActiveWallet as Z,useAutoConnect as $,useProfiles as ee,useConnectModal as te,useDisconnect as ne,useWalletInfo as oe}from"thirdweb/react";import{useConnect as ie}from"wagmi";import{jsx as re}from"react/jsx-runtime";function L({config:e,theme:n,chains:o=[],chain:t,publicJsonRpcUrl:d=t.rpcUrls.default.http[0]}){let{connectors:h,connect:w}=ie(),l=Z(),a=Y(),{disconnect:A}=ne(),{data:g}=oe(l?.id),{data:m}=ee({client:e.client}),f=R(()=>M({id:t.id,blockExplorers:t.blockExplorers,blockTime:t.blockTime,ensTlds:t.ensTlds,testnet:t.testnet,contracts:t.contracts,nativeCurrency:t.nativeCurrency,name:t.name,rpcUrls:{default:{http:[d]}}}),[d,t]),u={client:e.client,chain:f,wallets:e.wallets};async function p(r){let i=h.find(s=>s.id==="in-app-wallet");if(i){let s={withCapabilities:!0,wallet:r};w({connector:i,chainId:t.id,...s})}else console.error("no tw connector found")}let{isLoading:W}=$({...u,onConnect:p}),v=R(()=>crypto.randomUUID(),[l?.id,a?.address]),{connect:P}=te();return{async connect({strategy:r}){if(!e.hasEmbeddedWallets){console.error("useBeraWagmi.connect: this function is not available if embedded wallets are disabled");return}let i=e.wallets.find(s=>s.id==="inApp");if(!i){console.error("useBeraWagmi.connect: no inApp wallet found");return}await i.connect({...u,strategy:r}),await p(i)},async openConnectModal(){let r=await P({...u,wallets:e.wallets,theme:n==="auto"?void 0:n,size:"compact",chains:[f,...o.filter(i=>i.id!==f.id).map(i=>M({id:i.id}))]});await p(r)},disconnect(){l&&A(l)},isConnecting:W,connectionId:v,connectorName:g?.name??null,isEmbeddedWallet:g?.id==="inApp",wallet:a,profiles:m,DebugConnectButton(){return re(X,{...u,connectModal:{size:"compact"},onConnect:r=>p(r)})}}}import{jsx as k}from"react/jsx-runtime";function C(){let e=se(O);if(!e)throw new Error("BeraWagmiContext not found");return e}var O=ae(void 0);function Se({children:e,config:n,flags:{disableEip5792:o,disable5792Upgrade:t,accountOverride:d}={},theme:h,onSmartAccountRejection:w,chains:l=[],defaultChain:a,thirdweb:A,publicJsonRpcUrl:g}){let{wallet:m,openConnectModal:f,connect:u,DebugConnectButton:p,connectionId:W,disconnect:v,connectorName:P,isEmbeddedWallet:r,profiles:i,isConnecting:s}=L({config:n,theme:h,chains:l,chain:a,publicJsonRpcUrl:g}),{address:y,chainId:B}=le(),{disconnect:S}=ue(),_=pe(),c=T(()=>{if(!(!y||!m))return d??y},[d,y,m]),{data:b}=D({config:n.wagmi,chainId:a.id,address:c}),{data:x}=ce(c?["BeraWagmiProvider_code",c,B]:null,([F,G,we])=>_?.getCode({address:G}),{refreshInterval:6e4}),[q,J]=T(()=>x?x.startsWith("0xef01")?[!1,!0]:[!0,!1]:[!1,!1],[x]),{data:U}=me(),K=T(()=>{try{return b?de(b):void 0}catch{}},[b]),j=z({name:K});return k(O.Provider,{value:{flags:{disableEip5792:!!o,disable5792Upgrade:!!t},walletClient:U,onSmartAccountRejection:()=>{w?.()},isEmbeddedWalletsEnabled:A.embeddedWallets??!0,isConnecting:s,isConnected:!!c&&!!U,DebugConnectButton:p,account:m&&B&&c?{connectionId:W,chainId:B,connectorName:P,isEmbeddedWallet:r,profiles:i,wallet:{address:c,ensName:b?.replace(".bera",".\u{1F43B}\u26D3\uFE0F")??null,ensAvatar:j.data??null,has7702Authorization:J,isContract:q}}:void 0,connect:u,openConnectModal:async()=>{await f()},disconnect:()=>{S(),v()},defaultChainId:a.id},children:k(N,{address:c,defaultChainId:a.id,children:e})})}function fe(){let{account:e,isConnected:n}=C();return{...e,isConnected:n}}import{useMemo as Ce}from"react";import{useCapabilities as ge}from"wagmi";function be({chainId:e}){let{flags:n,account:o}=C(),{data:t}=ge({account:o?.wallet?.address,scopeKey:o?.connectionId,query:{retry:3},chainId:e});return{supportsAtomic:Ce(()=>n.disableEip5792||!t?!1:t?.atomic?.status==="supported"||!n.disable5792Upgrade&&t?.atomic?.status==="ready",[t,n.disableEip5792,n.disable5792Upgrade,e]),capabilities:t}}function Xe(e){let{defaultChainId:n}=E(),{chainId:o,...t}=e??{};return he({chainId:o??n,...t})}export{E as a,fe as b,be as c,Xe as d,$e as e,et as f,tt as g,z as h,D as i,nt as j,ot as k,C as l,Se as m};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _wagmi = require('wagmi');var _react = require('react');var _jsxruntime = require('react/jsx-runtime');var I=_react.createContext.call(void 0, void 0);function N({children:e,address:n,defaultChainId:o}){return _jsxruntime.jsx.call(void 0, I.Provider,{value:{address:n,defaultChainId:o},children:e})}function E(){let e=_react.useContext.call(void 0, I);if(!e)throw new Error("LightweightAccountContext not found");let{address:n,defaultChainId:o}=e;return{isConnected:!!n,address:n,defaultChainId:o}}var _immutable = require('swr/immutable'); var _immutable2 = _interopRequireDefault(_immutable);var _ens = require('viem/ens');var _thirdweb = require('thirdweb');var _react3 = require('thirdweb/react');function L({config:e,theme:n,chains:o=[],chain:t,publicJsonRpcUrl:d=t.rpcUrls.default.http[0]}){let{connectors:h,connect:w}=_wagmi.useConnect.call(void 0, ),l=_react3.useActiveWallet.call(void 0, ),a=_react3.useActiveAccount.call(void 0, ),{disconnect:A}=_react3.useDisconnect.call(void 0, ),{data:g}=_react3.useWalletInfo.call(void 0, _optionalChain([l, 'optionalAccess', _2 => _2.id])),{data:m}=_react3.useProfiles.call(void 0, {client:e.client}),f=_react.useMemo.call(void 0, ()=>_thirdweb.defineChain.call(void 0, {id:t.id,blockExplorers:t.blockExplorers,blockTime:t.blockTime,ensTlds:t.ensTlds,testnet:t.testnet,contracts:t.contracts,nativeCurrency:t.nativeCurrency,name:t.name,rpcUrls:{default:{http:[d]}}}),[d,t]),u={client:e.client,chain:f,wallets:e.wallets};async function p(r){let i=h.find(s=>s.id==="in-app-wallet");if(i){let s={withCapabilities:!0,wallet:r};w({connector:i,chainId:t.id,...s})}else console.error("no tw connector found")}let{isLoading:W}=_react3.useAutoConnect.call(void 0, {...u,onConnect:p}),v=_react.useMemo.call(void 0, ()=>crypto.randomUUID(),[_optionalChain([l, 'optionalAccess', _3 => _3.id]),_optionalChain([a, 'optionalAccess', _4 => _4.address])]),{connect:P}=_react3.useConnectModal.call(void 0, );return{async connect({strategy:r}){if(!e.hasEmbeddedWallets){console.error("useBeraWagmi.connect: this function is not available if embedded wallets are disabled");return}let i=e.wallets.find(s=>s.id==="inApp");if(!i){console.error("useBeraWagmi.connect: no inApp wallet found");return}await i.connect({...u,strategy:r}),await p(i)},async openConnectModal(){let r=await P({...u,wallets:e.wallets,theme:n==="auto"?void 0:n,size:"compact",chains:[f,...o.filter(i=>i.id!==f.id).map(i=>_thirdweb.defineChain.call(void 0, {id:i.id}))]});await p(r)},disconnect(){l&&A(l)},isConnecting:W,connectionId:v,connectorName:_nullishCoalesce(_optionalChain([g, 'optionalAccess', _5 => _5.name]), () => (null)),isEmbeddedWallet:_optionalChain([g, 'optionalAccess', _6 => _6.id])==="inApp",wallet:a,profiles:m,DebugConnectButton(){return _jsxruntime.jsx.call(void 0, _react3.ConnectButton,{...u,connectModal:{size:"compact"},onConnect:r=>p(r)})}}}function C(){let e=_react.useContext.call(void 0, O);if(!e)throw new Error("BeraWagmiContext not found");return e}var O=_react.createContext.call(void 0, void 0);function Se({children:e,config:n,flags:{disableEip5792:o,disable5792Upgrade:t,accountOverride:d}={},theme:h,onSmartAccountRejection:w,chains:l=[],defaultChain:a,thirdweb:A,publicJsonRpcUrl:g}){let{wallet:m,openConnectModal:f,connect:u,DebugConnectButton:p,connectionId:W,disconnect:v,connectorName:P,isEmbeddedWallet:r,profiles:i,isConnecting:s}=L({config:n,theme:h,chains:l,chain:a,publicJsonRpcUrl:g}),{address:y,chainId:B}=_wagmi.useAccount.call(void 0, ),{disconnect:S}=_wagmi.useDisconnect.call(void 0, ),_=_wagmi.usePublicClient.call(void 0, ),c=_react.useMemo.call(void 0, ()=>{if(!(!y||!m))return _nullishCoalesce(d, () => (y))},[d,y,m]),{data:b}=_wagmi.useEnsName.call(void 0, {config:n.wagmi,chainId:a.id,address:c}),{data:x}=_immutable2.default.call(void 0, c?["BeraWagmiProvider_code",c,B]:null,([F,G,we])=>_optionalChain([_, 'optionalAccess', _7 => _7.getCode, 'call', _8 => _8({address:G})]),{refreshInterval:6e4}),[q,J]=_react.useMemo.call(void 0, ()=>x?x.startsWith("0xef01")?[!1,!0]:[!0,!1]:[!1,!1],[x]),{data:U}=_wagmi.useWalletClient.call(void 0, ),K=_react.useMemo.call(void 0, ()=>{try{return b?_ens.normalize.call(void 0, b):void 0}catch (e2){}},[b]),j=_wagmi.useEnsAvatar.call(void 0, {name:K});return _jsxruntime.jsx.call(void 0, O.Provider,{value:{flags:{disableEip5792:!!o,disable5792Upgrade:!!t},walletClient:U,onSmartAccountRejection:()=>{_optionalChain([w, 'optionalCall', _9 => _9()])},isEmbeddedWalletsEnabled:_nullishCoalesce(A.embeddedWallets, () => (!0)),isConnecting:s,isConnected:!!c&&!!U,DebugConnectButton:p,account:m&&B&&c?{connectionId:W,chainId:B,connectorName:P,isEmbeddedWallet:r,profiles:i,wallet:{address:c,ensName:_nullishCoalesce(_optionalChain([b, 'optionalAccess', _10 => _10.replace, 'call', _11 => _11(".bera",".\u{1F43B}\u26D3\uFE0F")]), () => (null)),ensAvatar:_nullishCoalesce(j.data, () => (null)),has7702Authorization:J,isContract:q}}:void 0,connect:u,openConnectModal:async()=>{await f()},disconnect:()=>{S(),v()},defaultChainId:a.id},children:_jsxruntime.jsx.call(void 0, N,{address:c,defaultChainId:a.id,children:e})})}function fe(){let{account:e,isConnected:n}=C();return{...e,isConnected:n}}function be({chainId:e}){let{flags:n,account:o}=C(),{data:t}=_wagmi.useCapabilities.call(void 0, {account:_optionalChain([o, 'optionalAccess', _12 => _12.wallet, 'optionalAccess', _13 => _13.address]),scopeKey:_optionalChain([o, 'optionalAccess', _14 => _14.connectionId]),query:{retry:3},chainId:e});return{supportsAtomic:_react.useMemo.call(void 0, ()=>n.disableEip5792||!t?!1:_optionalChain([t, 'optionalAccess', _15 => _15.atomic, 'optionalAccess', _16 => _16.status])==="supported"||!n.disable5792Upgrade&&_optionalChain([t, 'optionalAccess', _17 => _17.atomic, 'optionalAccess', _18 => _18.status])==="ready",[t,n.disableEip5792,n.disable5792Upgrade,e]),capabilities:t}}function Xe(e){let{defaultChainId:n}=E(),{chainId:o,...t}=_nullishCoalesce(e, () => ({}));return _wagmi.usePublicClient.call(void 0, {chainId:_nullishCoalesce(o, () => (n)),...t})}exports.a = E; exports.b = fe; exports.c = be; exports.d = Xe; exports.e = _wagmi.useBlockNumber; exports.f = _wagmi.useChains; exports.g = _wagmi.useConfig; exports.h = _wagmi.useEnsAvatar; exports.i = _wagmi.useEnsName; exports.j = _wagmi.useSwitchChain; exports.k = _wagmi.useTransactionReceipt; exports.l = C; exports.m = Se;
|
package/dist/context/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";var _chunkHDH4V7DJcjs = require('../chunk-HDH4V7DJ.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";var _chunkHDH4V7DJcjs = require('../chunk-HDH4V7DJ.cjs');var _chunkZCJIFG7Wcjs = require('../chunk-ZCJIFG7W.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 u=new _reactquery.QueryClient;function B({transports:t,defaultChain:e,chains:i,thirdweb:o,...f}){let n=_react.useMemo.call(void 0, ()=>_chunkHDH4V7DJcjs.a.call(void 0, {thirdweb:o,transports:t,defaultChain:e,chains:i}),[e,o,t,i]);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:u,children:_jsxruntime.jsx.call(void 0, _chunkZCJIFG7Wcjs.m,{...f,thirdweb:o,chains:i,defaultChain:e,config:n})})})})}exports.WagmiProvider = B;
|
package/dist/context/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { Transport, Chain } from 'viem';
|
|
3
|
-
import { I as IBeraWagmiProviderProps } from '../BeraWagmi-
|
|
3
|
+
import { I as IBeraWagmiProviderProps } from '../BeraWagmi-Bcm59a7m.cjs';
|
|
4
4
|
import 'react';
|
|
5
5
|
import 'thirdweb/wallets';
|
|
6
6
|
import 'wagmi';
|
|
@@ -10,7 +10,6 @@ import 'thirdweb';
|
|
|
10
10
|
type WagmiProviderProps = Omit<IBeraWagmiProviderProps, "config" | "defaultChain"> & {
|
|
11
11
|
transports?: Record<number, Transport>;
|
|
12
12
|
defaultChain: Chain;
|
|
13
|
-
chains?: Chain[];
|
|
14
13
|
};
|
|
15
14
|
declare function WagmiProvider({ transports, defaultChain, chains, thirdweb, ...beraWagmiProps }: WagmiProviderProps): react_jsx_runtime.JSX.Element;
|
|
16
15
|
|
package/dist/context/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { Transport, Chain } from 'viem';
|
|
3
|
-
import { I as IBeraWagmiProviderProps } from '../BeraWagmi-
|
|
3
|
+
import { I as IBeraWagmiProviderProps } from '../BeraWagmi-4q0Ls6Dc.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
import 'thirdweb/wallets';
|
|
6
6
|
import 'wagmi';
|
|
@@ -10,7 +10,6 @@ import 'thirdweb';
|
|
|
10
10
|
type WagmiProviderProps = Omit<IBeraWagmiProviderProps, "config" | "defaultChain"> & {
|
|
11
11
|
transports?: Record<number, Transport>;
|
|
12
12
|
defaultChain: Chain;
|
|
13
|
-
chains?: Chain[];
|
|
14
13
|
};
|
|
15
14
|
declare function WagmiProvider({ transports, defaultChain, chains, thirdweb, ...beraWagmiProps }: WagmiProviderProps): react_jsx_runtime.JSX.Element;
|
|
16
15
|
|
package/dist/context/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{a as m}from"../chunk-YD5OWUSZ.mjs";import{m as a}from"../chunk-
|
|
1
|
+
"use client";import{a as m}from"../chunk-YD5OWUSZ.mjs";import{m as a}from"../chunk-PPRCI25K.mjs";import{useMemo as p}from"react";import{QueryClient as d,QueryClientProvider as g}from"@tanstack/react-query";import{ThirdwebProvider as P}from"thirdweb/react";import{WagmiProvider as s}from"wagmi";import{jsx as r}from"react/jsx-runtime";var u=new d;function B({transports:t,defaultChain:e,chains:i,thirdweb:o,...f}){let n=p(()=>m({thirdweb:o,transports:t,defaultChain:e,chains:i}),[e,o,t,i]);return r(P,{children:r(s,{config:n.wagmi,reconnectOnMount:!1,children:r(g,{client:u,children:r(a,{...f,thirdweb:o,chains:i,defaultChain:e,config:n})})})})}export{B as WagmiProvider};
|
package/dist/hooks/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZCJIFG7Wcjs = require('../chunk-ZCJIFG7W.cjs');exports.useBeraAccount = _chunkZCJIFG7Wcjs.b; exports.useBeraWagmi = _chunkZCJIFG7Wcjs.l; exports.useBeraWallet = _chunkZCJIFG7Wcjs.a; exports.useBlockNumber = _chunkZCJIFG7Wcjs.e; exports.useCapabilities = _chunkZCJIFG7Wcjs.c; exports.useChains = _chunkZCJIFG7Wcjs.f; exports.useConfig = _chunkZCJIFG7Wcjs.g; exports.useEnsAvatar = _chunkZCJIFG7Wcjs.h; exports.useEnsName = _chunkZCJIFG7Wcjs.i; exports.usePublicClient = _chunkZCJIFG7Wcjs.d; exports.useSwitchChain = _chunkZCJIFG7Wcjs.j; exports.useTransactionReceipt = _chunkZCJIFG7Wcjs.k;
|
package/dist/hooks/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UsePublicClientParameters, UsePublicClientReturnType } from 'wagmi';
|
|
2
2
|
export { useBlockNumber, useChains, useConfig, useEnsAvatar, useEnsName, useSwitchChain, useTransactionReceipt } from 'wagmi';
|
|
3
|
-
import { B as BeraWagmiApi, C as ChainId } from '../BeraWagmi-
|
|
4
|
-
export { u as useBeraWagmi } from '../BeraWagmi-
|
|
3
|
+
import { B as BeraWagmiApi, C as ChainId } from '../BeraWagmi-Bcm59a7m.cjs';
|
|
4
|
+
export { u as useBeraWagmi } from '../BeraWagmi-Bcm59a7m.cjs';
|
|
5
5
|
import 'react';
|
|
6
6
|
import 'thirdweb/wallets';
|
|
7
7
|
import 'viem';
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UsePublicClientParameters, UsePublicClientReturnType } from 'wagmi';
|
|
2
2
|
export { useBlockNumber, useChains, useConfig, useEnsAvatar, useEnsName, useSwitchChain, useTransactionReceipt } from 'wagmi';
|
|
3
|
-
import { B as BeraWagmiApi, C as ChainId } from '../BeraWagmi-
|
|
4
|
-
export { u as useBeraWagmi } from '../BeraWagmi-
|
|
3
|
+
import { B as BeraWagmiApi, C as ChainId } from '../BeraWagmi-4q0Ls6Dc.js';
|
|
4
|
+
export { u as useBeraWagmi } from '../BeraWagmi-4q0Ls6Dc.js';
|
|
5
5
|
import 'react';
|
|
6
6
|
import 'thirdweb/wallets';
|
|
7
7
|
import 'viem';
|
package/dist/hooks/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l}from"../chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l}from"../chunk-PPRCI25K.mjs";export{b as useBeraAccount,l as useBeraWagmi,a as useBeraWallet,e as useBlockNumber,c as useCapabilities,f as useChains,g as useConfig,h as useEnsAvatar,i as useEnsName,d as usePublicClient,j as useSwitchChain,k as useTransactionReceipt};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _react = require('thirdweb/react');exports.useActiveAccount = _react.useActiveAccount; exports.useActiveWallet = _react.useActiveWallet; exports.
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _react = require('thirdweb/react');exports.useActiveAccount = _react.useActiveAccount; exports.useActiveWallet = _react.useActiveWallet; exports.useWalletInfo = _react.useWalletInfo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useActiveAccount, useActiveWallet,
|
|
1
|
+
export { useActiveAccount, useActiveWallet, useWalletInfo } from 'thirdweb/react';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useActiveAccount, useActiveWallet,
|
|
1
|
+
export { useActiveAccount, useActiveWallet, useWalletInfo } from 'thirdweb/react';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useActiveAccount as
|
|
1
|
+
import{useActiveAccount as c,useActiveWallet as l,useWalletInfo as o}from"thirdweb/react";export{c as useActiveAccount,l as useActiveWallet,o as useWalletInfo};
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@berachain/wagmi",
|
|
3
|
-
"version": "0.4.0-beta.
|
|
3
|
+
"version": "0.4.0-beta.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
7
7
|
"src"
|
|
8
8
|
],
|
|
9
|
+
"sideEffects": false,
|
|
9
10
|
"types": "./dist/index.d.ts",
|
|
10
11
|
"module": "./dist/index.mjs",
|
|
11
12
|
"main": "./dist/index.cjs",
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
useMemo,
|
|
6
6
|
} from "react";
|
|
7
7
|
import useSWRImmutable from "swr/immutable";
|
|
8
|
-
import type { WalletConnectionOption } from "thirdweb/wallets";
|
|
8
|
+
import type { Profile, WalletConnectionOption } from "thirdweb/wallets";
|
|
9
9
|
import type { Address, Chain } from "viem";
|
|
10
10
|
import { normalize } from "viem/ens";
|
|
11
11
|
import {
|
|
@@ -48,6 +48,7 @@ export interface BeraWagmiApi {
|
|
|
48
48
|
isEmbeddedWallet: boolean;
|
|
49
49
|
connectorName: string | null;
|
|
50
50
|
connectionId: string;
|
|
51
|
+
profiles: Profile[] | undefined;
|
|
51
52
|
/**
|
|
52
53
|
* Wallet to display.
|
|
53
54
|
*
|
|
@@ -64,7 +65,6 @@ export interface BeraWagmiApi {
|
|
|
64
65
|
* ENS avatar of the wallet.
|
|
65
66
|
*/
|
|
66
67
|
ensAvatar: string | null;
|
|
67
|
-
|
|
68
68
|
/**
|
|
69
69
|
* Whether the wallet has 7702 authorization.
|
|
70
70
|
*/
|
|
@@ -99,10 +99,7 @@ export interface BeraWagmiApi {
|
|
|
99
99
|
* This is used to disable EIP-5792 temporarily.
|
|
100
100
|
*/
|
|
101
101
|
onSmartAccountRejection(): void;
|
|
102
|
-
|
|
103
|
-
* List of external chains that are whitelisted for that app.
|
|
104
|
-
*/
|
|
105
|
-
chains: Chain[];
|
|
102
|
+
|
|
106
103
|
defaultChainId: ChainId;
|
|
107
104
|
}
|
|
108
105
|
|
|
@@ -149,7 +146,7 @@ export function BeraWagmiProvider({
|
|
|
149
146
|
flags: { disableEip5792, disable5792Upgrade, accountOverride } = {},
|
|
150
147
|
theme,
|
|
151
148
|
onSmartAccountRejection,
|
|
152
|
-
chains,
|
|
149
|
+
chains = [],
|
|
153
150
|
defaultChain,
|
|
154
151
|
thirdweb,
|
|
155
152
|
publicJsonRpcUrl,
|
|
@@ -163,6 +160,7 @@ export function BeraWagmiProvider({
|
|
|
163
160
|
disconnect: disconnectProvider,
|
|
164
161
|
connectorName,
|
|
165
162
|
isEmbeddedWallet,
|
|
163
|
+
profiles,
|
|
166
164
|
isConnecting,
|
|
167
165
|
} = useThirdweb({
|
|
168
166
|
config,
|
|
@@ -259,6 +257,7 @@ export function BeraWagmiProvider({
|
|
|
259
257
|
chainId,
|
|
260
258
|
connectorName,
|
|
261
259
|
isEmbeddedWallet,
|
|
260
|
+
profiles,
|
|
262
261
|
wallet: {
|
|
263
262
|
address,
|
|
264
263
|
ensName: ens?.replace(".bera", ".🐻⛓️") ?? null,
|
|
@@ -270,14 +269,13 @@ export function BeraWagmiProvider({
|
|
|
270
269
|
: undefined,
|
|
271
270
|
connect,
|
|
272
271
|
openConnectModal: async () => {
|
|
273
|
-
console.log("openConnectModal.called");
|
|
274
272
|
await openConnectModal();
|
|
275
273
|
},
|
|
276
274
|
disconnect: () => {
|
|
277
275
|
disconnectWagmi();
|
|
278
276
|
disconnectProvider();
|
|
279
277
|
},
|
|
280
|
-
chains,
|
|
278
|
+
// chains,
|
|
281
279
|
defaultChainId: defaultChain.id,
|
|
282
280
|
}}
|
|
283
281
|
>
|
|
@@ -6,11 +6,17 @@ import {
|
|
|
6
6
|
useActiveAccount,
|
|
7
7
|
useActiveWallet,
|
|
8
8
|
useAutoConnect,
|
|
9
|
+
useProfiles,
|
|
9
10
|
useConnectModal as useTwConnectModal,
|
|
10
11
|
useDisconnect as useTwDisconnect,
|
|
11
12
|
useWalletInfo,
|
|
12
13
|
} from "thirdweb/react";
|
|
13
|
-
import type {
|
|
14
|
+
import type {
|
|
15
|
+
Account,
|
|
16
|
+
AutoConnectProps,
|
|
17
|
+
Profile,
|
|
18
|
+
Wallet,
|
|
19
|
+
} from "thirdweb/wallets";
|
|
14
20
|
import type { Chain } from "viem";
|
|
15
21
|
import { useConnect } from "wagmi";
|
|
16
22
|
|
|
@@ -20,13 +26,13 @@ import type { BeraWagmiApi } from "./BeraWagmi";
|
|
|
20
26
|
export function useThirdweb({
|
|
21
27
|
config,
|
|
22
28
|
theme,
|
|
23
|
-
chains,
|
|
29
|
+
chains = [],
|
|
24
30
|
chain,
|
|
25
31
|
publicJsonRpcUrl = chain.rpcUrls.default.http[0],
|
|
26
32
|
}: {
|
|
27
33
|
config: ReturnType<typeof getConfig>;
|
|
28
34
|
theme: "light" | "dark" | "auto" | undefined;
|
|
29
|
-
chains
|
|
35
|
+
chains?: Chain[];
|
|
30
36
|
publicJsonRpcUrl?: string;
|
|
31
37
|
chain: Chain;
|
|
32
38
|
}): Pick<
|
|
@@ -41,6 +47,7 @@ export function useThirdweb({
|
|
|
41
47
|
connectorName: string | null;
|
|
42
48
|
isEmbeddedWallet: boolean;
|
|
43
49
|
wallet: Account | undefined;
|
|
50
|
+
profiles: Profile[] | undefined;
|
|
44
51
|
} {
|
|
45
52
|
const { connectors, connect: wagmiConnect } = useConnect();
|
|
46
53
|
|
|
@@ -49,6 +56,8 @@ export function useThirdweb({
|
|
|
49
56
|
const { disconnect: disconnectThirdweb } = useTwDisconnect();
|
|
50
57
|
const { data: walletInfo } = useWalletInfo(activeWallet?.id);
|
|
51
58
|
|
|
59
|
+
const { data: profiles } = useProfiles({ client: config.client });
|
|
60
|
+
|
|
52
61
|
const thirdwebChain = useMemo(
|
|
53
62
|
() =>
|
|
54
63
|
defineChain({
|
|
@@ -139,11 +148,14 @@ export function useThirdweb({
|
|
|
139
148
|
size: "compact",
|
|
140
149
|
chains: [
|
|
141
150
|
thirdwebChain,
|
|
142
|
-
...chains
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
151
|
+
...chains
|
|
152
|
+
// avoid duplicates
|
|
153
|
+
.filter((c) => c.id !== thirdwebChain.id)
|
|
154
|
+
.map((c) =>
|
|
155
|
+
defineChain({
|
|
156
|
+
id: c.id,
|
|
157
|
+
}),
|
|
158
|
+
),
|
|
147
159
|
],
|
|
148
160
|
}); // opens the connect modal
|
|
149
161
|
|
|
@@ -159,6 +171,7 @@ export function useThirdweb({
|
|
|
159
171
|
connectorName: walletInfo?.name ?? null,
|
|
160
172
|
isEmbeddedWallet: walletInfo?.id === "inApp",
|
|
161
173
|
wallet: activeAccount,
|
|
174
|
+
profiles,
|
|
162
175
|
DebugConnectButton() {
|
|
163
176
|
return (
|
|
164
177
|
<ConnectButton
|
package/dist/chunk-2DC2R4UF.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{usePublicClient as ge}from"wagmi";import{useContext as Q}from"react";import{createContext as G}from"react";import{jsx as H}from"react/jsx-runtime";var x=G(void 0);function U({children:e,address:n,defaultChainId:o}){return H(x.Provider,{value:{address:n,defaultChainId:o},children:e})}function I(){let e=Q(x);if(!e)throw new Error("LightweightAccountContext not found");let{address:n,defaultChainId:o}=e;return{isConnected:!!n,address:n,defaultChainId:o}}import{useBlockNumber as Ye,useChains as Ze,useConfig as $e,useEnsAvatar as k,useEnsName as z,useSwitchChain as et,useTransactionReceipt as tt}from"wagmi";import{createContext as ie,useContext as ae,useMemo as E}from"react";import re from"swr/immutable";import{normalize as se}from"viem/ens";import{useAccount as ce,useDisconnect as de,usePublicClient as le,useWalletClient as ue}from"wagmi";import{useMemo as M}from"react";import{defineChain as N}from"thirdweb";import{ConnectButton as V,useActiveAccount as X,useActiveWallet as Y,useAutoConnect as Z,useConnectModal as $,useDisconnect as ee,useWalletInfo as te}from"thirdweb/react";import{useConnect as ne}from"wagmi";import{jsx as oe}from"react/jsx-runtime";function R({config:e,theme:n,chains:o,chain:t,publicJsonRpcUrl:l=t.rpcUrls.default.http[0]}){let{connectors:h,connect:b}=ne(),r=Y(),s=X(),{disconnect:w}=ee(),{data:C}=te(r?.id),u=M(()=>N({id:t.id,blockExplorers:t.blockExplorers,blockTime:t.blockTime,ensTlds:t.ensTlds,testnet:t.testnet,contracts:t.contracts,nativeCurrency:t.nativeCurrency,name:t.name,rpcUrls:{default:{http:[l]}}}),[l,t]),p={client:e.client,chain:u,wallets:e.wallets};async function m(a){let i=h.find(c=>c.id==="in-app-wallet");if(i){let c={withCapabilities:!0,wallet:a};b({connector:i,chainId:t.id,...c})}else console.error("no tw connector found")}let{isLoading:A}=Z({...p,onConnect:m}),W=M(()=>crypto.randomUUID(),[r?.id,s?.address]),{connect:v}=$();return{async connect({strategy:a}){if(!e.hasEmbeddedWallets){console.error("useBeraWagmi.connect: this function is not available if embedded wallets are disabled");return}let i=e.wallets.find(c=>c.id==="inApp");if(!i){console.error("useBeraWagmi.connect: no inApp wallet found");return}await i.connect({...p,strategy:a}),await m(i)},async openConnectModal(){let a=await v({...p,wallets:e.wallets,theme:n==="auto"?void 0:n,size:"compact",chains:[u,...o.map(i=>N({id:i.id}))]});await m(a)},disconnect(){r&&w(r)},isConnecting:A,connectionId:W,connectorName:C?.name??null,isEmbeddedWallet:C?.id==="inApp",wallet:s,DebugConnectButton(){return oe(V,{...p,connectModal:{size:"compact"},onConnect:a=>m(a)})}}}import{jsx as L}from"react/jsx-runtime";function f(){let e=ae(D);if(!e)throw new Error("BeraWagmiContext not found");return e}var D=ie(void 0);function De({children:e,config:n,flags:{disableEip5792:o,disable5792Upgrade:t,accountOverride:l}={},theme:h,onSmartAccountRejection:b,chains:r,defaultChain:s,thirdweb:w,publicJsonRpcUrl:C}){let{wallet:u,openConnectModal:p,connect:m,DebugConnectButton:A,connectionId:W,disconnect:v,connectorName:a,isEmbeddedWallet:i,isConnecting:c}=R({config:n,theme:h,chains:r,chain:s,publicJsonRpcUrl:C}),{address:y,chainId:P}=ce(),{disconnect:O}=de(),S=le(),d=E(()=>{if(!(!y||!u))return l??y},[l,y,u]),{data:g}=z({config:n.wagmi,chainId:s.id,address:d}),{data:B}=re(d?["BeraWagmiProvider_code",d,P]:null,([j,F,he])=>S?.getCode({address:F}),{refreshInterval:6e4}),[_,q]=E(()=>B?B.startsWith("0xef01")?[!1,!0]:[!0,!1]:[!1,!1],[B]),{data:T}=ue(),J=E(()=>{try{return g?se(g):void 0}catch{}},[g]),K=k({name:J});return L(D.Provider,{value:{flags:{disableEip5792:!!o,disable5792Upgrade:!!t},walletClient:T,onSmartAccountRejection:()=>{b?.()},isEmbeddedWalletsEnabled:w.embeddedWallets??!0,isConnecting:c,isConnected:!!d&&!!T,DebugConnectButton:A,account:u&&P&&d?{connectionId:W,chainId:P,connectorName:a,isEmbeddedWallet:i,wallet:{address:d,ensName:g?.replace(".bera",".\u{1F43B}\u26D3\uFE0F")??null,ensAvatar:K.data??null,has7702Authorization:q,isContract:_}}:void 0,connect:m,openConnectModal:async()=>{console.log("openConnectModal.called"),await p()},disconnect:()=>{O(),v()},chains:r,defaultChainId:s.id},children:L(U,{address:d,defaultChainId:s.id,children:e})})}function pe(){let{account:e,isConnected:n}=f();return{...e,isConnected:n}}import{useMemo as me}from"react";import{useCapabilities as fe}from"wagmi";function Ce({chainId:e}){let{flags:n,account:o}=f(),{data:t}=fe({account:o?.wallet?.address,scopeKey:o?.connectionId,query:{retry:3},chainId:e});return{supportsAtomic:me(()=>n.disableEip5792||!t?!1:t?.atomic?.status==="supported"||!n.disable5792Upgrade&&t?.atomic?.status==="ready",[t,n.disableEip5792,n.disable5792Upgrade,e]),capabilities:t}}function Qe(e){let{defaultChainId:n}=I(),{chainId:o,...t}=e??{};return ge({chainId:o??n,...t})}export{I as a,pe as b,Ce as c,Qe as d,Ye as e,Ze as f,$e as g,k as h,z as i,et as j,tt as k,f as l,De as m};
|
package/dist/chunk-52QNT47H.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _wagmi = require('wagmi');var _react = require('react');var _jsxruntime = require('react/jsx-runtime');var x=_react.createContext.call(void 0, void 0);function U({children:e,address:n,defaultChainId:o}){return _jsxruntime.jsx.call(void 0, x.Provider,{value:{address:n,defaultChainId:o},children:e})}function I(){let e=_react.useContext.call(void 0, x);if(!e)throw new Error("LightweightAccountContext not found");let{address:n,defaultChainId:o}=e;return{isConnected:!!n,address:n,defaultChainId:o}}var _immutable = require('swr/immutable'); var _immutable2 = _interopRequireDefault(_immutable);var _ens = require('viem/ens');var _thirdweb = require('thirdweb');var _react3 = require('thirdweb/react');function R({config:e,theme:n,chains:o,chain:t,publicJsonRpcUrl:l=t.rpcUrls.default.http[0]}){let{connectors:h,connect:b}=_wagmi.useConnect.call(void 0, ),r=_react3.useActiveWallet.call(void 0, ),s=_react3.useActiveAccount.call(void 0, ),{disconnect:w}=_react3.useDisconnect.call(void 0, ),{data:C}=_react3.useWalletInfo.call(void 0, _optionalChain([r, 'optionalAccess', _2 => _2.id])),u=_react.useMemo.call(void 0, ()=>_thirdweb.defineChain.call(void 0, {id:t.id,blockExplorers:t.blockExplorers,blockTime:t.blockTime,ensTlds:t.ensTlds,testnet:t.testnet,contracts:t.contracts,nativeCurrency:t.nativeCurrency,name:t.name,rpcUrls:{default:{http:[l]}}}),[l,t]),p={client:e.client,chain:u,wallets:e.wallets};async function m(a){let i=h.find(c=>c.id==="in-app-wallet");if(i){let c={withCapabilities:!0,wallet:a};b({connector:i,chainId:t.id,...c})}else console.error("no tw connector found")}let{isLoading:A}=_react3.useAutoConnect.call(void 0, {...p,onConnect:m}),W=_react.useMemo.call(void 0, ()=>crypto.randomUUID(),[_optionalChain([r, 'optionalAccess', _3 => _3.id]),_optionalChain([s, 'optionalAccess', _4 => _4.address])]),{connect:v}=_react3.useConnectModal.call(void 0, );return{async connect({strategy:a}){if(!e.hasEmbeddedWallets){console.error("useBeraWagmi.connect: this function is not available if embedded wallets are disabled");return}let i=e.wallets.find(c=>c.id==="inApp");if(!i){console.error("useBeraWagmi.connect: no inApp wallet found");return}await i.connect({...p,strategy:a}),await m(i)},async openConnectModal(){let a=await v({...p,wallets:e.wallets,theme:n==="auto"?void 0:n,size:"compact",chains:[u,...o.map(i=>_thirdweb.defineChain.call(void 0, {id:i.id}))]});await m(a)},disconnect(){r&&w(r)},isConnecting:A,connectionId:W,connectorName:_nullishCoalesce(_optionalChain([C, 'optionalAccess', _5 => _5.name]), () => (null)),isEmbeddedWallet:_optionalChain([C, 'optionalAccess', _6 => _6.id])==="inApp",wallet:s,DebugConnectButton(){return _jsxruntime.jsx.call(void 0, _react3.ConnectButton,{...p,connectModal:{size:"compact"},onConnect:a=>m(a)})}}}function f(){let e=_react.useContext.call(void 0, D);if(!e)throw new Error("BeraWagmiContext not found");return e}var D=_react.createContext.call(void 0, void 0);function De({children:e,config:n,flags:{disableEip5792:o,disable5792Upgrade:t,accountOverride:l}={},theme:h,onSmartAccountRejection:b,chains:r,defaultChain:s,thirdweb:w,publicJsonRpcUrl:C}){let{wallet:u,openConnectModal:p,connect:m,DebugConnectButton:A,connectionId:W,disconnect:v,connectorName:a,isEmbeddedWallet:i,isConnecting:c}=R({config:n,theme:h,chains:r,chain:s,publicJsonRpcUrl:C}),{address:y,chainId:P}=_wagmi.useAccount.call(void 0, ),{disconnect:O}=_wagmi.useDisconnect.call(void 0, ),S=_wagmi.usePublicClient.call(void 0, ),d=_react.useMemo.call(void 0, ()=>{if(!(!y||!u))return _nullishCoalesce(l, () => (y))},[l,y,u]),{data:g}=_wagmi.useEnsName.call(void 0, {config:n.wagmi,chainId:s.id,address:d}),{data:B}=_immutable2.default.call(void 0, d?["BeraWagmiProvider_code",d,P]:null,([j,F,he])=>_optionalChain([S, 'optionalAccess', _7 => _7.getCode, 'call', _8 => _8({address:F})]),{refreshInterval:6e4}),[_,q]=_react.useMemo.call(void 0, ()=>B?B.startsWith("0xef01")?[!1,!0]:[!0,!1]:[!1,!1],[B]),{data:T}=_wagmi.useWalletClient.call(void 0, ),J=_react.useMemo.call(void 0, ()=>{try{return g?_ens.normalize.call(void 0, g):void 0}catch (e2){}},[g]),K=_wagmi.useEnsAvatar.call(void 0, {name:J});return _jsxruntime.jsx.call(void 0, D.Provider,{value:{flags:{disableEip5792:!!o,disable5792Upgrade:!!t},walletClient:T,onSmartAccountRejection:()=>{_optionalChain([b, 'optionalCall', _9 => _9()])},isEmbeddedWalletsEnabled:_nullishCoalesce(w.embeddedWallets, () => (!0)),isConnecting:c,isConnected:!!d&&!!T,DebugConnectButton:A,account:u&&P&&d?{connectionId:W,chainId:P,connectorName:a,isEmbeddedWallet:i,wallet:{address:d,ensName:_nullishCoalesce(_optionalChain([g, 'optionalAccess', _10 => _10.replace, 'call', _11 => _11(".bera",".\u{1F43B}\u26D3\uFE0F")]), () => (null)),ensAvatar:_nullishCoalesce(K.data, () => (null)),has7702Authorization:q,isContract:_}}:void 0,connect:m,openConnectModal:async()=>{console.log("openConnectModal.called"),await p()},disconnect:()=>{O(),v()},chains:r,defaultChainId:s.id},children:_jsxruntime.jsx.call(void 0, U,{address:d,defaultChainId:s.id,children:e})})}function pe(){let{account:e,isConnected:n}=f();return{...e,isConnected:n}}function Ce({chainId:e}){let{flags:n,account:o}=f(),{data:t}=_wagmi.useCapabilities.call(void 0, {account:_optionalChain([o, 'optionalAccess', _12 => _12.wallet, 'optionalAccess', _13 => _13.address]),scopeKey:_optionalChain([o, 'optionalAccess', _14 => _14.connectionId]),query:{retry:3},chainId:e});return{supportsAtomic:_react.useMemo.call(void 0, ()=>n.disableEip5792||!t?!1:_optionalChain([t, 'optionalAccess', _15 => _15.atomic, 'optionalAccess', _16 => _16.status])==="supported"||!n.disable5792Upgrade&&_optionalChain([t, 'optionalAccess', _17 => _17.atomic, 'optionalAccess', _18 => _18.status])==="ready",[t,n.disableEip5792,n.disable5792Upgrade,e]),capabilities:t}}function Qe(e){let{defaultChainId:n}=I(),{chainId:o,...t}=_nullishCoalesce(e, () => ({}));return _wagmi.usePublicClient.call(void 0, {chainId:_nullishCoalesce(o, () => (n)),...t})}exports.a = I; exports.b = pe; exports.c = Ce; exports.d = Qe; exports.e = _wagmi.useBlockNumber; exports.f = _wagmi.useChains; exports.g = _wagmi.useConfig; exports.h = _wagmi.useEnsAvatar; exports.i = _wagmi.useEnsName; exports.j = _wagmi.useSwitchChain; exports.k = _wagmi.useTransactionReceipt; exports.l = f; exports.m = De;
|