Skip to content

Commit

Permalink
Merge branch 'V3' into fix/ethers-chains
Browse files Browse the repository at this point in the history
  • Loading branch information
svenvoskamp authored Dec 14, 2023
2 parents ff1b202 + 81edbe7 commit fff9cf8
Show file tree
Hide file tree
Showing 74 changed files with 1,871 additions and 1,672 deletions.
19 changes: 10 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.5.0-alpha.1",
"version": "3.5.0-6a05dc24",
"private": true,
"main": "index.js",
"scripts": {
Expand All @@ -9,17 +9,18 @@
"lint": "eslint . --ext .js,.jsx,.ts,.tsx"
},
"dependencies": {
"@web3modal/ui": "3.5.0-alpha.1",
"@web3modal/ui": "3.5.0-6a05dc24",
"@web3modal/common": "3.5.0-6a05dc24",
"lit": "3.1.0",
"storybook": "7.6.3"
"storybook": "7.6.4"
},
"devDependencies": {
"@storybook/addon-essentials": "7.6.3",
"@storybook/addon-links": "7.6.3",
"@storybook/blocks": "7.6.3",
"@storybook/theming": "7.6.3",
"@storybook/web-components": "7.6.3",
"@storybook/web-components-vite": "7.6.3",
"@storybook/addon-essentials": "7.6.4",
"@storybook/addon-links": "7.6.4",
"@storybook/blocks": "7.6.4",
"@storybook/theming": "7.6.4",
"@storybook/web-components": "7.6.4",
"@storybook/web-components-vite": "7.6.4",
"file-system-cache": "2.4.4"
}
}
7 changes: 4 additions & 3 deletions apps/gallery/utils/PresetUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ import type {
ThemeType,
TransactionType,
VisualType
} from '@web3modal/ui/src/utils/TypesUtil'
} from '@web3modal/ui/src/utils/TypeUtil'
import type { TransactionStatus, TransactionDirection } from '@web3modal/common'

