Skip to content

Commit

Permalink
use Cleanify__factory and renamed file and hook name
Browse files Browse the repository at this point in the history
  • Loading branch information
Agilulfo1820 committed Nov 18, 2023
1 parent 85db536 commit 0664129
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export * from "./usePolling";
export * from "./useTrashifyContract";
export * from "./useCleanifyContract";
export * from "./useTrashifyReports";
export * from "./useReportMetadata";
export * from "./useSubmitReport";
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { useAccountAbstraction } from "@store";
import { useMemo } from "react";
import { Trashify__factory as TrashifyFactory } from "@/typechain";
import { Cleanify__factory as CleanifyFactory } from "@/typechain";
import { useWeb3Provider } from "@hooks/useWeb3Provider.ts";

export const useTrashifyContract = () => {
export const useCleanifyContract = () => {
const { chain } = useAccountAbstraction();
const { providerOrSigner } = useWeb3Provider();

const contract = useMemo(() => {
return TrashifyFactory.connect(chain.contractAddress, providerOrSigner);
return CleanifyFactory.connect(chain.contractAddress, providerOrSigner);
}, [chain.contractAddress, providerOrSigner]);

return {
Expand Down
12 changes: 6 additions & 6 deletions src/hooks/useReportById.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import {useReportMetadata} from "@hooks/useReportMetadata.ts"
import {BaseReport} from "@models/report.ts"
import {useEffect, useState} from "react"
import {useTrashifyContract} from "@hooks/useTrashifyContract.ts"
import { useReportMetadata } from "@hooks/useReportMetadata.ts"
import { BaseReport } from "@models/report.ts"
import { useEffect, useState } from "react"
import { useCleanifyContract } from "@hooks/useCleanifyContract.ts"

export const useReportById = (id: number) => {

const {contract} = useTrashifyContract()
const { contract } = useCleanifyContract()

const [baseReport, setBaseReport] = useState<BaseReport>()

const {report} = useReportMetadata(baseReport)
const { report } = useReportMetadata(baseReport)

useEffect(() => {
if (contract) {
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useSubmitReport.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useTrashifyContract } from "@hooks/useTrashifyContract.ts";
import { useCleanifyContract } from "@hooks/useCleanifyContract.ts";
import { uploadToIpfs } from "@utils";
import { ReportMetadata } from "@models/report.ts";
import { NewReportSubmitedEvent } from "@/typechain/contracts/Trashify";

export const useSubmitReport = () => {
const { contract } = useTrashifyContract();
const { contract } = useCleanifyContract();
const createReport = async (
metadata: ReportMetadata
): Promise<NewReportSubmitedEvent> => {
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useTrashifyReports.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useTrashifyContract } from "@hooks/useTrashifyContract.ts";
import { useCleanifyContract } from "@hooks/useCleanifyContract.ts";
import { useEffect, useState } from "react";
import { Trashify } from "@/typechain";
import { BaseReport } from "@models/report.ts";

export const useTrashifyReports = () => {
const { contract } = useTrashifyContract();
const { contract } = useCleanifyContract();
const [baseReports, setBaseReports] = useState<BaseReport[]>([]);

const queryReports = async (contract: Trashify) => {
Expand Down

0 comments on commit 0664129

Please sign in to comment.