@b3dotfun/sdk 0.0.50-test.1 → 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/bondkit/bondkitToken.js +2 -2
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +3 -2
- package/dist/esm/bondkit/bondkitToken.js +2 -2
- package/dist/esm/global-account/react/hooks/useAuthentication.js +3 -2
- package/package.json +3 -2
- package/src/bondkit/bondkitToken.ts +2 -2
- package/src/global-account/react/hooks/useAuthentication.ts +29 -25
|
@@ -61,7 +61,7 @@ class BondkitToken {
|
|
|
61
61
|
});
|
|
62
62
|
this.publicClient = (0, viem_1.createPublicClient)({
|
|
63
63
|
chain: this.chain,
|
|
64
|
-
transport,
|
|
64
|
+
transport: (0, viem_1.http)(this.rpcUrl),
|
|
65
65
|
});
|
|
66
66
|
this.contract = (0, viem_1.getContract)({
|
|
67
67
|
address: this.contractAddress,
|
|
@@ -108,7 +108,7 @@ class BondkitToken {
|
|
|
108
108
|
});
|
|
109
109
|
this.publicClient = (0, viem_1.createPublicClient)({
|
|
110
110
|
chain: this.chain,
|
|
111
|
-
transport,
|
|
111
|
+
transport: (0, viem_1.http)(this.rpcUrl),
|
|
112
112
|
});
|
|
113
113
|
this.contract = (0, viem_1.getContract)({
|
|
114
114
|
address: this.contractAddress,
|
|
@@ -171,7 +171,7 @@ function useAuthentication(partnerId) {
|
|
|
171
171
|
setIsConnected,
|
|
172
172
|
setUser,
|
|
173
173
|
]);
|
|
174
|
-
const logout = async (callback) => {
|
|
174
|
+
const logout = (0, react_2.useCallback)(async (callback) => {
|
|
175
175
|
if (activeWallet) {
|
|
176
176
|
debug("@@logout:activeWallet", activeWallet);
|
|
177
177
|
disconnect(activeWallet);
|
|
@@ -188,6 +188,7 @@ function useAuthentication(partnerId) {
|
|
|
188
188
|
localStorage.removeItem("thirdweb:connected-wallet-ids");
|
|
189
189
|
localStorage.removeItem("wagmi.store");
|
|
190
190
|
localStorage.removeItem("lastAuthProvider");
|
|
191
|
+
localStorage.removeItem("b3-user");
|
|
191
192
|
}
|
|
192
193
|
app_1.default.logout();
|
|
193
194
|
debug("@@logout:loggedOut");
|
|
@@ -195,7 +196,7 @@ function useAuthentication(partnerId) {
|
|
|
195
196
|
setIsConnected(false);
|
|
196
197
|
setUser();
|
|
197
198
|
callback?.();
|
|
198
|
-
};
|
|
199
|
+
}, [activeWallet, disconnect, wallets, setIsAuthenticated, setUser, setIsConnected]);
|
|
199
200
|
const { isLoading: useAutoConnectLoading } = (0, react_3.useAutoConnect)({
|
|
200
201
|
client: thirdweb_1.client,
|
|
201
202
|
wallets: [wallet],
|
|
@@ -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],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@b3dotfun/sdk",
|
|
3
|
-
"version": "0.0.
|
|
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",
|
|
@@ -377,7 +377,8 @@
|
|
|
377
377
|
"thirdweb": "5.108.14",
|
|
378
378
|
"three": "^0.175.0",
|
|
379
379
|
"viem": "2.37.9",
|
|
380
|
-
"wagmi": "
|
|
380
|
+
"wagmi": "2.16.9",
|
|
381
|
+
"@wagmi/core": "2.20.3"
|
|
381
382
|
},
|
|
382
383
|
"peerDependenciesMeta": {
|
|
383
384
|
"@react-three/postprocessing": {
|
|
@@ -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,
|