chore: run latest prettier

This commit is contained in:
Justin Starry 2020-06-24 16:07:47 +08:00 committed by Justin Starry
parent 6171b55f50
commit ad75f08c43
50 changed files with 1055 additions and 1047 deletions

View File

@ -5,8 +5,8 @@ module.exports = function override(config, env) {
config.resolve.extensions.push(".wasm"); config.resolve.extensions.push(".wasm");
config.module.rules.forEach(rule => { config.module.rules.forEach((rule) => {
(rule.oneOf || []).forEach(oneOf => { (rule.oneOf || []).forEach((oneOf) => {
if (oneOf.loader && oneOf.loader.indexOf("file-loader") >= 0) { if (oneOf.loader && oneOf.loader.indexOf("file-loader") >= 0) {
// Make file-loader ignore WASM files // Make file-loader ignore WASM files
oneOf.exclude.push(wasmExtensionRegExp); oneOf.exclude.push(wasmExtensionRegExp);
@ -18,7 +18,7 @@ module.exports = function override(config, env) {
config.module.rules.push({ config.module.rules.push({
test: wasmExtensionRegExp, test: wasmExtensionRegExp,
include: path.resolve(__dirname, "src"), include: path.resolve(__dirname, "src"),
use: [{ loader: require.resolve("wasm-loader"), options: {} }] use: [{ loader: require.resolve("wasm-loader"), options: {} }],
}); });
return config; return config;

View File

@ -24,7 +24,10 @@ function App() {
<div className="row align-items-end"> <div className="row align-items-end">
<div className="col"> <div className="col">
<Link <Link
to={location => ({ ...pickCluster(location), pathname: "/" })} to={(location) => ({
...pickCluster(location),
pathname: "/",
})}
> >
<img src={Logo} width="250" alt="Solana Explorer" /> <img src={Logo} width="250" alt="Solana Explorer" />
</Link> </Link>
@ -49,14 +52,14 @@ function App() {
></Route> ></Route>
<Route <Route
exact exact
path={TX_ALIASES.flatMap(tx => [tx, tx + "s"]).map( path={TX_ALIASES.flatMap((tx) => [tx, tx + "s"]).map(
tx => `/${tx}/:signature` (tx) => `/${tx}/:signature`
)} )}
render={({ match }) => ( render={({ match }) => (
<TransactionDetails signature={match.params.signature} /> <TransactionDetails signature={match.params.signature} />
)} )}
/> />
<Route exact path={TX_ALIASES.map(tx => `/${tx}s`)}> <Route exact path={TX_ALIASES.map((tx) => `/${tx}s`)}>
<TabbedPage tab="Transactions"> <TabbedPage tab="Transactions">
<TransactionsCard /> <TransactionsCard />
</TabbedPage> </TabbedPage>
@ -64,13 +67,16 @@ function App() {
<Route <Route
exact exact
path={ACCOUNT_ALIASES.concat(ACCOUNT_ALIASES_PLURAL).map( path={ACCOUNT_ALIASES.concat(ACCOUNT_ALIASES_PLURAL).map(
account => `/${account}/:address` (account) => `/${account}/:address`
)} )}
render={({ match }) => ( render={({ match }) => (
<AccountDetails address={match.params.address} /> <AccountDetails address={match.params.address} />
)} )}
/> />
<Route exact path={ACCOUNT_ALIASES_PLURAL.map(alias => "/" + alias)}> <Route
exact
path={ACCOUNT_ALIASES_PLURAL.map((alias) => "/" + alias)}
>
<TabbedPage tab="Accounts"> <TabbedPage tab="Accounts">
<AccountsCard /> <AccountsCard />
</TabbedPage> </TabbedPage>

View File

@ -9,7 +9,7 @@ import {
useFetchAccountInfo, useFetchAccountInfo,
useAccountInfo, useAccountInfo,
useAccountHistory, useAccountHistory,
Account Account,
} from "providers/accounts"; } from "providers/accounts";
import { lamportsToSolString } from "utils"; import { lamportsToSolString } from "utils";
import Copyable from "./Copyable"; import Copyable from "./Copyable";
@ -50,8 +50,8 @@ export default function AccountDetails({ address }: Props) {
<input <input
type="text" type="text"
value={search} value={search}
onChange={e => setSearch(e.target.value)} onChange={(e) => setSearch(e.target.value)}
onKeyUp={e => e.key === "Enter" && updateAddress()} onKeyUp={(e) => e.key === "Enter" && updateAddress()}
className="form-control form-control-prepended search text-monospace" className="form-control form-control-prepended search text-monospace"
placeholder="Search for address" placeholder="Search for address"
/> />
@ -252,9 +252,9 @@ function HistoryCard({ pubkey }: { pubkey: PublicKey }) {
<td> <td>
<Link <Link
to={location => ({ to={(location) => ({
...location, ...location,
pathname: "/tx/" + signature pathname: "/tx/" + signature,
})} })}
className="btn btn-rounded-circle btn-white btn-sm" className="btn btn-rounded-circle btn-white btn-sm"
> >

View File

@ -4,7 +4,7 @@ import {
useAccounts, useAccounts,
Account, Account,
FetchStatus, FetchStatus,
useFetchAccountInfo useFetchAccountInfo,
} from "../providers/accounts"; } from "../providers/accounts";
import { assertUnreachable } from "../utils"; import { assertUnreachable } from "../utils";
import { displayAddress } from "../utils/tx"; import { displayAddress } from "../utils/tx";
@ -68,10 +68,10 @@ function AccountsCard() {
<input <input
type="text" type="text"
onInput={() => setError("")} onInput={() => setError("")}
onKeyDown={e => onKeyDown={(e) =>
e.keyCode === 13 && onNew(e.currentTarget.value) e.keyCode === 13 && onNew(e.currentTarget.value)
} }
onSubmit={e => onNew(e.currentTarget.value)} onSubmit={(e) => onNew(e.currentTarget.value)}
ref={addressInput} ref={addressInput}
className={`form-control text-address text-monospace ${ className={`form-control text-address text-monospace ${
error ? "is-invalid" : "" error ? "is-invalid" : ""
@ -85,7 +85,7 @@ function AccountsCard() {
<td>-</td> <td>-</td>
<td></td> <td></td>
</tr> </tr>
{accounts.map(account => renderAccountRow(account))} {accounts.map((account) => renderAccountRow(account))}
</tbody> </tbody>
</table> </table>
</div> </div>
@ -172,9 +172,9 @@ const renderAccountRow = (account: Account) => {
</td> </td>
<td> <td>
<Link <Link
to={location => ({ to={(location) => ({
...location, ...location,
pathname: "/account/" + base58AccountPubkey pathname: "/account/" + base58AccountPubkey,
})} })}
className="btn btn-rounded-circle btn-white btn-sm" className="btn btn-rounded-circle btn-white btn-sm"
> >

View File

@ -11,7 +11,7 @@ import {
CLUSTERS, CLUSTERS,
Cluster, Cluster,
useClusterModal, useClusterModal,
useUpdateCustomUrl useUpdateCustomUrl,
} from "../providers/cluster"; } from "../providers/cluster";
import { assertUnreachable } from "../utils"; import { assertUnreachable } from "../utils";
import Overlay from "./Overlay"; import Overlay from "./Overlay";
@ -28,7 +28,7 @@ function ClusterModal() {
> >
<div className="modal-dialog modal-dialog-vertical"> <div className="modal-dialog modal-dialog-vertical">
<div className="modal-content"> <div className="modal-content">
<div className="modal-body" onClick={e => e.stopPropagation()}> <div className="modal-body" onClick={(e) => e.stopPropagation()}>
<span className="c-pointer" onClick={onClose}> <span className="c-pointer" onClick={onClose}>
&times; &times;
</span> </span>
@ -62,7 +62,7 @@ function CustomClusterInput({ activeSuffix, active }: InputProps) {
if (customUrl.length > 0) query.set("cluster", "custom"); if (customUrl.length > 0) query.set("cluster", "custom");
return { return {
...location, ...location,
search: query.toString() search: query.toString(),
}; };
}; };
@ -77,7 +77,7 @@ function CustomClusterInput({ activeSuffix, active }: InputProps) {
const inputTextClass = editing ? "" : "text-muted"; const inputTextClass = editing ? "" : "text-muted";
return ( return (
<Link <Link
to={location => clusterLocation(location)} to={(location) => clusterLocation(location)}
className="btn input-group input-group-merge p-0" className="btn input-group input-group-merge p-0"
> >
<input <input
@ -88,7 +88,7 @@ function CustomClusterInput({ activeSuffix, active }: InputProps) {
)}`} )}`}
onFocus={() => setEditing(true)} onFocus={() => setEditing(true)}
onBlur={() => setEditing(false)} onBlur={() => setEditing(false)}
onInput={e => onUrlInput(e.currentTarget.value)} onInput={(e) => onUrlInput(e.currentTarget.value)}
/> />
<div className="input-group-prepend"> <div className="input-group-prepend">
<div className={`input-group-text pr-0 ${customClass("border")}`}> <div className={`input-group-text pr-0 ${customClass("border")}`}>
@ -144,7 +144,7 @@ function ClusterToggle() {
} }
return { return {
...location, ...location,
search: params.toString() search: params.toString(),
}; };
}; };

View File

@ -3,7 +3,7 @@ import { useCluster, ClusterStatus, Cluster } from "../providers/cluster";
function ClusterStatusButton({ function ClusterStatusButton({
onClick, onClick,
expand expand,
}: { }: {
onClick: () => void; onClick: () => void;
expand?: boolean; expand?: boolean;

View File

@ -12,7 +12,7 @@ type State = "hide" | "copy" | "copied";
function Popover({ function Popover({
state, state,
bottom, bottom,
right right,
}: { }: {
state: State; state: State;
bottom?: boolean; bottom?: boolean;

View File

@ -13,7 +13,7 @@ function Popover({
state, state,
bottom, bottom,
right, right,
text text,
}: { }: {
state: State; state: State;
bottom?: boolean; bottom?: boolean;

View File

@ -52,7 +52,7 @@ export default function TabbedPage({ children, tab }: Props) {
function NavLink({ function NavLink({
href, href,
tab, tab,
current current,
}: { }: {
href: string; href: string;
tab: Tab; tab: Tab;
@ -65,7 +65,7 @@ function NavLink({
return ( return (
<Link <Link
to={location => ({ ...pickCluster(location), pathname: href })} to={(location) => ({ ...pickCluster(location), pathname: href })}
className={classes} className={classes}
> >
{tab} {tab}

View File

@ -77,7 +77,7 @@ export default function TopAccountsCard() {
<div className="col-auto"> <div className="col-auto">
<FilterDropdown <FilterDropdown
filter={filter} filter={filter}
toggle={() => setDropdown(show => !show)} toggle={() => setDropdown((show) => !show)}
show={showDropdown} show={showDropdown}
/> />
</div> </div>
@ -127,9 +127,9 @@ const renderAccountRow = (
<td>{`${((100 * account.lamports) / supply).toFixed(3)}%`}</td> <td>{`${((100 * account.lamports) / supply).toFixed(3)}%`}</td>
<td> <td>
<Link <Link
to={location => ({ to={(location) => ({
...location, ...location,
pathname: "/account/" + base58AccountPubkey pathname: "/account/" + base58AccountPubkey,
})} })}
className="btn btn-rounded-circle btn-white btn-sm" className="btn btn-rounded-circle btn-white btn-sm"
> >
@ -185,7 +185,7 @@ const FilterDropdown = ({ filter, toggle, show }: DropdownProps) => {
} }
return { return {
...location, ...location,
search: params.toString() search: params.toString(),
}; };
}; };
@ -202,11 +202,11 @@ const FilterDropdown = ({ filter, toggle, show }: DropdownProps) => {
<div <div
className={`dropdown-menu-right dropdown-menu${show ? " show" : ""}`} className={`dropdown-menu-right dropdown-menu${show ? " show" : ""}`}
> >
{FILTERS.map(filterOption => { {FILTERS.map((filterOption) => {
return ( return (
<Link <Link
key={filterOption || "null"} key={filterOption || "null"}
to={location => buildLocation(location, filterOption)} to={(location) => buildLocation(location, filterOption)}
className={`dropdown-item${ className={`dropdown-item${
filterOption === filter ? " active" : "" filterOption === filter ? " active" : ""
}`} }`}

View File

@ -3,7 +3,7 @@ import {
useFetchTransactionStatus, useFetchTransactionStatus,
useTransactionStatus, useTransactionStatus,
useTransactionDetails, useTransactionDetails,
FetchStatus FetchStatus,
} from "../providers/transactions"; } from "../providers/transactions";
import { useFetchTransactionDetails } from "providers/transactions/details"; import { useFetchTransactionDetails } from "providers/transactions/details";
import { useCluster, useClusterModal } from "providers/cluster"; import { useCluster, useClusterModal } from "providers/cluster";
@ -11,7 +11,7 @@ import {
TransactionSignature, TransactionSignature,
SystemProgram, SystemProgram,
StakeProgram, StakeProgram,
SystemInstruction SystemInstruction,
} from "@solana/web3.js"; } from "@solana/web3.js";
import ClusterStatusButton from "components/ClusterStatusButton"; import ClusterStatusButton from "components/ClusterStatusButton";
import { lamportsToSolString } from "utils"; import { lamportsToSolString } from "utils";
@ -49,8 +49,8 @@ export default function TransactionDetails({ signature }: Props) {
<input <input
type="text" type="text"
value={search} value={search}
onChange={e => setSearch(e.target.value)} onChange={(e) => setSearch(e.target.value)}
onKeyUp={e => e.key === "Enter" && updateSignature()} onKeyUp={(e) => e.key === "Enter" && updateSignature()}
className="form-control form-control-prepended search text-monospace" className="form-control form-control-prepended search text-monospace"
placeholder="Search for signature" placeholder="Search for signature"
/> />
@ -293,7 +293,7 @@ function AccountsCard({ signature }: Props) {
{index < message.header.numRequiredSignatures && ( {index < message.header.numRequiredSignatures && (
<span className="badge badge-soft-dark mr-1">Signer</span> <span className="badge badge-soft-dark mr-1">Signer</span>
)} )}
{message.instructions.find(ix => ix.programIdIndex === index) && ( {message.instructions.find((ix) => ix.programIdIndex === index) && (
<span className="badge badge-soft-dark mr-1">Program</span> <span className="badge badge-soft-dark mr-1">Program</span>
)} )}
</td> </td>

View File

@ -4,7 +4,7 @@ import {
useTransactions, useTransactions,
TransactionStatus, TransactionStatus,
FetchStatus, FetchStatus,
useFetchTransactionStatus useFetchTransactionStatus,
} from "../providers/transactions"; } from "../providers/transactions";
import bs58 from "bs58"; import bs58 from "bs58";
import { assertUnreachable } from "../utils"; import { assertUnreachable } from "../utils";
@ -71,10 +71,10 @@ function TransactionsCard() {
<input <input
type="text" type="text"
onInput={() => setError("")} onInput={() => setError("")}
onKeyDown={e => onKeyDown={(e) =>
e.keyCode === 13 && onNew(e.currentTarget.value) e.keyCode === 13 && onNew(e.currentTarget.value)
} }
onSubmit={e => onNew(e.currentTarget.value)} onSubmit={(e) => onNew(e.currentTarget.value)}
ref={signatureInput} ref={signatureInput}
className={`form-control text-signature text-monospace ${ className={`form-control text-signature text-monospace ${
error ? "is-invalid" : "" error ? "is-invalid" : ""
@ -87,7 +87,9 @@ function TransactionsCard() {
<td>-</td> <td>-</td>
<td></td> <td></td>
</tr> </tr>
{transactions.map(transaction => renderTransactionRow(transaction))} {transactions.map((transaction) =>
renderTransactionRow(transaction)
)}
</tbody> </tbody>
</table> </table>
</div> </div>
@ -162,7 +164,7 @@ const renderTransactionRow = (transactionStatus: TransactionStatus) => {
<td>{slotText}</td> <td>{slotText}</td>
<td> <td>
<Link <Link
to={location => ({ ...location, pathname: "/tx/" + signature })} to={(location) => ({ ...location, pathname: "/tx/" + signature })}
className="btn btn-rounded-circle btn-white btn-sm" className="btn btn-rounded-circle btn-white btn-sm"
> >
<span className="fe fe-arrow-right"></span> <span className="fe fe-arrow-right"></span>

View File

@ -9,7 +9,7 @@ import { Account, useFetchAccountInfo } from "providers/accounts";
export function StakeAccountCards({ export function StakeAccountCards({
account, account,
stakeAccount stakeAccount,
}: { }: {
account: Account; account: Account;
stakeAccount: StakeAccount; stakeAccount: StakeAccount;
@ -40,7 +40,7 @@ function LockupCard({ stakeAccount }: { stakeAccount: StakeAccount }) {
function OverviewCard({ function OverviewCard({
account, account,
stakeAccount stakeAccount,
}: { }: {
account: Account; account: Account;
stakeAccount: StakeAccount; stakeAccount: StakeAccount;

View File

@ -4,7 +4,7 @@ export default function ErrorCard({
retry, retry,
retryText, retryText,
text, text,
subtext subtext,
}: { }: {
retry?: () => void; retry?: () => void;
retryText?: string; retryText?: string;

View File

@ -1,7 +1,7 @@
import React from "react"; import React from "react";
export default function TableCardBody({ export default function TableCardBody({
children children,
}: { }: {
children: React.ReactNode; children: React.ReactNode;
}) { }) {

View File

@ -17,7 +17,7 @@ export function InstructionCard({
result, result,
index, index,
ix, ix,
defaultRaw defaultRaw,
}: InstructionProps) { }: InstructionProps) {
const [resultClass] = ixResult(result, index); const [resultClass] = ixResult(result, index);
const [showRaw, setShowRaw] = React.useState(defaultRaw || false); const [showRaw, setShowRaw] = React.useState(defaultRaw || false);
@ -36,7 +36,7 @@ export function InstructionCard({
className={`btn btn-sm d-flex ${ className={`btn btn-sm d-flex ${
showRaw ? "btn-dark active" : "btn-white" showRaw ? "btn-dark active" : "btn-white"
}`} }`}
onClick={() => setShowRaw(r => !r)} onClick={() => setShowRaw((r) => !r)}
> >
<span className="fe fe-code mr-1"></span> <span className="fe fe-code mr-1"></span>
Raw Raw

View File

@ -5,7 +5,7 @@ import { InstructionCard } from "./InstructionCard";
export function UnknownDetailsCard({ export function UnknownDetailsCard({
ix, ix,
index, index,
result result,
}: { }: {
ix: TransactionInstruction; ix: TransactionInstruction;
index: number; index: number;

View File

@ -3,7 +3,7 @@ import {
TransactionInstruction, TransactionInstruction,
SignatureResult, SignatureResult,
StakeInstruction, StakeInstruction,
StakeProgram StakeProgram,
} from "@solana/web3.js"; } from "@solana/web3.js";
import { displayAddress } from "utils/tx"; import { displayAddress } from "utils/tx";
import { InstructionCard } from "../InstructionCard"; import { InstructionCard } from "../InstructionCard";

View File

@ -3,7 +3,7 @@ import {
TransactionInstruction, TransactionInstruction,
SignatureResult, SignatureResult,
StakeInstruction, StakeInstruction,
StakeProgram StakeProgram,
} from "@solana/web3.js"; } from "@solana/web3.js";
import { displayAddress } from "utils/tx"; import { displayAddress } from "utils/tx";
import { InstructionCard } from "../InstructionCard"; import { InstructionCard } from "../InstructionCard";

View File

@ -3,7 +3,7 @@ import {
TransactionInstruction, TransactionInstruction,
SignatureResult, SignatureResult,
StakeInstruction, StakeInstruction,
StakeProgram StakeProgram,
} from "@solana/web3.js"; } from "@solana/web3.js";
import { displayAddress } from "utils/tx"; import { displayAddress } from "utils/tx";
import { InstructionCard } from "../InstructionCard"; import { InstructionCard } from "../InstructionCard";

View File

@ -4,7 +4,7 @@ import {
SignatureResult, SignatureResult,
StakeInstruction, StakeInstruction,
StakeProgram, StakeProgram,
SystemProgram SystemProgram,
} from "@solana/web3.js"; } from "@solana/web3.js";
import { displayAddress } from "utils/tx"; import { displayAddress } from "utils/tx";
import { InstructionCard } from "../InstructionCard"; import { InstructionCard } from "../InstructionCard";

View File

@ -3,7 +3,7 @@ import {
TransactionInstruction, TransactionInstruction,
SignatureResult, SignatureResult,
StakeInstruction, StakeInstruction,
StakeProgram StakeProgram,
} from "@solana/web3.js"; } from "@solana/web3.js";
import { displayAddress } from "utils/tx"; import { displayAddress } from "utils/tx";
import { lamportsToSolString } from "utils"; import { lamportsToSolString } from "utils";

View File

@ -2,7 +2,7 @@ import React from "react";
import { import {
StakeInstruction, StakeInstruction,
TransactionInstruction, TransactionInstruction,
SignatureResult SignatureResult,
} from "@solana/web3.js"; } from "@solana/web3.js";
import { UnknownDetailsCard } from "../UnknownDetailsCard"; import { UnknownDetailsCard } from "../UnknownDetailsCard";

View File

@ -3,7 +3,7 @@ import {
TransactionInstruction, TransactionInstruction,
SignatureResult, SignatureResult,
StakeInstruction, StakeInstruction,
StakeProgram StakeProgram,
} from "@solana/web3.js"; } from "@solana/web3.js";
import { lamportsToSolString } from "utils"; import { lamportsToSolString } from "utils";
import { displayAddress } from "utils/tx"; import { displayAddress } from "utils/tx";

View File

@ -3,7 +3,7 @@ import {
TransactionInstruction, TransactionInstruction,
SystemProgram, SystemProgram,
SignatureResult, SignatureResult,
SystemInstruction SystemInstruction,
} from "@solana/web3.js"; } from "@solana/web3.js";
import { displayAddress } from "utils/tx"; import { displayAddress } from "utils/tx";
import { InstructionCard } from "../InstructionCard"; import { InstructionCard } from "../InstructionCard";

View File

@ -3,7 +3,7 @@ import {
TransactionInstruction, TransactionInstruction,
SystemProgram, SystemProgram,
SignatureResult, SignatureResult,
SystemInstruction SystemInstruction,
} from "@solana/web3.js"; } from "@solana/web3.js";
import { displayAddress } from "utils/tx"; import { displayAddress } from "utils/tx";
import { InstructionCard } from "../InstructionCard"; import { InstructionCard } from "../InstructionCard";

View File

@ -3,7 +3,7 @@ import {
TransactionInstruction, TransactionInstruction,
SystemProgram, SystemProgram,
SignatureResult, SignatureResult,
SystemInstruction SystemInstruction,
} from "@solana/web3.js"; } from "@solana/web3.js";
import { displayAddress } from "utils/tx"; import { displayAddress } from "utils/tx";
import { InstructionCard } from "../InstructionCard"; import { InstructionCard } from "../InstructionCard";

View File

@ -3,7 +3,7 @@ import {
TransactionInstruction, TransactionInstruction,
SystemProgram, SystemProgram,
SignatureResult, SignatureResult,
SystemInstruction SystemInstruction,
} from "@solana/web3.js"; } from "@solana/web3.js";
import { displayAddress } from "utils/tx"; import { displayAddress } from "utils/tx";
import { InstructionCard } from "../InstructionCard"; import { InstructionCard } from "../InstructionCard";

View File

@ -3,7 +3,7 @@ import {
TransactionInstruction, TransactionInstruction,
SystemProgram, SystemProgram,
SignatureResult, SignatureResult,
SystemInstruction SystemInstruction,
} from "@solana/web3.js"; } from "@solana/web3.js";
import { lamportsToSolString } from "utils"; import { lamportsToSolString } from "utils";
import { displayAddress } from "utils/tx"; import { displayAddress } from "utils/tx";

View File

@ -3,7 +3,7 @@ import {
TransactionInstruction, TransactionInstruction,
SystemProgram, SystemProgram,
SignatureResult, SignatureResult,
SystemInstruction SystemInstruction,
} from "@solana/web3.js"; } from "@solana/web3.js";
import { lamportsToSolString } from "utils"; import { lamportsToSolString } from "utils";
import { displayAddress } from "utils/tx"; import { displayAddress } from "utils/tx";

View File

@ -3,7 +3,7 @@ import {
TransactionInstruction, TransactionInstruction,
SystemProgram, SystemProgram,
SignatureResult, SignatureResult,
SystemInstruction SystemInstruction,
} from "@solana/web3.js"; } from "@solana/web3.js";
import { displayAddress } from "utils/tx"; import { displayAddress } from "utils/tx";
import { InstructionCard } from "../InstructionCard"; import { InstructionCard } from "../InstructionCard";

View File

@ -3,7 +3,7 @@ import {
TransactionInstruction, TransactionInstruction,
SystemProgram, SystemProgram,
SignatureResult, SignatureResult,
SystemInstruction SystemInstruction,
} from "@solana/web3.js"; } from "@solana/web3.js";
import { displayAddress } from "utils/tx"; import { displayAddress } from "utils/tx";
import { InstructionCard } from "../InstructionCard"; import { InstructionCard } from "../InstructionCard";

View File

@ -3,7 +3,7 @@ import {
TransactionInstruction, TransactionInstruction,
SystemProgram, SystemProgram,
SignatureResult, SignatureResult,
SystemInstruction SystemInstruction,
} from "@solana/web3.js"; } from "@solana/web3.js";
import { displayAddress } from "utils/tx"; import { displayAddress } from "utils/tx";
import { InstructionCard } from "../InstructionCard"; import { InstructionCard } from "../InstructionCard";

View File

@ -3,7 +3,7 @@ import {
TransactionInstruction, TransactionInstruction,
SystemProgram, SystemProgram,
SignatureResult, SignatureResult,
SystemInstruction SystemInstruction,
} from "@solana/web3.js"; } from "@solana/web3.js";
import { displayAddress } from "utils/tx"; import { displayAddress } from "utils/tx";
import { lamportsToSolString } from "utils"; import { lamportsToSolString } from "utils";

View File

@ -2,7 +2,7 @@ import React from "react";
import { import {
SystemInstruction, SystemInstruction,
TransactionInstruction, TransactionInstruction,
SignatureResult SignatureResult,
} from "@solana/web3.js"; } from "@solana/web3.js";
import { UnknownDetailsCard } from "../UnknownDetailsCard"; import { UnknownDetailsCard } from "../UnknownDetailsCard";

View File

@ -3,7 +3,7 @@ import {
TransactionInstruction, TransactionInstruction,
SystemProgram, SystemProgram,
SignatureResult, SignatureResult,
SystemInstruction SystemInstruction,
} from "@solana/web3.js"; } from "@solana/web3.js";
import { lamportsToSolString } from "utils"; import { lamportsToSolString } from "utils";
import { displayAddress } from "utils/tx"; import { displayAddress } from "utils/tx";

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@ import { useCluster } from "../cluster";
import { import {
HistoryManager, HistoryManager,
HistoricalTransaction, HistoricalTransaction,
SlotRange SlotRange,
} from "./historyManager"; } from "./historyManager";
interface AccountHistory { interface AccountHistory {
@ -19,7 +19,7 @@ type State = { [address: string]: AccountHistory };
export enum ActionType { export enum ActionType {
Update, Update,
Add, Add,
Remove Remove,
} }
interface Update { interface Update {
@ -48,10 +48,10 @@ function reducer(state: State, action: Action): State {
case ActionType.Add: { case ActionType.Add: {
if (action.addresses.length === 0) return state; if (action.addresses.length === 0) return state;
const details = { ...state }; const details = { ...state };
action.addresses.forEach(address => { action.addresses.forEach((address) => {
if (!details[address]) { if (!details[address]) {
details[address] = { details[address] = {
status: FetchStatus.Fetching status: FetchStatus.Fetching,
}; };
} }
}); });
@ -61,7 +61,7 @@ function reducer(state: State, action: Action): State {
case ActionType.Remove: { case ActionType.Remove: {
if (action.addresses.length === 0) return state; if (action.addresses.length === 0) return state;
const details = { ...state }; const details = { ...state };
action.addresses.forEach(address => { action.addresses.forEach((address) => {
delete details[address]; delete details[address];
}); });
return details; return details;
@ -81,8 +81,8 @@ function reducer(state: State, action: Action): State {
[address]: { [address]: {
status: action.status, status: action.status,
fetched, fetched,
fetchedRange fetchedRange,
} },
}; };
} }
break; break;
@ -121,16 +121,16 @@ export function HistoryProvider({ children }: HistoryProviderProps) {
}); });
const removeList: string[] = []; const removeList: string[] = [];
removeAddresses.forEach(address => { removeAddresses.forEach((address) => {
manager.current.removeAccountHistory(address); manager.current.removeAccountHistory(address);
removeList.push(address); removeList.push(address);
}); });
dispatch({ type: ActionType.Remove, addresses: removeList }); dispatch({ type: ActionType.Remove, addresses: removeList });
const fetchList: string[] = []; const fetchList: string[] = [];
fetchAddresses.forEach(s => fetchList.push(s)); fetchAddresses.forEach((s) => fetchList.push(s));
dispatch({ type: ActionType.Add, addresses: fetchList }); dispatch({ type: ActionType.Add, addresses: fetchList });
fetchAddresses.forEach(address => { fetchAddresses.forEach((address) => {
fetchAccountHistory( fetchAccountHistory(
dispatch, dispatch,
new PublicKey(address), new PublicKey(address),
@ -160,7 +160,7 @@ async function fetchAccountHistory(
dispatch({ dispatch({
type: ActionType.Update, type: ActionType.Update,
status: FetchStatus.Fetching, status: FetchStatus.Fetching,
pubkey pubkey,
}); });
let status; let status;

View File

@ -2,7 +2,7 @@ import {
TransactionSignature, TransactionSignature,
Connection, Connection,
PublicKey, PublicKey,
SignatureStatus SignatureStatus,
} from "@solana/web3.js"; } from "@solana/web3.js";
const MAX_STATUS_BATCH_SIZE = 256; const MAX_STATUS_BATCH_SIZE = 256;
@ -101,7 +101,7 @@ export class HistoryManager {
range.min = Math.max(nextRange.min - slotLookBack, fullRange.min); range.min = Math.max(nextRange.min - slotLookBack, fullRange.min);
nextRange = { nextRange = {
min: range.min, min: range.min,
max: nextRange.min - 1 max: nextRange.min - 1,
}; };
} }
@ -111,14 +111,14 @@ export class HistoryManager {
const batch = signatures.splice(0, MAX_STATUS_BATCH_SIZE); const batch = signatures.splice(0, MAX_STATUS_BATCH_SIZE);
const statuses = ( const statuses = (
await this.connection.getSignatureStatuses(batch, { await this.connection.getSignatureStatuses(batch, {
searchTransactionHistory: true searchTransactionHistory: true,
}) })
).value; ).value;
statuses.forEach((status, index) => { statuses.forEach((status, index) => {
if (status !== null) { if (status !== null) {
transactions.push({ transactions.push({
signature: batch[index], signature: batch[index],
status status,
}); });
} }
}); });

View File

@ -9,7 +9,7 @@ export { useAccountHistory } from "./history";
export enum FetchStatus { export enum FetchStatus {
Fetching, Fetching,
FetchFailed, FetchFailed,
Fetched Fetched,
} }
export interface Details { export interface Details {
@ -35,7 +35,7 @@ interface State {
export enum ActionType { export enum ActionType {
Update, Update,
Fetch Fetch,
} }
interface Update { interface Update {
@ -67,8 +67,8 @@ function reducer(state: State, action: Action): State {
[address]: { [address]: {
id: account.id, id: account.id,
pubkey: account.pubkey, pubkey: account.pubkey,
status: FetchStatus.Fetching status: FetchStatus.Fetching,
} },
}; };
return { ...state, accounts }; return { ...state, accounts };
} else { } else {
@ -78,8 +78,8 @@ function reducer(state: State, action: Action): State {
[address]: { [address]: {
id: idCounter, id: idCounter,
status: FetchStatus.Fetching, status: FetchStatus.Fetching,
pubkey: action.pubkey pubkey: action.pubkey,
} },
}; };
return { ...state, accounts, idCounter }; return { ...state, accounts, idCounter };
} }
@ -93,8 +93,8 @@ function reducer(state: State, action: Action): State {
...state.accounts, ...state.accounts,
[address]: { [address]: {
...account, ...account,
...action.data ...action.data,
} },
}; };
return { ...state, accounts }; return { ...state, accounts };
} }
@ -114,30 +114,30 @@ type AccountsProviderProps = { children: React.ReactNode };
export function AccountsProvider({ children }: AccountsProviderProps) { export function AccountsProvider({ children }: AccountsProviderProps) {
const [state, dispatch] = React.useReducer(reducer, { const [state, dispatch] = React.useReducer(reducer, {
idCounter: 0, idCounter: 0,
accounts: {} accounts: {},
}); });
const { status, url } = useCluster(); const { status, url } = useCluster();
// Check account statuses on startup and whenever cluster updates // Check account statuses on startup and whenever cluster updates
React.useEffect(() => { React.useEffect(() => {
Object.keys(state.accounts).forEach(address => { Object.keys(state.accounts).forEach((address) => {
fetchAccountInfo(dispatch, new PublicKey(address), url, status); fetchAccountInfo(dispatch, new PublicKey(address), url, status);
}); });
}, [status, url]); // eslint-disable-line react-hooks/exhaustive-deps }, [status, url]); // eslint-disable-line react-hooks/exhaustive-deps
const query = useQuery(); const query = useQuery();
const values = ACCOUNT_ALIASES.concat(ACCOUNT_ALIASES_PLURAL).map(key => const values = ACCOUNT_ALIASES.concat(ACCOUNT_ALIASES_PLURAL).map((key) =>
query.get(key) query.get(key)
); );
React.useEffect(() => { React.useEffect(() => {
values values
.filter((value): value is string => value !== null) .filter((value): value is string => value !== null)
.flatMap(value => value.split(",")) .flatMap((value) => value.split(","))
// Remove duplicates // Remove duplicates
.filter((item, pos, self) => self.indexOf(item) === pos) .filter((item, pos, self) => self.indexOf(item) === pos)
.filter(address => !state.accounts[address]) .filter((address) => !state.accounts[address])
.forEach(address => { .forEach((address) => {
try { try {
fetchAccountInfo(dispatch, new PublicKey(address), url, status); fetchAccountInfo(dispatch, new PublicKey(address), url, status);
} catch (err) { } catch (err) {
@ -164,7 +164,7 @@ async function fetchAccountInfo(
) { ) {
dispatch({ dispatch({
type: ActionType.Fetch, type: ActionType.Fetch,
pubkey pubkey,
}); });
// We will auto-refetch when status is no longer connecting // We will auto-refetch when status is no longer connecting
@ -196,7 +196,7 @@ async function fetchAccountInfo(
space: result.data.length, space: result.data.length,
executable: result.executable, executable: result.executable,
owner: result.owner, owner: result.owner,
data data,
}; };
} }
fetchStatus = FetchStatus.Fetched; fetchStatus = FetchStatus.Fetched;
@ -217,7 +217,7 @@ export function useAccounts() {
idCounter: context.idCounter, idCounter: context.idCounter,
accounts: Object.values(context.accounts).sort((a, b) => accounts: Object.values(context.accounts).sort((a, b) =>
a.id <= b.id ? 1 : -1 a.id <= b.id ? 1 : -1
) ),
}; };
} }

View File

@ -6,21 +6,21 @@ import { useHistory, useLocation } from "react-router-dom";
export enum ClusterStatus { export enum ClusterStatus {
Connected, Connected,
Connecting, Connecting,
Failure Failure,
} }
export enum Cluster { export enum Cluster {
MainnetBeta, MainnetBeta,
Testnet, Testnet,
Devnet, Devnet,
Custom Custom,
} }
export const CLUSTERS = [ export const CLUSTERS = [
Cluster.MainnetBeta, Cluster.MainnetBeta,
Cluster.Testnet, Cluster.Testnet,
Cluster.Devnet, Cluster.Devnet,
Cluster.Custom Cluster.Custom,
]; ];
export function clusterSlug(cluster: Cluster): string { export function clusterSlug(cluster: Cluster): string {
@ -128,7 +128,7 @@ export function ClusterProvider({ children }: ClusterProviderProps) {
const [state, dispatch] = React.useReducer(clusterReducer, { const [state, dispatch] = React.useReducer(clusterReducer, {
cluster: DEFAULT_CLUSTER, cluster: DEFAULT_CLUSTER,
customUrl: "", customUrl: "",
status: ClusterStatus.Connecting status: ClusterStatus.Connecting,
}); });
const [showModal, setShowModal] = React.useState(false); const [showModal, setShowModal] = React.useState(false);
const query = useQuery(); const query = useQuery();
@ -169,7 +169,7 @@ async function updateCluster(
dispatch({ dispatch({
status: ClusterStatus.Connecting, status: ClusterStatus.Connecting,
cluster, cluster,
customUrl customUrl,
}); });
try { try {
@ -179,7 +179,7 @@ async function updateCluster(
status: ClusterStatus.Connected, status: ClusterStatus.Connected,
cluster, cluster,
customUrl, customUrl,
firstAvailableBlock firstAvailableBlock,
}); });
} catch (error) { } catch (error) {
console.error("Failed to update cluster", error); console.error("Failed to update cluster", error);
@ -206,7 +206,7 @@ export function useCluster() {
return { return {
...context, ...context,
url: clusterUrl(context.cluster, context.customUrl), url: clusterUrl(context.cluster, context.customUrl),
name: clusterName(context.cluster) name: clusterName(context.cluster),
}; };
} }

View File

@ -6,7 +6,7 @@ import { useCluster, ClusterStatus } from "./cluster";
export enum Status { export enum Status {
Idle, Idle,
Disconnected, Disconnected,
Connecting Connecting,
} }
type RichLists = { type RichLists = {
@ -60,12 +60,12 @@ async function fetch(dispatch: Dispatch, url: string) {
await Promise.all([ await Promise.all([
connection.getLargestAccounts(), connection.getLargestAccounts(),
connection.getLargestAccounts({ filter: "circulating" }), connection.getLargestAccounts({ filter: "circulating" }),
connection.getLargestAccounts({ filter: "nonCirculating" }) connection.getLargestAccounts({ filter: "nonCirculating" }),
]) ])
).map(response => response.value); ).map((response) => response.value);
// Update state if still connecting // Update state if still connecting
dispatch(state => { dispatch((state) => {
if (state !== Status.Connecting) return state; if (state !== Status.Connecting) return state;
return { total, circulating, nonCirculating }; return { total, circulating, nonCirculating };
}); });

View File

@ -6,7 +6,7 @@ import { useCluster, ClusterStatus } from "./cluster";
export enum Status { export enum Status {
Idle, Idle,
Disconnected, Disconnected,
Connecting Connecting,
} }
type State = Supply | Status | string; type State = Supply | Status | string;
@ -45,7 +45,7 @@ async function fetch(dispatch: Dispatch, url: string) {
const supply = (await connection.getSupply()).value; const supply = (await connection.getSupply()).value;
// Update state if still connecting // Update state if still connecting
dispatch(state => { dispatch((state) => {
if (state !== Status.Connecting) return state; if (state !== Status.Connecting) return state;
return supply; return supply;
}); });

View File

@ -10,7 +10,7 @@ import {
Transaction, Transaction,
ConfirmedTransaction, ConfirmedTransaction,
Message, Message,
clusterApiUrl clusterApiUrl,
} from "@solana/web3.js"; } from "@solana/web3.js";
export const isCached = (url: string, signature: string): boolean => { export const isCached = (url: string, signature: string): boolean => {
@ -22,44 +22,44 @@ export const CACHED_STATUSES: { [key: string]: TransactionStatusInfo } = {
slot: 10440804, slot: 10440804,
result: { err: null }, result: { err: null },
timestamp: 1589212180, timestamp: 1589212180,
confirmations: "max" confirmations: "max",
}, },
DYrfStEEzbV5sftX8LgUa54Nwnc5m5E1731cqBtiiC66TeXgKpfqZEQTuFY3vhHZ2K1BsaFM3X9FqisR28EtZr8: { DYrfStEEzbV5sftX8LgUa54Nwnc5m5E1731cqBtiiC66TeXgKpfqZEQTuFY3vhHZ2K1BsaFM3X9FqisR28EtZr8: {
slot: 10451288, slot: 10451288,
result: { err: null }, result: { err: null },
timestamp: 1589216984, timestamp: 1589216984,
confirmations: "max" confirmations: "max",
}, },
"3bLx2PLpkxCxJA5P7HVe8asFdSWXVAh1DrxfkqWE9bWvPRxXE2hqwj1vuSC858fUw3XAGQcHbJknhtNdxY2sehab": { "3bLx2PLpkxCxJA5P7HVe8asFdSWXVAh1DrxfkqWE9bWvPRxXE2hqwj1vuSC858fUw3XAGQcHbJknhtNdxY2sehab": {
slot: 10516588, slot: 10516588,
result: { err: null }, result: { err: null },
timestamp: 1589247117, timestamp: 1589247117,
confirmations: "max" confirmations: "max",
}, },
"3fE8xNgyxbwbvA5MX3wM87ahDDgCVEaaMMSa8UCWWNxojaRYBgrQyiKXLSxcryMWb7sEyVLBWyqUaRWnQCroSqjY": { "3fE8xNgyxbwbvA5MX3wM87ahDDgCVEaaMMSa8UCWWNxojaRYBgrQyiKXLSxcryMWb7sEyVLBWyqUaRWnQCroSqjY": {
slot: 10575124, slot: 10575124,
result: { err: null }, result: { err: null },
timestamp: 1589274236, timestamp: 1589274236,
confirmations: "max" confirmations: "max",
}, },
"5PWymGjKV7T1oqeqGn139EHFyjNM2dnNhHCUcfD2bmdj8cfF95HpY1uJ84W89c4sJQnmyZxXcYrcjumx2jHUvxZQ": { "5PWymGjKV7T1oqeqGn139EHFyjNM2dnNhHCUcfD2bmdj8cfF95HpY1uJ84W89c4sJQnmyZxXcYrcjumx2jHUvxZQ": {
slot: 12447825, slot: 12447825,
result: { err: null }, result: { err: null },
timestamp: 15901860565, timestamp: 15901860565,
confirmations: "max" confirmations: "max",
}, },
"5K4KuqTTRNtzfpxWiwnkePzGfsa3tBEmpMy7vQFR3KWFAZNVY9tvoSaz1Yt5dKxcgsZPio2EsASVDGbQB1HvirGD": { "5K4KuqTTRNtzfpxWiwnkePzGfsa3tBEmpMy7vQFR3KWFAZNVY9tvoSaz1Yt5dKxcgsZPio2EsASVDGbQB1HvirGD": {
slot: 12450728, slot: 12450728,
result: { err: null }, result: { err: null },
timestamp: 15901874549, timestamp: 15901874549,
confirmations: "max" confirmations: "max",
}, },
"45pGoC4Rr3fJ1TKrsiRkhHRbdUeX7633XAGVec6XzVdpRbzQgHhe6ZC6Uq164MPWtiqMg7wCkC6Wy3jy2BqsDEKf": { "45pGoC4Rr3fJ1TKrsiRkhHRbdUeX7633XAGVec6XzVdpRbzQgHhe6ZC6Uq164MPWtiqMg7wCkC6Wy3jy2BqsDEKf": {
slot: 12972684, slot: 12972684,
result: { err: null }, result: { err: null },
timestamp: 1590432412, timestamp: 1590432412,
confirmations: "max" confirmations: "max",
} },
}; };
export const CACHED_DETAILS: { [key: string]: ConfirmedTransaction } = { export const CACHED_DETAILS: { [key: string]: ConfirmedTransaction } = {
@ -71,22 +71,22 @@ export const CACHED_DETAILS: { [key: string]: ConfirmedTransaction } = {
accountKeys: [ accountKeys: [
"2ojv9BAiHUrvsm9gxDe7fJSzbNZSJcxZvf8dqmWGHG8S", "2ojv9BAiHUrvsm9gxDe7fJSzbNZSJcxZvf8dqmWGHG8S",
"4C6NCcLPUgGuBBkV2dJW96mrptMUCp3RG1ft9rqwjFi9", "4C6NCcLPUgGuBBkV2dJW96mrptMUCp3RG1ft9rqwjFi9",
"11111111111111111111111111111111" "11111111111111111111111111111111",
], ],
header: { header: {
numReadonlySignedAccounts: 0, numReadonlySignedAccounts: 0,
numReadonlyUnsignedAccounts: 1, numReadonlyUnsignedAccounts: 1,
numRequiredSignatures: 1 numRequiredSignatures: 1,
}, },
instructions: [ instructions: [
{ accounts: [0, 1], data: "3Bxs411UBrj8QXUb", programIdIndex: 2 } { accounts: [0, 1], data: "3Bxs411UBrj8QXUb", programIdIndex: 2 },
], ],
recentBlockhash: "5Aw8MaMYdYtnfJyyrregWMWGgiMtWZ6GtRzeP6Ufo65Z" recentBlockhash: "5Aw8MaMYdYtnfJyyrregWMWGgiMtWZ6GtRzeP6Ufo65Z",
}), }),
[ [
"uQf4pS38FjRF294QFEXizhYkZFjSR9ZSBvvV6MV5b4VpdfRnK3PY9TWZ2qHMQKtte3XwKVLcWqsTF6wL9NEZMty" "uQf4pS38FjRF294QFEXizhYkZFjSR9ZSBvvV6MV5b4VpdfRnK3PY9TWZ2qHMQKtte3XwKVLcWqsTF6wL9NEZMty",
] ]
) ),
}, },
DYrfStEEzbV5sftX8LgUa54Nwnc5m5E1731cqBtiiC66TeXgKpfqZEQTuFY3vhHZ2K1BsaFM3X9FqisR28EtZr8: { DYrfStEEzbV5sftX8LgUa54Nwnc5m5E1731cqBtiiC66TeXgKpfqZEQTuFY3vhHZ2K1BsaFM3X9FqisR28EtZr8: {
@ -97,26 +97,26 @@ export const CACHED_DETAILS: { [key: string]: ConfirmedTransaction } = {
accountKeys: [ accountKeys: [
"2ojv9BAiHUrvsm9gxDe7fJSzbNZSJcxZvf8dqmWGHG8S", "2ojv9BAiHUrvsm9gxDe7fJSzbNZSJcxZvf8dqmWGHG8S",
"4C6NCcLPUgGuBBkV2dJW96mrptMUCp3RG1ft9rqwjFi9", "4C6NCcLPUgGuBBkV2dJW96mrptMUCp3RG1ft9rqwjFi9",
"11111111111111111111111111111111" "11111111111111111111111111111111",
], ],
header: { header: {
numReadonlySignedAccounts: 0, numReadonlySignedAccounts: 0,
numReadonlyUnsignedAccounts: 1, numReadonlyUnsignedAccounts: 1,
numRequiredSignatures: 1 numRequiredSignatures: 1,
}, },
instructions: [ instructions: [
{ {
accounts: [0, 1], accounts: [0, 1],
data: "3Bxs3zwYHuDo723R", data: "3Bxs3zwYHuDo723R",
programIdIndex: 2 programIdIndex: 2,
} },
], ],
recentBlockhash: "4hXYcBdfcadcjfWV17ZwMa4MXe8kbZHYHwr3GzfyqunL" recentBlockhash: "4hXYcBdfcadcjfWV17ZwMa4MXe8kbZHYHwr3GzfyqunL",
}), }),
[ [
"DYrfStEEzbV5sftX8LgUa54Nwnc5m5E1731cqBtiiC66TeXgKpfqZEQTuFY3vhHZ2K1BsaFM3X9FqisR28EtZr8" "DYrfStEEzbV5sftX8LgUa54Nwnc5m5E1731cqBtiiC66TeXgKpfqZEQTuFY3vhHZ2K1BsaFM3X9FqisR28EtZr8",
] ]
) ),
}, },
"3bLx2PLpkxCxJA5P7HVe8asFdSWXVAh1DrxfkqWE9bWvPRxXE2hqwj1vuSC858fUw3XAGQcHbJknhtNdxY2sehab": { "3bLx2PLpkxCxJA5P7HVe8asFdSWXVAh1DrxfkqWE9bWvPRxXE2hqwj1vuSC858fUw3XAGQcHbJknhtNdxY2sehab": {
@ -127,26 +127,26 @@ export const CACHED_DETAILS: { [key: string]: ConfirmedTransaction } = {
accountKeys: [ accountKeys: [
"2ojv9BAiHUrvsm9gxDe7fJSzbNZSJcxZvf8dqmWGHG8S", "2ojv9BAiHUrvsm9gxDe7fJSzbNZSJcxZvf8dqmWGHG8S",
"4C6NCcLPUgGuBBkV2dJW96mrptMUCp3RG1ft9rqwjFi9", "4C6NCcLPUgGuBBkV2dJW96mrptMUCp3RG1ft9rqwjFi9",
"11111111111111111111111111111111" "11111111111111111111111111111111",
], ],
header: { header: {
numReadonlySignedAccounts: 0, numReadonlySignedAccounts: 0,
numReadonlyUnsignedAccounts: 1, numReadonlyUnsignedAccounts: 1,
numRequiredSignatures: 1 numRequiredSignatures: 1,
}, },
instructions: [ instructions: [
{ {
accounts: [0, 1], accounts: [0, 1],
data: "3Bxs3zwYHuDo723R", data: "3Bxs3zwYHuDo723R",
programIdIndex: 2 programIdIndex: 2,
} },
], ],
recentBlockhash: "HSzTGt3PJMeQtFr94gEdeZqTRaBxgS8Wf1zq3MDdNT3L" recentBlockhash: "HSzTGt3PJMeQtFr94gEdeZqTRaBxgS8Wf1zq3MDdNT3L",
}), }),
[ [
"3bLx2PLpkxCxJA5P7HVe8asFdSWXVAh1DrxfkqWE9bWvPRxXE2hqwj1vuSC858fUw3XAGQcHbJknhtNdxY2sehab" "3bLx2PLpkxCxJA5P7HVe8asFdSWXVAh1DrxfkqWE9bWvPRxXE2hqwj1vuSC858fUw3XAGQcHbJknhtNdxY2sehab",
] ]
) ),
}, },
"3fE8xNgyxbwbvA5MX3wM87ahDDgCVEaaMMSa8UCWWNxojaRYBgrQyiKXLSxcryMWb7sEyVLBWyqUaRWnQCroSqjY": { "3fE8xNgyxbwbvA5MX3wM87ahDDgCVEaaMMSa8UCWWNxojaRYBgrQyiKXLSxcryMWb7sEyVLBWyqUaRWnQCroSqjY": {
@ -157,26 +157,26 @@ export const CACHED_DETAILS: { [key: string]: ConfirmedTransaction } = {
accountKeys: [ accountKeys: [
"2ojv9BAiHUrvsm9gxDe7fJSzbNZSJcxZvf8dqmWGHG8S", "2ojv9BAiHUrvsm9gxDe7fJSzbNZSJcxZvf8dqmWGHG8S",
"4C6NCcLPUgGuBBkV2dJW96mrptMUCp3RG1ft9rqwjFi9", "4C6NCcLPUgGuBBkV2dJW96mrptMUCp3RG1ft9rqwjFi9",
"11111111111111111111111111111111" "11111111111111111111111111111111",
], ],
header: { header: {
numReadonlySignedAccounts: 0, numReadonlySignedAccounts: 0,
numReadonlyUnsignedAccounts: 1, numReadonlyUnsignedAccounts: 1,
numRequiredSignatures: 1 numRequiredSignatures: 1,
}, },
instructions: [ instructions: [
{ {
accounts: [0, 1], accounts: [0, 1],
data: "3Bxs3zuKU6mRKSqD", data: "3Bxs3zuKU6mRKSqD",
programIdIndex: 2 programIdIndex: 2,
} },
], ],
recentBlockhash: "6f6TBMhUoypfR5HHnEqC6VoooKxEcNad5W3Sf63j9MSD" recentBlockhash: "6f6TBMhUoypfR5HHnEqC6VoooKxEcNad5W3Sf63j9MSD",
}), }),
[ [
"3fE8xNgyxbwbvA5MX3wM87ahDDgCVEaaMMSa8UCWWNxojaRYBgrQyiKXLSxcryMWb7sEyVLBWyqUaRWnQCroSqjY" "3fE8xNgyxbwbvA5MX3wM87ahDDgCVEaaMMSa8UCWWNxojaRYBgrQyiKXLSxcryMWb7sEyVLBWyqUaRWnQCroSqjY",
] ]
) ),
}, },
"5PWymGjKV7T1oqeqGn139EHFyjNM2dnNhHCUcfD2bmdj8cfF95HpY1uJ84W89c4sJQnmyZxXcYrcjumx2jHUvxZQ": { "5PWymGjKV7T1oqeqGn139EHFyjNM2dnNhHCUcfD2bmdj8cfF95HpY1uJ84W89c4sJQnmyZxXcYrcjumx2jHUvxZQ": {
@ -187,26 +187,26 @@ export const CACHED_DETAILS: { [key: string]: ConfirmedTransaction } = {
accountKeys: [ accountKeys: [
"HCV5dGFJXRrJ3jhDYA4DCeb9TEDTwGGYXtT3wHksu2Zr", "HCV5dGFJXRrJ3jhDYA4DCeb9TEDTwGGYXtT3wHksu2Zr",
"4C6NCcLPUgGuBBkV2dJW96mrptMUCp3RG1ft9rqwjFi9", "4C6NCcLPUgGuBBkV2dJW96mrptMUCp3RG1ft9rqwjFi9",
"11111111111111111111111111111111" "11111111111111111111111111111111",
], ],
header: { header: {
numReadonlySignedAccounts: 0, numReadonlySignedAccounts: 0,
numReadonlyUnsignedAccounts: 1, numReadonlyUnsignedAccounts: 1,
numRequiredSignatures: 1 numRequiredSignatures: 1,
}, },
instructions: [ instructions: [
{ {
accounts: [0, 1], accounts: [0, 1],
data: "3Bxs3zrfhSqZJTR1", data: "3Bxs3zrfhSqZJTR1",
programIdIndex: 2 programIdIndex: 2,
} },
], ],
recentBlockhash: "3HJNFraT7XGAqMrQs83EKwDGB6LpHVwUMQKGaYMNY49E" recentBlockhash: "3HJNFraT7XGAqMrQs83EKwDGB6LpHVwUMQKGaYMNY49E",
}), }),
[ [
"5PWymGjKV7T1oqeqGn139EHFyjNM2dnNhHCUcfD2bmdj8cfF95HpY1uJ84W89c4sJQnmyZxXcYrcjumx2jHUvxZQ" "5PWymGjKV7T1oqeqGn139EHFyjNM2dnNhHCUcfD2bmdj8cfF95HpY1uJ84W89c4sJQnmyZxXcYrcjumx2jHUvxZQ",
] ]
) ),
}, },
"5K4KuqTTRNtzfpxWiwnkePzGfsa3tBEmpMy7vQFR3KWFAZNVY9tvoSaz1Yt5dKxcgsZPio2EsASVDGbQB1HvirGD": { "5K4KuqTTRNtzfpxWiwnkePzGfsa3tBEmpMy7vQFR3KWFAZNVY9tvoSaz1Yt5dKxcgsZPio2EsASVDGbQB1HvirGD": {
@ -218,27 +218,27 @@ export const CACHED_DETAILS: { [key: string]: ConfirmedTransaction } = {
"6yKHERk8rsbmJxvMpPuwPs1ct3hRiP7xaJF2tvnGU6nK", "6yKHERk8rsbmJxvMpPuwPs1ct3hRiP7xaJF2tvnGU6nK",
"4C6NCcLPUgGuBBkV2dJW96mrptMUCp3RG1ft9rqwjFi9", "4C6NCcLPUgGuBBkV2dJW96mrptMUCp3RG1ft9rqwjFi9",
"3o6xgkJ9sTmDeQWyfj3sxwon18fXJB9PV5LDc8sfgR4a", "3o6xgkJ9sTmDeQWyfj3sxwon18fXJB9PV5LDc8sfgR4a",
"11111111111111111111111111111111" "11111111111111111111111111111111",
], ],
header: { header: {
numReadonlySignedAccounts: 0, numReadonlySignedAccounts: 0,
numReadonlyUnsignedAccounts: 1, numReadonlyUnsignedAccounts: 1,
numRequiredSignatures: 2 numRequiredSignatures: 2,
}, },
instructions: [ instructions: [
{ {
accounts: [1, 2], accounts: [1, 2],
data: "3Bxs3ztRCp3tH1yZ", data: "3Bxs3ztRCp3tH1yZ",
programIdIndex: 3 programIdIndex: 3,
} },
], ],
recentBlockhash: "8eXVUNRxrDgpsEuoTWyLay1LUh2djc3Y8cw2owXRN8cU" recentBlockhash: "8eXVUNRxrDgpsEuoTWyLay1LUh2djc3Y8cw2owXRN8cU",
}), }),
[ [
"5K4KuqTTRNtzfpxWiwnkePzGfsa3tBEmpMy7vQFR3KWFAZNVY9tvoSaz1Yt5dKxcgsZPio2EsASVDGbQB1HvirGD", "5K4KuqTTRNtzfpxWiwnkePzGfsa3tBEmpMy7vQFR3KWFAZNVY9tvoSaz1Yt5dKxcgsZPio2EsASVDGbQB1HvirGD",
"37tvpG1eAeEBizJPhJvmpC2BY8npwy6K1wrZdNwdRAfWSbkerY3ZwYAPMHbrzoq7tthvWC2qFU28niqLPxbukeXF" "37tvpG1eAeEBizJPhJvmpC2BY8npwy6K1wrZdNwdRAfWSbkerY3ZwYAPMHbrzoq7tthvWC2qFU28niqLPxbukeXF",
] ]
) ),
}, },
"45pGoC4Rr3fJ1TKrsiRkhHRbdUeX7633XAGVec6XzVdpRbzQgHhe6ZC6Uq164MPWtiqMg7wCkC6Wy3jy2BqsDEKf": { "45pGoC4Rr3fJ1TKrsiRkhHRbdUeX7633XAGVec6XzVdpRbzQgHhe6ZC6Uq164MPWtiqMg7wCkC6Wy3jy2BqsDEKf": {
@ -250,26 +250,26 @@ export const CACHED_DETAILS: { [key: string]: ConfirmedTransaction } = {
"6yKHERk8rsbmJxvMpPuwPs1ct3hRiP7xaJF2tvnGU6nK", "6yKHERk8rsbmJxvMpPuwPs1ct3hRiP7xaJF2tvnGU6nK",
"3o6xgkJ9sTmDeQWyfj3sxwon18fXJB9PV5LDc8sfgR4a", "3o6xgkJ9sTmDeQWyfj3sxwon18fXJB9PV5LDc8sfgR4a",
"1nc1nerator11111111111111111111111111111111", "1nc1nerator11111111111111111111111111111111",
"11111111111111111111111111111111" "11111111111111111111111111111111",
], ],
header: { header: {
numReadonlySignedAccounts: 0, numReadonlySignedAccounts: 0,
numReadonlyUnsignedAccounts: 1, numReadonlyUnsignedAccounts: 1,
numRequiredSignatures: 2 numRequiredSignatures: 2,
}, },
instructions: [ instructions: [
{ {
accounts: [1, 2], accounts: [1, 2],
data: "3Bxs4NNAyLXRbuZZ", data: "3Bxs4NNAyLXRbuZZ",
programIdIndex: 3 programIdIndex: 3,
} },
], ],
recentBlockhash: "2xnatNUtSbeMRwi3k4vxPwXxeKFQYVuCNRg2rAgydWVP" recentBlockhash: "2xnatNUtSbeMRwi3k4vxPwXxeKFQYVuCNRg2rAgydWVP",
}), }),
[ [
"45pGoC4Rr3fJ1TKrsiRkhHRbdUeX7633XAGVec6XzVdpRbzQgHhe6ZC6Uq164MPWtiqMg7wCkC6Wy3jy2BqsDEKf", "45pGoC4Rr3fJ1TKrsiRkhHRbdUeX7633XAGVec6XzVdpRbzQgHhe6ZC6Uq164MPWtiqMg7wCkC6Wy3jy2BqsDEKf",
"2E7CDMTssxTYkdetCKVWQv9X2KNDPiuZrT2Y7647PhFEXuAWWxmHJb3ryCmP29ocQ1SNc7VyJjjm4X3jE8xWDmGY" "2E7CDMTssxTYkdetCKVWQv9X2KNDPiuZrT2Y7647PhFEXuAWWxmHJb3ryCmP29ocQ1SNc7VyJjjm4X3jE8xWDmGY",
] ]
) ),
} },
}; };

View File

@ -2,7 +2,7 @@ import React from "react";
import { import {
Connection, Connection,
TransactionSignature, TransactionSignature,
ConfirmedTransaction ConfirmedTransaction,
} from "@solana/web3.js"; } from "@solana/web3.js";
import { useCluster } from "../cluster"; import { useCluster } from "../cluster";
import { useTransactions, FetchStatus } from "./index"; import { useTransactions, FetchStatus } from "./index";
@ -18,7 +18,7 @@ type State = { [signature: string]: Details };
export enum ActionType { export enum ActionType {
Update, Update,
Add, Add,
Remove Remove,
} }
interface Update { interface Update {
@ -46,11 +46,11 @@ function reducer(state: State, action: Action): State {
case ActionType.Add: { case ActionType.Add: {
if (action.signatures.length === 0) return state; if (action.signatures.length === 0) return state;
const details = { ...state }; const details = { ...state };
action.signatures.forEach(signature => { action.signatures.forEach((signature) => {
if (!details[signature]) { if (!details[signature]) {
details[signature] = { details[signature] = {
fetchStatus: FetchStatus.Fetching, fetchStatus: FetchStatus.Fetching,
transaction: null transaction: null,
}; };
} }
}); });
@ -60,7 +60,7 @@ function reducer(state: State, action: Action): State {
case ActionType.Remove: { case ActionType.Remove: {
if (action.signatures.length === 0) return state; if (action.signatures.length === 0) return state;
const details = { ...state }; const details = { ...state };
action.signatures.forEach(signature => { action.signatures.forEach((signature) => {
delete details[signature]; delete details[signature];
}); });
return details; return details;
@ -72,11 +72,11 @@ function reducer(state: State, action: Action): State {
details = { details = {
...details, ...details,
fetchStatus: action.fetchStatus, fetchStatus: action.fetchStatus,
transaction: action.transaction transaction: action.transaction,
}; };
return { return {
...state, ...state,
[action.signature]: details [action.signature]: details,
}; };
} }
break; break;
@ -109,13 +109,13 @@ export function DetailsProvider({ children }: DetailsProviderProps) {
}); });
const removeList: string[] = []; const removeList: string[] = [];
removeSignatures.forEach(s => removeList.push(s)); removeSignatures.forEach((s) => removeList.push(s));
dispatch({ type: ActionType.Remove, signatures: removeList }); dispatch({ type: ActionType.Remove, signatures: removeList });
const fetchList: string[] = []; const fetchList: string[] = [];
fetchSignatures.forEach(s => fetchList.push(s)); fetchSignatures.forEach((s) => fetchList.push(s));
dispatch({ type: ActionType.Add, signatures: fetchList }); dispatch({ type: ActionType.Add, signatures: fetchList });
fetchSignatures.forEach(signature => { fetchSignatures.forEach((signature) => {
fetchDetails(dispatch, signature, url); fetchDetails(dispatch, signature, url);
}); });
}, [transactions]); // eslint-disable-line react-hooks/exhaustive-deps }, [transactions]); // eslint-disable-line react-hooks/exhaustive-deps
@ -138,7 +138,7 @@ async function fetchDetails(
type: ActionType.Update, type: ActionType.Update,
fetchStatus: FetchStatus.Fetching, fetchStatus: FetchStatus.Fetching,
transaction: null, transaction: null,
signature signature,
}); });
let fetchStatus; let fetchStatus;

View File

@ -6,13 +6,13 @@ import {
Account, Account,
SignatureResult, SignatureResult,
PublicKey, PublicKey,
sendAndConfirmTransaction sendAndConfirmTransaction,
} from "@solana/web3.js"; } from "@solana/web3.js";
import { useQuery } from "../../utils/url"; import { useQuery } from "../../utils/url";
import { useCluster, Cluster, ClusterStatus } from "../cluster"; import { useCluster, Cluster, ClusterStatus } from "../cluster";
import { import {
DetailsProvider, DetailsProvider,
StateContext as DetailsStateContext StateContext as DetailsStateContext,
} from "./details"; } from "./details";
import base58 from "bs58"; import base58 from "bs58";
import { useFetchAccountInfo } from "../accounts"; import { useFetchAccountInfo } from "../accounts";
@ -21,7 +21,7 @@ import { CACHED_STATUSES, isCached } from "./cached";
export enum FetchStatus { export enum FetchStatus {
Fetching, Fetching,
FetchFailed, FetchFailed,
Fetched Fetched,
} }
export type Confirmations = number | "max"; export type Confirmations = number | "max";
@ -50,7 +50,7 @@ interface State {
export enum ActionType { export enum ActionType {
UpdateStatus, UpdateStatus,
FetchSignature FetchSignature,
} }
interface UpdateStatus { interface UpdateStatus {
@ -79,8 +79,8 @@ function reducer(state: State, action: Action): State {
[action.signature]: { [action.signature]: {
...transaction, ...transaction,
fetchStatus: FetchStatus.Fetching, fetchStatus: FetchStatus.Fetching,
info: undefined info: undefined,
} },
}; };
return { ...state, transactions }; return { ...state, transactions };
} else { } else {
@ -90,8 +90,8 @@ function reducer(state: State, action: Action): State {
[action.signature]: { [action.signature]: {
id: nextId, id: nextId,
signature: action.signature, signature: action.signature,
fetchStatus: FetchStatus.Fetching fetchStatus: FetchStatus.Fetching,
} },
}; };
return { ...state, transactions, idCounter: nextId }; return { ...state, transactions, idCounter: nextId };
} }
@ -105,8 +105,8 @@ function reducer(state: State, action: Action): State {
[action.signature]: { [action.signature]: {
...transaction, ...transaction,
fetchStatus: action.fetchStatus, fetchStatus: action.fetchStatus,
info: action.info info: action.info,
} },
}; };
return { ...state, transactions }; return { ...state, transactions };
} }
@ -125,7 +125,7 @@ type TransactionsProviderProps = { children: React.ReactNode };
export function TransactionsProvider({ children }: TransactionsProviderProps) { export function TransactionsProvider({ children }: TransactionsProviderProps) {
const [state, dispatch] = React.useReducer(reducer, { const [state, dispatch] = React.useReducer(reducer, {
idCounter: 0, idCounter: 0,
transactions: {} transactions: {},
}); });
const { cluster, status: clusterStatus, url } = useCluster(); const { cluster, status: clusterStatus, url } = useCluster();
@ -135,7 +135,7 @@ export function TransactionsProvider({ children }: TransactionsProviderProps) {
// Check transaction statuses whenever cluster updates // Check transaction statuses whenever cluster updates
React.useEffect(() => { React.useEffect(() => {
Object.keys(state.transactions).forEach(signature => { Object.keys(state.transactions).forEach((signature) => {
fetchTransactionStatus(dispatch, signature, url, clusterStatus); fetchTransactionStatus(dispatch, signature, url, clusterStatus);
}); });
@ -146,18 +146,18 @@ export function TransactionsProvider({ children }: TransactionsProviderProps) {
}, [testFlag, cluster, clusterStatus, url]); // eslint-disable-line react-hooks/exhaustive-deps }, [testFlag, cluster, clusterStatus, url]); // eslint-disable-line react-hooks/exhaustive-deps
// Check for transactions in the url params // Check for transactions in the url params
const values = TX_ALIASES.flatMap(key => [ const values = TX_ALIASES.flatMap((key) => [
query.get(key), query.get(key),
query.get(key + "s") query.get(key + "s"),
]); ]);
React.useEffect(() => { React.useEffect(() => {
values values
.filter((value): value is string => value !== null) .filter((value): value is string => value !== null)
.flatMap(value => value.split(",")) .flatMap((value) => value.split(","))
// Remove duplicates // Remove duplicates
.filter((item, pos, self) => self.indexOf(item) === pos) .filter((item, pos, self) => self.indexOf(item) === pos)
.filter(signature => !state.transactions[signature]) .filter((signature) => !state.transactions[signature])
.forEach(signature => { .forEach((signature) => {
fetchTransactionStatus(dispatch, signature, url, clusterStatus); fetchTransactionStatus(dispatch, signature, url, clusterStatus);
}); });
}, [values.toString()]); // eslint-disable-line react-hooks/exhaustive-deps }, [values.toString()]); // eslint-disable-line react-hooks/exhaustive-deps
@ -200,7 +200,7 @@ async function createTestTransaction(
const tx = SystemProgram.transfer({ const tx = SystemProgram.transfer({
fromPubkey: testAccount.publicKey, fromPubkey: testAccount.publicKey,
toPubkey: testAccount.publicKey, toPubkey: testAccount.publicKey,
lamports: 1 lamports: 1,
}); });
const signature = await sendAndConfirmTransaction( const signature = await sendAndConfirmTransaction(
connection, connection,
@ -222,7 +222,7 @@ export async function fetchTransactionStatus(
) { ) {
dispatch({ dispatch({
type: ActionType.FetchSignature, type: ActionType.FetchSignature,
signature signature,
}); });
// We will auto-refetch when status is no longer connecting // We will auto-refetch when status is no longer connecting
@ -237,7 +237,7 @@ export async function fetchTransactionStatus(
try { try {
const connection = new Connection(url); const connection = new Connection(url);
const { value } = await connection.getSignatureStatus(signature, { const { value } = await connection.getSignatureStatus(signature, {
searchTransactionHistory: true searchTransactionHistory: true,
}); });
if (value !== null) { if (value !== null) {
@ -256,7 +256,7 @@ export async function fetchTransactionStatus(
slot: value.slot, slot: value.slot,
timestamp, timestamp,
confirmations, confirmations,
result: { err: value.err } result: { err: value.err },
}; };
} }
fetchStatus = FetchStatus.Fetched; fetchStatus = FetchStatus.Fetched;
@ -270,7 +270,7 @@ export async function fetchTransactionStatus(
type: ActionType.UpdateStatus, type: ActionType.UpdateStatus,
signature, signature,
fetchStatus, fetchStatus,
info info,
}); });
} }
@ -285,7 +285,7 @@ export function useTransactions() {
idCounter: context.idCounter, idCounter: context.idCounter,
transactions: Object.values(context.transactions).sort((a, b) => transactions: Object.values(context.transactions).sort((a, b) =>
a.id <= b.id ? 1 : -1 a.id <= b.id ? 1 : -1
) ),
}; };
} }

View File

@ -62,7 +62,7 @@ export function register(config?: Config) {
function registerValidSW(swUrl: string, config?: Config) { function registerValidSW(swUrl: string, config?: Config) {
navigator.serviceWorker navigator.serviceWorker
.register(swUrl) .register(swUrl)
.then(registration => { .then((registration) => {
registration.onupdatefound = () => { registration.onupdatefound = () => {
const installingWorker = registration.installing; const installingWorker = registration.installing;
if (installingWorker == null) { if (installingWorker == null) {
@ -98,7 +98,7 @@ function registerValidSW(swUrl: string, config?: Config) {
}; };
}; };
}) })
.catch(error => { .catch((error) => {
console.error("Error during service worker registration:", error); console.error("Error during service worker registration:", error);
}); });
} }
@ -106,9 +106,9 @@ function registerValidSW(swUrl: string, config?: Config) {
function checkValidServiceWorker(swUrl: string, config?: Config) { function checkValidServiceWorker(swUrl: string, config?: Config) {
// Check if the service worker can be found. If it can't reload the page. // Check if the service worker can be found. If it can't reload the page.
fetch(swUrl, { fetch(swUrl, {
headers: { "Service-Worker": "script" } headers: { "Service-Worker": "script" },
}) })
.then(response => { .then((response) => {
// Ensure service worker exists, and that we really are getting a JS file. // Ensure service worker exists, and that we really are getting a JS file.
const contentType = response.headers.get("content-type"); const contentType = response.headers.get("content-type");
if ( if (
@ -116,7 +116,7 @@ function checkValidServiceWorker(swUrl: string, config?: Config) {
(contentType != null && contentType.indexOf("javascript") === -1) (contentType != null && contentType.indexOf("javascript") === -1)
) { ) {
// No service worker found. Probably a different app. Reload the page. // No service worker found. Probably a different app. Reload the page.
navigator.serviceWorker.ready.then(registration => { navigator.serviceWorker.ready.then((registration) => {
registration.unregister().then(() => { registration.unregister().then(() => {
window.location.reload(); window.location.reload();
}); });
@ -136,10 +136,10 @@ function checkValidServiceWorker(swUrl: string, config?: Config) {
export function unregister() { export function unregister() {
if ("serviceWorker" in navigator) { if ("serviceWorker" in navigator) {
navigator.serviceWorker.ready navigator.serviceWorker.ready
.then(registration => { .then((registration) => {
registration.unregister(); registration.unregister();
}) })
.catch(error => { .catch((error) => {
console.error(error.message); console.error(error.message);
}); });
} }

View File

@ -3,14 +3,14 @@ export function displayTimestamp(unixTimestamp: number): string {
const dateString = new Intl.DateTimeFormat("en-US", { const dateString = new Intl.DateTimeFormat("en-US", {
year: "numeric", year: "numeric",
month: "long", month: "long",
day: "numeric" day: "numeric",
}).format(expireDate); }).format(expireDate);
const timeString = new Intl.DateTimeFormat("en-US", { const timeString = new Intl.DateTimeFormat("en-US", {
hour: "numeric", hour: "numeric",
minute: "numeric", minute: "numeric",
second: "numeric", second: "numeric",
hour12: false, hour12: false,
timeZoneName: "long" timeZoneName: "long",
}).format(expireDate); }).format(expireDate);
return `${dateString} at ${timeString}`; return `${dateString} at ${timeString}`;
} }

View File

@ -6,7 +6,7 @@ import {
SYSVAR_CLOCK_PUBKEY, SYSVAR_CLOCK_PUBKEY,
SYSVAR_RENT_PUBKEY, SYSVAR_RENT_PUBKEY,
SYSVAR_REWARDS_PUBKEY, SYSVAR_REWARDS_PUBKEY,
SYSVAR_STAKE_HISTORY_PUBKEY SYSVAR_STAKE_HISTORY_PUBKEY,
} from "@solana/web3.js"; } from "@solana/web3.js";
const PROGRAM_IDS = { const PROGRAM_IDS = {
@ -17,13 +17,13 @@ const PROGRAM_IDS = {
Storage111111111111111111111111111111111111: "Storage", Storage111111111111111111111111111111111111: "Storage",
[SystemProgram.programId.toBase58()]: "System", [SystemProgram.programId.toBase58()]: "System",
Vest111111111111111111111111111111111111111: "Vest", Vest111111111111111111111111111111111111111: "Vest",
[VOTE_PROGRAM_ID.toBase58()]: "Vote" [VOTE_PROGRAM_ID.toBase58()]: "Vote",
}; };
const LOADER_IDS = { const LOADER_IDS = {
MoveLdr111111111111111111111111111111111111: "Move Loader", MoveLdr111111111111111111111111111111111111: "Move Loader",
NativeLoader1111111111111111111111111111111: "Native Loader", NativeLoader1111111111111111111111111111111: "Native Loader",
[BpfLoader.programId.toBase58()]: "BPF Loader" [BpfLoader.programId.toBase58()]: "BPF Loader",
}; };
const SYSVAR_IDS = { const SYSVAR_IDS = {
@ -36,7 +36,7 @@ const SYSVAR_IDS = {
[SYSVAR_REWARDS_PUBKEY.toBase58()]: "SYSVAR_REWARDS", [SYSVAR_REWARDS_PUBKEY.toBase58()]: "SYSVAR_REWARDS",
SysvarS1otHashes111111111111111111111111111: "SYSVAR_SLOT_HASHES", SysvarS1otHashes111111111111111111111111111: "SYSVAR_SLOT_HASHES",
SysvarS1otHistory11111111111111111111111111: "SYSVAR_SLOT_HISTORY", SysvarS1otHistory11111111111111111111111111: "SYSVAR_SLOT_HISTORY",
[SYSVAR_STAKE_HISTORY_PUBKEY.toBase58()]: "SYSVAR_STAKE_HISTORY" [SYSVAR_STAKE_HISTORY_PUBKEY.toBase58()]: "SYSVAR_STAKE_HISTORY",
}; };
export function displayAddress(address: string): string { export function displayAddress(address: string): string {

View File

@ -17,7 +17,7 @@ export function pickCluster(location: Location): Location {
return { return {
...location, ...location,
search search,
}; };
} }
@ -27,7 +27,7 @@ export function findGetParameter(parameterName: string): string | null {
window.location.search window.location.search
.substr(1) .substr(1)
.split("&") .split("&")
.forEach(function(item) { .forEach(function (item) {
tmp = item.split("="); tmp = item.split("=");
if (tmp[0].toLowerCase() === parameterName.toLowerCase()) { if (tmp[0].toLowerCase() === parameterName.toLowerCase()) {
if (tmp.length === 2) { if (tmp.length === 2) {