@berachain/wagmi 0.2.0-beta.2 → 0.4.0-beta.0
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-Cgyr2tEA.d.cts → BeraWagmi-C5bwVJdu.d.cts} +41 -28
- package/dist/{BeraWagmi-4czj_EN4.d.ts → BeraWagmi-Ce70nKxp.d.ts} +41 -28
- package/dist/chunk-CO26JY24.mjs +1 -0
- package/dist/chunk-SGIUHS4G.mjs +1 -0
- package/dist/chunk-SMQG24G3.cjs +1 -0
- package/dist/chunk-YQS2GSB4.cjs +1 -0
- package/dist/config/index.cjs +1 -1
- package/dist/config/index.d.cts +14 -18
- package/dist/config/index.d.ts +14 -18
- package/dist/config/index.mjs +1 -1
- package/dist/context/index.cjs +1 -1
- package/dist/context/index.d.cts +8 -6
- package/dist/context/index.d.ts +8 -6
- package/dist/context/index.mjs +1 -1
- package/dist/core/thirdweb/index.cjs +1 -0
- package/dist/core/thirdweb/index.d.cts +74 -0
- package/dist/core/thirdweb/index.d.ts +74 -0
- package/dist/core/thirdweb/index.mjs +1 -0
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.cts +23 -4
- package/dist/hooks/index.d.ts +23 -4
- package/dist/hooks/index.mjs +1 -1
- package/package.json +12 -8
- package/src/config/defaultWagmiConfig.ts +24 -142
- package/src/context/BeraWagmi.tsx +70 -119
- package/src/context/LightweightAccountProvider.tsx +9 -2
- package/src/context/WagmiProvider.tsx +30 -17
- package/src/context/useThirdweb.tsx +53 -27
- package/src/core/thirdweb/index.ts +61 -0
- package/src/hooks/index.ts +3 -1
- package/src/hooks/useBeraWallet.ts +2 -1
- package/src/hooks/useCapabilities.ts +34 -0
- package/dist/chunk-24VBIB22.cjs +0 -1
- package/dist/chunk-CPC3I7WV.cjs +0 -1
- package/dist/chunk-YGBWE4UM.mjs +0 -1
- package/dist/chunk-ZKXXJYGS.mjs +0 -1
- package/src/context/types.ts +0 -16
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { Address,
|
|
2
|
+
import { Address, Chain } from 'viem';
|
|
3
3
|
import { UseWalletClientReturnType } from 'wagmi';
|
|
4
|
-
import {
|
|
5
|
-
import { getConfig } from './config/index.cjs';
|
|
4
|
+
import { getConfig, ThirdwebConfig } from './config/index.cjs';
|
|
6
5
|
|
|
7
6
|
declare function useBeraWagmi(): BeraWagmiApi;
|
|
8
7
|
interface BeraWagmiApi {
|
|
@@ -23,18 +22,7 @@ interface BeraWagmiApi {
|
|
|
23
22
|
*/
|
|
24
23
|
isEmbeddedWallet: boolean;
|
|
25
24
|
connectorName: string | null;
|
|
26
|
-
|
|
27
|
-
getSupportsAtomic: (chainId: number) => boolean;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Wallet provider capabilities for the current account.
|
|
31
|
-
*
|
|
32
|
-
* Status can be:
|
|
33
|
-
* - supported: User has enabled the feature.
|
|
34
|
-
* - ready: The wallet provider is ready to use the feature.
|
|
35
|
-
* - unsupported: The wallet provider does not support the feature.
|
|
36
|
-
*/
|
|
37
|
-
capabilities: GetCapabilitiesReturnType | undefined;
|
|
25
|
+
connectionId: string;
|
|
38
26
|
/**
|
|
39
27
|
* Wallet to display.
|
|
40
28
|
*
|
|
@@ -63,8 +51,20 @@ interface BeraWagmiApi {
|
|
|
63
51
|
isEmbeddedWalletsEnabled: boolean;
|
|
64
52
|
isConnected: boolean;
|
|
65
53
|
isConnecting: boolean;
|
|
54
|
+
flags: {
|
|
55
|
+
disableEip5792: boolean;
|
|
56
|
+
disable5792Upgrade: boolean;
|
|
57
|
+
};
|
|
66
58
|
walletClient: UseWalletClientReturnType["data"];
|
|
67
|
-
|
|
59
|
+
openConnectModal: () => Promise<void> | void;
|
|
60
|
+
/**
|
|
61
|
+
* Connects a wallet using a specific strategy.
|
|
62
|
+
*
|
|
63
|
+
* @param strategy - The strategy to use to connect the wallet.
|
|
64
|
+
*/
|
|
65
|
+
connect: ({ strategy, }: {
|
|
66
|
+
strategy: "google" | "apple";
|
|
67
|
+
}) => Promise<void> | void;
|
|
68
68
|
disconnect(): void;
|
|
69
69
|
/**
|
|
70
70
|
* A callback that is called when a smart account upgrade is rejected.
|
|
@@ -75,28 +75,41 @@ interface BeraWagmiApi {
|
|
|
75
75
|
/**
|
|
76
76
|
* List of external chains that are whitelisted for that app.
|
|
77
77
|
*/
|
|
78
|
-
|
|
78
|
+
chains: Chain[];
|
|
79
|
+
defaultChainId: ChainId;
|
|
80
|
+
}
|
|
81
|
+
declare enum ChainId {
|
|
82
|
+
MAINNET = 80094,
|
|
83
|
+
BEPOLIA = 80069
|
|
79
84
|
}
|
|
80
85
|
interface IBeraWagmiProviderProps extends PropsWithChildren {
|
|
81
86
|
config: ReturnType<typeof getConfig>;
|
|
82
87
|
theme?: "dark" | "light" | "auto";
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
flags?: {
|
|
89
|
+
disableEip5792?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Whether to disable the 5792 upgrade for users that haven't upgraded yet.
|
|
92
|
+
*
|
|
93
|
+
* `atomic.status === "ready"`
|
|
94
|
+
*/
|
|
95
|
+
disable5792Upgrade?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* A value that mocks the connected wallet address, while transactions are still sent from the connected wallet.
|
|
98
|
+
* It can be used for advanced use cases like sending permissionless transactions (like incentive claims).
|
|
99
|
+
*/
|
|
100
|
+
accountOverride?: Address;
|
|
101
|
+
};
|
|
92
102
|
onSmartAccountRejection?: () => void;
|
|
93
|
-
edgeConfigChainList: EdgeConfigSchema["wagmi"]["externalChainList"];
|
|
94
103
|
/**
|
|
95
104
|
* Event triggered when a wallet is connected manually.
|
|
96
105
|
*
|
|
97
106
|
* This is not triggered when a wallet connect automatically after a refresh.
|
|
98
107
|
*/
|
|
99
108
|
onConnectedWallet?: () => void;
|
|
109
|
+
chains: Chain[];
|
|
110
|
+
defaultChain: Chain;
|
|
111
|
+
thirdweb: ThirdwebConfig;
|
|
112
|
+
publicJsonRpcUrl: string;
|
|
100
113
|
}
|
|
101
114
|
|
|
102
|
-
export { type BeraWagmiApi as B, type IBeraWagmiProviderProps as I, useBeraWagmi as u };
|
|
115
|
+
export { type BeraWagmiApi as B, ChainId as C, type IBeraWagmiProviderProps as I, useBeraWagmi as u };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { Address,
|
|
2
|
+
import { Address, Chain } from 'viem';
|
|
3
3
|
import { UseWalletClientReturnType } from 'wagmi';
|
|
4
|
-
import {
|
|
5
|
-
import { getConfig } from './config/index.js';
|
|
4
|
+
import { getConfig, ThirdwebConfig } from './config/index.js';
|
|
6
5
|
|
|
7
6
|
declare function useBeraWagmi(): BeraWagmiApi;
|
|
8
7
|
interface BeraWagmiApi {
|
|
@@ -23,18 +22,7 @@ interface BeraWagmiApi {
|
|
|
23
22
|
*/
|
|
24
23
|
isEmbeddedWallet: boolean;
|
|
25
24
|
connectorName: string | null;
|
|
26
|
-
|
|
27
|
-
getSupportsAtomic: (chainId: number) => boolean;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Wallet provider capabilities for the current account.
|
|
31
|
-
*
|
|
32
|
-
* Status can be:
|
|
33
|
-
* - supported: User has enabled the feature.
|
|
34
|
-
* - ready: The wallet provider is ready to use the feature.
|
|
35
|
-
* - unsupported: The wallet provider does not support the feature.
|
|
36
|
-
*/
|
|
37
|
-
capabilities: GetCapabilitiesReturnType | undefined;
|
|
25
|
+
connectionId: string;
|
|
38
26
|
/**
|
|
39
27
|
* Wallet to display.
|
|
40
28
|
*
|
|
@@ -63,8 +51,20 @@ interface BeraWagmiApi {
|
|
|
63
51
|
isEmbeddedWalletsEnabled: boolean;
|
|
64
52
|
isConnected: boolean;
|
|
65
53
|
isConnecting: boolean;
|
|
54
|
+
flags: {
|
|
55
|
+
disableEip5792: boolean;
|
|
56
|
+
disable5792Upgrade: boolean;
|
|
57
|
+
};
|
|
66
58
|
walletClient: UseWalletClientReturnType["data"];
|
|
67
|
-
|
|
59
|
+
openConnectModal: () => Promise<void> | void;
|
|
60
|
+
/**
|
|
61
|
+
* Connects a wallet using a specific strategy.
|
|
62
|
+
*
|
|
63
|
+
* @param strategy - The strategy to use to connect the wallet.
|
|
64
|
+
*/
|
|
65
|
+
connect: ({ strategy, }: {
|
|
66
|
+
strategy: "google" | "apple";
|
|
67
|
+
}) => Promise<void> | void;
|
|
68
68
|
disconnect(): void;
|
|
69
69
|
/**
|
|
70
70
|
* A callback that is called when a smart account upgrade is rejected.
|
|
@@ -75,28 +75,41 @@ interface BeraWagmiApi {
|
|
|
75
75
|
/**
|
|
76
76
|
* List of external chains that are whitelisted for that app.
|
|
77
77
|
*/
|
|
78
|
-
|
|
78
|
+
chains: Chain[];
|
|
79
|
+
defaultChainId: ChainId;
|
|
80
|
+
}
|
|
81
|
+
declare enum ChainId {
|
|
82
|
+
MAINNET = 80094,
|
|
83
|
+
BEPOLIA = 80069
|
|
79
84
|
}
|
|
80
85
|
interface IBeraWagmiProviderProps extends PropsWithChildren {
|
|
81
86
|
config: ReturnType<typeof getConfig>;
|
|
82
87
|
theme?: "dark" | "light" | "auto";
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
flags?: {
|
|
89
|
+
disableEip5792?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Whether to disable the 5792 upgrade for users that haven't upgraded yet.
|
|
92
|
+
*
|
|
93
|
+
* `atomic.status === "ready"`
|
|
94
|
+
*/
|
|
95
|
+
disable5792Upgrade?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* A value that mocks the connected wallet address, while transactions are still sent from the connected wallet.
|
|
98
|
+
* It can be used for advanced use cases like sending permissionless transactions (like incentive claims).
|
|
99
|
+
*/
|
|
100
|
+
accountOverride?: Address;
|
|
101
|
+
};
|
|
92
102
|
onSmartAccountRejection?: () => void;
|
|
93
|
-
edgeConfigChainList: EdgeConfigSchema["wagmi"]["externalChainList"];
|
|
94
103
|
/**
|
|
95
104
|
* Event triggered when a wallet is connected manually.
|
|
96
105
|
*
|
|
97
106
|
* This is not triggered when a wallet connect automatically after a refresh.
|
|
98
107
|
*/
|
|
99
108
|
onConnectedWallet?: () => void;
|
|
109
|
+
chains: Chain[];
|
|
110
|
+
defaultChain: Chain;
|
|
111
|
+
thirdweb: ThirdwebConfig;
|
|
112
|
+
publicJsonRpcUrl: string;
|
|
100
113
|
}
|
|
101
114
|
|
|
102
|
-
export { type BeraWagmiApi as B, type IBeraWagmiProviderProps as I, useBeraWagmi as u };
|
|
115
|
+
export { type BeraWagmiApi as B, ChainId as C, type IBeraWagmiProviderProps as I, useBeraWagmi as u };
|
|
@@ -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 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};
|
|
@@ -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 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};
|
|
@@ -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: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;
|
|
@@ -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 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;
|
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 _chunkSMQG24G3cjs = require('../chunk-SMQG24G3.cjs');exports.getConfig = _chunkSMQG24G3cjs.a;
|
package/dist/config/index.d.cts
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
import * as thirdweb from 'thirdweb';
|
|
2
2
|
import * as thirdweb_wallets from 'thirdweb/wallets';
|
|
3
|
-
import { Chain } from 'viem';
|
|
3
|
+
import { Transport, Chain } from 'viem';
|
|
4
4
|
import { Config } from 'wagmi';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
* Using default viem chain definition since it also includes ens and other metadata
|
|
8
|
-
*/
|
|
9
|
-
declare const chain: Chain;
|
|
10
|
-
declare const defaultBeraNetworkConfig: NetworkConfig;
|
|
11
|
-
interface NetworkConfig {
|
|
12
|
-
chain: Chain;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Exporting this is helpful for the multi-chain zap, to get the list of chains that we want to support.
|
|
16
|
-
*/
|
|
17
|
-
declare const externalChains: Chain[];
|
|
18
|
-
declare const chainIdToName: Record<Chain["id"], string>;
|
|
19
|
-
declare function getConfig({ sponsorGas, enableEmbeddedWallets, }: {
|
|
6
|
+
interface ThirdwebConfig {
|
|
20
7
|
sponsorGas?: boolean;
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
embeddedWallets?: boolean;
|
|
9
|
+
clientId: string;
|
|
10
|
+
}
|
|
11
|
+
interface BeraWagmiConfig {
|
|
12
|
+
thirdweb: ThirdwebConfig;
|
|
13
|
+
transports?: Record<number, Transport>;
|
|
14
|
+
chains?: Chain[];
|
|
15
|
+
defaultChain: Chain;
|
|
16
|
+
}
|
|
17
|
+
declare function getConfig({ thirdweb, transports, defaultChain: chain, chains, }: BeraWagmiConfig): {
|
|
18
|
+
hasEmbeddedWallets: boolean | undefined;
|
|
23
19
|
wallets: thirdweb_wallets.Wallet[];
|
|
24
20
|
executionMode: {
|
|
25
21
|
readonly mode: "EIP7702";
|
|
@@ -29,4 +25,4 @@ declare function getConfig({ sponsorGas, enableEmbeddedWallets, }: {
|
|
|
29
25
|
wagmi: Config;
|
|
30
26
|
};
|
|
31
27
|
|
|
32
|
-
export { type
|
|
28
|
+
export { type BeraWagmiConfig, type ThirdwebConfig, getConfig };
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
import * as thirdweb from 'thirdweb';
|
|
2
2
|
import * as thirdweb_wallets from 'thirdweb/wallets';
|
|
3
|
-
import { Chain } from 'viem';
|
|
3
|
+
import { Transport, Chain } from 'viem';
|
|
4
4
|
import { Config } from 'wagmi';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
* Using default viem chain definition since it also includes ens and other metadata
|
|
8
|
-
*/
|
|
9
|
-
declare const chain: Chain;
|
|
10
|
-
declare const defaultBeraNetworkConfig: NetworkConfig;
|
|
11
|
-
interface NetworkConfig {
|
|
12
|
-
chain: Chain;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Exporting this is helpful for the multi-chain zap, to get the list of chains that we want to support.
|
|
16
|
-
*/
|
|
17
|
-
declare const externalChains: Chain[];
|
|
18
|
-
declare const chainIdToName: Record<Chain["id"], string>;
|
|
19
|
-
declare function getConfig({ sponsorGas, enableEmbeddedWallets, }: {
|
|
6
|
+
interface ThirdwebConfig {
|
|
20
7
|
sponsorGas?: boolean;
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
embeddedWallets?: boolean;
|
|
9
|
+
clientId: string;
|
|
10
|
+
}
|
|
11
|
+
interface BeraWagmiConfig {
|
|
12
|
+
thirdweb: ThirdwebConfig;
|
|
13
|
+
transports?: Record<number, Transport>;
|
|
14
|
+
chains?: Chain[];
|
|
15
|
+
defaultChain: Chain;
|
|
16
|
+
}
|
|
17
|
+
declare function getConfig({ thirdweb, transports, defaultChain: chain, chains, }: BeraWagmiConfig): {
|
|
18
|
+
hasEmbeddedWallets: boolean | undefined;
|
|
23
19
|
wallets: thirdweb_wallets.Wallet[];
|
|
24
20
|
executionMode: {
|
|
25
21
|
readonly mode: "EIP7702";
|
|
@@ -29,4 +25,4 @@ declare function getConfig({ sponsorGas, enableEmbeddedWallets, }: {
|
|
|
29
25
|
wagmi: Config;
|
|
30
26
|
};
|
|
31
27
|
|
|
32
|
-
export { type
|
|
28
|
+
export { type BeraWagmiConfig, type ThirdwebConfig, getConfig };
|
package/dist/config/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a
|
|
1
|
+
import{a as o}from"../chunk-CO26JY24.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 _chunkSMQG24G3cjs = require('../chunk-SMQG24G3.cjs');var _chunkYQS2GSB4cjs = require('../chunk-YQS2GSB4.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, ()=>_chunkSMQG24G3cjs.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, _chunkYQS2GSB4cjs.m,{...f,thirdweb:o,chains:i,defaultChain:e,config:t})})})})}exports.WagmiProvider = h;
|
package/dist/context/index.d.cts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { Transport, Chain } from 'viem';
|
|
3
|
+
import { I as IBeraWagmiProviderProps } from '../BeraWagmi-C5bwVJdu.cjs';
|
|
3
4
|
import 'react';
|
|
4
|
-
import 'viem';
|
|
5
5
|
import 'wagmi';
|
|
6
|
-
import '@berachain/config/internal/edge-config';
|
|
7
6
|
import '../config/index.cjs';
|
|
8
7
|
import 'thirdweb';
|
|
9
8
|
import 'thirdweb/wallets';
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
type WagmiProviderProps = Omit<IBeraWagmiProviderProps, "config" | "defaultChain"> & {
|
|
11
|
+
transports?: Record<number, Transport>;
|
|
12
|
+
defaultChain: Chain;
|
|
13
|
+
chains?: Chain[];
|
|
14
|
+
};
|
|
15
|
+
declare function WagmiProvider({ transports, defaultChain, chains, thirdweb, ...beraWagmiProps }: WagmiProviderProps): react_jsx_runtime.JSX.Element;
|
|
14
16
|
|
|
15
17
|
export { WagmiProvider };
|
package/dist/context/index.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { Transport, Chain } from 'viem';
|
|
3
|
+
import { I as IBeraWagmiProviderProps } from '../BeraWagmi-Ce70nKxp.js';
|
|
3
4
|
import 'react';
|
|
4
|
-
import 'viem';
|
|
5
5
|
import 'wagmi';
|
|
6
|
-
import '@berachain/config/internal/edge-config';
|
|
7
6
|
import '../config/index.js';
|
|
8
7
|
import 'thirdweb';
|
|
9
8
|
import 'thirdweb/wallets';
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
type WagmiProviderProps = Omit<IBeraWagmiProviderProps, "config" | "defaultChain"> & {
|
|
11
|
+
transports?: Record<number, Transport>;
|
|
12
|
+
defaultChain: Chain;
|
|
13
|
+
chains?: Chain[];
|
|
14
|
+
};
|
|
15
|
+
declare function WagmiProvider({ transports, defaultChain, chains, thirdweb, ...beraWagmiProps }: WagmiProviderProps): react_jsx_runtime.JSX.Element;
|
|
14
16
|
|
|
15
17
|
export { WagmiProvider };
|
package/dist/context/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{a as m}from"../chunk-CO26JY24.mjs";import{m as a}from"../chunk-SGIUHS4G.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _viem = require('viem');var _erc4337 = require('thirdweb/extensions/erc4337');var _inapp = require('thirdweb/wallets/in-app');function s(e=32){return _viem.toHex.call(void 0, n(e))}function n(e=32){return globalThis.crypto.getRandomValues(new Uint8Array(e))}var i=[{name:"limitType",type:"uint8"},{name:"limit",type:"uint256"},{name:"period",type:"uint256"}],r= exports.ConstraintRequest =[{name:"condition",type:"uint8"},{name:"index",type:"uint64"},{name:"refValue",type:"bytes32"},{name:"limit",type:"UsageLimit"}],o= exports.CallSpecRequest =[{name:"target",type:"address"},{name:"selector",type:"bytes4"},{name:"maxValuePerUse",type:"uint256"},{name:"valueLimit",type:"UsageLimit"},{name:"constraints",type:"Constraint[]"}],p= exports.TransferSpecRequest =[{name:"target",type:"address"},{name:"maxValuePerUse",type:"uint256"},{name:"valueLimit",type:"UsageLimit"}],m= exports.SessionSpecRequest =[{name:"signer",type:"address"},{name:"isWildcard",type:"bool"},{name:"expiresAt",type:"uint256"},{name:"callPolicies",type:"CallSpec[]"},{name:"transferPolicies",type:"TransferSpec[]"},{name:"uid",type:"bytes32"}];exports.CallSpecRequest = o; exports.ConstraintRequest = r; exports.SessionSpecRequest = m; exports.TransferSpecRequest = p; exports.UsageLimitRequest = i; exports.createSessionKey = _inapp.createSessionKey; exports.getAllActiveSigners = _erc4337.getAllActiveSigners; exports.randomBytesHex = s;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export { getAllActiveSigners } from 'thirdweb/extensions/erc4337';
|
|
2
|
+
export { Condition, CreateSessionKeyOptions, GetCallPoliciesForSignerParams, LimitType, createSessionKey } from 'thirdweb/wallets/in-app';
|
|
3
|
+
|
|
4
|
+
declare function randomBytesHex(length?: number): `0x${string}`;
|
|
5
|
+
declare const UsageLimitRequest: readonly [{
|
|
6
|
+
readonly name: "limitType";
|
|
7
|
+
readonly type: "uint8";
|
|
8
|
+
}, {
|
|
9
|
+
readonly name: "limit";
|
|
10
|
+
readonly type: "uint256";
|
|
11
|
+
}, {
|
|
12
|
+
readonly name: "period";
|
|
13
|
+
readonly type: "uint256";
|
|
14
|
+
}];
|
|
15
|
+
declare const ConstraintRequest: readonly [{
|
|
16
|
+
readonly name: "condition";
|
|
17
|
+
readonly type: "uint8";
|
|
18
|
+
}, {
|
|
19
|
+
readonly name: "index";
|
|
20
|
+
readonly type: "uint64";
|
|
21
|
+
}, {
|
|
22
|
+
readonly name: "refValue";
|
|
23
|
+
readonly type: "bytes32";
|
|
24
|
+
}, {
|
|
25
|
+
readonly name: "limit";
|
|
26
|
+
readonly type: "UsageLimit";
|
|
27
|
+
}];
|
|
28
|
+
declare const CallSpecRequest: readonly [{
|
|
29
|
+
readonly name: "target";
|
|
30
|
+
readonly type: "address";
|
|
31
|
+
}, {
|
|
32
|
+
readonly name: "selector";
|
|
33
|
+
readonly type: "bytes4";
|
|
34
|
+
}, {
|
|
35
|
+
readonly name: "maxValuePerUse";
|
|
36
|
+
readonly type: "uint256";
|
|
37
|
+
}, {
|
|
38
|
+
readonly name: "valueLimit";
|
|
39
|
+
readonly type: "UsageLimit";
|
|
40
|
+
}, {
|
|
41
|
+
readonly name: "constraints";
|
|
42
|
+
readonly type: "Constraint[]";
|
|
43
|
+
}];
|
|
44
|
+
declare const TransferSpecRequest: readonly [{
|
|
45
|
+
readonly name: "target";
|
|
46
|
+
readonly type: "address";
|
|
47
|
+
}, {
|
|
48
|
+
readonly name: "maxValuePerUse";
|
|
49
|
+
readonly type: "uint256";
|
|
50
|
+
}, {
|
|
51
|
+
readonly name: "valueLimit";
|
|
52
|
+
readonly type: "UsageLimit";
|
|
53
|
+
}];
|
|
54
|
+
declare const SessionSpecRequest: readonly [{
|
|
55
|
+
readonly name: "signer";
|
|
56
|
+
readonly type: "address";
|
|
57
|
+
}, {
|
|
58
|
+
readonly name: "isWildcard";
|
|
59
|
+
readonly type: "bool";
|
|
60
|
+
}, {
|
|
61
|
+
readonly name: "expiresAt";
|
|
62
|
+
readonly type: "uint256";
|
|
63
|
+
}, {
|
|
64
|
+
readonly name: "callPolicies";
|
|
65
|
+
readonly type: "CallSpec[]";
|
|
66
|
+
}, {
|
|
67
|
+
readonly name: "transferPolicies";
|
|
68
|
+
readonly type: "TransferSpec[]";
|
|
69
|
+
}, {
|
|
70
|
+
readonly name: "uid";
|
|
71
|
+
readonly type: "bytes32";
|
|
72
|
+
}];
|
|
73
|
+
|
|
74
|
+
export { CallSpecRequest, ConstraintRequest, SessionSpecRequest, TransferSpecRequest, UsageLimitRequest, randomBytesHex };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export { getAllActiveSigners } from 'thirdweb/extensions/erc4337';
|
|
2
|
+
export { Condition, CreateSessionKeyOptions, GetCallPoliciesForSignerParams, LimitType, createSessionKey } from 'thirdweb/wallets/in-app';
|
|
3
|
+
|
|
4
|
+
declare function randomBytesHex(length?: number): `0x${string}`;
|
|
5
|
+
declare const UsageLimitRequest: readonly [{
|
|
6
|
+
readonly name: "limitType";
|
|
7
|
+
readonly type: "uint8";
|
|
8
|
+
}, {
|
|
9
|
+
readonly name: "limit";
|
|
10
|
+
readonly type: "uint256";
|
|
11
|
+
}, {
|
|
12
|
+
readonly name: "period";
|
|
13
|
+
readonly type: "uint256";
|
|
14
|
+
}];
|
|
15
|
+
declare const ConstraintRequest: readonly [{
|
|
16
|
+
readonly name: "condition";
|
|
17
|
+
readonly type: "uint8";
|
|
18
|
+
}, {
|
|
19
|
+
readonly name: "index";
|
|
20
|
+
readonly type: "uint64";
|
|
21
|
+
}, {
|
|
22
|
+
readonly name: "refValue";
|
|
23
|
+
readonly type: "bytes32";
|
|
24
|
+
}, {
|
|
25
|
+
readonly name: "limit";
|
|
26
|
+
readonly type: "UsageLimit";
|
|
27
|
+
}];
|
|
28
|
+
declare const CallSpecRequest: readonly [{
|
|
29
|
+
readonly name: "target";
|
|
30
|
+
readonly type: "address";
|
|
31
|
+
}, {
|
|
32
|
+
readonly name: "selector";
|
|
33
|
+
readonly type: "bytes4";
|
|
34
|
+
}, {
|
|
35
|
+
readonly name: "maxValuePerUse";
|
|
36
|
+
readonly type: "uint256";
|
|
37
|
+
}, {
|
|
38
|
+
readonly name: "valueLimit";
|
|
39
|
+
readonly type: "UsageLimit";
|
|
40
|
+
}, {
|
|
41
|
+
readonly name: "constraints";
|
|
42
|
+
readonly type: "Constraint[]";
|
|
43
|
+
}];
|
|
44
|
+
declare const TransferSpecRequest: readonly [{
|
|
45
|
+
readonly name: "target";
|
|
46
|
+
readonly type: "address";
|
|
47
|
+
}, {
|
|
48
|
+
readonly name: "maxValuePerUse";
|
|
49
|
+
readonly type: "uint256";
|
|
50
|
+
}, {
|
|
51
|
+
readonly name: "valueLimit";
|
|
52
|
+
readonly type: "UsageLimit";
|
|
53
|
+
}];
|
|
54
|
+
declare const SessionSpecRequest: readonly [{
|
|
55
|
+
readonly name: "signer";
|
|
56
|
+
readonly type: "address";
|
|
57
|
+
}, {
|
|
58
|
+
readonly name: "isWildcard";
|
|
59
|
+
readonly type: "bool";
|
|
60
|
+
}, {
|
|
61
|
+
readonly name: "expiresAt";
|
|
62
|
+
readonly type: "uint256";
|
|
63
|
+
}, {
|
|
64
|
+
readonly name: "callPolicies";
|
|
65
|
+
readonly type: "CallSpec[]";
|
|
66
|
+
}, {
|
|
67
|
+
readonly name: "transferPolicies";
|
|
68
|
+
readonly type: "TransferSpec[]";
|
|
69
|
+
}, {
|
|
70
|
+
readonly name: "uid";
|
|
71
|
+
readonly type: "bytes32";
|
|
72
|
+
}];
|
|
73
|
+
|
|
74
|
+
export { CallSpecRequest, ConstraintRequest, SessionSpecRequest, TransferSpecRequest, UsageLimitRequest, randomBytesHex };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{toHex as t}from"viem";import{getAllActiveSigners as l}from"thirdweb/extensions/erc4337";import{createSessionKey as d}from"thirdweb/wallets/in-app";function s(e=32){return t(n(e))}function n(e=32){return globalThis.crypto.getRandomValues(new Uint8Array(e))}var i=[{name:"limitType",type:"uint8"},{name:"limit",type:"uint256"},{name:"period",type:"uint256"}],r=[{name:"condition",type:"uint8"},{name:"index",type:"uint64"},{name:"refValue",type:"bytes32"},{name:"limit",type:"UsageLimit"}],o=[{name:"target",type:"address"},{name:"selector",type:"bytes4"},{name:"maxValuePerUse",type:"uint256"},{name:"valueLimit",type:"UsageLimit"},{name:"constraints",type:"Constraint[]"}],p=[{name:"target",type:"address"},{name:"maxValuePerUse",type:"uint256"},{name:"valueLimit",type:"UsageLimit"}],m=[{name:"signer",type:"address"},{name:"isWildcard",type:"bool"},{name:"expiresAt",type:"uint256"},{name:"callPolicies",type:"CallSpec[]"},{name:"transferPolicies",type:"TransferSpec[]"},{name:"uid",type:"bytes32"}];export{o as CallSpecRequest,r as ConstraintRequest,m as SessionSpecRequest,p as TransferSpecRequest,i as UsageLimitRequest,d as createSessionKey,l as getAllActiveSigners,s as randomBytesHex};
|
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 _chunkYQS2GSB4cjs = require('../chunk-YQS2GSB4.cjs');exports.useBeraAccount = _chunkYQS2GSB4cjs.b; exports.useBeraWagmi = _chunkYQS2GSB4cjs.l; exports.useBeraWallet = _chunkYQS2GSB4cjs.a; exports.useBlockNumber = _chunkYQS2GSB4cjs.e; exports.useCapabilities = _chunkYQS2GSB4cjs.c; exports.useChains = _chunkYQS2GSB4cjs.f; exports.useConfig = _chunkYQS2GSB4cjs.g; exports.useEnsAvatar = _chunkYQS2GSB4cjs.h; exports.useEnsName = _chunkYQS2GSB4cjs.i; exports.usePublicClient = _chunkYQS2GSB4cjs.d; exports.useSwitchChain = _chunkYQS2GSB4cjs.j; exports.useTransactionReceipt = _chunkYQS2GSB4cjs.k;
|
package/dist/hooks/index.d.cts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { UsePublicClientParameters, UsePublicClientReturnType } from 'wagmi';
|
|
2
2
|
export { useBlockNumber, useChains, useConfig, useEnsAvatar, useEnsName, useSwitchChain, useTransactionReceipt } from 'wagmi';
|
|
3
|
-
import { B as BeraWagmiApi } from '../BeraWagmi-
|
|
4
|
-
export { u as useBeraWagmi } from '../BeraWagmi-
|
|
3
|
+
import { B as BeraWagmiApi, C as ChainId } from '../BeraWagmi-C5bwVJdu.cjs';
|
|
4
|
+
export { u as useBeraWagmi } from '../BeraWagmi-C5bwVJdu.cjs';
|
|
5
5
|
import 'react';
|
|
6
6
|
import 'viem';
|
|
7
|
-
import '@berachain/config/internal/edge-config';
|
|
8
7
|
import '../config/index.cjs';
|
|
9
8
|
import 'thirdweb';
|
|
10
9
|
import 'thirdweb/wallets';
|
|
@@ -16,8 +15,28 @@ declare function useBeraAccount(): Partial<NonNullable<BeraWagmiApi["account"]>>
|
|
|
16
15
|
declare function useBeraWallet(): {
|
|
17
16
|
readonly isConnected: boolean;
|
|
18
17
|
readonly address: `0x${string}` | undefined;
|
|
18
|
+
readonly defaultChainId: ChainId;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
declare function useCapabilities({ chainId }: {
|
|
22
|
+
chainId: number;
|
|
23
|
+
}): {
|
|
24
|
+
supportsAtomic: boolean;
|
|
25
|
+
capabilities: {
|
|
26
|
+
[x: string]: any;
|
|
27
|
+
atomic?: {
|
|
28
|
+
status: "supported" | "ready" | "unsupported";
|
|
29
|
+
} | undefined;
|
|
30
|
+
unstable_addSubAccount?: {
|
|
31
|
+
keyTypes: ("address" | "p256" | "webcrypto-p256" | "webauthn-p256")[];
|
|
32
|
+
supported: boolean;
|
|
33
|
+
} | undefined;
|
|
34
|
+
paymasterService?: {
|
|
35
|
+
supported: boolean;
|
|
36
|
+
} | undefined;
|
|
37
|
+
} | undefined;
|
|
19
38
|
};
|
|
20
39
|
|
|
21
40
|
declare function usePublicClient(args?: UsePublicClientParameters): UsePublicClientReturnType;
|
|
22
41
|
|
|
23
|
-
export { useBeraAccount, useBeraWallet, usePublicClient };
|
|
42
|
+
export { useBeraAccount, useBeraWallet, useCapabilities, usePublicClient };
|