diff --git a/apps/api/package.json b/apps/api/package.json index 833d1192d..14c10e14f 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -12,7 +12,7 @@ "dependencies": { "@aws-sdk/client-sts": "3.521.0", "@hono/zod-validator": "^0.1.11", - "hono": "^4.0.6", + "hono": "^4.0.7", "linkedom": "^0.16.8", "ua-parser-js": "^1.0.37", "viem": "^2.7.14", diff --git a/apps/web/src/components/Login/Signup.tsx b/apps/web/src/components/Login/Signup.tsx index dfdd1bc93..1faef77bc 100644 --- a/apps/web/src/components/Login/Signup.tsx +++ b/apps/web/src/components/Login/Signup.tsx @@ -15,7 +15,7 @@ import { } from '@tape.xyz/constants' import { EVENTS, Tower } from '@tape.xyz/generic' import { - useGenerateLensApiRelayAddressLazyQuery, + useGenerateLensApiRelayAddressQuery, useProfileLazyQuery } from '@tape.xyz/lens' import type { CustomErrorWithData } from '@tape.xyz/lens/custom-types' @@ -109,9 +109,11 @@ const Signup: FC = ({ showLogin, onSuccess, setShowSignup }) => { }) } - const [generateRelayerAddress] = useGenerateLensApiRelayAddressLazyQuery({ + const { data } = useGenerateLensApiRelayAddressQuery({ fetchPolicy: 'no-cache' }) + const delegatedExecutor = data?.generateLensAPIRelayAddress + const [checkAvailability, { loading: checkingAvailability }] = useProfileLazyQuery() const [checkIsProfileMinted] = useProfileLazyQuery({ @@ -195,7 +197,7 @@ const Signup: FC = ({ showLogin, onSuccess, setShowSignup }) => { 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=1&embed=1&media=0` + `https://tape.lemonsqueezy.com/checkout/buy/d9dba154-17d4-40df-a786-6f90c3dc0ca7?checkout[custom][address]=${address}&checkout[custom][delegatedExecutor]=${delegatedExecutor}&checkout[custom][handle]=${handle}&desc=0&discount=1&embed=1&media=0` ) } @@ -215,16 +217,14 @@ const Signup: FC = ({ showLogin, onSuccess, setShowSignup }) => { await handleWrongNetwork() try { - const { data } = await generateRelayerAddress() - const relayerAddress = data?.generateLensAPIRelayAddress - if (!relayerAddress) { + if (!delegatedExecutor) { setCreating(false) return toast.error(ERROR_MESSAGE) } return await writeContractAsync({ abi: TAPE_SIGNUP_PROXY_ABI, address: TAPE_SIGNUP_PROXY_ADDRESS, - args: [[address, ZERO_ADDRESS, '0x'], handle, [relayerAddress]], + args: [[address, ZERO_ADDRESS, '0x'], handle, [delegatedExecutor]], functionName: 'createProfileWithHandleUsingCredits', value: parseEther(TAPE_SIGNUP_PRICE.toString()) }) diff --git a/apps/web/src/components/Mod/Signup.tsx b/apps/web/src/components/Mod/Signup.tsx index 3d8c229e9..1501f015c 100644 --- a/apps/web/src/components/Mod/Signup.tsx +++ b/apps/web/src/components/Mod/Signup.tsx @@ -5,9 +5,11 @@ import { import { LENS_PERMISSIONLESS_CREATOR_ADDRESS, POLYGON_CHAIN_ID, - TAPE_SIGNUP_PROXY_ADDRESS + TAPE_SIGNUP_PROXY_ADDRESS, + ZERO_ADDRESS } from '@tape.xyz/constants' -import { Button } from '@tape.xyz/ui' +import { useGenerateLensApiRelayAddressQuery } from '@tape.xyz/lens' +import { Button, Input } from '@tape.xyz/ui' import React, { useState } from 'react' import toast from 'react-hot-toast' import type { Address } from 'viem' @@ -24,6 +26,12 @@ const RELAYER_ADDRESSES = [ const Signup = () => { const [loading, setLoading] = useState(false) + const [newMint, setNewMint] = useState({ handle: '', address: '' }) + + const { data: relayerAddressData } = useGenerateLensApiRelayAddressQuery({ + fetchPolicy: 'no-cache' + }) + const delegatedExecutor = relayerAddressData?.generateLensAPIRelayAddress const { data } = useReadContract({ abi: LENS_PERMISSIONLESS_CREATOR_ABI, @@ -57,10 +65,10 @@ const Signup = () => { const balance = contractBalance && parseFloat(formatUnits(contractBalance.value, 18)) - const { writeContractAsync } = useWriteContract({ + const { writeContractAsync, isPending } = useWriteContract({ mutation: { onSuccess: () => { - toast.success('Funds withdrawn') + toast.success('Write contract successful!') setLoading(false) }, onError: (error) => { @@ -81,6 +89,21 @@ const Signup = () => { } catch {} } + const mintForUser = async () => { + try { + await writeContractAsync({ + abi: TAPE_SIGNUP_PROXY_ABI, + address: TAPE_SIGNUP_PROXY_ADDRESS, + args: [ + [newMint.address, ZERO_ADDRESS, '0x'], + newMint.handle, + [delegatedExecutor] + ], + functionName: 'createProfileWithHandle' + }) + } catch {} + } + return (
    @@ -102,6 +125,32 @@ const Signup = () => { ))}
+
+

Mint for user

+
+ + setNewMint({ ...newMint, address: e.target.value }) + } + /> + setNewMint({ ...newMint, handle: e.target.value })} + /> + +
+
) } diff --git a/yarn.lock b/yarn.lock index 3853f789f..537a74088 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13112,10 +13112,10 @@ hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.1, hoist-non-react- dependencies: react-is "^16.7.0" -hono@^4.0.6: - version "4.0.6" - resolved "https://registry.yarnpkg.com/hono/-/hono-4.0.6.tgz#3c7b0e3b8c47f2c910a77aaa3727c5894c1c4f41" - integrity sha512-yL8Dp4mNscQj3zqMsmuHRoDoJlbP/3Jjz5HrIcd8a7MEWDr/O8oPgEQx2saVG+NX8mgEeEDQOuG2cgXCc9VuoA== +hono@^4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/hono/-/hono-4.0.7.tgz#55ffe7212e5634380fc942958932451d2b75715b" + integrity sha512-1fhi9MUzMIXWqPWA7OGPTpzjQupT78rf+U6N+2vxwy7U76jUX0dmkUtp572gR+dbGR1YugLYvyg/JrgPOSoutw== hosted-git-info@^2.1.4: version "2.8.9"