Skip to content

Commit

Permalink
build(deps): upgrade wallet connect dependencies (#5129)
Browse files Browse the repository at this point in the history
### Description

Upgrades Wallet Connect dependencies to the latest versions: originally
pinned in #4406.

### Test plan

- Tested locally on iOS and Android
  - Connect
  - Verify
  - Sign Transaction

### Related issues

- Related: ACT-962

### Backwards compatibility

Yes

### Network scalability

N/A
  • Loading branch information
MuckT committed Mar 25, 2024
1 parent ea2e5fc commit bc9afe0
Show file tree
Hide file tree
Showing 13 changed files with 507 additions and 92 deletions.
7 changes: 7 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,9 @@ PODS:
- React-Core
- react-native-camera/RN (4.2.1):
- React-Core
- react-native-compat (2.11.3):
- RCT-Folly (= 2021.07.22.00)
- React-Core
- react-native-config (1.5.1):
- react-native-config/App (= 1.5.1)
- react-native-config/App (1.5.1):
Expand Down Expand Up @@ -819,6 +822,7 @@ DEPENDENCIES:
- React-logger (from `../node_modules/react-native/ReactCommon/logger`)
- react-native-adjust (from `../node_modules/react-native-adjust`)
- react-native-camera (from `../node_modules/react-native-camera`)
- "react-native-compat (from `../node_modules/@walletconnect/react-native-compat`)"
- react-native-config (from `../node_modules/react-native-config`)
- react-native-contacts (from `../node_modules/react-native-contacts`)
- "react-native-cookies (from `../node_modules/@react-native-cookies/cookies`)"
Expand Down Expand Up @@ -985,6 +989,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-adjust"
react-native-camera:
:path: "../node_modules/react-native-camera"
react-native-compat:
:path: "../node_modules/@walletconnect/react-native-compat"
react-native-config:
:path: "../node_modules/react-native-config"
react-native-contacts:
Expand Down Expand Up @@ -1174,6 +1180,7 @@ SPEC CHECKSUMS:
React-logger: 35538accacf2583693fbc3ee8b53e69a1776fcee
react-native-adjust: 0463129823eabe31ff28262295be713ba5f99d2c
react-native-camera: 3eae183c1d111103963f3dd913b65d01aef8110f
react-native-compat: 4da17905c26471d956dae70f9912a60d7da7fad2
react-native-config: 86038147314e2e6d10ea9972022aa171e6b1d4d8
react-native-contacts: fd1614c74777089ebb6b0a0e3847dd78130ef9f4
react-native-cookies: f54fcded06bb0cda05c11d86788020b43528a26c
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@
"@toruslabs/constants": "^13.2.0",
"@toruslabs/fetch-node-details": "^13.2.0",
"@toruslabs/torus.js": "^12.1.1",
"@walletconnect/react-native-compat": "2.10.0",
"@walletconnect/utils": "2.10.0",
"@walletconnect/web3wallet": "1.9.0",
"@walletconnect/react-native-compat": "^2.11.3",
"@walletconnect/utils": "^2.11.3",
"@walletconnect/web3wallet": "^1.10.3",
"Base64": "^1.3.0",
"bignumber.js": "^9.1.2",
"clevertap-react-native": "^1.2.1",
Expand Down Expand Up @@ -244,9 +244,9 @@
"@typescript-eslint/eslint-plugin": "^5.58.0",
"@valora/eslint-config-typescript": "^1.0.2",
"@valora/resolve-kit": "^1.0.1",
"@walletconnect/legacy-types": "2.0.0",
"@walletconnect/sign-client": "2.10.0",
"@walletconnect/types": "2.10.0",
"@walletconnect/legacy-types": "^2.0.0",
"@walletconnect/sign-client": "^2.11.3",
"@walletconnect/types": "^2.11.3",
"ajv": "^8.10.0",
"babel-jest": "^29.2.1",
"babel-plugin-module-resolver": "^4.1.0",
Expand Down
12 changes: 0 additions & 12 deletions renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,4 @@
groupName: 'prettier',
},
],

