From e099ef525439eaf198d5e23971f05a81bdd0df73 Mon Sep 17 00:00:00 2001 From: gregfromstl Date: Tue, 11 Jun 2024 08:39:55 -0700 Subject: [PATCH] [SDK] Add refetchInterval and retry options to useReadContract hook --- .changeset/dry-roses-cross.md | 5 +++++ .../src/react/core/hooks/contract/useReadContract.ts | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 .changeset/dry-roses-cross.md diff --git a/.changeset/dry-roses-cross.md b/.changeset/dry-roses-cross.md new file mode 100644 index 00000000000..d7ce816edf8 --- /dev/null +++ b/.changeset/dry-roses-cross.md @@ -0,0 +1,5 @@ +--- +"thirdweb": minor +--- + +Adds options refetchInterval and retry params to useReadContract diff --git a/packages/thirdweb/src/react/core/hooks/contract/useReadContract.ts b/packages/thirdweb/src/react/core/hooks/contract/useReadContract.ts index 3c6cee6ba9b..4727e6f5356 100644 --- a/packages/thirdweb/src/react/core/hooks/contract/useReadContract.ts +++ b/packages/thirdweb/src/react/core/hooks/contract/useReadContract.ts @@ -18,8 +18,14 @@ import type { import type { PreparedMethod } from "../../../../utils/abi/prepare-method.js"; import { getFunctionId } from "../../../../utils/function-id.js"; import { stringify } from "../../../../utils/json.js"; +import type { Prettify } from "../../../../utils/type-utils.js"; -type PickedQueryOptions = Pick; +type PickedQueryOptions = Prettify< + Pick & { + refetchInterval?: number; + retry?: number; + } +>; /** * A hook to read from a contract.