diff --git a/frontend/src/pages/home.tsx b/frontend/src/pages/home.tsx index cfd385c..d1ddd8e 100644 --- a/frontend/src/pages/home.tsx +++ b/frontend/src/pages/home.tsx @@ -38,6 +38,23 @@ export const HomePage: FC = () => { } }, [embeddedState]); // Runs when embeddedState changes + function mintNFT() { + console.log("Minting NFT..."); + if (!initDataRaw) { + console.error("No init data found"); + return; + } + + openfortService.mintNFT(initDataRaw).then((res) => { + console.log("NFT minted!"); + console.log("Transaction hash:", res); + document.getElementById("msg")!.innerHTML = `View transaction`; + }).catch((error) => { + console.error("Failed to mint NFT:", error); + document.getElementById("msg")!.innerHTML = "Failed to mint NFT"; + }); + } + return ( @@ -53,8 +70,9 @@ export const HomePage: FC = () => { ) : embeddedState === EmbeddedState.READY ? ( <>
- +
+
openfortService.logout()} className="disconnect-text">Logout ) : ( diff --git a/frontend/src/services/openfortService.ts b/frontend/src/services/openfortService.ts index 837a6b9..c463269 100644 --- a/frontend/src/services/openfortService.ts +++ b/frontend/src/services/openfortService.ts @@ -10,6 +10,7 @@ import { } from '@openfort/openfort-js'; import openfort from '../utils/openfortConfig'; import axios from 'axios'; +import {ShieldAuthProvider} from "@openfort/openfort-node/models/preGenerateEmbeddedAccountRequest"; const chainId = Number(import.meta.env.VITE_CHAIN_ID); @@ -112,7 +113,7 @@ class OpenfortService { const shieldAuth: ShieldAuthentication = { auth: ShieldAuthType.OPENFORT, token: identityToken, - authProvider: "telegramMiniApp", + authProvider: ShieldAuthProvider.TELEGRAM_MINI_APP, tokenType: "customToken", encryptionSession: await this.getEncryptionSession(), };