Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V3 / ethers preview #1363

Merged
merged 69 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
c9db2a3
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Aug 8, 2023
797a677
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Aug 15, 2023
5bb31c4
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Aug 15, 2023
9d7d7fb
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Aug 16, 2023
e4751ef
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Aug 16, 2023
c283ab2
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Aug 21, 2023
035cfef
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Aug 23, 2023
44b0366
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Aug 23, 2023
f00815b
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Aug 25, 2023
482e54e
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Aug 30, 2023
bf7059a
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Sep 4, 2023
362f940
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Sep 5, 2023
9b91647
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Sep 5, 2023
83fa048
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Sep 6, 2023
b35eb4b
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Sep 7, 2023
343d084
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Sep 7, 2023
54fca2f
Merge branch 'V3' of github.com:WalletConnect/web3modal into V3
svenvoskamp Sep 11, 2023
cd47bc9
support right fallback for color-mix
svenvoskamp Sep 11, 2023
33d39e5
merge
svenvoskamp Sep 26, 2023
2eb8129
wip
svenvoskamp Sep 27, 2023
649b7b3
merge v3 into branch
svenvoskamp Sep 27, 2023
92d66bc
add injected and wc provider, fetch balance, switch change, ens
svenvoskamp Sep 28, 2023
afb08d4
remove getCaipNetwork
svenvoskamp Sep 28, 2023
0e2f777
remove comment
svenvoskamp Sep 28, 2023
a44f59e
remove comment
svenvoskamp Sep 28, 2023
34657ad
remove Text
svenvoskamp Sep 28, 2023
26ff358
change modal export
svenvoskamp Sep 28, 2023
4d1161b
fix lint
svenvoskamp Sep 28, 2023
13ab1b6
disable theming for now
svenvoskamp Sep 29, 2023
c146677
fix wagmi page
svenvoskamp Sep 29, 2023
2a8d68e
remove unused code
svenvoskamp Sep 29, 2023
d0c79c9
several events added + cleanup ethers package
svenvoskamp Sep 29, 2023
96e47c8
wip
svenvoskamp Oct 4, 2023
64ce325
wip
svenvoskamp Oct 4, 2023
4143a77
add coinbase connector & fix other issues
svenvoskamp Oct 6, 2023
91785c4
fix type
svenvoskamp Oct 6, 2023
309bbc1
fix loose dependency
svenvoskamp Oct 6, 2023
2e9c569
add eip6963 provider
svenvoskamp Oct 10, 2023
fade4e7
add utils, scaffold-react & scaffold-vue package
svenvoskamp Oct 11, 2023
7f02713
remove vue runtime
svenvoskamp Oct 11, 2023
be23851
merge V3 into branch
svenvoskamp Oct 11, 2023
5c0f8d1
fix prettier and update dangerfile
svenvoskamp Oct 11, 2023
af87294
resolve feedback and make test ready
svenvoskamp Oct 13, 2023
d119018
create new canary
svenvoskamp Oct 13, 2023
89c8c02
resolving issues
svenvoskamp Oct 13, 2023
b8b169e
fix dangerfile
svenvoskamp Oct 13, 2023
255b15f
fix dangerfile
svenvoskamp Oct 13, 2023
fc5035a
fix dangerfile
svenvoskamp Oct 13, 2023
0623f48
fix dangerfile
svenvoskamp Oct 13, 2023
e4fde44
fix loose depedency
svenvoskamp Oct 13, 2023
2f8a23a
update canary
svenvoskamp Oct 13, 2023
f0cb78a
fix 404
svenvoskamp Oct 16, 2023
e9a666e
Resolve feedback
svenvoskamp Oct 16, 2023
398b55b
Resolve feedback
svenvoskamp Oct 16, 2023
aa6a174
Resolve feedback
svenvoskamp Oct 16, 2023
fd707ef
Resolve feedback
svenvoskamp Oct 16, 2023
d2a3096
fix build
svenvoskamp Oct 16, 2023
2d0c035
fix eip6963 issue
svenvoskamp Oct 17, 2023
5422a2b
change config, handle wc provider on client
svenvoskamp Oct 17, 2023
5f14b83
fix hooks issue, add ethers examples, remove eventlisteners when disc…
svenvoskamp Oct 18, 2023
632e736
fix hooks issue, add ethers examples, remove eventlisteners when disc…
svenvoskamp Oct 18, 2023
e34faf1
enable theming
svenvoskamp Oct 18, 2023
833004b
new canary
svenvoskamp Oct 18, 2023
04d4c72
update deps, add getters for html/vanillajs, add metadata
svenvoskamp Oct 19, 2023
f9b3ed8
update deps
svenvoskamp Oct 19, 2023
d19bfd4
updated examples, added coinbase properties
svenvoskamp Oct 19, 2023
5c9d4b0
missing wallets eip6963 fix
svenvoskamp Oct 19, 2023
d60ac69
resolve feedback
svenvoskamp Oct 20, 2023
7fefc6d
add option for connectorImages
svenvoskamp Oct 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions apps/gallery/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@apps/gallery",
"version": "3.1.0",
"version": "3.2.0-f9b3ed8",
"private": true,
"main": "index.js",
"scripts": {
Expand All @@ -9,17 +9,17 @@
"lint": "eslint . --ext .js,.jsx,.ts,.tsx"
},
"dependencies": {
"@web3modal/ui": "3.1.0",
"@web3modal/ui": "3.2.0-f9b3ed8",
"lit": "3.0.0",
"storybook": "7.4.6"
"storybook": "7.5.0"
},
"devDependencies": {
"@storybook/addon-essentials": "7.4.6",
"@storybook/addon-links": "7.4.6",
"@storybook/blocks": "7.4.6",
"@storybook/theming": "7.4.6",
"@storybook/web-components": "7.4.6",
"@storybook/web-components-vite": "7.4.6",
"@storybook/addon-essentials": "7.5.0",
"@storybook/addon-links": "7.5.0",
"@storybook/blocks": "7.5.0",
"@storybook/theming": "7.5.0",
"@storybook/web-components": "7.5.0",
"@storybook/web-components-vite": "7.5.0",
"file-system-cache": "2.4.4"
}
}
3 changes: 2 additions & 1 deletion apps/laboratory/next.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
output: 'export'
output: 'export',
trailingSlash: true
svenvoskamp marked this conversation as resolved.
Show resolved Hide resolved
}

