Skip to content

Instantly share code, notes, and snippets.

View Shih-Yu's full-sized avatar
:shipit:

Shih-Yu Hwang Shih-Yu

:shipit:
  • Austin, Tx
View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Web Stream Demo</title>
</head>
<!-- Internal CSS styling -->
<style>
require("dotenv").config();
const HDWalletProvider = require('@truffle/hdwallet-provider');
module.exports = {
networks: {
cronosTestnet: {
provider: () => new HDWalletProvider(process.env.PRIVATE_KEY, `https://cronos-testnet-3.crypto.org:8545`),
const SimpleStorage = artifacts.require("SimpleStorage");
module.exports = function (deployer) {
deployer.deploy(SimpleStorage);
};
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
contract SimpleStorage {
string public word;
constructor() {
word = "Welcome!";
}
import { useState } from "react";
import './App.css';
import Web3 from "web3";
import NumberChanger from "../src/artifacts/contracts/NumberChanger.sol/NumberChanger.json";
const contractAddress = "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512";
function App() {
const web3 = new Web3("http://localhost:8545");
return (
<div className="App">
<header className="App-header">
<h1>Welcome to Number Changer</h1>
<h3 >
Your number is: {number}
</h3>
<input
placeholder="Enter a number"
onChange={ (e) => setNewNumber(e.target.value) }
import { useState } from "react";
import './App.css';
import Web3 from "web3";
import NumberChanger from "../src/artifacts/contracts/NumberChanger.sol/NumberChanger.json";
const contractAddress = " 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512";
function App() {
const web3 = new Web3("http://localhost:8545");
return (
<div className="App">
<header className="App-header">
<h1>Welcome to Number Changer</h1>
<h3 >
Your number is: {number}
</h3>
<input
placeholder="Enter a number"
onChange={ (e) => setNewNumber(e.target.value) }
import logo from './logo.svg';
import './App.css';
function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
import { useState } from "react";
import './App.css';
import Web3 from "web3";
import NumberChanger from "./build/NumberChanger.json";
const contractAddress = "0x7c2481b87100844E11df966BcCD55E82A138Fe84";
function App() {
const web3 = new Web3("http://localhost:8545");