export const colorOptions: ColorType[] = [
'accent-100',
Expand Down Expand Up @@ -263,9 +264,9 @@ export const transactionTypeOptions: TransactionType[] = [
'withdraw'
]

export const transactionDirectionOptions: TransactionType[] = ['', 'in', 'out']
export const transactionDirectionOptions: TransactionDirection[] = ['in', 'out']

export const transactionStatusOptions: TransactionType[] = ['confirmed', 'pending', 'failed']
export const transactionStatusOptions: TransactionStatus[] = ['confirmed', 'pending', 'failed']

export const cardSelectOptions: CardSelectType[] = ['network', 'wallet']

Expand Down
18 changes: 9 additions & 9 deletions apps/laboratory/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@apps/laboratory",
"version": "3.5.0-alpha.1",
"version": "3.5.0-6a05dc24",
"private": true,
"scripts": {
"dev:laboratory": "next dev",
Expand All @@ -11,17 +11,17 @@
"@chakra-ui/react": "2.8.2",
"@emotion/react": "11.11.1",
"@emotion/styled": "11.11.0",
"@sentry/browser": "7.84.0",
"@sentry/react": "7.84.0",
"@web3modal/ethers": "3.5.0-alpha.1",
"@web3modal/ethers5": "3.5.0-alpha.1",
"@web3modal/wagmi": "3.5.0-alpha.1",
"framer-motion": "10.16.12",
"next": "14.0.3",
"@sentry/browser": "7.86.0",
"@sentry/react": "7.86.0",
"@web3modal/ethers": "3.5.0-6a05dc24",
"@web3modal/ethers5": "3.5.0-6a05dc24",
"@web3modal/wagmi": "3.5.0-6a05dc24",
"framer-motion": "10.16.16",
"next": "14.0.4",
"next-auth": "4.24.5",
"react-icons": "4.12.0",
"siwe": "2.1.4",
"valtio": "1.12.1"
"valtio": "1.11.2"
},
"devDependencies": {
"ethers": "6.9.0"
Expand Down
19 changes: 11 additions & 8 deletions apps/laboratory/src/pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { SIWESession } from '@web3modal/core'
import type { NextApiRequest, NextApiResponse } from 'next'
import type { DefaultSession } from 'next-auth'
import nextAuth from 'next-auth'
import credentialsProvider from 'next-auth/providers/credentials'
import { getCsrfToken } from 'next-auth/react'
Expand All @@ -9,7 +8,8 @@ import { ethers } from 'ethers'

declare module 'next-auth' {
interface Session extends SIWESession {
user?: DefaultSession['user']
address: string
chainId: number
}
}

Expand All @@ -22,6 +22,10 @@ export default async function auth(req: NextApiRequest, res: NextApiResponse) {
if (!nextAuthSecret) {
throw new Error('NEXTAUTH_SECRET is not set')
}
const projectId = process.env['NEXT_PUBLIC_PROJECT_ID']
if (!projectId) {
throw new Error('NEXT_PUBLIC_PROJECT_ID is not set')
}

const providers = [
credentialsProvider({
Expand All @@ -44,16 +48,16 @@ export default async function auth(req: NextApiRequest, res: NextApiResponse) {
throw new Error('SiweMessage is undefined')
}
const siwe = new SiweMessage(credentials.message)
const provider = new ethers.InfuraProvider(siwe.chainId)
const provider = new ethers.JsonRpcProvider(
`https://rpc.walletconnect.com/v1?chainId=eip155:${siwe.chainId}&projectId=${projectId}`
)
const nonce = await getCsrfToken({ req: { headers: req.headers } })
const result = await siwe.verify(
{
signature: credentials?.signature || '',
nonce
},
{
provider
}
{ provider }
)

if (result.success) {
Expand All @@ -79,19 +83,18 @@ export default async function auth(req: NextApiRequest, res: NextApiResponse) {

return await nextAuth(req, res, {
// https://next-auth.js.org/configuration/providers/oauth
secret: nextAuthSecret,
providers,
session: {
strategy: 'jwt'
},
secret: nextAuthSecret,
callbacks: {
session({ session, token }) {
if (!token.sub) {
return session
}

const [, chainId, address] = token.sub.split(':')

if (chainId && address) {
session.address = address
session.chainId = parseInt(chainId, 10)
Expand Down
20 changes: 9 additions & 11 deletions dangerfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,17 @@ async function checkUiPackage() {
fail('New layout components were added, but not exported in ui/index.ts')
}

// TODO: Uncomment after first pr merged (when file will have diffs insted of being created)

// if (created_ui_components_index_ts.length && !jsx_index_diff?.added.includes('../components')) {
// fail('New components were added, but not exported in ui/utils/JSXTypeUtil.ts')
// }
if (created_ui_components_index_ts.length && !jsx_index_diff?.added.includes('../components')) {
fail('New components were added, but not exported in ui/utils/JSXTypeUtil.ts')
}

// if (created_ui_composites_index_ts.length && !jsx_index_diff?.added.includes('../composites')) {
// fail('New composites were added, but not exported in ui/utils/JSXTypeUtil.ts')
// }
if (created_ui_composites_index_ts.length && !jsx_index_diff?.added.includes('../composites')) {
fail('New composites were added, but not exported in ui/utils/JSXTypeUtil.ts')
}

// if (created_ui_layout_index_ts.length && !jsx_index_diff?.added.includes('../layout')) {
// fail('New layout components were added, but not exported in ui/utils/JSXTypeUtil.ts')
// }
if (created_ui_layout_index_ts.length && !jsx_index_diff?.added.includes('../layout')) {
fail('New layout components were added, but not exported in ui/utils/JSXTypeUtil.ts')
}

if (created_ui_components.length && !created_ui_components_stories.length) {
fail('New components were added, but no stories were created')
Expand Down
4 changes: 2 additions & 2 deletions examples/html-ethers5/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "@examples/html-ethers5",
"private": true,
"version": "3.5.0-alpha.1",
"version": "3.5.0-6a05dc24",
"scripts": {
"dev:example": "vite --port 3011",
"build:examples": "vite build"
},
"dependencies": {
"@web3modal/ethers5": "3.5.0-alpha.1",
"@web3modal/ethers5": "3.5.0-6a05dc24",
"ethers": "5.7.2"
}
}
4 changes: 2 additions & 2 deletions examples/html-wagmi/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "@examples/html-wagmi",
"private": true,
"version": "3.5.0-alpha.1",
"version": "3.5.0-6a05dc24",
"scripts": {
"dev:example": "vite --port 3001",
"build:examples": "vite build"
},
"dependencies": {
"@web3modal/wagmi": "3.5.0-alpha.1"
"@web3modal/wagmi": "3.5.0-6a05dc24"
}
}
6 changes: 3 additions & 3 deletions examples/react-ethers5/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "@examples/react-ethers5",
"private": true,
"version": "3.5.0-alpha.1",
"version": "3.5.0-6a05dc24",
"scripts": {
"dev:example": "vite --port 3012",
"build:examples": "vite build"
},
"dependencies": {
"@web3modal/ethers5": "3.5.0-alpha.1",
"@web3modal/ethers5": "3.5.0-6a05dc24",
"ethers": "5.7.2"
},
"devDependencies": {
"@vitejs/plugin-react": "4.2.0"
"@vitejs/plugin-react": "4.2.1"
}
}
6 changes: 3 additions & 3 deletions examples/react-wagmi/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "@examples/react-wagmi",
"private": true,
"version": "3.5.0-alpha.1",
"version": "3.5.0-6a05dc24",
"scripts": {
"dev:example": "vite --port 3002",
"build:examples": "vite build"
},
"dependencies": {
"@web3modal/wagmi": "3.5.0-alpha.1"
"@web3modal/wagmi": "3.5.0-6a05dc24"
},
"devDependencies": {
"@vitejs/plugin-react": "4.2.0"
"@vitejs/plugin-react": "4.2.1"
}
}
6 changes: 3 additions & 3 deletions examples/vue-ethers5/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "@examples/vue-ethers5",
"private": true,
"version": "3.5.0-alpha.1",
"version": "3.5.0-6a05dc24",
"scripts": {
"dev:example": "vite --port 3013",
"build:examples": "vite build"
},
"dependencies": {
"@web3modal/ethers5": "3.5.0-alpha.1",
"@web3modal/ethers5": "3.5.0-6a05dc24",
"ethers": "5.7.2"
},
"devDependencies": {
"@vitejs/plugin-vue": "4.5.1"
"@vitejs/plugin-vue": "4.5.2"
}
}
6 changes: 3 additions & 3 deletions examples/vue-wagmi/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "@examples/vue-wagmi",
"private": true,
"version": "3.5.0-alpha.1",
"version": "3.5.0-6a05dc24",
"scripts": {
"dev:example": "vite --port 3003",
"build:examples": "vite build"
},
"dependencies": {
"@web3modal/wagmi": "3.5.0-alpha.1"
"@web3modal/wagmi": "3.5.0-6a05dc24"
},
"devDependencies": {
"@vitejs/plugin-vue": "4.5.1"
"@vitejs/plugin-vue": "4.5.2"
}
}
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
"apps/*",
"examples/*"
],
"version": "3.5.0-alpha.1",
"version": "3.5.0-6a05dc24",
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
}
Loading

0 comments on commit fff9cf8

Please sign in to comment.