From f2e919c7f78c4c9cd63b74f56c6825f65adb4782 Mon Sep 17 00:00:00 2001 From: samuelea Date: Tue, 21 Nov 2023 15:46:07 -0500 Subject: [PATCH] updated auth options --- README.md | 4 +- examples/react/package.json | 2 +- examples/react/src/components/Homepage.tsx | 20 ++- packages/checkout/package.json | 10 +- packages/connectors/package.json | 4 +- .../src/connectors/twitch/TwitchLogo.tsx | 9 +- .../src/connectors/twitch/twitch.ts | 4 +- packages/kit/README.md | 4 +- packages/kit/package.json | 16 +-- .../ConnectWalletContent/index.tsx | 133 +++++++++++------- .../kit/src/components/KitProvider/index.tsx | 4 +- .../kit/src/constants/defaultSignInOptions.ts | 4 +- packages/wallet/package.json | 10 +- pnpm-lock.yaml | 51 +++---- 14 files changed, 159 insertions(+), 116 deletions(-) diff --git a/README.md b/README.md index 68f0962b..9fa97fde 100644 --- a/README.md +++ b/README.md @@ -135,8 +135,8 @@ The settings are described in more detailed in the Sequence Kit documentation. logoUrl: 'https://logo-dark-mode.svg', projectName: 'my app', showEmailInput: true, - miniAuthOptions: ['google', 'facebook', 'twitch', 'apple'], - authOptions: ['metamask', 'wallet-connect'], + socialAuthOptions: ['google', 'facebook', 'twitch', 'apple'], + walletAuthOptions: ['metamask', 'wallet-connect'], }; // limits the digital assets displayed on the assets summary screen displayedAssets: [ diff --git a/examples/react/package.json b/examples/react/package.json index 4cfc1966..c87342e6 100644 --- a/examples/react/package.json +++ b/examples/react/package.json @@ -4,7 +4,7 @@ "private": true, "homepage": "kit", "dependencies": { - "0xsequence": "^1.4.4", + "0xsequence": "^1.4.5", "@0xsequence/design-system": "^1.0.20", "@0xsequence/kit": "workspace:*", "@0xsequence/kit-checkout": "workspace:*", diff --git a/examples/react/src/components/Homepage.tsx b/examples/react/src/components/Homepage.tsx index 4899cf19..fc6ccf2c 100644 --- a/examples/react/src/components/Homepage.tsx +++ b/examples/react/src/components/Homepage.tsx @@ -3,7 +3,7 @@ import qs from 'query-string' import { useOpenConnectModal, signEthAuthProof, validateEthProof, useTheme as useKitTheme } from '@0xsequence/kit' import { useOpenWalletModal } from '@0xsequence/kit-wallet' import { useCheckoutModal } from '@0xsequence/kit-checkout' -import { useDisconnect, useAccount, useWalletClient, usePublicClient } from 'wagmi' +import { useDisconnect, useAccount, useWalletClient, usePublicClient, useSwitchNetwork, useChainId } from 'wagmi' import { Box, Button, @@ -30,6 +30,9 @@ function Homepage() { const { triggerCheckout } = useCheckoutModal() const { disconnect } = useDisconnect() const { data: walletClient } = useWalletClient() + const { switchNetwork } = useSwitchNetwork() + const chainId = useChainId() + const publicClient = usePublicClient() // append ?debug=true to url to enable debug mode @@ -168,6 +171,14 @@ function Homepage() { ) } + const onSwitchNetwork = () => { + if (chainId === 1) { + switchNetwork(137) + } else { + switchNetwork(1) + } + } + return ( {isDebugMode && ( @@ -205,6 +216,13 @@ function Homepage() { onClick={generateEthAuthProof} /> )} + {isDebugMode && ( + + )}