@berachain/wagmi 0.4.0-beta.1 → 0.4.0-beta.3
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-CGaPo4Jy.d.cts → BeraWagmi-BdZ9nENq.d.cts} +5 -8
- package/dist/{BeraWagmi-DygXBvcd.d.ts → BeraWagmi-ByydBpB4.d.ts} +5 -8
- package/dist/chunk-2DC2R4UF.mjs +1 -0
- package/dist/chunk-52QNT47H.cjs +1 -0
- package/dist/chunk-HDH4V7DJ.cjs +1 -0
- package/dist/chunk-YD5OWUSZ.mjs +1 -0
- package/dist/config/index.cjs +1 -1
- package/dist/config/index.d.cts +2 -2
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.mjs +1 -1
- package/dist/context/index.cjs +1 -1
- package/dist/context/index.d.cts +2 -2
- package/dist/context/index.d.ts +2 -2
- package/dist/context/index.mjs +1 -1
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.cts +3 -3
- package/dist/hooks/index.d.ts +3 -3
- package/dist/hooks/index.mjs +1 -1
- package/dist/hooks/thirdweb/index.cjs +1 -1
- package/dist/hooks/thirdweb/index.d.cts +1 -1
- package/dist/hooks/thirdweb/index.d.ts +1 -1
- package/dist/hooks/thirdweb/index.mjs +1 -1
- package/package.json +1 -1
- package/src/config/defaultWagmiConfig.ts +6 -1
- package/src/context/BeraWagmi.tsx +7 -10
- package/src/context/useThirdweb.tsx +17 -4
- package/src/hooks/thirdweb/index.ts +1 -0
- package/dist/chunk-CO26JY24.mjs +0 -1
- package/dist/chunk-SGIUHS4G.mjs +0 -1
- package/dist/chunk-SMQG24G3.cjs +0 -1
- package/dist/chunk-YQS2GSB4.cjs +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { WalletConnectionOption } from 'thirdweb/wallets';
|
|
2
3
|
import { Address, Chain } from 'viem';
|
|
3
4
|
import { UseWalletClientReturnType } from 'wagmi';
|
|
4
5
|
import { getConfig, ThirdwebConfig } from './config/index.cjs';
|
|
@@ -8,7 +9,7 @@ interface BeraWagmiApi {
|
|
|
8
9
|
/**
|
|
9
10
|
* @deprecated used for prototyping only.
|
|
10
11
|
*/
|
|
11
|
-
DebugConnectButton
|
|
12
|
+
DebugConnectButton(): React.ReactNode;
|
|
12
13
|
/**
|
|
13
14
|
* Account connected to berachain dapp. It might include some additional data once embedded wallets are enabled.
|
|
14
15
|
*/
|
|
@@ -56,22 +57,18 @@ interface BeraWagmiApi {
|
|
|
56
57
|
disable5792Upgrade: boolean;
|
|
57
58
|
};
|
|
58
59
|
walletClient: UseWalletClientReturnType["data"];
|
|
59
|
-
openConnectModal
|
|
60
|
+
openConnectModal(): Promise<void> | void;
|
|
60
61
|
/**
|
|
61
62
|
* Connects a wallet using a specific strategy.
|
|
62
|
-
*
|
|
63
|
-
* @param strategy - The strategy to use to connect the wallet.
|
|
64
63
|
*/
|
|
65
|
-
connect:
|
|
66
|
-
strategy: "google" | "apple";
|
|
67
|
-
}) => Promise<void> | void;
|
|
64
|
+
connect(args: Omit<WalletConnectionOption<"inApp">, "client">): Promise<void> | void;
|
|
68
65
|
disconnect(): void;
|
|
69
66
|
/**
|
|
70
67
|
* A callback that is called when a smart account upgrade is rejected.
|
|
71
68
|
*
|
|
72
69
|
* This is used to disable EIP-5792 temporarily.
|
|
73
70
|
*/
|
|
74
|
-
onSmartAccountRejection
|
|
71
|
+
onSmartAccountRejection(): void;
|
|
75
72
|
/**
|
|
76
73
|
* List of external chains that are whitelisted for that app.
|
|
77
74
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { WalletConnectionOption } from 'thirdweb/wallets';
|
|
2
3
|
import { Address, Chain } from 'viem';
|
|
3
4
|
import { UseWalletClientReturnType } from 'wagmi';
|
|
4
5
|
import { getConfig, ThirdwebConfig } from './config/index.js';
|
|
@@ -8,7 +9,7 @@ interface BeraWagmiApi {
|
|
|
8
9
|
/**
|
|
9
10
|
* @deprecated used for prototyping only.
|
|
10
11
|
*/
|
|
11
|
-
DebugConnectButton
|
|
12
|
+
DebugConnectButton(): React.ReactNode;
|
|
12
13
|
/**
|
|
13
14
|
* Account connected to berachain dapp. It might include some additional data once embedded wallets are enabled.
|
|
14
15
|
*/
|
|
@@ -56,22 +57,18 @@ interface BeraWagmiApi {
|
|
|
56
57
|
disable5792Upgrade: boolean;
|
|
57
58
|
};
|
|
58
59
|
walletClient: UseWalletClientReturnType["data"];
|
|
59
|
-
openConnectModal
|
|
60
|
+
openConnectModal(): Promise<void> | void;
|
|
60
61
|
/**
|
|
61
62
|
* Connects a wallet using a specific strategy.
|
|
62
|
-
*
|
|
63
|
-
* @param strategy - The strategy to use to connect the wallet.
|
|
64
63
|
*/
|
|
65
|
-
connect:
|
|
66
|
-
strategy: "google" | "apple";
|
|
67
|
-
}) => Promise<void> | void;
|
|
64
|
+
connect(args: Omit<WalletConnectionOption<"inApp">, "client">): Promise<void> | void;
|
|
68
65
|
disconnect(): void;
|
|
69
66
|
/**
|
|
70
67
|
* A callback that is called when a smart account upgrade is rejected.
|
|
71
68
|
*
|
|
72
69
|
* This is used to disable EIP-5792 temporarily.
|
|
73
70
|
*/
|
|
74
|
-
onSmartAccountRejection
|
|
71
|
+
onSmartAccountRejection(): void;
|
|
75
72
|
/**
|
|
76
73
|
* List of external chains that are whitelisted for that app.
|
|
77
74
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{usePublicClient as ge}from"wagmi";import{useContext as Q}from"react";import{createContext as G}from"react";import{jsx as H}from"react/jsx-runtime";var x=G(void 0);function U({children:e,address:n,defaultChainId:o}){return H(x.Provider,{value:{address:n,defaultChainId:o},children:e})}function I(){let e=Q(x);if(!e)throw new Error("LightweightAccountContext not found");let{address:n,defaultChainId:o}=e;return{isConnected:!!n,address:n,defaultChainId:o}}import{useBlockNumber as Ye,useChains as Ze,useConfig as $e,useEnsAvatar as k,useEnsName as z,useSwitchChain as et,useTransactionReceipt as tt}from"wagmi";import{createContext as ie,useContext as ae,useMemo as E}from"react";import re from"swr/immutable";import{normalize as se}from"viem/ens";import{useAccount as ce,useDisconnect as de,usePublicClient as le,useWalletClient as ue}from"wagmi";import{useMemo as M}from"react";import{defineChain as N}from"thirdweb";import{ConnectButton as V,useActiveAccount as X,useActiveWallet as Y,useAutoConnect as Z,useConnectModal as $,useDisconnect as ee,useWalletInfo as te}from"thirdweb/react";import{useConnect as ne}from"wagmi";import{jsx as oe}from"react/jsx-runtime";function R({config:e,theme:n,chains:o,chain:t,publicJsonRpcUrl:l=t.rpcUrls.default.http[0]}){let{connectors:h,connect:b}=ne(),r=Y(),s=X(),{disconnect:w}=ee(),{data:C}=te(r?.id),u=M(()=>N({id:t.id,blockExplorers:t.blockExplorers,blockTime:t.blockTime,ensTlds:t.ensTlds,testnet:t.testnet,contracts:t.contracts,nativeCurrency:t.nativeCurrency,name:t.name,rpcUrls:{default:{http:[l]}}}),[l,t]),p={client:e.client,chain:u,wallets:e.wallets};async function m(a){let i=h.find(c=>c.id==="in-app-wallet");if(i){let c={withCapabilities:!0,wallet:a};b({connector:i,chainId:t.id,...c})}else console.error("no tw connector found")}let{isLoading:A}=Z({...p,onConnect:m}),W=M(()=>crypto.randomUUID(),[r?.id,s?.address]),{connect:v}=$();return{async connect({strategy:a}){if(!e.hasEmbeddedWallets){console.error("useBeraWagmi.connect: this function is not available if embedded wallets are disabled");return}let i=e.wallets.find(c=>c.id==="inApp");if(!i){console.error("useBeraWagmi.connect: no inApp wallet found");return}await i.connect({...p,strategy:a}),await m(i)},async openConnectModal(){let a=await v({...p,wallets:e.wallets,theme:n==="auto"?void 0:n,size:"compact",chains:[u,...o.map(i=>N({id:i.id}))]});await m(a)},disconnect(){r&&w(r)},isConnecting:A,connectionId:W,connectorName:C?.name??null,isEmbeddedWallet:C?.id==="inApp",wallet:s,DebugConnectButton(){return oe(V,{...p,connectModal:{size:"compact"},onConnect:a=>m(a)})}}}import{jsx as L}from"react/jsx-runtime";function f(){let e=ae(D);if(!e)throw new Error("BeraWagmiContext not found");return e}var D=ie(void 0);function De({children:e,config:n,flags:{disableEip5792:o,disable5792Upgrade:t,accountOverride:l}={},theme:h,onSmartAccountRejection:b,chains:r,defaultChain:s,thirdweb:w,publicJsonRpcUrl:C}){let{wallet:u,openConnectModal:p,connect:m,DebugConnectButton:A,connectionId:W,disconnect:v,connectorName:a,isEmbeddedWallet:i,isConnecting:c}=R({config:n,theme:h,chains:r,chain:s,publicJsonRpcUrl:C}),{address:y,chainId:P}=ce(),{disconnect:O}=de(),S=le(),d=E(()=>{if(!(!y||!u))return l??y},[l,y,u]),{data:g}=z({config:n.wagmi,chainId:s.id,address:d}),{data:B}=re(d?["BeraWagmiProvider_code",d,P]:null,([j,F,he])=>S?.getCode({address:F}),{refreshInterval:6e4}),[_,q]=E(()=>B?B.startsWith("0xef01")?[!1,!0]:[!0,!1]:[!1,!1],[B]),{data:T}=ue(),J=E(()=>{try{return g?se(g):void 0}catch{}},[g]),K=k({name:J});return L(D.Provider,{value:{flags:{disableEip5792:!!o,disable5792Upgrade:!!t},walletClient:T,onSmartAccountRejection:()=>{b?.()},isEmbeddedWalletsEnabled:w.embeddedWallets??!0,isConnecting:c,isConnected:!!d&&!!T,DebugConnectButton:A,account:u&&P&&d?{connectionId:W,chainId:P,connectorName:a,isEmbeddedWallet:i,wallet:{address:d,ensName:g?.replace(".bera",".\u{1F43B}\u26D3\uFE0F")??null,ensAvatar:K.data??null,has7702Authorization:q,isContract:_}}:void 0,connect:m,openConnectModal:async()=>{console.log("openConnectModal.called"),await p()},disconnect:()=>{O(),v()},chains:r,defaultChainId:s.id},children:L(U,{address:d,defaultChainId:s.id,children:e})})}function pe(){let{account:e,isConnected:n}=f();return{...e,isConnected:n}}import{useMemo as me}from"react";import{useCapabilities as fe}from"wagmi";function Ce({chainId:e}){let{flags:n,account:o}=f(),{data:t}=fe({account:o?.wallet?.address,scopeKey:o?.connectionId,query:{retry:3},chainId:e});return{supportsAtomic:me(()=>n.disableEip5792||!t?!1:t?.atomic?.status==="supported"||!n.disable5792Upgrade&&t?.atomic?.status==="ready",[t,n.disableEip5792,n.disable5792Upgrade,e]),capabilities:t}}function Qe(e){let{defaultChainId:n}=I(),{chainId:o,...t}=e??{};return ge({chainId:o??n,...t})}export{I as a,pe as b,Ce as c,Qe as d,Ye as e,Ze as f,$e as g,k as h,z as i,et as j,tt as k,f as l,De as m};
|
|
@@ -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 x=_react.createContext.call(void 0, void 0);function U({children:e,address:n,defaultChainId:o}){return _jsxruntime.jsx.call(void 0, x.Provider,{value:{address:n,defaultChainId:o},children:e})}function I(){let e=_react.useContext.call(void 0, x);if(!e)throw new Error("LightweightAccountContext not found");let{address:n,defaultChainId:o}=e;return{isConnected:!!n,address:n,defaultChainId:o}}var _immutable = require('swr/immutable'); var _immutable2 = _interopRequireDefault(_immutable);var _ens = require('viem/ens');var _thirdweb = require('thirdweb');var _react3 = require('thirdweb/react');function R({config:e,theme:n,chains:o,chain:t,publicJsonRpcUrl:l=t.rpcUrls.default.http[0]}){let{connectors:h,connect:b}=_wagmi.useConnect.call(void 0, ),r=_react3.useActiveWallet.call(void 0, ),s=_react3.useActiveAccount.call(void 0, ),{disconnect:w}=_react3.useDisconnect.call(void 0, ),{data:C}=_react3.useWalletInfo.call(void 0, _optionalChain([r, 'optionalAccess', _2 => _2.id])),u=_react.useMemo.call(void 0, ()=>_thirdweb.defineChain.call(void 0, {id:t.id,blockExplorers:t.blockExplorers,blockTime:t.blockTime,ensTlds:t.ensTlds,testnet:t.testnet,contracts:t.contracts,nativeCurrency:t.nativeCurrency,name:t.name,rpcUrls:{default:{http:[l]}}}),[l,t]),p={client:e.client,chain:u,wallets:e.wallets};async function m(a){let i=h.find(c=>c.id==="in-app-wallet");if(i){let c={withCapabilities:!0,wallet:a};b({connector:i,chainId:t.id,...c})}else console.error("no tw connector found")}let{isLoading:A}=_react3.useAutoConnect.call(void 0, {...p,onConnect:m}),W=_react.useMemo.call(void 0, ()=>crypto.randomUUID(),[_optionalChain([r, 'optionalAccess', _3 => _3.id]),_optionalChain([s, 'optionalAccess', _4 => _4.address])]),{connect:v}=_react3.useConnectModal.call(void 0, );return{async connect({strategy:a}){if(!e.hasEmbeddedWallets){console.error("useBeraWagmi.connect: this function is not available if embedded wallets are disabled");return}let i=e.wallets.find(c=>c.id==="inApp");if(!i){console.error("useBeraWagmi.connect: no inApp wallet found");return}await i.connect({...p,strategy:a}),await m(i)},async openConnectModal(){let a=await v({...p,wallets:e.wallets,theme:n==="auto"?void 0:n,size:"compact",chains:[u,...o.map(i=>_thirdweb.defineChain.call(void 0, {id:i.id}))]});await m(a)},disconnect(){r&&w(r)},isConnecting:A,connectionId:W,connectorName:_nullishCoalesce(_optionalChain([C, 'optionalAccess', _5 => _5.name]), () => (null)),isEmbeddedWallet:_optionalChain([C, 'optionalAccess', _6 => _6.id])==="inApp",wallet:s,DebugConnectButton(){return _jsxruntime.jsx.call(void 0, _react3.ConnectButton,{...p,connectModal:{size:"compact"},onConnect:a=>m(a)})}}}function f(){let e=_react.useContext.call(void 0, D);if(!e)throw new Error("BeraWagmiContext not found");return e}var D=_react.createContext.call(void 0, void 0);function De({children:e,config:n,flags:{disableEip5792:o,disable5792Upgrade:t,accountOverride:l}={},theme:h,onSmartAccountRejection:b,chains:r,defaultChain:s,thirdweb:w,publicJsonRpcUrl:C}){let{wallet:u,openConnectModal:p,connect:m,DebugConnectButton:A,connectionId:W,disconnect:v,connectorName:a,isEmbeddedWallet:i,isConnecting:c}=R({config:n,theme:h,chains:r,chain:s,publicJsonRpcUrl:C}),{address:y,chainId:P}=_wagmi.useAccount.call(void 0, ),{disconnect:O}=_wagmi.useDisconnect.call(void 0, ),S=_wagmi.usePublicClient.call(void 0, ),d=_react.useMemo.call(void 0, ()=>{if(!(!y||!u))return _nullishCoalesce(l, () => (y))},[l,y,u]),{data:g}=_wagmi.useEnsName.call(void 0, {config:n.wagmi,chainId:s.id,address:d}),{data:B}=_immutable2.default.call(void 0, d?["BeraWagmiProvider_code",d,P]:null,([j,F,he])=>_optionalChain([S, 'optionalAccess', _7 => _7.getCode, 'call', _8 => _8({address:F})]),{refreshInterval:6e4}),[_,q]=_react.useMemo.call(void 0, ()=>B?B.startsWith("0xef01")?[!1,!0]:[!0,!1]:[!1,!1],[B]),{data:T}=_wagmi.useWalletClient.call(void 0, ),J=_react.useMemo.call(void 0, ()=>{try{return g?_ens.normalize.call(void 0, g):void 0}catch (e2){}},[g]),K=_wagmi.useEnsAvatar.call(void 0, {name:J});return _jsxruntime.jsx.call(void 0, D.Provider,{value:{flags:{disableEip5792:!!o,disable5792Upgrade:!!t},walletClient:T,onSmartAccountRejection:()=>{_optionalChain([b, 'optionalCall', _9 => _9()])},isEmbeddedWalletsEnabled:_nullishCoalesce(w.embeddedWallets, () => (!0)),isConnecting:c,isConnected:!!d&&!!T,DebugConnectButton:A,account:u&&P&&d?{connectionId:W,chainId:P,connectorName:a,isEmbeddedWallet:i,wallet:{address:d,ensName:_nullishCoalesce(_optionalChain([g, 'optionalAccess', _10 => _10.replace, 'call', _11 => _11(".bera",".\u{1F43B}\u26D3\uFE0F")]), () => (null)),ensAvatar:_nullishCoalesce(K.data, () => (null)),has7702Authorization:q,isContract:_}}:void 0,connect:m,openConnectModal:async()=>{console.log("openConnectModal.called"),await p()},disconnect:()=>{O(),v()},chains:r,defaultChainId:s.id},children:_jsxruntime.jsx.call(void 0, U,{address:d,defaultChainId:s.id,children:e})})}function pe(){let{account:e,isConnected:n}=f();return{...e,isConnected:n}}function Ce({chainId:e}){let{flags:n,account:o}=f(),{data:t}=_wagmi.useCapabilities.call(void 0, {account:_optionalChain([o, 'optionalAccess', _12 => _12.wallet, 'optionalAccess', _13 => _13.address]),scopeKey:_optionalChain([o, 'optionalAccess', _14 => _14.connectionId]),query:{retry:3},chainId:e});return{supportsAtomic:_react.useMemo.call(void 0, ()=>n.disableEip5792||!t?!1:_optionalChain([t, 'optionalAccess', _15 => _15.atomic, 'optionalAccess', _16 => _16.status])==="supported"||!n.disable5792Upgrade&&_optionalChain([t, 'optionalAccess', _17 => _17.atomic, 'optionalAccess', _18 => _18.status])==="ready",[t,n.disableEip5792,n.disable5792Upgrade,e]),capabilities:t}}function Qe(e){let{defaultChainId:n}=I(),{chainId:o,...t}=_nullishCoalesce(e, () => ({}));return _wagmi.usePublicClient.call(void 0, {chainId:_nullishCoalesce(o, () => (n)),...t})}exports.a = I; exports.b = pe; exports.c = Ce; exports.d = Qe; exports.e = _wagmi.useBlockNumber; exports.f = _wagmi.useChains; exports.g = _wagmi.useConfig; exports.h = _wagmi.useEnsAvatar; exports.i = _wagmi.useEnsName; exports.j = _wagmi.useSwitchChain; exports.k = _wagmi.useTransactionReceipt; exports.l = f; exports.m = De;
|
|
@@ -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 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;
|
|
@@ -0,0 +1 @@
|
|
|
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/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 _chunkHDH4V7DJcjs = require('../chunk-HDH4V7DJ.cjs');exports.getConfig = _chunkHDH4V7DJcjs.a;
|
package/dist/config/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as thirdweb from 'thirdweb';
|
|
2
|
-
import
|
|
2
|
+
import { Wallet } from 'thirdweb/wallets';
|
|
3
3
|
import { Transport, Chain } from 'viem';
|
|
4
4
|
import { Config } from 'wagmi';
|
|
5
5
|
|
|
@@ -16,7 +16,7 @@ interface BeraWagmiConfig {
|
|
|
16
16
|
}
|
|
17
17
|
declare function getConfig({ thirdweb, transports, defaultChain: chain, chains, }: BeraWagmiConfig): {
|
|
18
18
|
hasEmbeddedWallets: boolean | undefined;
|
|
19
|
-
wallets:
|
|
19
|
+
wallets: Wallet[];
|
|
20
20
|
executionMode: {
|
|
21
21
|
readonly mode: "EIP7702";
|
|
22
22
|
readonly sponsorGas: boolean | undefined;
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as thirdweb from 'thirdweb';
|
|
2
|
-
import
|
|
2
|
+
import { Wallet } from 'thirdweb/wallets';
|
|
3
3
|
import { Transport, Chain } from 'viem';
|
|
4
4
|
import { Config } from 'wagmi';
|
|
5
5
|
|
|
@@ -16,7 +16,7 @@ interface BeraWagmiConfig {
|
|
|
16
16
|
}
|
|
17
17
|
declare function getConfig({ thirdweb, transports, defaultChain: chain, chains, }: BeraWagmiConfig): {
|
|
18
18
|
hasEmbeddedWallets: boolean | undefined;
|
|
19
|
-
wallets:
|
|
19
|
+
wallets: Wallet[];
|
|
20
20
|
executionMode: {
|
|
21
21
|
readonly mode: "EIP7702";
|
|
22
22
|
readonly sponsorGas: boolean | undefined;
|
package/dist/config/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o}from"../chunk-
|
|
1
|
+
import{a as o}from"../chunk-YD5OWUSZ.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 _chunkHDH4V7DJcjs = require('../chunk-HDH4V7DJ.cjs');var _chunk52QNT47Hcjs = require('../chunk-52QNT47H.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 h({transports:n,defaultChain:e,chains:i,thirdweb:o,...f}){let t=_react.useMemo.call(void 0, ()=>_chunkHDH4V7DJcjs.a.call(void 0, {thirdweb:o,transports:n,defaultChain:e,chains:i}),[e,o,n,i]);return _jsxruntime.jsx.call(void 0, _react3.ThirdwebProvider,{children:_jsxruntime.jsx.call(void 0, _wagmi.WagmiProvider,{config:t.wagmi,reconnectOnMount:!1,children:_jsxruntime.jsx.call(void 0, _reactquery.QueryClientProvider,{client:u,children:_jsxruntime.jsx.call(void 0, _chunk52QNT47Hcjs.m,{...f,thirdweb:o,chains:i,defaultChain:e,config:t})})})})}exports.WagmiProvider = h;
|
package/dist/context/index.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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-BdZ9nENq.cjs';
|
|
4
4
|
import 'react';
|
|
5
|
+
import 'thirdweb/wallets';
|
|
5
6
|
import 'wagmi';
|
|
6
7
|
import '../config/index.cjs';
|
|
7
8
|
import 'thirdweb';
|
|
8
|
-
import 'thirdweb/wallets';
|
|
9
9
|
|
|
10
10
|
type WagmiProviderProps = Omit<IBeraWagmiProviderProps, "config" | "defaultChain"> & {
|
|
11
11
|
transports?: Record<number, Transport>;
|
package/dist/context/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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-ByydBpB4.js';
|
|
4
4
|
import 'react';
|
|
5
|
+
import 'thirdweb/wallets';
|
|
5
6
|
import 'wagmi';
|
|
6
7
|
import '../config/index.js';
|
|
7
8
|
import 'thirdweb';
|
|
8
|
-
import 'thirdweb/wallets';
|
|
9
9
|
|
|
10
10
|
type WagmiProviderProps = Omit<IBeraWagmiProviderProps, "config" | "defaultChain"> & {
|
|
11
11
|
transports?: Record<number, Transport>;
|
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-YD5OWUSZ.mjs";import{m as a}from"../chunk-2DC2R4UF.mjs";import{useMemo as p}from"react";import{QueryClient as d,QueryClientProvider as g}from"@tanstack/react-query";import{ThirdwebProvider as s}from"thirdweb/react";import{WagmiProvider as P}from"wagmi";import{jsx as r}from"react/jsx-runtime";var u=new d;function h({transports:n,defaultChain:e,chains:i,thirdweb:o,...f}){let t=p(()=>m({thirdweb:o,transports:n,defaultChain:e,chains:i}),[e,o,n,i]);return r(s,{children:r(P,{config:t.wagmi,reconnectOnMount:!1,children:r(g,{client:u,children:r(a,{...f,thirdweb:o,chains:i,defaultChain:e,config:t})})})})}export{h 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 _chunk52QNT47Hcjs = require('../chunk-52QNT47H.cjs');exports.useBeraAccount = _chunk52QNT47Hcjs.b; exports.useBeraWagmi = _chunk52QNT47Hcjs.l; exports.useBeraWallet = _chunk52QNT47Hcjs.a; exports.useBlockNumber = _chunk52QNT47Hcjs.e; exports.useCapabilities = _chunk52QNT47Hcjs.c; exports.useChains = _chunk52QNT47Hcjs.f; exports.useConfig = _chunk52QNT47Hcjs.g; exports.useEnsAvatar = _chunk52QNT47Hcjs.h; exports.useEnsName = _chunk52QNT47Hcjs.i; exports.usePublicClient = _chunk52QNT47Hcjs.d; exports.useSwitchChain = _chunk52QNT47Hcjs.j; exports.useTransactionReceipt = _chunk52QNT47Hcjs.k;
|
package/dist/hooks/index.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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-BdZ9nENq.cjs';
|
|
4
|
+
export { u as useBeraWagmi } from '../BeraWagmi-BdZ9nENq.cjs';
|
|
5
5
|
import 'react';
|
|
6
|
+
import 'thirdweb/wallets';
|
|
6
7
|
import 'viem';
|
|
7
8
|
import '../config/index.cjs';
|
|
8
9
|
import 'thirdweb';
|
|
9
|
-
import 'thirdweb/wallets';
|
|
10
10
|
|
|
11
11
|
declare function useBeraAccount(): Partial<NonNullable<BeraWagmiApi["account"]>> & {
|
|
12
12
|
isConnected: boolean;
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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-ByydBpB4.js';
|
|
4
|
+
export { u as useBeraWagmi } from '../BeraWagmi-ByydBpB4.js';
|
|
5
5
|
import 'react';
|
|
6
|
+
import 'thirdweb/wallets';
|
|
6
7
|
import 'viem';
|
|
7
8
|
import '../config/index.js';
|
|
8
9
|
import 'thirdweb';
|
|
9
|
-
import 'thirdweb/wallets';
|
|
10
10
|
|
|
11
11
|
declare function useBeraAccount(): Partial<NonNullable<BeraWagmiApi["account"]>> & {
|
|
12
12
|
isConnected: boolean;
|
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-2DC2R4UF.mjs";export{b as useBeraAccount,l as useBeraWagmi,a as useBeraWallet,e as useBlockNumber,c as useCapabilities,f as useChains,g as useConfig,h as useEnsAvatar,i as useEnsName,d as usePublicClient,j as useSwitchChain,k as useTransactionReceipt};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _react = require('thirdweb/react');exports.useActiveAccount = _react.useActiveAccount; exports.useActiveWallet = _react.useActiveWallet; exports.useWalletInfo = _react.useWalletInfo;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _react = require('thirdweb/react');exports.useActiveAccount = _react.useActiveAccount; exports.useActiveWallet = _react.useActiveWallet; exports.useProfiles = _react.useProfiles; exports.useWalletInfo = _react.useWalletInfo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useActiveAccount, useActiveWallet, useWalletInfo } from 'thirdweb/react';
|
|
1
|
+
export { useActiveAccount, useActiveWallet, useProfiles, useWalletInfo } from 'thirdweb/react';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useActiveAccount, useActiveWallet, useWalletInfo } from 'thirdweb/react';
|
|
1
|
+
export { useActiveAccount, useActiveWallet, useProfiles, useWalletInfo } from 'thirdweb/react';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useActiveAccount as
|
|
1
|
+
import{useActiveAccount as l,useActiveWallet as o,useProfiles as s,useWalletInfo as u}from"thirdweb/react";export{l as useActiveAccount,o as useActiveWallet,s as useProfiles,u as useWalletInfo};
|
package/package.json
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
getInstalledWallets,
|
|
6
6
|
type InAppWalletCreationOptions,
|
|
7
7
|
inAppWallet,
|
|
8
|
+
type Wallet,
|
|
8
9
|
} from "thirdweb/wallets";
|
|
9
10
|
import type { Chain, Transport } from "viem";
|
|
10
11
|
import { type Config, createConfig, createStorage } from "wagmi";
|
|
@@ -41,10 +42,14 @@ export function getConfig({
|
|
|
41
42
|
|
|
42
43
|
const thirdwebWallet: ReturnType<typeof inAppWallet> = inAppWallet({
|
|
43
44
|
executionMode,
|
|
45
|
+
auth: {
|
|
46
|
+
options: ["google", "apple"],
|
|
47
|
+
mode: "popup",
|
|
48
|
+
},
|
|
44
49
|
});
|
|
45
50
|
|
|
46
51
|
const installedWallets = getInstalledWallets();
|
|
47
|
-
const wallets = [
|
|
52
|
+
const wallets: Wallet[] = [
|
|
48
53
|
...installedWallets,
|
|
49
54
|
createWallet("io.rabby"),
|
|
50
55
|
createWallet("io.metamask"),
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
useMemo,
|
|
6
6
|
} from "react";
|
|
7
7
|
import useSWRImmutable from "swr/immutable";
|
|
8
|
+
import type { WalletConnectionOption } from "thirdweb/wallets";
|
|
8
9
|
import type { Address, Chain } from "viem";
|
|
9
10
|
import { normalize } from "viem/ens";
|
|
10
11
|
import {
|
|
@@ -31,7 +32,7 @@ export interface BeraWagmiApi {
|
|
|
31
32
|
/**
|
|
32
33
|
* @deprecated used for prototyping only.
|
|
33
34
|
*/
|
|
34
|
-
DebugConnectButton
|
|
35
|
+
DebugConnectButton(): React.ReactNode;
|
|
35
36
|
/**
|
|
36
37
|
* Account connected to berachain dapp. It might include some additional data once embedded wallets are enabled.
|
|
37
38
|
*/
|
|
@@ -84,24 +85,20 @@ export interface BeraWagmiApi {
|
|
|
84
85
|
disable5792Upgrade: boolean;
|
|
85
86
|
};
|
|
86
87
|
walletClient: UseWalletClientReturnType["data"];
|
|
87
|
-
openConnectModal
|
|
88
|
+
openConnectModal(): Promise<void> | void;
|
|
88
89
|
/**
|
|
89
90
|
* Connects a wallet using a specific strategy.
|
|
90
|
-
*
|
|
91
|
-
* @param strategy - The strategy to use to connect the wallet.
|
|
92
91
|
*/
|
|
93
|
-
connect
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
strategy: "google" | "apple";
|
|
97
|
-
}) => Promise<void> | void;
|
|
92
|
+
connect(
|
|
93
|
+
args: Omit<WalletConnectionOption<"inApp">, "client">,
|
|
94
|
+
): Promise<void> | void;
|
|
98
95
|
disconnect(): void;
|
|
99
96
|
/**
|
|
100
97
|
* A callback that is called when a smart account upgrade is rejected.
|
|
101
98
|
*
|
|
102
99
|
* This is used to disable EIP-5792 temporarily.
|
|
103
100
|
*/
|
|
104
|
-
onSmartAccountRejection
|
|
101
|
+
onSmartAccountRejection(): void;
|
|
105
102
|
/**
|
|
106
103
|
* List of external chains that are whitelisted for that app.
|
|
107
104
|
*/
|
|
@@ -10,11 +10,12 @@ import {
|
|
|
10
10
|
useDisconnect as useTwDisconnect,
|
|
11
11
|
useWalletInfo,
|
|
12
12
|
} from "thirdweb/react";
|
|
13
|
-
import type { AutoConnectProps, Wallet } from "thirdweb/wallets";
|
|
13
|
+
import type { Account, AutoConnectProps, Wallet } from "thirdweb/wallets";
|
|
14
14
|
import type { Chain } from "viem";
|
|
15
15
|
import { useConnect } from "wagmi";
|
|
16
16
|
|
|
17
17
|
import type { getConfig } from "~/config";
|
|
18
|
+
import type { BeraWagmiApi } from "./BeraWagmi";
|
|
18
19
|
|
|
19
20
|
export function useThirdweb({
|
|
20
21
|
config,
|
|
@@ -28,7 +29,19 @@ export function useThirdweb({
|
|
|
28
29
|
chains: Chain[];
|
|
29
30
|
publicJsonRpcUrl?: string;
|
|
30
31
|
chain: Chain;
|
|
31
|
-
})
|
|
32
|
+
}): Pick<
|
|
33
|
+
BeraWagmiApi,
|
|
34
|
+
| "connect"
|
|
35
|
+
| "openConnectModal"
|
|
36
|
+
| "disconnect"
|
|
37
|
+
| "isConnecting"
|
|
38
|
+
| "DebugConnectButton"
|
|
39
|
+
> & {
|
|
40
|
+
connectionId: string;
|
|
41
|
+
connectorName: string | null;
|
|
42
|
+
isEmbeddedWallet: boolean;
|
|
43
|
+
wallet: Account | undefined;
|
|
44
|
+
} {
|
|
32
45
|
const { connectors, connect: wagmiConnect } = useConnect();
|
|
33
46
|
|
|
34
47
|
const activeWallet = useActiveWallet();
|
|
@@ -97,7 +110,7 @@ export function useThirdweb({
|
|
|
97
110
|
const { connect: twConnectModal } = useTwConnectModal();
|
|
98
111
|
|
|
99
112
|
return {
|
|
100
|
-
async connect({ strategy }
|
|
113
|
+
async connect({ strategy }) {
|
|
101
114
|
if (!config.hasEmbeddedWallets) {
|
|
102
115
|
console.error(
|
|
103
116
|
"useBeraWagmi.connect: this function is not available if embedded wallets are disabled",
|
|
@@ -113,8 +126,8 @@ export function useThirdweb({
|
|
|
113
126
|
}
|
|
114
127
|
|
|
115
128
|
await wallet.connect({
|
|
129
|
+
...connectOptions,
|
|
116
130
|
strategy,
|
|
117
|
-
client: config.client,
|
|
118
131
|
});
|
|
119
132
|
await syncConnectedWallet(wallet);
|
|
120
133
|
},
|
package/dist/chunk-CO26JY24.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 b,inAppWallet as u}from"thirdweb/wallets";import{createConfig as W,createStorage as h}from"wagmi";function A({thirdweb:e,transports:l={},defaultChain:a,chains:r=[]}){let o=C({clientId:e.clientId}),s=!!a.contracts?.multicall3,n={mode:"EIP7702",sponsorGas:e.sponsorGas},d=u({executionMode:n}),i=[...b(),t("io.rabby"),t("io.metamask"),t("com.coinbase.wallet"),t("walletConnect")].filter((c,p,f)=>f.findIndex(m=>m.id===c.id)===p);return{hasEmbeddedWallets:e.embeddedWallets,wallets:e.embeddedWallets?[d,...i]:i,executionMode:n,client:o,wagmi:W({chains:[a,...r],ssr:!0,connectors:[g({client:o,executionMode:n})],storage:h({key:"wagmi-berachain-thirdweb",storage:typeof window<"u"?localStorage:void 0}),batch:{multicall:s?{wait:15}:void 0},transports:l})}}export{A as a};
|
package/dist/chunk-SGIUHS4G.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{usePublicClient as ge}from"wagmi";import{useContext as Q}from"react";import{createContext as G}from"react";import{jsx as H}from"react/jsx-runtime";var B=G(void 0);function U({children:e,address:n,defaultChainId:o}){return H(B.Provider,{value:{address:n,defaultChainId:o},children:e})}function I(){let e=Q(B);if(!e)throw new Error("LightweightAccountContext not found");let{address:n,defaultChainId:o}=e;return{isConnected:!!n,address:n,defaultChainId:o}}import{useBlockNumber as Ye,useChains as Ze,useConfig as $e,useEnsAvatar as z,useEnsName as k,useSwitchChain as et,useTransactionReceipt as tt}from"wagmi";import{createContext as ie,useContext as ae,useMemo as E}from"react";import re from"swr/immutable";import{normalize as se}from"viem/ens";import{useAccount as ce,useDisconnect as de,usePublicClient as le,useWalletClient as ue}from"wagmi";import{useMemo as R}from"react";import{defineChain as M}from"thirdweb";import{ConnectButton as V,useActiveAccount as X,useActiveWallet as Y,useAutoConnect as Z,useConnectModal as $,useDisconnect as ee,useWalletInfo as te}from"thirdweb/react";import{useConnect as ne}from"wagmi";import{jsx as oe}from"react/jsx-runtime";function N({config:e,theme:n,chains:o,chain:t,publicJsonRpcUrl:l=t.rpcUrls.default.http[0]}){let{connectors:h,connect:b}=ne(),r=Y(),s=X(),{disconnect:w}=ee(),{data:C}=te(r?.id),u=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:[l]}}}),[l,t]),m={client:e.client,chain:u,wallets:e.wallets};async function p(a){let i=h.find(c=>c.id==="in-app-wallet");if(i){let c={withCapabilities:!0,wallet:a};b({connector:i,chainId:t.id,...c})}else console.error("no tw connector found")}let{isLoading:A}=Z({...m,onConnect:p}),W=R(()=>crypto.randomUUID(),[r?.id,s?.address]),{connect:v}=$();return{async connect({strategy:a}){if(!e.hasEmbeddedWallets){console.error("useBeraWagmi.connect: this function is not available if embedded wallets are disabled");return}let i=e.wallets.find(c=>c.id==="inApp");if(!i){console.error("useBeraWagmi.connect: no inApp wallet found");return}await i.connect({strategy:a,client:e.client}),await p(i)},async openConnectModal(){let a=await v({...m,wallets:e.wallets,theme:n==="auto"?void 0:n,size:"compact",chains:[u,...o.map(i=>M({id:i.id}))]});await p(a)},disconnect(){r&&w(r)},isConnecting:A,connectionId:W,connectorName:C?.name??null,isEmbeddedWallet:C?.id==="inApp",wallet:s,DebugConnectButton(){return oe(V,{...m,connectModal:{size:"compact"},onConnect:a=>p(a)})}}}import{jsx as L}from"react/jsx-runtime";function f(){let e=ae(D);if(!e)throw new Error("BeraWagmiContext not found");return e}var D=ie(void 0);function De({children:e,config:n,flags:{disableEip5792:o,disable5792Upgrade:t,accountOverride:l}={},theme:h,onSmartAccountRejection:b,chains:r,defaultChain:s,thirdweb:w,publicJsonRpcUrl:C}){let{wallet:u,openConnectModal:m,connect:p,DebugConnectButton:A,connectionId:W,disconnect:v,connectorName:a,isEmbeddedWallet:i,isConnecting:c}=N({config:n,theme:h,chains:r,chain:s,publicJsonRpcUrl:C}),{address:y,chainId:P}=ce(),{disconnect:S}=de(),O=le(),d=E(()=>{if(!(!y||!u))return l??y},[l,y,u]),{data:g}=k({config:n.wagmi,chainId:s.id,address:d}),{data:x}=re(d?["BeraWagmiProvider_code",d,P]:null,([j,F,he])=>O?.getCode({address:F}),{refreshInterval:6e4}),[_,q]=E(()=>x?x.startsWith("0xef01")?[!1,!0]:[!0,!1]:[!1,!1],[x]),{data:T}=ue(),J=E(()=>{try{return g?se(g):void 0}catch{}},[g]),K=z({name:J});return L(D.Provider,{value:{flags:{disableEip5792:!!o,disable5792Upgrade:!!t},walletClient:T,onSmartAccountRejection:()=>{b?.()},isEmbeddedWalletsEnabled:w.embeddedWallets??!0,isConnecting:c,isConnected:!!d&&!!T,DebugConnectButton:A,account:u&&P&&d?{connectionId:W,chainId:P,connectorName:a,isEmbeddedWallet:i,wallet:{address:d,ensName:g?.replace(".bera",".\u{1F43B}\u26D3\uFE0F")??null,ensAvatar:K.data??null,has7702Authorization:q,isContract:_}}:void 0,connect:p,openConnectModal:async()=>{console.log("openConnectModal.called"),await m()},disconnect:()=>{S(),v()},chains:r,defaultChainId:s.id},children:L(U,{address:d,defaultChainId:s.id,children:e})})}function pe(){let{account:e,isConnected:n}=f();return{...e,isConnected:n}}import{useMemo as me}from"react";import{useCapabilities as fe}from"wagmi";function Ce({chainId:e}){let{flags:n,account:o}=f(),{data:t}=fe({account:o?.wallet?.address,scopeKey:o?.connectionId,query:{retry:3},chainId:e});return{supportsAtomic:me(()=>n.disableEip5792||!t?!1:t?.atomic?.status==="supported"||!n.disable5792Upgrade&&t?.atomic?.status==="ready",[t,n.disableEip5792,n.disable5792Upgrade,e]),capabilities:t}}function Qe(e){let{defaultChainId:n}=I(),{chainId:o,...t}=e??{};return ge({chainId:o??n,...t})}export{I as a,pe as b,Ce as c,Qe as d,Ye as e,Ze as f,$e as g,z as h,k as i,et as j,tt as k,f as l,De as m};
|
package/dist/chunk-SMQG24G3.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:l={},defaultChain:a,chains:r=[]}){let o=_thirdweb.createThirdwebClient.call(void 0, {clientId:e.clientId}),s=!!_optionalChain([a, 'access', _ => _.contracts, 'optionalAccess', _2 => _2.multicall3]),n={mode:"EIP7702",sponsorGas:e.sponsorGas},d=_wallets.inAppWallet.call(void 0, {executionMode:n}),i=[..._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,f)=>f.findIndex(m=>m.id===c.id)===p);return{hasEmbeddedWallets:e.embeddedWallets,wallets:e.embeddedWallets?[d,...i]:i,executionMode:n,client:o,wagmi:_wagmi.createConfig.call(void 0, {chains:[a,...r],ssr:!0,connectors:[_wagmiadapter.inAppWalletConnector.call(void 0, {client:o,executionMode:n})],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:l})}}exports.a = A;
|
package/dist/chunk-YQS2GSB4.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 B=_react.createContext.call(void 0, void 0);function U({children:e,address:n,defaultChainId:o}){return _jsxruntime.jsx.call(void 0, B.Provider,{value:{address:n,defaultChainId:o},children:e})}function I(){let e=_react.useContext.call(void 0, B);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 N({config:e,theme:n,chains:o,chain:t,publicJsonRpcUrl:l=t.rpcUrls.default.http[0]}){let{connectors:h,connect:b}=_wagmi.useConnect.call(void 0, ),r=_react3.useActiveWallet.call(void 0, ),s=_react3.useActiveAccount.call(void 0, ),{disconnect:w}=_react3.useDisconnect.call(void 0, ),{data:C}=_react3.useWalletInfo.call(void 0, _optionalChain([r, 'optionalAccess', _2 => _2.id])),u=_react.useMemo.call(void 0, ()=>_thirdweb.defineChain.call(void 0, {id:t.id,blockExplorers:t.blockExplorers,blockTime:t.blockTime,ensTlds:t.ensTlds,testnet:t.testnet,contracts:t.contracts,nativeCurrency:t.nativeCurrency,name:t.name,rpcUrls:{default:{http:[l]}}}),[l,t]),m={client:e.client,chain:u,wallets:e.wallets};async function p(a){let i=h.find(c=>c.id==="in-app-wallet");if(i){let c={withCapabilities:!0,wallet:a};b({connector:i,chainId:t.id,...c})}else console.error("no tw connector found")}let{isLoading:A}=_react3.useAutoConnect.call(void 0, {...m,onConnect:p}),W=_react.useMemo.call(void 0, ()=>crypto.randomUUID(),[_optionalChain([r, 'optionalAccess', _3 => _3.id]),_optionalChain([s, 'optionalAccess', _4 => _4.address])]),{connect:v}=_react3.useConnectModal.call(void 0, );return{async connect({strategy:a}){if(!e.hasEmbeddedWallets){console.error("useBeraWagmi.connect: this function is not available if embedded wallets are disabled");return}let i=e.wallets.find(c=>c.id==="inApp");if(!i){console.error("useBeraWagmi.connect: no inApp wallet found");return}await i.connect({strategy:a,client:e.client}),await p(i)},async openConnectModal(){let a=await v({...m,wallets:e.wallets,theme:n==="auto"?void 0:n,size:"compact",chains:[u,...o.map(i=>_thirdweb.defineChain.call(void 0, {id:i.id}))]});await p(a)},disconnect(){r&&w(r)},isConnecting:A,connectionId:W,connectorName:_nullishCoalesce(_optionalChain([C, 'optionalAccess', _5 => _5.name]), () => (null)),isEmbeddedWallet:_optionalChain([C, 'optionalAccess', _6 => _6.id])==="inApp",wallet:s,DebugConnectButton(){return _jsxruntime.jsx.call(void 0, _react3.ConnectButton,{...m,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 De({children:e,config:n,flags:{disableEip5792:o,disable5792Upgrade:t,accountOverride:l}={},theme:h,onSmartAccountRejection:b,chains:r,defaultChain:s,thirdweb:w,publicJsonRpcUrl:C}){let{wallet:u,openConnectModal:m,connect:p,DebugConnectButton:A,connectionId:W,disconnect:v,connectorName:a,isEmbeddedWallet:i,isConnecting:c}=N({config:n,theme:h,chains:r,chain:s,publicJsonRpcUrl:C}),{address:y,chainId:P}=_wagmi.useAccount.call(void 0, ),{disconnect:S}=_wagmi.useDisconnect.call(void 0, ),O=_wagmi.usePublicClient.call(void 0, ),d=_react.useMemo.call(void 0, ()=>{if(!(!y||!u))return _nullishCoalesce(l, () => (y))},[l,y,u]),{data:g}=_wagmi.useEnsName.call(void 0, {config:n.wagmi,chainId:s.id,address:d}),{data:x}=_immutable2.default.call(void 0, d?["BeraWagmiProvider_code",d,P]:null,([j,F,he])=>_optionalChain([O, 'optionalAccess', _7 => _7.getCode, 'call', _8 => _8({address:F})]),{refreshInterval:6e4}),[_,q]=_react.useMemo.call(void 0, ()=>x?x.startsWith("0xef01")?[!1,!0]:[!0,!1]:[!1,!1],[x]),{data:T}=_wagmi.useWalletClient.call(void 0, ),J=_react.useMemo.call(void 0, ()=>{try{return g?_ens.normalize.call(void 0, g):void 0}catch (e2){}},[g]),K=_wagmi.useEnsAvatar.call(void 0, {name:J});return _jsxruntime.jsx.call(void 0, D.Provider,{value:{flags:{disableEip5792:!!o,disable5792Upgrade:!!t},walletClient:T,onSmartAccountRejection:()=>{_optionalChain([b, 'optionalCall', _9 => _9()])},isEmbeddedWalletsEnabled:_nullishCoalesce(w.embeddedWallets, () => (!0)),isConnecting:c,isConnected:!!d&&!!T,DebugConnectButton:A,account:u&&P&&d?{connectionId:W,chainId:P,connectorName:a,isEmbeddedWallet:i,wallet:{address:d,ensName:_nullishCoalesce(_optionalChain([g, 'optionalAccess', _10 => _10.replace, 'call', _11 => _11(".bera",".\u{1F43B}\u26D3\uFE0F")]), () => (null)),ensAvatar:_nullishCoalesce(K.data, () => (null)),has7702Authorization:q,isContract:_}}:void 0,connect:p,openConnectModal:async()=>{console.log("openConnectModal.called"),await m()},disconnect:()=>{S(),v()},chains:r,defaultChainId:s.id},children:_jsxruntime.jsx.call(void 0, U,{address:d,defaultChainId:s.id,children:e})})}function pe(){let{account:e,isConnected:n}=f();return{...e,isConnected:n}}function Ce({chainId:e}){let{flags:n,account:o}=f(),{data:t}=_wagmi.useCapabilities.call(void 0, {account:_optionalChain([o, 'optionalAccess', _12 => _12.wallet, 'optionalAccess', _13 => _13.address]),scopeKey:_optionalChain([o, 'optionalAccess', _14 => _14.connectionId]),query:{retry:3},chainId:e});return{supportsAtomic:_react.useMemo.call(void 0, ()=>n.disableEip5792||!t?!1:_optionalChain([t, 'optionalAccess', _15 => _15.atomic, 'optionalAccess', _16 => _16.status])==="supported"||!n.disable5792Upgrade&&_optionalChain([t, 'optionalAccess', _17 => _17.atomic, 'optionalAccess', _18 => _18.status])==="ready",[t,n.disableEip5792,n.disable5792Upgrade,e]),capabilities:t}}function Qe(e){let{defaultChainId:n}=I(),{chainId:o,...t}=_nullishCoalesce(e, () => ({}));return _wagmi.usePublicClient.call(void 0, {chainId:_nullishCoalesce(o, () => (n)),...t})}exports.a = I; exports.b = pe; exports.c = Ce; exports.d = Qe; exports.e = _wagmi.useBlockNumber; exports.f = _wagmi.useChains; exports.g = _wagmi.useConfig; exports.h = _wagmi.useEnsAvatar; exports.i = _wagmi.useEnsName; exports.j = _wagmi.useSwitchChain; exports.k = _wagmi.useTransactionReceipt; exports.l = f; exports.m = De;
|