diff --git a/DevGrants/Ife Grant/algo.png b/DevGrants/Ife Grant/algo.png new file mode 100644 index 000000000..cef3133ab Binary files /dev/null and b/DevGrants/Ife Grant/algo.png differ diff --git a/DevGrants/Ife Grant/backgroundIfe.png b/DevGrants/Ife Grant/backgroundIfe.png new file mode 100644 index 000000000..f02bd55b7 Binary files /dev/null and b/DevGrants/Ife Grant/backgroundIfe.png differ diff --git a/DevGrants/Ife Grant/choice.png b/DevGrants/Ife Grant/choice.png new file mode 100644 index 000000000..9f575c07d Binary files /dev/null and b/DevGrants/Ife Grant/choice.png differ diff --git a/DevGrants/Ife Grant/index.html b/DevGrants/Ife Grant/index.html new file mode 100644 index 000000000..b48e96c8f --- /dev/null +++ b/DevGrants/Ife Grant/index.html @@ -0,0 +1,113 @@ + + + + + + Choice Coin + + + +
+
+ +

HOICE COIN

+
+ + +

Choice Coin Voting Mail

+ +
+ + +
+ +
+ + + \ No newline at end of file diff --git a/DevGrants/Ife Grant/script.js b/DevGrants/Ife Grant/script.js new file mode 100644 index 000000000..024b24ded --- /dev/null +++ b/DevGrants/Ife Grant/script.js @@ -0,0 +1,87 @@ +// Retrieve AlgoSigner sdk from the browser +const { AlgoSigner } = window; + +//define the adddresses +const red_address = ""; +const blue_address = ""; + +//Get DOM Elements +const submitBtn = document.querySelector(".submit"); +const connectWallet = document.querySelector(".connect"); +const yes = document.querySelector(".yes-btn"); +const no = document.querySelector(".no-btn"); + +let yesOrNo = ""; +const setValue = (value) => { + yesOrNo = value; +}; +//Function to Connect User's Account +const ConnectAccount = async () => { + //Check if AlgoSigner is installed + if (!AlgoSigner) { + return alert("Kindly install AlgoSigner"); + } + + //Connect Account if AlgoSigner is installed + await AlgoSigner.connect() + .then((d) => {}) + .catch((e) => console.log("error in connection")); +}; + +// Sign the Transaction +const signTransaction = async (receiver = blue_address) => { + const txn = await AlgoSigner.algod({ + ledger: "TestNet", + path: "/v2/transactions/params", + }) + .then((e) => { + return e; + }) + .catch((e) => console.log("error in algorand")); + + //retrieve account details + const account = await AlgoSigner.accounts({ + ledger: "TestNet", + }) + .then((value) => value[0]) + .then((result) => { + const { address } = result; + + return address; + }) + + .catch((e) => console.log("failed to retrieve accounts")); + + //Transaction signature + await AlgoSigner.sign({ + from: account, + to: receiver, + amount: document.querySelector("hello"), + note: "voting", + fee: txn["min-fee"], + }) + .then(() => console.log("complete")) + .catch((e) => console.log("error", e)); +}; + +connectWallet.addEventListener("click", async (e) => { + await ConnectAccount(); + connectWallet.value = "Connected"; +}); + +submitBtn.addEventListener("click", (e) => { + console.log("welcome user"); + + //checks to see if the user click an option + if (!yesOrNo) { + alert("Please click either yes or no"); + return; + } + if (yesOrNo == "Yes") { + signTransaction(blue_address); + } + if (yesOrNo == "No") { + signTransaction(red_address); + } + alert(`Transaction successful in successful in ${yesOrNo}`); +}); \ No newline at end of file diff --git a/DevGrants/Ife Grant/style.css b/DevGrants/Ife Grant/style.css new file mode 100644 index 000000000..2512906a0 --- /dev/null +++ b/DevGrants/Ife Grant/style.css @@ -0,0 +1,71 @@ +/** @format */ + +body { + background: url("backgroundIfe.png"); + display: flex; + flex-wrap: wrap; +} + +* { + padding: 0; + margin: 0; +} +/* Connect Form */ + +.mainDiv { + border: 5px solid white; + display: flex; + margin-left: 200px; + flex-direction: column; + height: 500px; + width: 400px; + align-items: center; + margin-top: 170px; + background-color: rgba(255, 255, 255, 0.5); + box-shadow: -5px -5px rgba(0, 0, 0, 0.5); + border-radius: 25px; +} +.box { + width: 350px; + padding: 10px; + height: 50px; + color: white; + margin-top: 6px; + background: transparent; + border-bottom: 1px solid; + border-top: none; + border-right: none; + border-left: none; +} +.box::placeholder { + font-size: 1em; + color: rgb(255, 255, 255); + padding: 5px; +} +.pas { + width: 350px; + padding: 10px; + height: 70px; + margin-top: 6px; + border-radius: 5px; + border-bottom: 1px solid; + border-top: none; + border-right: none; + border-left: none; +} +button { + background: black; + border-radius: 5px; + color: white; +} +@media only screen and (max-width: 700px) { + body { + background-color: black; + } + .mainDiv { + margin: auto; + display: flex; + flex-direction: column; + margin-top: 60px; + } +}