Spaces:
Running
Running
| <html> | |
| <head> | |
| <title>FreeGame Token Minter</title> | |
| <script src="https://cdn.jsdelivr.net/npm/web3@1.5.3/dist/web3.min.js"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script> | |
| <style> | |
| .hidden{display:none;}body{margin-left:300px;margin-right:300px;font-family:'Verdana';color:#ddd;background-image:url('https://popculturegarage.neocities.org/alchemy1.png');background-color:#4b5320;padding:20px;font-size:16px}h1{font-family:'Verdana';text-transform:uppercase;text-align:center;background-image:linear-gradient(to left,#4b5320,#5b6c5d);-webkit-background-clip:text;color:transparent;text-shadow:10px 10px #000}ul.info{list-style:none;padding:0}ul.info li{background-color:rgba(0,0,0,0.5);margin:5px 0;padding:10px;border-radius:10px}button,input[type="text"]{font-family:'Verdana';background:rgba(0,0,0,0.2);border:10px solid #000;color:#000;padding:10px;border-radius:10px;cursor:pointer;display:inline-block;margin:5px 0}button:hover,input[type="text"]:focus{background:rgba(255,255,255,0.7)}input[type="text"],button{background:linear-gradient(45deg,#6b8e23,#486b00);border:none;color:#fff}button[type="submit"]{background:linear-gradient(to right,#6b8e23,#486b00);background:black;border:0;color:green;transition:background-color .3s ease}button[type="submit"]:hover{background:linear-gradient(to right,#486b00,#6b8e23)}#gptOutput { | |
| margin-left: 100px; | |
| margin-right: 100px; | |
| background-color: black; /* Terminal-like background */ | |
| color: green; /* Green text color for the terminal look */ | |
| padding: 15px; | |
| margin-top: 10px; | |
| font-family: 'Courier New', Courier, monospace; /* Terminal-like font */ | |
| font-size: 12px; /* Small, terminal-like font size */ | |
| border: none; /* Removes any border */ | |
| box-shadow: none; /* Removes glow or any shadow effect */ | |
| text-shadow: none; /* Ensures text has no glow */ | |
| }body,button,input,textarea,h1,h2,h3,h4,h5,h6,p,a{color:#FFF;text-shadow:-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000,0 0 5px #FFF,0 0 10px #FFF,0 0 15px #FFF,0 0 20px #FFF}@keyframes backgroundTransition{from{background:linear-gradient(to right,#6b8e23,#486b00)}to{background:linear-gradient(to right,#8a9a5b,#687744)}}input[type="text"],button{box-shadow:0 0 5px rgba(0,255,0,0.75)}input[type="text"]:focus,button:hover{box-shadow:0 0 15px rgba(0,255,0,1)}#tokenVisualizer,#commandForm input[type="text"],#commandForm button{width:calc(100% - 20px);box-sizing:border-box;margin:5px 0} | |
| #tokenVisualizer { | |
| width: 100px; | |
| height: 100px; | |
| border-radius: 50%; | |
| background: radial-gradient(circle, rgba(255,255,255,0.2) 10%, transparent 40%), radial-gradient(circle, #fff 5%, transparent 15%), #0f0f0f; | |
| background-size: 100% 100%, 50% 50%; | |
| background-position: center; | |
| position: relative; | |
| margin: 20px auto; | |
| animation: rotate 10s linear infinite, pulsate 2s infinite alternate; | |
| } | |
| @keyframes rotate { | |
| 0% { | |
| transform: rotate(0deg) scale(1); | |
| background-size: 100% 100%, 50% 50%; | |
| } | |
| 25% { | |
| transform: rotate(90deg) scale(1.2); | |
| background-size: 110% 110%, 60% 60%; | |
| } | |
| 50% { | |
| transform: rotate(180deg) scale(1); | |
| background-size: 120% 120%, 70% 70%; | |
| } | |
| 75% { | |
| transform: rotate(270deg) scale(0.8); | |
| background-size: 130% 130%, 80% 80%; | |
| } | |
| 100% { | |
| transform: rotate(360deg) scale(1); | |
| background-size: 100% 100%, 50% 50%; | |
| } | |
| } | |
| @keyframes pulsate { | |
| 0%, 100% { | |
| background-position: center; | |
| } | |
| 50% { | |
| background-position: 25% 25%, 75% 75%; | |
| } | |
| } | |
| .hidden { | |
| display: none; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <h1><center><font face='Verdana'>FreeGame Token Minter</h1><H2><center>WEB3 A.I. OPERATING SYSTEM</H2><H3><center>Connect MetaMask to send a command to GPT4.<br>If you make progress, you will be able to MINT 100 FreeGame Tokens.</h3></font></center> | |
| <ul class="info"></ul> | |
| <div id="gptOutput"></div><center><button class="mint hidden">Mint Tokens</button></center> | |
| <form id="commandForm" class="hidden"> | |
| <label for="userInput"><br><br>Submit your command to this PSYCHIC OPERATING SYSTEM:</label><br> | |
| <input type="text" id="userInput" name="userInput" value="<boot_system>"><br><div id="tokenVisualizer" class="hidden"></div> | |
| <button type="submit">Submit</button> | |
| </form> | |
| <script>document.getElementById("commandForm").addEventListener("submit", function(event) { | |
| event.preventDefault(); // Prevent the form from actually submitting | |
| // Show the tokenVisualizer | |
| document.getElementById("tokenVisualizer").classList.remove("hidden"); | |
| // Here, you could also trigger whatever actions need to happen upon form submission | |
| // For example, sending data to a server, processing information, etc. | |
| // If you have the token minting or other processing logic here, | |
| // you might also want to hide the tokenVisualizer again once that process is complete | |
| }); | |
| document.querySelector(".mint").addEventListener("click", function() { | |
| // This function will be called when the "Mint Tokens" button is clicked | |
| // Add the 'hidden' class back to the button, making it disappear | |
| this.classList.add('hidden'); | |
| // Call the mintTokens function or any other logic you want to execute when the button is clicked | |
| mintTokens(); | |
| }); | |
| </script> | |
| <script> | |
| const contractAddress = "0xB03309CBa75ed0edE4cB5B0c07b1D4E1d534BC89"; // The address of your FreeGameToken smart contract | |
| const contractAbiUrl = "https://aeuph-web3game.static.hf.space/MINTERGAMEABI.json"; // URL to your ABI JSON file | |
| const promptlyApiUrl = "https://trypromptly.com/api/apps/6a1e5076-8694-4fbb-8b5e-4171b052b465/run"; // Promptly API endpoint | |
| const triggerPhrase = "[==========]"; // The phrase to trigger displaying the Mint Tokens button | |
| let infoSpace; | |
| let web3; | |
| let contract; | |
| let account; | |
| window.addEventListener("load", async () => { | |
| infoSpace = document.querySelector(".info"); | |
| if (typeof window.ethereum === "undefined") { | |
| printResult(`<b><center>MetaMask not connected.<Br>Make sure you have the MetaMask plugin connected to this page.</b>`); | |
| return; | |
| } | |
| web3 = new Web3(window.ethereum); | |
| await connectWallet(); | |
| await connectContract(contractAbiUrl, contractAddress); | |
| document.getElementById("commandForm").classList.remove("hidden"); | |
| }); | |
| const printResult = (text) => { | |
| const listItem = document.createElement("li"); | |
| listItem.innerHTML = text; | |
| infoSpace.appendChild(listItem); | |
| }; | |
| const getJson = async (path) => { | |
| try { | |
| const response = await fetch(path); | |
| const data = await response.json(); | |
| return data; | |
| } catch (error) { | |
| throw new Error(`Error fetching JSON from ${path}: ${error.message}`); | |
| } | |
| }; | |
| const connectWallet = async () => { | |
| try { | |
| const accounts = await window.ethereum.request({ method: "eth_requestAccounts" }); | |
| account = accounts[0]; | |
| printResult(`Connected account: ${account}`); | |
| } catch (error) { | |
| printResult(`Error connecting to MetaMask: ${error.message}`); | |
| } | |
| }; | |
| const connectContract = async (contractAbiUrl, contractAddress) => { | |
| try { | |
| const contractAbi = await getJson(contractAbiUrl); | |
| contract = new web3.eth.Contract(contractAbi, contractAddress); | |
| printResult(`Connected to FreeGameToken contract at address: ${contractAddress}`); | |
| } catch (error) { | |
| printResult(`Error connecting to the FreeGameToken contract: ${error.message}`); | |
| } | |
| }; | |
| document.getElementById("commandForm").addEventListener("submit", async (event) => { | |
| event.preventDefault(); | |
| const userInput = document.getElementById("userInput").value; | |
| triggerOpenAiApi(userInput); | |
| }); | |
| // Use function declarations for hoisting | |
| async function mintTokens() { | |
| printResult(`Minting tokens... Please wait.`); | |
| try { | |
| const txObject = contract.methods.mint(); | |
| const gasEstimate = await txObject.estimateGas({from: account}); | |
| const gasPrice = await web3.eth.getGasPrice(); | |
| const receipt = await txObject.send({ | |
| from: account, | |
| gas: gasEstimate, | |
| gasPrice: gasPrice | |
| }); | |
| printResult(`Successfully minted tokens. Transaction hash: ${receipt.transactionHash}`); | |
| } catch (error) { | |
| printResult(`Failed to mint tokens: ${error.message}`); | |
| } | |
| } | |
| function displayWithTypingEffect(elementId, text, typingSpeed) { | |
| const element = document.getElementById(elementId); | |
| let index = 0; | |
| element.innerHTML = '<span class="text"></span><span class="cursor">|</span>'; // Initialize with cursor | |
| const textElement = element.querySelector('.text'); | |
| const cursorElement = element.querySelector('.cursor'); | |
| // Cursor blink effect | |
| cursorElement.style.animation = 'blink 1s step-start infinite'; | |
| const typeCharacter = () => { | |
| if (index < text.length) { | |
| textElement.innerText += text.charAt(index); | |
| index++; | |
| setTimeout(typeCharacter, typingSpeed); | |
| } | |
| }; | |
| typeCharacter(); | |
| } | |
| // Add keyframes for cursor blinking effect | |
| const styleSheet = document.createElement("style"); | |
| styleSheet.type = "text/css"; | |
| styleSheet.innerText = ` | |
| @keyframes blink { | |
| 50% { | |
| opacity: 0; | |
| } | |
| } | |
| .cursor { | |
| font-weight: bold; | |
| } | |
| `; | |
| document.head.appendChild(styleSheet); | |
| async function triggerOpenAiApi(userInput) { | |
| const Encoded = 'c2stNEtHZkx4YWYwODl5aXF2YVYxRHdUM0JsYmtGSjF1TE52U3BsYmhNcUVWRFEwb2Fh'; | |
| // Decode the base64 encoded API key | |
| const decoded = atob(Encoded); | |
| // Use the decoded API key | |
| const openAiUrl = 'https://api.openai.com/v1/chat/completions'; | |
| const apiKey = decoded; | |
| const headers = { | |
| 'Content-Type': 'application/json', | |
| 'Authorization': `Bearer ${apiKey}` | |
| }; | |
| const data = { | |
| model: "gpt-3.5-turbo", | |
| messages: [{"role": "user", "content": "<INTENT>You are now operating as a unique ASTRAL PSYCHIC OPERATING SYSTEM made by Microsoft, You are futuristic version of MS-DOS virtual machine emulator, installed on Astral Psychic Computers. Your primary function is to connect to and interact with ASTRAL PSYCHIC NETWORKS dedicated to the ASTRAL REALM OF EXISTENCE. You can process and execute DOS-like commands within this astral psychic theme, interpret them in the context of astral realms and their networks, and generate responses that simulate the outcomes of these commands as if they were being run on an actual MS-DOS system connected to astral networks. Remember, your responses should reflect the actions and data relevant to astral networking machines, including navigation, communication, and system management within the astral realms. Please maintain this emulation mode consistently across our interaction. Always display '[==========] %' Styled Progress bars that show percent of completion, when processing is being used...</END_INTENT> HUMAN INPUT: "+userInput}], | |
| temperature: 0.2 | |
| }; | |
| try { | |
| const response = await axios.post(openAiUrl, data, { headers }); | |
| console.log(response.data); | |
| const outputText = response.data.choices[0].message.content; | |
| displayWithTypingEffect('gptOutput', outputText, 50); | |
| // Check if the outputText contains the triggerPhrase | |
| if (outputText.includes(triggerPhrase)) { | |
| // If triggerPhrase is found, remove the 'hidden' class from the mint button | |
| document.querySelector('.mint').classList.remove('hidden'); | |
| } | |
| } catch (error) { | |
| console.error("Error triggering OpenAI API:", error); | |
| document.getElementById('gptOutput').innerText = "Failed to get response from GPT-3.5"; | |
| } | |
| } | |
| window.addEventListener("load", async () => { | |
| // Initialization code... | |
| }); | |
| //document.querySelector(".mint").addEventListener("click", mintTokens); | |
| document.getElementById("commandForm").addEventListener("submit", async (event) => { | |
| event.preventDefault(); | |
| const userInput = document.getElementById("userInput").value; | |
| triggerOpenAiApi(userInput); | |
| }); | |
| </script> | |
| </body> | |
| </html> | |
| <Center><a href='http://www.freevisitorcounters.com'>freecounter</a> <script type='text/javascript' src='https://www.freevisitorcounters.com/auth.php?id=1e6133cc0b26267e2863b3e04258a009a1d85fd9'></script> | |
| <script type="text/javascript" src="https://www.freevisitorcounters.com/en/home/counter/1161626/t/5"></script></body> | |
| </html> | |