From f52e277dc4d08890c70c3594db260b0f37048c42 Mon Sep 17 00:00:00 2001 From: Alex van Andel Date: Wed, 2 Feb 2022 11:07:13 +0000 Subject: [PATCH] Web3 hotfixes to latest main (#1681) * Fixed import of web3 dir * Invalid way of including the zodResolver, exposed by updating 2.8.3 to 2.8.5 in @hookform/resolvers * smartContractAddress is added conditionally, so added check to reflect this in the updateMutation --- ee/components/web3/CryptoSection.tsx | 2 +- pages/api/book/event.ts | 3 ++- pages/event-types/[type].tsx | 15 ++++++++------- pages/getting-started.tsx | 4 ++-- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/ee/components/web3/CryptoSection.tsx b/ee/components/web3/CryptoSection.tsx index fcd106b3..8b14265b 100644 --- a/ee/components/web3/CryptoSection.tsx +++ b/ee/components/web3/CryptoSection.tsx @@ -3,7 +3,6 @@ import { useCallback, useMemo, useState } from "react"; import React from "react"; import Web3 from "web3"; import { AbiItem } from "web3-utils"; -import verifyAccount, { AUTH_MESSAGE } from "web3/utils/verifyAccount"; import { useLocale } from "@lib/hooks/useLocale"; import showToast from "@lib/notification"; @@ -12,6 +11,7 @@ import { Button } from "@components/ui/Button"; import { useContracts } from "../../../contexts/contractsContext"; import genericAbi from "../../../web3/abis/abiWithGetBalance.json"; +import verifyAccount, { AUTH_MESSAGE } from "../../../web3/utils/verifyAccount"; interface Window { ethereum: any; diff --git a/pages/api/book/event.ts b/pages/api/book/event.ts index 468fb39c..bdc287fb 100644 --- a/pages/api/book/event.ts +++ b/pages/api/book/event.ts @@ -8,7 +8,6 @@ import utc from "dayjs/plugin/utc"; import type { NextApiRequest, NextApiResponse } from "next"; import short from "short-uuid"; import { v5 as uuidv5 } from "uuid"; -import verifyAccount from "web3/utils/verifyAccount"; import { handlePayment } from "@ee/lib/stripe/server"; @@ -34,6 +33,8 @@ import getSubscribers from "@lib/webhooks/subscriptions"; import { getTranslation } from "@server/lib/i18n"; +import verifyAccount from "../../../web3/utils/verifyAccount"; + dayjs.extend(dayjsBusinessTime); dayjs.extend(utc); dayjs.extend(isBetween); diff --git a/pages/event-types/[type].tsx b/pages/event-types/[type].tsx index 37aab1aa..129423d2 100644 --- a/pages/event-types/[type].tsx +++ b/pages/event-types/[type].tsx @@ -564,16 +564,17 @@ const EventTypePage = (props: inferSSRProps) => { form={formMethods} handleSubmit={async (values) => { const { periodDates, periodCountCalendarDays, smartContractAddress, ...input } = values; - const metadata = { - smartContractAddress: smartContractAddress, - }; updateMutation.mutate({ ...input, - metadata, periodStartDate: periodDates.startDate, periodEndDate: periodDates.endDate, periodCountCalendarDays: periodCountCalendarDays === "1", id: eventType.id, + metadata: smartContractAddress + ? { + smartContractAddress, + } + : undefined, }); }} className="space-y-6"> @@ -1034,7 +1035,7 @@ const EventTypePage = (props: inferSSRProps) => { )} {period.type === "RANGE" && ( -
+
) => { defaultChecked={requirePayment} />
-
+

{t("require_payment")} (0.5% +{" "} @@ -1197,7 +1198,7 @@ const EventTypePage = (props: inferSSRProps) => { {/* )} */} -

+
diff --git a/pages/getting-started.tsx b/pages/getting-started.tsx index 3b9fbf79..53963a10 100644 --- a/pages/getting-started.tsx +++ b/pages/getting-started.tsx @@ -1,5 +1,5 @@ import { ArrowRightIcon } from "@heroicons/react/outline"; -import { zodResolver } from "@hookform/resolvers/zod/dist/zod"; +import { zodResolver } from "@hookform/resolvers/zod"; import { Prisma } from "@prisma/client"; import classnames from "classnames"; import dayjs from "dayjs"; @@ -534,7 +534,7 @@ export default function Onboarding(props: inferSSRProps} -
+
{steps.map((s, index) => { return index <= currentStep ? (