Created
May 13, 2020 14:04
-
-
Save anubhavgirdhar/bbaf7a929e7bd7988771601f668ad2fd to your computer and use it in GitHub Desktop.
Front End for a Quotes DApp to store a quote and its respective owner on the Ethereum Blockchain
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function startApp() { | |
const address = "0x2Fb33202f99510FD2d1f7522d8709889b7858024"; | |
const abi = [{"constant":false,"inputs":[{"internalType":"string","name":"newQuote","type":"string"}],"name":"setQuote","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getQuote","outputs":[{"internalType":"string","name":"currentQuote","type":"string"},{"internalType":"address","name":"currentOwner","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"quote","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"}] | |
const contract = new web3.eth.Contract(abi, address); | |
await contract.methods.setQuote("This is the best tutorial in the history of tutorials ever!").send({ from: userAccount }); | |
const result = await contract.methods.getQuote().call({ from: userAccount }) | |
console.log(result); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment