@b3dotfun/sdk 0.0.52-alpha.1 → 0.0.53-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/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/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/useFirstEOA.tsx +20 -2
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { useAuthStore } from "../../../global-account/react/index.js";
|
|
2
2
|
import { debugB3React } from "../../../shared/utils/debug.js";
|
|
3
|
-
import {
|
|
3
|
+
import { client } from "../../../shared/utils/thirdweb.js";
|
|
4
|
+
import { useEffect, useMemo, useState } from "react";
|
|
5
|
+
import { viemAdapter } from "thirdweb/adapters/viem";
|
|
4
6
|
import { useConnectedWallets, useWalletInfo } from "thirdweb/react";
|
|
5
7
|
const debug = debugB3React("useFirstEOA");
|
|
6
|
-
export function useFirstEOA() {
|
|
8
|
+
export function useFirstEOA(chain) {
|
|
7
9
|
const wallets = useConnectedWallets();
|
|
8
10
|
const isConnected = useAuthStore(state => state.isConnected);
|
|
9
11
|
const [firstEOA, setFirstEOA] = useState(undefined);
|
|
@@ -30,9 +32,27 @@ export function useFirstEOA() {
|
|
|
30
32
|
};
|
|
31
33
|
autoSelectFirstEOAWallet();
|
|
32
34
|
}, [isConnected, wallets]);
|
|
35
|
+
const walletClient = useMemo(() => {
|
|
36
|
+
if (!firstEOA)
|
|
37
|
+
return undefined;
|
|
38
|
+
if (!chain)
|
|
39
|
+
return undefined;
|
|
40
|
+
try {
|
|
41
|
+
const viemClientWallet = viemAdapter.wallet.toViem({
|
|
42
|
+
client,
|
|
43
|
+
chain,
|
|
44
|
+
wallet: firstEOA,
|
|
45
|
+
});
|
|
46
|
+
return viemClientWallet;
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
console.error("Error setting wallet client", err);
|
|
50
|
+
}
|
|
51
|
+
}, [firstEOA, chain]);
|
|
33
52
|
return {
|
|
34
53
|
account: firstEOA,
|
|
35
54
|
address,
|
|
36
55
|
info: walletInfo,
|
|
56
|
+
walletClient,
|
|
37
57
|
};
|
|
38
58
|
}
|
|
@@ -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"];
|