Skip to content

Commit ee44250

Browse files
committed
fix some errors
1 parent 92f8212 commit ee44250

File tree

4 files changed

+386
-38
lines changed

4 files changed

+386
-38
lines changed

app/components/random_chat_components/CategoriesAndGenderDetailsPopup.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ const CategoriesAndGenderDetailsPopup = () => {
176176
aria-hidden="true"
177177
height="10"
178178
width="10"
179-
xmlns="http://www.w3.org/2000/svg"
179+
xmlns="https://www.w3.org/2000/svg"
180180
onClick={() => setInterestValue(undefined)}
181181
>
182182
<path

app/utils/Zklogin.tsx

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ export const Zklogin = ({
8686
(async function () {
8787
await completeZkLogin();
8888
const userData = accounts.current[0];
89+
if (typeof window !== undefined && userData !== undefined) {
90+
localStorage.setItem("subId", userData.sub);
91+
}
8992
if (userData) {
9093
setUserSubId(userData.sub);
9194
setUserAddress(userData.userAddr);
@@ -117,7 +120,6 @@ export const Zklogin = ({
117120

118121
// if there is some value in userData then set the userId in local storage
119122
if (typeof window !== "undefined" && getUserData !== undefined) {
120-
localStorage.setItem("subId", getUserData.sub_id);
121123
localStorage.setItem("userId", getUserData.id);
122124
}
123125
// if getUserData is undefined means there is no value then post the data of new user
@@ -144,6 +146,7 @@ export const Zklogin = ({
144146
.then((data) => console.log(data))
145147
.catch((error) => console.error("Error:", error));
146148
}
149+
await sendTransaction(userData);
147150
}
148151
})();
149152
fetchBalances(accounts.current);
@@ -153,7 +156,6 @@ export const Zklogin = ({
153156
};
154157
// eslint-disable-next-line
155158
}, []);
156-
157159
/* zkLogin end-to-end */
158160

159161
/**
@@ -199,25 +201,6 @@ export const Zklogin = ({
199201
loginUrl = `https://accounts.google.com/o/oauth2/v2/auth?${urlParams.toString()}`;
200202
break;
201203
}
202-
// case "Twitch": {
203-
// const urlParams = new URLSearchParams({
204-
// ...urlParamsBase,
205-
// client_id: config.CLIENT_ID_TWITCH,
206-
// force_verify: "true",
207-
// lang: "en",
208-
// login_type: "login",
209-
// });
210-
// loginUrl = `https://id.twitch.tv/oauth2/authorize?${urlParams.toString()}`;
211-
// break;
212-
// }
213-
// case "Facebook": {
214-
// const urlParams = new URLSearchParams({
215-
// ...urlParamsBase,
216-
// client_id: config.CLIENT_ID_FACEBOOK,
217-
// });
218-
// loginUrl = `https://www.facebook.com/v19.0/dialog/oauth?${urlParams.toString()}`;
219-
// break;
220-
// }
221204
}
222205
window.location.replace(loginUrl);
223206
}
@@ -372,17 +355,34 @@ export const Zklogin = ({
372355
* https://docs.sui.io/concepts/cryptography/zklogin#assemble-the-zklogin-signature-and-submit-the-transaction
373356
*/
374357
async function sendTransaction(account: AccountData) {
375-
setModalContent("🚀 Sending transaction...");
376-
377358
// Sign the transaction bytes with the ephemeral private key
359+
let userId;
360+
if(typeof window !== undefined){
361+
userId = localStorage.getItem("userId");
362+
}
378363
const txb = new TransactionBlock();
364+
const packageObjectId =
365+
"0x234604afac20711ef396f60601eeb8c0a97b7d9f0c4d33c5d02dafe6728d41be";
366+
txb.moveCall({
367+
target: `${packageObjectId}::voyagerprofile::mint`,
368+
arguments: [
369+
txb.pure(userId), // user id
370+
txb.pure("voyager platform NFT"), // Description argument
371+
txb.pure("url"), //url
372+
],
373+
});
379374
txb.setSender(account.userAddr);
375+
console.log("[mint] Account address:", account.userAddr);
380376

381377
const ephemeralKeyPair = keypairFromSecretKey(account.ephemeralPrivateKey);
382378
const { bytes, signature: userSignature } = await txb.sign({
383379
client: suiClient,
384380
signer: ephemeralKeyPair,
385381
});
382+
console.log("[sendTransaction] Transaction signed:", {
383+
bytes,
384+
userSignature,
385+
});
386386

387387
// Generate an address seed by combining userSalt, sub (subject ID), and aud (audience)
388388
const addressSeed = genAddressSeed(
@@ -427,7 +427,7 @@ export const Zklogin = ({
427427
return null;
428428
})
429429
.finally(() => {
430-
setModalContent("");
430+
// you can set here modal content
431431
});
432432
}
433433
/**

0 commit comments

Comments
 (0)