Skip to content

Commit

Permalink
updated auth options
Browse files Browse the repository at this point in the history
  • Loading branch information
SamueleA committed Nov 21, 2023
1 parent 6ff0abd commit f2e919c
Show file tree
Hide file tree
Showing 14 changed files with 159 additions and 116 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down
2 changes: 1 addition & 1 deletion examples/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:*",
Expand Down
20 changes: 19 additions & 1 deletion examples/react/src/components/Homepage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -168,6 +171,14 @@ function Homepage() {
)
}

const onSwitchNetwork = () => {
if (chainId === 1) {
switchNetwork(137)
} else {
switchNetwork(1)
}
}

return (
<Box background="backgroundPrimary">
{isDebugMode && (
Expand Down Expand Up @@ -205,6 +216,13 @@ function Homepage() {
onClick={generateEthAuthProof}
/>
)}
{isDebugMode && (
<ClickableCard
title="Switch network"
description="Switch network"
onClick={onSwitchNetwork}
/>
)}
</Box>
<Box width="full" gap="2" flexDirection="row" justifyContent="flex-end" >
<Button onClick={() => disconnect()} leftIcon={SignoutIcon} label="Sign out" />
Expand Down
10 changes: 5 additions & 5 deletions packages/checkout/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"0xsequence": "^1.4.4",
"@0xsequence/api": "^1.4.4",
"@0xsequence/indexer": "^1.4.4",
"@0xsequence/metadata": "^1.4.4",
"@0xsequence/network": "^1.4.4",
"0xsequence": "^1.4.5",
"@0xsequence/api": "^1.4.5",
"@0xsequence/indexer": "^1.4.5",
"@0xsequence/metadata": "^1.4.5",
"@0xsequence/network": "^1.4.5",
"@tanstack/react-query": "^4.29.5",
"react-copy-to-clipboard": "^5.1.0",
"@paperxyz/react-client-sdk": "^1.1.3"
Expand Down
4 changes: 2 additions & 2 deletions packages/connectors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@0xsequence/provider": "^1.4.4",
"@0xsequence/provider": "^1.4.5",
"@0xsequence/wagmi-connector": "^2.1.4"
},
"devDependencies": {
"@0xsequence/design-system": "^1.0.20",
"@0xsequence/kit": "workspace:*"
},
"peerDependencies": {
"0xsequence": ">=1.4.4",
"0xsequence": ">=1.4.5",
"ethers": ">=5.7.2",
"@0xsequence/design-system": ">=1.0.20",
"react": ">=17",
Expand Down
9 changes: 7 additions & 2 deletions packages/connectors/src/connectors/twitch/TwitchLogo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ import React from 'react'
import { Box } from '@0xsequence/design-system'

interface GetTwitchLogo {
isDarkMode: boolean
isDarkMode?: boolean
}

export const getTwitchLogo = ({ isDarkMode }: GetTwitchLogo) => {
const fillColor = isDarkMode ? 'white' : 'black'
let fillColor: string
if (isDarkMode === undefined) {
fillColor = '#9146FF'
} else {
fillColor = isDarkMode ? 'white' : 'black'
}

const TwitchLogo: React.FunctionComponent = ({...props}) => {
return (
Expand Down
4 changes: 2 additions & 2 deletions packages/connectors/src/connectors/twitch/twitch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export interface TwitchOptions {
export const twitch = ({ chains, options = {} }: TwitchOptions) => ({
id: 'twitch',
isSequenceBased: true,
logoDark: getTwitchLogo({ isDarkMode: true }),
logoLight: getTwitchLogo({ isDarkMode: false }),
logoDark: getTwitchLogo({}),
logoLight: getTwitchLogo({}),
miniLogoDark: getTwitchLogo({ isDarkMode: true }),
miniLogoLight: getTwitchLogo({ isDarkMode: false }),
// iconBackground: '#fff',
Expand Down
4 changes: 2 additions & 2 deletions packages/kit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,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: [
Expand Down
16 changes: 8 additions & 8 deletions packages/kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@0xsequence/auth": "^1.4.4",
"@0xsequence/api": "^1.4.4",
"@0xsequence/indexer": "^1.4.4",
"@0xsequence/metadata": "^1.4.4",
"@0xsequence/network": "^1.4.4",
"@0xsequence/auth": "^1.4.5",
"@0xsequence/api": "^1.4.5",
"@0xsequence/indexer": "^1.4.5",
"@0xsequence/metadata": "^1.4.5",
"@0xsequence/network": "^1.4.5",
"@0xsequence/design-system": "^1.0.20",
"@0xsequence/ethauth": "^0.8.1",
"@0xsequence/kit-connectors": "workspace:*",
"@0xsequence/utils": "1.4.4",
"@0xsequence/utils": "1.4.5",
"@0xsequence/wagmi-connector": "^2.1.4",
"@vanilla-extract/css": "^1.9.3",
"@vanilla-extract/recipes": "^0.3.0",
"framer-motion": "^8.5.2"
},
"peerDependencies": {
"0xsequence": ">=1.4.4",
"0xsequence": ">=1.4.5",
"ethers": ">=5.7.2",
"react": ">=17",
"react-dom": ">=17",
Expand All @@ -42,7 +42,7 @@
},
"devDependencies": {
"ethers": "5.7.2",
"0xsequence": "^1.4.4",
"0xsequence": "^1.4.5",
"viem": "1.10.7",
"wagmi": "1.3.9"
},
Expand Down
Loading

0 comments on commit f2e919c

Please sign in to comment.