From c692a164ca9a4ae76fabdb286e776a1254d044fe Mon Sep 17 00:00:00 2001 From: Jacob Homanics Date: Thu, 28 Mar 2024 02:50:06 -0500 Subject: [PATCH] rendered hat IPFS data --- hat-jsons/tinkerers-hat.json | 1 + packages/foundry/script/DeployDemo.s.sol | 2 +- packages/nextjs/app/hats/_components/Hats.tsx | 15 ++++++++++++--- packages/nextjs/contracts/deployedContracts.ts | 12 ++++++------ 4 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 hat-jsons/tinkerers-hat.json diff --git a/hat-jsons/tinkerers-hat.json b/hat-jsons/tinkerers-hat.json new file mode 100644 index 0000000..99debea --- /dev/null +++ b/hat-jsons/tinkerers-hat.json @@ -0,0 +1 @@ +{ "name": "The Tinkerer's Hat", "description": "The hat said to be valued by many.", "image": "ipfs://bafkreicgyc2cxnas6klscempaioaiexidmb7sjij2wa53b6pbdmnwfr5jm"} \ No newline at end of file diff --git a/packages/foundry/script/DeployDemo.s.sol b/packages/foundry/script/DeployDemo.s.sol index 920a693..657b943 100644 --- a/packages/foundry/script/DeployDemo.s.sol +++ b/packages/foundry/script/DeployDemo.s.sol @@ -95,7 +95,7 @@ contract DeployDemoScript is ScaffoldETHDeploy { address(eligibilityModule), address(activeModule), true, - "Claimable IPFS" + "ipfs://bafkreidsaw3skbqux3oiutd6j3vqh6dpjimy3msgizm54fq7e5yikdcje4" ); console.log(claimableHatId); diff --git a/packages/nextjs/app/hats/_components/Hats.tsx b/packages/nextjs/app/hats/_components/Hats.tsx index 3529396..70382c3 100644 --- a/packages/nextjs/app/hats/_components/Hats.tsx +++ b/packages/nextjs/app/hats/_components/Hats.tsx @@ -1,5 +1,6 @@ "use client"; +import { useFetch } from "usehooks-ts"; import { useAccount } from "wagmi"; import { useScaffoldContractRead, useScaffoldContractWrite } from "~~/hooks/scaffold-eth"; @@ -70,12 +71,20 @@ export function Hats() { args: [BigInt(claimableHatId)], }); - console.log(viewHat); + const result: any = useFetch(viewHat ? viewHat[5].replace("ipfs://", "https://nftstorage.link/ipfs/") : ""); + console.log(result.data); + console.log(result?.data?.json?.image.replace("ipfs://", "https://nftstorage.link/ipfs/")); return ( <>
-

{viewHat ? viewHat[0] : ""}

+

{result?.data?.name}

+ +

{result?.data?.description}

- {balanceOfClaimableHat || 0 > 0 ?

Hat Claimed!

: <>} + {balanceOfClaimableHat || 0 > 0 ?

You are currently wearing this hat!

: <>}
); diff --git a/packages/nextjs/contracts/deployedContracts.ts b/packages/nextjs/contracts/deployedContracts.ts index cc413c1..2754852 100644 --- a/packages/nextjs/contracts/deployedContracts.ts +++ b/packages/nextjs/contracts/deployedContracts.ts @@ -7,7 +7,7 @@ import { GenericContractsDeclaration } from "~~/utils/scaffold-eth/contract"; const deployedContracts = { 31337: { ReputationTokensStandalone: { - address: "0xcB0f2a13098f8e841e6Adfa5B17Ec00508b27665", + address: "0xFCa5Bb3732185AE6AaFC65aD8C9A4fBFf21DbaaD", abi: [ { type: "constructor", @@ -1649,7 +1649,7 @@ const deployedContracts = { }, }, ReputationFaucet: { - address: "0x38c76A767d45Fc390160449948aF80569E2C4217", + address: "0xa68E430060f74F9821D2dC9A9E2CE3aF7d842EBe", abi: [ { type: "constructor", @@ -1673,7 +1673,7 @@ const deployedContracts = { inheritedFunctions: {}, }, Hats: { - address: "0x89ec9355b1Bcc964e576211c8B011BD709083f8d", + address: "0xa8fcCF4D0e2f2c4451123fF2F9ddFc9be465Fa1d", abi: [ { type: "constructor", @@ -3634,7 +3634,7 @@ const deployedContracts = { }, }, SimpleClaimHatter: { - address: "0xed12bE400A07910E4d4E743E4ceE26ab1FC9a961", + address: "0x975cDd867aCB99f0195be09C269E2440aa1b1FA8", abi: [ { type: "constructor", @@ -3960,7 +3960,7 @@ const deployedContracts = { }, }, ActiveModule: { - address: "0xc775bF567D67018dfFac4E89a7Cf10f0EDd0Be93", + address: "0x0aD6371dd7E9923d9968D63Eb8B9858c700abD9d", abi: [ { type: "function", @@ -3990,7 +3990,7 @@ const deployedContracts = { inheritedFunctions: {}, }, ERC1155EligibiltiyModule: { - address: "0x3489745eff9525CCC3d8c648102FE2cf3485e228", + address: "0xAA5c5496e2586F81d8d2d0B970eB85aB088639c2", abi: [ { type: "constructor",