// A list of dependencies to be ignored by Renovate - "exact match" only
ignoreDeps: [
// avoid upgrading WalletConnect since there is a bug introduced in 2.10.1 that CI does not cover
// TODO remove once WC bug resolved. https://linear.app/valora/issue/ACT-962/wallet-connect-no-matching-sessions
'@walletconnect/react-native-compat',
'@walletconnect/utils',
'@walletconnect/web3wallet',
'@walletconnect/legacy-types',
'@walletconnect/sign-client',
'@walletconnect/types',
],
}
9 changes: 9 additions & 0 deletions src/redux/migrations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import {
v197Schema,
v1Schema,
v200Schema,
v201Schema,
v21Schema,
v28Schema,
v2Schema,
Expand Down Expand Up @@ -1565,4 +1566,12 @@ describe('Redux persist migrations', () => {
delete expectedSchema.app.hideHomeBalances
expect(migratedSchema).toStrictEqual(expectedSchema)
})

it('works from 201 to 202', () => {
const oldSchema = v201Schema
const migratedSchema = migrations[202](oldSchema)
const expectedSchema: any = _.cloneDeep(oldSchema)
expectedSchema.walletConnect.pendingSessions = []
expect(migratedSchema).toStrictEqual(expectedSchema)
})
})
7 changes: 7 additions & 0 deletions src/redux/migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1630,4 +1630,11 @@ export const migrations = {
hideBalances: state.app.hideHomeBalances,
},
}),
202: (state: any) => ({
...state,
walletConnect: {
...state.walletConnect,
pendingSessions: [],
},
}),
}
2 changes: 1 addition & 1 deletion src/redux/store.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ describe('store state', () => {
{
"_persist": {
"rehydrated": true,
"version": 201,
"version": 202,
},
"account": {
"acceptedTerms": false,
Expand Down
2 changes: 1 addition & 1 deletion src/redux/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const persistConfig: PersistConfig<ReducersRootState> = {
key: 'root',
// default is -1, increment as we make migrations
// See https://github.com/valora-inc/wallet/tree/main/WALLET.md#redux-state-migration
version: 201,
version: 202,
keyPrefix: `reduxStore-`, // the redux-persist default is `persist:` which doesn't work with some file systems.
storage: FSStorage(),
blacklist: ['networkInfo', 'alert', 'imports', 'keylessBackup', 'jumpstart'],
Expand Down
2 changes: 1 addition & 1 deletion src/walletConnect/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const reducer = (
.includes(pendingAction.topic)
),
pendingSessions: state.pendingSessions.filter(
(pendingSession) => pendingSession.params.expiry > action.dateInSeconds
(pendingSession) => pendingSession.params.expiryTimestamp > action.dateInSeconds
),
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/walletConnect/saga.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function createSessionProposal(
return {
id: 1669989187506938,
params: {
expiry: 1669989496,
expiryTimestamp: 1669989496,
proposer: {
publicKey: 'f4284dc764da82e9b62d625f4dfea4088142f477c0d7420cdec2a0f49959c233',
metadata: proposerMetadata,
Expand Down Expand Up @@ -643,9 +643,8 @@ describe('showActionRequest', () => {
})
})

// TODO: use a real connection string
const v2ConnectionString =
'wc:79a02f869d0f921e435a5e0643304548ebfa4a0430f9c66fe8b1a9254db7ef77@2?controller=false&publicKey=f661b0a9316a4ce0b6892bdce42bea0f45037f2c1bee9e118a3a4bc868a32a39&relay={"protocol":"waku"}'
'wc:79a02f869d0f921e435a5e0643304548ebfa4a0430f9c66fe8b1a9254db7ef77@2?relay-protocol=irn&symKey=f661b0a9316a4ce0b6892bdce42bea0f45037f2c1bee9e118a3a4bc868a32a39'

describe('initialiseWalletConnect', () => {
const origin = WalletConnectPairingOrigin.Deeplink
Expand Down
2 changes: 1 addition & 1 deletion src/walletConnect/screens/SessionRequest.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe(SessionRequest, () => {
params: {
id: 1690539550772665,
pairingTopic: 'b655eac1cf0cc18780a1c6503d7395f633b3d10791b7a628d9602d10b2fe3f26',
expiry: 1690539851,
expiryTimestamp: 1690539851,
requiredNamespaces: {
eip155: {
methods: ['eth_sendTransaction', 'personal_sign'],
Expand Down
8 changes: 7 additions & 1 deletion test/RootStateSchema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2403,6 +2403,9 @@
"expiry": {
"type": "number"
},
"expiryTimestamp": {
"type": "number"
},
"id": {
"type": "number"
},
Expand Down Expand Up @@ -2442,7 +2445,7 @@
}
},
"required": [
"expiry",
"expiryTimestamp",
"id",
"optionalNamespaces",
"proposer",
Expand Down Expand Up @@ -5126,6 +5129,9 @@
"verified": {
"additionalProperties": false,
"properties": {
"isScam": {
"type": "boolean"
},
"origin": {
"type": "string"
},
Expand Down
14 changes: 13 additions & 1 deletion test/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3175,6 +3175,18 @@ export const v201Schema = {
},
}

export const v202Schema = {
...v201Schema,
_persist: {
...v201Schema._persist,
version: 202,
},
walletConnect: {
...v201Schema.walletConnect,
pendingSessions: [],
},
}

export function getLatestSchema(): Partial<RootState> {
return v201Schema as Partial<RootState>
return v202Schema as Partial<RootState>
}

0 comments on commit bc9afe0

Please sign in to comment.