Skip to content

Commit 52d3edb

Browse files
heyitakievan-gray
authored andcommitted
prettier: reduce line length to 100
i was wrong and airbnb was right
1 parent 1447e51 commit 52d3edb

File tree

8 files changed

+39
-13
lines changed

8 files changed

+39
-13
lines changed

.prettierrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"singleQuote": true,
3-
"printWidth": 120
3+
"printWidth": 100
44
}

watcher/src/chains/evm.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ import { EVM_RPCS_BY_CHAIN } from '../consts';
55
import { makeBlockKey, makeVaaKey, VaasByBlock } from '../db';
66
import { Watcher } from '../watch';
77

8-
export type EVMProvider = ethers.providers.JsonRpcProvider | ethers.providers.JsonRpcBatchProvider | CeloProvider;
8+
export type EVMProvider =
9+
| ethers.providers.JsonRpcProvider
10+
| ethers.providers.JsonRpcBatchProvider
11+
| CeloProvider;
912

1013
const wormholeInterface = ethers_contracts.Implementation__factory.createInterface();
1114

watcher/src/chains/polygon.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ export class PolygonWatcher extends EVMWatcher {
99
}
1010
async getFinalizedBlockNumber(): Promise<number | null> {
1111
console.log('fetching Polygon last child block from Ethereum');
12-
const rootChain = new ethers.utils.Interface([`function getLastChildBlock() external view returns (uint256)`]);
12+
const rootChain = new ethers.utils.Interface([
13+
`function getLastChildBlock() external view returns (uint256)`,
14+
]);
1315
const callData = rootChain.encodeFunctionData('getLastChildBlock');
1416
try {
1517
const callResult = (

watcher/src/consts.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ export const EVM_RPCS_BY_CHAIN: { [key in ChainName]?: string } = {
3434
export const POLYGON_ROOT_CHAIN_RPC = 'https://rpc.ankr.com/eth';
3535
export const POLYGON_ROOT_CHAIN_ADDRESS = '0x86E4Dc95c7FBdBf52e33D563BbDB00823894C287';
3636

37-
export const getMaximumBatchSize = (chain: ChainName): number => (chain === 'acala' || chain === 'karura' ? 50 : 100);
37+
export const getMaximumBatchSize = (chain: ChainName): number =>
38+
chain === 'acala' || chain === 'karura' ? 50 : 100;
3839

3940
export const INITIAL_DEPLOYMENT_BLOCK_BY_CHAIN: {
4041
[key in ChainName]?: string;

watcher/src/db.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@ export const loadDb = (): void => {
2020
// TODO: should this be a composite key or should the value become more complex
2121
export const makeBlockKey = (block: string, timestamp: string): string => `${block}/${timestamp}`;
2222

23-
export const makeVaaKey = (transactionHash: string, chain: ChainId | ChainName, emitter: string, seq: string): string =>
24-
`${transactionHash}:${coalesceChainId(chain)}/${emitter}/${seq}`;
23+
export const makeVaaKey = (
24+
transactionHash: string,
25+
chain: ChainId | ChainName,
26+
emitter: string,
27+
seq: string
28+
): string => `${transactionHash}:${coalesceChainId(chain)}/${emitter}/${seq}`;
2529

2630
export const storeVaasByBlock = (chain: ChainName, vaasByBlock: VaasByBlock): void => {
2731
const chainId = coalesceChainId(chain);

watcher/src/watch.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ const createWatcherByChain: {
5858
export async function watch(chain: ChainName) {
5959
const watcher = createWatcherByChain[chain]();
6060
let toBlock: number | null = await watcher.getFinalizedBlockNumber();
61-
const lastReadBlock: string | null = getLastBlockByChain(chain) || INITIAL_DEPLOYMENT_BLOCK_BY_CHAIN[chain] || null;
61+
const lastReadBlock: string | null =
62+
getLastBlockByChain(chain) || INITIAL_DEPLOYMENT_BLOCK_BY_CHAIN[chain] || null;
6263
let fromBlock: number | null = lastReadBlock !== null ? Number(lastReadBlock) : toBlock;
6364
while (true) {
6465
if (fromBlock && toBlock && fromBlock <= toBlock) {

web/src/App.tsx

+18-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
import { ChainId, coalesceChainName } from '@certusone/wormhole-sdk/lib/esm/utils/consts';
22
import { CheckBox, CheckBoxOutlineBlank, Launch } from '@mui/icons-material';
3-
import { Box, Button, CircularProgress, IconButton, SxProps, Theme, Tooltip, Typography } from '@mui/material';
3+
import {
4+
Box,
5+
Button,
6+
CircularProgress,
7+
IconButton,
8+
SxProps,
9+
Theme,
10+
Tooltip,
11+
Typography,
12+
} from '@mui/material';
413
import axios from 'axios';
514
import React, { useCallback, useEffect, useMemo, useState } from 'react';
615
import CollapsibleSection from './CollapsibleSection';
@@ -74,7 +83,12 @@ function BlockDetail({ chain, block, vaas }: { chain: string; block: string; vaa
7483
</Typography>
7584
<Typography variant="body2" sx={{ fontFamily: 'monospace', ml: 1 }} gutterBottom>
7685
{vaa.split(':')[1]}{' '}
77-
<IconButton href={explorerVaa(vaa.split(':')[1])} target="_blank" size="small" sx={inlineIconButtonSx}>
86+
<IconButton
87+
href={explorerVaa(vaa.split(':')[1])}
88+
target="_blank"
89+
size="small"
90+
sx={inlineIconButtonSx}
91+
>
7892
<Launch fontSize="inherit" />
7993
</IconButton>
8094
</Typography>
@@ -262,7 +276,8 @@ function App() {
262276
} = {};
263277
Object.entries(db).forEach(([chain, vaasByBlock]) => {
264278
const entries = Object.entries(vaasByBlock);
265-
const [lastIndexedBlockNumber, lastIndexedBlockTime] = entries[entries.length - 1][0].split('/');
279+
const [lastIndexedBlockNumber, lastIndexedBlockTime] =
280+
entries[entries.length - 1][0].split('/');
266281
metaByChain[chain] = {
267282
lastIndexedBlockNumber,
268283
lastIndexedBlockTime,

web/src/utils.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,6 @@ export const explorerTx = (chainId: ChainId, tx: string) =>
114114
: '';
115115

116116
export const explorerVaa = (key: string) =>
117-
`https://wormhole.com/explorer/?emitterChain=${key.split('/')[0]}&emitterAddress=${key.split('/')[1]}&sequence=${
118-
key.split('/')[2]
119-
}`;
117+
`https://wormhole.com/explorer/?emitterChain=${key.split('/')[0]}&emitterAddress=${
118+
key.split('/')[1]
119+
}&sequence=${key.split('/')[2]}`;

0 commit comments

Comments
 (0)