@berachain/wagmi 0.4.0-beta.5 → 0.4.0-beta.7
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-Bcm59a7m.d.cts → BeraWagmi-0-HNcmGS.d.cts} +3 -3
- package/dist/{BeraWagmi-4q0Ls6Dc.d.ts → BeraWagmi-COCKRVoz.d.ts} +3 -3
- package/dist/chunk-EAWOJX7K.mjs +1 -0
- package/dist/chunk-IPQBC7RQ.cjs +1 -0
- package/dist/chunk-MZZ62TKM.mjs +1 -0
- package/dist/chunk-PVMPBWIG.cjs +1 -0
- package/dist/config/index.cjs +1 -1
- package/dist/config/index.d.cts +2 -1
- package/dist/config/index.d.ts +2 -1
- package/dist/config/index.mjs +1 -1
- 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/core/index.cjs +1 -1
- package/dist/core/index.d.cts +1 -2
- package/dist/core/index.d.ts +1 -2
- package/dist/core/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.d.cts +1 -0
- package/dist/hooks/thirdweb/index.d.ts +1 -0
- package/package.json +3 -3
- package/src/config/defaultWagmiConfig.ts +3 -5
- package/src/context/BeraWagmi.tsx +3 -5
- package/src/context/useThirdweb.tsx +28 -14
- package/src/core/index.ts +7 -1
- package/dist/chunk-HDH4V7DJ.cjs +0 -1
- package/dist/chunk-PPRCI25K.mjs +0 -1
- package/dist/chunk-YD5OWUSZ.mjs +0 -1
- package/dist/chunk-ZCJIFG7W.cjs +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { Profile,
|
|
2
|
+
import { Profile, SingleStepAuthArgsType, 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';
|
|
@@ -62,7 +62,7 @@ interface BeraWagmiApi {
|
|
|
62
62
|
/**
|
|
63
63
|
* Connects a wallet using a specific strategy.
|
|
64
64
|
*/
|
|
65
|
-
connect(args:
|
|
65
|
+
connect(args: SingleStepAuthArgsType): Promise<Wallet | null> | undefined;
|
|
66
66
|
disconnect(): void;
|
|
67
67
|
/**
|
|
68
68
|
* A callback that is called when a smart account upgrade is rejected.
|
|
@@ -100,7 +100,7 @@ interface IBeraWagmiProviderProps extends PropsWithChildren {
|
|
|
100
100
|
* This is not triggered when a wallet connect automatically after a refresh.
|
|
101
101
|
*/
|
|
102
102
|
onConnectedWallet?: () => void;
|
|
103
|
-
chains
|
|
103
|
+
chains?: Chain[];
|
|
104
104
|
defaultChain: Chain;
|
|
105
105
|
thirdweb: ThirdwebConfig;
|
|
106
106
|
publicJsonRpcUrl?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { Profile,
|
|
2
|
+
import { Profile, SingleStepAuthArgsType, 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';
|
|
@@ -62,7 +62,7 @@ interface BeraWagmiApi {
|
|
|
62
62
|
/**
|
|
63
63
|
* Connects a wallet using a specific strategy.
|
|
64
64
|
*/
|
|
65
|
-
connect(args:
|
|
65
|
+
connect(args: SingleStepAuthArgsType): Promise<Wallet | null> | undefined;
|
|
66
66
|
disconnect(): void;
|
|
67
67
|
/**
|
|
68
68
|
* A callback that is called when a smart account upgrade is rejected.
|
|
@@ -100,7 +100,7 @@ interface IBeraWagmiProviderProps extends PropsWithChildren {
|
|
|
100
100
|
* This is not triggered when a wallet connect automatically after a refresh.
|
|
101
101
|
*/
|
|
102
102
|
onConnectedWallet?: () => void;
|
|
103
|
-
chains
|
|
103
|
+
chains?: Chain[];
|
|
104
104
|
defaultChain: Chain;
|
|
105
105
|
thirdweb: ThirdwebConfig;
|
|
106
106
|
publicJsonRpcUrl?: string;
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -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: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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{inAppWalletConnector as W}from"@thirdweb-dev/wagmi-adapter";import{createThirdwebClient as g}from"thirdweb";import{createWallet as t,getInstalledWallets as C,inAppWallet as b}from"thirdweb/wallets";import{createConfig as u,createStorage as h}from"wagmi";function T({thirdweb:e,transports:i={},defaultChain:n,chains:r=[]}){let l=g({clientId:e.clientId}),s=!!n.contracts?.multicall3,a={mode:"EIP7702",sponsorGas:e.sponsorGas},d=b({executionMode:a}),o=[...C(),t("io.rabby"),t("io.metamask"),t("com.coinbase.wallet"),t("walletConnect")].filter((c,p,m)=>m.findIndex(f=>f.id===c.id)===p);return{hasEmbeddedWallets:e.embeddedWallets,wallets:e.embeddedWallets?[d,...o]:o,executionMode:a,client:l,wagmi:u({chains:[n,...r],ssr:!0,connectors:[W({client:l,executionMode:a})],storage:h({key:"wagmi-berachain-thirdweb",storage:typeof window<"u"?localStorage:void 0}),batch:{multicall:s?{wait:15}:void 0},transports:i})}}export{T as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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 _wagmiadapter = require('@thirdweb-dev/wagmi-adapter');var _thirdweb = require('thirdweb');var _wallets = require('thirdweb/wallets');var _wagmi = require('wagmi');function T({thirdweb:e,transports:i={},defaultChain:n,chains:r=[]}){let l=_thirdweb.createThirdwebClient.call(void 0, {clientId:e.clientId}),s=!!_optionalChain([n, 'access', _ => _.contracts, 'optionalAccess', _2 => _2.multicall3]),a={mode:"EIP7702",sponsorGas:e.sponsorGas},d=_wallets.inAppWallet.call(void 0, {executionMode:a}),o=[..._wallets.getInstalledWallets.call(void 0, ),_wallets.createWallet.call(void 0, "io.rabby"),_wallets.createWallet.call(void 0, "io.metamask"),_wallets.createWallet.call(void 0, "com.coinbase.wallet"),_wallets.createWallet.call(void 0, "walletConnect")].filter((c,p,m)=>m.findIndex(f=>f.id===c.id)===p);return{hasEmbeddedWallets:e.embeddedWallets,wallets:e.embeddedWallets?[d,...o]:o,executionMode:a,client:l,wagmi:_wagmi.createConfig.call(void 0, {chains:[n,...r],ssr:!0,connectors:[_wagmiadapter.inAppWalletConnector.call(void 0, {client:l,executionMode:a})],storage:_wagmi.createStorage.call(void 0, {key:"wagmi-berachain-thirdweb",storage:typeof window<"u"?localStorage:void 0}),batch:{multicall:s?{wait:15}:void 0},transports:i})}}exports.a = T;
|
package/dist/config/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 _chunkPVMPBWIGcjs = require('../chunk-PVMPBWIG.cjs');exports.getConfig = _chunkPVMPBWIGcjs.a;
|
package/dist/config/index.d.cts
CHANGED
|
@@ -14,6 +14,7 @@ interface BeraWagmiConfig {
|
|
|
14
14
|
chains?: Chain[];
|
|
15
15
|
defaultChain: Chain;
|
|
16
16
|
}
|
|
17
|
+
type InAppWallet = Wallet<"inApp">;
|
|
17
18
|
declare function getConfig({ thirdweb, transports, defaultChain: chain, chains, }: BeraWagmiConfig): {
|
|
18
19
|
hasEmbeddedWallets: boolean | undefined;
|
|
19
20
|
wallets: Wallet[];
|
|
@@ -25,4 +26,4 @@ declare function getConfig({ thirdweb, transports, defaultChain: chain, chains,
|
|
|
25
26
|
wagmi: Config;
|
|
26
27
|
};
|
|
27
28
|
|
|
28
|
-
export { type BeraWagmiConfig, type ThirdwebConfig, getConfig };
|
|
29
|
+
export { type BeraWagmiConfig, type InAppWallet, type ThirdwebConfig, getConfig };
|
package/dist/config/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ interface BeraWagmiConfig {
|
|
|
14
14
|
chains?: Chain[];
|
|
15
15
|
defaultChain: Chain;
|
|
16
16
|
}
|
|
17
|
+
type InAppWallet = Wallet<"inApp">;
|
|
17
18
|
declare function getConfig({ thirdweb, transports, defaultChain: chain, chains, }: BeraWagmiConfig): {
|
|
18
19
|
hasEmbeddedWallets: boolean | undefined;
|
|
19
20
|
wallets: Wallet[];
|
|
@@ -25,4 +26,4 @@ declare function getConfig({ thirdweb, transports, defaultChain: chain, chains,
|
|
|
25
26
|
wagmi: Config;
|
|
26
27
|
};
|
|
27
28
|
|
|
28
|
-
export { type BeraWagmiConfig, type ThirdwebConfig, getConfig };
|
|
29
|
+
export { type BeraWagmiConfig, type InAppWallet, type ThirdwebConfig, getConfig };
|
package/dist/config/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o}from"../chunk-
|
|
1
|
+
import{a as o}from"../chunk-MZZ62TKM.mjs";export{o as getConfig};
|
package/dist/context/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";var _chunkPVMPBWIGcjs = require('../chunk-PVMPBWIG.cjs');var _chunkIPQBC7RQcjs = require('../chunk-IPQBC7RQ.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, _chunkIPQBC7RQcjs.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-0-HNcmGS.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-COCKRVoz.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-
|
|
1
|
+
"use client";import{a as m}from"../chunk-MZZ62TKM.mjs";import{m as a}from"../chunk-EAWOJX7K.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/core/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _core = require('@wagmi/core');exports.getConnectorClient = _core.getConnectorClient; exports.getWalletClient = _core.getWalletClient; exports.switchChain = _core.switchChain;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _core = require('@wagmi/core');exports.getConnectorClient = _core.getConnectorClient; exports.getPublicClient = _core.getPublicClient; exports.getWalletClient = _core.getWalletClient; exports.switchChain = _core.switchChain;
|
package/dist/core/index.d.cts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { getConnectorClient, getWalletClient, switchChain } from '@wagmi/core';
|
|
2
|
-
import 'thirdweb/react';
|
|
1
|
+
export { Config, getConnectorClient, getPublicClient, getWalletClient, switchChain } from '@wagmi/core';
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { getConnectorClient, getWalletClient, switchChain } from '@wagmi/core';
|
|
2
|
-
import 'thirdweb/react';
|
|
1
|
+
export { Config, getConnectorClient, getPublicClient, getWalletClient, switchChain } from '@wagmi/core';
|
package/dist/core/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getConnectorClient as n,getWalletClient as
|
|
1
|
+
import{getConnectorClient as i,getPublicClient as n,getWalletClient as l,switchChain as C}from"@wagmi/core";export{i as getConnectorClient,n as getPublicClient,l as getWalletClient,C as switchChain};
|
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 _chunkIPQBC7RQcjs = require('../chunk-IPQBC7RQ.cjs');exports.useBeraAccount = _chunkIPQBC7RQcjs.b; exports.useBeraWagmi = _chunkIPQBC7RQcjs.l; exports.useBeraWallet = _chunkIPQBC7RQcjs.a; exports.useBlockNumber = _chunkIPQBC7RQcjs.e; exports.useCapabilities = _chunkIPQBC7RQcjs.c; exports.useChains = _chunkIPQBC7RQcjs.f; exports.useConfig = _chunkIPQBC7RQcjs.g; exports.useEnsAvatar = _chunkIPQBC7RQcjs.h; exports.useEnsName = _chunkIPQBC7RQcjs.i; exports.usePublicClient = _chunkIPQBC7RQcjs.d; exports.useSwitchChain = _chunkIPQBC7RQcjs.j; exports.useTransactionReceipt = _chunkIPQBC7RQcjs.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-0-HNcmGS.cjs';
|
|
4
|
+
export { u as useBeraWagmi } from '../BeraWagmi-0-HNcmGS.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-COCKRVoz.js';
|
|
4
|
+
export { u as useBeraWagmi } from '../BeraWagmi-COCKRVoz.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-EAWOJX7K.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.0-beta.
|
|
3
|
+
"version": "0.4.0-beta.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"author": "Berachain",
|
|
42
42
|
"license": "MIT",
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@thirdweb-dev/wagmi-adapter": "0.2.
|
|
44
|
+
"@thirdweb-dev/wagmi-adapter": "0.2.207",
|
|
45
45
|
"@wagmi/core": "2.22.1",
|
|
46
46
|
"swr": "2.3.3",
|
|
47
|
-
"thirdweb": "5.
|
|
47
|
+
"thirdweb": "5.119.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@types/node": "24.1.0",
|
|
@@ -23,6 +23,8 @@ export interface BeraWagmiConfig {
|
|
|
23
23
|
defaultChain: Chain;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
export type InAppWallet = Wallet<"inApp">;
|
|
27
|
+
|
|
26
28
|
export function getConfig({
|
|
27
29
|
thirdweb,
|
|
28
30
|
transports = {},
|
|
@@ -40,12 +42,8 @@ export function getConfig({
|
|
|
40
42
|
sponsorGas: thirdweb.sponsorGas,
|
|
41
43
|
} as const satisfies NonNullable<InAppWalletCreationOptions>["executionMode"];
|
|
42
44
|
|
|
43
|
-
const thirdwebWallet:
|
|
45
|
+
const thirdwebWallet: InAppWallet = inAppWallet({
|
|
44
46
|
executionMode,
|
|
45
|
-
auth: {
|
|
46
|
-
options: ["google", "apple"],
|
|
47
|
-
mode: "popup",
|
|
48
|
-
},
|
|
49
47
|
});
|
|
50
48
|
|
|
51
49
|
const installedWallets = getInstalledWallets();
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
useMemo,
|
|
6
6
|
} from "react";
|
|
7
7
|
import useSWRImmutable from "swr/immutable";
|
|
8
|
-
import type { Profile,
|
|
8
|
+
import type { Profile, SingleStepAuthArgsType, Wallet } from "thirdweb/wallets";
|
|
9
9
|
import type { Address, Chain } from "viem";
|
|
10
10
|
import { normalize } from "viem/ens";
|
|
11
11
|
import {
|
|
@@ -89,9 +89,7 @@ export interface BeraWagmiApi {
|
|
|
89
89
|
/**
|
|
90
90
|
* Connects a wallet using a specific strategy.
|
|
91
91
|
*/
|
|
92
|
-
connect(
|
|
93
|
-
args: Omit<WalletConnectionOption<"inApp">, "client">,
|
|
94
|
-
): Promise<void> | void;
|
|
92
|
+
connect(args: SingleStepAuthArgsType): Promise<Wallet | null> | undefined;
|
|
95
93
|
disconnect(): void;
|
|
96
94
|
/**
|
|
97
95
|
* A callback that is called when a smart account upgrade is rejected.
|
|
@@ -134,7 +132,7 @@ export interface IBeraWagmiProviderProps extends PropsWithChildren {
|
|
|
134
132
|
* This is not triggered when a wallet connect automatically after a refresh.
|
|
135
133
|
*/
|
|
136
134
|
onConnectedWallet?: () => void;
|
|
137
|
-
chains
|
|
135
|
+
chains?: Chain[];
|
|
138
136
|
defaultChain: Chain;
|
|
139
137
|
thirdweb: ThirdwebConfig;
|
|
140
138
|
publicJsonRpcUrl?: string;
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
useActiveWallet,
|
|
8
8
|
useAutoConnect,
|
|
9
9
|
useProfiles,
|
|
10
|
+
useConnect as useTwConnect,
|
|
10
11
|
useConnectModal as useTwConnectModal,
|
|
11
12
|
useDisconnect as useTwDisconnect,
|
|
12
13
|
useWalletInfo,
|
|
@@ -20,7 +21,7 @@ import type {
|
|
|
20
21
|
import type { Chain } from "viem";
|
|
21
22
|
import { useConnect } from "wagmi";
|
|
22
23
|
|
|
23
|
-
import type { getConfig } from "~/config";
|
|
24
|
+
import type { getConfig, InAppWallet } from "~/config";
|
|
24
25
|
import type { BeraWagmiApi } from "./BeraWagmi";
|
|
25
26
|
|
|
26
27
|
export function useThirdweb({
|
|
@@ -28,8 +29,10 @@ export function useThirdweb({
|
|
|
28
29
|
theme,
|
|
29
30
|
chains = [],
|
|
30
31
|
chain,
|
|
32
|
+
onConnectedWallet,
|
|
31
33
|
publicJsonRpcUrl = chain.rpcUrls.default.http[0],
|
|
32
34
|
}: {
|
|
35
|
+
onConnectedWallet?: () => void;
|
|
33
36
|
config: ReturnType<typeof getConfig>;
|
|
34
37
|
theme: "light" | "dark" | "auto" | undefined;
|
|
35
38
|
chains?: Chain[];
|
|
@@ -55,6 +58,7 @@ export function useThirdweb({
|
|
|
55
58
|
const activeAccount = useActiveAccount(); // thirdweb
|
|
56
59
|
const { disconnect: disconnectThirdweb } = useTwDisconnect();
|
|
57
60
|
const { data: walletInfo } = useWalletInfo(activeWallet?.id);
|
|
61
|
+
const { connect: twConnect } = useTwConnect();
|
|
58
62
|
|
|
59
63
|
const { data: profiles } = useProfiles({ client: config.client });
|
|
60
64
|
|
|
@@ -119,26 +123,35 @@ export function useThirdweb({
|
|
|
119
123
|
const { connect: twConnectModal } = useTwConnectModal();
|
|
120
124
|
|
|
121
125
|
return {
|
|
122
|
-
|
|
126
|
+
connect(args) {
|
|
123
127
|
if (!config.hasEmbeddedWallets) {
|
|
124
128
|
console.error(
|
|
125
129
|
"useBeraWagmi.connect: this function is not available if embedded wallets are disabled",
|
|
126
130
|
);
|
|
127
131
|
return;
|
|
128
132
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
133
|
+
return twConnect(async () => {
|
|
134
|
+
// this must be called inside twConnect or it won't work for social login wallets
|
|
135
|
+
const wallet = config.wallets.find(
|
|
136
|
+
(w) => w.id === "inApp",
|
|
137
|
+
) as InAppWallet;
|
|
138
|
+
|
|
139
|
+
if (!wallet) {
|
|
140
|
+
console.error("useBeraWagmi.connect: no inApp wallet found");
|
|
141
|
+
throw new Error("no inApp wallet found");
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return wallet
|
|
145
|
+
.connect({
|
|
146
|
+
...connectOptions,
|
|
147
|
+
...args,
|
|
148
|
+
})
|
|
149
|
+
.then(() => {
|
|
150
|
+
onConnectedWallet?.();
|
|
151
|
+
syncConnectedWallet(wallet);
|
|
152
|
+
return wallet;
|
|
153
|
+
});
|
|
140
154
|
});
|
|
141
|
-
await syncConnectedWallet(wallet);
|
|
142
155
|
},
|
|
143
156
|
async openConnectModal() {
|
|
144
157
|
const wallet = await twConnectModal({
|
|
@@ -159,6 +172,7 @@ export function useThirdweb({
|
|
|
159
172
|
],
|
|
160
173
|
}); // opens the connect modal
|
|
161
174
|
|
|
175
|
+
onConnectedWallet?.();
|
|
162
176
|
await syncConnectedWallet(wallet);
|
|
163
177
|
},
|
|
164
178
|
disconnect() {
|
package/src/core/index.ts
CHANGED
package/dist/chunk-HDH4V7DJ.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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 _wagmiadapter = require('@thirdweb-dev/wagmi-adapter');var _thirdweb = require('thirdweb');var _wallets = require('thirdweb/wallets');var _wagmi = require('wagmi');function A({thirdweb:e,transports:i={},defaultChain:n,chains:r=[]}){let o=_thirdweb.createThirdwebClient.call(void 0, {clientId:e.clientId}),s=!!_optionalChain([n, 'access', _ => _.contracts, 'optionalAccess', _2 => _2.multicall3]),a={mode:"EIP7702",sponsorGas:e.sponsorGas},d=_wallets.inAppWallet.call(void 0, {executionMode:a,auth:{options:["google","apple"],mode:"popup"}}),l=[..._wallets.getInstalledWallets.call(void 0, ),_wallets.createWallet.call(void 0, "io.rabby"),_wallets.createWallet.call(void 0, "io.metamask"),_wallets.createWallet.call(void 0, "com.coinbase.wallet"),_wallets.createWallet.call(void 0, "walletConnect")].filter((p,c,m)=>m.findIndex(f=>f.id===p.id)===c);return{hasEmbeddedWallets:e.embeddedWallets,wallets:e.embeddedWallets?[d,...l]:l,executionMode:a,client:o,wagmi:_wagmi.createConfig.call(void 0, {chains:[n,...r],ssr:!0,connectors:[_wagmiadapter.inAppWalletConnector.call(void 0, {client:o,executionMode:a})],storage:_wagmi.createStorage.call(void 0, {key:"wagmi-berachain-thirdweb",storage:typeof window<"u"?localStorage:void 0}),batch:{multicall:s?{wait:15}:void 0},transports:i})}}exports.a = A;
|
package/dist/chunk-PPRCI25K.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
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};
|
package/dist/chunk-YD5OWUSZ.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{inAppWalletConnector as g}from"@thirdweb-dev/wagmi-adapter";import{createThirdwebClient as C}from"thirdweb";import{createWallet as t,getInstalledWallets as u,inAppWallet as W}from"thirdweb/wallets";import{createConfig as b,createStorage as h}from"wagmi";function A({thirdweb:e,transports:i={},defaultChain:n,chains:r=[]}){let o=C({clientId:e.clientId}),s=!!n.contracts?.multicall3,a={mode:"EIP7702",sponsorGas:e.sponsorGas},d=W({executionMode:a,auth:{options:["google","apple"],mode:"popup"}}),l=[...u(),t("io.rabby"),t("io.metamask"),t("com.coinbase.wallet"),t("walletConnect")].filter((p,c,m)=>m.findIndex(f=>f.id===p.id)===c);return{hasEmbeddedWallets:e.embeddedWallets,wallets:e.embeddedWallets?[d,...l]:l,executionMode:a,client:o,wagmi:b({chains:[n,...r],ssr:!0,connectors:[g({client:o,executionMode:a})],storage:h({key:"wagmi-berachain-thirdweb",storage:typeof window<"u"?localStorage:void 0}),batch:{multicall:s?{wait:15}:void 0},transports:i})}}export{A as a};
|
package/dist/chunk-ZCJIFG7W.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: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;
|