From dcd572c6765dfc44c1730704b10b7d98d7c9cc72 Mon Sep 17 00:00:00 2001 From: Joaquim Verges Date: Sun, 13 Oct 2024 20:42:13 +1300 Subject: [PATCH] feat: expose auth options on useConnectModal --- .changeset/blue-seahorses-compare.md | 5 +++++ .../react/web/ui/ConnectWallet/useConnectModal.tsx | 11 +++++++++++ 2 files changed, 16 insertions(+) create mode 100644 .changeset/blue-seahorses-compare.md diff --git a/.changeset/blue-seahorses-compare.md b/.changeset/blue-seahorses-compare.md new file mode 100644 index 00000000000..06cf163fc9b --- /dev/null +++ b/.changeset/blue-seahorses-compare.md @@ -0,0 +1,5 @@ +--- +"thirdweb": patch +--- + +Expose auth options on `useConnectModal` diff --git a/packages/thirdweb/src/react/web/ui/ConnectWallet/useConnectModal.tsx b/packages/thirdweb/src/react/web/ui/ConnectWallet/useConnectModal.tsx index d680206da58..3563f93595c 100644 --- a/packages/thirdweb/src/react/web/ui/ConnectWallet/useConnectModal.tsx +++ b/packages/thirdweb/src/react/web/ui/ConnectWallet/useConnectModal.tsx @@ -5,6 +5,7 @@ import type { Wallet } from "../../../../wallets/interfaces/wallet.js"; import type { SmartWalletOptions } from "../../../../wallets/smart/types.js"; import type { AppMetadata } from "../../../../wallets/types.js"; import type { Theme } from "../../../core/design-system/index.js"; +import type { SiweAuthOptions } from "../../../core/hooks/auth/useSiweAuth.js"; import { SetRootElementContext } from "../../../core/providers/RootElementContext.js"; import { WalletUIStatesProvider } from "../../providers/wallet-ui-states-provider.js"; import { canFitWideModal } from "../../utils/canFitWideModal.js"; @@ -432,4 +433,14 @@ export type UseConnectModalOptions = { * If you want to hide the branding, set this prop to `false` */ showThirdwebBranding?: boolean; + + /** + * Enable SIWE (Sign in with Ethererum) by passing an object of type `SiweAuthOptions` to + * enforce the users to sign a message after connecting their wallet to authenticate themselves. + * + * Refer to the [`SiweAuthOptions`](https://portal.thirdweb.com/references/typescript/v5/SiweAuthOptions) for more details + */ + auth?: SiweAuthOptions; }; + +// TODO: consilidate Button/Embed/Modal props into one type with extras