chore:(deps): bump typescript from 4.0.5 to 4.1.3 in /explorer (#14284)
* chore:(deps): bump typescript from 4.0.5 to 4.1.3 in /explorer Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.0.5 to 4.1.3. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](https://github.com/Microsoft/TypeScript/compare/v4.0.5...v4.1.3) Signed-off-by: dependabot[bot] <support@github.com> * bump Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Justin Starry <justin@solana.com>
This commit is contained in:
parent
9f28758efa
commit
b87d6cd03d
|
@ -17,6 +17,7 @@
|
|||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
.eslintcache
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
|
|
|
@ -18334,9 +18334,9 @@
|
|||
}
|
||||
},
|
||||
"typescript": {
|
||||
"version": "4.0.5",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.5.tgz",
|
||||
"integrity": "sha512-ywmr/VrTVCmNTJ6iV2LwIrfG1P+lv6luD8sUJs+2eI9NLGigaN+nUQc13iHqisq7bra9lnmUSYqbJvegraBOPQ=="
|
||||
"version": "4.1.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.3.tgz",
|
||||
"integrity": "sha512-B3ZIOf1IKeH2ixgHhj6la6xdwR9QrLC5d1VKeCSY4tvkqhF2eqd9O7txNlS0PO3GrBAFIdr3L1ndNwteUbZLYg=="
|
||||
},
|
||||
"unicode-canonical-property-names-ecmascript": {
|
||||
"version": "1.0.4",
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
"react-scripts": "^4.0.1",
|
||||
"react-select": "^3.1.1",
|
||||
"superstruct": "github:solana-labs/superstruct",
|
||||
"typescript": "^4.0.5"
|
||||
"typescript": "^4.1.3"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
|
|
|
@ -12,7 +12,6 @@ import { ClusterStatsPage } from "pages/ClusterStatsPage";
|
|||
import { SupplyPage } from "pages/SupplyPage";
|
||||
import { TransactionDetailsPage } from "pages/TransactionDetailsPage";
|
||||
import { BlockDetailsPage } from "pages/BlockDetailsPage";
|
||||
import { UnlockAlert } from "components/UnlockAlert";
|
||||
|
||||
const ADDRESS_ALIASES = ["account", "accounts", "addresses"];
|
||||
const TX_ALIASES = ["txs", "txn", "txns", "transaction", "transactions"];
|
||||
|
|
|
@ -1,97 +0,0 @@
|
|||
import React from "react";
|
||||
|
||||
import { Connection } from "@solana/web3.js";
|
||||
import { useCluster, Cluster } from "providers/cluster";
|
||||
|
||||
const CLUSTER_SYNC_INTERVAL = 30000;
|
||||
|
||||
export function displayTimestamp(unixTimestamp: number): string {
|
||||
const expireDate = new Date(unixTimestamp);
|
||||
const dateString = new Intl.DateTimeFormat("en-US", {
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
timeZone: "UTC",
|
||||
}).format(expireDate);
|
||||
const timeString = new Intl.DateTimeFormat("en-US", {
|
||||
hour: "numeric",
|
||||
minute: "numeric",
|
||||
hour12: false,
|
||||
timeZone: "UTC",
|
||||
}).format(expireDate);
|
||||
return `${dateString} ${timeString}`;
|
||||
}
|
||||
|
||||
export function UnlockAlert() {
|
||||
const { cluster, url } = useCluster();
|
||||
const [active, setActive] = React.useState(false);
|
||||
const [blockTime, setBlockTime] = React.useState<number | null>(null);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!active || !url) {
|
||||
return;
|
||||
}
|
||||
|
||||
const connection = new Connection(url);
|
||||
const getBlockTime = async () => {
|
||||
try {
|
||||
const epochInfo = await connection.getEpochInfo();
|
||||
const blockTime = await connection.getBlockTime(epochInfo.absoluteSlot);
|
||||
if (blockTime !== null) {
|
||||
setBlockTime(blockTime);
|
||||
}
|
||||
} catch (error) {}
|
||||
};
|
||||
|
||||
getBlockTime();
|
||||
|
||||
const blockTimeInterval = setInterval(getBlockTime, CLUSTER_SYNC_INTERVAL);
|
||||
const secondInterval = setInterval(() => {
|
||||
setBlockTime((time) => (time !== null ? time + 1 : null));
|
||||
}, 1000);
|
||||
|
||||
return () => {
|
||||
clearInterval(blockTimeInterval);
|
||||
clearInterval(secondInterval);
|
||||
};
|
||||
}, [active, url]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (cluster !== Cluster.MainnetBeta) {
|
||||
return;
|
||||
}
|
||||
|
||||
setActive(true);
|
||||
return () => {
|
||||
setActive(false);
|
||||
};
|
||||
}, [setActive, cluster]);
|
||||
|
||||
if (cluster !== Cluster.MainnetBeta || blockTime === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="alert alert-secondary text-center">
|
||||
<p className="mb-1">
|
||||
An unlock event is scheduled for January 7, 2021 00:00 cluster time.
|
||||
</p>
|
||||
<p className="mb-1">
|
||||
Cluster time is currently {displayTimestamp(blockTime * 1000)}.
|
||||
</p>
|
||||
<p className="mb-0">
|
||||
More information can be found{" "}
|
||||
<u>
|
||||
<a
|
||||
href="https://solana.com/transparency"
|
||||
className="text-white font-weight-bold"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
here
|
||||
</a>
|
||||
</u>
|
||||
.
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
|
@ -13,7 +13,7 @@
|
|||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"jsx": "react",
|
||||
"jsx": "react-jsx",
|
||||
"baseUrl": "src",
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue