Skip to content

Commit

Permalink
Merge branch 'main' into v6
Browse files Browse the repository at this point in the history
  • Loading branch information
enesozturk committed Sep 4, 2024
2 parents 61bf61e + 88ae1d8 commit 3738207
Show file tree
Hide file tree
Showing 146 changed files with 15,360 additions and 16,679 deletions.
43 changes: 28 additions & 15 deletions .github/workflows/ui_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,31 @@ on:
required: false

jobs:
setup_playwright_runners:
uses: WalletConnect/gh-actions-runners/.github/workflows/setup-runners.yml@main
with:
cpu: 16384
memory: 65536
labels: playwright
count: 5
secrets:
GITHUB_PAT: ${{ secrets.RELEASE_TOKEN }}
TF_API_TOKEN: ${{ secrets.TFC_INFRA_TOKEN }}

ui_tests:
name: 'Playwright Tests'
runs-on:
group: ubuntu-runners
runs-on: [self-hosted, playwright]
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4, 5]
shardTotal: [5]
timeout-minutes: 20
steps:
- name: Tune GitHub-hosted runner network
uses: smorimoto/tune-github-hosted-runner-network@v1
# Possibly this helps with GitHub-hosted runner network issues, but it's not confirmed
# It's not supported in self-hosted runners, however, so commenting it out for now
# - name: Tune GitHub-hosted runner network
# uses: smorimoto/tune-github-hosted-runner-network@v1

- name: checkout
uses: actions/checkout@v4
Expand All @@ -75,17 +87,18 @@ jobs:
node-version: 18.x
cache: 'pnpm'

- name: Get installed Playwright version
id: playwright-version
run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package-lock.json').packages['apps/laboratory']['devDependencies']['@playwright/test'])")" >> $GITHUB_ENV

- name: Cache playwright binaries
uses: actions/cache@v4
id: playwright-cache
with:
path: |
~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}-${{ hashFiles('apps/laboratory/tests/shared/constants/devices.ts') }}
# - name: Get installed Playwright version
# id: playwright-version
# run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package-lock.json').packages['apps/laboratory']['devDependencies']['@playwright/test'])")" >> $GITHUB_ENV

# This cache causes weird errors on retry runs when using the self-hosted runners, disabling for now
# - name: Cache playwright binaries
# uses: actions/cache@v4
# id: playwright-cache
# with:
# path: |
# ~/.cache/ms-playwright
# key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}-${{ hashFiles('apps/laboratory/tests/shared/constants/devices.ts') }}

- name: Install dependencies
run: pnpm install
Expand Down
30 changes: 30 additions & 0 deletions apps/demo/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
# @apps/demo

## 5.1.5

### Patch Changes

- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770
- fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771
- feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772
- chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776
- chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768
- fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779
- fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780
- Updated dependencies []:
- @web3modal/wagmi@5.1.5

## 5.1.4

### Patch Changes

- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746
- chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741
- chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751
- Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748
- fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715
- chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747
- fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765
- chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756
- fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745
- Updated dependencies []:
- @web3modal/wagmi@5.1.4

