Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My female Dev #1085

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added DevGrants/Simi Grant/back.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions DevGrants/Simi Grant/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Choice Coin</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h2 style="position: absolute; font-size: 12rem; opacity: 0.5; left: 200px;">CHOICE COIN</h2>
<div class="form">
<div style="display: flex; flex-direction: row;">
<h1 style="color: white;">Choice Coin Voting</h1>
<button style="padding: 5px; margin-top: 20px; margin-left: 5px;" class="connect">Connect Wallet</button>
</div>
<input class="box" placeholder="Enter Address">
<p style="color: white; padding: 10px; font-size: 18px;">Statement To be Submitted</p>
<input name="Password" placeholder="Enter Statement" class="pas">
<div style="margin: 10px;">
<input type="button" value="Yes" class="true">
<input type="button" value="NO" class="false">
</div>
<button type="submit" style="padding: 10px; margin-top: 30px;">Submit</button>
</div>
<script src="script.js"></script>
</body>
</html>
87 changes: 87 additions & 0 deletions DevGrants/Simi Grant/script.js
Original file line number Diff line number Diff line change
@@ -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}`);
});
51 changes: 51 additions & 0 deletions DevGrants/Simi Grant/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
body{
background: url("back.jpg") no-repeat center center/cover;
}

/* Connect Form */
.form{
margin: auto;
display: flex;
flex-direction: column;
height: 540px;
width: 600px;
align-items: center;
margin-top: 130px;
background-color: rgba(0, 0, 0, 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: #000000
;
border-radius: 5px;
color: white;
}