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
This commit is contained in:
Alex van Andel 2022-02-02 11:07:13 +00:00 committed by GitHub
parent 8bb3e9c0be
commit f52e277dc4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 11 deletions

View file

@ -3,7 +3,6 @@ import { useCallback, useMemo, useState } from "react";
import React from "react"; import React from "react";
import Web3 from "web3"; import Web3 from "web3";
import { AbiItem } from "web3-utils"; import { AbiItem } from "web3-utils";
import verifyAccount, { AUTH_MESSAGE } from "web3/utils/verifyAccount";
import { useLocale } from "@lib/hooks/useLocale"; import { useLocale } from "@lib/hooks/useLocale";
import showToast from "@lib/notification"; import showToast from "@lib/notification";
@ -12,6 +11,7 @@ import { Button } from "@components/ui/Button";
import { useContracts } from "../../../contexts/contractsContext"; import { useContracts } from "../../../contexts/contractsContext";
import genericAbi from "../../../web3/abis/abiWithGetBalance.json"; import genericAbi from "../../../web3/abis/abiWithGetBalance.json";
import verifyAccount, { AUTH_MESSAGE } from "../../../web3/utils/verifyAccount";
interface Window { interface Window {
ethereum: any; ethereum: any;

View file

@ -8,7 +8,6 @@ import utc from "dayjs/plugin/utc";
import type { NextApiRequest, NextApiResponse } from "next"; import type { NextApiRequest, NextApiResponse } from "next";
import short from "short-uuid"; import short from "short-uuid";
import { v5 as uuidv5 } from "uuid"; import { v5 as uuidv5 } from "uuid";
import verifyAccount from "web3/utils/verifyAccount";
import { handlePayment } from "@ee/lib/stripe/server"; import { handlePayment } from "@ee/lib/stripe/server";
@ -34,6 +33,8 @@ import getSubscribers from "@lib/webhooks/subscriptions";
import { getTranslation } from "@server/lib/i18n"; import { getTranslation } from "@server/lib/i18n";
import verifyAccount from "../../../web3/utils/verifyAccount";
dayjs.extend(dayjsBusinessTime); dayjs.extend(dayjsBusinessTime);
dayjs.extend(utc); dayjs.extend(utc);
dayjs.extend(isBetween); dayjs.extend(isBetween);

View file

@ -564,16 +564,17 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
form={formMethods} form={formMethods}
handleSubmit={async (values) => { handleSubmit={async (values) => {
const { periodDates, periodCountCalendarDays, smartContractAddress, ...input } = values; const { periodDates, periodCountCalendarDays, smartContractAddress, ...input } = values;
const metadata = {
smartContractAddress: smartContractAddress,
};
updateMutation.mutate({ updateMutation.mutate({
...input, ...input,
metadata,
periodStartDate: periodDates.startDate, periodStartDate: periodDates.startDate,
periodEndDate: periodDates.endDate, periodEndDate: periodDates.endDate,
periodCountCalendarDays: periodCountCalendarDays === "1", periodCountCalendarDays: periodCountCalendarDays === "1",
id: eventType.id, id: eventType.id,
metadata: smartContractAddress
? {
smartContractAddress,
}
: undefined,
}); });
}} }}
className="space-y-6"> className="space-y-6">
@ -1034,7 +1035,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
</div> </div>
)} )}
{period.type === "RANGE" && ( {period.type === "RANGE" && (
<div className="inline-flex rtl:space-x-reverse space-x-2 ltr:ml-2 rtl:mr-2"> <div className="inline-flex space-x-2 rtl:space-x-reverse ltr:ml-2 rtl:mr-2">
<Controller <Controller
name="periodDates" name="periodDates"
control={formMethods.control} control={formMethods.control}
@ -1130,7 +1131,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
defaultChecked={requirePayment} defaultChecked={requirePayment}
/> />
</div> </div>
<div className="ltr:ml-3 rtl:mr-3 text-sm"> <div className="text-sm ltr:ml-3 rtl:mr-3">
<p className="text-neutral-900"> <p className="text-neutral-900">
{t("require_payment")} (0.5% +{" "} {t("require_payment")} (0.5% +{" "}
<IntlProvider locale="en"> <IntlProvider locale="en">
@ -1197,7 +1198,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
</> </>
{/* )} */} {/* )} */}
</Collapsible> </Collapsible>
<div className="flex justify-end mt-4 rtl:space-x-reverse space-x-2"> <div className="flex justify-end mt-4 space-x-2 rtl:space-x-reverse">
<Button href="/event-types" color="secondary" tabIndex={-1}> <Button href="/event-types" color="secondary" tabIndex={-1}>
{t("cancel")} {t("cancel")}
</Button> </Button>

View file

@ -1,5 +1,5 @@
import { ArrowRightIcon } from "@heroicons/react/outline"; 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 { Prisma } from "@prisma/client";
import classnames from "classnames"; import classnames from "classnames";
import dayjs from "dayjs"; import dayjs from "dayjs";
@ -534,7 +534,7 @@ export default function Onboarding(props: inferSSRProps<typeof getServerSideProp
{error && <Alert severity="error" {...error} />} {error && <Alert severity="error" {...error} />}
<section className="flex w-full rtl:space-x-reverse space-x-2"> <section className="flex w-full space-x-2 rtl:space-x-reverse">
{steps.map((s, index) => { {steps.map((s, index) => {
return index <= currentStep ? ( return index <= currentStep ? (
<div <div