@berachain/wagmi 0.4.1 → 0.4.2
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-Bod8ckMU.d.ts → BeraWagmi-BYoBR8sq.d.ts} +9 -7
- package/dist/{BeraWagmi-tWJv_bhM.d.cts → BeraWagmi-D_9r9lFE.d.cts} +9 -7
- package/dist/chunk-JNXJQLQC.cjs +1 -0
- package/dist/chunk-UEV74GTG.mjs +1 -0
- package/dist/context/index.cjs +1 -1
- package/dist/context/index.d.cts +1 -1
- package/dist/context/index.d.ts +1 -1
- 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/package.json +3 -3
- package/src/context/BeraWagmi.tsx +10 -6
- package/src/context/useThirdweb.tsx +37 -26
- package/dist/chunk-4MF5YCJ5.mjs +0 -1
- package/dist/chunk-PNOS6IM4.cjs +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { SingleStepAuthArgsType, MultiStepAuthArgsType, Profile, Wallet } 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';
|
|
@@ -88,6 +88,12 @@ declare enum ChainId {
|
|
|
88
88
|
MAINNET = 80094,
|
|
89
89
|
BEPOLIA = 80069
|
|
90
90
|
}
|
|
91
|
+
type ConnectEvent = {
|
|
92
|
+
type: "connect";
|
|
93
|
+
data: SingleStepAuthArgsType | MultiStepAuthArgsType;
|
|
94
|
+
} | {
|
|
95
|
+
type: "connect_modal";
|
|
96
|
+
};
|
|
91
97
|
interface IBeraWagmiProviderProps extends PropsWithChildren {
|
|
92
98
|
config: ReturnType<typeof getConfig>;
|
|
93
99
|
theme?: "dark" | "light" | "auto";
|
|
@@ -106,12 +112,8 @@ interface IBeraWagmiProviderProps extends PropsWithChildren {
|
|
|
106
112
|
accountOverride?: Address;
|
|
107
113
|
};
|
|
108
114
|
onSmartAccountRejection?: () => void;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
*
|
|
112
|
-
* This is not triggered when a wallet connect automatically after a refresh.
|
|
113
|
-
*/
|
|
114
|
-
onConnectedWallet?: () => void;
|
|
115
|
+
onConnect?: (event: ConnectEvent) => void;
|
|
116
|
+
onConnectError?: (error: Error) => void;
|
|
115
117
|
chains?: Chain[];
|
|
116
118
|
defaultChain: Chain;
|
|
117
119
|
thirdweb: ThirdwebConfig;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { SingleStepAuthArgsType, MultiStepAuthArgsType, Profile, Wallet } 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';
|
|
@@ -88,6 +88,12 @@ declare enum ChainId {
|
|
|
88
88
|
MAINNET = 80094,
|
|
89
89
|
BEPOLIA = 80069
|
|
90
90
|
}
|
|
91
|
+
type ConnectEvent = {
|
|
92
|
+
type: "connect";
|
|
93
|
+
data: SingleStepAuthArgsType | MultiStepAuthArgsType;
|
|
94
|
+
} | {
|
|
95
|
+
type: "connect_modal";
|
|
96
|
+
};
|
|
91
97
|
interface IBeraWagmiProviderProps extends PropsWithChildren {
|
|
92
98
|
config: ReturnType<typeof getConfig>;
|
|
93
99
|
theme?: "dark" | "light" | "auto";
|
|
@@ -106,12 +112,8 @@ interface IBeraWagmiProviderProps extends PropsWithChildren {
|
|
|
106
112
|
accountOverride?: Address;
|
|
107
113
|
};
|
|
108
114
|
onSmartAccountRejection?: () => void;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
*
|
|
112
|
-
* This is not triggered when a wallet connect automatically after a refresh.
|
|
113
|
-
*/
|
|
114
|
-
onConnectedWallet?: () => void;
|
|
115
|
+
onConnect?: (event: ConnectEvent) => void;
|
|
116
|
+
onConnectError?: (error: Error) => void;
|
|
115
117
|
chains?: Chain[];
|
|
116
118
|
defaultChain: Chain;
|
|
117
119
|
thirdweb: ThirdwebConfig;
|
|
@@ -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 U=_react.createContext.call(void 0, void 0);function R({children:e,address:n,defaultChainId:r}){return _jsxruntime.jsx.call(void 0, U.Provider,{value:{address:n,defaultChainId:r},children:e})}function M(){let e=_react.useContext.call(void 0, U);if(!e)throw new Error("LightweightAccountContext not found");let{address:n,defaultChainId:r}=e;return{isConnected:!!n,address:n,defaultChainId:r}}var _immutable = require('swr/immutable'); var _immutable2 = _interopRequireDefault(_immutable);var _ens = require('viem/ens');var _thirdweb = require('thirdweb');var _react3 = require('thirdweb/react');var _inapp = require('thirdweb/wallets/in-app');function k({config:e,theme:n,chains:r=[],chain:t,onConnect:c,onConnectError:g,publicJsonRpcUrl:h=t.rpcUrls.default.http[0]}){let{connectors:y,connect:d}=_wagmi.useConnect.call(void 0, ),l=_react3.useActiveWallet.call(void 0, ),b=_react3.useActiveAccount.call(void 0, ),{disconnect:W}=_react3.useDisconnect.call(void 0, ),{data:A}=_react3.useWalletInfo.call(void 0, _optionalChain([l, 'optionalAccess', _2 => _2.id])),{connect:m}=_react3.useConnect.call(void 0, ),{data:v}=_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:[h]}}}),[h,t]),u={client:e.client,chain:f,wallets:e.wallets};async function p(o){let i=y.find(a=>a.id==="in-app-wallet");if(i){let a={withCapabilities:!0,wallet:o};d({connector:i,chainId:t.id,...a})}else console.error("no tw connector found")}let{isLoading:P}=_react3.useAutoConnect.call(void 0, {...u,onConnect:p}),E=_react.useMemo.call(void 0, ()=>"randomUUID"in crypto?crypto.randomUUID():Math.random().toString(36).substring(2,15),[_optionalChain([l, 'optionalAccess', _3 => _3.id]),_optionalChain([b, 'optionalAccess', _4 => _4.address])]),{connect:B}=_react3.useConnectModal.call(void 0, );return{connect(o){if(!e.hasEmbeddedWallets){console.error("useBeraWagmi.connect: this function is not available if embedded wallets are disabled");return}return m(async()=>{let i=e.wallets.find(a=>a.id==="inApp");if(!i)throw console.error("useBeraWagmi.connect: no inApp wallet found"),new Error("no inApp wallet found");return i.connect({...u,...o}).then(async()=>(_optionalChain([c, 'optionalCall', _5 => _5({type:"connect",data:o})]),await p(i),i)).catch(a=>{throw _optionalChain([g, 'optionalCall', _6 => _6(a)]),a})})},async openConnectModal(){try{let o=await B({...u,wallets:e.wallets,theme:n==="auto"?void 0:n,size:"compact",chains:[f,...r.filter(i=>i.id!==f.id).map(i=>_thirdweb.defineChain.call(void 0, {id:i.id}))]});_optionalChain([c, 'optionalCall', _7 => _7({type:"connect_modal"})]),await p(o)}catch(o){throw _optionalChain([g, 'optionalCall', _8 => _8(o)]),o}},disconnect(){l&&W(l)},isConnecting:P,connectionId:E,connectorName:_nullishCoalesce(_optionalChain([A, 'optionalAccess', _9 => _9.name]), () => (null)),isEmbeddedWallet:_optionalChain([A, 'optionalAccess', _10 => _10.id])==="inApp",wallet:b,profiles:v,preAuthenticate(o){return _inapp.preAuthenticate.call(void 0, {...o,client:e.client})},DebugConnectButton(){return _jsxruntime.jsx.call(void 0, _react3.ConnectButton,{...u,connectModal:{size:"compact"},onConnect:o=>p(o)})}}}function C(){let e=_react.useContext.call(void 0, q);if(!e)throw new Error("BeraWagmiContext not found");return e}var q=_react.createContext.call(void 0, void 0);function Fe({children:e,config:n,flags:{disableEip5792:r,disable5792Upgrade:t,accountOverride:c}={},theme:g,onSmartAccountRejection:h,chains:y=[],defaultChain:d,thirdweb:l,publicJsonRpcUrl:b,onConnect:W,onConnectError:A}){let{wallet:m,openConnectModal:v,connect:f,DebugConnectButton:u,connectionId:p,disconnect:P,connectorName:E,isEmbeddedWallet:B,profiles:o,preAuthenticate:i,isConnecting:a}=k({config:n,theme:g,chains:y,chain:d,publicJsonRpcUrl:b,onConnect:W,onConnectError:A}),{address:x,chainId:I}=_wagmi.useAccount.call(void 0, ),{disconnect:J}=_wagmi.useDisconnect.call(void 0, ),K=_wagmi.usePublicClient.call(void 0, ),s=_react.useMemo.call(void 0, ()=>{if(!(!x||!m))return _nullishCoalesce(c, () => (x))},[c,x,m]),{data:w}=_wagmi.useEnsName.call(void 0, {config:n.wagmi,chainId:d.id,address:s}),{data:T}=_immutable2.default.call(void 0, s?["BeraWagmiProvider_code",s,I]:null,([Q,V,Pe])=>_optionalChain([K, 'optionalAccess', _11 => _11.getCode, 'call', _12 => _12({address:V})]),{refreshInterval:6e4}),[j,F]=_react.useMemo.call(void 0, ()=>T?T.startsWith("0xef01")?[!1,!0]:[!0,!1]:[!1,!1],[T]),{data:S}=_wagmi.useWalletClient.call(void 0, ),G=_react.useMemo.call(void 0, ()=>{try{return w?_ens.normalize.call(void 0, w):void 0}catch (e2){}},[w]),H=_wagmi.useEnsAvatar.call(void 0, {name:G});return _jsxruntime.jsx.call(void 0, q.Provider,{value:{preAuthenticate:i,flags:{disableEip5792:!!r,disable5792Upgrade:!!t},walletClient:S,onSmartAccountRejection:()=>{_optionalChain([h, 'optionalCall', _13 => _13()])},isEmbeddedWalletsEnabled:_nullishCoalesce(l.embeddedWallets, () => (!0)),isConnecting:a,isConnected:!!s&&!!S,DebugConnectButton:u,account:m&&I&&s?{connectionId:p,chainId:I,connectorName:E,isEmbeddedWallet:B,profiles:o,wallet:{address:s,ensName:_nullishCoalesce(_optionalChain([w, 'optionalAccess', _14 => _14.replace, 'call', _15 => _15(".bera",".\u{1F43B}\u26D3\uFE0F")]), () => (null)),ensAvatar:_nullishCoalesce(H.data, () => (null)),has7702Authorization:F,isContract:j}}:void 0,connect:f,openConnectModal:async()=>{await v()},disconnect:()=>{J(),P()},defaultChainId:d.id},children:_jsxruntime.jsx.call(void 0, R,{address:s,defaultChainId:d.id,children:e})})}function Ae(){let{account:e,isConnected:n}=C();return{...e,isConnected:n}}function We({chainId:e}){let{flags:n,account:r}=C(),{data:t}=_wagmi.useCapabilities.call(void 0, {account:_optionalChain([r, 'optionalAccess', _16 => _16.wallet, 'optionalAccess', _17 => _17.address]),scopeKey:_optionalChain([r, 'optionalAccess', _18 => _18.connectionId]),query:{retry:3},chainId:e});return{supportsAtomic:_react.useMemo.call(void 0, ()=>n.disableEip5792||!t?!1:_optionalChain([t, 'optionalAccess', _19 => _19.atomic, 'optionalAccess', _20 => _20.status])==="supported"||!n.disable5792Upgrade&&_optionalChain([t, 'optionalAccess', _21 => _21.atomic, 'optionalAccess', _22 => _22.status])==="ready",[t,n.disableEip5792,n.disable5792Upgrade,e]),capabilities:t}}function nt(e){let{defaultChainId:n}=M(),{chainId:r,...t}=_nullishCoalesce(e, () => ({}));return _wagmi.usePublicClient.call(void 0, {chainId:_nullishCoalesce(r, () => (n)),...t})}exports.a = M; exports.b = Ae; exports.c = We; exports.d = nt; 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 = Fe;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{usePublicClient as ve}from"wagmi";import{useContext as Z}from"react";import{createContext as X}from"react";import{jsx as Y}from"react/jsx-runtime";var U=X(void 0);function R({children:e,address:n,defaultChainId:r}){return Y(U.Provider,{value:{address:n,defaultChainId:r},children:e})}function M(){let e=Z(U);if(!e)throw new Error("LightweightAccountContext not found");let{address:n,defaultChainId:r}=e;return{isConnected:!!n,address:n,defaultChainId:r}}import{useBlockNumber as rt,useChains as at,useConfig as st,useEnsAvatar as _,useEnsName as O,useSwitchChain as ct,useTransactionReceipt as dt}from"wagmi";import{createContext as ue,useContext as pe,useMemo as N}from"react";import me from"swr/immutable";import{normalize as fe}from"viem/ens";import{useAccount as Ce,useDisconnect as ge,usePublicClient as he,useWalletClient as be}from"wagmi";import{useMemo as D}from"react";import{defineChain as L}from"thirdweb";import{ConnectButton as $,useActiveAccount as ee,useActiveWallet as te,useAutoConnect as ne,useProfiles as oe,useConnect as ie,useConnectModal as re,useDisconnect as ae,useWalletInfo as se}from"thirdweb/react";import{preAuthenticate as ce}from"thirdweb/wallets/in-app";import{useConnect as de}from"wagmi";import{jsx as le}from"react/jsx-runtime";function k({config:e,theme:n,chains:r=[],chain:t,onConnect:c,onConnectError:g,publicJsonRpcUrl:h=t.rpcUrls.default.http[0]}){let{connectors:y,connect:d}=de(),l=te(),b=ee(),{disconnect:W}=ae(),{data:A}=se(l?.id),{connect:m}=ie(),{data:v}=oe({client:e.client}),f=D(()=>L({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:[h]}}}),[h,t]),u={client:e.client,chain:f,wallets:e.wallets};async function p(o){let i=y.find(a=>a.id==="in-app-wallet");if(i){let a={withCapabilities:!0,wallet:o};d({connector:i,chainId:t.id,...a})}else console.error("no tw connector found")}let{isLoading:P}=ne({...u,onConnect:p}),E=D(()=>"randomUUID"in crypto?crypto.randomUUID():Math.random().toString(36).substring(2,15),[l?.id,b?.address]),{connect:B}=re();return{connect(o){if(!e.hasEmbeddedWallets){console.error("useBeraWagmi.connect: this function is not available if embedded wallets are disabled");return}return m(async()=>{let i=e.wallets.find(a=>a.id==="inApp");if(!i)throw console.error("useBeraWagmi.connect: no inApp wallet found"),new Error("no inApp wallet found");return i.connect({...u,...o}).then(async()=>(c?.({type:"connect",data:o}),await p(i),i)).catch(a=>{throw g?.(a),a})})},async openConnectModal(){try{let o=await B({...u,wallets:e.wallets,theme:n==="auto"?void 0:n,size:"compact",chains:[f,...r.filter(i=>i.id!==f.id).map(i=>L({id:i.id}))]});c?.({type:"connect_modal"}),await p(o)}catch(o){throw g?.(o),o}},disconnect(){l&&W(l)},isConnecting:P,connectionId:E,connectorName:A?.name??null,isEmbeddedWallet:A?.id==="inApp",wallet:b,profiles:v,preAuthenticate(o){return ce({...o,client:e.client})},DebugConnectButton(){return le($,{...u,connectModal:{size:"compact"},onConnect:o=>p(o)})}}}import{jsx as z}from"react/jsx-runtime";function C(){let e=pe(q);if(!e)throw new Error("BeraWagmiContext not found");return e}var q=ue(void 0);function Fe({children:e,config:n,flags:{disableEip5792:r,disable5792Upgrade:t,accountOverride:c}={},theme:g,onSmartAccountRejection:h,chains:y=[],defaultChain:d,thirdweb:l,publicJsonRpcUrl:b,onConnect:W,onConnectError:A}){let{wallet:m,openConnectModal:v,connect:f,DebugConnectButton:u,connectionId:p,disconnect:P,connectorName:E,isEmbeddedWallet:B,profiles:o,preAuthenticate:i,isConnecting:a}=k({config:n,theme:g,chains:y,chain:d,publicJsonRpcUrl:b,onConnect:W,onConnectError:A}),{address:x,chainId:I}=Ce(),{disconnect:J}=ge(),K=he(),s=N(()=>{if(!(!x||!m))return c??x},[c,x,m]),{data:w}=O({config:n.wagmi,chainId:d.id,address:s}),{data:T}=me(s?["BeraWagmiProvider_code",s,I]:null,([Q,V,Pe])=>K?.getCode({address:V}),{refreshInterval:6e4}),[j,F]=N(()=>T?T.startsWith("0xef01")?[!1,!0]:[!0,!1]:[!1,!1],[T]),{data:S}=be(),G=N(()=>{try{return w?fe(w):void 0}catch{}},[w]),H=_({name:G});return z(q.Provider,{value:{preAuthenticate:i,flags:{disableEip5792:!!r,disable5792Upgrade:!!t},walletClient:S,onSmartAccountRejection:()=>{h?.()},isEmbeddedWalletsEnabled:l.embeddedWallets??!0,isConnecting:a,isConnected:!!s&&!!S,DebugConnectButton:u,account:m&&I&&s?{connectionId:p,chainId:I,connectorName:E,isEmbeddedWallet:B,profiles:o,wallet:{address:s,ensName:w?.replace(".bera",".\u{1F43B}\u26D3\uFE0F")??null,ensAvatar:H.data??null,has7702Authorization:F,isContract:j}}:void 0,connect:f,openConnectModal:async()=>{await v()},disconnect:()=>{J(),P()},defaultChainId:d.id},children:z(R,{address:s,defaultChainId:d.id,children:e})})}function Ae(){let{account:e,isConnected:n}=C();return{...e,isConnected:n}}import{useMemo as we}from"react";import{useCapabilities as ye}from"wagmi";function We({chainId:e}){let{flags:n,account:r}=C(),{data:t}=ye({account:r?.wallet?.address,scopeKey:r?.connectionId,query:{retry:3},chainId:e});return{supportsAtomic:we(()=>n.disableEip5792||!t?!1:t?.atomic?.status==="supported"||!n.disable5792Upgrade&&t?.atomic?.status==="ready",[t,n.disableEip5792,n.disable5792Upgrade,e]),capabilities:t}}function nt(e){let{defaultChainId:n}=M(),{chainId:r,...t}=e??{};return ve({chainId:r??n,...t})}export{M as a,Ae as b,We as c,nt as d,rt as e,at as f,st as g,_ as h,O as i,ct as j,dt as k,C as l,Fe as m};
|
package/dist/context/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";var _chunkPVMPBWIGcjs = require('../chunk-PVMPBWIG.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";var _chunkPVMPBWIGcjs = require('../chunk-PVMPBWIG.cjs');var _chunkJNXJQLQCcjs = require('../chunk-JNXJQLQC.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, ()=>_chunkPVMPBWIGcjs.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, _chunkJNXJQLQCcjs.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-D_9r9lFE.cjs';
|
|
4
4
|
import 'react';
|
|
5
5
|
import 'thirdweb/wallets';
|
|
6
6
|
import 'wagmi';
|
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-BYoBR8sq.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
import 'thirdweb/wallets';
|
|
6
6
|
import 'wagmi';
|
package/dist/context/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{a as m}from"../chunk-MZZ62TKM.mjs";import{m as a}from"../chunk-
|
|
1
|
+
"use client";import{a as m}from"../chunk-MZZ62TKM.mjs";import{m as a}from"../chunk-UEV74GTG.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 _chunkJNXJQLQCcjs = require('../chunk-JNXJQLQC.cjs');exports.useBeraAccount = _chunkJNXJQLQCcjs.b; exports.useBeraWagmi = _chunkJNXJQLQCcjs.l; exports.useBeraWallet = _chunkJNXJQLQCcjs.a; exports.useBlockNumber = _chunkJNXJQLQCcjs.e; exports.useCapabilities = _chunkJNXJQLQCcjs.c; exports.useChains = _chunkJNXJQLQCcjs.f; exports.useConfig = _chunkJNXJQLQCcjs.g; exports.useEnsAvatar = _chunkJNXJQLQCcjs.h; exports.useEnsName = _chunkJNXJQLQCcjs.i; exports.usePublicClient = _chunkJNXJQLQCcjs.d; exports.useSwitchChain = _chunkJNXJQLQCcjs.j; exports.useTransactionReceipt = _chunkJNXJQLQCcjs.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-D_9r9lFE.cjs';
|
|
4
|
+
export { u as useBeraWagmi } from '../BeraWagmi-D_9r9lFE.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-BYoBR8sq.js';
|
|
4
|
+
export { u as useBeraWagmi } from '../BeraWagmi-BYoBR8sq.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-UEV74GTG.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};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@berachain/wagmi",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"thirdweb": "5.119.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
+
"@berachain/config": "0.1.3",
|
|
50
51
|
"@types/node": "24.1.0",
|
|
51
52
|
"@types/react": "19.1.8",
|
|
52
53
|
"tsup": "8.4.0",
|
|
53
54
|
"viem": "2.45.0",
|
|
54
|
-
"wagmi": "2.19.5"
|
|
55
|
-
"@berachain/config": "0.1.0"
|
|
55
|
+
"wagmi": "2.19.5"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"react": "^19.1",
|
|
@@ -125,6 +125,10 @@ export enum ChainId {
|
|
|
125
125
|
BEPOLIA = 80069,
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
export type ConnectEvent =
|
|
129
|
+
| { type: "connect"; data: SingleStepAuthArgsType | MultiStepAuthArgsType }
|
|
130
|
+
| { type: "connect_modal" };
|
|
131
|
+
|
|
128
132
|
export interface IBeraWagmiProviderProps extends PropsWithChildren {
|
|
129
133
|
config: ReturnType<typeof getConfig>;
|
|
130
134
|
theme?: "dark" | "light" | "auto";
|
|
@@ -143,12 +147,8 @@ export interface IBeraWagmiProviderProps extends PropsWithChildren {
|
|
|
143
147
|
accountOverride?: Address;
|
|
144
148
|
};
|
|
145
149
|
onSmartAccountRejection?: () => void;
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
*
|
|
149
|
-
* This is not triggered when a wallet connect automatically after a refresh.
|
|
150
|
-
*/
|
|
151
|
-
onConnectedWallet?: () => void;
|
|
150
|
+
onConnect?: (event: ConnectEvent) => void;
|
|
151
|
+
onConnectError?: (error: Error) => void;
|
|
152
152
|
chains?: Chain[];
|
|
153
153
|
defaultChain: Chain;
|
|
154
154
|
thirdweb: ThirdwebConfig;
|
|
@@ -165,6 +165,8 @@ export function BeraWagmiProvider({
|
|
|
165
165
|
defaultChain,
|
|
166
166
|
thirdweb,
|
|
167
167
|
publicJsonRpcUrl,
|
|
168
|
+
onConnect,
|
|
169
|
+
onConnectError,
|
|
168
170
|
}: IBeraWagmiProviderProps) {
|
|
169
171
|
const {
|
|
170
172
|
wallet,
|
|
@@ -184,6 +186,8 @@ export function BeraWagmiProvider({
|
|
|
184
186
|
chains,
|
|
185
187
|
chain: defaultChain,
|
|
186
188
|
publicJsonRpcUrl,
|
|
189
|
+
onConnect,
|
|
190
|
+
onConnectError,
|
|
187
191
|
});
|
|
188
192
|
|
|
189
193
|
const { address: connectedAddress, chainId } = useAccount(); // wagmi
|
|
@@ -23,17 +23,19 @@ import type { Chain } from "viem";
|
|
|
23
23
|
import { useConnect } from "wagmi";
|
|
24
24
|
|
|
25
25
|
import type { getConfig, InAppWallet } from "../config";
|
|
26
|
-
import type { BeraWagmiApi } from "./BeraWagmi";
|
|
26
|
+
import type { BeraWagmiApi, ConnectEvent } from "./BeraWagmi";
|
|
27
27
|
|
|
28
28
|
export function useThirdweb({
|
|
29
29
|
config,
|
|
30
30
|
theme,
|
|
31
31
|
chains = [],
|
|
32
32
|
chain,
|
|
33
|
-
|
|
33
|
+
onConnect,
|
|
34
|
+
onConnectError,
|
|
34
35
|
publicJsonRpcUrl = chain.rpcUrls.default.http[0],
|
|
35
36
|
}: {
|
|
36
|
-
|
|
37
|
+
onConnect?: (event: ConnectEvent) => void;
|
|
38
|
+
onConnectError?: (error: Error) => void;
|
|
37
39
|
config: ReturnType<typeof getConfig>;
|
|
38
40
|
theme: "light" | "dark" | "auto" | undefined;
|
|
39
41
|
chains?: Chain[];
|
|
@@ -152,34 +154,43 @@ export function useThirdweb({
|
|
|
152
154
|
...connectOptions,
|
|
153
155
|
...args,
|
|
154
156
|
})
|
|
155
|
-
.then(() => {
|
|
156
|
-
|
|
157
|
-
syncConnectedWallet(wallet);
|
|
157
|
+
.then(async () => {
|
|
158
|
+
onConnect?.({ type: "connect", data: args });
|
|
159
|
+
await syncConnectedWallet(wallet);
|
|
158
160
|
return wallet;
|
|
161
|
+
})
|
|
162
|
+
.catch((e) => {
|
|
163
|
+
onConnectError?.(e);
|
|
164
|
+
throw e;
|
|
159
165
|
});
|
|
160
166
|
});
|
|
161
167
|
},
|
|
162
168
|
async openConnectModal() {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
169
|
+
try {
|
|
170
|
+
const wallet = await twConnectModal({
|
|
171
|
+
...connectOptions,
|
|
172
|
+
wallets: config.wallets,
|
|
173
|
+
theme: theme === "auto" ? undefined : theme,
|
|
174
|
+
size: "compact",
|
|
175
|
+
chains: [
|
|
176
|
+
thirdwebChain,
|
|
177
|
+
...chains
|
|
178
|
+
// avoid duplicates
|
|
179
|
+
.filter((c) => c.id !== thirdwebChain.id)
|
|
180
|
+
.map((c) =>
|
|
181
|
+
defineChain({
|
|
182
|
+
id: c.id,
|
|
183
|
+
}),
|
|
184
|
+
),
|
|
185
|
+
],
|
|
186
|
+
}); // opens the connect modal
|
|
187
|
+
|
|
188
|
+
onConnect?.({ type: "connect_modal" });
|
|
189
|
+
await syncConnectedWallet(wallet);
|
|
190
|
+
} catch (e) {
|
|
191
|
+
onConnectError?.(e as Error);
|
|
192
|
+
throw e;
|
|
193
|
+
}
|
|
183
194
|
},
|
|
184
195
|
disconnect() {
|
|
185
196
|
if (activeWallet) {
|
package/dist/chunk-4MF5YCJ5.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{usePublicClient as We}from"wagmi";import{useContext as X}from"react";import{createContext as Q}from"react";import{jsx as V}from"react/jsx-runtime";var E=Q(void 0);function N({children:e,address:n,defaultChainId:i}){return V(E.Provider,{value:{address:n,defaultChainId:i},children:e})}function T(){let e=X(E);if(!e)throw new Error("LightweightAccountContext not found");let{address:n,defaultChainId:i}=e;return{isConnected:!!n,address:n,defaultChainId:i}}import{useBlockNumber as ot,useChains as it,useConfig as rt,useEnsAvatar as k,useEnsName as z,useSwitchChain as at,useTransactionReceipt as st}from"wagmi";import{createContext as de,useContext as le,useMemo as U}from"react";import ue from"swr/immutable";import{normalize as pe}from"viem/ens";import{useAccount as me,useDisconnect as fe,usePublicClient as Ce,useWalletClient as ge}from"wagmi";import{useMemo as R}from"react";import{defineChain as S}from"thirdweb";import{ConnectButton as Y,useActiveAccount as Z,useActiveWallet as $,useAutoConnect as ee,useProfiles as te,useConnect as ne,useConnectModal as oe,useDisconnect as ie,useWalletInfo as re}from"thirdweb/react";import{preAuthenticate as ae}from"thirdweb/wallets/in-app";import{useConnect as se}from"wagmi";import{jsx as ce}from"react/jsx-runtime";function D({config:e,theme:n,chains:i=[],chain:t,onConnectedWallet:d,publicJsonRpcUrl:C=t.rpcUrls.default.http[0]}){let{connectors:b,connect:A}=se(),a=$(),g=Z(),{disconnect:w}=ie(),{data:l}=re(a?.id),{connect:W}=ne(),{data:y}=te({client:e.client}),m=R(()=>S({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:[C]}}}),[C,t]),u={client:e.client,chain:m,wallets:e.wallets};async function p(r){let o=b.find(s=>s.id==="in-app-wallet");if(o){let s={withCapabilities:!0,wallet:r};A({connector:o,chainId:t.id,...s})}else console.error("no tw connector found")}let{isLoading:P}=ee({...u,onConnect:p}),v=R(()=>"randomUUID"in crypto?crypto.randomUUID():Math.random().toString(36).substring(2,15),[a?.id,g?.address]),{connect:B}=oe();return{connect(r){if(!e.hasEmbeddedWallets){console.error("useBeraWagmi.connect: this function is not available if embedded wallets are disabled");return}return W(async()=>{let o=e.wallets.find(s=>s.id==="inApp");if(!o)throw console.error("useBeraWagmi.connect: no inApp wallet found"),new Error("no inApp wallet found");return o.connect({...u,...r}).then(()=>(d?.(),p(o),o))})},async openConnectModal(){let r=await B({...u,wallets:e.wallets,theme:n==="auto"?void 0:n,size:"compact",chains:[m,...i.filter(o=>o.id!==m.id).map(o=>S({id:o.id}))]});d?.(),await p(r)},disconnect(){a&&w(a)},isConnecting:P,connectionId:v,connectorName:l?.name??null,isEmbeddedWallet:l?.id==="inApp",wallet:g,profiles:y,preAuthenticate(r){return ae({...r,client:e.client})},DebugConnectButton(){return ce(Y,{...u,connectModal:{size:"compact"},onConnect:r=>p(r)})}}}import{jsx as L}from"react/jsx-runtime";function f(){let e=le(O);if(!e)throw new Error("BeraWagmiContext not found");return e}var O=de(void 0);function Ke({children:e,config:n,flags:{disableEip5792:i,disable5792Upgrade:t,accountOverride:d}={},theme:C,onSmartAccountRejection:b,chains:A=[],defaultChain:a,thirdweb:g,publicJsonRpcUrl:w}){let{wallet:l,openConnectModal:W,connect:y,DebugConnectButton:m,connectionId:u,disconnect:p,connectorName:P,isEmbeddedWallet:v,profiles:B,preAuthenticate:r,isConnecting:o}=D({config:n,theme:C,chains:A,chain:a,publicJsonRpcUrl:w}),{address:s,chainId:I}=me(),{disconnect:_}=fe(),q=Ce(),c=U(()=>{if(!(!s||!l))return d??s},[d,s,l]),{data:h}=z({config:n.wagmi,chainId:a.id,address:c}),{data:x}=ue(c?["BeraWagmiProvider_code",c,I]:null,([G,H,ye])=>q?.getCode({address:H}),{refreshInterval:6e4}),[J,K]=U(()=>x?x.startsWith("0xef01")?[!1,!0]:[!0,!1]:[!1,!1],[x]),{data:M}=ge(),j=U(()=>{try{return h?pe(h):void 0}catch{}},[h]),F=k({name:j});return L(O.Provider,{value:{preAuthenticate:r,flags:{disableEip5792:!!i,disable5792Upgrade:!!t},walletClient:M,onSmartAccountRejection:()=>{b?.()},isEmbeddedWalletsEnabled:g.embeddedWallets??!0,isConnecting:o,isConnected:!!c&&!!M,DebugConnectButton:m,account:l&&I&&c?{connectionId:u,chainId:I,connectorName:P,isEmbeddedWallet:v,profiles:B,wallet:{address:c,ensName:h?.replace(".bera",".\u{1F43B}\u26D3\uFE0F")??null,ensAvatar:F.data??null,has7702Authorization:K,isContract:J}}:void 0,connect:y,openConnectModal:async()=>{await W()},disconnect:()=>{_(),p()},defaultChainId:a.id},children:L(N,{address:c,defaultChainId:a.id,children:e})})}function he(){let{account:e,isConnected:n}=f();return{...e,isConnected:n}}import{useMemo as be}from"react";import{useCapabilities as Ae}from"wagmi";function we({chainId:e}){let{flags:n,account:i}=f(),{data:t}=Ae({account:i?.wallet?.address,scopeKey:i?.connectionId,query:{retry:3},chainId:e});return{supportsAtomic:be(()=>n.disableEip5792||!t?!1:t?.atomic?.status==="supported"||!n.disable5792Upgrade&&t?.atomic?.status==="ready",[t,n.disableEip5792,n.disable5792Upgrade,e]),capabilities:t}}function et(e){let{defaultChainId:n}=T(),{chainId:i,...t}=e??{};return We({chainId:i??n,...t})}export{T as a,he as b,we as c,et as d,ot as e,it as f,rt as g,k as h,z as i,at as j,st as k,f as l,Ke as m};
|
package/dist/chunk-PNOS6IM4.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 E=_react.createContext.call(void 0, void 0);function N({children:e,address:n,defaultChainId:i}){return _jsxruntime.jsx.call(void 0, E.Provider,{value:{address:n,defaultChainId:i},children:e})}function T(){let e=_react.useContext.call(void 0, E);if(!e)throw new Error("LightweightAccountContext not found");let{address:n,defaultChainId:i}=e;return{isConnected:!!n,address:n,defaultChainId:i}}var _immutable = require('swr/immutable'); var _immutable2 = _interopRequireDefault(_immutable);var _ens = require('viem/ens');var _thirdweb = require('thirdweb');var _react3 = require('thirdweb/react');var _inapp = require('thirdweb/wallets/in-app');function D({config:e,theme:n,chains:i=[],chain:t,onConnectedWallet:d,publicJsonRpcUrl:C=t.rpcUrls.default.http[0]}){let{connectors:b,connect:A}=_wagmi.useConnect.call(void 0, ),a=_react3.useActiveWallet.call(void 0, ),g=_react3.useActiveAccount.call(void 0, ),{disconnect:w}=_react3.useDisconnect.call(void 0, ),{data:l}=_react3.useWalletInfo.call(void 0, _optionalChain([a, 'optionalAccess', _2 => _2.id])),{connect:W}=_react3.useConnect.call(void 0, ),{data:y}=_react3.useProfiles.call(void 0, {client:e.client}),m=_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:[C]}}}),[C,t]),u={client:e.client,chain:m,wallets:e.wallets};async function p(r){let o=b.find(s=>s.id==="in-app-wallet");if(o){let s={withCapabilities:!0,wallet:r};A({connector:o,chainId:t.id,...s})}else console.error("no tw connector found")}let{isLoading:P}=_react3.useAutoConnect.call(void 0, {...u,onConnect:p}),v=_react.useMemo.call(void 0, ()=>"randomUUID"in crypto?crypto.randomUUID():Math.random().toString(36).substring(2,15),[_optionalChain([a, 'optionalAccess', _3 => _3.id]),_optionalChain([g, 'optionalAccess', _4 => _4.address])]),{connect:B}=_react3.useConnectModal.call(void 0, );return{connect(r){if(!e.hasEmbeddedWallets){console.error("useBeraWagmi.connect: this function is not available if embedded wallets are disabled");return}return W(async()=>{let o=e.wallets.find(s=>s.id==="inApp");if(!o)throw console.error("useBeraWagmi.connect: no inApp wallet found"),new Error("no inApp wallet found");return o.connect({...u,...r}).then(()=>(_optionalChain([d, 'optionalCall', _5 => _5()]),p(o),o))})},async openConnectModal(){let r=await B({...u,wallets:e.wallets,theme:n==="auto"?void 0:n,size:"compact",chains:[m,...i.filter(o=>o.id!==m.id).map(o=>_thirdweb.defineChain.call(void 0, {id:o.id}))]});_optionalChain([d, 'optionalCall', _6 => _6()]),await p(r)},disconnect(){a&&w(a)},isConnecting:P,connectionId:v,connectorName:_nullishCoalesce(_optionalChain([l, 'optionalAccess', _7 => _7.name]), () => (null)),isEmbeddedWallet:_optionalChain([l, 'optionalAccess', _8 => _8.id])==="inApp",wallet:g,profiles:y,preAuthenticate(r){return _inapp.preAuthenticate.call(void 0, {...r,client:e.client})},DebugConnectButton(){return _jsxruntime.jsx.call(void 0, _react3.ConnectButton,{...u,connectModal:{size:"compact"},onConnect:r=>p(r)})}}}function f(){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 Ke({children:e,config:n,flags:{disableEip5792:i,disable5792Upgrade:t,accountOverride:d}={},theme:C,onSmartAccountRejection:b,chains:A=[],defaultChain:a,thirdweb:g,publicJsonRpcUrl:w}){let{wallet:l,openConnectModal:W,connect:y,DebugConnectButton:m,connectionId:u,disconnect:p,connectorName:P,isEmbeddedWallet:v,profiles:B,preAuthenticate:r,isConnecting:o}=D({config:n,theme:C,chains:A,chain:a,publicJsonRpcUrl:w}),{address:s,chainId:I}=_wagmi.useAccount.call(void 0, ),{disconnect:_}=_wagmi.useDisconnect.call(void 0, ),q=_wagmi.usePublicClient.call(void 0, ),c=_react.useMemo.call(void 0, ()=>{if(!(!s||!l))return _nullishCoalesce(d, () => (s))},[d,s,l]),{data:h}=_wagmi.useEnsName.call(void 0, {config:n.wagmi,chainId:a.id,address:c}),{data:x}=_immutable2.default.call(void 0, c?["BeraWagmiProvider_code",c,I]:null,([G,H,ye])=>_optionalChain([q, 'optionalAccess', _9 => _9.getCode, 'call', _10 => _10({address:H})]),{refreshInterval:6e4}),[J,K]=_react.useMemo.call(void 0, ()=>x?x.startsWith("0xef01")?[!1,!0]:[!0,!1]:[!1,!1],[x]),{data:M}=_wagmi.useWalletClient.call(void 0, ),j=_react.useMemo.call(void 0, ()=>{try{return h?_ens.normalize.call(void 0, h):void 0}catch (e2){}},[h]),F=_wagmi.useEnsAvatar.call(void 0, {name:j});return _jsxruntime.jsx.call(void 0, O.Provider,{value:{preAuthenticate:r,flags:{disableEip5792:!!i,disable5792Upgrade:!!t},walletClient:M,onSmartAccountRejection:()=>{_optionalChain([b, 'optionalCall', _11 => _11()])},isEmbeddedWalletsEnabled:_nullishCoalesce(g.embeddedWallets, () => (!0)),isConnecting:o,isConnected:!!c&&!!M,DebugConnectButton:m,account:l&&I&&c?{connectionId:u,chainId:I,connectorName:P,isEmbeddedWallet:v,profiles:B,wallet:{address:c,ensName:_nullishCoalesce(_optionalChain([h, 'optionalAccess', _12 => _12.replace, 'call', _13 => _13(".bera",".\u{1F43B}\u26D3\uFE0F")]), () => (null)),ensAvatar:_nullishCoalesce(F.data, () => (null)),has7702Authorization:K,isContract:J}}:void 0,connect:y,openConnectModal:async()=>{await W()},disconnect:()=>{_(),p()},defaultChainId:a.id},children:_jsxruntime.jsx.call(void 0, N,{address:c,defaultChainId:a.id,children:e})})}function he(){let{account:e,isConnected:n}=f();return{...e,isConnected:n}}function we({chainId:e}){let{flags:n,account:i}=f(),{data:t}=_wagmi.useCapabilities.call(void 0, {account:_optionalChain([i, 'optionalAccess', _14 => _14.wallet, 'optionalAccess', _15 => _15.address]),scopeKey:_optionalChain([i, 'optionalAccess', _16 => _16.connectionId]),query:{retry:3},chainId:e});return{supportsAtomic:_react.useMemo.call(void 0, ()=>n.disableEip5792||!t?!1:_optionalChain([t, 'optionalAccess', _17 => _17.atomic, 'optionalAccess', _18 => _18.status])==="supported"||!n.disable5792Upgrade&&_optionalChain([t, 'optionalAccess', _19 => _19.atomic, 'optionalAccess', _20 => _20.status])==="ready",[t,n.disableEip5792,n.disable5792Upgrade,e]),capabilities:t}}function et(e){let{defaultChainId:n}=T(),{chainId:i,...t}=_nullishCoalesce(e, () => ({}));return _wagmi.usePublicClient.call(void 0, {chainId:_nullishCoalesce(i, () => (n)),...t})}exports.a = T; exports.b = he; exports.c = we; exports.d = et; 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 = Ke;
|