@b3dotfun/sdk 0.0.50-alpha.0 → 0.0.50-alpha.2

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.
@@ -3,12 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useFirstEOA = useFirstEOA;
4
4
  const react_1 = require("../../../global-account/react");
5
5
  const debug_1 = require("../../../shared/utils/debug");
6
- const thirdweb_1 = require("../../../shared/utils/thirdweb");
7
6
  const react_2 = require("react");
8
- const viem_1 = require("thirdweb/adapters/viem");
9
7
  const react_3 = require("thirdweb/react");
10
8
  const debug = (0, debug_1.debugB3React)("useFirstEOA");
11
- function useFirstEOA(chain) {
9
+ function useFirstEOA() {
12
10
  const wallets = (0, react_3.useConnectedWallets)();
13
11
  const isConnected = (0, react_1.useAuthStore)(state => state.isConnected);
14
12
  const [firstEOA, setFirstEOA] = (0, react_2.useState)(undefined);
@@ -35,27 +33,9 @@ function useFirstEOA(chain) {
35
33
  };
36
34
  autoSelectFirstEOAWallet();
37
35
  }, [isConnected, wallets]);
38
- const walletClient = (0, react_2.useMemo)(() => {
39
- if (!firstEOA)
40
- return undefined;
41
- if (!chain)
42
- return undefined;
43
- try {
44
- const viemClientWallet = viem_1.viemAdapter.wallet.toViem({
45
- client: thirdweb_1.client,
46
- chain,
47
- wallet: firstEOA,
48
- });
49
- return viemClientWallet;
50
- }
51
- catch (err) {
52
- console.error("Error setting wallet client", err);
53
- }
54
- }, [firstEOA, chain]);
55
36
  return {
56
37
  account: firstEOA,
57
38
  address,
58
39
  info: walletInfo,
59
- walletClient,
60
40
  };
61
41
  }
@@ -58,7 +58,7 @@ export class BondkitToken {
58
58
  });
59
59
  this.publicClient = createPublicClient({
60
60
  chain: this.chain,
61
- transport,
61
+ transport: http(this.rpcUrl),
62
62
  });
63
63
  this.contract = getContract({
64
64
  address: this.contractAddress,
@@ -105,7 +105,7 @@ export class BondkitToken {
105
105
  });
106
106
  this.publicClient = createPublicClient({
107
107
  chain: this.chain,
108
- transport,
108
+ transport: http(this.rpcUrl),
109
109
  });
110
110
  this.contract = getContract({
111
111
  address: this.contractAddress,
@@ -165,7 +165,7 @@ export function useAuthentication(partnerId) {
165
165
  setIsConnected,
166
166
  setUser,
167
167
  ]);
168
- const logout = async (callback) => {
168
+ const logout = useCallback(async (callback) => {
169
169
  if (activeWallet) {
170
170
  debug("@@logout:activeWallet", activeWallet);
171
171
  disconnect(activeWallet);
@@ -182,6 +182,7 @@ export function useAuthentication(partnerId) {
182
182
  localStorage.removeItem("thirdweb:connected-wallet-ids");
183
183
  localStorage.removeItem("wagmi.store");
184
184
  localStorage.removeItem("lastAuthProvider");
185
+ localStorage.removeItem("b3-user");
185
186
  }
186
187
  app.logout();
187
188
  debug("@@logout:loggedOut");
@@ -189,7 +190,7 @@ export function useAuthentication(partnerId) {
189
190
  setIsConnected(false);
190
191
  setUser();
191
192
  callback?.();
192
- };
193
+ }, [activeWallet, disconnect, wallets, setIsAuthenticated, setUser, setIsConnected]);
193
194
  const { isLoading: useAutoConnectLoading } = useAutoConnect({
194
195
  client,
195
196
  wallets: [wallet],