@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.
- package/dist/cjs/bondkit/bondkitToken.js +2 -2
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +3 -2
- package/dist/cjs/global-account/react/hooks/useFirstEOA.d.ts +1 -7663
- package/dist/cjs/global-account/react/hooks/useFirstEOA.js +1 -21
- package/dist/esm/bondkit/bondkitToken.js +2 -2
- package/dist/esm/global-account/react/hooks/useAuthentication.js +3 -2
- package/dist/esm/global-account/react/hooks/useFirstEOA.d.ts +1 -7663
- package/dist/esm/global-account/react/hooks/useFirstEOA.js +2 -22
- package/dist/types/global-account/react/hooks/useFirstEOA.d.ts +1 -7663
- package/package.json +2 -2
- package/src/bondkit/bondkitToken.ts +2 -2
- package/src/global-account/react/hooks/useAuthentication.ts +29 -25
- package/src/global-account/react/hooks/useFirstEOA.tsx +2 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@b3dotfun/sdk",
|
|
3
|
-
"version": "0.0.50-alpha.
|
|
3
|
+
"version": "0.0.50-alpha.2",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"react-native": "./dist/cjs/index.native.js",
|
|
@@ -374,7 +374,7 @@
|
|
|
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.
|
|
377
|
+
"thirdweb": "5.108.9",
|
|
378
378
|
"three": "^0.175.0",
|
|
379
379
|
"viem": "^2.28.1",
|
|
380
380
|
"wagmi": "^2.14.15"
|
|
@@ -113,7 +113,7 @@ export class BondkitToken {
|
|
|
113
113
|
|
|
114
114
|
this.publicClient = createPublicClient({
|
|
115
115
|
chain: this.chain,
|
|
116
|
-
transport,
|
|
116
|
+
transport: http(this.rpcUrl),
|
|
117
117
|
});
|
|
118
118
|
|
|
119
119
|
this.contract = getContract({
|
|
@@ -161,7 +161,7 @@ export class BondkitToken {
|
|
|
161
161
|
|
|
162
162
|
this.publicClient = createPublicClient({
|
|
163
163
|
chain: this.chain,
|
|
164
|
-
transport,
|
|
164
|
+
transport: http(this.rpcUrl),
|
|
165
165
|
});
|
|
166
166
|
|
|
167
167
|
this.contract = getContract({
|
|
@@ -193,35 +193,39 @@ export function useAuthentication(partnerId: string) {
|
|
|
193
193
|
],
|
|
194
194
|
);
|
|
195
195
|
|
|
196
|
-
const logout =
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
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
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
204
|
+
// Log out of each wallet
|
|
205
|
+
wallets.forEach(wallet => {
|
|
206
|
+
console.log("@@logging out", wallet);
|
|
207
|
+
disconnect(wallet);
|
|
208
|
+
});
|
|
208
209
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
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
|
-
|
|
218
|
-
|
|
219
|
+
app.logout();
|
|
220
|
+
debug("@@logout:loggedOut");
|
|
219
221
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
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,14 +1,12 @@
|
|
|
1
1
|
import { useAuthStore } from "@b3dotfun/sdk/global-account/react";
|
|
2
2
|
import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
|
|
3
|
-
import {
|
|
4
|
-
import { useEffect, useMemo, useState } from "react";
|
|
5
|
-
import { viemAdapter } from "thirdweb/adapters/viem";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
6
4
|
import { useConnectedWallets, useWalletInfo } from "thirdweb/react";
|
|
7
5
|
import { Wallet } from "thirdweb/wallets";
|
|
8
6
|
|
|
9
7
|
const debug = debugB3React("useFirstEOA");
|
|
10
8
|
|
|
11
|
-
export function useFirstEOA(
|
|
9
|
+
export function useFirstEOA() {
|
|
12
10
|
const wallets = useConnectedWallets();
|
|
13
11
|
const isConnected = useAuthStore(state => state.isConnected);
|
|
14
12
|
const [firstEOA, setFirstEOA] = useState<Wallet | undefined>(undefined);
|
|
@@ -41,25 +39,9 @@ export function useFirstEOA(chain?: { id: number; name: string; rpc: string }) {
|
|
|
41
39
|
autoSelectFirstEOAWallet();
|
|
42
40
|
}, [isConnected, wallets]);
|
|
43
41
|
|
|
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
|
-
|
|
59
42
|
return {
|
|
60
43
|
account: firstEOA,
|
|
61
44
|
address,
|
|
62
45
|
info: walletInfo,
|
|
63
|
-
walletClient,
|
|
64
46
|
};
|
|
65
47
|
}
|