Skip to content

Commit

Permalink
🤖🔭 ↝ Updating route for lazy minting proposal data as nfts (check pre…
Browse files Browse the repository at this point in the history
…v commit)
  • Loading branch information
Gizmotronn committed Jan 4, 2023
1 parent 3e827e0 commit aab097f
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 2 deletions.
8 changes: 8 additions & 0 deletions Server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,20 @@
contract = web3Sdk.get_contract("0xCcaA1ABA77Bae6296D386C2F130c46FEc3E5A004")
proposals = contract.call("getProposals")

# Minting candidate nfts
nftSdk = ThirdwebSDK('mumbai')
nftContract = nftSdk.get_contract("0xed6e837Fda815FBf78E8E7266482c5Be80bC4bF9")

@app.route('/')
def index():
return "Hello World"

@app.route('/proposals', methods=["GET"])
def getProposals():
# Mint nft based on proposal id
proposalCandidate = nftContract.call("lazyMint", _amount, _baseURIForTokens, _data) # Get this from Jupyter notebook -> https://thirdweb.com/mumbai/0xed6e837Fda815FBf78E8E7266482c5Be80bC4bF9/nfts token id 0 (e.g.)
createProposal = contract.call("createProposal", _owner, _title, _description, _target, _deadline, _image) # Get this from PUSH req contents

return proposals

@app.route('/login', methods=['POST'])
Expand Down
2 changes: 1 addition & 1 deletion Server/frontend/components/Sidebar.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from "react";
import Link from "next/link";
import { logo, sun } from '../assets';
import { navlinks } from '../constants';
import { navlinks } from '../pages/api/proposals/constants';
import styles from '../styles/Header.module.css';

const Icon = ({ styles, name, imgUrl, isActive, disabled, handleClick }) => (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createCampaign, dashboard, logout, payment, profile, withdraw } from '../assets';
import { createCampaign, dashboard, logout, payment, profile, withdraw } from '../../../../assets';

export const navlinks = [
{
Expand Down
File renamed without changes.
17 changes: 17 additions & 0 deletions Server/frontend/pages/api/proposals/fetchProposals.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
/*import { useContract, useContractRead } from "@thirdweb-dev/react";
export default function fetchProposalFromContract () {
/*
const [isLoading, setIsLoading] = useState(false);
const [proposals, setProposals] = useState([]);
const { address, contract, getProposals } = useStateContext();
const fetchProposals = async () => { // This is to allow us to call this g.request in the useEffect (as the request is async in /context)
setIsLoading(true);
const data = await getProposals();
setProposals(data);
setIsLoading(false);
}
useEffect(() => {
if (contract) fetchProposals();
}, [address, contract]); // Re-called when these change
*/

/*const { contract, isLoading, error } = useContract("0xCcaA1ABA77Bae6296D386C2F130c46FEc3E5A004");
const proposalData = contract.call("numberOfClassifications")
const allProposals = fetch('/proposals');
Expand Down

1 comment on commit aab097f

@Gizmotronn
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.