Skip to content

Commit

Permalink
Merge pull request #1320 from tapexyz/bump
Browse files Browse the repository at this point in the history
chore: bump deps
  • Loading branch information
sasicodes authored Feb 26, 2024
2 parents 2362a6a + 7db1576 commit 1dd7747
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 16 deletions.
2 changes: 1 addition & 1 deletion apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 7 additions & 7 deletions apps/web/src/components/Login/Signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -109,9 +109,11 @@ const Signup: FC<Props> = ({ showLogin, onSuccess, setShowSignup }) => {
})
}

const [generateRelayerAddress] = useGenerateLensApiRelayAddressLazyQuery({
const { data } = useGenerateLensApiRelayAddressQuery({
fetchPolicy: 'no-cache'
})
const delegatedExecutor = data?.generateLensAPIRelayAddress

const [checkAvailability, { loading: checkingAvailability }] =
useProfileLazyQuery()
const [checkIsProfileMinted] = useProfileLazyQuery({
Expand Down Expand Up @@ -195,7 +197,7 @@ const Signup: FC<Props> = ({ 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`
)
}

Expand All @@ -215,16 +217,14 @@ const Signup: FC<Props> = ({ 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())
})
Expand Down
57 changes: 53 additions & 4 deletions apps/web/src/components/Mod/Signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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,
Expand Down Expand Up @@ -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) => {
Expand All @@ -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 (
<div className="space-y-4 p-5">
<ul>
Expand All @@ -102,6 +125,32 @@ const Signup = () => {
))}
</ul>
</div>
<div>
<h2 className="mb-2 font-bold">Mint for user</h2>
<div className="flex space-x-2">
<Input
className="rounded-lg border border-gray-300 p-2"
placeholder="Address"
value={newMint.address}
onChange={(e) =>
setNewMint({ ...newMint, address: e.target.value })
}
/>
<Input
className="rounded-lg border border-gray-300 p-2"
placeholder="Handle"
value={newMint.handle}
onChange={(e) => setNewMint({ ...newMint, handle: e.target.value })}
/>
<Button
disabled={isPending}
loading={isPending}
onClick={() => mintForUser()}
>
Mint
</Button>
</div>
</div>
</div>
)
}
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 1dd7747

Please sign in to comment.