Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

Commit

Permalink
WCv2 Fix (#356)
Browse files Browse the repository at this point in the history
* update wallet connect to latest

* fix hydration errors

* add cannoli to walletconnect and a note for next time

* chore: upgrade local WC Wallet

* chore: remove unused import

* fix: make it work

* docs: add explanation for the changes

* fix: remove unused import

* fix: typing

* fix: remove unused auth-client

* fix: remove node 14 CI runner

* add cannoli to mock wallet, add properties to mock client which are missing

* include fetch in tests

* fix deprecated setup for ts jest

* Fix dapp name not being sent to the wallet

* solving world hunger right here

* solve connection issues, and chain switching. fix infinite connector initialization.

* fix incorrect reject message,
use proper logger
ensure initialised before swithing networks to prevent errors and deinitialise when closing
more helpful comments
safely delete pairing
signTransaction is required.

* UPDATE WC DEPS TO LATEST

* publish 5.0.4 beta 1

* use correct version

* Fixing build for example app

---------

Co-authored-by: Aaron <aaron.deruvo@clabs.co>
Co-authored-by: Nicolas Brugneaux <nicolas.brugneaux@gmail.com>
Co-authored-by: Daniel Kesler <danielckesler@gmail.com>
  • Loading branch information
4 people authored Jun 13, 2023
1 parent b5d97b9 commit 61796eb
Show file tree
Hide file tree
Showing 23 changed files with 598 additions and 547 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [14, 16, 18]
node: [16, 18]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
6 changes: 2 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ module.exports = {
setupFilesAfterEnv: ['<rootDir>/../../jest.setup.ts'],
roots: ['<rootDir>/src', '<rootDir>/__tests__'],
preset: 'ts-jest',
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
},
transform: {
'\\*.tsx': ['ts-jest', '<rootDir>/tsconfig.spec.json'],
},
testEnvironment: 'jsdom',
testRegex: '(/__tests__/.*|(\\.|/))(test|spec)\\.[jt]sx?$',
Expand Down
3 changes: 3 additions & 0 deletions jest.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import '@testing-library/jest-dom';

import fetch from 'isomorphic-fetch';
import { TextDecoder, TextEncoder } from 'util';

if (typeof window !== 'undefined' && !('TextEncoder' in window)) {
Expand All @@ -20,3 +21,5 @@ if (typeof window !== 'undefined' && !('TextEncoder' in window)) {
value: TextDecoder,
});
}

global['fetch'] = fetch;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"path": "./packages"
},
"engines": {
"node": ">=14.0.0"
"node": ">=16.0.0"
},
"scripts": {
"dev": "lerna run dev --stream --parallel",
Expand Down
11 changes: 7 additions & 4 deletions packages/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@
"license": "MIT",
"dependencies": {
"@celo/contractkit": "^3.2.0",
"@celo/react-celo": "5.0.3-dev",
"@celo/react-celo": "5.0.4-beta.1-dev",
"@celo/utils": "^3.2.0",
"@walletconnect/sign-client": "^2.1.4",
"@walletconnect/types": "^2.1.4",
"@walletconnect/utils": "^2.1.4",
"@celo/wallet-walletconnect": "5.0.4-beta.1-dev",
"@walletconnect/core": "^2.7.3",
"@walletconnect/sign-client": "^2.7.3",
"@walletconnect/types": "^2.7.3",
"@walletconnect/utils": "^2.7.3",
"@walletconnect/web3wallet": "^1.7.1",
"next": "^12.1.6",
"postcss": "^8.4.5",
"react": "^18.1.0",
Expand Down
8 changes: 6 additions & 2 deletions packages/example/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,10 @@ async function getBalances(
export const WC_PROJECT_ID = 'cbd4dfc72c388f372fc45f003becb013';

export default function Home(): React.ReactElement {
const [isMounted, setIsMounted] = useState(false);
useEffect(() => {
setIsMounted(true);
}, []);
return (
<CeloProvider
dapp={{
Expand All @@ -357,7 +361,7 @@ export default function Home(): React.ReactElement {
providersOptions: { searchable: true },
}}
>
<HomePage />
{isMounted && <HomePage />}
</CeloProvider>
);
}
Expand Down Expand Up @@ -410,7 +414,7 @@ function SelectChain() {
onChange={(e) => {
const newNetwork = networks.find((n) => n.name === e.target.value);
if (newNetwork) {
void updateNetwork(newNetwork);
void updateNetwork(newNetwork).catch(console.error);
}
}}
>
Expand Down
Loading

0 comments on commit 61796eb

Please sign in to comment.