@b3dotfun/sdk 0.0.50 → 0.0.51-alpha.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.
@@ -12,6 +12,7 @@ export declare const b3Mainnet: {
12
12
  readonly url: "https://explorer.b3.fun";
13
13
  };
14
14
  };
15
+ blockTime?: number | undefined | undefined;
15
16
  contracts?: {
16
17
  [x: string]: import("viem").ChainContract | {
17
18
  [sourceId: number]: import("viem").ChainContract | undefined;
@@ -19,7 +20,7 @@ export declare const b3Mainnet: {
19
20
  ensRegistry?: import("viem").ChainContract | undefined;
20
21
  ensUniversalResolver?: import("viem").ChainContract | undefined;
21
22
  multicall3?: import("viem").ChainContract | undefined;
22
- universalSignatureVerifier?: import("viem").ChainContract | undefined;
23
+ erc6492Verifier?: import("viem").ChainContract | undefined;
23
24
  } | undefined;
24
25
  ensTlds?: readonly string[] | undefined;
25
26
  id: 8333;
@@ -29,6 +30,7 @@ export declare const b3Mainnet: {
29
30
  readonly symbol: "ETH";
30
31
  readonly decimals: 18;
31
32
  };
33
+ experimental_preconfirmationTime?: number | undefined | undefined;
32
34
  rpcUrls: {
33
35
  readonly default: {
34
36
  readonly http: readonly ["https://mainnet-rpc.b3.fun"];
@@ -56,6 +58,7 @@ export declare const getViemChainConfig: (config: ChainNetworks) => {
56
58
  readonly url: string;
57
59
  };
58
60
  };
61
+ blockTime?: number | undefined | undefined;
59
62
  contracts?: {
60
63
  [x: string]: import("viem").ChainContract | {
61
64
  [sourceId: number]: import("viem").ChainContract | undefined;
@@ -63,7 +66,7 @@ export declare const getViemChainConfig: (config: ChainNetworks) => {
63
66
  ensRegistry?: import("viem").ChainContract | undefined;
64
67
  ensUniversalResolver?: import("viem").ChainContract | undefined;
65
68
  multicall3?: import("viem").ChainContract | undefined;
66
- universalSignatureVerifier?: import("viem").ChainContract | undefined;
69
+ erc6492Verifier?: import("viem").ChainContract | undefined;
67
70
  } | undefined;
68
71
  ensTlds?: readonly string[] | undefined;
69
72
  id: number;
@@ -73,6 +76,7 @@ export declare const getViemChainConfig: (config: ChainNetworks) => {
73
76
  name: string;
74
77
  decimals: number;
75
78
  };
79
+ experimental_preconfirmationTime?: number | undefined | undefined;
76
80
  rpcUrls: {
77
81
  readonly default: {
78
82
  readonly http: readonly [string];
@@ -103,6 +107,7 @@ export declare const b3Chain: Chain | {
103
107
  readonly url: "https://explorer.b3.fun";
104
108
  };
105
109
  };
110
+ blockTime?: number | undefined | undefined;
106
111
  contracts?: {
107
112
  [x: string]: import("viem").ChainContract | {
108
113
  [sourceId: number]: import("viem").ChainContract | undefined;
@@ -110,7 +115,7 @@ export declare const b3Chain: Chain | {
110
115
  ensRegistry?: import("viem").ChainContract | undefined;
111
116
  ensUniversalResolver?: import("viem").ChainContract | undefined;
112
117
  multicall3?: import("viem").ChainContract | undefined;
113
- universalSignatureVerifier?: import("viem").ChainContract | undefined;
118
+ erc6492Verifier?: import("viem").ChainContract | undefined;
114
119
  } | undefined;
115
120
  ensTlds?: readonly string[] | undefined;
116
121
  id: 8333;
@@ -120,6 +125,7 @@ export declare const b3Chain: Chain | {
120
125
  readonly symbol: "ETH";
121
126
  readonly decimals: 18;
122
127
  };
128
+ experimental_preconfirmationTime?: number | undefined | undefined;
123
129
  rpcUrls: {
124
130
  readonly default: {
125
131
  readonly http: readonly ["https://mainnet-rpc.b3.fun"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.0.50",
3
+ "version": "0.0.51-alpha.0",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -301,7 +301,7 @@
301
301
  "@solana/web3.js": "^1.98.2",
302
302
  "@stripe/react-stripe-js": "^3.7.0",
303
303
  "@stripe/stripe-js": "^7.3.1",
304
- "@thirdweb-dev/wagmi-adapter": "0.2.159",
304
+ "@thirdweb-dev/wagmi-adapter": "0.2.165",
305
305
  "@web3icons/react": "3.16.0",
306
306
  "big.js": "^7.0.1",
307
307
  "class-variance-authority": "0.7.0",
@@ -374,10 +374,11 @@
374
374
  "react": "^18.0.0 || ^19.0.0",
375
375
  "react-dom": "^18.0.0 || ^19.0.0",
376
376
  "react-native-mmkv": "^3.2.0",
377
- "thirdweb": "5.108.9",
377
+ "thirdweb": "5.108.14",
378
378
  "three": "^0.175.0",
379
- "viem": "^2.28.1",
380
- "wagmi": "^2.14.15"
379
+ "viem": "2.37.9",
380
+ "wagmi": "2.16.9",
381
+ "@wagmi/core": "2.20.3"
381
382
  },
382
383
  "peerDependenciesMeta": {
383
384
  "@react-three/postprocessing": {
@@ -193,35 +193,39 @@ export function useAuthentication(partnerId: string) {
193
193
  ],
194
194
  );
195
195
 
196
- const logout = async (callback?: () => void) => {
197
- if (activeWallet) {
198
- debug("@@logout:activeWallet", activeWallet);
199
- disconnect(activeWallet);
200
- debug("@@logout:activeWallet", activeWallet);
201
- }
196
+ const logout = useCallback(
197
+ async (callback?: () => void) => {
198
+ if (activeWallet) {
199
+ debug("@@logout:activeWallet", activeWallet);
200
+ disconnect(activeWallet);
201
+ debug("@@logout:activeWallet", activeWallet);
202
+ }
202
203
 
203
- // Log out of each wallet
204
- wallets.forEach(wallet => {
205
- console.log("@@logging out", wallet);
206
- disconnect(wallet);
207
- });
204
+ // Log out of each wallet
205
+ wallets.forEach(wallet => {
206
+ console.log("@@logging out", wallet);
207
+ disconnect(wallet);
208
+ });
208
209
 
209
- // Delete localStorage thirdweb:connected-wallet-ids
210
- // https://npc-labs.slack.com/archives/C070E6HNG85/p1750185115273099
211
- if (typeof localStorage !== "undefined") {
212
- localStorage.removeItem("thirdweb:connected-wallet-ids");
213
- localStorage.removeItem("wagmi.store");
214
- localStorage.removeItem("lastAuthProvider");
215
- }
210
+ // Delete localStorage thirdweb:connected-wallet-ids
211
+ // https://npc-labs.slack.com/archives/C070E6HNG85/p1750185115273099
212
+ if (typeof localStorage !== "undefined") {
213
+ localStorage.removeItem("thirdweb:connected-wallet-ids");
214
+ localStorage.removeItem("wagmi.store");
215
+ localStorage.removeItem("lastAuthProvider");
216
+ localStorage.removeItem("b3-user");
217
+ }
216
218
 
217
- app.logout();
218
- debug("@@logout:loggedOut");
219
+ app.logout();
220
+ debug("@@logout:loggedOut");
219
221
 
220
- setIsAuthenticated(false);
221
- setIsConnected(false);
222
- setUser();
223
- callback?.();
224
- };
222
+ setIsAuthenticated(false);
223
+ setIsConnected(false);
224
+ setUser();
225
+ callback?.();
226
+ },
227
+ [activeWallet, disconnect, wallets, setIsAuthenticated, setUser, setIsConnected],
228
+ );
225
229
 
226
230
  const { isLoading: useAutoConnectLoading } = useAutoConnect({
227
231
  client,
@@ -1,12 +1,14 @@
1
1
  import { useAuthStore } from "@b3dotfun/sdk/global-account/react";
2
2
  import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
3
- import { useEffect, useState } from "react";
3
+ import { client } from "@b3dotfun/sdk/shared/utils/thirdweb";
4
+ import { useEffect, useMemo, useState } from "react";
5
+ import { viemAdapter } from "thirdweb/adapters/viem";
4
6
  import { useConnectedWallets, useWalletInfo } from "thirdweb/react";
5
7
  import { Wallet } from "thirdweb/wallets";
6
8
 
7
9
  const debug = debugB3React("useFirstEOA");
8
10
 
9
- export function useFirstEOA() {
11
+ export function useFirstEOA(chain?: { id: number; name: string; rpc: string }) {
10
12
  const wallets = useConnectedWallets();
11
13
  const isConnected = useAuthStore(state => state.isConnected);
12
14
  const [firstEOA, setFirstEOA] = useState<Wallet | undefined>(undefined);
@@ -39,9 +41,25 @@ export function useFirstEOA() {
39
41
  autoSelectFirstEOAWallet();
40
42
  }, [isConnected, wallets]);
41
43
 
44
+ const walletClient = useMemo(() => {
45
+ if (!firstEOA) return undefined;
46
+ if (!chain) return undefined;
47
+ try {
48
+ const viemClientWallet = viemAdapter.wallet.toViem({
49
+ client,
50
+ chain,
51
+ wallet: firstEOA,
52
+ });
53
+ return viemClientWallet;
54
+ } catch (err) {
55
+ console.error("Error setting wallet client", err);
56
+ }
57
+ }, [firstEOA, chain]);
58
+
42
59
  return {
43
60
  account: firstEOA,
44
61
  address,
45
62
  info: walletInfo,
63
+ walletClient,
46
64
  };
47
65
  }