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

Commit

Permalink
chore: eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasbrugneaux committed Feb 13, 2023
1 parent aadd0bf commit 35af8f0
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 48 deletions.
10 changes: 6 additions & 4 deletions packages/react-celo/__tests__/connectors/walletconnect.test.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
/* 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';

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);
Expand Down Expand Up @@ -59,7 +61,7 @@ describe('WalletConnectConnector', () => {
Alfajores,
false,
CeloContract.GoldToken,
buildOptions(Alfajores),
{ chainId: 4220, projectId: 'cbd4dfc72c388f372fc45f003becb013' },
false,
(x: string) => x,
1,
Expand Down
4 changes: 2 additions & 2 deletions packages/react-celo/__tests__/modals/connect.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ describe('ConnectModal', () => {
describe('when given reactModalProps', () => {
let dom: RenderResult;
describe('style.overlay', () => {
beforeEach(() => {
act(() => {
beforeEach(async () => {
await act(() => {
dom = renderComponentInCKProvider(
<ConnectModal
reactModalProps={{
Expand Down
6 changes: 3 additions & 3 deletions packages/react-celo/__tests__/react-celo-provider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('CeloProvider', () => {
});

const button = await dom.findByText('Connect');
act(() => {
await act(() => {
fireEvent.click(button);
});

Expand Down Expand Up @@ -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);
});

Expand Down
10 changes: 1 addition & 9 deletions packages/react-celo/src/components/connector-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -86,6 +81,3 @@ export default function ConnectorScreen({
</div>
);
}

// 296.500
// 248.762
6 changes: 2 additions & 4 deletions packages/react-celo/src/connectors/wallet-connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down Expand Up @@ -266,5 +266,3 @@ export default class WalletConnectConnector
}
}
}

const END_MESSAGE = '[react-celo] WC SESSION ENDED BY DAPP';
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -79,16 +78,14 @@ const testTx = {
};
const decryptMessage = 'Hello';

const walletConnectBridge = process.env.WALLET_CONNECT_BRIDGE;
const E2E = !!walletConnectBridge;

describe('WalletConnectWallet tests', () => {
const wallet = new WalletConnectWallet({
init: {
relayUrl: 'wss://relay.walletconnect.com',
logger: 'error',
},
projectId: '3ee9bf02f3a89a03837044fc7cdeb232',
chainId: 4220,
});
const testWallet: {
init: (uri: string) => void;
Expand Down
3 changes: 2 additions & 1 deletion packages/walletconnect/src/types.ts
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
7 changes: 1 addition & 6 deletions packages/walletconnect/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/"]
}
9 changes: 1 addition & 8 deletions packages/walletconnect/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "lib",
"noEmit": false,
"declaration": true,
"declarationMap": true,
"sourceMap": true
},
"include": ["src/test/"]
"include": ["__tests__"]
}

0 comments on commit 35af8f0

Please sign in to comment.