Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dimakorzhovnik committed May 29, 2024
2 parents 56b74ff + 53ac8e7 commit dc66f22
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
9 changes: 9 additions & 0 deletions front/src/api/cyber.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import axios from "axios";

// const base = "http://159.89.24.179:5000";
// const base = "http://128.140.108.218:4000";
const base = "https://awesome.cybernode.ai";

export function sendProof(data: any) {
return axios.post(base + "/proof", data);
}
30 changes: 28 additions & 2 deletions front/src/pages/Main/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { Citizenship } from "@/types";
import MusicalAddress from "@/components/MusicalAddress/MusicalAddress";
import Passport from "./Passport/Passport";
import ActionBar from "@/components/ActionBar/ActionBar";
import { sendProof } from "@/api/cyber";

const tele = (window as any).Telegram.WebApp;

Expand Down Expand Up @@ -43,6 +44,31 @@ const Main = () => {

const tonProof = wallet?.connectItems?.tonProof;

console.log("tonProof", tonProof);

async function sendProofCall() {
try {
const { address, publicKey } = wallet.account || {};

const d = {
proof: {
proof: {
...tonProof.proof,
state_init: "",
},
network: "-239",
address,
},
pubkey: publicKey,
};
const data = await sendProof(d);

console.log(data.data);
} catch (error) {
console.error(error);
}
}

// @ts-ignore
const body = tonProof && fromAscii(fromBase64(tonProof?.proof?.payload));

Expand All @@ -53,7 +79,7 @@ const Main = () => {
const data = p.msg_data;

if (type === "map_nickname" && !passportProof) {
debugger;
sendProofCall();
setPassportProof({
...tonProof,
data: p,
Expand All @@ -62,7 +88,7 @@ const Main = () => {
}

if (type === "add_post" && !textProof) {
debugger;
sendProofCall();
setTextProof({
...tonProof,
data: p,
Expand Down

0 comments on commit dc66f22

Please sign in to comment.