chore: run latest prettier
This commit is contained in:
parent
6171b55f50
commit
ad75f08c43
|
@ -5,8 +5,8 @@ module.exports = function override(config, env) {
|
|||
|
||||
config.resolve.extensions.push(".wasm");
|
||||
|
||||
config.module.rules.forEach(rule => {
|
||||
(rule.oneOf || []).forEach(oneOf => {
|
||||
config.module.rules.forEach((rule) => {
|
||||
(rule.oneOf || []).forEach((oneOf) => {
|
||||
if (oneOf.loader && oneOf.loader.indexOf("file-loader") >= 0) {
|
||||
// Make file-loader ignore WASM files
|
||||
oneOf.exclude.push(wasmExtensionRegExp);
|
||||
|
@ -18,7 +18,7 @@ module.exports = function override(config, env) {
|
|||
config.module.rules.push({
|
||||
test: wasmExtensionRegExp,
|
||||
include: path.resolve(__dirname, "src"),
|
||||
use: [{ loader: require.resolve("wasm-loader"), options: {} }]
|
||||
use: [{ loader: require.resolve("wasm-loader"), options: {} }],
|
||||
});
|
||||
|
||||
return config;
|
||||
|
|
|
@ -24,7 +24,10 @@ function App() {
|
|||
<div className="row align-items-end">
|
||||
<div className="col">
|
||||
<Link
|
||||
to={location => ({ ...pickCluster(location), pathname: "/" })}
|
||||
to={(location) => ({
|
||||
...pickCluster(location),
|
||||
pathname: "/",
|
||||
})}
|
||||
>
|
||||
<img src={Logo} width="250" alt="Solana Explorer" />
|
||||
</Link>
|
||||
|
@ -49,14 +52,14 @@ function App() {
|
|||
></Route>
|
||||
<Route
|
||||
exact
|
||||
path={TX_ALIASES.flatMap(tx => [tx, tx + "s"]).map(
|
||||
tx => `/${tx}/:signature`
|
||||
path={TX_ALIASES.flatMap((tx) => [tx, tx + "s"]).map(
|
||||
(tx) => `/${tx}/:signature`
|
||||
)}
|
||||
render={({ match }) => (
|
||||
<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">
|
||||
<TransactionsCard />
|
||||
</TabbedPage>
|
||||
|
@ -64,13 +67,16 @@ function App() {
|
|||
<Route
|
||||
exact
|
||||
path={ACCOUNT_ALIASES.concat(ACCOUNT_ALIASES_PLURAL).map(
|
||||
account => `/${account}/:address`
|
||||
(account) => `/${account}/:address`
|
||||
)}
|
||||
render={({ match }) => (
|
||||
<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">
|
||||
<AccountsCard />
|
||||
</TabbedPage>
|
||||
|
|
|
@ -9,7 +9,7 @@ import {
|
|||
useFetchAccountInfo,
|
||||
useAccountInfo,
|
||||
useAccountHistory,
|
||||
Account
|
||||
Account,
|
||||
} from "providers/accounts";
|
||||
import { lamportsToSolString } from "utils";
|
||||
import Copyable from "./Copyable";
|
||||
|
@ -50,8 +50,8 @@ export default function AccountDetails({ address }: Props) {
|
|||
<input
|
||||
type="text"
|
||||
value={search}
|
||||
onChange={e => setSearch(e.target.value)}
|
||||
onKeyUp={e => e.key === "Enter" && updateAddress()}
|
||||
onChange={(e) => setSearch(e.target.value)}
|
||||
onKeyUp={(e) => e.key === "Enter" && updateAddress()}
|
||||
className="form-control form-control-prepended search text-monospace"
|
||||
placeholder="Search for address"
|
||||
/>
|
||||
|
@ -252,9 +252,9 @@ function HistoryCard({ pubkey }: { pubkey: PublicKey }) {
|
|||
|
||||
<td>
|
||||
<Link
|
||||
to={location => ({
|
||||
to={(location) => ({
|
||||
...location,
|
||||
pathname: "/tx/" + signature
|
||||
pathname: "/tx/" + signature,
|
||||
})}
|
||||
className="btn btn-rounded-circle btn-white btn-sm"
|
||||
>
|
||||
|
|
|
@ -4,7 +4,7 @@ import {
|
|||
useAccounts,
|
||||
Account,
|
||||
FetchStatus,
|
||||
useFetchAccountInfo
|
||||
useFetchAccountInfo,
|
||||
} from "../providers/accounts";
|
||||
import { assertUnreachable } from "../utils";
|
||||
import { displayAddress } from "../utils/tx";
|
||||
|
@ -68,10 +68,10 @@ function AccountsCard() {
|
|||
<input
|
||||
type="text"
|
||||
onInput={() => setError("")}
|
||||
onKeyDown={e =>
|
||||
onKeyDown={(e) =>
|
||||
e.keyCode === 13 && onNew(e.currentTarget.value)
|
||||
}
|
||||
onSubmit={e => onNew(e.currentTarget.value)}
|
||||
onSubmit={(e) => onNew(e.currentTarget.value)}
|
||||
ref={addressInput}
|
||||
className={`form-control text-address text-monospace ${
|
||||
error ? "is-invalid" : ""
|
||||
|
@ -85,7 +85,7 @@ function AccountsCard() {
|
|||
<td>-</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
{accounts.map(account => renderAccountRow(account))}
|
||||
{accounts.map((account) => renderAccountRow(account))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
@ -172,9 +172,9 @@ const renderAccountRow = (account: Account) => {
|
|||
</td>
|
||||
<td>
|
||||
<Link
|
||||
to={location => ({
|
||||
to={(location) => ({
|
||||
...location,
|
||||
pathname: "/account/" + base58AccountPubkey
|
||||
pathname: "/account/" + base58AccountPubkey,
|
||||
})}
|
||||
className="btn btn-rounded-circle btn-white btn-sm"
|
||||
>
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
CLUSTERS,
|
||||
Cluster,
|
||||
useClusterModal,
|
||||
useUpdateCustomUrl
|
||||
useUpdateCustomUrl,
|
||||
} from "../providers/cluster";
|
||||
import { assertUnreachable } from "../utils";
|
||||
import Overlay from "./Overlay";
|
||||
|
@ -28,7 +28,7 @@ function ClusterModal() {
|
|||
>
|
||||
<div className="modal-dialog modal-dialog-vertical">
|
||||
<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>
|
||||
|
@ -62,7 +62,7 @@ function CustomClusterInput({ activeSuffix, active }: InputProps) {
|
|||
if (customUrl.length > 0) query.set("cluster", "custom");
|
||||
return {
|
||||
...location,
|
||||
search: query.toString()
|
||||
search: query.toString(),
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -77,7 +77,7 @@ function CustomClusterInput({ activeSuffix, active }: InputProps) {
|
|||
const inputTextClass = editing ? "" : "text-muted";
|
||||
return (
|
||||
<Link
|
||||
to={location => clusterLocation(location)}
|
||||
to={(location) => clusterLocation(location)}
|
||||
className="btn input-group input-group-merge p-0"
|
||||
>
|
||||
<input
|
||||
|
@ -88,7 +88,7 @@ function CustomClusterInput({ activeSuffix, active }: InputProps) {
|
|||
)}`}
|
||||
onFocus={() => setEditing(true)}
|
||||
onBlur={() => setEditing(false)}
|
||||
onInput={e => onUrlInput(e.currentTarget.value)}
|
||||
onInput={(e) => onUrlInput(e.currentTarget.value)}
|
||||
/>
|
||||
<div className="input-group-prepend">
|
||||
<div className={`input-group-text pr-0 ${customClass("border")}`}>
|
||||
|
@ -144,7 +144,7 @@ function ClusterToggle() {
|
|||
}
|
||||
return {
|
||||
...location,
|
||||
search: params.toString()
|
||||
search: params.toString(),
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import { useCluster, ClusterStatus, Cluster } from "../providers/cluster";
|
|||
|
||||
function ClusterStatusButton({
|
||||
onClick,
|
||||
expand
|
||||
expand,
|
||||
}: {
|
||||
onClick: () => void;
|
||||
expand?: boolean;
|
||||
|
|
|
@ -12,7 +12,7 @@ type State = "hide" | "copy" | "copied";
|
|||
function Popover({
|
||||
state,
|
||||
bottom,
|
||||
right
|
||||
right,
|
||||
}: {
|
||||
state: State;
|
||||
bottom?: boolean;
|
||||
|
|
|
@ -13,7 +13,7 @@ function Popover({
|
|||
state,
|
||||
bottom,
|
||||
right,
|
||||
text
|
||||
text,
|
||||
}: {
|
||||
state: State;
|
||||
bottom?: boolean;
|
||||
|
|
|
@ -52,7 +52,7 @@ export default function TabbedPage({ children, tab }: Props) {
|
|||
function NavLink({
|
||||
href,
|
||||
tab,
|
||||
current
|
||||
current,
|
||||
}: {
|
||||
href: string;
|
||||
tab: Tab;
|
||||
|
@ -65,7 +65,7 @@ function NavLink({
|
|||
|
||||
return (
|
||||
<Link
|
||||
to={location => ({ ...pickCluster(location), pathname: href })}
|
||||
to={(location) => ({ ...pickCluster(location), pathname: href })}
|
||||
className={classes}
|
||||
>
|
||||
{tab}
|
||||
|
|
|
@ -77,7 +77,7 @@ export default function TopAccountsCard() {
|
|||
<div className="col-auto">
|
||||
<FilterDropdown
|
||||
filter={filter}
|
||||
toggle={() => setDropdown(show => !show)}
|
||||
toggle={() => setDropdown((show) => !show)}
|
||||
show={showDropdown}
|
||||
/>
|
||||
</div>
|
||||
|
@ -127,9 +127,9 @@ const renderAccountRow = (
|
|||
<td>{`${((100 * account.lamports) / supply).toFixed(3)}%`}</td>
|
||||
<td>
|
||||
<Link
|
||||
to={location => ({
|
||||
to={(location) => ({
|
||||
...location,
|
||||
pathname: "/account/" + base58AccountPubkey
|
||||
pathname: "/account/" + base58AccountPubkey,
|
||||
})}
|
||||
className="btn btn-rounded-circle btn-white btn-sm"
|
||||
>
|
||||
|
@ -185,7 +185,7 @@ const FilterDropdown = ({ filter, toggle, show }: DropdownProps) => {
|
|||
}
|
||||
return {
|
||||
...location,
|
||||
search: params.toString()
|
||||
search: params.toString(),
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -202,11 +202,11 @@ const FilterDropdown = ({ filter, toggle, show }: DropdownProps) => {
|
|||
<div
|
||||
className={`dropdown-menu-right dropdown-menu${show ? " show" : ""}`}
|
||||
>
|
||||
{FILTERS.map(filterOption => {
|
||||
{FILTERS.map((filterOption) => {
|
||||
return (
|
||||
<Link
|
||||
key={filterOption || "null"}
|
||||
to={location => buildLocation(location, filterOption)}
|
||||
to={(location) => buildLocation(location, filterOption)}
|
||||
className={`dropdown-item${
|
||||
filterOption === filter ? " active" : ""
|
||||
}`}
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
useFetchTransactionStatus,
|
||||
useTransactionStatus,
|
||||
useTransactionDetails,
|
||||
FetchStatus
|
||||
FetchStatus,
|
||||
} from "../providers/transactions";
|
||||
import { useFetchTransactionDetails } from "providers/transactions/details";
|
||||
import { useCluster, useClusterModal } from "providers/cluster";
|
||||
|
@ -11,7 +11,7 @@ import {
|
|||
TransactionSignature,
|
||||
SystemProgram,
|
||||
StakeProgram,
|
||||
SystemInstruction
|
||||
SystemInstruction,
|
||||
} from "@solana/web3.js";
|
||||
import ClusterStatusButton from "components/ClusterStatusButton";
|
||||
import { lamportsToSolString } from "utils";
|
||||
|
@ -49,8 +49,8 @@ export default function TransactionDetails({ signature }: Props) {
|
|||
<input
|
||||
type="text"
|
||||
value={search}
|
||||
onChange={e => setSearch(e.target.value)}
|
||||
onKeyUp={e => e.key === "Enter" && updateSignature()}
|
||||
onChange={(e) => setSearch(e.target.value)}
|
||||
onKeyUp={(e) => e.key === "Enter" && updateSignature()}
|
||||
className="form-control form-control-prepended search text-monospace"
|
||||
placeholder="Search for signature"
|
||||
/>
|
||||
|
@ -293,7 +293,7 @@ function AccountsCard({ signature }: Props) {
|
|||
{index < message.header.numRequiredSignatures && (
|
||||
<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>
|
||||
)}
|
||||
</td>
|
||||
|
|
|
@ -4,7 +4,7 @@ import {
|
|||
useTransactions,
|
||||
TransactionStatus,
|
||||
FetchStatus,
|
||||
useFetchTransactionStatus
|
||||
useFetchTransactionStatus,
|
||||
} from "../providers/transactions";
|
||||
import bs58 from "bs58";
|
||||
import { assertUnreachable } from "../utils";
|
||||
|
@ -71,10 +71,10 @@ function TransactionsCard() {
|
|||
<input
|
||||
type="text"
|
||||
onInput={() => setError("")}
|
||||
onKeyDown={e =>
|
||||
onKeyDown={(e) =>
|
||||
e.keyCode === 13 && onNew(e.currentTarget.value)
|
||||
}
|
||||
onSubmit={e => onNew(e.currentTarget.value)}
|
||||
onSubmit={(e) => onNew(e.currentTarget.value)}
|
||||
ref={signatureInput}
|
||||
className={`form-control text-signature text-monospace ${
|
||||
error ? "is-invalid" : ""
|
||||
|
@ -87,7 +87,9 @@ function TransactionsCard() {
|
|||
<td>-</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
{transactions.map(transaction => renderTransactionRow(transaction))}
|
||||
{transactions.map((transaction) =>
|
||||
renderTransactionRow(transaction)
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
@ -162,7 +164,7 @@ const renderTransactionRow = (transactionStatus: TransactionStatus) => {
|
|||
<td>{slotText}</td>
|
||||
<td>
|
||||
<Link
|
||||
to={location => ({ ...location, pathname: "/tx/" + signature })}
|
||||
to={(location) => ({ ...location, pathname: "/tx/" + signature })}
|
||||
className="btn btn-rounded-circle btn-white btn-sm"
|
||||
>
|
||||
<span className="fe fe-arrow-right"></span>
|
||||
|
|
|
@ -9,7 +9,7 @@ import { Account, useFetchAccountInfo } from "providers/accounts";
|
|||
|
||||
export function StakeAccountCards({
|
||||
account,
|
||||
stakeAccount
|
||||
stakeAccount,
|
||||
}: {
|
||||
account: Account;
|
||||
stakeAccount: StakeAccount;
|
||||
|
@ -40,7 +40,7 @@ function LockupCard({ stakeAccount }: { stakeAccount: StakeAccount }) {
|
|||
|
||||
function OverviewCard({
|
||||
account,
|
||||
stakeAccount
|
||||
stakeAccount,
|
||||
}: {
|
||||
account: Account;
|
||||
stakeAccount: StakeAccount;
|
||||
|
|
|
@ -4,7 +4,7 @@ export default function ErrorCard({
|
|||
retry,
|
||||
retryText,
|
||||
text,
|
||||
subtext
|
||||
subtext,
|
||||
}: {
|
||||
retry?: () => void;
|
||||
retryText?: string;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React from "react";
|
||||
|
||||
export default function TableCardBody({
|
||||
children
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
|
|
|
@ -17,7 +17,7 @@ export function InstructionCard({
|
|||
result,
|
||||
index,
|
||||
ix,
|
||||
defaultRaw
|
||||
defaultRaw,
|
||||
}: InstructionProps) {
|
||||
const [resultClass] = ixResult(result, index);
|
||||
const [showRaw, setShowRaw] = React.useState(defaultRaw || false);
|
||||
|
@ -36,7 +36,7 @@ export function InstructionCard({
|
|||
className={`btn btn-sm d-flex ${
|
||||
showRaw ? "btn-dark active" : "btn-white"
|
||||
}`}
|
||||
onClick={() => setShowRaw(r => !r)}
|
||||
onClick={() => setShowRaw((r) => !r)}
|
||||
>
|
||||
<span className="fe fe-code mr-1"></span>
|
||||
Raw
|
||||
|
|
|
@ -5,7 +5,7 @@ import { InstructionCard } from "./InstructionCard";
|
|||
export function UnknownDetailsCard({
|
||||
ix,
|
||||
index,
|
||||
result
|
||||
result,
|
||||
}: {
|
||||
ix: TransactionInstruction;
|
||||
index: number;
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
TransactionInstruction,
|
||||
SignatureResult,
|
||||
StakeInstruction,
|
||||
StakeProgram
|
||||
StakeProgram,
|
||||
} from "@solana/web3.js";
|
||||
import { displayAddress } from "utils/tx";
|
||||
import { InstructionCard } from "../InstructionCard";
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
TransactionInstruction,
|
||||
SignatureResult,
|
||||
StakeInstruction,
|
||||
StakeProgram
|
||||
StakeProgram,
|
||||
} from "@solana/web3.js";
|
||||
import { displayAddress } from "utils/tx";
|
||||
import { InstructionCard } from "../InstructionCard";
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
TransactionInstruction,
|
||||
SignatureResult,
|
||||
StakeInstruction,
|
||||
StakeProgram
|
||||
StakeProgram,
|
||||
} from "@solana/web3.js";
|
||||
import { displayAddress } from "utils/tx";
|
||||
import { InstructionCard } from "../InstructionCard";
|
||||
|
|
|
@ -4,7 +4,7 @@ import {
|
|||
SignatureResult,
|
||||
StakeInstruction,
|
||||
StakeProgram,
|
||||
SystemProgram
|
||||
SystemProgram,
|
||||
} from "@solana/web3.js";
|
||||
import { displayAddress } from "utils/tx";
|
||||
import { InstructionCard } from "../InstructionCard";
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
TransactionInstruction,
|
||||
SignatureResult,
|
||||
StakeInstruction,
|
||||
StakeProgram
|
||||
StakeProgram,
|
||||
} from "@solana/web3.js";
|
||||
import { displayAddress } from "utils/tx";
|
||||
import { lamportsToSolString } from "utils";
|
||||
|
|
|
@ -2,7 +2,7 @@ import React from "react";
|
|||
import {
|
||||
StakeInstruction,
|
||||
TransactionInstruction,
|
||||
SignatureResult
|
||||
SignatureResult,
|
||||
} from "@solana/web3.js";
|
||||
|
||||
import { UnknownDetailsCard } from "../UnknownDetailsCard";
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
TransactionInstruction,
|
||||
SignatureResult,
|
||||
StakeInstruction,
|
||||
StakeProgram
|
||||
StakeProgram,
|
||||
} from "@solana/web3.js";
|
||||
import { lamportsToSolString } from "utils";
|
||||
import { displayAddress } from "utils/tx";
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
TransactionInstruction,
|
||||
SystemProgram,
|
||||
SignatureResult,
|
||||
SystemInstruction
|
||||
SystemInstruction,
|
||||
} from "@solana/web3.js";
|
||||
import { displayAddress } from "utils/tx";
|
||||
import { InstructionCard } from "../InstructionCard";
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
TransactionInstruction,
|
||||
SystemProgram,
|
||||
SignatureResult,
|
||||
SystemInstruction
|
||||
SystemInstruction,
|
||||
} from "@solana/web3.js";
|
||||
import { displayAddress } from "utils/tx";
|
||||
import { InstructionCard } from "../InstructionCard";
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
TransactionInstruction,
|
||||
SystemProgram,
|
||||
SignatureResult,
|
||||
SystemInstruction
|
||||
SystemInstruction,
|
||||
} from "@solana/web3.js";
|
||||
import { displayAddress } from "utils/tx";
|
||||
import { InstructionCard } from "../InstructionCard";
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
TransactionInstruction,
|
||||
SystemProgram,
|
||||
SignatureResult,
|
||||
SystemInstruction
|
||||
SystemInstruction,
|
||||
} from "@solana/web3.js";
|
||||
import { displayAddress } from "utils/tx";
|
||||
import { InstructionCard } from "../InstructionCard";
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
TransactionInstruction,
|
||||
SystemProgram,
|
||||
SignatureResult,
|
||||
SystemInstruction
|
||||
SystemInstruction,
|
||||
} from "@solana/web3.js";
|
||||
import { lamportsToSolString } from "utils";
|
||||
import { displayAddress } from "utils/tx";
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
TransactionInstruction,
|
||||
SystemProgram,
|
||||
SignatureResult,
|
||||
SystemInstruction
|
||||
SystemInstruction,
|
||||
} from "@solana/web3.js";
|
||||
import { lamportsToSolString } from "utils";
|
||||
import { displayAddress } from "utils/tx";
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
TransactionInstruction,
|
||||
SystemProgram,
|
||||
SignatureResult,
|
||||
SystemInstruction
|
||||
SystemInstruction,
|
||||
} from "@solana/web3.js";
|
||||
import { displayAddress } from "utils/tx";
|
||||
import { InstructionCard } from "../InstructionCard";
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
TransactionInstruction,
|
||||
SystemProgram,
|
||||
SignatureResult,
|
||||
SystemInstruction
|
||||
SystemInstruction,
|
||||
} from "@solana/web3.js";
|
||||
import { displayAddress } from "utils/tx";
|
||||
import { InstructionCard } from "../InstructionCard";
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
TransactionInstruction,
|
||||
SystemProgram,
|
||||
SignatureResult,
|
||||
SystemInstruction
|
||||
SystemInstruction,
|
||||
} from "@solana/web3.js";
|
||||
import { displayAddress } from "utils/tx";
|
||||
import { InstructionCard } from "../InstructionCard";
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
TransactionInstruction,
|
||||
SystemProgram,
|
||||
SignatureResult,
|
||||
SystemInstruction
|
||||
SystemInstruction,
|
||||
} from "@solana/web3.js";
|
||||
import { displayAddress } from "utils/tx";
|
||||
import { lamportsToSolString } from "utils";
|
||||
|
|
|
@ -2,7 +2,7 @@ import React from "react";
|
|||
import {
|
||||
SystemInstruction,
|
||||
TransactionInstruction,
|
||||
SignatureResult
|
||||
SignatureResult,
|
||||
} from "@solana/web3.js";
|
||||
|
||||
import { UnknownDetailsCard } from "../UnknownDetailsCard";
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
TransactionInstruction,
|
||||
SystemProgram,
|
||||
SignatureResult,
|
||||
SystemInstruction
|
||||
SystemInstruction,
|
||||
} from "@solana/web3.js";
|
||||
import { lamportsToSolString } from "utils";
|
||||
import { displayAddress } from "utils/tx";
|
||||
|
|
|
@ -5,7 +5,7 @@ import { useCluster } from "../cluster";
|
|||
import {
|
||||
HistoryManager,
|
||||
HistoricalTransaction,
|
||||
SlotRange
|
||||
SlotRange,
|
||||
} from "./historyManager";
|
||||
|
||||
interface AccountHistory {
|
||||
|
@ -19,7 +19,7 @@ type State = { [address: string]: AccountHistory };
|
|||
export enum ActionType {
|
||||
Update,
|
||||
Add,
|
||||
Remove
|
||||
Remove,
|
||||
}
|
||||
|
||||
interface Update {
|
||||
|
@ -48,10 +48,10 @@ function reducer(state: State, action: Action): State {
|
|||
case ActionType.Add: {
|
||||
if (action.addresses.length === 0) return state;
|
||||
const details = { ...state };
|
||||
action.addresses.forEach(address => {
|
||||
action.addresses.forEach((address) => {
|
||||
if (!details[address]) {
|
||||
details[address] = {
|
||||
status: FetchStatus.Fetching
|
||||
status: FetchStatus.Fetching,
|
||||
};
|
||||
}
|
||||
});
|
||||
|
@ -61,7 +61,7 @@ function reducer(state: State, action: Action): State {
|
|||
case ActionType.Remove: {
|
||||
if (action.addresses.length === 0) return state;
|
||||
const details = { ...state };
|
||||
action.addresses.forEach(address => {
|
||||
action.addresses.forEach((address) => {
|
||||
delete details[address];
|
||||
});
|
||||
return details;
|
||||
|
@ -81,8 +81,8 @@ function reducer(state: State, action: Action): State {
|
|||
[address]: {
|
||||
status: action.status,
|
||||
fetched,
|
||||
fetchedRange
|
||||
}
|
||||
fetchedRange,
|
||||
},
|
||||
};
|
||||
}
|
||||
break;
|
||||
|
@ -121,16 +121,16 @@ export function HistoryProvider({ children }: HistoryProviderProps) {
|
|||
});
|
||||
|
||||
const removeList: string[] = [];
|
||||
removeAddresses.forEach(address => {
|
||||
removeAddresses.forEach((address) => {
|
||||
manager.current.removeAccountHistory(address);
|
||||
removeList.push(address);
|
||||
});
|
||||
dispatch({ type: ActionType.Remove, addresses: removeList });
|
||||
|
||||
const fetchList: string[] = [];
|
||||
fetchAddresses.forEach(s => fetchList.push(s));
|
||||
fetchAddresses.forEach((s) => fetchList.push(s));
|
||||
dispatch({ type: ActionType.Add, addresses: fetchList });
|
||||
fetchAddresses.forEach(address => {
|
||||
fetchAddresses.forEach((address) => {
|
||||
fetchAccountHistory(
|
||||
dispatch,
|
||||
new PublicKey(address),
|
||||
|
@ -160,7 +160,7 @@ async function fetchAccountHistory(
|
|||
dispatch({
|
||||
type: ActionType.Update,
|
||||
status: FetchStatus.Fetching,
|
||||
pubkey
|
||||
pubkey,
|
||||
});
|
||||
|
||||
let status;
|
||||
|
|
|
@ -2,7 +2,7 @@ import {
|
|||
TransactionSignature,
|
||||
Connection,
|
||||
PublicKey,
|
||||
SignatureStatus
|
||||
SignatureStatus,
|
||||
} from "@solana/web3.js";
|
||||
|
||||
const MAX_STATUS_BATCH_SIZE = 256;
|
||||
|
@ -101,7 +101,7 @@ export class HistoryManager {
|
|||
range.min = Math.max(nextRange.min - slotLookBack, fullRange.min);
|
||||
nextRange = {
|
||||
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 statuses = (
|
||||
await this.connection.getSignatureStatuses(batch, {
|
||||
searchTransactionHistory: true
|
||||
searchTransactionHistory: true,
|
||||
})
|
||||
).value;
|
||||
statuses.forEach((status, index) => {
|
||||
if (status !== null) {
|
||||
transactions.push({
|
||||
signature: batch[index],
|
||||
status
|
||||
status,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -9,7 +9,7 @@ export { useAccountHistory } from "./history";
|
|||
export enum FetchStatus {
|
||||
Fetching,
|
||||
FetchFailed,
|
||||
Fetched
|
||||
Fetched,
|
||||
}
|
||||
|
||||
export interface Details {
|
||||
|
@ -35,7 +35,7 @@ interface State {
|
|||
|
||||
export enum ActionType {
|
||||
Update,
|
||||
Fetch
|
||||
Fetch,
|
||||
}
|
||||
|
||||
interface Update {
|
||||
|
@ -67,8 +67,8 @@ function reducer(state: State, action: Action): State {
|
|||
[address]: {
|
||||
id: account.id,
|
||||
pubkey: account.pubkey,
|
||||
status: FetchStatus.Fetching
|
||||
}
|
||||
status: FetchStatus.Fetching,
|
||||
},
|
||||
};
|
||||
return { ...state, accounts };
|
||||
} else {
|
||||
|
@ -78,8 +78,8 @@ function reducer(state: State, action: Action): State {
|
|||
[address]: {
|
||||
id: idCounter,
|
||||
status: FetchStatus.Fetching,
|
||||
pubkey: action.pubkey
|
||||
}
|
||||
pubkey: action.pubkey,
|
||||
},
|
||||
};
|
||||
return { ...state, accounts, idCounter };
|
||||
}
|
||||
|
@ -93,8 +93,8 @@ function reducer(state: State, action: Action): State {
|
|||
...state.accounts,
|
||||
[address]: {
|
||||
...account,
|
||||
...action.data
|
||||
}
|
||||
...action.data,
|
||||
},
|
||||
};
|
||||
return { ...state, accounts };
|
||||
}
|
||||
|
@ -114,30 +114,30 @@ type AccountsProviderProps = { children: React.ReactNode };
|
|||
export function AccountsProvider({ children }: AccountsProviderProps) {
|
||||
const [state, dispatch] = React.useReducer(reducer, {
|
||||
idCounter: 0,
|
||||
accounts: {}
|
||||
accounts: {},
|
||||
});
|
||||
|
||||
const { status, url } = useCluster();
|
||||
|
||||
// Check account statuses on startup and whenever cluster updates
|
||||
React.useEffect(() => {
|
||||
Object.keys(state.accounts).forEach(address => {
|
||||
Object.keys(state.accounts).forEach((address) => {
|
||||
fetchAccountInfo(dispatch, new PublicKey(address), url, status);
|
||||
});
|
||||
}, [status, url]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
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)
|
||||
);
|
||||
React.useEffect(() => {
|
||||
values
|
||||
.filter((value): value is string => value !== null)
|
||||
.flatMap(value => value.split(","))
|
||||
.flatMap((value) => value.split(","))
|
||||
// Remove duplicates
|
||||
.filter((item, pos, self) => self.indexOf(item) === pos)
|
||||
.filter(address => !state.accounts[address])
|
||||
.forEach(address => {
|
||||
.filter((address) => !state.accounts[address])
|
||||
.forEach((address) => {
|
||||
try {
|
||||
fetchAccountInfo(dispatch, new PublicKey(address), url, status);
|
||||
} catch (err) {
|
||||
|
@ -164,7 +164,7 @@ async function fetchAccountInfo(
|
|||
) {
|
||||
dispatch({
|
||||
type: ActionType.Fetch,
|
||||
pubkey
|
||||
pubkey,
|
||||
});
|
||||
|
||||
// We will auto-refetch when status is no longer connecting
|
||||
|
@ -196,7 +196,7 @@ async function fetchAccountInfo(
|
|||
space: result.data.length,
|
||||
executable: result.executable,
|
||||
owner: result.owner,
|
||||
data
|
||||
data,
|
||||
};
|
||||
}
|
||||
fetchStatus = FetchStatus.Fetched;
|
||||
|
@ -217,7 +217,7 @@ export function useAccounts() {
|
|||
idCounter: context.idCounter,
|
||||
accounts: Object.values(context.accounts).sort((a, b) =>
|
||||
a.id <= b.id ? 1 : -1
|
||||
)
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -6,21 +6,21 @@ import { useHistory, useLocation } from "react-router-dom";
|
|||
export enum ClusterStatus {
|
||||
Connected,
|
||||
Connecting,
|
||||
Failure
|
||||
Failure,
|
||||
}
|
||||
|
||||
export enum Cluster {
|
||||
MainnetBeta,
|
||||
Testnet,
|
||||
Devnet,
|
||||
Custom
|
||||
Custom,
|
||||
}
|
||||
|
||||
export const CLUSTERS = [
|
||||
Cluster.MainnetBeta,
|
||||
Cluster.Testnet,
|
||||
Cluster.Devnet,
|
||||
Cluster.Custom
|
||||
Cluster.Custom,
|
||||
];
|
||||
|
||||
export function clusterSlug(cluster: Cluster): string {
|
||||
|
@ -128,7 +128,7 @@ export function ClusterProvider({ children }: ClusterProviderProps) {
|
|||
const [state, dispatch] = React.useReducer(clusterReducer, {
|
||||
cluster: DEFAULT_CLUSTER,
|
||||
customUrl: "",
|
||||
status: ClusterStatus.Connecting
|
||||
status: ClusterStatus.Connecting,
|
||||
});
|
||||
const [showModal, setShowModal] = React.useState(false);
|
||||
const query = useQuery();
|
||||
|
@ -169,7 +169,7 @@ async function updateCluster(
|
|||
dispatch({
|
||||
status: ClusterStatus.Connecting,
|
||||
cluster,
|
||||
customUrl
|
||||
customUrl,
|
||||
});
|
||||
|
||||
try {
|
||||
|
@ -179,7 +179,7 @@ async function updateCluster(
|
|||
status: ClusterStatus.Connected,
|
||||
cluster,
|
||||
customUrl,
|
||||
firstAvailableBlock
|
||||
firstAvailableBlock,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Failed to update cluster", error);
|
||||
|
@ -206,7 +206,7 @@ export function useCluster() {
|
|||
return {
|
||||
...context,
|
||||
url: clusterUrl(context.cluster, context.customUrl),
|
||||
name: clusterName(context.cluster)
|
||||
name: clusterName(context.cluster),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import { useCluster, ClusterStatus } from "./cluster";
|
|||
export enum Status {
|
||||
Idle,
|
||||
Disconnected,
|
||||
Connecting
|
||||
Connecting,
|
||||
}
|
||||
|
||||
type RichLists = {
|
||||
|
@ -60,12 +60,12 @@ async function fetch(dispatch: Dispatch, url: string) {
|
|||
await Promise.all([
|
||||
connection.getLargestAccounts(),
|
||||
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
|
||||
dispatch(state => {
|
||||
dispatch((state) => {
|
||||
if (state !== Status.Connecting) return state;
|
||||
return { total, circulating, nonCirculating };
|
||||
});
|
||||
|
|
|
@ -6,7 +6,7 @@ import { useCluster, ClusterStatus } from "./cluster";
|
|||
export enum Status {
|
||||
Idle,
|
||||
Disconnected,
|
||||
Connecting
|
||||
Connecting,
|
||||
}
|
||||
|
||||
type State = Supply | Status | string;
|
||||
|
@ -45,7 +45,7 @@ async function fetch(dispatch: Dispatch, url: string) {
|
|||
const supply = (await connection.getSupply()).value;
|
||||
|
||||
// Update state if still connecting
|
||||
dispatch(state => {
|
||||
dispatch((state) => {
|
||||
if (state !== Status.Connecting) return state;
|
||||
return supply;
|
||||
});
|
||||
|
|
|
@ -10,7 +10,7 @@ import {
|
|||
Transaction,
|
||||
ConfirmedTransaction,
|
||||
Message,
|
||||
clusterApiUrl
|
||||
clusterApiUrl,
|
||||
} from "@solana/web3.js";
|
||||
|
||||
export const isCached = (url: string, signature: string): boolean => {
|
||||
|
@ -22,44 +22,44 @@ export const CACHED_STATUSES: { [key: string]: TransactionStatusInfo } = {
|
|||
slot: 10440804,
|
||||
result: { err: null },
|
||||
timestamp: 1589212180,
|
||||
confirmations: "max"
|
||||
confirmations: "max",
|
||||
},
|
||||
DYrfStEEzbV5sftX8LgUa54Nwnc5m5E1731cqBtiiC66TeXgKpfqZEQTuFY3vhHZ2K1BsaFM3X9FqisR28EtZr8: {
|
||||
slot: 10451288,
|
||||
result: { err: null },
|
||||
timestamp: 1589216984,
|
||||
confirmations: "max"
|
||||
confirmations: "max",
|
||||
},
|
||||
"3bLx2PLpkxCxJA5P7HVe8asFdSWXVAh1DrxfkqWE9bWvPRxXE2hqwj1vuSC858fUw3XAGQcHbJknhtNdxY2sehab": {
|
||||
slot: 10516588,
|
||||
result: { err: null },
|
||||
timestamp: 1589247117,
|
||||
confirmations: "max"
|
||||
confirmations: "max",
|
||||
},
|
||||
"3fE8xNgyxbwbvA5MX3wM87ahDDgCVEaaMMSa8UCWWNxojaRYBgrQyiKXLSxcryMWb7sEyVLBWyqUaRWnQCroSqjY": {
|
||||
slot: 10575124,
|
||||
result: { err: null },
|
||||
timestamp: 1589274236,
|
||||
confirmations: "max"
|
||||
confirmations: "max",
|
||||
},
|
||||
"5PWymGjKV7T1oqeqGn139EHFyjNM2dnNhHCUcfD2bmdj8cfF95HpY1uJ84W89c4sJQnmyZxXcYrcjumx2jHUvxZQ": {
|
||||
slot: 12447825,
|
||||
result: { err: null },
|
||||
timestamp: 15901860565,
|
||||
confirmations: "max"
|
||||
confirmations: "max",
|
||||
},
|
||||
"5K4KuqTTRNtzfpxWiwnkePzGfsa3tBEmpMy7vQFR3KWFAZNVY9tvoSaz1Yt5dKxcgsZPio2EsASVDGbQB1HvirGD": {
|
||||
slot: 12450728,
|
||||
result: { err: null },
|
||||
timestamp: 15901874549,
|
||||
confirmations: "max"
|
||||
confirmations: "max",
|
||||
},
|
||||
"45pGoC4Rr3fJ1TKrsiRkhHRbdUeX7633XAGVec6XzVdpRbzQgHhe6ZC6Uq164MPWtiqMg7wCkC6Wy3jy2BqsDEKf": {
|
||||
slot: 12972684,
|
||||
result: { err: null },
|
||||
timestamp: 1590432412,
|
||||
confirmations: "max"
|
||||
}
|
||||
confirmations: "max",
|
||||
},
|
||||
};
|
||||
|
||||
export const CACHED_DETAILS: { [key: string]: ConfirmedTransaction } = {
|
||||
|
@ -71,22 +71,22 @@ export const CACHED_DETAILS: { [key: string]: ConfirmedTransaction } = {
|
|||
accountKeys: [
|
||||
"2ojv9BAiHUrvsm9gxDe7fJSzbNZSJcxZvf8dqmWGHG8S",
|
||||
"4C6NCcLPUgGuBBkV2dJW96mrptMUCp3RG1ft9rqwjFi9",
|
||||
"11111111111111111111111111111111"
|
||||
"11111111111111111111111111111111",
|
||||
],
|
||||
header: {
|
||||
numReadonlySignedAccounts: 0,
|
||||
numReadonlyUnsignedAccounts: 1,
|
||||
numRequiredSignatures: 1
|
||||
numRequiredSignatures: 1,
|
||||
},
|
||||
instructions: [
|
||||
{ accounts: [0, 1], data: "3Bxs411UBrj8QXUb", programIdIndex: 2 }
|
||||
{ accounts: [0, 1], data: "3Bxs411UBrj8QXUb", programIdIndex: 2 },
|
||||
],
|
||||
recentBlockhash: "5Aw8MaMYdYtnfJyyrregWMWGgiMtWZ6GtRzeP6Ufo65Z"
|
||||
recentBlockhash: "5Aw8MaMYdYtnfJyyrregWMWGgiMtWZ6GtRzeP6Ufo65Z",
|
||||
}),
|
||||
[
|
||||
"uQf4pS38FjRF294QFEXizhYkZFjSR9ZSBvvV6MV5b4VpdfRnK3PY9TWZ2qHMQKtte3XwKVLcWqsTF6wL9NEZMty"
|
||||
"uQf4pS38FjRF294QFEXizhYkZFjSR9ZSBvvV6MV5b4VpdfRnK3PY9TWZ2qHMQKtte3XwKVLcWqsTF6wL9NEZMty",
|
||||
]
|
||||
)
|
||||
),
|
||||
},
|
||||
|
||||
DYrfStEEzbV5sftX8LgUa54Nwnc5m5E1731cqBtiiC66TeXgKpfqZEQTuFY3vhHZ2K1BsaFM3X9FqisR28EtZr8: {
|
||||
|
@ -97,26 +97,26 @@ export const CACHED_DETAILS: { [key: string]: ConfirmedTransaction } = {
|
|||
accountKeys: [
|
||||
"2ojv9BAiHUrvsm9gxDe7fJSzbNZSJcxZvf8dqmWGHG8S",
|
||||
"4C6NCcLPUgGuBBkV2dJW96mrptMUCp3RG1ft9rqwjFi9",
|
||||
"11111111111111111111111111111111"
|
||||
"11111111111111111111111111111111",
|
||||
],
|
||||
header: {
|
||||
numReadonlySignedAccounts: 0,
|
||||
numReadonlyUnsignedAccounts: 1,
|
||||
numRequiredSignatures: 1
|
||||
numRequiredSignatures: 1,
|
||||
},
|
||||
instructions: [
|
||||
{
|
||||
accounts: [0, 1],
|
||||
data: "3Bxs3zwYHuDo723R",
|
||||
programIdIndex: 2
|
||||
}
|
||||
programIdIndex: 2,
|
||||
},
|
||||
],
|
||||
recentBlockhash: "4hXYcBdfcadcjfWV17ZwMa4MXe8kbZHYHwr3GzfyqunL"
|
||||
recentBlockhash: "4hXYcBdfcadcjfWV17ZwMa4MXe8kbZHYHwr3GzfyqunL",
|
||||
}),
|
||||
[
|
||||
"DYrfStEEzbV5sftX8LgUa54Nwnc5m5E1731cqBtiiC66TeXgKpfqZEQTuFY3vhHZ2K1BsaFM3X9FqisR28EtZr8"
|
||||
"DYrfStEEzbV5sftX8LgUa54Nwnc5m5E1731cqBtiiC66TeXgKpfqZEQTuFY3vhHZ2K1BsaFM3X9FqisR28EtZr8",
|
||||
]
|
||||
)
|
||||
),
|
||||
},
|
||||
|
||||
"3bLx2PLpkxCxJA5P7HVe8asFdSWXVAh1DrxfkqWE9bWvPRxXE2hqwj1vuSC858fUw3XAGQcHbJknhtNdxY2sehab": {
|
||||
|
@ -127,26 +127,26 @@ export const CACHED_DETAILS: { [key: string]: ConfirmedTransaction } = {
|
|||
accountKeys: [
|
||||
"2ojv9BAiHUrvsm9gxDe7fJSzbNZSJcxZvf8dqmWGHG8S",
|
||||
"4C6NCcLPUgGuBBkV2dJW96mrptMUCp3RG1ft9rqwjFi9",
|
||||
"11111111111111111111111111111111"
|
||||
"11111111111111111111111111111111",
|
||||
],
|
||||
header: {
|
||||
numReadonlySignedAccounts: 0,
|
||||
numReadonlyUnsignedAccounts: 1,
|
||||
numRequiredSignatures: 1
|
||||
numRequiredSignatures: 1,
|
||||
},
|
||||
instructions: [
|
||||
{
|
||||
accounts: [0, 1],
|
||||
data: "3Bxs3zwYHuDo723R",
|
||||
programIdIndex: 2
|
||||
}
|
||||
programIdIndex: 2,
|
||||
},
|
||||
],
|
||||
recentBlockhash: "HSzTGt3PJMeQtFr94gEdeZqTRaBxgS8Wf1zq3MDdNT3L"
|
||||
recentBlockhash: "HSzTGt3PJMeQtFr94gEdeZqTRaBxgS8Wf1zq3MDdNT3L",
|
||||
}),
|
||||
[
|
||||
"3bLx2PLpkxCxJA5P7HVe8asFdSWXVAh1DrxfkqWE9bWvPRxXE2hqwj1vuSC858fUw3XAGQcHbJknhtNdxY2sehab"
|
||||
"3bLx2PLpkxCxJA5P7HVe8asFdSWXVAh1DrxfkqWE9bWvPRxXE2hqwj1vuSC858fUw3XAGQcHbJknhtNdxY2sehab",
|
||||
]
|
||||
)
|
||||
),
|
||||
},
|
||||
|
||||
"3fE8xNgyxbwbvA5MX3wM87ahDDgCVEaaMMSa8UCWWNxojaRYBgrQyiKXLSxcryMWb7sEyVLBWyqUaRWnQCroSqjY": {
|
||||
|
@ -157,26 +157,26 @@ export const CACHED_DETAILS: { [key: string]: ConfirmedTransaction } = {
|
|||
accountKeys: [
|
||||
"2ojv9BAiHUrvsm9gxDe7fJSzbNZSJcxZvf8dqmWGHG8S",
|
||||
"4C6NCcLPUgGuBBkV2dJW96mrptMUCp3RG1ft9rqwjFi9",
|
||||
"11111111111111111111111111111111"
|
||||
"11111111111111111111111111111111",
|
||||
],
|
||||
header: {
|
||||
numReadonlySignedAccounts: 0,
|
||||
numReadonlyUnsignedAccounts: 1,
|
||||
numRequiredSignatures: 1
|
||||
numRequiredSignatures: 1,
|
||||
},
|
||||
instructions: [
|
||||
{
|
||||
accounts: [0, 1],
|
||||
data: "3Bxs3zuKU6mRKSqD",
|
||||
programIdIndex: 2
|
||||
}
|
||||
programIdIndex: 2,
|
||||
},
|
||||
],
|
||||
recentBlockhash: "6f6TBMhUoypfR5HHnEqC6VoooKxEcNad5W3Sf63j9MSD"
|
||||
recentBlockhash: "6f6TBMhUoypfR5HHnEqC6VoooKxEcNad5W3Sf63j9MSD",
|
||||
}),
|
||||
[
|
||||
"3fE8xNgyxbwbvA5MX3wM87ahDDgCVEaaMMSa8UCWWNxojaRYBgrQyiKXLSxcryMWb7sEyVLBWyqUaRWnQCroSqjY"
|
||||
"3fE8xNgyxbwbvA5MX3wM87ahDDgCVEaaMMSa8UCWWNxojaRYBgrQyiKXLSxcryMWb7sEyVLBWyqUaRWnQCroSqjY",
|
||||
]
|
||||
)
|
||||
),
|
||||
},
|
||||
|
||||
"5PWymGjKV7T1oqeqGn139EHFyjNM2dnNhHCUcfD2bmdj8cfF95HpY1uJ84W89c4sJQnmyZxXcYrcjumx2jHUvxZQ": {
|
||||
|
@ -187,26 +187,26 @@ export const CACHED_DETAILS: { [key: string]: ConfirmedTransaction } = {
|
|||
accountKeys: [
|
||||
"HCV5dGFJXRrJ3jhDYA4DCeb9TEDTwGGYXtT3wHksu2Zr",
|
||||
"4C6NCcLPUgGuBBkV2dJW96mrptMUCp3RG1ft9rqwjFi9",
|
||||
"11111111111111111111111111111111"
|
||||
"11111111111111111111111111111111",
|
||||
],
|
||||
header: {
|
||||
numReadonlySignedAccounts: 0,
|
||||
numReadonlyUnsignedAccounts: 1,
|
||||
numRequiredSignatures: 1
|
||||
numRequiredSignatures: 1,
|
||||
},
|
||||
instructions: [
|
||||
{
|
||||
accounts: [0, 1],
|
||||
data: "3Bxs3zrfhSqZJTR1",
|
||||
programIdIndex: 2
|
||||
}
|
||||
programIdIndex: 2,
|
||||
},
|
||||
],
|
||||
recentBlockhash: "3HJNFraT7XGAqMrQs83EKwDGB6LpHVwUMQKGaYMNY49E"
|
||||
recentBlockhash: "3HJNFraT7XGAqMrQs83EKwDGB6LpHVwUMQKGaYMNY49E",
|
||||
}),
|
||||
[
|
||||
"5PWymGjKV7T1oqeqGn139EHFyjNM2dnNhHCUcfD2bmdj8cfF95HpY1uJ84W89c4sJQnmyZxXcYrcjumx2jHUvxZQ"
|
||||
"5PWymGjKV7T1oqeqGn139EHFyjNM2dnNhHCUcfD2bmdj8cfF95HpY1uJ84W89c4sJQnmyZxXcYrcjumx2jHUvxZQ",
|
||||
]
|
||||
)
|
||||
),
|
||||
},
|
||||
|
||||
"5K4KuqTTRNtzfpxWiwnkePzGfsa3tBEmpMy7vQFR3KWFAZNVY9tvoSaz1Yt5dKxcgsZPio2EsASVDGbQB1HvirGD": {
|
||||
|
@ -218,27 +218,27 @@ export const CACHED_DETAILS: { [key: string]: ConfirmedTransaction } = {
|
|||
"6yKHERk8rsbmJxvMpPuwPs1ct3hRiP7xaJF2tvnGU6nK",
|
||||
"4C6NCcLPUgGuBBkV2dJW96mrptMUCp3RG1ft9rqwjFi9",
|
||||
"3o6xgkJ9sTmDeQWyfj3sxwon18fXJB9PV5LDc8sfgR4a",
|
||||
"11111111111111111111111111111111"
|
||||
"11111111111111111111111111111111",
|
||||
],
|
||||
header: {
|
||||
numReadonlySignedAccounts: 0,
|
||||
numReadonlyUnsignedAccounts: 1,
|
||||
numRequiredSignatures: 2
|
||||
numRequiredSignatures: 2,
|
||||
},
|
||||
instructions: [
|
||||
{
|
||||
accounts: [1, 2],
|
||||
data: "3Bxs3ztRCp3tH1yZ",
|
||||
programIdIndex: 3
|
||||
}
|
||||
programIdIndex: 3,
|
||||
},
|
||||
],
|
||||
recentBlockhash: "8eXVUNRxrDgpsEuoTWyLay1LUh2djc3Y8cw2owXRN8cU"
|
||||
recentBlockhash: "8eXVUNRxrDgpsEuoTWyLay1LUh2djc3Y8cw2owXRN8cU",
|
||||
}),
|
||||
[
|
||||
"5K4KuqTTRNtzfpxWiwnkePzGfsa3tBEmpMy7vQFR3KWFAZNVY9tvoSaz1Yt5dKxcgsZPio2EsASVDGbQB1HvirGD",
|
||||
"37tvpG1eAeEBizJPhJvmpC2BY8npwy6K1wrZdNwdRAfWSbkerY3ZwYAPMHbrzoq7tthvWC2qFU28niqLPxbukeXF"
|
||||
"37tvpG1eAeEBizJPhJvmpC2BY8npwy6K1wrZdNwdRAfWSbkerY3ZwYAPMHbrzoq7tthvWC2qFU28niqLPxbukeXF",
|
||||
]
|
||||
)
|
||||
),
|
||||
},
|
||||
|
||||
"45pGoC4Rr3fJ1TKrsiRkhHRbdUeX7633XAGVec6XzVdpRbzQgHhe6ZC6Uq164MPWtiqMg7wCkC6Wy3jy2BqsDEKf": {
|
||||
|
@ -250,26 +250,26 @@ export const CACHED_DETAILS: { [key: string]: ConfirmedTransaction } = {
|
|||
"6yKHERk8rsbmJxvMpPuwPs1ct3hRiP7xaJF2tvnGU6nK",
|
||||
"3o6xgkJ9sTmDeQWyfj3sxwon18fXJB9PV5LDc8sfgR4a",
|
||||
"1nc1nerator11111111111111111111111111111111",
|
||||
"11111111111111111111111111111111"
|
||||
"11111111111111111111111111111111",
|
||||
],
|
||||
header: {
|
||||
numReadonlySignedAccounts: 0,
|
||||
numReadonlyUnsignedAccounts: 1,
|
||||
numRequiredSignatures: 2
|
||||
numRequiredSignatures: 2,
|
||||
},
|
||||
instructions: [
|
||||
{
|
||||
accounts: [1, 2],
|
||||
data: "3Bxs4NNAyLXRbuZZ",
|
||||
programIdIndex: 3
|
||||
}
|
||||
programIdIndex: 3,
|
||||
},
|
||||
],
|
||||
recentBlockhash: "2xnatNUtSbeMRwi3k4vxPwXxeKFQYVuCNRg2rAgydWVP"
|
||||
recentBlockhash: "2xnatNUtSbeMRwi3k4vxPwXxeKFQYVuCNRg2rAgydWVP",
|
||||
}),
|
||||
[
|
||||
"45pGoC4Rr3fJ1TKrsiRkhHRbdUeX7633XAGVec6XzVdpRbzQgHhe6ZC6Uq164MPWtiqMg7wCkC6Wy3jy2BqsDEKf",
|
||||
"2E7CDMTssxTYkdetCKVWQv9X2KNDPiuZrT2Y7647PhFEXuAWWxmHJb3ryCmP29ocQ1SNc7VyJjjm4X3jE8xWDmGY"
|
||||
"2E7CDMTssxTYkdetCKVWQv9X2KNDPiuZrT2Y7647PhFEXuAWWxmHJb3ryCmP29ocQ1SNc7VyJjjm4X3jE8xWDmGY",
|
||||
]
|
||||
)
|
||||
}
|
||||
),
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@ import React from "react";
|
|||
import {
|
||||
Connection,
|
||||
TransactionSignature,
|
||||
ConfirmedTransaction
|
||||
ConfirmedTransaction,
|
||||
} from "@solana/web3.js";
|
||||
import { useCluster } from "../cluster";
|
||||
import { useTransactions, FetchStatus } from "./index";
|
||||
|
@ -18,7 +18,7 @@ type State = { [signature: string]: Details };
|
|||
export enum ActionType {
|
||||
Update,
|
||||
Add,
|
||||
Remove
|
||||
Remove,
|
||||
}
|
||||
|
||||
interface Update {
|
||||
|
@ -46,11 +46,11 @@ function reducer(state: State, action: Action): State {
|
|||
case ActionType.Add: {
|
||||
if (action.signatures.length === 0) return state;
|
||||
const details = { ...state };
|
||||
action.signatures.forEach(signature => {
|
||||
action.signatures.forEach((signature) => {
|
||||
if (!details[signature]) {
|
||||
details[signature] = {
|
||||
fetchStatus: FetchStatus.Fetching,
|
||||
transaction: null
|
||||
transaction: null,
|
||||
};
|
||||
}
|
||||
});
|
||||
|
@ -60,7 +60,7 @@ function reducer(state: State, action: Action): State {
|
|||
case ActionType.Remove: {
|
||||
if (action.signatures.length === 0) return state;
|
||||
const details = { ...state };
|
||||
action.signatures.forEach(signature => {
|
||||
action.signatures.forEach((signature) => {
|
||||
delete details[signature];
|
||||
});
|
||||
return details;
|
||||
|
@ -72,11 +72,11 @@ function reducer(state: State, action: Action): State {
|
|||
details = {
|
||||
...details,
|
||||
fetchStatus: action.fetchStatus,
|
||||
transaction: action.transaction
|
||||
transaction: action.transaction,
|
||||
};
|
||||
return {
|
||||
...state,
|
||||
[action.signature]: details
|
||||
[action.signature]: details,
|
||||
};
|
||||
}
|
||||
break;
|
||||
|
@ -109,13 +109,13 @@ export function DetailsProvider({ children }: DetailsProviderProps) {
|
|||
});
|
||||
|
||||
const removeList: string[] = [];
|
||||
removeSignatures.forEach(s => removeList.push(s));
|
||||
removeSignatures.forEach((s) => removeList.push(s));
|
||||
dispatch({ type: ActionType.Remove, signatures: removeList });
|
||||
|
||||
const fetchList: string[] = [];
|
||||
fetchSignatures.forEach(s => fetchList.push(s));
|
||||
fetchSignatures.forEach((s) => fetchList.push(s));
|
||||
dispatch({ type: ActionType.Add, signatures: fetchList });
|
||||
fetchSignatures.forEach(signature => {
|
||||
fetchSignatures.forEach((signature) => {
|
||||
fetchDetails(dispatch, signature, url);
|
||||
});
|
||||
}, [transactions]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
@ -138,7 +138,7 @@ async function fetchDetails(
|
|||
type: ActionType.Update,
|
||||
fetchStatus: FetchStatus.Fetching,
|
||||
transaction: null,
|
||||
signature
|
||||
signature,
|
||||
});
|
||||
|
||||
let fetchStatus;
|
||||
|
|
|
@ -6,13 +6,13 @@ import {
|
|||
Account,
|
||||
SignatureResult,
|
||||
PublicKey,
|
||||
sendAndConfirmTransaction
|
||||
sendAndConfirmTransaction,
|
||||
} from "@solana/web3.js";
|
||||
import { useQuery } from "../../utils/url";
|
||||
import { useCluster, Cluster, ClusterStatus } from "../cluster";
|
||||
import {
|
||||
DetailsProvider,
|
||||
StateContext as DetailsStateContext
|
||||
StateContext as DetailsStateContext,
|
||||
} from "./details";
|
||||
import base58 from "bs58";
|
||||
import { useFetchAccountInfo } from "../accounts";
|
||||
|
@ -21,7 +21,7 @@ import { CACHED_STATUSES, isCached } from "./cached";
|
|||
export enum FetchStatus {
|
||||
Fetching,
|
||||
FetchFailed,
|
||||
Fetched
|
||||
Fetched,
|
||||
}
|
||||
|
||||
export type Confirmations = number | "max";
|
||||
|
@ -50,7 +50,7 @@ interface State {
|
|||
|
||||
export enum ActionType {
|
||||
UpdateStatus,
|
||||
FetchSignature
|
||||
FetchSignature,
|
||||
}
|
||||
|
||||
interface UpdateStatus {
|
||||
|
@ -79,8 +79,8 @@ function reducer(state: State, action: Action): State {
|
|||
[action.signature]: {
|
||||
...transaction,
|
||||
fetchStatus: FetchStatus.Fetching,
|
||||
info: undefined
|
||||
}
|
||||
info: undefined,
|
||||
},
|
||||
};
|
||||
return { ...state, transactions };
|
||||
} else {
|
||||
|
@ -90,8 +90,8 @@ function reducer(state: State, action: Action): State {
|
|||
[action.signature]: {
|
||||
id: nextId,
|
||||
signature: action.signature,
|
||||
fetchStatus: FetchStatus.Fetching
|
||||
}
|
||||
fetchStatus: FetchStatus.Fetching,
|
||||
},
|
||||
};
|
||||
return { ...state, transactions, idCounter: nextId };
|
||||
}
|
||||
|
@ -105,8 +105,8 @@ function reducer(state: State, action: Action): State {
|
|||
[action.signature]: {
|
||||
...transaction,
|
||||
fetchStatus: action.fetchStatus,
|
||||
info: action.info
|
||||
}
|
||||
info: action.info,
|
||||
},
|
||||
};
|
||||
return { ...state, transactions };
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ type TransactionsProviderProps = { children: React.ReactNode };
|
|||
export function TransactionsProvider({ children }: TransactionsProviderProps) {
|
||||
const [state, dispatch] = React.useReducer(reducer, {
|
||||
idCounter: 0,
|
||||
transactions: {}
|
||||
transactions: {},
|
||||
});
|
||||
|
||||
const { cluster, status: clusterStatus, url } = useCluster();
|
||||
|
@ -135,7 +135,7 @@ export function TransactionsProvider({ children }: TransactionsProviderProps) {
|
|||
|
||||
// Check transaction statuses whenever cluster updates
|
||||
React.useEffect(() => {
|
||||
Object.keys(state.transactions).forEach(signature => {
|
||||
Object.keys(state.transactions).forEach((signature) => {
|
||||
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
|
||||
|
||||
// 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 + "s")
|
||||
query.get(key + "s"),
|
||||
]);
|
||||
React.useEffect(() => {
|
||||
values
|
||||
.filter((value): value is string => value !== null)
|
||||
.flatMap(value => value.split(","))
|
||||
.flatMap((value) => value.split(","))
|
||||
// Remove duplicates
|
||||
.filter((item, pos, self) => self.indexOf(item) === pos)
|
||||
.filter(signature => !state.transactions[signature])
|
||||
.forEach(signature => {
|
||||
.filter((signature) => !state.transactions[signature])
|
||||
.forEach((signature) => {
|
||||
fetchTransactionStatus(dispatch, signature, url, clusterStatus);
|
||||
});
|
||||
}, [values.toString()]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
@ -200,7 +200,7 @@ async function createTestTransaction(
|
|||
const tx = SystemProgram.transfer({
|
||||
fromPubkey: testAccount.publicKey,
|
||||
toPubkey: testAccount.publicKey,
|
||||
lamports: 1
|
||||
lamports: 1,
|
||||
});
|
||||
const signature = await sendAndConfirmTransaction(
|
||||
connection,
|
||||
|
@ -222,7 +222,7 @@ export async function fetchTransactionStatus(
|
|||
) {
|
||||
dispatch({
|
||||
type: ActionType.FetchSignature,
|
||||
signature
|
||||
signature,
|
||||
});
|
||||
|
||||
// We will auto-refetch when status is no longer connecting
|
||||
|
@ -237,7 +237,7 @@ export async function fetchTransactionStatus(
|
|||
try {
|
||||
const connection = new Connection(url);
|
||||
const { value } = await connection.getSignatureStatus(signature, {
|
||||
searchTransactionHistory: true
|
||||
searchTransactionHistory: true,
|
||||
});
|
||||
|
||||
if (value !== null) {
|
||||
|
@ -256,7 +256,7 @@ export async function fetchTransactionStatus(
|
|||
slot: value.slot,
|
||||
timestamp,
|
||||
confirmations,
|
||||
result: { err: value.err }
|
||||
result: { err: value.err },
|
||||
};
|
||||
}
|
||||
fetchStatus = FetchStatus.Fetched;
|
||||
|
@ -270,7 +270,7 @@ export async function fetchTransactionStatus(
|
|||
type: ActionType.UpdateStatus,
|
||||
signature,
|
||||
fetchStatus,
|
||||
info
|
||||
info,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -285,7 +285,7 @@ export function useTransactions() {
|
|||
idCounter: context.idCounter,
|
||||
transactions: Object.values(context.transactions).sort((a, b) =>
|
||||
a.id <= b.id ? 1 : -1
|
||||
)
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ export function register(config?: Config) {
|
|||
function registerValidSW(swUrl: string, config?: Config) {
|
||||
navigator.serviceWorker
|
||||
.register(swUrl)
|
||||
.then(registration => {
|
||||
.then((registration) => {
|
||||
registration.onupdatefound = () => {
|
||||
const installingWorker = registration.installing;
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
@ -106,9 +106,9 @@ function registerValidSW(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.
|
||||
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.
|
||||
const contentType = response.headers.get("content-type");
|
||||
if (
|
||||
|
@ -116,7 +116,7 @@ function checkValidServiceWorker(swUrl: string, config?: Config) {
|
|||
(contentType != null && contentType.indexOf("javascript") === -1)
|
||||
) {
|
||||
// No service worker found. Probably a different app. Reload the page.
|
||||
navigator.serviceWorker.ready.then(registration => {
|
||||
navigator.serviceWorker.ready.then((registration) => {
|
||||
registration.unregister().then(() => {
|
||||
window.location.reload();
|
||||
});
|
||||
|
@ -136,10 +136,10 @@ function checkValidServiceWorker(swUrl: string, config?: Config) {
|
|||
export function unregister() {
|
||||
if ("serviceWorker" in navigator) {
|
||||
navigator.serviceWorker.ready
|
||||
.then(registration => {
|
||||
.then((registration) => {
|
||||
registration.unregister();
|
||||
})
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
console.error(error.message);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -3,14 +3,14 @@ export function displayTimestamp(unixTimestamp: number): string {
|
|||
const dateString = new Intl.DateTimeFormat("en-US", {
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric"
|
||||
day: "numeric",
|
||||
}).format(expireDate);
|
||||
const timeString = new Intl.DateTimeFormat("en-US", {
|
||||
hour: "numeric",
|
||||
minute: "numeric",
|
||||
second: "numeric",
|
||||
hour12: false,
|
||||
timeZoneName: "long"
|
||||
timeZoneName: "long",
|
||||
}).format(expireDate);
|
||||
return `${dateString} at ${timeString}`;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import {
|
|||
SYSVAR_CLOCK_PUBKEY,
|
||||
SYSVAR_RENT_PUBKEY,
|
||||
SYSVAR_REWARDS_PUBKEY,
|
||||
SYSVAR_STAKE_HISTORY_PUBKEY
|
||||
SYSVAR_STAKE_HISTORY_PUBKEY,
|
||||
} from "@solana/web3.js";
|
||||
|
||||
const PROGRAM_IDS = {
|
||||
|
@ -17,13 +17,13 @@ const PROGRAM_IDS = {
|
|||
Storage111111111111111111111111111111111111: "Storage",
|
||||
[SystemProgram.programId.toBase58()]: "System",
|
||||
Vest111111111111111111111111111111111111111: "Vest",
|
||||
[VOTE_PROGRAM_ID.toBase58()]: "Vote"
|
||||
[VOTE_PROGRAM_ID.toBase58()]: "Vote",
|
||||
};
|
||||
|
||||
const LOADER_IDS = {
|
||||
MoveLdr111111111111111111111111111111111111: "Move Loader",
|
||||
NativeLoader1111111111111111111111111111111: "Native Loader",
|
||||
[BpfLoader.programId.toBase58()]: "BPF Loader"
|
||||
[BpfLoader.programId.toBase58()]: "BPF Loader",
|
||||
};
|
||||
|
||||
const SYSVAR_IDS = {
|
||||
|
@ -36,7 +36,7 @@ const SYSVAR_IDS = {
|
|||
[SYSVAR_REWARDS_PUBKEY.toBase58()]: "SYSVAR_REWARDS",
|
||||
SysvarS1otHashes111111111111111111111111111: "SYSVAR_SLOT_HASHES",
|
||||
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 {
|
||||
|
|
|
@ -17,7 +17,7 @@ export function pickCluster(location: Location): Location {
|
|||
|
||||
return {
|
||||
...location,
|
||||
search
|
||||
search,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue