@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.
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +3 -2
- package/dist/cjs/global-account/react/hooks/useFirstEOA.d.ts +7670 -1
- package/dist/cjs/global-account/react/hooks/useFirstEOA.js +21 -1
- package/dist/cjs/shared/constants/chains/b3Chain.d.ts +9 -3
- package/dist/esm/global-account/react/hooks/useAuthentication.js +3 -2
- package/dist/esm/global-account/react/hooks/useFirstEOA.d.ts +7670 -1
- package/dist/esm/global-account/react/hooks/useFirstEOA.js +22 -2
- package/dist/esm/shared/constants/chains/b3Chain.d.ts +9 -3
- package/dist/types/global-account/react/hooks/useFirstEOA.d.ts +7670 -1
- package/dist/types/shared/constants/chains/b3Chain.d.ts +9 -3
- package/package.json +6 -5
- package/src/global-account/react/hooks/useAuthentication.ts +29 -25
- package/src/global-account/react/hooks/useFirstEOA.tsx +20 -2
|
@@ -3,10 +3,12 @@ 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");
|
|
6
7
|
const react_2 = require("react");
|
|
8
|
+
const viem_1 = require("thirdweb/adapters/viem");
|
|
7
9
|
const react_3 = require("thirdweb/react");
|
|
8
10
|
const debug = (0, debug_1.debugB3React)("useFirstEOA");
|
|
9
|
-
function useFirstEOA() {
|
|
11
|
+
function useFirstEOA(chain) {
|
|
10
12
|
const wallets = (0, react_3.useConnectedWallets)();
|
|
11
13
|
const isConnected = (0, react_1.useAuthStore)(state => state.isConnected);
|
|
12
14
|
const [firstEOA, setFirstEOA] = (0, react_2.useState)(undefined);
|
|
@@ -33,9 +35,27 @@ function useFirstEOA() {
|
|
|
33
35
|
};
|
|
34
36
|
autoSelectFirstEOAWallet();
|
|
35
37
|
}, [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]);
|
|
36
55
|
return {
|
|
37
56
|
account: firstEOA,
|
|
38
57
|
address,
|
|
39
58
|
info: walletInfo,
|
|
59
|
+
walletClient,
|
|
40
60
|
};
|
|
41
61
|
}
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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"];
|
|
@@ -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],
|