1
1
"use client" ;
2
2
3
3
import { useMemo , useState } from "react" ;
4
- import { getConditions , mintPrivateFunction , useTotalNFTsQuery } from "../utils" ;
5
- import { LigthouseEnctyptedFileUpload } from "./LighthouseUpload" ;
4
+ import { mintPrivateFunction , useTotalNFTsQuery } from "../utils" ;
5
+ import { LigthouseLitEnctyptedFileUpload } from "./LighthouseUpload" ;
6
6
import { WriteContractFunctionForm } from "./WriteContractFunctionForm" ;
7
7
import { Hex } from "viem" ;
8
8
import { useAccount } from "wagmi" ;
@@ -12,34 +12,37 @@ export const MintPrivateNFTForm = () => {
12
12
const [ imageCid , setImageCid ] = useState < string | null > ( null ) ;
13
13
const { chainId } = useAccount ( ) ;
14
14
const contractsData = useAllContracts ( ) ;
15
- // Find the LighthouseNFT contract address
16
- const [ LighthouseNFTAddress , Abi ] = useMemo ( ( ) => {
17
- // Change the contract name to match the contract name in the contractsData object by default it is LighthouseNFT
18
- const lighthouseContract = Object . entries ( contractsData ) . find ( ( [ name ] ) => name === "LighthouseNFT " ) ;
19
- return lighthouseContract ? [ lighthouseContract [ 1 ] . address , lighthouseContract [ 1 ] . abi ] : [ null , null ] ;
15
+ // Find the LitEncryptedNFT contract address
16
+ const [ LitEncryptedNFTAddress , Abi ] = useMemo ( ( ) => {
17
+ // Change the contract name to match the contract name in the contractsData object by default it is LitEncryptedNFT
18
+ const nftContract = Object . entries ( contractsData ) . find ( ( [ name ] ) => name === "LitEncryptedNFT " ) ;
19
+ return nftContract ? [ nftContract [ 1 ] . address , nftContract [ 1 ] . abi ] : [ null , null ] ;
20
20
} , [ contractsData ] ) ;
21
21
22
22
const handleGetCID = ( cid : string ) => {
23
23
setImageCid ( cid ) ;
24
24
} ;
25
25
26
26
// Fetch total supply
27
- const { totalNFTs } = useTotalNFTsQuery ( LighthouseNFTAddress as Hex , Abi as any ) ;
27
+ const { totalNFTs } = useTotalNFTsQuery ( LitEncryptedNFTAddress as Hex , Abi as any ) ;
28
28
const nextToken = totalNFTs ? Number ( totalNFTs ) + 1 : 1 ;
29
- const conditions = getConditions ( LighthouseNFTAddress as string , chainId as number , nextToken ) ;
29
+ const chain = chainId === 371 ? "filecoin" : "filecoin" ;
30
+ // const conditions = getConditions(LitEncryptedNFTAddress as string, chainId as number, nextToken);
30
31
return (
31
32
< div className = "flex flex-col items-center space-y-4 p-5 w-full bg-base-100 border-base-300 border shadow-md shadow-secondary rounded-3xl px-6 lg:px-8 mb-6 py-4" >
32
33
< h2 className = "text-2xl font-bold" > Mint Your Private NFT</ h2 >
33
- < LigthouseEnctyptedFileUpload
34
+ < LigthouseLitEnctyptedFileUpload
34
35
handleGetCID = { handleGetCID }
35
36
acceptMimeType = "image/*"
36
- accessControlConditions = { { conditions : conditions . conditions , aggregate : conditions . aggregator } }
37
+ tokenId = { nextToken }
38
+ chain = { chain }
39
+ contractAddress = { LitEncryptedNFTAddress as string }
37
40
/>
38
- { imageCid && LighthouseNFTAddress && (
41
+ { imageCid && LitEncryptedNFTAddress && (
39
42
< WriteContractFunctionForm
40
43
abi = { Abi }
41
44
abiFunction = { mintPrivateFunction }
42
- contractAddress = { LighthouseNFTAddress }
45
+ contractAddress = { LitEncryptedNFTAddress }
43
46
onChange = { ( ) => void 0 }
44
47
functionPropsWithIndexAndValue = { [ { index : 0 , value : imageCid } ] }
45
48
/>
0 commit comments