diff --git a/.eslintrc b/.eslintrc
index 227c74e690c..2cff0446f29 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -24,7 +24,8 @@
"@next/next/no-img-element": "off",
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
- "jsx-a11y/role-supports-aria-props": "off"
+ "jsx-a11y/role-supports-aria-props": "off",
+ "no-use-before-define" :"error"
},
"ignorePatterns": ["/src/generated/types.ts"]
}
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
index 4fb8ff13f38..41f5c28d35a 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.yml
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -1,27 +1,70 @@
name: "Bug Report"
-description: 'Report a reproducible bug in the Lenster'
-labels: 'needs review'
+description: "Report a reproducible bug in the Lenster"
+labels: "needs review"
body:
- type: markdown
attributes:
value: Thanks for taking the time to file a bug report! Please fill out this form as completely as possible.
- - type: markdown
+
+ - type: checkboxes
attributes:
- value: If you leave out sections there is a high likelihood your issue will be closed.
+ label: Is there an existing issue for this?
+ description: Please search to see if an issue already exists for the bug you encountered.
+ options:
+ - label: I have searched the existing issues
+ required: true
+
- type: textarea
attributes:
- label: Summary
- description: Describe the issue in 1 or 2 sentences
- placeholder: Clearly describe what the expected behavior is vs. what is actually happening.
+ label: Current Behavior
+ description: A concise description of what you're experiencing.
validations:
- required: true
+ required: false
+
+ - type: textarea
+ attributes:
+ label: Expected Behavior
+ description: A concise description of what you expected to happen.
+ validations:
+ required: false
+
+ - type: textarea
+ attributes:
+ label: Steps To Reproduce
+ description: Steps or code snippets to reproduce the behavior.
+ validations:
+ required: false
+
- type: dropdown
attributes:
label: What platform(s) does this occur on?
multiple: true
options:
- - Android
- - iOS
- Web
+ - Mobile
validations:
required: true
+
+ - type: dropdown
+ attributes:
+ label: What browser(s) does this occur on?
+ multiple: true
+ options:
+ - Chrome
+ - Firefox
+ - Brave
+ - Safari
+ - Edge
+ - Others
+ validations:
+ required: true
+
+ - type: textarea
+ attributes:
+ label: Anything else?
+ description: |
+ Screenshots? Anything that will give us more context about the issue you are encountering!
+
+ Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
+ validations:
+ required: false
diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml
new file mode 100644
index 00000000000..2864c0f407e
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.yml
@@ -0,0 +1,11 @@
+name: "Feature Request"
+description: "Request a feature for Lenster"
+labels: "needs review"
+body:
+ - type: textarea
+ attributes:
+ label: Summary
+ description: Describe the feature in 1 or 2 sentences
+ placeholder: Clearly describe what you want to see in Lenster.
+ validations:
+ required: true
diff --git a/cypress.config.ts b/cypress.config.ts
index c024f618fe4..df5751e92b4 100644
--- a/cypress.config.ts
+++ b/cypress.config.ts
@@ -13,5 +13,9 @@ export default defineConfig({
env: {
is_mainnet: process.env.NEXT_PUBLIC_IS_MAINNET === 'true'
},
- e2e: { setupNodeEvents() {} }
+ e2e: {
+ setupNodeEvents() {
+ //do nothing
+ }
+ }
})
diff --git a/package.json b/package.json
index 92ca959b363..9a5a7693ecb 100644
--- a/package.json
+++ b/package.json
@@ -21,11 +21,11 @@
"dependencies": {
"@apollo/client": "^3.6.9",
"@giphy/js-fetch-api": "^4.3.1",
- "@giphy/react-components": "^5.12.0",
+ "@giphy/react-components": "^5.13.0",
"@headlessui/react": "^1.6.6",
"@heroicons/react": "^1.0.6",
"@hookform/resolvers": "^2.9.6",
- "@sentry/nextjs": "^7.7.0",
+ "@sentry/nextjs": "^7.8.0",
"@tailwindcss/aspect-ratio": "^0.4.0",
"@tippyjs/react": "^4.2.6",
"@types/react-mentions": "^4.1.6",
@@ -56,19 +56,19 @@
"react-mentions": "4.4.7",
"use-streak": "^1.0.4",
"uuid": "^8.3.2",
- "wagmi": "^0.5.11",
+ "wagmi": "^0.6.0",
"zod": "^3.17.10",
"zustand": "^4.0.0"
},
"devDependencies": {
- "@graphql-codegen/cli": "^2.10.0",
+ "@graphql-codegen/cli": "^2.11.2",
"@graphql-codegen/fragment-matcher": "^3.3.0",
"@graphql-codegen/typescript": "^2.7.2",
"@tailwindcss/forms": "^0.5.2",
"@tailwindcss/line-clamp": "^0.4.0",
- "@types/node": "^18.0.6",
+ "@types/node": "^18.6.2",
"@types/react": "^18.0.15",
- "@types/react-copy-to-clipboard": "^5.0.3",
+ "@types/react-copy-to-clipboard": "^5.0.4",
"@types/react-dom": "^18.0.6",
"@types/ua-parser-js": "^0.7.36",
"@types/uuid": "^8.3.4",
diff --git a/src/components/Comment/NewComment/index.tsx b/src/components/Comment/NewComment/index.tsx
index 91686654d57..cf3a93a6b5f 100644
--- a/src/components/Comment/NewComment/index.tsx
+++ b/src/components/Comment/NewComment/index.tsx
@@ -41,7 +41,11 @@ import {
} from 'src/constants'
import { useAppPersistStore, useAppStore } from 'src/store/app'
import { v4 as uuid } from 'uuid'
-import { useContractWrite, useSignTypedData } from 'wagmi'
+import {
+ useContractWrite,
+ usePrepareContractWrite,
+ useSignTypedData
+} from 'wagmi'
const Attachment = dynamic(() => import('../../Shared/Attachment'), {
loading: () =>
@@ -137,15 +141,20 @@ const NewComment: FC = ({
setSelectedModule(defaultModuleData)
setFeeData(defaultFeeData)
}
+ const { config } = usePrepareContractWrite({
+ addressOrName: LENSHUB_PROXY,
+ contractInterface: LensHubProxy,
+ functionName: 'commentWithSig',
+ enabled: false
+ })
+
const {
data,
error,
isLoading: writeLoading,
write
} = useContractWrite({
- addressOrName: LENSHUB_PROXY,
- contractInterface: LensHubProxy,
- functionName: 'commentWithSig',
+ ...config,
onSuccess() {
onCompleted()
},
@@ -213,9 +222,10 @@ const NewComment: FC = ({
data: { broadcast: result }
} = await broadcast({ variables: { request: { id, signature } } })
- if ('reason' in result) write({ args: inputStruct })
+ if ('reason' in result)
+ write?.({ recklesslySetUnpreparedArgs: inputStruct })
} else {
- write({ args: inputStruct })
+ write?.({ recklesslySetUnpreparedArgs: inputStruct })
}
} catch (error) {
Logger.warn('[Sign Error]', error)
diff --git a/src/components/Community/Create.tsx b/src/components/Community/Create.tsx
index aab67748b4f..6e51933737a 100644
--- a/src/components/Community/Create.tsx
+++ b/src/components/Community/Create.tsx
@@ -34,7 +34,11 @@ import {
import Custom404 from 'src/pages/404'
import { useAppPersistStore, useAppStore } from 'src/store/app'
import { v4 as uuid } from 'uuid'
-import { useContractWrite, useSignTypedData } from 'wagmi'
+import {
+ useContractWrite,
+ usePrepareContractWrite,
+ useSignTypedData
+} from 'wagmi'
import { object, string } from 'zod'
const newCommunitySchema = object({
@@ -59,14 +63,19 @@ const Create: NextPage = () => {
}
})
+ const { config } = usePrepareContractWrite({
+ addressOrName: LENSHUB_PROXY,
+ contractInterface: LensHubProxy,
+ functionName: 'postWithSig',
+ enabled: false
+ })
+
const {
data,
isLoading: writeLoading,
write
} = useContractWrite({
- addressOrName: LENSHUB_PROXY,
- contractInterface: LensHubProxy,
- functionName: 'postWithSig',
+ ...config,
onError(error: any) {
toast.error(error?.data?.message ?? error?.message)
}
@@ -142,9 +151,10 @@ const Create: NextPage = () => {
data: { broadcast: result }
} = await broadcast({ variables: { request: { id, signature } } })
- if ('reason' in result) write({ args: inputStruct })
+ if ('reason' in result)
+ write?.({ recklesslySetUnpreparedArgs: inputStruct })
} else {
- write({ args: inputStruct })
+ write?.({ recklesslySetUnpreparedArgs: inputStruct })
}
} catch (error) {
Logger.warn('[Sign Error]', error)
diff --git a/src/components/Community/Join.tsx b/src/components/Community/Join.tsx
index 6eea540bbd6..b37758aa8e6 100644
--- a/src/components/Community/Join.tsx
+++ b/src/components/Community/Join.tsx
@@ -19,7 +19,12 @@ import {
SIGN_WALLET
} from 'src/constants'
import { useAppPersistStore, useAppStore } from 'src/store/app'
-import { useAccount, useContractWrite, useSignTypedData } from 'wagmi'
+import {
+ useAccount,
+ useContractWrite,
+ usePrepareContractWrite,
+ useSignTypedData
+} from 'wagmi'
const CREATE_COLLECT_TYPED_DATA_MUTATION = gql`
mutation CreateCollectTypedData(
@@ -75,10 +80,15 @@ const Join: FC = ({ community, setJoined, showJoin = true }) => {
toast.success('Joined successfully!')
}
- const { isLoading: writeLoading, write } = useContractWrite({
+ const { config } = usePrepareContractWrite({
addressOrName: LENSHUB_PROXY,
contractInterface: LensHubProxy,
functionName: 'collectWithSig',
+ enabled: false
+ })
+
+ const { isLoading: writeLoading, write } = useContractWrite({
+ ...config,
onSuccess() {
onCompleted()
},
@@ -133,9 +143,10 @@ const Join: FC = ({ community, setJoined, showJoin = true }) => {
data: { broadcast: result }
} = await broadcast({ variables: { request: { id, signature } } })
- if ('reason' in result) write({ args: inputStruct })
+ if ('reason' in result)
+ write?.({ recklesslySetUnpreparedArgs: inputStruct })
} else {
- write({ args: inputStruct })
+ write?.({ recklesslySetUnpreparedArgs: inputStruct })
}
} catch (error) {
Logger.warn('[Sign Error]', error)
diff --git a/src/components/Crowdfund/Create.tsx b/src/components/Crowdfund/Create.tsx
index 2679523e470..4137d80d890 100644
--- a/src/components/Crowdfund/Create.tsx
+++ b/src/components/Crowdfund/Create.tsx
@@ -38,7 +38,11 @@ import {
import Custom404 from 'src/pages/404'
import { useAppPersistStore, useAppStore } from 'src/store/app'
import { v4 as uuid } from 'uuid'
-import { useContractWrite, useSignTypedData } from 'wagmi'
+import {
+ useContractWrite,
+ usePrepareContractWrite,
+ useSignTypedData
+} from 'wagmi'
import { object, string } from 'zod'
const MODULES_CURRENCY_QUERY = gql`
@@ -92,14 +96,19 @@ const Create: NextPage = () => {
}
})
+ const { config } = usePrepareContractWrite({
+ addressOrName: LENSHUB_PROXY,
+ contractInterface: LensHubProxy,
+ functionName: 'postWithSig',
+ enabled: false
+ })
+
const {
data,
isLoading: writeLoading,
write
} = useContractWrite({
- addressOrName: LENSHUB_PROXY,
- contractInterface: LensHubProxy,
- functionName: 'postWithSig',
+ ...config,
onError(error: any) {
toast.error(error?.data?.message ?? error?.message)
}
@@ -178,9 +187,10 @@ const Create: NextPage = () => {
data: { broadcast: result }
} = await broadcast({ variables: { request: { id, signature } } })
- if ('reason' in result) write({ args: inputStruct })
+ if ('reason' in result)
+ write?.({ recklesslySetUnpreparedArgs: inputStruct })
} else {
- write({ args: inputStruct })
+ write?.({ recklesslySetUnpreparedArgs: inputStruct })
}
} catch (error) {
Logger.warn('[Sign Error]', error)
diff --git a/src/components/Post/Actions/Collect/CollectModule.tsx b/src/components/Post/Actions/Collect/CollectModule.tsx
index 812363b793a..250a68b340d 100644
--- a/src/components/Post/Actions/Collect/CollectModule.tsx
+++ b/src/components/Post/Actions/Collect/CollectModule.tsx
@@ -51,6 +51,7 @@ import {
useAccount,
useBalance,
useContractWrite,
+ usePrepareContractWrite,
useSignTypedData
} from 'wagmi'
@@ -125,13 +126,23 @@ const CollectModule: FC = ({ count, setCount, post }) => {
const [revenue, setRevenue] = useState(0)
const [showCollectorsModal, setShowCollectorsModal] = useState(false)
const [allowed, setAllowed] = useState(true)
-
const { address } = useAccount()
const { isLoading: signLoading, signTypedDataAsync } = useSignTypedData({
onError(error) {
toast.error(error?.message)
}
})
+ const { data, loading } = useQuery(COLLECT_QUERY, {
+ variables: { request: { publicationId: post?.pubId ?? post?.id } },
+ onCompleted() {
+ Logger.log(
+ '[Query]',
+ `Fetched collect module details Publication:${post?.pubId ?? post?.id}`
+ )
+ }
+ })
+
+ const collectModule: any = data?.publication?.collectModule
const onCompleted = () => {
setRevenue(revenue + parseFloat(collectModule?.amount?.value))
@@ -139,14 +150,19 @@ const CollectModule: FC = ({ count, setCount, post }) => {
toast.success('Transaction submitted successfully!')
}
+ const { config } = usePrepareContractWrite({
+ addressOrName: LENSHUB_PROXY,
+ contractInterface: LensHubProxy,
+ functionName: 'collectWithSig',
+ enabled: false
+ })
+
const {
data: writeData,
isLoading: writeLoading,
write
} = useContractWrite({
- addressOrName: LENSHUB_PROXY,
- contractInterface: LensHubProxy,
- functionName: 'collectWithSig',
+ ...config,
onSuccess() {
onCompleted()
},
@@ -155,17 +171,6 @@ const CollectModule: FC = ({ count, setCount, post }) => {
}
})
- const { data, loading } = useQuery(COLLECT_QUERY, {
- variables: { request: { publicationId: post?.pubId ?? post?.id } },
- onCompleted() {
- Logger.log(
- '[Query]',
- `Fetched collect module details Publication:${post?.pubId ?? post?.id}`
- )
- }
- })
-
- const collectModule: any = data?.publication?.collectModule
const percentageCollected =
(count / parseInt(collectModule?.collectLimit)) * 100
@@ -279,9 +284,10 @@ const CollectModule: FC = ({ count, setCount, post }) => {
data: { broadcast: result }
} = await broadcast({ variables: { request: { id, signature } } })
- if ('reason' in result) write({ args: inputStruct })
+ if ('reason' in result)
+ write?.({ recklesslySetUnpreparedArgs: inputStruct })
} else {
- write({ args: inputStruct })
+ write?.({ recklesslySetUnpreparedArgs: inputStruct })
}
} catch (error) {
Logger.warn('[Sign Error]', error)
diff --git a/src/components/Post/Actions/Mirror.tsx b/src/components/Post/Actions/Mirror.tsx
index f640234f043..f8b5695c498 100644
--- a/src/components/Post/Actions/Mirror.tsx
+++ b/src/components/Post/Actions/Mirror.tsx
@@ -23,7 +23,11 @@ import {
SIGN_WALLET
} from 'src/constants'
import { useAppPersistStore, useAppStore } from 'src/store/app'
-import { useContractWrite, useSignTypedData } from 'wagmi'
+import {
+ useContractWrite,
+ usePrepareContractWrite,
+ useSignTypedData
+} from 'wagmi'
const CREATE_MIRROR_TYPED_DATA_MUTATION = gql`
mutation CreateMirrorTypedData(
@@ -96,10 +100,15 @@ const Mirror: FC = ({ post }) => {
toast.success('Post has been mirrored!')
}
- const { isLoading: writeLoading, write } = useContractWrite({
+ const { config } = usePrepareContractWrite({
addressOrName: LENSHUB_PROXY,
contractInterface: LensHubProxy,
functionName: 'mirrorWithSig',
+ enabled: false
+ })
+
+ const { isLoading: writeLoading, write } = useContractWrite({
+ ...config,
onSuccess() {
onCompleted()
},
@@ -163,9 +172,10 @@ const Mirror: FC = ({ post }) => {
data: { broadcast: result }
} = await broadcast({ variables: { request: { id, signature } } })
- if ('reason' in result) write({ args: inputStruct })
+ if ('reason' in result)
+ write?.({ recklesslySetUnpreparedArgs: inputStruct })
} else {
- write({ args: inputStruct })
+ write?.({ recklesslySetUnpreparedArgs: inputStruct })
}
} catch (error) {
Logger.warn('[Sign Error]', error)
diff --git a/src/components/Post/Crowdfund/Fund.tsx b/src/components/Post/Crowdfund/Fund.tsx
index 739819e642a..53be5eb2770 100644
--- a/src/components/Post/Crowdfund/Fund.tsx
+++ b/src/components/Post/Crowdfund/Fund.tsx
@@ -26,6 +26,7 @@ import {
useAccount,
useBalance,
useContractWrite,
+ usePrepareContractWrite,
useSignTypedData
} from 'wagmi'
@@ -123,14 +124,19 @@ const Fund: FC = ({ fund, collectModule, setRevenue, revenue }) => {
toast.success('Transaction submitted successfully!')
}
+ const { config } = usePrepareContractWrite({
+ addressOrName: LENSHUB_PROXY,
+ contractInterface: LensHubProxy,
+ functionName: 'collectWithSig',
+ enabled: false
+ })
+
const {
data: writeData,
isLoading: writeLoading,
write
} = useContractWrite({
- addressOrName: LENSHUB_PROXY,
- contractInterface: LensHubProxy,
- functionName: 'collectWithSig',
+ ...config,
onSuccess() {
onCompleted()
},
@@ -183,9 +189,10 @@ const Fund: FC = ({ fund, collectModule, setRevenue, revenue }) => {
data: { broadcast: result }
} = await broadcast({ variables: { request: { id, signature } } })
- if ('reason' in result) write({ args: inputStruct })
+ if ('reason' in result)
+ write?.({ recklesslySetUnpreparedArgs: inputStruct })
} else {
- write({ args: inputStruct })
+ write?.({ recklesslySetUnpreparedArgs: inputStruct })
}
} catch (error) {
Logger.warn('[Sign Error]', error)
diff --git a/src/components/Post/NewPost/index.tsx b/src/components/Post/NewPost/index.tsx
index c80305e449e..391a274bcee 100644
--- a/src/components/Post/NewPost/index.tsx
+++ b/src/components/Post/NewPost/index.tsx
@@ -37,7 +37,11 @@ import {
} from 'src/constants'
import { useAppPersistStore, useAppStore } from 'src/store/app'
import { v4 as uuid } from 'uuid'
-import { useContractWrite, useSignTypedData } from 'wagmi'
+import {
+ useContractWrite,
+ usePrepareContractWrite,
+ useSignTypedData
+} from 'wagmi'
const Attachment = dynamic(() => import('../../Shared/Attachment'), {
loading: () =>
@@ -127,15 +131,21 @@ const NewPost: FC = ({ setShowModal, hideCard = false }) => {
setSelectedModule(defaultModuleData)
setFeeData(defaultFeeData)
}
+
+ const { config } = usePrepareContractWrite({
+ addressOrName: LENSHUB_PROXY,
+ contractInterface: LensHubProxy,
+ functionName: 'postWithSig',
+ enabled: false
+ })
+
const {
data,
error,
isLoading: writeLoading,
write
} = useContractWrite({
- addressOrName: LENSHUB_PROXY,
- contractInterface: LensHubProxy,
- functionName: 'postWithSig',
+ ...config,
onSuccess() {
onCompleted()
},
@@ -197,9 +207,10 @@ const NewPost: FC = ({ setShowModal, hideCard = false }) => {
data: { broadcast: result }
} = await broadcast({ variables: { request: { id, signature } } })
- if ('reason' in result) write({ args: inputStruct })
+ if ('reason' in result)
+ write?.({ recklesslySetUnpreparedArgs: inputStruct })
} else {
- write({ args: inputStruct })
+ write?.({ recklesslySetUnpreparedArgs: inputStruct })
}
} catch (error) {
Logger.warn('[Sign Error]', error)
diff --git a/src/components/Settings/Account/SetProfile.tsx b/src/components/Settings/Account/SetProfile.tsx
index 4a43d153ac9..f77d783d9f2 100644
--- a/src/components/Settings/Account/SetProfile.tsx
+++ b/src/components/Settings/Account/SetProfile.tsx
@@ -24,7 +24,12 @@ import {
} from 'src/constants'
import Custom404 from 'src/pages/404'
import { useAppPersistStore, useAppStore } from 'src/store/app'
-import { useAccount, useContractWrite, useSignTypedData } from 'wagmi'
+import {
+ useAccount,
+ useContractWrite,
+ usePrepareContractWrite,
+ useSignTypedData
+} from 'wagmi'
const CREATE_SET_DEFAULT_PROFILE_DATA_MUTATION = gql`
mutation CreateSetDefaultProfileTypedData(
@@ -73,15 +78,20 @@ const SetProfile: FC = () => {
toast.success('Default profile updated successfully!')
}
+ const { config } = usePrepareContractWrite({
+ addressOrName: LENSHUB_PROXY,
+ contractInterface: LensHubProxy,
+ functionName: 'setDefaultProfileWithSig',
+ enabled: false
+ })
+
const {
data: writeData,
isLoading: writeLoading,
error,
write
} = useContractWrite({
- addressOrName: LENSHUB_PROXY,
- contractInterface: LensHubProxy,
- functionName: 'setDefaultProfileWithSig',
+ ...config,
onSuccess() {
onCompleted()
},
@@ -141,9 +151,10 @@ const SetProfile: FC = () => {
data: { broadcast: result }
} = await broadcast({ variables: { request: { id, signature } } })
- if ('reason' in result) write({ args: inputStruct })
+ if ('reason' in result)
+ write?.({ recklesslySetUnpreparedArgs: inputStruct })
} else {
- write({ args: inputStruct })
+ write?.({ recklesslySetUnpreparedArgs: inputStruct })
}
} catch (error) {
Logger.warn('[Sign Error]', error)
diff --git a/src/components/Settings/Account/SuperFollow.tsx b/src/components/Settings/Account/SuperFollow.tsx
index e8ccd09db00..8f5ce1c5352 100644
--- a/src/components/Settings/Account/SuperFollow.tsx
+++ b/src/components/Settings/Account/SuperFollow.tsx
@@ -27,7 +27,11 @@ import {
SIGN_WALLET
} from 'src/constants'
import { useAppPersistStore, useAppStore } from 'src/store/app'
-import { useContractWrite, useSignTypedData } from 'wagmi'
+import {
+ useContractWrite,
+ usePrepareContractWrite,
+ useSignTypedData
+} from 'wagmi'
import { object, string } from 'zod'
const newCrowdfundSchema = object({
@@ -107,14 +111,19 @@ const SuperFollow: FC = () => {
}
})
+ const { config } = usePrepareContractWrite({
+ addressOrName: LENSHUB_PROXY,
+ contractInterface: LensHubProxy,
+ functionName: 'setFollowModuleWithSig',
+ enabled: false
+ })
+
const {
data: writeData,
isLoading: writeLoading,
write
} = useContractWrite({
- addressOrName: LENSHUB_PROXY,
- contractInterface: LensHubProxy,
- functionName: 'setFollowModuleWithSig',
+ ...config,
onError(error: any) {
toast.error(error?.data?.message ?? error?.message)
}
@@ -168,9 +177,10 @@ const SuperFollow: FC = () => {
data: { broadcast: result }
} = await broadcast({ variables: { request: { id, signature } } })
- if ('reason' in result) write({ args: inputStruct })
+ if ('reason' in result)
+ write?.({ recklesslySetUnpreparedArgs: inputStruct })
} else {
- write({ args: inputStruct })
+ write?.({ recklesslySetUnpreparedArgs: inputStruct })
}
} catch (error) {
Logger.warn('[Sign Error]', error)
diff --git a/src/components/Settings/Allowance/Button.tsx b/src/components/Settings/Allowance/Button.tsx
index d588bd6895e..3484d580925 100644
--- a/src/components/Settings/Allowance/Button.tsx
+++ b/src/components/Settings/Allowance/Button.tsx
@@ -8,7 +8,11 @@ import { ExclamationIcon, MinusIcon, PlusIcon } from '@heroicons/react/outline'
import { getModule } from '@lib/getModule'
import React, { Dispatch, FC, useState } from 'react'
import toast from 'react-hot-toast'
-import { useSendTransaction, useWaitForTransaction } from 'wagmi'
+import {
+ usePrepareSendTransaction,
+ useSendTransaction,
+ useWaitForTransaction
+} from 'wagmi'
const GENERATE_ALLOWANCE_QUERY = gql`
query GenerateModuleCurrencyApprovalData(
@@ -40,15 +44,22 @@ const AllowanceButton: FC = ({
GENERATE_ALLOWANCE_QUERY
)
+ const { config } = usePrepareSendTransaction({
+ request: {}
+ })
+
const {
data: txData,
isLoading: transactionLoading,
sendTransaction
} = useSendTransaction({
+ ...config,
+ mode: 'recklesslyUnprepared',
onError(error: any) {
toast.error(error?.data?.message ?? error?.message)
}
})
+
const { isLoading: waitLoading } = useWaitForTransaction({
hash: txData?.hash,
onSuccess() {
@@ -76,8 +87,12 @@ const AllowanceButton: FC = ({
}
}).then((res) => {
const data = res?.data?.generateModuleCurrencyApprovalData
- sendTransaction({
- request: { from: data?.from, to: data?.to, data: data?.data }
+ sendTransaction?.({
+ recklesslySetUnpreparedRequest: {
+ from: data?.from,
+ to: data?.to,
+ data: data?.data
+ }
})
})
}
diff --git a/src/components/Settings/Delete/index.tsx b/src/components/Settings/Delete/index.tsx
index 26f5982738e..9e144e6bff5 100644
--- a/src/components/Settings/Delete/index.tsx
+++ b/src/components/Settings/Delete/index.tsx
@@ -22,7 +22,12 @@ import {
} from 'src/constants'
import Custom404 from 'src/pages/404'
import { useAppPersistStore, useAppStore } from 'src/store/app'
-import { useContractWrite, useDisconnect, useSignTypedData } from 'wagmi'
+import {
+ useContractWrite,
+ useDisconnect,
+ usePrepareContractWrite,
+ useSignTypedData
+} from 'wagmi'
import Sidebar from '../Sidebar'
@@ -84,10 +89,15 @@ const DeleteSettings: FC = () => {
location.href = '/'
}
- const { isLoading: writeLoading, write } = useContractWrite({
+ const { config } = usePrepareContractWrite({
addressOrName: LENSHUB_PROXY,
contractInterface: LensHubProxy,
functionName: 'burnWithSig',
+ enabled: false
+ })
+
+ const { isLoading: writeLoading, write } = useContractWrite({
+ ...config,
onSuccess() {
onCompleted()
},
@@ -118,7 +128,7 @@ const DeleteSettings: FC = () => {
const { v, r, s } = splitSignature(signature)
const sig = { v, r, s, deadline }
- write({ args: [tokenId, sig] })
+ write?.({ recklesslySetUnpreparedArgs: [tokenId, sig] })
} catch (error) {
Logger.warn('[Sign Error]', error)
}
diff --git a/src/components/Settings/Profile/NFTPicture.tsx b/src/components/Settings/Profile/NFTPicture.tsx
index 1fe680c6b3f..b1bbca2a496 100644
--- a/src/components/Settings/Profile/NFTPicture.tsx
+++ b/src/components/Settings/Profile/NFTPicture.tsx
@@ -31,6 +31,7 @@ import { useAppPersistStore, useAppStore } from 'src/store/app'
import {
chain,
useContractWrite,
+ usePrepareContractWrite,
useSignMessage,
useSignTypedData
} from 'wagmi'
@@ -113,15 +114,20 @@ const NFTPicture: FC = ({ profile }) => {
toast.success('Avatar updated successfully!')
}
+ const { config } = usePrepareContractWrite({
+ addressOrName: LENSHUB_PROXY,
+ contractInterface: LensHubProxy,
+ functionName: 'setProfileImageURIWithSig',
+ enabled: false
+ })
+
const {
data: writeData,
isLoading: writeLoading,
error,
write
} = useContractWrite({
- addressOrName: LENSHUB_PROXY,
- contractInterface: LensHubProxy,
- functionName: 'setProfileImageURIWithSig',
+ ...config,
onSuccess() {
onCompleted()
},
@@ -174,9 +180,10 @@ const NFTPicture: FC = ({ profile }) => {
data: { broadcast: result }
} = await broadcast({ variables: { request: { id, signature } } })
- if ('reason' in result) write({ args: inputStruct })
+ if ('reason' in result)
+ write?.({ recklesslySetUnpreparedArgs: inputStruct })
} else {
- write({ args: inputStruct })
+ write?.({ recklesslySetUnpreparedArgs: inputStruct })
}
} catch (error) {
Logger.warn('[Sign Error]', error)
diff --git a/src/components/Settings/Profile/Picture.tsx b/src/components/Settings/Profile/Picture.tsx
index 75070022a99..b64579cbd69 100644
--- a/src/components/Settings/Profile/Picture.tsx
+++ b/src/components/Settings/Profile/Picture.tsx
@@ -28,7 +28,11 @@ import {
SIGN_WALLET
} from 'src/constants'
import { useAppPersistStore, useAppStore } from 'src/store/app'
-import { useContractWrite, useSignTypedData } from 'wagmi'
+import {
+ useContractWrite,
+ usePrepareContractWrite,
+ useSignTypedData
+} from 'wagmi'
const CREATE_SET_PROFILE_IMAGE_URI_TYPED_DATA_MUTATION = gql`
mutation CreateSetProfileImageUriTypedData(
@@ -81,15 +85,20 @@ const Picture: FC = ({ profile }) => {
toast.success('Avatar updated successfully!')
}
+ const { config } = usePrepareContractWrite({
+ addressOrName: LENSHUB_PROXY,
+ contractInterface: LensHubProxy,
+ functionName: 'setProfileImageURIWithSig',
+ enabled: false
+ })
+
const {
data: writeData,
isLoading: writeLoading,
error,
write
} = useContractWrite({
- addressOrName: LENSHUB_PROXY,
- contractInterface: LensHubProxy,
- functionName: 'setProfileImageURIWithSig',
+ ...config,
onSuccess() {
onCompleted()
},
@@ -144,9 +153,10 @@ const Picture: FC = ({ profile }) => {
data: { broadcast: result }
} = await broadcast({ variables: { request: { id, signature } } })
- if ('reason' in result) write({ args: inputStruct })
+ if ('reason' in result)
+ write?.({ recklesslySetUnpreparedArgs: inputStruct })
} else {
- write({ args: inputStruct })
+ write?.({ recklesslySetUnpreparedArgs: inputStruct })
}
} catch (error) {
Logger.warn('[Sign Error]', error)
diff --git a/src/components/Settings/Profile/Profile.tsx b/src/components/Settings/Profile/Profile.tsx
index 3898b50269f..29169e14654 100644
--- a/src/components/Settings/Profile/Profile.tsx
+++ b/src/components/Settings/Profile/Profile.tsx
@@ -38,7 +38,11 @@ import {
} from 'src/constants'
import { useAppPersistStore, useAppStore } from 'src/store/app'
import { v4 as uuid } from 'uuid'
-import { useContractWrite, useSignTypedData } from 'wagmi'
+import {
+ useContractWrite,
+ usePrepareContractWrite,
+ useSignTypedData
+} from 'wagmi'
import { object, optional, string } from 'zod'
const CREATE_SET_PROFILE_METADATA_TYPED_DATA_MUTATION = gql`
@@ -112,15 +116,20 @@ const Profile: FC = ({ profile }) => {
toast.success('Profile updated successfully!')
}
+ const { config } = usePrepareContractWrite({
+ addressOrName: LENS_PERIPHERY,
+ contractInterface: LensPeriphery,
+ functionName: 'setProfileMetadataURIWithSig',
+ enabled: false
+ })
+
const {
data: writeData,
isLoading: writeLoading,
error,
write
} = useContractWrite({
- addressOrName: LENS_PERIPHERY,
- contractInterface: LensPeriphery,
- functionName: 'setProfileMetadataURIWithSig',
+ ...config,
onSuccess() {
onCompleted()
},
@@ -171,9 +180,10 @@ const Profile: FC = ({ profile }) => {
data: { broadcast: result }
} = await broadcast({ variables: { request: { id, signature } } })
- if ('reason' in result) write({ args: inputStruct })
+ if ('reason' in result)
+ write?.({ recklesslySetUnpreparedArgs: inputStruct })
} else {
- write({ args: inputStruct })
+ write?.({ recklesslySetUnpreparedArgs: inputStruct })
}
} catch (error) {
Logger.warn('[Sign Error]', error)
diff --git a/src/components/Shared/Attachment.tsx b/src/components/Shared/Attachment.tsx
index d0ac3eba6a0..c61ea48d782 100644
--- a/src/components/Shared/Attachment.tsx
+++ b/src/components/Shared/Attachment.tsx
@@ -44,7 +44,10 @@ const Attachment: FC = ({ attachments, setAttachments }) => {
setLoading(true)
try {
- if (hasVideos(evt.target.files) || evt.target.files!.length > 4) {
+ if (
+ evt.target.files &&
+ (hasVideos(evt.target.files) || evt.target.files.length > 4)
+ ) {
toast.error('Please choose either 1 video or up to 4 photos.')
} else {
const attachment = await uploadAssetsToIPFS(evt.target.files)
diff --git a/src/components/Shared/Follow.tsx b/src/components/Shared/Follow.tsx
index 866fbeb6ec7..7bb9e8fd9c0 100644
--- a/src/components/Shared/Follow.tsx
+++ b/src/components/Shared/Follow.tsx
@@ -18,7 +18,12 @@ import {
RELAY_ON
} from 'src/constants'
import { useAppPersistStore, useAppStore } from 'src/store/app'
-import { useAccount, useContractWrite, useSignTypedData } from 'wagmi'
+import {
+ useAccount,
+ useContractWrite,
+ usePrepareContractWrite,
+ useSignTypedData
+} from 'wagmi'
const CREATE_FOLLOW_TYPED_DATA_MUTATION = gql`
mutation CreateFollowTypedData(
@@ -84,10 +89,15 @@ const Follow: FC = ({
toast.success('Followed successfully!')
}
- const { isLoading: writeLoading, write } = useContractWrite({
+ const { config } = usePrepareContractWrite({
addressOrName: LENSHUB_PROXY,
contractInterface: LensHubProxy,
functionName: 'followWithSig',
+ enabled: false
+ })
+
+ const { isLoading: writeLoading, write } = useContractWrite({
+ ...config,
onSuccess() {
onCompleted()
},
@@ -141,9 +151,10 @@ const Follow: FC = ({
data: { broadcast: result }
} = await broadcast({ variables: { request: { id, signature } } })
- if ('reason' in result) write({ args: inputStruct })
+ if ('reason' in result)
+ write?.({ recklesslySetUnpreparedArgs: inputStruct })
} else {
- write({ args: inputStruct })
+ write?.({ recklesslySetUnpreparedArgs: inputStruct })
}
} catch (error) {
Logger.warn('[Sign Error]', error)
diff --git a/src/components/Shared/Navbar/Search.tsx b/src/components/Shared/Navbar/Search.tsx
index 6dfca1d9012..01fb73d7cce 100644
--- a/src/components/Shared/Navbar/Search.tsx
+++ b/src/components/Shared/Navbar/Search.tsx
@@ -26,10 +26,10 @@ export const SEARCH_USERS_QUERY = gql`
`
interface Props {
- hideDrodown?: boolean
+ hideDropdown?: boolean
}
-const Search: FC = ({ hideDrodown = false }) => {
+const Search: FC = ({ hideDropdown = false }) => {
const { push, pathname, query } = useRouter()
const [searchText, setSearchText] = useState('')
const dropdownRef = useRef(null)
@@ -49,7 +49,7 @@ const Search: FC = ({ hideDrodown = false }) => {
const handleSearch = (evt: ChangeEvent) => {
const keyword = evt.target.value
setSearchText(keyword)
- if (pathname !== '/search' && !hideDrodown) {
+ if (pathname !== '/search' && !hideDropdown) {
searchUsers({
variables: { request: { type: 'PROFILE', query: keyword, limit: 8 } }
})
@@ -79,7 +79,7 @@ const Search: FC = ({ hideDrodown = false }) => {
/>
- {pathname !== '/search' && !hideDrodown && searchText.length > 0 && (
+ {pathname !== '/search' && !hideDropdown && searchText.length > 0 && (
{
diff --git a/src/components/Shared/SelectCollectModule/FeeEntry.tsx b/src/components/Shared/SelectCollectModule/FeeEntry.tsx
index 205b74228fd..0b3f269d2c7 100644
--- a/src/components/Shared/SelectCollectModule/FeeEntry.tsx
+++ b/src/components/Shared/SelectCollectModule/FeeEntry.tsx
@@ -71,7 +71,13 @@ const FeeEntry: FC = ({
Back
-