## 5.1.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@apps/demo",
"version": "5.1.3",
"version": "5.1.5",
"private": true,
"scripts": {
"dev": "next dev",
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

## 5.1.5

### Patch Changes

- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770
- fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771
- feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772
- chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776
- chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768
- fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779
- fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780
- Updated dependencies []:
- @web3modal/common@5.1.5
- @web3modal/ui@5.1.5

## 5.1.4

### Patch Changes

- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746
- chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741
- chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751
- Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748
- fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715
- chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747
- fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765
- chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756
- fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745
- Updated dependencies []:
- @web3modal/common@5.1.4
- @web3modal/ui@5.1.4

## 5.1.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion apps/gallery/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@apps/gallery",
"version": "5.1.3",
"version": "5.1.5",
"private": true,
"main": "index.js",
"scripts": {
Expand Down
42 changes: 42 additions & 0 deletions apps/laboratory/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,47 @@
# @apps/laboratory

## 5.1.5

### Patch Changes

- - chore: add safety for localstorage by @zoruka in https://github.com/WalletConnect/web3modal/pull/2770
- fix: impossible to press on send placeholder input on mobile by @magiziz in https://github.com/WalletConnect/web3modal/pull/2771
- feat: solana sign all transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2772
- chore: change universal provider relay url and move to constants file by @zoruka in https://github.com/WalletConnect/web3modal/pull/2776
- chore: remove coinbase SDK de-duplication by @tomiir in https://github.com/WalletConnect/web3modal/pull/2768
- fix: add missing chainId param for transactions request by @zoruka in https://github.com/WalletConnect/web3modal/pull/2779
- fix: remove coming message from solana transactions by @zoruka in https://github.com/WalletConnect/web3modal/pull/2780
- Updated dependencies []:
- @web3modal/base@5.1.5
- @web3modal/ethers@5.1.5
- @web3modal/ethers5@5.1.5
- @web3modal/siwe@5.1.5
- @web3modal/solana@5.1.5
- @web3modal/wagmi@5.1.5
- @web3modal/wallet@5.1.5

## 5.1.4

### Patch Changes

- - Added entries on assetlinks for flutter wallet by @quetool in https://github.com/WalletConnect/web3modal/pull/2746
- chore: only upgrade ethers v6 by @chris13524 in https://github.com/WalletConnect/web3modal/pull/2741
- chore: fix wagmi not disconnecting and add adapter tests by @magiziz in https://github.com/WalletConnect/web3modal/pull/2751
- Added more fingerprints to Flutter apps by @quetool in https://github.com/WalletConnect/web3modal/pull/2748
- fix: remove auth connector from ethers and check for socials length by @tomiir in https://github.com/WalletConnect/web3modal/pull/2715
- chore: make all socials enabled by default by @tomiir in https://github.com/WalletConnect/web3modal/pull/2747
- fix: social logins not working in laboratory by @magiziz in https://github.com/WalletConnect/web3modal/pull/2765
- chore: expose solana provider type by @zoruka in https://github.com/WalletConnect/web3modal/pull/2756
- fix: Connector image mismatch by @tomiir in https://github.com/WalletConnect/web3modal/pull/2745
- Updated dependencies []:
- @web3modal/base@5.1.4
- @web3modal/ethers@5.1.4
- @web3modal/ethers5@5.1.4
- @web3modal/siwe@5.1.4
- @web3modal/solana@5.1.4
- @web3modal/wagmi@5.1.4
- @web3modal/wallet@5.1.4

## 5.1.3

### Patch Changes
Expand Down
19 changes: 13 additions & 6 deletions apps/laboratory/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
/** @type {import('next').NextConfig} */
// Keep in-sync with https://docs.walletconnect.com/advanced/security/content-security-policy
const SHAKRA_UI = `'sha256-e7MRMmTzLsLQvIy1iizO1lXf7VWYoQ6ysj5fuUzvRwE='`
/*
* Keep in-sync with https://docs.walletconnect.com/advanced/security/content-security-policy
* DO NOT use `unsafe-inline` or `unsafe-eval` for `script-src` or `default-src` in production as this
* is against CSP best practices
*/
const cspHeader = `
default-src 'self';
script-src 'self' 'unsafe-inline' ${process.env.NODE_ENV === 'production' ? '' : "'unsafe-eval'"};
script-src 'self' ${SHAKRA_UI} ${process.env.NODE_ENV === 'production' ? '' : "'unsafe-eval'"};
style-src 'self' 'unsafe-inline' https://fonts.googleapis.com;
img-src 'self' data: blob: https://walletconnect.org https://walletconnect.com https://secure.walletconnect.com https://secure.walletconnect.org https://tokens-data.1inch.io https://tokens.1inch.io https://ipfs.io https://lab.web3modal.com;
img-src * 'self' data: blob: https://walletconnect.org https://walletconnect.com https://secure.walletconnect.com https://secure.walletconnect.org https://tokens-data.1inch.io https://tokens.1inch.io https://ipfs.io https://lab.web3modal.com;
font-src 'self' https://fonts.gstatic.com;
connect-src 'self' https://rpc.walletconnect.com https://rpc.walletconnect.org https://explorer.walletconnect.com https://explorer.walletconnect.org https://relay.walletconnect.com https://relay.walletconnect.org wss://relay.walletconnect.com wss://relay.walletconnect.org https://pulse.walletconnect.com https://pulse.walletconnect.org https://api.web3modal.com https://api.web3modal.org wss://www.walletlink.org https://o1095249.ingest.sentry.io;
frame-src 'self' https://verify.walletconnect.com https://verify.walletconnect.org https://secure.walletconnect.com https://secure.walletconnect.org;
connect-src 'self' https://react-wallet.walletconnect.com https://rpc.walletconnect.com https://rpc.walletconnect.org https://relay.walletconnect.com https://relay.walletconnect.org wss://relay.walletconnect.com wss://relay.walletconnect.org https://pulse.walletconnect.com https://pulse.walletconnect.org https://api.web3modal.com https://api.web3modal.org wss://www.walletlink.org https://o1095249.ingest.sentry.io;
frame-src 'self' https://verify.walletconnect.com https://verify.walletconnect.org https://secure.walletconnect.com https://secure.walletconnect.org ${
process.env.NEXT_PUBLIC_SECURE_SITE_SDK_URL || ''
};
object-src 'none';
base-uri 'self';
form-action 'self';
Expand Down Expand Up @@ -39,7 +46,7 @@ const nextConfig = {
source: '/:path*',
headers: [
{
key: 'Content-Security-Policy-Report-Only',
key: 'Content-Security-Policy',
value: cspHeader.replace(/\n/g, ' ').trim()
},
{
Expand Down
3 changes: 1 addition & 2 deletions apps/laboratory/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@apps/laboratory",
"type": "module",
"version": "5.1.3",
"version": "5.1.5",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down Expand Up @@ -67,7 +67,6 @@
"framer-motion": "10.17.9",
"next": "14.2.3",
"next-auth": "4.24.5",
"permissionless": "0.1.31",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-icons": "4.12.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
import { useState } from 'react'
import { Button, Stack, Text, Spacer } from '@chakra-ui/react'
import {
PublicKey,
Transaction,
TransactionMessage,
VersionedTransaction,
SystemProgram
} from '@solana/web3.js'

import { useWeb3ModalAccount, useWeb3ModalProvider, type Provider } from '@web3modal/solana/react'

import { solana } from '../../utils/ChainsUtil'
import { useChakraToast } from '../Toast'
import type { Connection } from '@web3modal/base/adapters/solana/web3js'
import bs58 from 'bs58'

const PHANTOM_DEVNET_ADDRESS = '8vCyX7oB6Pc3pbWMGYYZF5pbSnAdQ7Gyr32JqxqCy8ZR'
const recipientAddress = new PublicKey(PHANTOM_DEVNET_ADDRESS)
const amountInLamports = 1_000_000

export function SolanaSignAllTransactionsTest() {
const toast = useChakraToast()
const { chainId } = useWeb3ModalAccount()
const { walletProvider, connection } = useWeb3ModalProvider()
const [loading, setLoading] = useState(false)

async function onSignTransaction(type: 'legacy' | 'versioned') {
try {
setLoading(true)
if (!walletProvider?.publicKey) {
throw Error('user is disconnected')
}

if (!connection) {
throw Error('no connection set')
}

const transactions = await Promise.all(
Array.from({ length: 5 }, () => createTransaction(walletProvider, connection, type))
)
const response = await walletProvider.signAllTransactions(transactions)

const description = response
.map(transaction => {
const signature =
transaction.signatures[0] instanceof Uint8Array
? transaction.signatures[0]
: transaction.signatures[0]?.signature

if (!signature) {
throw Error('Empty signature')
}

return bs58.encode(signature)
})
.join('\n\n')

toast({
title: 'Success',
description,
type: 'success'
})
} catch (err) {
toast({
title: 'Error',
description: (err as Error).message,
type: 'error'
})
} finally {
setLoading(false)
}
}

if (chainId === solana.chainId) {
return (
<Text fontSize="md" color="yellow">
Switch to Solana Devnet or Testnet to test this feature
</Text>
)
}

return (
<Stack direction={['column', 'column', 'row']}>
<Button
data-testid="sign-transaction-button"
onClick={onSignTransaction.bind(null, 'legacy')}
isDisabled={loading}
>
Sign All Transactions
</Button>
<Button
data-test-id="sign-transaction-button"
onClick={onSignTransaction.bind(null, 'versioned')}
isDisabled={loading}
>
Sign All Versioned Transactions
</Button>
<Spacer />
</Stack>
)
}

async function createTransaction(
provider: Provider,
connection: Connection,
type: 'legacy' | 'versioned'
) {
if (!provider.publicKey) {
throw Error('No public key found')
}

const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash()

const instructions = [
SystemProgram.transfer({
fromPubkey: provider.publicKey,
toPubkey: recipientAddress,
lamports: amountInLamports
})
]

if (type === 'legacy') {
return new Transaction({ feePayer: provider.publicKey, blockhash, lastValidBlockHeight }).add(
...instructions
)
}

return new VersionedTransaction(
new TransactionMessage({
payerKey: provider.publicKey,
recentBlockhash: blockhash,
instructions
}).compileToV0Message()
)
}
Loading

0 comments on commit 3738207

Please sign in to comment.