Skip to content

Commit

Permalink
fix: 4.2.0 bug fixes (#2234)
Browse files Browse the repository at this point in the history
Co-authored-by: Enes <enesozturk.d@gmail.com>
Co-authored-by: Sven <38101365+svenvoskamp@users.noreply.github.com>
Co-authored-by: Sven <fr.sven.fr@gmail.com>
  • Loading branch information
4 people committed May 14, 2024
1 parent 4ad71be commit 45a8d41
Show file tree
Hide file tree
Showing 110 changed files with 5,077 additions and 6,408 deletions.
29 changes: 29 additions & 0 deletions apps/demo/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
# @apps/demo

## 4.2.0-alpha.0

### Patch Changes

- feat: 4.2.0-alpha release

- Updated dependencies []:
- @web3modal/wagmi@4.2.0-alpha.0

## 4.2.0-03e4f4a8.2

### Patch Changes

- fix: Issue with SIWE + Wagmi sign out. Fixes issue where signature verification fail resulted in empty open modal'

- Updated dependencies []:
- @web3modal/wagmi@4.2.0-03e4f4a8.2

## 4.2.0-448f7f4.1

### Minor Changes

- refactor: improvements to all features (siwe, send, swaps, ui and ux)

### Patch Changes

- Updated dependencies []:
- @web3modal/wagmi@4.2.0-448f7f4.1

## 4.1.12-910a844.0

### Patch Changes
Expand Down
8 changes: 4 additions & 4 deletions apps/demo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@apps/demo",
"version": "4.1.12-910a844.0",
"version": "4.2.0-alpha.0",
"private": true,
"scripts": {
"dev:demo": "next dev",
Expand All @@ -11,7 +11,7 @@
"dependencies": {
"@radix-ui/react-switch": "1.0.3",
"@tanstack/react-query": "5.24.8",
"@web3modal/wagmi": "4.1.12-910a844.0",
"@web3modal/wagmi": "4.2.0-alpha.0",
"clsx": "2.1.0",
"framer-motion": "11.0.8",
"next": "14.1.1",
Expand All @@ -20,8 +20,8 @@
"sonner": "1.4.3",
"tailwind-merge": "2.2.1",
"vaul": "0.9.0",
"viem": "2.7.19",
"wagmi": "2.5.19",
"viem": "2.10.3",
"wagmi": "2.8.7",
"zustand": "4.5.2"
},
"devDependencies": {
Expand Down
32 changes: 32 additions & 0 deletions apps/gallery/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# @apps/gallery

## 4.2.0-alpha.0

### Patch Changes

- feat: 4.2.0-alpha release

- Updated dependencies []:
- @web3modal/common@4.2.0-alpha.0
- @web3modal/ui@4.2.0-alpha.0

## 4.2.0-03e4f4a8.2

### Patch Changes

- fix: Issue with SIWE + Wagmi sign out. Fixes issue where signature verification fail resulted in empty open modal'

- Updated dependencies []:
- @web3modal/common@4.2.0-03e4f4a8.2
- @web3modal/ui@4.2.0-03e4f4a8.2

## 4.2.0-448f7f4.1

### Minor Changes

- refactor: improvements to all features (siwe, send, swaps, ui and ux)

### Patch Changes

- Updated dependencies []:
- @web3modal/common@4.2.0-448f7f4.1
- @web3modal/ui@4.2.0-448f7f4.1

## 4.1.12-910a844.0

### Patch Changes
Expand Down
6 changes: 3 additions & 3 deletions apps/gallery/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@apps/gallery",
"version": "4.1.12-910a844.0",
"version": "4.2.0-alpha.0",
"private": true,
"main": "index.js",
"scripts": {
Expand All @@ -9,8 +9,8 @@
"lint": "eslint . --ext .js,.jsx,.ts,.tsx"
},
"dependencies": {
"@web3modal/common": "4.1.12-910a844.0",
"@web3modal/ui": "4.1.12-910a844.0",
"@web3modal/common": "4.2.0-alpha.0",
"@web3modal/ui": "4.2.0-alpha.0",
"lit": "3.1.0",
"storybook": "7.6.7"
},
Expand Down
38 changes: 38 additions & 0 deletions apps/laboratory/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,43 @@
# @apps/laboratory

## 4.2.0-alpha.0

### Patch Changes

- feat: 4.2.0-alpha release

- Updated dependencies []:
- @web3modal/ethers@4.2.0-alpha.0
- @web3modal/solana@4.2.0-alpha.0
- @web3modal/wagmi@4.2.0-alpha.0
- @web3modal/siwe@4.2.0-alpha.0

## 4.2.0-03e4f4a8.2

### Patch Changes

- fix: Issue with SIWE + Wagmi sign out. Fixes issue where signature verification fail resulted in empty open modal'

- Updated dependencies []:
- @web3modal/ethers@4.2.0-03e4f4a8.2
- @web3modal/solana@4.2.0-03e4f4a8.2
- @web3modal/wagmi@4.2.0-03e4f4a8.2
- @web3modal/siwe@4.2.0-03e4f4a8.2

## 4.2.0-448f7f4.1

### Minor Changes

- refactor: improvements to all features (siwe, send, swaps, ui and ux)

### Patch Changes

- Updated dependencies []:
- @web3modal/ethers@4.2.0-448f7f4.1
- @web3modal/wagmi@4.2.0-448f7f4.1
- @web3modal/siwe@4.2.0-448f7f4.1
- @web3modal/solana@4.2.0-448f7f4.1

## 4.1.12-910a844.0

### Patch Changes
Expand Down
17 changes: 10 additions & 7 deletions apps/laboratory/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@apps/laboratory",
"version": "4.1.12-910a844.0",
"version": "4.2.0-alpha.0",
"private": true,
"scripts": {
"dev:laboratory": "next dev",
Expand All @@ -14,13 +14,15 @@
"playwright:test:email": "playwright test --grep 'email.spec.ts'",
"playwright:test:siwe": "playwright test --grep siwe.spec.ts",
"playwright:test:siwe-email": "playwright test --grep siwe-email.spec.ts",
"playwright:test:siwe-sa": "playwright test --grep siwe-smart-account.spec.ts",
"playwright:test:sa": "playwright test --grep smart-account.spec.ts",
"playwright:test:canary": "playwright test --retries=0 --grep canary.spec.ts --project='Desktop Chrome/wagmi'",
"playwright:debug": "npm run playwright:test -- --debug",
"playwright:debug:wallet": "npm run playwright:test:wallet -- --debug",
"playwright:debug:email": "npm run playwright:test:email -- --debug",
"playwright:debug:siwe": "npm run playwright:test:siwe -- --debug",
"playwright:debug:siwe-email": "npm run playwright:test:siwe-email -- --debug",
"playwright:debug:siwe-sa": "npm run playwright:test:siwe-smart-account -- --debug",
"playwright:debug:sa": "npm run playwright:test:sa -- --debug",
"playwright:debug:canary": "npm run playwright:test:canary -- --debug"
},
Expand All @@ -33,19 +35,20 @@
"@sentry/react": "7.92.0",
"@solana/web3.js": "1.87.6",
"@tanstack/react-query": "5.24.8",
"@web3modal/ethers": "4.1.12-910a844.0",
"@web3modal/siwe": "4.1.12-910a844.0",
"@web3modal/solana": "4.1.12-910a844.0",
"@web3modal/wagmi": "4.1.12-910a844.0",
"@web3modal/ethers": "4.2.0-alpha.0",
"@web3modal/siwe": "4.2.0-alpha.0",
"@web3modal/solana": "4.2.0-alpha.0",
"@web3modal/wagmi": "4.2.0-alpha.0",
"ethers": "6.9.0",
"framer-motion": "10.17.9",
"next": "14.0.4",
"next-auth": "4.24.5",
"react-icons": "4.12.0",
"@walletconnect/utils": "2.12.0",
"valtio": "1.11.2",
"viem": "2.9.3",
"wagmi": "2.5.19"
"viem": "2.10.3",
"wagmi": "2.8.7",
"@wagmi/connectors": "4.3.9"
},
"devDependencies": {
"@aws-sdk/client-cloudwatch": "3.509.0",
Expand Down
16 changes: 8 additions & 8 deletions apps/laboratory/src/pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import type { NextApiRequest, NextApiResponse } from 'next'
import nextAuth from 'next-auth'
import credentialsProvider from 'next-auth/providers/credentials'
import {
type SIWESession,
verifySignature,
getChainIdFromMessage,
getAddressFromMessage
} from '@web3modal/siwe'
import { type SIWESession, getChainIdFromMessage, getAddressFromMessage } from '@web3modal/siwe'
import { verifySignature } from '../../../utils/SignatureUtil'

declare module 'next-auth' {
interface Session extends SIWESession {
Expand Down Expand Up @@ -51,8 +47,12 @@ export default async function auth(req: NextApiRequest, res: NextApiResponse) {
const { message, signature } = credentials
const address = getAddressFromMessage(message)
const chainId = getChainIdFromMessage(message)

const isValid = await verifySignature({ address, message, signature, chainId, projectId })
const isValid = await verifySignature({
address,
message,
signature,
chainId: Number(chainId.split(':')[1])
})

if (isValid) {
return {
Expand Down
2 changes: 1 addition & 1 deletion apps/laboratory/src/pages/library/ethers-siwe.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SiweData } from '../../components/Siwe/SiweData'
import { EthersTests } from '../../components/Ethers/EthersTests'
import { Web3ModalButtons } from '../../components/Web3ModalButtons'
import { createWeb3Modal, defaultConfig } from '@web3modal/ethers5/react'
import { createWeb3Modal, defaultConfig } from '@web3modal/ethers/react'
import { ThemeStore } from '../../utils/StoreUtil'
import { EthersConstants } from '../../utils/EthersConstants'
import { ConstantsUtil } from '../../utils/ConstantsUtil'
Expand Down
31 changes: 31 additions & 0 deletions apps/laboratory/src/utils/SignatureUtil.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { createPublicClient, http } from 'viem'

function getTransport({ chainId }: { chainId: number }) {
const RPC_URL = 'https://rpc.walletconnect.com'

return http(
`${RPC_URL}/v1/?chainId=eip155:${chainId}&projectId=${process.env['NEXT_PUBLIC_PROJECT_ID']}`
)
}

export async function verifySignature({
address,
message,
signature,
chainId
}: {
address: string
message: string
signature: string
chainId: number
}) {
const publicClient = createPublicClient({
transport: getTransport({ chainId })
})

return publicClient.verifyMessage({
message,
address: address as `0x${string}`,
signature: signature as `0x${string}`
})
}
9 changes: 6 additions & 3 deletions apps/laboratory/tests/shared/utils/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,17 @@ const customProjectProperties: CustomProjectProperties = {
useOptions: braveOptions
},
'Desktop Brave/wagmi': {
testIgnore: /(?:email\.spec\.ts|smart-account\.spec\.ts|siwe-email\.spec\.ts).*$/u,
testIgnore:
/(?:email\.spec\.ts|smart-account\.spec\.ts|siwe-email\.spec\.ts|siwe-smart-account\.spec\.ts).*$/u,
useOptions: braveOptions
},
'Desktop Chrome/wagmi': {
testIgnore: /(?:email\.spec\.ts|smart-account\.spec\.ts|siwe-email\.spec\.ts).*$/u
testIgnore:
/(?:email\.spec\.ts|smart-account\.spec\.ts|siwe-email\.spec\.ts|siwe-smart-account\.spec\.ts).*$/u
},
'Desktop Firefox/wagmi': {
testIgnore: /(?:email\.spec\.ts|smart-account\.spec\.ts|siwe-email\.spec\.ts).*$/u
testIgnore:
/(?:email\.spec\.ts|smart-account\.spec\.ts|siwe-email\.spec\.ts|siwe-smart-account\.spec\.ts).*$/u
},
// Exclude email.spec.ts, siwe.spec.ts, and canary.spec.ts from solana, not yet implemented
'Desktop Chrome/solana': {
Expand Down
20 changes: 5 additions & 15 deletions apps/laboratory/tests/shared/validators/ModalValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,7 @@ import { expect } from '@playwright/test'
import type { Page } from '@playwright/test'
import { ConstantsUtil } from '../../../src/utils/ConstantsUtil'
import { getMaximumWaitConnections } from '../utils/timeouts'
import { createPublicClient, http } from 'viem'

function getTransport({ chainId }: { chainId: number }) {
const RPC_URL = 'https://rpc.walletconnect.com'

return http(
`${RPC_URL}/v1/?chainId=eip155:${chainId}&projectId=${process.env['NEXT_PUBLIC_PROJECT_ID']}`
)
}
import { verifySignature } from '../../../src/utils/SignatureUtil'

const MAX_WAIT = getMaximumWaitConnections()

Expand Down Expand Up @@ -102,13 +94,11 @@ export class ModalValidator {
}

async expectValidSignature(signature: `0x${string}`, address: `0x${string}`, chainId: number) {
const publicClient = createPublicClient({
transport: getTransport({ chainId })
})
const isVerified = await publicClient.verifyMessage({
message: 'Hello Web3Modal!',
const isVerified = await verifySignature({
address,
signature
message: 'Hello Web3Modal!',
signature,
chainId
})

expect(isVerified).toBe(true)
Expand Down
2 changes: 1 addition & 1 deletion apps/laboratory/tests/siwe-email.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { testMEmailSiwe } from './shared/fixtures/w3m-email-fixture'
import type { ModalWalletPage } from './shared/pages/ModalWalletPage'
import { ModalWalletPage } from './shared/pages/ModalWalletPage'
import { ModalWalletValidator } from './shared/validators/ModalWalletValidator'

testMEmailSiwe.beforeEach(async ({ modalValidator }) => {
Expand Down
Loading

0 comments on commit 45a8d41

Please sign in to comment.