Advertisement
theultraman20

index.html

Jan 3rd, 2025 (edited)
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3.   <head>
  4.     <meta charset="utf-8">
  5.     <title>Hello wasm-pack!</title>
  6.   </head>
  7.     <link
  8.         rel="preload"
  9.         href="./chuck-wallet-f1350b740083405d_bg.wasm"
  10.         as="fetch"
  11.         type="application/wasm"
  12.         crossorigin=""
  13.     />
  14.     <link rel="modulepreload" href="./chuck-wallet-f1350b740083405d.js"/>
  15.     <script type="module">
  16.  
  17.  
  18.       //THIS IS NECESSARY
  19.       window.addEventListener("TrunkApplicationStarted", (event) => {
  20.         const wasm = event.detail.wasm;
  21.         wasm.greet("Bindgen str test");
  22.           //const nonce = wasm.get_nonce(); // Call the function
  23.           //document.getElementById("nonce").innerText = "0x" + nonce.toString(16);
  24.           //alert("hello");
  25.           var privInput = document.getElementById("privkey");
  26.  
  27.           var prevInput = "";
  28.           privInput.addEventListener("blur", (event) => {
  29.  
  30.             const input = event.target.value;
  31.             if (input == prevInput) {
  32.               return;
  33.             }
  34.  
  35.             prevInput = input;
  36.             if (input) {
  37.               var bal = wasm.get_balance(input);
  38.               var addr = wasm.get_addr()
  39.             }
  40.             document.getElementById("balance").textContent = "Balance: "+bal;
  41.           });
  42.  
  43.           document.getElementById("sendbtn").addEventListener("click", (event) => {
  44.             var amt = document.getElementById("sendamt").value;
  45.             if (amt > 0) {
  46.               wasm.spend(amt);
  47.             }
  48.           });
  49.       });
  50.  
  51.       </script>
  52.  
  53.  
  54.  
  55.         <body>
  56.         <div id="top">
  57.             <h1 style="font-size: 3vw">Chuck Coin</h1>
  58.             <img
  59.                 src="https://www.chuckecheese.com/wp-content/uploads/fall2024/rocketship.png"
  60.                 width="100px"
  61.             />
  62.         </div>
  63.         <h3>Send coins:</h3>
  64.         <label>
  65.             Paste your private key:
  66.             <input id="privkey" type="password" />
  67.         </label>
  68.         <br />
  69.         <br />
  70.         <label>
  71.             Recipient address
  72.             <input
  73.                 type="number"
  74.                 inputmode="numeric"
  75.                 value="0"
  76.                 min="0"
  77.                 max="1000000"
  78.                 class="no-spinner"
  79.                 id = "sendamt"
  80.                 name="test"
  81.             />
  82.         </label>
  83.  
  84.         <button id = "sendbtn">Send</button>
  85.         <br/>
  86.         <br/>
  87.         <p>Your wallet address: <b id="wallet_addr">0xf67818e7d8a65f7d</b></p>
  88.         <p id="balance">Balance:</p>
  89.         <script src="./bootstrap.js"></script>
  90.     </body>
  91. </html>
  92.  
  93. <!-- include directly for now -->
  94. <style>
  95.     body {
  96.         font-family: system-ui;
  97.         background: #f06d06;
  98.         color: white;
  99.         text-align: center;
  100.     }
  101.  
  102.     /*
  103. @font-face {
  104.   font-family: "summer-blaster";
  105.     src: url("https://www.chuckecheese.com/wp-content/uploads/fall2024/summer-blaster.woff2") format("woff2"),
  106.        url("https://www.chuckecheese.com/wp-content/uploads/fall2024/summer-blaster.woff") format("woff");
  107. }*/
  108.  
  109.     #top {
  110.         display: flex;
  111.         font-family: "summer-blaster", sans-serif;
  112.         align-items: center;
  113.         justify-content: center;
  114.     }
  115.  
  116.     /* Hide the spinner arrows in Chrome, Safari, Edge */
  117.     .no-spinner::-webkit-inner-spin-button,
  118.     .no-spinner::-webkit-outer-spin-button {
  119.         -webkit-appearance: none;
  120.         margin: 0;
  121.     }
  122.  
  123.     /* Hide the spinner arrows in Firefox */
  124.  
  125.     .no-spinner {
  126.         -moz-appearance: textfield;
  127.     }
  128. </style>
  129.  
  130. </html>
  131.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement