@berachain/wagmi 0.4.0 → 0.4.1
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-COCKRVoz.d.ts → BeraWagmi-Bod8ckMU.d.ts} +14 -2
- package/dist/{BeraWagmi-0-HNcmGS.d.cts → BeraWagmi-tWJv_bhM.d.cts} +14 -2
- package/dist/chunk-4MF5YCJ5.mjs +1 -0
- package/dist/chunk-PNOS6IM4.cjs +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 +2 -2
- package/src/context/BeraWagmi.tsx +22 -3
- package/src/context/WagmiProvider.tsx +1 -1
- package/src/context/useThirdweb.tsx +11 -2
- package/src/hooks/useBeraAccounts.ts +1 -1
- package/src/hooks/useBeraWallet.ts +1 -1
- package/dist/chunk-EAWOJX7K.mjs +0 -1
- package/dist/chunk-IPQBC7RQ.cjs +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { Profile, SingleStepAuthArgsType, Wallet } from 'thirdweb/wallets';
|
|
2
|
+
import { Profile, SingleStepAuthArgsType, MultiStepAuthArgsType, 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';
|
|
@@ -61,8 +61,20 @@ interface BeraWagmiApi {
|
|
|
61
61
|
openConnectModal(): Promise<void> | void;
|
|
62
62
|
/**
|
|
63
63
|
* Connects a wallet using a specific strategy.
|
|
64
|
+
* For email/phone use MultiStepAuthArgsType (requires preAuthenticate first).
|
|
64
65
|
*/
|
|
65
|
-
connect(args: SingleStepAuthArgsType): Promise<Wallet | null> | undefined;
|
|
66
|
+
connect(args: SingleStepAuthArgsType | MultiStepAuthArgsType): Promise<Wallet | null> | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Sends an OTP to the user's email or phone number.
|
|
69
|
+
* Call this before connect() when using email or phone strategy.
|
|
70
|
+
*/
|
|
71
|
+
preAuthenticate(args: {
|
|
72
|
+
strategy: "email";
|
|
73
|
+
email: string;
|
|
74
|
+
} | {
|
|
75
|
+
strategy: "phone";
|
|
76
|
+
phoneNumber: string;
|
|
77
|
+
}): Promise<void>;
|
|
66
78
|
disconnect(): void;
|
|
67
79
|
/**
|
|
68
80
|
* A callback that is called when a smart account upgrade is rejected.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { Profile, SingleStepAuthArgsType, Wallet } from 'thirdweb/wallets';
|
|
2
|
+
import { Profile, SingleStepAuthArgsType, MultiStepAuthArgsType, 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';
|
|
@@ -61,8 +61,20 @@ interface BeraWagmiApi {
|
|
|
61
61
|
openConnectModal(): Promise<void> | void;
|
|
62
62
|
/**
|
|
63
63
|
* Connects a wallet using a specific strategy.
|
|
64
|
+
* For email/phone use MultiStepAuthArgsType (requires preAuthenticate first).
|
|
64
65
|
*/
|
|
65
|
-
connect(args: SingleStepAuthArgsType): Promise<Wallet | null> | undefined;
|
|
66
|
+
connect(args: SingleStepAuthArgsType | MultiStepAuthArgsType): Promise<Wallet | null> | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Sends an OTP to the user's email or phone number.
|
|
69
|
+
* Call this before connect() when using email or phone strategy.
|
|
70
|
+
*/
|
|
71
|
+
preAuthenticate(args: {
|
|
72
|
+
strategy: "email";
|
|
73
|
+
email: string;
|
|
74
|
+
} | {
|
|
75
|
+
strategy: "phone";
|
|
76
|
+
phoneNumber: string;
|
|
77
|
+
}): Promise<void>;
|
|
66
78
|
disconnect(): void;
|
|
67
79
|
/**
|
|
68
80
|
* A callback that is called when a smart account upgrade is rejected.
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -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 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;
|
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 _chunkPNOS6IM4cjs = require('../chunk-PNOS6IM4.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, _chunkPNOS6IM4cjs.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-tWJv_bhM.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-Bod8ckMU.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-4MF5YCJ5.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 _chunkPNOS6IM4cjs = require('../chunk-PNOS6IM4.cjs');exports.useBeraAccount = _chunkPNOS6IM4cjs.b; exports.useBeraWagmi = _chunkPNOS6IM4cjs.l; exports.useBeraWallet = _chunkPNOS6IM4cjs.a; exports.useBlockNumber = _chunkPNOS6IM4cjs.e; exports.useCapabilities = _chunkPNOS6IM4cjs.c; exports.useChains = _chunkPNOS6IM4cjs.f; exports.useConfig = _chunkPNOS6IM4cjs.g; exports.useEnsAvatar = _chunkPNOS6IM4cjs.h; exports.useEnsName = _chunkPNOS6IM4cjs.i; exports.usePublicClient = _chunkPNOS6IM4cjs.d; exports.useSwitchChain = _chunkPNOS6IM4cjs.j; exports.useTransactionReceipt = _chunkPNOS6IM4cjs.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-tWJv_bhM.cjs';
|
|
4
|
+
export { u as useBeraWagmi } from '../BeraWagmi-tWJv_bhM.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-Bod8ckMU.js';
|
|
4
|
+
export { u as useBeraWagmi } from '../BeraWagmi-Bod8ckMU.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-4MF5YCJ5.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.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@thirdweb-dev/wagmi-adapter": "0.2.207",
|
|
45
45
|
"@wagmi/core": "2.22.1",
|
|
46
|
-
"swr": "2.
|
|
46
|
+
"swr": "2.4.1",
|
|
47
47
|
"thirdweb": "5.119.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
@@ -5,7 +5,12 @@ import {
|
|
|
5
5
|
useMemo,
|
|
6
6
|
} from "react";
|
|
7
7
|
import useSWRImmutable from "swr/immutable";
|
|
8
|
-
import type {
|
|
8
|
+
import type {
|
|
9
|
+
MultiStepAuthArgsType,
|
|
10
|
+
Profile,
|
|
11
|
+
SingleStepAuthArgsType,
|
|
12
|
+
Wallet,
|
|
13
|
+
} from "thirdweb/wallets";
|
|
9
14
|
import type { Address, Chain } from "viem";
|
|
10
15
|
import { normalize } from "viem/ens";
|
|
11
16
|
import {
|
|
@@ -16,7 +21,7 @@ import {
|
|
|
16
21
|
useWalletClient,
|
|
17
22
|
} from "wagmi";
|
|
18
23
|
|
|
19
|
-
import type { getConfig, ThirdwebConfig } from "
|
|
24
|
+
import type { getConfig, ThirdwebConfig } from "../config";
|
|
20
25
|
import { useEnsAvatar, useEnsName } from "../hooks";
|
|
21
26
|
import { LightweightAccountProvider } from "./LightweightAccountProvider";
|
|
22
27
|
import { useThirdweb } from "./useThirdweb";
|
|
@@ -88,8 +93,20 @@ export interface BeraWagmiApi {
|
|
|
88
93
|
openConnectModal(): Promise<void> | void;
|
|
89
94
|
/**
|
|
90
95
|
* Connects a wallet using a specific strategy.
|
|
96
|
+
* For email/phone use MultiStepAuthArgsType (requires preAuthenticate first).
|
|
91
97
|
*/
|
|
92
|
-
connect(
|
|
98
|
+
connect(
|
|
99
|
+
args: SingleStepAuthArgsType | MultiStepAuthArgsType,
|
|
100
|
+
): Promise<Wallet | null> | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* Sends an OTP to the user's email or phone number.
|
|
103
|
+
* Call this before connect() when using email or phone strategy.
|
|
104
|
+
*/
|
|
105
|
+
preAuthenticate(
|
|
106
|
+
args:
|
|
107
|
+
| { strategy: "email"; email: string }
|
|
108
|
+
| { strategy: "phone"; phoneNumber: string },
|
|
109
|
+
): Promise<void>;
|
|
93
110
|
disconnect(): void;
|
|
94
111
|
/**
|
|
95
112
|
* A callback that is called when a smart account upgrade is rejected.
|
|
@@ -159,6 +176,7 @@ export function BeraWagmiProvider({
|
|
|
159
176
|
connectorName,
|
|
160
177
|
isEmbeddedWallet,
|
|
161
178
|
profiles,
|
|
179
|
+
preAuthenticate,
|
|
162
180
|
isConnecting,
|
|
163
181
|
} = useThirdweb({
|
|
164
182
|
config,
|
|
@@ -233,6 +251,7 @@ export function BeraWagmiProvider({
|
|
|
233
251
|
return (
|
|
234
252
|
<BeraWagmiContext.Provider
|
|
235
253
|
value={{
|
|
254
|
+
preAuthenticate,
|
|
236
255
|
flags: {
|
|
237
256
|
disableEip5792: !!disableEip5792,
|
|
238
257
|
disable5792Upgrade: !!disable5792Upgrade,
|
|
@@ -6,7 +6,7 @@ import { ThirdwebProvider } from "thirdweb/react";
|
|
|
6
6
|
import type { Chain, Transport } from "viem";
|
|
7
7
|
import { WagmiProvider as WagmiProviderBase } from "wagmi";
|
|
8
8
|
|
|
9
|
-
import { getConfig } from "
|
|
9
|
+
import { getConfig } from "../config/defaultWagmiConfig";
|
|
10
10
|
import { BeraWagmiProvider, type IBeraWagmiProviderProps } from "./BeraWagmi";
|
|
11
11
|
|
|
12
12
|
type WagmiProviderProps = Omit<
|
|
@@ -18,10 +18,11 @@ import type {
|
|
|
18
18
|
Profile,
|
|
19
19
|
Wallet,
|
|
20
20
|
} from "thirdweb/wallets";
|
|
21
|
+
import { preAuthenticate } from "thirdweb/wallets/in-app";
|
|
21
22
|
import type { Chain } from "viem";
|
|
22
23
|
import { useConnect } from "wagmi";
|
|
23
24
|
|
|
24
|
-
import type { getConfig, InAppWallet } from "
|
|
25
|
+
import type { getConfig, InAppWallet } from "../config";
|
|
25
26
|
import type { BeraWagmiApi } from "./BeraWagmi";
|
|
26
27
|
|
|
27
28
|
export function useThirdweb({
|
|
@@ -45,6 +46,7 @@ export function useThirdweb({
|
|
|
45
46
|
| "disconnect"
|
|
46
47
|
| "isConnecting"
|
|
47
48
|
| "DebugConnectButton"
|
|
49
|
+
| "preAuthenticate"
|
|
48
50
|
> & {
|
|
49
51
|
connectionId: string;
|
|
50
52
|
connectorName: string | null;
|
|
@@ -117,7 +119,11 @@ export function useThirdweb({
|
|
|
117
119
|
});
|
|
118
120
|
|
|
119
121
|
const connectionId = useMemo(() => {
|
|
120
|
-
|
|
122
|
+
// this might not be available in some environments
|
|
123
|
+
if ("randomUUID" in crypto) {
|
|
124
|
+
return crypto.randomUUID();
|
|
125
|
+
}
|
|
126
|
+
return Math.random().toString(36).substring(2, 15);
|
|
121
127
|
}, [activeWallet?.id, activeAccount?.address]);
|
|
122
128
|
|
|
123
129
|
const { connect: twConnectModal } = useTwConnectModal();
|
|
@@ -186,6 +192,9 @@ export function useThirdweb({
|
|
|
186
192
|
isEmbeddedWallet: walletInfo?.id === "inApp",
|
|
187
193
|
wallet: activeAccount,
|
|
188
194
|
profiles,
|
|
195
|
+
preAuthenticate(args) {
|
|
196
|
+
return preAuthenticate({ ...args, client: config.client });
|
|
197
|
+
},
|
|
189
198
|
DebugConnectButton() {
|
|
190
199
|
return (
|
|
191
200
|
<ConnectButton
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useContext } from "react";
|
|
2
2
|
|
|
3
|
-
import { LightweightAccountContext } from "
|
|
3
|
+
import { LightweightAccountContext } from "../context/LightweightAccountProvider";
|
|
4
4
|
|
|
5
5
|
export function useBeraWallet() {
|
|
6
6
|
const context = useContext(LightweightAccountContext);
|
package/dist/chunk-EAWOJX7K.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{usePublicClient as we}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:i}){return Q(I.Provider,{value:{address:n,defaultChainId:i},children:e})}function E(){let e=V(I);if(!e)throw new Error("LightweightAccountContext not found");let{address:n,defaultChainId:i}=e;return{isConnected:!!n,address:n,defaultChainId:i}}import{useBlockNumber as et,useChains as tt,useConfig as nt,useEnsAvatar as k,useEnsName as z,useSwitchChain as ot,useTransactionReceipt as it}from"wagmi";import{createContext as se,useContext as ce,useMemo as T}from"react";import de from"swr/immutable";import{normalize as le}from"viem/ens";import{useAccount as ue,useDisconnect as pe,usePublicClient as me,useWalletClient as fe}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,useConnect as te,useConnectModal as ne,useDisconnect as oe,useWalletInfo as ie}from"thirdweb/react";import{useConnect as re}from"wagmi";import{jsx as ae}from"react/jsx-runtime";function L({config:e,theme:n,chains:i=[],chain:t,onConnectedWallet:d,publicJsonRpcUrl:C=t.rpcUrls.default.http[0]}){let{connectors:b,connect:w}=re(),r=Z(),g=Y(),{disconnect:A}=oe(),{data:l}=ie(r?.id),{connect:W}=te(),{data:y}=ee({client:e.client}),m=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:[C]}}}),[C,t]),u={client:e.client,chain:m,wallets:e.wallets};async function p(a){let o=b.find(s=>s.id==="in-app-wallet");if(o){let s={withCapabilities:!0,wallet:a};w({connector:o,chainId:t.id,...s})}else console.error("no tw connector found")}let{isLoading:P}=$({...u,onConnect:p}),v=R(()=>crypto.randomUUID(),[r?.id,g?.address]),{connect:B}=ne();return{connect(a){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,...a}).then(()=>(d?.(),p(o),o))})},async openConnectModal(){let a=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=>M({id:o.id}))]});d?.(),await p(a)},disconnect(){r&&A(r)},isConnecting:P,connectionId:v,connectorName:l?.name??null,isEmbeddedWallet:l?.id==="inApp",wallet:g,profiles:y,DebugConnectButton(){return ae(X,{...u,connectModal:{size:"compact"},onConnect:a=>p(a)})}}}import{jsx as S}from"react/jsx-runtime";function f(){let e=ce(D);if(!e)throw new Error("BeraWagmiContext not found");return e}var D=se(void 0);function _e({children:e,config:n,flags:{disableEip5792:i,disable5792Upgrade:t,accountOverride:d}={},theme:C,onSmartAccountRejection:b,chains:w=[],defaultChain:r,thirdweb:g,publicJsonRpcUrl:A}){let{wallet:l,openConnectModal:W,connect:y,DebugConnectButton:m,connectionId:u,disconnect:p,connectorName:P,isEmbeddedWallet:v,profiles:B,isConnecting:a}=L({config:n,theme:C,chains:w,chain:r,publicJsonRpcUrl:A}),{address:o,chainId:s}=ue(),{disconnect:O}=pe(),_=me(),c=T(()=>{if(!(!o||!l))return d??o},[d,o,l]),{data:h}=z({config:n.wagmi,chainId:r.id,address:c}),{data:x}=de(c?["BeraWagmiProvider_code",c,s]:null,([F,G,Ae])=>_?.getCode({address:G}),{refreshInterval:6e4}),[q,J]=T(()=>x?x.startsWith("0xef01")?[!1,!0]:[!0,!1]:[!1,!1],[x]),{data:U}=fe(),K=T(()=>{try{return h?le(h):void 0}catch{}},[h]),j=k({name:K});return S(D.Provider,{value:{flags:{disableEip5792:!!i,disable5792Upgrade:!!t},walletClient:U,onSmartAccountRejection:()=>{b?.()},isEmbeddedWalletsEnabled:g.embeddedWallets??!0,isConnecting:a,isConnected:!!c&&!!U,DebugConnectButton:m,account:l&&s&&c?{connectionId:u,chainId:s,connectorName:P,isEmbeddedWallet:v,profiles:B,wallet:{address:c,ensName:h?.replace(".bera",".\u{1F43B}\u26D3\uFE0F")??null,ensAvatar:j.data??null,has7702Authorization:J,isContract:q}}:void 0,connect:y,openConnectModal:async()=>{await W()},disconnect:()=>{O(),p()},defaultChainId:r.id},children:S(N,{address:c,defaultChainId:r.id,children:e})})}function Ce(){let{account:e,isConnected:n}=f();return{...e,isConnected:n}}import{useMemo as ge}from"react";import{useCapabilities as he}from"wagmi";function be({chainId:e}){let{flags:n,account:i}=f(),{data:t}=he({account:i?.wallet?.address,scopeKey:i?.connectionId,query:{retry:3},chainId:e});return{supportsAtomic:ge(()=>n.disableEip5792||!t?!1:t?.atomic?.status==="supported"||!n.disable5792Upgrade&&t?.atomic?.status==="ready",[t,n.disableEip5792,n.disable5792Upgrade,e]),capabilities:t}}function Ye(e){let{defaultChainId:n}=E(),{chainId:i,...t}=e??{};return we({chainId:i??n,...t})}export{E as a,Ce as b,be as c,Ye as d,et as e,tt as f,nt as g,k as h,z as i,ot as j,it as k,f as l,_e as m};
|
package/dist/chunk-IPQBC7RQ.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 I=_react.createContext.call(void 0, void 0);function N({children:e,address:n,defaultChainId:i}){return _jsxruntime.jsx.call(void 0, I.Provider,{value:{address:n,defaultChainId:i},children:e})}function E(){let e=_react.useContext.call(void 0, I);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');function L({config:e,theme:n,chains:i=[],chain:t,onConnectedWallet:d,publicJsonRpcUrl:C=t.rpcUrls.default.http[0]}){let{connectors:b,connect:w}=_wagmi.useConnect.call(void 0, ),r=_react3.useActiveWallet.call(void 0, ),g=_react3.useActiveAccount.call(void 0, ),{disconnect:A}=_react3.useDisconnect.call(void 0, ),{data:l}=_react3.useWalletInfo.call(void 0, _optionalChain([r, '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(a){let o=b.find(s=>s.id==="in-app-wallet");if(o){let s={withCapabilities:!0,wallet:a};w({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, ()=>crypto.randomUUID(),[_optionalChain([r, 'optionalAccess', _3 => _3.id]),_optionalChain([g, 'optionalAccess', _4 => _4.address])]),{connect:B}=_react3.useConnectModal.call(void 0, );return{connect(a){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,...a}).then(()=>(_optionalChain([d, 'optionalCall', _5 => _5()]),p(o),o))})},async openConnectModal(){let a=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(a)},disconnect(){r&&A(r)},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,DebugConnectButton(){return _jsxruntime.jsx.call(void 0, _react3.ConnectButton,{...u,connectModal:{size:"compact"},onConnect:a=>p(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 _e({children:e,config:n,flags:{disableEip5792:i,disable5792Upgrade:t,accountOverride:d}={},theme:C,onSmartAccountRejection:b,chains:w=[],defaultChain:r,thirdweb:g,publicJsonRpcUrl:A}){let{wallet:l,openConnectModal:W,connect:y,DebugConnectButton:m,connectionId:u,disconnect:p,connectorName:P,isEmbeddedWallet:v,profiles:B,isConnecting:a}=L({config:n,theme:C,chains:w,chain:r,publicJsonRpcUrl:A}),{address:o,chainId:s}=_wagmi.useAccount.call(void 0, ),{disconnect:O}=_wagmi.useDisconnect.call(void 0, ),_=_wagmi.usePublicClient.call(void 0, ),c=_react.useMemo.call(void 0, ()=>{if(!(!o||!l))return _nullishCoalesce(d, () => (o))},[d,o,l]),{data:h}=_wagmi.useEnsName.call(void 0, {config:n.wagmi,chainId:r.id,address:c}),{data:x}=_immutable2.default.call(void 0, c?["BeraWagmiProvider_code",c,s]:null,([F,G,Ae])=>_optionalChain([_, 'optionalAccess', _9 => _9.getCode, 'call', _10 => _10({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 h?_ens.normalize.call(void 0, h):void 0}catch (e2){}},[h]),j=_wagmi.useEnsAvatar.call(void 0, {name:K});return _jsxruntime.jsx.call(void 0, D.Provider,{value:{flags:{disableEip5792:!!i,disable5792Upgrade:!!t},walletClient:U,onSmartAccountRejection:()=>{_optionalChain([b, 'optionalCall', _11 => _11()])},isEmbeddedWalletsEnabled:_nullishCoalesce(g.embeddedWallets, () => (!0)),isConnecting:a,isConnected:!!c&&!!U,DebugConnectButton:m,account:l&&s&&c?{connectionId:u,chainId:s,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(j.data, () => (null)),has7702Authorization:J,isContract:q}}:void 0,connect:y,openConnectModal:async()=>{await W()},disconnect:()=>{O(),p()},defaultChainId:r.id},children:_jsxruntime.jsx.call(void 0, N,{address:c,defaultChainId:r.id,children:e})})}function Ce(){let{account:e,isConnected:n}=f();return{...e,isConnected:n}}function be({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 Ye(e){let{defaultChainId:n}=E(),{chainId:i,...t}=_nullishCoalesce(e, () => ({}));return _wagmi.usePublicClient.call(void 0, {chainId:_nullishCoalesce(i, () => (n)),...t})}exports.a = E; exports.b = Ce; exports.c = be; exports.d = Ye; 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 = _e;
|