Skip to content

Commit

Permalink
Update createAttestation params
Browse files Browse the repository at this point in the history
  • Loading branch information
carlbarrdahl committed Apr 6, 2024
1 parent 17f2bcc commit fd32452
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/features/applications/hooks/useApproveApplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function useApproveApplication(opts?: { onSuccess?: () => void }) {
refUID,
},
signer,
round.network,
contracts,
),
),
);
Expand Down
2 changes: 1 addition & 1 deletion src/features/voters/hooks/useApproveVoters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function useApproveVoters({
recipient,
},
signer,
round.network!,
contracts,
),
),
);
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useEAS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { type MultiAttestationRequest } from "@ethereum-attestation-service/eas-

import { useEthersSigner } from "~/hooks/useEthersSigner";
import { createAttestation } from "~/lib/eas/createAttestation";
import { createEAS } from "~/lib/eas/createEAS";
import { createEAS, getContracts } from "~/lib/eas/createEAS";
import { useCurrentRound } from "~/features/rounds/hooks/useRound";

export function useCreateAttestation() {
Expand All @@ -16,7 +16,7 @@ export function useCreateAttestation() {
}) => {
if (!signer) throw new Error("Connect wallet first");
if (!round?.network) throw new Error("Round network not configured");
return createAttestation(data, signer, round.network);
return createAttestation(data, signer, getContracts(round.network));
},
});
}
Expand Down
6 changes: 2 additions & 4 deletions src/lib/eas/createAttestation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from "@ethereum-attestation-service/eas-sdk";
import { type Signer } from "ethers";

import { getContracts } from "./createEAS";
import { eas } from "~/config";

type Params = {
values: Record<string, unknown>;
Expand All @@ -19,13 +19,11 @@ type Params = {
export async function createAttestation(
params: Params,
signer: Signer,
network: string,
contracts: typeof eas.contracts.default,
): Promise<AttestationRequest> {
console.log("Getting recipient address");
const recipient = params.recipient ?? (await signer.getAddress());

const contracts = getContracts(network);

const schemaRegistry = new SchemaRegistry(contracts.registry);
console.log("Connecting signer to SchemaRegistry...");
schemaRegistry.connect(signer);
Expand Down

0 comments on commit fd32452

Please sign in to comment.