diff --git a/checkpoint.py b/checkpoint.py index 1c6e878..d60aa60 100644 --- a/checkpoint.py +++ b/checkpoint.py @@ -219,3 +219,47 @@ def restore( if params_only: state = state.params return state +import { useState } from "react"; +import { ethers } from "ethers"; + +const metaLandAddress = "0xYourMetaLandContract"; +const metaTokenAddress = "0xYourMetaTokenContract"; +const metaContentAddress = "0xYourMetaContentContract"; + +const provider = new ethers.providers.Web3Provider(window.ethereum); +const signer = provider.getSigner(); + +const metaLandContract = new ethers.Contract(metaLandAddress, MetaLandABI, signer); +const metaTokenContract = new ethers.Contract(metaTokenAddress, MetaTokenABI, signer); +const metaContentContract = new ethers.Contract(metaContentAddress, MetaContentABI, signer); + +function App() { + const [landId, setLandId] = useState(""); + const [price, setPrice] = useState(""); + const [metadataURI, setMetadataURI] = useState(""); + + const mintLand = async () => { + const tx = await metaLandContract.mintLand(metadataURI, ethers.utils.parseEther(price)); + await tx.wait(); + alert("Terrain créé !"); + }; + + const buyLand = async () => { + const tx = await metaLandContract.buyLand(landId); + await tx.wait(); + alert("Terrain acheté !"); + }; + + return ( +