added ton_proof
This commit is contained in:
parent
99c9f00110
commit
1b79b15a31
|
|
@ -7,9 +7,19 @@ export const useAuth = () => {
|
||||||
const WebApp = useWebApp();
|
const WebApp = useWebApp();
|
||||||
console.log("👀👀👀 webapp: ", WebApp);
|
console.log("👀👀👀 webapp: ", WebApp);
|
||||||
|
|
||||||
return useMutation(["auth"], () => {
|
return useMutation(["auth"], async () => {
|
||||||
console.log("👀👀👀 in mutation - auth");
|
console.log("👀👀👀 in mutation - auth");
|
||||||
|
|
||||||
|
const authV1Token = sessionStorage.getItem("auth_v1_token");
|
||||||
|
|
||||||
|
let tonProof;
|
||||||
|
if (authV1Token) {
|
||||||
|
tonProof = await WebApp.initDataUnsafe.signData({
|
||||||
|
data: authV1Token,
|
||||||
|
});
|
||||||
|
console.log("👀👀👀 tonProof: ", tonProof);
|
||||||
|
}
|
||||||
|
|
||||||
return request.post<{
|
return request.post<{
|
||||||
connected_wallet: null | {
|
connected_wallet: null | {
|
||||||
version: string;
|
version: string;
|
||||||
|
|
@ -20,6 +30,17 @@ export const useAuth = () => {
|
||||||
auth_v1_token: string;
|
auth_v1_token: string;
|
||||||
}>("/auth.twa", {
|
}>("/auth.twa", {
|
||||||
twa_data: WebApp.initData,
|
twa_data: WebApp.initData,
|
||||||
|
ton_proof: tonProof ? {
|
||||||
|
account: {
|
||||||
|
address: tonProof.address,
|
||||||
|
// O.: add more as needed
|
||||||
|
},
|
||||||
|
ton_proof: {
|
||||||
|
signature: tonProof.signature,
|
||||||
|
payload: tonProof.payload,
|
||||||
|
// O.: add more as needed
|
||||||
|
}
|
||||||
|
} : undefined
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue