From 3d970de613cb373c1e2124d332d16f9b2ccf115e Mon Sep 17 00:00:00 2001 From: Sasi Date: Sun, 25 Feb 2024 23:37:58 +0530 Subject: [PATCH] chore: cleanup --- apps/api/scripts/clickhouse.sql | 4 ++-- apps/api/src/helpers/constants.ts | 2 +- apps/api/src/routes/signup.ts | 20 +++++++++++--------- apps/web/src/components/Login/Signup.tsx | 15 ++++++++++++--- packages/constants/general.ts | 2 +- packages/permissionless/README.md | 4 ++-- packages/permissionless/scripts/deploy.ts | 9 +++++---- 7 files changed, 34 insertions(+), 22 deletions(-) diff --git a/apps/api/scripts/clickhouse.sql b/apps/api/scripts/clickhouse.sql index 3563769d3..39343f91b 100644 --- a/apps/api/scripts/clickhouse.sql +++ b/apps/api/scripts/clickhouse.sql @@ -29,8 +29,8 @@ CREATE TABLE signups ( handle String, address String, email String, - ls_txn_id String, - txn_hash String, + order_number String, + hash String, created DateTime DEFAULT now() ) ENGINE = MergeTree ORDER BY created; diff --git a/apps/api/src/helpers/constants.ts b/apps/api/src/helpers/constants.ts index ce89ce630..f80a31661 100644 --- a/apps/api/src/helpers/constants.ts +++ b/apps/api/src/helpers/constants.ts @@ -6,7 +6,7 @@ export const ERROR_MESSAGE = 'Something went wrong' export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000' export const TAPE_SIGNUP_PROXY_ADDRESS = - '0xb9F635c498CdC2dBf95B3A916b007fD16c5506ED' + '0xFa920e03C4096C09ae20716c249f6d3A27114984' export const TAPE_SIGNUP_PROXY_ABI = [ { inputs: [ diff --git a/apps/api/src/routes/signup.ts b/apps/api/src/routes/signup.ts index fa189f3d3..2d7925a1b 100644 --- a/apps/api/src/routes/signup.ts +++ b/apps/api/src/routes/signup.ts @@ -8,7 +8,6 @@ import type { z } from 'zod' import { any, object } from 'zod' import { - ERROR_MESSAGE, TAPE_SIGNUP_PROXY_ABI, TAPE_SIGNUP_PROXY_ADDRESS, ZERO_ADDRESS @@ -84,17 +83,17 @@ app.post('/', zValidator('json', validationSchema), async (c) => { if (!test_mode) { const clickhouseBody = ` INSERT INTO signups ( + handle, address, email, - handle, - hash, - order_number + order_number, + hash ) VALUES ( + '${handle}', '${address}', '${email}', - '${handle}', - '${hash}', - '${order_number}' + '${order_number}', + '${hash}' ) ` const clickhouseResponse = await fetch(c.env.INGEST_REST_ENDPOINT, { @@ -103,14 +102,17 @@ app.post('/', zValidator('json', validationSchema), async (c) => { body: clickhouseBody }) if (clickhouseResponse.status !== 200) { - return c.json({ success: false, message: ERROR_MESSAGE }) + return c.json({ + success: false, + message: 'Failed to ingest to clickhouse!' + }) } } return c.json({ success: true, hash }) } catch (error) { console.log('🚀 ~ signup ~ app.post ~ error:', error) - return c.json({ success: false, message: ERROR_MESSAGE }) + return c.json({ success: false, message: error }) } }) diff --git a/apps/web/src/components/Login/Signup.tsx b/apps/web/src/components/Login/Signup.tsx index db8321201..281f55d7b 100644 --- a/apps/web/src/components/Login/Signup.tsx +++ b/apps/web/src/components/Login/Signup.tsx @@ -195,7 +195,7 @@ const Signup = ({ window.createLemonSqueezy?.() window.LemonSqueezy?.Setup?.({ eventHandler }) window.LemonSqueezy?.Url?.Open?.( - `https://tape.lemonsqueezy.com/checkout/buy/d9dba154-17d4-40df-a786-6f90c3dc0ca7?checkout[custom][address]=${address}&checkout[custom][delegatedExecutor]=${address}&checkout[custom][handle]=${handle}&desc=0&discount=0&embed=1&media=0` + `https://tape.lemonsqueezy.com/checkout/buy/d9dba154-17d4-40df-a786-6f90c3dc0ca7?checkout[custom][address]=${address}&checkout[custom][delegatedExecutor]=${address}&checkout[custom][handle]=${handle}&desc=0&discount=1&embed=1&media=0` ) } @@ -203,6 +203,10 @@ const Signup = ({ { handle }: FormData, e: React.FormEvent ) => { + if (!isHandleAvailable) { + return toast.error('Handle is taken') + } + const clickedButton = (e.nativeEvent as any).submitter.name if (clickedButton === 'card') { return handleBuy() @@ -320,7 +324,12 @@ const Signup = ({
-
@@ -337,7 +346,7 @@ const Signup = ({ size="md" variant="secondary" loading={creating} - disabled={creating} + disabled={creating || !isHandleAvailable || checkingAvailability} > Mint for {TAPE_SIGNUP_PRICE} MATIC diff --git a/packages/constants/general.ts b/packages/constants/general.ts index 621b1d30c..553554aae 100644 --- a/packages/constants/general.ts +++ b/packages/constants/general.ts @@ -45,7 +45,7 @@ export const TAPE_API_URL = IS_PRODUCTION // tape addresses export const TAPE_SIGNUP_PROXY_ADDRESS = IS_MAINNET - ? '0xCdeA6d8372E3a8837A6714E0828aFE37bB054040' + ? '0xFa920e03C4096C09ae20716c249f6d3A27114984' : '0xb9F635c498CdC2dBf95B3A916b007fD16c5506ED' // lens addresses diff --git a/packages/permissionless/README.md b/packages/permissionless/README.md index fdbb65e32..decf2a11b 100644 --- a/packages/permissionless/README.md +++ b/packages/permissionless/README.md @@ -15,8 +15,8 @@ npx hardhat compile ### Deploy ``` npx hardhat run scripts/deploy.ts --network polygon -npx hardhat verify 0xCdeA6d8372E3a8837A6714E0828aFE37bB054040 --network polygon -hh verify 0xCdeA6d8372E3a8837A6714E0828aFE37bB054040 --network polygon +npx hardhat verify 0xFa920e03C4096C09ae20716c249f6d3A27114984 --network polygon +hh verify 0xFa920e03C4096C09ae20716c249f6d3A27114984 --network polygon ``` ``` diff --git a/packages/permissionless/scripts/deploy.ts b/packages/permissionless/scripts/deploy.ts index bc1ec4f65..322b86958 100644 --- a/packages/permissionless/scripts/deploy.ts +++ b/packages/permissionless/scripts/deploy.ts @@ -1,12 +1,13 @@ const hre = require('hardhat') async function deployProxy() { - // const owner = '0xB89560D7b33ea8d787EaaEfbcE1268f8991Db9E1' - // const permissionlessCreator = '0x0b5e6100243f793e480DE6088dE6bA70aA9f3872' + // mainnet + const owner = '0xB89560D7b33ea8d787EaaEfbcE1268f8991Db9E1' + const permissionlessCreator = '0x0b5e6100243f793e480DE6088dE6bA70aA9f3872' // testnet - const owner = '0xa8535b8049948bE1bFeb1404daEabbD407792411' - const permissionlessCreator = '0x42b302BBB4fA27c21d32EdF602E4e2aA65746999' + // const owner = '0xa8535b8049948bE1bFeb1404daEabbD407792411' + // const permissionlessCreator = '0x42b302BBB4fA27c21d32EdF602E4e2aA65746999' const TapePermissionlessCreator = await hre.ethers.getContractFactory( 'TapePermissionlessCreator'