Skip to content

Commit 4013e65

Browse files
Merge pull request #329 from reown-com/develop
prep for v1.2.3
2 parents ea2c3d7 + 9ba983e commit 4013e65

30 files changed

+3080
-2390
lines changed

.changeset/few-cherries-leave.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
'@reown/appkit-ethers5-react-native': patch
3+
'@reown/appkit-ethers-react-native': patch
4+
'@reown/appkit-wagmi-react-native': patch
5+
'@reown/appkit-auth-ethers-react-native': patch
6+
'@reown/appkit-auth-wagmi-react-native': patch
7+
'@reown/appkit-coinbase-ethers-react-native': patch
8+
'@reown/appkit-coinbase-wagmi-react-native': patch
9+
'@reown/appkit-common-react-native': patch
10+
'@reown/appkit-core-react-native': patch
11+
'@reown/appkit-scaffold-react-native': patch
12+
'@reown/appkit-scaffold-utils-react-native': patch
13+
'@reown/appkit-siwe-react-native': patch
14+
'@reown/appkit-ui-react-native': patch
15+
'@reown/appkit-wallet-react-native': patch
16+
---
17+
18+
fix: clear balance if the sdk fails to get it

.changeset/shaggy-moose-tan.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
'@reown/appkit-scaffold-react-native': patch
3+
'@reown/appkit-ethers5-react-native': patch
4+
'@reown/appkit-common-react-native': patch
5+
'@reown/appkit-ethers-react-native': patch
6+
'@reown/appkit-wagmi-react-native': patch
7+
'@reown/appkit-core-react-native': patch
8+
'@reown/appkit-siwe-react-native': patch
9+
'@reown/appkit-ui-react-native': patch
10+
'@reown/appkit-auth-ethers-react-native': patch
11+
'@reown/appkit-auth-wagmi-react-native': patch
12+
'@reown/appkit-coinbase-ethers-react-native': patch
13+
'@reown/appkit-coinbase-wagmi-react-native': patch
14+
'@reown/appkit-scaffold-utils-react-native': patch
15+
'@reown/appkit-wallet-react-native': patch
16+
---
17+
18+
fix: deduplicate wallets in all wallet list

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodejs 18.20.0

