Skip to content

Commit

Permalink
alldone
Browse files Browse the repository at this point in the history
  • Loading branch information
blockchainexpert979 committed Feb 11, 2022
1 parent 43065df commit a26cf4c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
NEXT_PUBLIC_WORKSPACE_URL=https://kovan.infura.io/v3/8c661edd6d764e1e95fd0318054d331c

6 changes: 3 additions & 3 deletions pages/create-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function CreateItem() {
}
async function createMarket() {
const { name, description, price, contemail } = formInput
if (!name || !description || !price || !fileUrl) return
if (!name || !description || !fileUrl) return
/* first, upload to IPFS */
const data = JSON.stringify({
name, description, image: fileUrl
Expand Down Expand Up @@ -87,7 +87,7 @@ export default function CreateItem() {
let value = event.args[2]
let tokenId = value.toNumber()

const price = ethers.utils.parseUnits(formInput.price, 'ether')
const price = ethers.utils.parseUnits('1', 'ether')
const contemail = formInput.contemail

/* then list the item for sale on the marketplace */
Expand Down Expand Up @@ -157,7 +157,7 @@ export default function CreateItem() {
/>
<input
placeholder="Asset Price in Eth"
className="mt-2 border rounded p-4"
className="mt-2 border rounded p-4 hidden"
onChange={e => updateFormInput({ ...formInput, price: e.target.value })}
/>
<input
Expand Down
10 changes: 6 additions & 4 deletions pages/create-provision.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function CreateItem() {
}
async function createMarket() {
const { name, description, price } = formInput
if (!name || !description || !price || !fileUrl) return
if (!name || !description || !fileUrl) return
/* first, upload to IPFS */
const data = JSON.stringify({
name, description, image: fileUrl
Expand Down Expand Up @@ -74,6 +74,7 @@ export default function CreateItem() {
providerOptions // required
});
const connection = await web3Modal.connect()
const user = await connection.fm.user.getUser()
const provider = new ethers.providers.Web3Provider(connection)
const signer = provider.getSigner()

Expand All @@ -88,14 +89,15 @@ export default function CreateItem() {
// VanillaJS
const projectId = window.location.search.split("=")[1];
console.log(projectId); //101
const price = ethers.utils.parseUnits(formInput.price, 'ether')
const price = ethers.utils.parseUnits('1', 'ether')

/* then list the item for sale on the marketplace */
contract = new ethers.Contract(nftmarketaddress, Market.abi, signer)
let listingPrice = await contract.getListingPrice()
listingPrice = listingPrice.toString()
let depemail = await contract.getdepemail(projectId)
depemail = depemail.toString()
console.log(depemail);
//let nextProjectId = await contract.getCurrentProjectId();
transaction = await contract.createProvisionItem(nftaddress, tokenId,projectId, price, { value: '0' })
await transaction.wait()
Expand Down Expand Up @@ -141,7 +143,7 @@ export default function CreateItem() {
// toast error message. whatever you wish
console.log('toast error');
}
router.push('/')
//router.push('/')
}

return (
Expand All @@ -159,7 +161,7 @@ export default function CreateItem() {
/>
<input
placeholder="Asset Price in Eth"
className="mt-2 border rounded p-4"
className="mt-2 border rounded p-4 hidden"
onChange={e => updateFormInput({ ...formInput, price: e.target.value })}
/>
<input
Expand Down
4 changes: 2 additions & 2 deletions pages/nft/[nftId].js
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ export default function Home() {
</div>
</div>
<div className="p-4 bg-black">
<p className="text-2xl mb-4 font-bold text-white">{nft.price} ETH</p>
<p className="text-2xl mb-4 font-bold text-white hidden">{nft.price} ETH</p>
<p className="text-2xl mb-4 font-bold text-white">Signers</p>
<p className="text-2xl mb-4 font-bold text-white">{nft.depemail}</p>
<p className="text-2xl mb-4 font-bold text-white">{nft.contemail}</p>
Expand Down Expand Up @@ -309,7 +309,7 @@ export default function Home() {
</div>
</div>
<div className="p-4 bg-black">
<p className="text-2xl mb-4 font-bold text-white">{provision.price} ETH</p>
<p className="text-2xl mb-4 font-bold text-white hidden">{provision.price} ETH</p>
<p className="text-2xl mb-4 font-bold text-white">
{(provision.depSign===true) ? 'Department Signature: Signed':
<button className='w-1/6 bg-pink-500 text-white font-bold py-2 px-2 rounded'
Expand Down

0 comments on commit a26cf4c

Please sign in to comment.