Skip to content

Commit

Permalink
rendered hat IPFS data
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobHomanics committed Mar 28, 2024
1 parent bd1ef9f commit c692a16
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
1 change: 1 addition & 0 deletions hat-jsons/tinkerers-hat.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "name": "The Tinkerer's Hat", "description": "The hat said to be valued by many.", "image": "ipfs://bafkreicgyc2cxnas6klscempaioaiexidmb7sjij2wa53b6pbdmnwfr5jm"}
2 changes: 1 addition & 1 deletion packages/foundry/script/DeployDemo.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ contract DeployDemoScript is ScaffoldETHDeploy {
address(eligibilityModule),
address(activeModule),
true,
"Claimable IPFS"
"ipfs://bafkreidsaw3skbqux3oiutd6j3vqh6dpjimy3msgizm54fq7e5yikdcje4"
);

console.log(claimableHatId);
Expand Down
15 changes: 12 additions & 3 deletions packages/nextjs/app/hats/_components/Hats.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"use client";

import { useFetch } from "usehooks-ts";
import { useAccount } from "wagmi";
import { useScaffoldContractRead, useScaffoldContractWrite } from "~~/hooks/scaffold-eth";

Expand Down Expand Up @@ -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 (
<>
<div className="py-5 space-y-5 flex flex-col justify-center items-center bg-primary bg-[length:100%_100%] py-1 px-5 sm:px-0 lg:py-auto max-w-[100vw] ">
<p>{viewHat ? viewHat[0] : ""}</p>
<p>{result?.data?.name}</p>
<img
src={result?.data?.image.replace("ipfs://", "https://nftstorage.link/ipfs/")}
width={156}
height={156}
></img>
<p>{result?.data?.description}</p>
<button
disabled={(balanceOfClaimableHat || 0) > 0}
className="btn btn-secondary btn-sm font-normal gap-1"
Expand All @@ -87,7 +96,7 @@ export function Hats() {
{"Claim (100 Lifetime Tokens)"}
</button>

{balanceOfClaimableHat || 0 > 0 ? <p>Hat Claimed!</p> : <></>}
{balanceOfClaimableHat || 0 > 0 ? <p>You are currently wearing this hat!</p> : <></>}
</div>
</>
);
Expand Down
12 changes: 6 additions & 6 deletions packages/nextjs/contracts/deployedContracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { GenericContractsDeclaration } from "~~/utils/scaffold-eth/contract";
const deployedContracts = {
31337: {
ReputationTokensStandalone: {
address: "0xcB0f2a13098f8e841e6Adfa5B17Ec00508b27665",
address: "0xFCa5Bb3732185AE6AaFC65aD8C9A4fBFf21DbaaD",
abi: [
{
type: "constructor",
Expand Down Expand Up @@ -1649,7 +1649,7 @@ const deployedContracts = {
},
},
ReputationFaucet: {
address: "0x38c76A767d45Fc390160449948aF80569E2C4217",
address: "0xa68E430060f74F9821D2dC9A9E2CE3aF7d842EBe",
abi: [
{
type: "constructor",
Expand All @@ -1673,7 +1673,7 @@ const deployedContracts = {
inheritedFunctions: {},
},
Hats: {
address: "0x89ec9355b1Bcc964e576211c8B011BD709083f8d",
address: "0xa8fcCF4D0e2f2c4451123fF2F9ddFc9be465Fa1d",
abi: [
{
type: "constructor",
Expand Down Expand Up @@ -3634,7 +3634,7 @@ const deployedContracts = {
},
},
SimpleClaimHatter: {
address: "0xed12bE400A07910E4d4E743E4ceE26ab1FC9a961",
address: "0x975cDd867aCB99f0195be09C269E2440aa1b1FA8",
abi: [
{
type: "constructor",
Expand Down Expand Up @@ -3960,7 +3960,7 @@ const deployedContracts = {
},
},
ActiveModule: {
address: "0xc775bF567D67018dfFac4E89a7Cf10f0EDd0Be93",
address: "0x0aD6371dd7E9923d9968D63Eb8B9858c700abD9d",
abi: [
{
type: "function",
Expand Down Expand Up @@ -3990,7 +3990,7 @@ const deployedContracts = {
inheritedFunctions: {},
},
ERC1155EligibiltiyModule: {
address: "0x3489745eff9525CCC3d8c648102FE2cf3485e228",
address: "0xAA5c5496e2586F81d8d2d0B970eB85aB088639c2",
abi: [
{
type: "constructor",
Expand Down

0 comments on commit c692a16

Please sign in to comment.