module.exports = nextConfig
11 changes: 6 additions & 5 deletions apps/laboratory/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@apps/laboratory",
"version": "3.1.0",
"version": "3.2.0-f9b3ed8",
"private": true,
"scripts": {
"dev:laboratory": "next dev",
Expand All @@ -11,11 +11,12 @@
"@chakra-ui/react": "2.8.1",
"@emotion/react": "11.11.1",
"@emotion/styled": "11.11.0",
"@sentry/browser": "7.73.0",
"@sentry/react": "7.73.0",
"@web3modal/wagmi": "3.1.0",
"@sentry/browser": "7.74.1",
"@sentry/react": "7.74.1",
"@web3modal/ethers5": "3.2.0-f9b3ed8",
"@web3modal/wagmi": "3.2.0-f9b3ed8",
"framer-motion": "10.16.4",
"next": "13.5.4",
"next": "13.5.6",
"react-icons": "4.11.0",
"valtio": "1.11.2"
}
Expand Down
29 changes: 29 additions & 0 deletions apps/laboratory/src/components/Ethers/EthersConnectButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Button, useToast } from '@chakra-ui/react'
import { useWeb3ModalAccount, useWeb3ModalSigner } from '@web3modal/ethers5/react'

export function EthersConnectButton() {
const toast = useToast()
const { isConnected } = useWeb3ModalAccount()
const { signer } = useWeb3ModalSigner()

async function onSignMessage() {
try {
const signature = await signer?.signMessage('Hello Web3Modal Ethers')
toast({ title: 'Succcess', description: signature, status: 'success', isClosable: true })
} catch {
toast({
title: 'Error',
description: 'Failed to sign message',
status: 'error',
isClosable: true
})
}
}

return (
<>
<w3m-button />
{isConnected ? <Button onClick={() => onSignMessage()}>Sign Message</Button> : null}
</>
)
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Button, useToast } from '@chakra-ui/react'
import { useAccount, useSignMessage } from 'wagmi'