TESTING.md

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
# Testing Setup
2+
3+
This document describes the testing setup for the WalletConnect AppKit React Native project.
4+
5+
## Shared Jest Setup
6+
7+
To avoid duplication and ensure consistency across packages, we use a shared Jest setup approach:
8+
9+
### Structure
10+
11+
- `jest-shared-setup.ts`: Contains common mocks used across all packages
12+
- Package-specific `jest-setup.ts` files: Import the shared setup and add package-specific mocks
13+
14+
### How it works
15+
16+
1. The root `jest.config.ts` defines a moduleNameMapper that maps `@shared-jest-setup` to the shared setup file:
17+
18+
```js
19+
moduleNameMapper: {
20+
'^@shared-jest-setup$': '<rootDir>/jest-shared-setup.ts'
21+
}
22+
```
23+
24+
2. Each package's `jest.config.ts` overrides this mapping to use a relative path:
25+
26+
```js
27+
moduleNameMapper: {
28+
'^@shared-jest-setup$': '../../jest-shared-setup.ts'
29+
}
30+
```
31+
32+
3. Each package has its own `jest-setup.ts` file that imports the shared setup and only adds package-specific mocks:
33+
34+
```js
35+
// Import shared setup
36+
import '@shared-jest-setup';
37+
38+
// Import helper functions from shared setup (if needed)
39+
import { mockThemeContext, mockUseTheme } from '@shared-jest-setup';
40+
41+
// Apply package-specific mocks
42+
mockThemeContext('../src/context/ThemeContext');
43+
mockUseTheme('../src/hooks/useTheme');
44+
45+
// Add any other package-specific mocks here if needed
46+
```
47+
48+
### Shared Mocks
49+
50+
The shared setup includes mocks for:
51+
52+
- `@react-native-async-storage/async-storage`
53+
- React Native components and APIs (StyleSheet, Dimensions, Platform, etc.)
54+
- `react-native-svg` components
55+
- Helper functions for mocking package-specific modules
56+
57+
All common mocks are centralized in the shared setup file, eliminating duplication across packages. This makes the testing setup more maintainable and consistent.
58+
59+
### Adding New Mocks
60+
61+
To add a new mock that should be shared across packages:
62+
63+
1. Add it to `jest-shared-setup.ts`
64+
2. If it's a function that needs to be imported by packages, export it from `jest-shared-setup.ts`
65+
66+
For package-specific mocks, add them to the package's `jest-setup.ts` file.
67+
68+
### Type Declarations
69+
70+
Each package includes a type declaration file for the shared setup module:
71+
72+
```ts
73+
// types/shared-jest-setup.d.ts
74+
declare module '@shared-jest-setup' {
75+
export function mockThemeContext(modulePath: string): void;
76+
export function mockUseTheme(modulePath: string): void;
77+
}
78+
```
79+
80+
## Running Tests
81+
82+
To run tests for all packages:
83+
84+
```bash
85+
yarn test
86+
```
87+
88+
To run tests for a specific package:
89+
90+
```bash
91+
yarn workspace @reown/appkit-[package-name]-react-native test
92+
```
93+
94+
## Playwright Testing
95+
96+
For end-to-end testing of web interfaces (such as the web demo or web views within the React Native app), we use Playwright.
97+
98+
### Setup
99+
100+
1. Install Playwright:
101+
102+
```bash
103+
# Install Playwright and browsers
104+
npx playwright install
105+
```
106+
107+
2. Playwright tests are located in the `e2e` directory at the root of the project.
108+
109+
### Writing Tests
110+
111+
Playwright tests are written using the Playwright Test framework. Here's a basic example:
112+
113+
```typescript
114+
import { test, expect } from '@playwright/test';
115+
116+
test('basic test', async ({ page }) => {
117+
// Navigate to the page
118+
await page.goto('https://your-app-url.com');
119+
120+
// Interact with the page
121+
await page.click('text=Sign In');
122+
await page.fill('input[name="email"]', 'user@example.com');
123+
await page.fill('input[name="password"]', 'password');
124+
await page.click('button[type="submit"]');
125+
126+
// Assert the result
127+
await expect(page.locator('.welcome-message')).toContainText('Welcome');
128+
});
129+
```
130+
131+
### Running Playwright Tests
132+
133+
To run all Playwright tests:
134+
135+
```bash
136+
yarn playwright:test
137+
```
138+
139+
To run a specific test file:
140+
141+
```bash
142+
yarn playwright:test tests/basic-tests.spec.ts
143+
```
144+
145+
### Debugging Playwright Tests
146+
147+
To debug tests:
148+
149+
1. Run with the `--debug` flag:
150+
151+
```bash
152+
yarn playwright:test --debug
153+
```
154+
155+
2. Use the Playwright Inspector to step through the test.
156+
157+
3. Add `await page.pause()` in your test to pause at a specific point.
158+
159+
### Generating Test Reports
160+
161+
To generate an HTML report:
162+
163+
```bash
164+
yarn playwright:test --reporter=html
165+
```
166+
167+
Then open the report:
168+
169+
```bash
170+
yarn playwright:test show-report
171+
```
172+
173+
For more information, refer to the [Playwright documentation](https://playwright.dev/docs/intro).

apps/native/app.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"orientation": "default",
77
"icon": "./assets/icon.png",
88
"userInterfaceStyle": "automatic",
9+
"newArchEnabled": true,
910
"splash": {
1011
"image": "./assets/splash.png",
1112
"resizeMode": "contain",

apps/native/package.json

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,40 +19,39 @@
1919
"build:web": "expo export -p web"
2020
},
2121
"dependencies": {
22-
"@expo/metro-runtime": "~3.2.3",
23-
"@react-native-async-storage/async-storage": "1.23.1",
24-
"@react-native-community/netinfo": "11.3.1",
22+
"@expo/metro-runtime": "~4.0.1",
23+
"@react-native-async-storage/async-storage": "2.1.2",
24+
"@react-native-community/netinfo": "11.4.1",
2525
"@reown/appkit-auth-wagmi-react-native": "1.2.2",
2626
"@reown/appkit-wagmi-react-native": "1.2.2",
2727
"@tanstack/query-async-storage-persister": "^5.40.0",
2828
"@tanstack/react-query": "5.56.2",
2929
"@tanstack/react-query-persist-client": "5.56.2",
30-
"@walletconnect/react-native-compat": "2.17.1",
31-
"expo": "~51.0.24",
32-
"expo-application": "~5.9.1",
33-
"expo-clipboard": "~6.0.3",
34-
"expo-status-bar": "~1.12.1",
35-
"expo-updates": "~0.25.21",
36-
"react": "18.2.0",
37-
"react-dom": "18.2.0",
38-
"react-native": "0.74.3",
30+
"@walletconnect/react-native-compat": "2.19.1",
31+
"expo": "^52.0.38",
32+
"expo-application": "~6.0.2",
33+
"expo-clipboard": "~7.0.1",
34+
"expo-status-bar": "~2.0.1",
35+
"expo-updates": "~0.27.3",
36+
"react": "18.3.1",
37+
"react-dom": "18.3.1",
38+
"react-native": "0.76.7",
3939
"react-native-get-random-values": "~1.11.0",
40-
"react-native-modal": "13.0.1",
41-
"react-native-svg": "15.2.0",
40+
"react-native-modal": "14.0.0-rc.0",
41+
"react-native-svg": "15.8.0",
4242
"react-native-toast-message": "2.2.1",
43-
"react-native-web": "~0.19.10",
44-
"react-native-webview": "13.8.6",
45-
"uuid": "3.4.0",
46-
"viem": "2.21.48",
47-
"wagmi": "2.12.33"
43+
"react-native-web": "~0.19.13",
44+
"react-native-webview": "13.12.5",
45+
"uuid": "^11.1.0",
46+
"viem": "2.23.10",
47+
"wagmi": "2.14.13"
4848
},
4949
"devDependencies": {
5050
"@babel/core": "^7.24.0",
5151
"@playwright/test": "^1.49.1",
5252
"@types/gh-pages": "^6",
5353
"@types/node": "^22.10.1",
5454
"@types/react": "~18.2.79",
55-
"@types/react-native": "0.72.2",
5655
"babel-plugin-module-resolver": "^5.0.0",
5756
"gh-pages": "^6.2.0",
5857
"typescript": "~5.3.3"

babel.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
module.exports = {
2-
presets: ['module:metro-react-native-babel-preset']
2+
presets: ['module:metro-react-native-babel-preset'],
3+
plugins: [
4+
'@babel/plugin-transform-flow-strip-types',
5+
['@babel/plugin-proposal-class-properties', { loose: true }],
6+
['@babel/plugin-proposal-private-methods', { loose: true }]
7+
]
38
};

jest-setup.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

jest-shared-setup.ts

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
// Mock AsyncStorage
2+
jest.mock('@react-native-async-storage/async-storage', () =>
3+
require('@react-native-async-storage/async-storage/jest/async-storage-mock')
4+
);
5+
6+
// Mock react-native modules that cause issues with Flow types
7+
jest.mock('react-native', () => {
8+
return {
9+
StyleSheet: {
10+
create: (styles: Record<string, any>) => styles,
11+
hairlineWidth: 1,
12+
absoluteFill: {},
13+
flatten: jest.fn()
14+
},
15+
Dimensions: {
16+
get: jest.fn().mockReturnValue({ width: 375, height: 812 }),
17+
addEventListener: jest.fn(),
18+
removeEventListener: jest.fn()
19+
},
20+
Platform: {
21+
OS: 'ios',
22+
select: jest.fn().mockImplementation((obj: { ios?: any; android?: any }) => obj.ios)
23+
},
24+
NativeModules: {
25+
StatusBarManager: { height: 44 }
26+
},
27+
Text: 'Text',
28+
View: 'View',
29+
TouchableOpacity: 'TouchableOpacity',
30+
TouchableWithoutFeedback: 'TouchableWithoutFeedback',
31+
TextInput: 'TextInput',
32+
ScrollView: 'ScrollView',
33+
Image: 'Image',
34+
Animated: {
35+
View: 'Animated.View',
36+
createAnimatedComponent: (component: string) => `Animated.${component}`,
37+
timing: jest.fn().mockReturnValue({ start: jest.fn() }),
38+
Value: jest.fn(() => ({
39+
interpolate: jest.fn(),
40+
setValue: jest.fn()
41+
}))
42+
},
43+
I18nManager: {
44+
isRTL: false
45+
},
46+
useColorScheme: jest.fn().mockReturnValue('light')
47+
};
48+
});
49+
50+
// Mock react-native-svg
51+
jest.mock('react-native-svg', () => {
52+
const mockSvg = () => 'Svg';
53+
mockSvg.Circle = () => 'Circle';
54+
mockSvg.Rect = () => 'Rect';
55+
mockSvg.Path = () => 'Path';
56+
mockSvg.G = () => 'G';
57+
mockSvg.Defs = () => 'Defs';
58+
mockSvg.LinearGradient = () => 'LinearGradient';
59+
mockSvg.Stop = () => 'Stop';
60+
61+
return mockSvg;
62+
});
63+
64+
// Export a function to mock package-specific modules
65+
export const mockThemeContext = (modulePath: string) => {
66+
jest.mock(
67+
modulePath,
68+
() => ({
69+
ThemeContext: {
70+
Provider: ({ children }: { children: React.ReactNode }) => children,
71+
Consumer: ({ children }: { children: Function }) => children({ themeMode: 'light' })
72+
},
73+
useTheme: jest.fn().mockReturnValue({
74+
themeMode: 'light',
75+
colors: {
76+
text: '#000000',
77+
background: '#FFFFFF',
78+
primary: '#3396FF'
79+
}
80+
})
81+
}),
82+
{ virtual: true }
83+
);
84+
};
85+
86+
export const mockUseTheme = (modulePath: string) => {
87+
jest.mock(
88+
modulePath,
89+
() => ({
90+
useTheme: jest.fn().mockReturnValue({
91+
themeMode: 'light',
92+
colors: {
93+
text: '#000000',
94+
background: '#FFFFFF',
95+
primary: '#3396FF'
96+
}
97+
})
98+
}),
99+
{ virtual: true }
100+
);
101+
};

0 commit comments

Comments
 (0)