Skip to content

Commit 6bb6186

Browse files
committed
dashboard: updated prettier
1 parent fc40540 commit 6bb6186

35 files changed

+749
-1040
lines changed

dashboard/config-overrides.js

+34-34
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { ProvidePlugin } = require("webpack");
1+
const { ProvidePlugin } = require('webpack');
22

33
module.exports = function override(config, env) {
44
return {
@@ -9,57 +9,57 @@ module.exports = function override(config, env) {
99
...config.module.rules,
1010
{
1111
test: /\.js$/,
12-
enforce: "pre",
13-
use: ["source-map-loader"],
12+
enforce: 'pre',
13+
use: ['source-map-loader'],
1414
resolve: {
1515
fullySpecified: false,
1616
},
1717
},
1818
{
1919
test: /\.wasm$/,
20-
type: "webassembly/async",
20+
type: 'webassembly/async',
2121
},
2222
],
2323
},
2424
plugins: [
2525
...config.plugins,
2626
new ProvidePlugin({
27-
Buffer: ["buffer", "Buffer"],
28-
process: "process/browser",
27+
Buffer: ['buffer', 'Buffer'],
28+
process: 'process/browser',
2929
}),
3030
],
3131
resolve: {
3232
...config.resolve,
3333
fallback: {
34-
assert: "assert",
35-
buffer: "buffer",
36-
console: "console-browserify",
37-
constants: "constants-browserify",
38-
crypto: "crypto-browserify",
39-
domain: "domain-browser",
40-
events: "events",
34+
assert: 'assert',
35+
buffer: 'buffer',
36+
console: 'console-browserify',
37+
constants: 'constants-browserify',
38+
crypto: 'crypto-browserify',
39+
domain: 'domain-browser',
40+
events: 'events',
4141
fs: false,
42-
http: "stream-http",
43-
https: "https-browserify",
44-
os: "os-browserify/browser",
45-
path: "path-browserify",
46-
punycode: "punycode",
47-
process: "process/browser",
48-
querystring: "querystring-es3",
49-
stream: "stream-browserify",
50-
_stream_duplex: "readable-stream/duplex",
51-
_stream_passthrough: "readable-stream/passthrough",
52-
_stream_readable: "readable-stream/readable",
53-
_stream_transform: "readable-stream/transform",
54-
_stream_writable: "readable-stream/writable",
55-
string_decoder: "string_decoder",
56-
sys: "util",
57-
timers: "timers-browserify",
58-
tty: "tty-browserify",
59-
url: "url",
60-
util: "util",
61-
vm: "vm-browserify",
62-
zlib: "browserify-zlib",
42+
http: 'stream-http',
43+
https: 'https-browserify',
44+
os: 'os-browserify/browser',
45+
path: 'path-browserify',
46+
punycode: 'punycode',
47+
process: 'process/browser',
48+
querystring: 'querystring-es3',
49+
stream: 'stream-browserify',
50+
_stream_duplex: 'readable-stream/duplex',
51+
_stream_passthrough: 'readable-stream/passthrough',
52+
_stream_readable: 'readable-stream/readable',
53+
_stream_transform: 'readable-stream/transform',
54+
_stream_writable: 'readable-stream/writable',
55+
string_decoder: 'string_decoder',
56+
sys: 'util',
57+
timers: 'timers-browserify',
58+
tty: 'tty-browserify',
59+
url: 'url',
60+
util: 'util',
61+
vm: 'vm-browserify',
62+
zlib: 'browserify-zlib',
6363
},
6464
},
6565
experiments: {

dashboard/public/index.html

+5-26
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,14 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1" />
66
<meta name="description" content="A dashboard for monitoring Wormhole" />
77
<meta name="theme-color" content="#ffffff" />
8-
<link
9-
rel="apple-touch-icon"
10-
sizes="180x180"
11-
href="%PUBLIC_URL%/apple-touch-icon.png"
12-
/>
13-
<link
14-
rel="icon"
15-
type="image/png"
16-
sizes="32x32"
17-
href="%PUBLIC_URL%/favicon-32x32.png"
18-
/>
19-
<link
20-
rel="icon"
21-
type="image/png"
22-
sizes="16x16"
23-
href="%PUBLIC_URL%/favicon-16x16.png"
24-
/>
8+
<link rel="apple-touch-icon" sizes="180x180" href="%PUBLIC_URL%/apple-touch-icon.png" />
9+
<link rel="icon" type="image/png" sizes="32x32" href="%PUBLIC_URL%/favicon-32x32.png" />
10+
<link rel="icon" type="image/png" sizes="16x16" href="%PUBLIC_URL%/favicon-16x16.png" />
2511
<link rel="manifest" href="%PUBLIC_URL%/site.webmanifest" />
26-
<link
27-
rel="mask-icon"
28-
href="%PUBLIC_URL%/safari-pinned-tab.svg"
29-
color="#5bbad5"
30-
/>
12+
<link rel="mask-icon" href="%PUBLIC_URL%/safari-pinned-tab.svg" color="#5bbad5" />
3113
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
3214
<meta name="msapplication-TileColor" content="#da532c" />
33-
<meta
34-
name="msapplication-config"
35-
content="%PUBLIC_URL%/browserconfig.xml"
36-
/>
15+
<meta name="msapplication-config" content="%PUBLIC_URL%/browserconfig.xml" />
3716
<title>Wormhole Dashboard</title>
3817
</head>
3918
<body>

dashboard/public/site.webmanifest

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{
2-
"name": "",
3-
"short_name": "",
4-
"icons": [
5-
{
6-
"src": "https://certusone.github.io/wormhole-dashboard/android-chrome-192x192.png",
7-
"sizes": "192x192",
8-
"type": "image/png"
9-
},
10-
{
11-
"src": "https://certusone.github.io/wormhole-dashboard/android-chrome-512x512.png",
12-
"sizes": "512x512",
13-
"type": "image/png"
14-
}
15-
],
16-
"theme_color": "#ffffff",
17-
"background_color": "#ffffff",
18-
"display": "standalone"
2+
"name": "",
3+
"short_name": "",
4+
"icons": [
5+
{
6+
"src": "https://certusone.github.io/wormhole-dashboard/android-chrome-192x192.png",
7+
"sizes": "192x192",
8+
"type": "image/png"
9+
},
10+
{
11+
"src": "https://certusone.github.io/wormhole-dashboard/android-chrome-512x512.png",
12+
"sizes": "512x512",
13+
"type": "image/png"
14+
}
15+
],
16+
"theme_color": "#ffffff",
17+
"background_color": "#ffffff",
18+
"display": "standalone"
1919
}

dashboard/src/App.tsx

+9-16
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
1-
import { GitHub } from "@mui/icons-material";
2-
import {
3-
AppBar,
4-
Box,
5-
CssBaseline,
6-
IconButton,
7-
Toolbar,
8-
Typography,
9-
} from "@mui/material";
10-
import CustomThemeProvider from "./components/CustomThemeProvider";
11-
import Main from "./components/Main";
12-
import NetworkSelector from "./components/NetworkSelector";
13-
import Settings from "./components/Settings";
14-
import { NetworkContextProvider } from "./contexts/NetworkContext";
15-
import { SettingsContextProvider } from "./contexts/SettingsContext";
16-
import WormholeStatsIcon from "./icons/WormholeStatsIcon";
1+
import { GitHub } from '@mui/icons-material';
2+
import { AppBar, Box, CssBaseline, IconButton, Toolbar, Typography } from '@mui/material';
3+
import CustomThemeProvider from './components/CustomThemeProvider';
4+
import Main from './components/Main';
5+
import NetworkSelector from './components/NetworkSelector';
6+
import Settings from './components/Settings';
7+
import { NetworkContextProvider } from './contexts/NetworkContext';
8+
import { SettingsContextProvider } from './contexts/SettingsContext';
9+
import WormholeStatsIcon from './icons/WormholeStatsIcon';
1710

1811
function App() {
1912
return (

dashboard/src/components/Accountant.tsx

+34-47
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
import { Box, Card, LinearProgress, Tooltip, Typography } from "@mui/material";
1+
import { Box, Card, LinearProgress, Tooltip, Typography } from '@mui/material';
22
import {
33
createColumnHelper,
44
getCoreRowModel,
55
getPaginationRowModel,
66
getSortedRowModel,
77
SortingState,
88
useReactTable,
9-
} from "@tanstack/react-table";
10-
import { useMemo, useState } from "react";
11-
import { useSettingsContext } from "../contexts/SettingsContext";
9+
} from '@tanstack/react-table';
10+
import { useMemo, useState } from 'react';
11+
import { useSettingsContext } from '../contexts/SettingsContext';
1212
import useGetAccountantPendingTransfers, {
1313
PendingTransfer,
14-
} from "../hooks/useGetAccountantPendingTransfers";
15-
import chainIdToName from "../utils/chainIdToName";
16-
import { GUARDIAN_SET_3 } from "../utils/consts";
17-
import Table from "./Table";
14+
} from '../hooks/useGetAccountantPendingTransfers';
15+
import chainIdToName from '../utils/chainIdToName';
16+
import { GUARDIAN_SET_3 } from '../utils/consts';
17+
import Table from './Table';
1818

1919
function getNumSignatures(signatures: string) {
2020
let bitfield = Number(signatures);
@@ -27,18 +27,18 @@ function getNumSignatures(signatures: string) {
2727
}
2828

2929
function getSignatureBits(signatures: string) {
30-
return Number(signatures).toString(2).padStart(GUARDIAN_SET_3.length, "0");
30+
return Number(signatures).toString(2).padStart(GUARDIAN_SET_3.length, '0');
3131
}
3232

3333
function getGuardiansFromSignatures(signatures: string) {
3434
const guardians: string[] = [];
3535
const bitString = getSignatureBits(signatures);
3636
for (let idx = 0; idx < bitString.length; idx++) {
37-
if (bitString[idx] === "1") {
37+
if (bitString[idx] === '1') {
3838
guardians.push(GUARDIAN_SET_3[bitString.length - 1 - idx].name);
3939
}
4040
}
41-
return guardians.reverse().join(", ");
41+
return guardians.reverse().join(', ');
4242
}
4343

4444
type GuardianSigningStat = {
@@ -58,11 +58,11 @@ const calculatePercent = (stat: GuardianSigningStat): number => {
5858
const guardianSigningColumnHelper = createColumnHelper<GuardianSigningStat>();
5959

6060
const guardianSigningColumns = [
61-
guardianSigningColumnHelper.accessor("name", {
62-
header: () => "Guardian",
61+
guardianSigningColumnHelper.accessor('name', {
62+
header: () => 'Guardian',
6363
sortingFn: `text`,
6464
}),
65-
guardianSigningColumnHelper.accessor("numSigned", {
65+
guardianSigningColumnHelper.accessor('numSigned', {
6666
header: () => <Box order="1">Signed</Box>,
6767
cell: (info) => (
6868
<Box textAlign="right">
@@ -71,20 +71,14 @@ const guardianSigningColumns = [
7171
),
7272
}),
7373
guardianSigningColumnHelper.accessor(calculatePercent, {
74-
id: "progress",
75-
header: () => "Progress",
74+
id: 'progress',
75+
header: () => 'Progress',
7676
cell: (info) => (
7777
<Tooltip title={`${info.getValue().toFixed(2)}%`} arrow>
7878
<LinearProgress
7979
variant="determinate"
8080
value={info.getValue()}
81-
color={
82-
info.getValue() > 90
83-
? "success"
84-
: info.getValue() > 50
85-
? "warning"
86-
: "error"
87-
}
81+
color={info.getValue() > 90 ? 'success' : info.getValue() > 50 ? 'warning' : 'error'}
8882
/>
8983
</Tooltip>
9084
),
@@ -94,33 +88,29 @@ const guardianSigningColumns = [
9488
const pendingTransferColumnHelper = createColumnHelper<PendingTransfer>();
9589

9690
const pendingTransferColumns = [
97-
pendingTransferColumnHelper.accessor("key.emitter_chain", {
98-
header: () => "Chain",
91+
pendingTransferColumnHelper.accessor('key.emitter_chain', {
92+
header: () => 'Chain',
9993
cell: (info) => `${chainIdToName(info.getValue())} (${info.getValue()})`,
10094
sortingFn: `text`,
10195
}),
102-
pendingTransferColumnHelper.accessor("key.emitter_address", {
103-
header: () => "Emitter",
96+
pendingTransferColumnHelper.accessor('key.emitter_address', {
97+
header: () => 'Emitter',
10498
}),
105-
pendingTransferColumnHelper.accessor("key.sequence", {
106-
header: () => "Sequence",
99+
pendingTransferColumnHelper.accessor('key.sequence', {
100+
header: () => 'Sequence',
107101
}),
108-
pendingTransferColumnHelper.accessor("data.0.tx_hash", {
109-
header: () => "Tx",
110-
cell: (info) => Buffer.from(info.getValue(), "base64").toString("hex"),
102+
pendingTransferColumnHelper.accessor('data.0.tx_hash', {
103+
header: () => 'Tx',
104+
cell: (info) => Buffer.from(info.getValue(), 'base64').toString('hex'),
111105
}),
112-
pendingTransferColumnHelper.accessor("data.0.signatures", {
113-
header: () => "Signatures",
106+
pendingTransferColumnHelper.accessor('data.0.signatures', {
107+
header: () => 'Signatures',
114108
cell: (info) => (
115109
<Tooltip
116110
title={
117111
<Box>
118-
<Typography gutterBottom>
119-
{getGuardiansFromSignatures(info.getValue())}
120-
</Typography>
121-
<Typography gutterBottom>
122-
{getSignatureBits(info.getValue())}
123-
</Typography>
112+
<Typography gutterBottom>{getGuardiansFromSignatures(info.getValue())}</Typography>
113+
<Typography gutterBottom>{getSignatureBits(info.getValue())}</Typography>
124114
</Box>
125115
}
126116
>
@@ -144,15 +134,14 @@ function Accountant() {
144134
for (const transfer of pendingTransferInfo) {
145135
const bitString = getSignatureBits(transfer.data[0].signatures);
146136
for (let idx = 0; idx < bitString.length; idx++) {
147-
if (bitString[idx] === "1") {
137+
if (bitString[idx] === '1') {
148138
stats[bitString.length - 1 - idx].numSigned += 1;
149139
}
150140
}
151141
}
152142
return stats;
153143
}, [pendingTransferInfo]);
154-
const [guardianSigningSorting, setGuardianSigningSorting] =
155-
useState<SortingState>([]);
144+
const [guardianSigningSorting, setGuardianSigningSorting] = useState<SortingState>([]);
156145
const guardianSigning = useReactTable({
157146
columns: guardianSigningColumns,
158147
data: guardianSigningStats,
@@ -164,8 +153,7 @@ function Accountant() {
164153
getSortedRowModel: getSortedRowModel(),
165154
onSortingChange: setGuardianSigningSorting,
166155
});
167-
const [pendingTransferSorting, setPendingTransferSorting] =
168-
useState<SortingState>([]);
156+
const [pendingTransferSorting, setPendingTransferSorting] = useState<SortingState>([]);
169157
const pendingTransfer = useReactTable({
170158
columns: pendingTransferColumns,
171159
data: pendingTransferInfo,
@@ -181,8 +169,7 @@ function Accountant() {
181169
});
182170
return !wormchainUrl ? (
183171
<Typography sx={{ p: 2 }}>
184-
Wormchain URL unset. Please configure in the settings to enable accountant
185-
info.
172+
Wormchain URL unset. Please configure in the settings to enable accountant info.
186173
</Typography>
187174
) : (
188175
<>

0 commit comments

Comments
 (0)