From 1d1087489017141d239af3e99900b7c6e9e9e634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edward=20Fern=C3=A1ndez?= <40343753+edanfesi@users.noreply.github.com> Date: Tue, 1 Feb 2022 16:48:40 -0500 Subject: [PATCH] Web3 App (#1603) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Crypto events (#1390) * update schemas, functions & ui to allow creating and updating events with a smart contract property * remove adding sc address in the dialog that first pops-up when creating a new event, since its an advanced option * add sc to booking ui * some more ts && error handling * fetch erc20s and nfts list in event-type page * some cleanup within time limit * ts fix 1 * more ts fixes * added web3 section to integrations * added web3 wrapper, needs connection to user_settings db * extract to api * Update eventType.ts * Update components/CryptoSection.tsx Change comment from // to /** as @zomars suggested Co-authored-by: Omar López * convert axios to fetch, change scAddress to smartContractAddress, load bloxy from next_public_env * Fix branch conflict * add enable/disable btn web3 * fixed away user causing duplicate entries * Remove web3 validation * renamed web3 button in integrations * remove unused variable * Add metadata column * added loader and showToast to the web3 btn * fix: remove smartContractAddress from info sended * send to user events when the contract is missing * use window.web3 instead of web3 * use NEXT_PUBLIC_WEB3_AUTH_MSG * remove web3 auth from .env * wip * wip * Add metamask not installed msg and success redirect * add redirect when verified * styled web3 button and added i18n to web3 * fixed redirect after verification * wip * wip * moved crypto section to ee Co-authored-by: Yuval Drori <53199044+yuvd@users.noreply.github.com> Co-authored-by: Peer Richelsen Co-authored-by: Yuval Drori Co-authored-by: Omar López Co-authored-by: Edward Fernandez Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: Peer Richelsen --- .env.example | 5 + components/NavTabs.tsx | 4 +- components/booking/pages/AvailabilityPage.tsx | 10 + components/booking/pages/BookingPage.tsx | 59 +- contexts/contractsContext.tsx | 42 + ee/components/web3/CryptoSection.tsx | 149 + lib/integrations/getIntegrations.ts | 13 +- lib/types/event-type.ts | 2 + package.json | 6 +- pages/[user].tsx | 74 +- pages/[user]/[type].tsx | 5 + pages/[user]/book.tsx | 30 +- pages/_app.tsx | 13 +- pages/api/book/event.ts | 11 +- pages/api/event-type/index.ts | 3 +- pages/api/eventType.ts | 5 +- pages/event-types/[type].tsx | 112 +- pages/integrations/index.tsx | 85 +- pages/team/[slug]/[type].tsx | 3 + pages/team/[slug]/book.tsx | 3 + .../20211222174947_placeholder/migration.sql | 38 + .../migration.sql | 2 + .../migration.sql | 3 + .../migration.sql | 1 + prisma/schema.prisma | 3 +- prisma/zod/eventtype.ts | 1 + public/integrations/metamask.svg | 61 + public/integrations/web3.svg | 5 + public/static/locales/de/common.json | 2 + public/static/locales/en/common.json | 11 +- public/static/locales/es/common.json | 2 + public/static/locales/fr/common.json | 2 + public/static/locales/it/common.json | 2 + public/static/locales/ja/common.json | 2 + public/static/locales/ko/common.json | 2 + public/static/locales/nl/common.json | 2 + public/static/locales/pl/common.json | 2 + public/static/locales/pt-BR/common.json | 2 + public/static/locales/pt/common.json | 2 + public/static/locales/ro/common.json | 2 + public/static/locales/ru/common.json | 2 + public/static/locales/zh-CN/common.json | 2 + server/routers/viewer.tsx | 57 + tsconfig.tsbuildinfo | 1 + web3/abis/abiWithGetBalance.json | 9 + web3/dummyResps/bloxyApi.js | 7004 +++++++++++++++++ web3/utils/verifyAccount.ts | 12 + yarn.lock | 4171 ++++++---- 48 files changed, 10630 insertions(+), 1409 deletions(-) create mode 100644 contexts/contractsContext.tsx create mode 100644 ee/components/web3/CryptoSection.tsx create mode 100644 prisma/migrations/20211222174947_placeholder/migration.sql create mode 100644 prisma/migrations/20211222181246_add_sc_address/migration.sql create mode 100644 prisma/migrations/20220113145333_rename_column_sc_address_to_smart_contract_address/migration.sql create mode 100644 prisma/migrations/20220131170110_add_metadata_column_to_event_type/migration.sql create mode 100644 public/integrations/metamask.svg create mode 100644 public/integrations/web3.svg create mode 100644 tsconfig.tsbuildinfo create mode 100644 web3/abis/abiWithGetBalance.json create mode 100644 web3/dummyResps/bloxyApi.js create mode 100644 web3/utils/verifyAccount.ts diff --git a/.env.example b/.env.example index b28da85c..e9f26198 100644 --- a/.env.example +++ b/.env.example @@ -90,3 +90,8 @@ CALENDSO_ENCRYPTION_KEY= # Intercom Config NEXT_PUBLIC_INTERCOM_APP_ID= + +# Web3/Crypto stuff +NEXT_PUBLIC_BLOXY_API_KEY= +# Auth message can be whatever you want, doesn't really matter because it's encrypted with a private key anyway, and will be visible to the signee +NEXT_PUBLIC_WEB3_AUTH_MSG= diff --git a/components/NavTabs.tsx b/components/NavTabs.tsx index d8e66a18..ce6a0560 100644 --- a/components/NavTabs.tsx +++ b/components/NavTabs.tsx @@ -17,11 +17,11 @@ const NavTabs: FC = ({ tabs, linkProps }) => { const router = useRouter(); return ( <> -