@berachain/wagmi 0.2.0-beta.1 → 0.3.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-BfIT9GJt.d.cts → BeraWagmi-8ToIEnAn.d.ts} +20 -22
- package/dist/{BeraWagmi-BfIT9GJt.d.ts → BeraWagmi-DqUsx-wd.d.cts} +20 -22
- package/dist/chunk-3MA6ZB64.cjs +1 -0
- package/dist/chunk-3VNWHDTQ.cjs +1 -0
- package/dist/chunk-HH2ZYQRJ.mjs +1 -0
- package/dist/chunk-YYGDSOWD.mjs +1 -0
- package/dist/config/index.cjs +1 -1
- package/dist/config/index.d.cts +20 -18
- package/dist/config/index.d.ts +20 -18
- package/dist/config/index.mjs +1 -1
- package/dist/context/index.cjs +1 -1
- package/dist/context/index.d.cts +11 -7
- package/dist/context/index.d.ts +11 -7
- 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 +26 -5
- package/dist/hooks/index.d.ts +26 -5
- package/dist/hooks/index.mjs +1 -1
- package/package.json +12 -8
- package/src/config/defaultWagmiConfig.ts +45 -139
- package/src/context/BeraWagmi.tsx +43 -112
- package/src/context/LightweightAccountProvider.tsx +9 -2
- package/src/context/WagmiProvider.tsx +32 -15
- package/src/context/useThirdweb.tsx +40 -46
- 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-5Q3SXXEY.mjs +0 -1
- package/dist/chunk-DYMS6OAP.cjs +0 -1
- package/dist/chunk-S2KJM5XB.cjs +0 -1
- package/dist/chunk-TZTB265J.mjs +0 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { EdgeConfigSchema } from '@berachain/config/internal/edge-config';
|
|
2
|
+
import { Address, Chain } from 'viem';
|
|
3
|
+
import { UseWalletClientReturnType } from 'wagmi';
|
|
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,6 +51,10 @@ 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
|
connectWallet: () => Promise<void> | void;
|
|
68
60
|
disconnect(): void;
|
|
@@ -75,13 +67,16 @@ interface BeraWagmiApi {
|
|
|
75
67
|
/**
|
|
76
68
|
* List of external chains that are whitelisted for that app.
|
|
77
69
|
*/
|
|
78
|
-
|
|
70
|
+
chains: Chain[];
|
|
71
|
+
defaultChainId: ChainId;
|
|
72
|
+
}
|
|
73
|
+
declare enum ChainId {
|
|
74
|
+
MAINNET = 80094,
|
|
75
|
+
BEPOLIA = 80069
|
|
79
76
|
}
|
|
80
77
|
interface IBeraWagmiProviderProps extends PropsWithChildren {
|
|
81
|
-
|
|
82
|
-
wagmi: Config;
|
|
78
|
+
config: ReturnType<typeof getConfig>;
|
|
83
79
|
theme?: "dark" | "light" | "auto";
|
|
84
|
-
isEmbeddedWalletsEnabled: boolean;
|
|
85
80
|
disableEip5792: boolean;
|
|
86
81
|
/**
|
|
87
82
|
* Whether to disable the 5792 upgrade for users that haven't upgraded yet.
|
|
@@ -91,13 +86,16 @@ interface IBeraWagmiProviderProps extends PropsWithChildren {
|
|
|
91
86
|
disable5792Upgrade?: boolean;
|
|
92
87
|
accountOverride?: Address;
|
|
93
88
|
onSmartAccountRejection?: () => void;
|
|
94
|
-
edgeConfigChainList: EdgeConfigSchema["wagmi"]["externalChainList"];
|
|
95
89
|
/**
|
|
96
90
|
* Event triggered when a wallet is connected manually.
|
|
97
91
|
*
|
|
98
92
|
* This is not triggered when a wallet connect automatically after a refresh.
|
|
99
93
|
*/
|
|
100
94
|
onConnectedWallet?: () => void;
|
|
95
|
+
chains: Chain[];
|
|
96
|
+
defaultChain: Chain;
|
|
97
|
+
thirdweb: ThirdwebConfig;
|
|
98
|
+
publicJsonRpcUrl: string;
|
|
101
99
|
}
|
|
102
100
|
|
|
103
|
-
export { type BeraWagmiApi as B, type IBeraWagmiProviderProps as I, useBeraWagmi as u };
|
|
101
|
+
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 {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { EdgeConfigSchema } from '@berachain/config/internal/edge-config';
|
|
2
|
+
import { Address, Chain } from 'viem';
|
|
3
|
+
import { UseWalletClientReturnType } from 'wagmi';
|
|
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,6 +51,10 @@ 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
|
connectWallet: () => Promise<void> | void;
|
|
68
60
|
disconnect(): void;
|
|
@@ -75,13 +67,16 @@ interface BeraWagmiApi {
|
|
|
75
67
|
/**
|
|
76
68
|
* List of external chains that are whitelisted for that app.
|
|
77
69
|
*/
|
|
78
|
-
|
|
70
|
+
chains: Chain[];
|
|
71
|
+
defaultChainId: ChainId;
|
|
72
|
+
}
|
|
73
|
+
declare enum ChainId {
|
|
74
|
+
MAINNET = 80094,
|
|
75
|
+
BEPOLIA = 80069
|
|
79
76
|
}
|
|
80
77
|
interface IBeraWagmiProviderProps extends PropsWithChildren {
|
|
81
|
-
|
|
82
|
-
wagmi: Config;
|
|
78
|
+
config: ReturnType<typeof getConfig>;
|
|
83
79
|
theme?: "dark" | "light" | "auto";
|
|
84
|
-
isEmbeddedWalletsEnabled: boolean;
|
|
85
80
|
disableEip5792: boolean;
|
|
86
81
|
/**
|
|
87
82
|
* Whether to disable the 5792 upgrade for users that haven't upgraded yet.
|
|
@@ -91,13 +86,16 @@ interface IBeraWagmiProviderProps extends PropsWithChildren {
|
|
|
91
86
|
disable5792Upgrade?: boolean;
|
|
92
87
|
accountOverride?: Address;
|
|
93
88
|
onSmartAccountRejection?: () => void;
|
|
94
|
-
edgeConfigChainList: EdgeConfigSchema["wagmi"]["externalChainList"];
|
|
95
89
|
/**
|
|
96
90
|
* Event triggered when a wallet is connected manually.
|
|
97
91
|
*
|
|
98
92
|
* This is not triggered when a wallet connect automatically after a refresh.
|
|
99
93
|
*/
|
|
100
94
|
onConnectedWallet?: () => void;
|
|
95
|
+
chains: Chain[];
|
|
96
|
+
defaultChain: Chain;
|
|
97
|
+
thirdweb: ThirdwebConfig;
|
|
98
|
+
publicJsonRpcUrl: string;
|
|
101
99
|
}
|
|
102
100
|
|
|
103
|
-
export { type BeraWagmiApi as B, type IBeraWagmiProviderProps as I, useBeraWagmi as u };
|
|
101
|
+
export { type BeraWagmiApi as B, ChainId as C, type IBeraWagmiProviderProps as I, useBeraWagmi as u };
|
|
@@ -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:t,transports:l={},defaultChain:a,chains:r=[]}){let o=_thirdweb.createThirdwebClient.call(void 0, {clientId:t.clientId}),s=!!_optionalChain([a, 'access', _ => _.contracts, 'optionalAccess', _2 => _2.multicall3]),n={mode:"EIP7702",sponsorGas:t.sponsorGas},c=_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((d,p,f)=>f.findIndex(m=>m.id===d.id)===p);return{wallets:t.embeddedWallets?[c,...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 x=_react.createContext.call(void 0, void 0);function T({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 N({config:e,theme:n,chains:o,chain:t,publicJsonRpcUrl:u}){let{connectors:C,connect:b}=_wagmi.useConnect.call(void 0, ),i=_react3.useActiveWallet.call(void 0, ),r=_react3.useActiveAccount.call(void 0, ),{disconnect:w}=_react3.useDisconnect.call(void 0, ),{data:g}=_react3.useWalletInfo.call(void 0, _optionalChain([i, 'optionalAccess', _2 => _2.id])),d=_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:[u]}}}),[u,t]),m={client:e.client,chain:d,wallets:e.wallets};async function p(a){let l=C.find(s=>s.id==="in-app-wallet");if(l){let s={withCapabilities:!0,wallet:a};b({connector:l,chainId:t.id,...s})}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([i, 'optionalAccess', _3 => _3.id]),_optionalChain([r, 'optionalAccess', _4 => _4.address])]),{connect:v}=_react3.useConnectModal.call(void 0, );return{async connect(){let a=await v({...m,wallets:e.wallets,theme:n==="auto"?void 0:n,size:"compact",chains:[d,...o.map(l=>_thirdweb.defineChain.call(void 0, {id:l.id}))]});await p(a)},disconnect(){i&&w(i)},isConnecting:A,connectionId:W,connectorName:_nullishCoalesce(_optionalChain([g, 'optionalAccess', _5 => _5.name]), () => (null)),isEmbeddedWallet:_optionalChain([g, 'optionalAccess', _6 => _6.id])==="inApp",wallet:r,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, k);if(!e)throw new Error("BeraWagmiContext not found");return e}var k=_react.createContext.call(void 0, void 0);function ke({children:e,config:n,disableEip5792:o,disable5792Upgrade:t,theme:u,accountOverride:C,onSmartAccountRejection:b,chains:i,defaultChain:r,thirdweb:w,publicJsonRpcUrl:g}){let{wallet:d,connect:m,DebugConnectButton:p,connectionId:A,disconnect:W,connectorName:v,isEmbeddedWallet:a,isConnecting:l}=N({config:n,theme:u,chains:i,chain:r,publicJsonRpcUrl:g}),{address:s,chainId:y}=_wagmi.useAccount.call(void 0, ),{disconnect:D}=_wagmi.useDisconnect.call(void 0, ),S=_wagmi.usePublicClient.call(void 0, ),c=_react.useMemo.call(void 0, ()=>{if(!(!s||!d))return _nullishCoalesce(C, () => (s))},[C,s,d]),{data:h}=_wagmi.useEnsName.call(void 0, {config:n.wagmi,chainId:r.id,address:c}),{data:P}=_immutable2.default.call(void 0, c?["BeraWagmiProvider_code",c,y]:null,([K,j,ge])=>_optionalChain([S, 'optionalAccess', _7 => _7.getCode, 'call', _8 => _8({address:j})]),{refreshInterval:6e4}),[O,_]=_react.useMemo.call(void 0, ()=>P?P.startsWith("0xef01")?[!1,!0]:[!0,!1]:[!1,!1],[P]),{data:E}=_wagmi.useWalletClient.call(void 0, ),q=_react.useMemo.call(void 0, ()=>{try{return h?_ens.normalize.call(void 0, h):void 0}catch (e2){}},[h]),J=_wagmi.useEnsAvatar.call(void 0, {name:q});return _jsxruntime.jsx.call(void 0, k.Provider,{value:{flags:{disableEip5792:o,disable5792Upgrade:!!t},walletClient:E,onSmartAccountRejection:()=>{_optionalChain([b, 'optionalCall', _9 => _9()])},isEmbeddedWalletsEnabled:_nullishCoalesce(w.embeddedWallets, () => (!0)),isConnecting:l,isConnected:!!c&&!!E,DebugConnectButton:p,account:d&&y&&c?{connectionId:A,chainId:y,connectorName:v,isEmbeddedWallet:a,wallet:{address:c,ensName:_nullishCoalesce(_optionalChain([h, 'optionalAccess', _10 => _10.replace, 'call', _11 => _11(".bera",".\u{1F43B}\u26D3\uFE0F")]), () => (null)),ensAvatar:_nullishCoalesce(J.data, () => (null)),has7702Authorization:_,isContract:O}}:void 0,connectWallet:async()=>{console.log("connectWallet.called"),await m()},disconnect:()=>{D(),W()},chains:i,defaultChainId:r.id},children:_jsxruntime.jsx.call(void 0, T,{address:c,defaultChainId:r.id,children:e})})}function ue(){let{account:e,isConnected:n}=f();return{...e,isConnected:n}}function fe({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 He(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 = ue; exports.c = fe; exports.d = He; exports.e = _wagmi.useBlockNumber; exports.f = _wagmi.useChains; exports.g = _wagmi.useConfig; exports.h = _wagmi.useEnsAvatar; exports.i = _wagmi.useEnsName; exports.j = _wagmi.useSwitchChain; exports.k = _wagmi.useTransactionReceipt; exports.l = f; exports.m = ke;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{usePublicClient as Ce}from"wagmi";import{useContext as H}from"react";import{createContext as F}from"react";import{jsx as G}from"react/jsx-runtime";var x=F(void 0);function T({children:e,address:n,defaultChainId:o}){return G(x.Provider,{value:{address:n,defaultChainId:o},children:e})}function I(){let e=H(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 Xe,useChains as Ye,useConfig as Ze,useEnsAvatar as z,useEnsName as M,useSwitchChain as $e,useTransactionReceipt as et}from"wagmi";import{createContext as oe,useContext as ie,useMemo as B}from"react";import re from"swr/immutable";import{normalize as ae}from"viem/ens";import{useAccount as se,useDisconnect as ce,usePublicClient as de,useWalletClient as le}from"wagmi";import{useMemo as U}from"react";import{defineChain as R}from"thirdweb";import{ConnectButton as Q,useActiveAccount as V,useActiveWallet as X,useAutoConnect as Y,useConnectModal as Z,useDisconnect as $,useWalletInfo as ee}from"thirdweb/react";import{useConnect as te}from"wagmi";import{jsx as ne}from"react/jsx-runtime";function N({config:e,theme:n,chains:o,chain:t,publicJsonRpcUrl:u}){let{connectors:C,connect:b}=te(),i=X(),r=V(),{disconnect:w}=$(),{data:g}=ee(i?.id),d=U(()=>R({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:[u]}}}),[u,t]),m={client:e.client,chain:d,wallets:e.wallets};async function p(a){let l=C.find(s=>s.id==="in-app-wallet");if(l){let s={withCapabilities:!0,wallet:a};b({connector:l,chainId:t.id,...s})}else console.error("no tw connector found")}let{isLoading:A}=Y({...m,onConnect:p}),W=U(()=>crypto.randomUUID(),[i?.id,r?.address]),{connect:v}=Z();return{async connect(){let a=await v({...m,wallets:e.wallets,theme:n==="auto"?void 0:n,size:"compact",chains:[d,...o.map(l=>R({id:l.id}))]});await p(a)},disconnect(){i&&w(i)},isConnecting:A,connectionId:W,connectorName:g?.name??null,isEmbeddedWallet:g?.id==="inApp",wallet:r,DebugConnectButton(){return ne(Q,{...m,connectModal:{size:"compact"},onConnect:a=>p(a)})}}}import{jsx as L}from"react/jsx-runtime";function f(){let e=ie(k);if(!e)throw new Error("BeraWagmiContext not found");return e}var k=oe(void 0);function ke({children:e,config:n,disableEip5792:o,disable5792Upgrade:t,theme:u,accountOverride:C,onSmartAccountRejection:b,chains:i,defaultChain:r,thirdweb:w,publicJsonRpcUrl:g}){let{wallet:d,connect:m,DebugConnectButton:p,connectionId:A,disconnect:W,connectorName:v,isEmbeddedWallet:a,isConnecting:l}=N({config:n,theme:u,chains:i,chain:r,publicJsonRpcUrl:g}),{address:s,chainId:y}=se(),{disconnect:D}=ce(),S=de(),c=B(()=>{if(!(!s||!d))return C??s},[C,s,d]),{data:h}=M({config:n.wagmi,chainId:r.id,address:c}),{data:P}=re(c?["BeraWagmiProvider_code",c,y]:null,([K,j,ge])=>S?.getCode({address:j}),{refreshInterval:6e4}),[O,_]=B(()=>P?P.startsWith("0xef01")?[!1,!0]:[!0,!1]:[!1,!1],[P]),{data:E}=le(),q=B(()=>{try{return h?ae(h):void 0}catch{}},[h]),J=z({name:q});return L(k.Provider,{value:{flags:{disableEip5792:o,disable5792Upgrade:!!t},walletClient:E,onSmartAccountRejection:()=>{b?.()},isEmbeddedWalletsEnabled:w.embeddedWallets??!0,isConnecting:l,isConnected:!!c&&!!E,DebugConnectButton:p,account:d&&y&&c?{connectionId:A,chainId:y,connectorName:v,isEmbeddedWallet:a,wallet:{address:c,ensName:h?.replace(".bera",".\u{1F43B}\u26D3\uFE0F")??null,ensAvatar:J.data??null,has7702Authorization:_,isContract:O}}:void 0,connectWallet:async()=>{console.log("connectWallet.called"),await m()},disconnect:()=>{D(),W()},chains:i,defaultChainId:r.id},children:L(T,{address:c,defaultChainId:r.id,children:e})})}function ue(){let{account:e,isConnected:n}=f();return{...e,isConnected:n}}import{useMemo as me}from"react";import{useCapabilities as pe}from"wagmi";function fe({chainId:e}){let{flags:n,account:o}=f(),{data:t}=pe({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 He(e){let{defaultChainId:n}=I(),{chainId:o,...t}=e??{};return Ce({chainId:o??n,...t})}export{I as a,ue as b,fe as c,He as d,Xe as e,Ye as f,Ze as g,z as h,M as i,$e as j,et as k,f as l,ke as m};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{inAppWalletConnector as g}from"@thirdweb-dev/wagmi-adapter";import{createThirdwebClient as C}from"thirdweb";import{createWallet as e,getInstalledWallets as b,inAppWallet as u}from"thirdweb/wallets";import{createConfig as h,createStorage as w}from"wagmi";function A({thirdweb:t,transports:l={},defaultChain:a,chains:r=[]}){let o=C({clientId:t.clientId}),s=!!a.contracts?.multicall3,n={mode:"EIP7702",sponsorGas:t.sponsorGas},c=u({executionMode:n}),i=[...b(),e("io.rabby"),e("io.metamask"),e("com.coinbase.wallet"),e("walletConnect")].filter((d,p,f)=>f.findIndex(m=>m.id===d.id)===p);return{wallets:t.embeddedWallets?[c,...i]:i,executionMode:n,client:o,wagmi:h({chains:[a,...r],ssr:!0,connectors:[g({client:o,executionMode:n})],storage:w({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/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 _chunk3MA6ZB64cjs = require('../chunk-3MA6ZB64.cjs');exports.getConfig = _chunk3MA6ZB64cjs.a;
|
package/dist/config/index.d.cts
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
import * as thirdweb from 'thirdweb';
|
|
2
|
-
import
|
|
2
|
+
import * as thirdweb_wallets from 'thirdweb/wallets';
|
|
3
|
+
import { Transport, Chain } from 'viem';
|
|
3
4
|
import { Config } from 'wagmi';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
* Using default viem chain definition since it also includes ens and other metadata
|
|
7
|
-
*/
|
|
8
|
-
declare const chain: Chain;
|
|
9
|
-
declare const defaultBeraNetworkConfig: NetworkConfig;
|
|
10
|
-
interface NetworkConfig {
|
|
11
|
-
chain: Chain;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Exporting this is helpful for the multi-chain zap, to get the list of chains that we want to support.
|
|
15
|
-
*/
|
|
16
|
-
declare const externalChains: Chain[];
|
|
17
|
-
declare const chainIdToName: Record<Chain["id"], string>;
|
|
18
|
-
declare function getWagmiConfig({ sponsorGas }: {
|
|
6
|
+
interface ThirdwebConfig {
|
|
19
7
|
sponsorGas?: boolean;
|
|
20
|
-
|
|
21
|
-
|
|
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
|
+
wallets: thirdweb_wallets.Wallet[];
|
|
19
|
+
executionMode: {
|
|
20
|
+
readonly mode: "EIP7702";
|
|
21
|
+
readonly sponsorGas: boolean | undefined;
|
|
22
|
+
};
|
|
23
|
+
client: thirdweb.ThirdwebClient;
|
|
22
24
|
wagmi: Config;
|
|
23
25
|
};
|
|
24
26
|
|
|
25
|
-
export { type
|
|
27
|
+
export { type BeraWagmiConfig, type ThirdwebConfig, getConfig };
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
import * as thirdweb from 'thirdweb';
|
|
2
|
-
import
|
|
2
|
+
import * as thirdweb_wallets from 'thirdweb/wallets';
|
|
3
|
+
import { Transport, Chain } from 'viem';
|
|
3
4
|
import { Config } from 'wagmi';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
* Using default viem chain definition since it also includes ens and other metadata
|
|
7
|
-
*/
|
|
8
|
-
declare const chain: Chain;
|
|
9
|
-
declare const defaultBeraNetworkConfig: NetworkConfig;
|
|
10
|
-
interface NetworkConfig {
|
|
11
|
-
chain: Chain;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Exporting this is helpful for the multi-chain zap, to get the list of chains that we want to support.
|
|
15
|
-
*/
|
|
16
|
-
declare const externalChains: Chain[];
|
|
17
|
-
declare const chainIdToName: Record<Chain["id"], string>;
|
|
18
|
-
declare function getWagmiConfig({ sponsorGas }: {
|
|
6
|
+
interface ThirdwebConfig {
|
|
19
7
|
sponsorGas?: boolean;
|
|
20
|
-
|
|
21
|
-
|
|
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
|
+
wallets: thirdweb_wallets.Wallet[];
|
|
19
|
+
executionMode: {
|
|
20
|
+
readonly mode: "EIP7702";
|
|
21
|
+
readonly sponsorGas: boolean | undefined;
|
|
22
|
+
};
|
|
23
|
+
client: thirdweb.ThirdwebClient;
|
|
22
24
|
wagmi: Config;
|
|
23
25
|
};
|
|
24
26
|
|
|
25
|
-
export { type
|
|
27
|
+
export { type BeraWagmiConfig, type ThirdwebConfig, getConfig };
|
package/dist/config/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a
|
|
1
|
+
import{a as o}from"../chunk-YYGDSOWD.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 _chunk3MA6ZB64cjs = require('../chunk-3MA6ZB64.cjs');var _chunk3VNWHDTQcjs = require('../chunk-3VNWHDTQ.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, ()=>_chunk3MA6ZB64cjs.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, _chunk3VNWHDTQcjs.m,{...f,thirdweb:o,chains:i,defaultChain:e,config:t})})})})}exports.WagmiProvider = h;
|
package/dist/context/index.d.cts
CHANGED
|
@@ -1,13 +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-DqUsx-wd.cjs';
|
|
3
4
|
import 'react';
|
|
4
|
-
import 'thirdweb';
|
|
5
|
-
import 'viem';
|
|
6
5
|
import 'wagmi';
|
|
7
|
-
import '
|
|
6
|
+
import '../config/index.cjs';
|
|
7
|
+
import 'thirdweb';
|
|
8
|
+
import 'thirdweb/wallets';
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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;
|
|
12
16
|
|
|
13
17
|
export { WagmiProvider };
|
package/dist/context/index.d.ts
CHANGED
|
@@ -1,13 +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-8ToIEnAn.js';
|
|
3
4
|
import 'react';
|
|
4
|
-
import 'thirdweb';
|
|
5
|
-
import 'viem';
|
|
6
5
|
import 'wagmi';
|
|
7
|
-
import '
|
|
6
|
+
import '../config/index.js';
|
|
7
|
+
import 'thirdweb';
|
|
8
|
+
import 'thirdweb/wallets';
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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;
|
|
12
16
|
|
|
13
17
|
export { WagmiProvider };
|
package/dist/context/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{a as m}from"../chunk-YYGDSOWD.mjs";import{m as a}from"../chunk-HH2ZYQRJ.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 _chunk3VNWHDTQcjs = require('../chunk-3VNWHDTQ.cjs');exports.useBeraAccount = _chunk3VNWHDTQcjs.b; exports.useBeraWagmi = _chunk3VNWHDTQcjs.l; exports.useBeraWallet = _chunk3VNWHDTQcjs.a; exports.useBlockNumber = _chunk3VNWHDTQcjs.e; exports.useCapabilities = _chunk3VNWHDTQcjs.c; exports.useChains = _chunk3VNWHDTQcjs.f; exports.useConfig = _chunk3VNWHDTQcjs.g; exports.useEnsAvatar = _chunk3VNWHDTQcjs.h; exports.useEnsName = _chunk3VNWHDTQcjs.i; exports.usePublicClient = _chunk3VNWHDTQcjs.d; exports.useSwitchChain = _chunk3VNWHDTQcjs.j; exports.useTransactionReceipt = _chunk3VNWHDTQcjs.k;
|
package/dist/hooks/index.d.cts
CHANGED
|
@@ -1,11 +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 } from '../BeraWagmi-
|
|
4
|
-
export { u as useBeraWagmi } from '../BeraWagmi-
|
|
3
|
+
import { B as BeraWagmiApi, C as ChainId } from '../BeraWagmi-DqUsx-wd.cjs';
|
|
4
|
+
export { u as useBeraWagmi } from '../BeraWagmi-DqUsx-wd.cjs';
|
|
5
5
|
import 'react';
|
|
6
|
-
import 'thirdweb';
|
|
7
6
|
import 'viem';
|
|
8
|
-
import '
|
|
7
|
+
import '../config/index.cjs';
|
|
8
|
+
import 'thirdweb';
|
|
9
|
+
import 'thirdweb/wallets';
|
|
9
10
|
|
|
10
11
|
declare function useBeraAccount(): Partial<NonNullable<BeraWagmiApi["account"]>> & {
|
|
11
12
|
isConnected: boolean;
|
|
@@ -14,8 +15,28 @@ declare function useBeraAccount(): Partial<NonNullable<BeraWagmiApi["account"]>>
|
|
|
14
15
|
declare function useBeraWallet(): {
|
|
15
16
|
readonly isConnected: boolean;
|
|
16
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;
|
|
17
38
|
};
|
|
18
39
|
|
|
19
40
|
declare function usePublicClient(args?: UsePublicClientParameters): UsePublicClientReturnType;
|
|
20
41
|
|
|
21
|
-
export { useBeraAccount, useBeraWallet, usePublicClient };
|
|
42
|
+
export { useBeraAccount, useBeraWallet, useCapabilities, usePublicClient };
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,11 +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 } from '../BeraWagmi-
|
|
4
|
-
export { u as useBeraWagmi } from '../BeraWagmi-
|
|
3
|
+
import { B as BeraWagmiApi, C as ChainId } from '../BeraWagmi-8ToIEnAn.js';
|
|
4
|
+
export { u as useBeraWagmi } from '../BeraWagmi-8ToIEnAn.js';
|
|
5
5
|
import 'react';
|
|
6
|
-
import 'thirdweb';
|
|
7
6
|
import 'viem';
|
|
8
|
-
import '
|
|
7
|
+
import '../config/index.js';
|
|
8
|
+
import 'thirdweb';
|
|
9
|
+
import 'thirdweb/wallets';
|
|
9
10
|
|
|
10
11
|
declare function useBeraAccount(): Partial<NonNullable<BeraWagmiApi["account"]>> & {
|
|
11
12
|
isConnected: boolean;
|
|
@@ -14,8 +15,28 @@ declare function useBeraAccount(): Partial<NonNullable<BeraWagmiApi["account"]>>
|
|
|
14
15
|
declare function useBeraWallet(): {
|
|
15
16
|
readonly isConnected: boolean;
|
|
16
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;
|
|
17
38
|
};
|
|
18
39
|
|
|
19
40
|
declare function usePublicClient(args?: UsePublicClientParameters): UsePublicClientReturnType;
|
|
20
41
|
|
|
21
|
-
export { useBeraAccount, useBeraWallet, usePublicClient };
|
|
42
|
+
export { useBeraAccount, useBeraWallet, useCapabilities, usePublicClient };
|
package/dist/hooks/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k}from"../chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l}from"../chunk-HH2ZYQRJ.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};
|