diff --git a/DevGrants/Divine Grant/algo.png b/DevGrants/Divine Grant/algo.png new file mode 100644 index 000000000..cef3133ab Binary files /dev/null and b/DevGrants/Divine Grant/algo.png differ diff --git a/DevGrants/Divine Grant/back.jpg b/DevGrants/Divine Grant/back.jpg new file mode 100644 index 000000000..8df82ff0b Binary files /dev/null and b/DevGrants/Divine Grant/back.jpg differ diff --git a/DevGrants/Divine Grant/choice.png b/DevGrants/Divine Grant/choice.png new file mode 100644 index 000000000..9f575c07d Binary files /dev/null and b/DevGrants/Divine Grant/choice.png differ diff --git a/DevGrants/Divine Grant/index.html b/DevGrants/Divine Grant/index.html new file mode 100644 index 000000000..0ab3bebb7 --- /dev/null +++ b/DevGrants/Divine Grant/index.html @@ -0,0 +1,26 @@ + + +
+ + +
+
+
+
+
+
\ No newline at end of file
diff --git a/DevGrants/Divine Grant/script.js b/DevGrants/Divine Grant/script.js
new file mode 100644
index 000000000..024b24ded
--- /dev/null
+++ b/DevGrants/Divine 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/Divine Grant/style.css b/DevGrants/Divine Grant/style.css
new file mode 100644
index 000000000..44bdddecc
--- /dev/null
+++ b/DevGrants/Divine Grant/style.css
@@ -0,0 +1,66 @@
+body{
+ background: url("back.jpg") no-repeat center center/cover;
+}
+
+/* Connect Form */
+
+.choice{
+ position: absolute;
+ opacity: 0.7;
+ top: 200px;
+ width: 400px;
+ height: 400px;
+}
+.algo{
+ position: absolute;
+ opacity: 0.7;
+ right: 20px;
+ width: 500px;
+ height: 500px;
+}
+.form{
+ margin-left: 50%;
+ display: flex;
+ flex-direction: column;
+ height: 540px;
+ width: 400px;
+ 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: #f7c100
+ ;
+ border-radius: 5px;
+ color: white;
+}
\ No newline at end of file