diff --git a/packages/react-celo/__tests__/connectors/walletconnect.test.ts b/packages/react-celo/__tests__/connectors/walletconnect.test.ts index add91399..8aeb27d5 100644 --- a/packages/react-celo/__tests__/connectors/walletconnect.test.ts +++ b/packages/react-celo/__tests__/connectors/walletconnect.test.ts @@ -1,11 +1,10 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ import { CeloContract } from '@celo/contractkit'; -import { WalletConnectWallet } from '@celo/wallet-walletconnect-v1'; +import { WalletConnectWallet } from '@celo/wallet-walletconnect'; import { generateTestingUtils } from 'eth-testing'; import { Alfajores, WalletIds } from '../../src'; import { ConnectorEvents, WalletConnectConnector } from '../../src/connectors'; -import { buildOptions } from '../../src/connectors/wallet-connect'; import { setApplicationLogger } from '../../src/utils/logger'; import { mockLogger } from '../test-logger'; @@ -13,7 +12,10 @@ const ACCOUNT = '0xf61B443A155b07D2b2cAeA2d99715dC84E839EEf'; jest.createMockFromModule('@celo/wallet-walletconnect-v1'); -const wallet = new WalletConnectWallet({}); +const wallet = new WalletConnectWallet({ + chainId: 4220, + projectId: 'f597db9e215becf1a4b24a7154c26fa2', +}); jest.spyOn(wallet, 'init').mockImplementation(async function init() { return Promise.resolve(undefined); @@ -59,7 +61,7 @@ describe('WalletConnectConnector', () => { Alfajores, false, CeloContract.GoldToken, - buildOptions(Alfajores), + { chainId: 4220, projectId: 'cbd4dfc72c388f372fc45f003becb013' }, false, (x: string) => x, 1, diff --git a/packages/react-celo/__tests__/modals/connect.test.tsx b/packages/react-celo/__tests__/modals/connect.test.tsx index c81a8c02..c4b8b7f3 100644 --- a/packages/react-celo/__tests__/modals/connect.test.tsx +++ b/packages/react-celo/__tests__/modals/connect.test.tsx @@ -21,8 +21,8 @@ describe('ConnectModal', () => { describe('when given reactModalProps', () => { let dom: RenderResult; describe('style.overlay', () => { - beforeEach(() => { - act(() => { + beforeEach(async () => { + await act(() => { dom = renderComponentInCKProvider( { }); const button = await dom.findByText('Connect'); - act(() => { + await act(() => { fireEvent.click(button); }); @@ -311,13 +311,13 @@ describe('CeloProvider', () => { }); }); - it('updates the current theme', () => { + it('updates the current theme', async () => { const { result, rerender } = renderUseCeloInternal({}); // FIXME Need to determine behavior when network is not in networks expect(result.current.network).toEqual(Mainnet); - act(() => { + await act(() => { result.current.updateTheme(defaultTheme.light); }); diff --git a/packages/react-celo/src/components/connector-screen.tsx b/packages/react-celo/src/components/connector-screen.tsx index 869d94a3..42c716e5 100644 --- a/packages/react-celo/src/components/connector-screen.tsx +++ b/packages/react-celo/src/components/connector-screen.tsx @@ -52,12 +52,7 @@ const styles = cls({ tw-font-medium`, }); -export default function ConnectorScreen({ - title, - content, - footer, - wcUri, -}: Props) { +export default function ConnectorScreen({ title, content, footer }: Props) { const theme = useTheme(); return ( @@ -86,6 +81,3 @@ export default function ConnectorScreen({ ); } - -// 296.500 -// 248.762 diff --git a/packages/react-celo/src/connectors/wallet-connect.ts b/packages/react-celo/src/connectors/wallet-connect.ts index 3d4b986e..47858793 100644 --- a/packages/react-celo/src/connectors/wallet-connect.ts +++ b/packages/react-celo/src/connectors/wallet-connect.ts @@ -80,13 +80,13 @@ export default class WalletConnectConnector } } - async startNetworkChangeFromApp(network: Network) { + startNetworkChangeFromApp(network: Network) { try { const wallet = this.kit.getWallet() as WalletConnectWallet; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - const resp = await wallet.switchToChain({ + const resp = wallet.switchToChain({ ...network, networkId: network.chainId, }); @@ -266,5 +266,3 @@ export default class WalletConnectConnector } } } - -const END_MESSAGE = '[react-celo] WC SESSION ENDED BY DAPP'; diff --git a/packages/walletconnect/test/utils/common.ts b/packages/walletconnect/__tests__/utils/common.ts similarity index 100% rename from packages/walletconnect/test/utils/common.ts rename to packages/walletconnect/__tests__/utils/common.ts diff --git a/packages/walletconnect/test/utils/in-memory-wallet.ts b/packages/walletconnect/__tests__/utils/in-memory-wallet.ts similarity index 96% rename from packages/walletconnect/test/utils/in-memory-wallet.ts rename to packages/walletconnect/__tests__/utils/in-memory-wallet.ts index 57aca9da..f21c57e8 100644 --- a/packages/walletconnect/test/utils/in-memory-wallet.ts +++ b/packages/walletconnect/__tests__/utils/in-memory-wallet.ts @@ -1,13 +1,8 @@ import { CeloTx, EncodedTransaction } from '@celo/connect'; import { newKit } from '@celo/contractkit/lib/mini-kit'; import { toChecksumAddress } from '@celo/utils/lib/address'; -import WalletConnect, { SIGN_CLIENT_EVENTS } from '@walletconnect/sign-client'; -import { - EngineTypes, - PairingTypes, - SessionTypes, - SignClientTypes, -} from '@walletconnect/types'; +import WalletConnect from '@walletconnect/sign-client'; +import { EngineTypes, SignClientTypes } from '@walletconnect/types'; import { getSdkError } from '@walletconnect/utils'; import debugConfig from 'debug'; diff --git a/packages/walletconnect/test/utils/mock-client.ts b/packages/walletconnect/__tests__/utils/mock-client.ts similarity index 100% rename from packages/walletconnect/test/utils/mock-client.ts rename to packages/walletconnect/__tests__/utils/mock-client.ts diff --git a/packages/walletconnect/test/wc-signer.test.ts b/packages/walletconnect/__tests__/wc-signer.test.ts similarity index 97% rename from packages/walletconnect/test/wc-signer.test.ts rename to packages/walletconnect/__tests__/wc-signer.test.ts index b4055b30..05419b8b 100644 --- a/packages/walletconnect/test/wc-signer.test.ts +++ b/packages/walletconnect/__tests__/wc-signer.test.ts @@ -22,7 +22,6 @@ import { testAddress, testPrivateKey, } from './utils/in-memory-wallet'; -import { MockWalletConnectClient } from './utils/mock-client'; const CHAIN_ID = 44378; const TYPED_DATA = { @@ -79,9 +78,6 @@ const testTx = { }; const decryptMessage = 'Hello'; -const walletConnectBridge = process.env.WALLET_CONNECT_BRIDGE; -const E2E = !!walletConnectBridge; - describe('WalletConnectWallet tests', () => { const wallet = new WalletConnectWallet({ init: { @@ -89,6 +85,7 @@ describe('WalletConnectWallet tests', () => { logger: 'error', }, projectId: '3ee9bf02f3a89a03837044fc7cdeb232', + chainId: 4220, }); const testWallet: { init: (uri: string) => void; diff --git a/packages/walletconnect/src/types.ts b/packages/walletconnect/src/types.ts index b80f1fe2..a82000ab 100644 --- a/packages/walletconnect/src/types.ts +++ b/packages/walletconnect/src/types.ts @@ -1,4 +1,5 @@ -import { SignClientTypes, SessionTypes } from '@walletconnect/types'; +import { SessionTypes, SignClientTypes } from '@walletconnect/types'; + export enum SupportedMethods { accounts = 'eth_accounts', signTransaction = 'eth_signTransaction', diff --git a/packages/walletconnect/tsconfig.json b/packages/walletconnect/tsconfig.json index 8c4f237a..6785c085 100644 --- a/packages/walletconnect/tsconfig.json +++ b/packages/walletconnect/tsconfig.json @@ -5,12 +5,7 @@ "noEmit": false, "declaration": true, "declarationMap": true, - "sourceMap": true, - "typeRoots": [ - "./src/global", - "./node_modules/@types", - "../../node_modules/@types" - ] + "sourceMap": true }, "include": ["src/"] } diff --git a/packages/walletconnect/tsconfig.spec.json b/packages/walletconnect/tsconfig.spec.json index 43ec0231..9755773c 100644 --- a/packages/walletconnect/tsconfig.spec.json +++ b/packages/walletconnect/tsconfig.spec.json @@ -1,11 +1,4 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "lib", - "noEmit": false, - "declaration": true, - "declarationMap": true, - "sourceMap": true - }, - "include": ["src/test/"] + "include": ["__tests__"] }