@b3dotfun/sdk 0.0.33-alpha.2 → 0.0.33-alpha.3
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.
|
@@ -9,6 +9,7 @@ const react_1 = require("react");
|
|
|
9
9
|
const sonner_1 = require("sonner");
|
|
10
10
|
const react_2 = require("thirdweb/react");
|
|
11
11
|
const wallets_1 = require("thirdweb/wallets");
|
|
12
|
+
const useSiwe_1 = require("../../hooks/useSiwe");
|
|
12
13
|
const useModalStore_1 = require("../../stores/useModalStore");
|
|
13
14
|
const profileDisplay_1 = require("../../utils/profileDisplay");
|
|
14
15
|
const useB3_1 = require("../B3Provider/useB3");
|
|
@@ -43,8 +44,9 @@ function LinkAccount({ onSuccess: onSuccessCallback, onError, onClose, chain, pa
|
|
|
43
44
|
...(0, profileDisplay_1.getProfileDisplayInfo)(profile),
|
|
44
45
|
originalProfile: profile,
|
|
45
46
|
}));
|
|
46
|
-
const { account } = (0, useB3_1.useB3)();
|
|
47
|
+
const { account, setUser } = (0, useB3_1.useB3)();
|
|
47
48
|
const { mutate: linkProfile } = (0, react_2.useLinkProfile)();
|
|
49
|
+
const { authenticate } = (0, useSiwe_1.useSiwe)();
|
|
48
50
|
const onSuccess = (0, react_1.useCallback)(async () => {
|
|
49
51
|
await onSuccessCallback?.();
|
|
50
52
|
}, [onSuccessCallback]);
|
|
@@ -63,6 +65,19 @@ function LinkAccount({ onSuccess: onSuccessCallback, onError, onClose, chain, pa
|
|
|
63
65
|
setLinkingState(false);
|
|
64
66
|
onError?.(error);
|
|
65
67
|
},
|
|
68
|
+
onSuccess: async (data) => {
|
|
69
|
+
console.log("Raw Link Account Data:", data);
|
|
70
|
+
try {
|
|
71
|
+
if (account) {
|
|
72
|
+
console.log("Sync user data...");
|
|
73
|
+
const userAuth = await authenticate(account, partnerId);
|
|
74
|
+
setUser(userAuth.user);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
catch (refreshError) {
|
|
78
|
+
console.warn("⚠️ Could not sync user data:", refreshError);
|
|
79
|
+
}
|
|
80
|
+
},
|
|
66
81
|
};
|
|
67
82
|
const validateInput = () => {
|
|
68
83
|
if (selectedMethod === "email") {
|
|
@@ -6,6 +6,7 @@ import { useCallback, useEffect, useState } from "react";
|
|
|
6
6
|
import { toast } from "sonner";
|
|
7
7
|
import { useLinkProfile, useProfiles } from "thirdweb/react";
|
|
8
8
|
import { preAuthenticate } from "thirdweb/wallets";
|
|
9
|
+
import { useSiwe } from "../../hooks/useSiwe.js";
|
|
9
10
|
import { useModalStore } from "../../stores/useModalStore.js";
|
|
10
11
|
import { getProfileDisplayInfo } from "../../utils/profileDisplay.js";
|
|
11
12
|
import { useB3 } from "../B3Provider/useB3.js";
|
|
@@ -40,8 +41,9 @@ export function LinkAccount({ onSuccess: onSuccessCallback, onError, onClose, ch
|
|
|
40
41
|
...getProfileDisplayInfo(profile),
|
|
41
42
|
originalProfile: profile,
|
|
42
43
|
}));
|
|
43
|
-
const { account } = useB3();
|
|
44
|
+
const { account, setUser } = useB3();
|
|
44
45
|
const { mutate: linkProfile } = useLinkProfile();
|
|
46
|
+
const { authenticate } = useSiwe();
|
|
45
47
|
const onSuccess = useCallback(async () => {
|
|
46
48
|
await onSuccessCallback?.();
|
|
47
49
|
}, [onSuccessCallback]);
|
|
@@ -60,6 +62,19 @@ export function LinkAccount({ onSuccess: onSuccessCallback, onError, onClose, ch
|
|
|
60
62
|
setLinkingState(false);
|
|
61
63
|
onError?.(error);
|
|
62
64
|
},
|
|
65
|
+
onSuccess: async (data) => {
|
|
66
|
+
console.log("Raw Link Account Data:", data);
|
|
67
|
+
try {
|
|
68
|
+
if (account) {
|
|
69
|
+
console.log("Sync user data...");
|
|
70
|
+
const userAuth = await authenticate(account, partnerId);
|
|
71
|
+
setUser(userAuth.user);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch (refreshError) {
|
|
75
|
+
console.warn("⚠️ Could not sync user data:", refreshError);
|
|
76
|
+
}
|
|
77
|
+
},
|
|
63
78
|
};
|
|
64
79
|
const validateInput = () => {
|
|
65
80
|
if (selectedMethod === "email") {
|
package/package.json
CHANGED
|
@@ -5,6 +5,7 @@ import { useCallback, useEffect, useState } from "react";
|
|
|
5
5
|
import { toast } from "sonner";
|
|
6
6
|
import { useLinkProfile, useProfiles } from "thirdweb/react";
|
|
7
7
|
import { preAuthenticate } from "thirdweb/wallets";
|
|
8
|
+
import { useSiwe } from "../../hooks/useSiwe";
|
|
8
9
|
import { LinkAccountModalProps, useModalStore } from "../../stores/useModalStore";
|
|
9
10
|
import { getProfileDisplayInfo } from "../../utils/profileDisplay";
|
|
10
11
|
import { useB3 } from "../B3Provider/useB3";
|
|
@@ -63,8 +64,9 @@ export function LinkAccount({
|
|
|
63
64
|
originalProfile: profile,
|
|
64
65
|
}));
|
|
65
66
|
|
|
66
|
-
const { account } = useB3();
|
|
67
|
+
const { account, setUser } = useB3();
|
|
67
68
|
const { mutate: linkProfile } = useLinkProfile();
|
|
69
|
+
const { authenticate } = useSiwe();
|
|
68
70
|
|
|
69
71
|
const onSuccess = useCallback(async () => {
|
|
70
72
|
await onSuccessCallback?.();
|
|
@@ -86,6 +88,18 @@ export function LinkAccount({
|
|
|
86
88
|
setLinkingState(false);
|
|
87
89
|
onError?.(error);
|
|
88
90
|
},
|
|
91
|
+
onSuccess: async (data: any) => {
|
|
92
|
+
console.log("Raw Link Account Data:", data);
|
|
93
|
+
try {
|
|
94
|
+
if (account) {
|
|
95
|
+
console.log("Sync user data...");
|
|
96
|
+
const userAuth = await authenticate(account, partnerId);
|
|
97
|
+
setUser(userAuth.user);
|
|
98
|
+
}
|
|
99
|
+
} catch (refreshError) {
|
|
100
|
+
console.warn("⚠️ Could not sync user data:", refreshError);
|
|
101
|
+
}
|
|
102
|
+
},
|
|
89
103
|
};
|
|
90
104
|
|
|
91
105
|
const validateInput = () => {
|