export function ConnectButton() {
export function WagmiConnectButton() {
const toast = useToast()
const { isConnected } = useAccount()
const { signMessageAsync } = useSignMessage({ message: 'Hello Web3Modal!' })
Expand Down
12 changes: 9 additions & 3 deletions apps/laboratory/src/layout/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
Flex,
Icon,
Link,
Text,
useColorMode,
useDisclosure
} from '@chakra-ui/react'
Expand All @@ -19,6 +18,7 @@ import { FaMagic } from 'react-icons/fa'
import AccentColorInput from '../components/Theming/AccentColorInput'
import BorderRadiusInput from '../components/Theming/BorderRadiusInput'
import MixColorInput from '../components/Theming/MixColorInput'
import NextLink from 'next/link'

export default function Header() {
const { colorMode, toggleColorMode } = useColorMode()
Expand Down Expand Up @@ -50,9 +50,15 @@ export default function Header() {
<Box borderBottom={'1px'} zIndex={2} position="relative">
<Container maxW="container.xl" padding={'4'}>
<Flex justify={['flex-end', 'space-between']} alignItems={'center'}>
<Text fontSize={'lg'} fontWeight={'bold'} display={['none', 'block']}>
<Link
as={NextLink}
href="/"
fontSize={'lg'}
fontWeight={'bold'}
display={['none', 'block']}
>
Web3Modal Lab
</Text>
</Link>
<Flex gridGap={4} alignItems={'center'}>
<Link isExternal href="https://github.com/WalletConnect/web3modal">
GitHub
Expand Down
108 changes: 26 additions & 82 deletions apps/laboratory/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,85 +1,29 @@
import { Center, VStack, useColorMode } from '@chakra-ui/react'
import { createWeb3Modal, defaultWagmiConfig, useWeb3ModalTheme } from '@web3modal/wagmi/react'
import { useEffect, useState } from 'react'
import { WagmiConfig } from 'wagmi'
import {
arbitrum,
aurora,
avalanche,
base,
bsc,
celo,
gnosis,
mainnet,
optimism,
polygon,
zkSync,
zora
} from 'wagmi/chains'
import { ConnectButton } from '../components/ConnectButton'
import { NetworksButton } from '../components/NetworksButton'

// 1. Get projectId
const projectId = process.env['NEXT_PUBLIC_PROJECT_ID']
if (!projectId) {
throw new Error('NEXT_PUBLIC_PROJECT_ID is not set')
}

// 2. Create wagmiConfig
const chains = [
mainnet,
arbitrum,
polygon,
avalanche,
bsc,
optimism,
gnosis,
zkSync,
zora,
base,
celo,
aurora
]
export const wagmiConfig = defaultWagmiConfig({
chains,
projectId,
metadata: {
name: 'Web3Modal',
description: 'Web3Modal Laboratory',
url: 'https://web3modal.com',
icons: ['https://avatars.githubusercontent.com/u/37784886']
}
})

// 3. Create Web3Modal
export const modal = createWeb3Modal({
wagmiConfig,
projectId,
chains,
enableAnalytics: true
})
import { Center, Link, VStack } from '@chakra-ui/react'
import NextLink from 'next/link'

export default function HomePage() {
const [ready, setReady] = useState(false)
const { colorMode } = useColorMode()
const { setThemeMode } = useWeb3ModalTheme()

useEffect(() => {
setReady(true)
}, [])

useEffect(() => {
setThemeMode(colorMode)
}, [colorMode])

return ready ? (
<WagmiConfig config={wagmiConfig}>
<Center h="80vh">
<VStack gap={4}>
<ConnectButton />
<NetworksButton />
</VStack>
</Center>
</WagmiConfig>
) : null
return (
<Center h="80vh">
<VStack gap={4}>
<Link
as={NextLink}
href="/library/wagmi"
padding={4}
border={'1px solid #47a1ff'}
borderRadius="xl"
>
V3 with Wagmi
</Link>
<Link
as={NextLink}
href="/library/ethers"
padding={4}
border={'1px solid #26D962'}
borderRadius="xl"
>
V3 with Ethers
</Link>
</VStack>
</Center>
)
}
47 changes: 47 additions & 0 deletions apps/laboratory/src/pages/library/ethers.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { Center, Text, VStack } from '@chakra-ui/react'
import { NetworksButton } from '../../components/NetworksButton'
import { EthersConnectButton } from '../../components/Ethers/EthersConnectButton'
import { createWeb3Modal, defaultConfig } from '@web3modal/ethers5/react'
import { ThemeStore } from '../../utils/StoreUtil'

const projectId = process.env['NEXT_PUBLIC_PROJECT_ID']
if (!projectId) {
throw new Error('NEXT_PUBLIC_PROJECT_ID is not set')
}
const chains = [1, 42161, 137, 43114, 56, 10, 100, 324, 7777777, 8453, 42220, 1313161554]

const modal = createWeb3Modal({
ethersConfig: defaultConfig({
metadata: {
name: 'Web3Modal',
description: 'Web3Modal Laboratory',
url: 'https://web3modal.com',
icons: ['https://avatars.githubusercontent.com/u/37784886']
},
defaultChainId: 1,
rpcUrl: 'https://cloudflare-eth.com'
}),
chains,
projectId,
enableAnalytics: true
})

ThemeStore.setModal(modal)

export default function Ethers() {
return (
<>
<Center paddingTop={10}>
<Text fontSize="xl" fontWeight={700}>
V3 with Ethers
</Text>
</Center>
<Center h="65vh">
<VStack gap={4}>
<EthersConnectButton />
<NetworksButton />
</VStack>
</Center>
</>
)
}
86 changes: 86 additions & 0 deletions apps/laboratory/src/pages/library/wagmi.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import { Center, Text, VStack } from '@chakra-ui/react'
import { createWeb3Modal, defaultWagmiConfig } from '@web3modal/wagmi/react'
import { useEffect, useState } from 'react'
import { WagmiConfig } from 'wagmi'
import {
arbitrum,
aurora,
avalanche,
base,
bsc,
celo,
gnosis,
mainnet,
optimism,
polygon,
zkSync,
zora
} from 'wagmi/chains'
import { WagmiConnectButton } from '../../components/Wagmi/WagmiConnectButton'
import { NetworksButton } from '../../components/NetworksButton'
import { ThemeStore } from '../../utils/StoreUtil'

// 1. Get projectId
const projectId = process.env['NEXT_PUBLIC_PROJECT_ID']
if (!projectId) {
throw new Error('NEXT_PUBLIC_PROJECT_ID is not set')
}

// 2. Create wagmiConfig
const chains = [
mainnet,
arbitrum,
polygon,
avalanche,
bsc,
optimism,
gnosis,
zkSync,
zora,
base,
celo,
aurora
]
export const wagmiConfig = defaultWagmiConfig({
chains,
projectId,
metadata: {
name: 'Web3Modal',
description: 'Web3Modal Laboratory',
url: 'https://web3modal.com',
icons: ['https://avatars.githubusercontent.com/u/37784886']
}
})

const modal = createWeb3Modal({
wagmiConfig,
projectId,
chains,
enableAnalytics: true
})

ThemeStore.setModal(modal)

export default function Wagmi() {
const [ready, setReady] = useState(false)

useEffect(() => {
setReady(true)
}, [])

return ready ? (
<WagmiConfig config={wagmiConfig}>
<Center paddingTop={10}>
<Text fontSize="xl" fontWeight={700}>
V3 with Wagmi
</Text>
</Center>
<Center h="65vh">
<VStack gap={4}>
<WagmiConnectButton />
<NetworksButton />
</VStack>
</Center>
</WagmiConfig>
) : null
}
Loading