explorer: Introduce scam registry and flag on account pages (#14886)
* explorer: add spam registry * explorer: adjust warning messaging * fix: remove red borders * explorer: change spam to scam * explorer: no need for this to be a prop now
This commit is contained in:
@ -28,6 +28,7 @@ import { SlotHashesCard } from "components/account/SlotHashesCard";
|
|||||||
import { StakeHistoryCard } from "components/account/StakeHistoryCard";
|
import { StakeHistoryCard } from "components/account/StakeHistoryCard";
|
||||||
import { BlockhashesCard } from "components/account/BlockhashesCard";
|
import { BlockhashesCard } from "components/account/BlockhashesCard";
|
||||||
import { ConfigAccountSection } from "components/account/ConfigAccountSection";
|
import { ConfigAccountSection } from "components/account/ConfigAccountSection";
|
||||||
|
import { isScamAccount } from "scamRegistry";
|
||||||
|
|
||||||
const TABS_LOOKUP: { [id: string]: Tab } = {
|
const TABS_LOOKUP: { [id: string]: Tab } = {
|
||||||
"spl-token:mint": {
|
"spl-token:mint": {
|
||||||
@ -129,6 +130,7 @@ function DetailsSections({ pubkey, tab }: { pubkey: PublicKey; tab?: string }) {
|
|||||||
const info = useAccountInfo(address);
|
const info = useAccountInfo(address);
|
||||||
const { status } = useCluster();
|
const { status } = useCluster();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
const isScam = isScamAccount(address);
|
||||||
|
|
||||||
// Fetch account on load
|
// Fetch account on load
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
@ -157,6 +159,12 @@ function DetailsSections({ pubkey, tab }: { pubkey: PublicKey; tab?: string }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
{isScam && (
|
||||||
|
<div className="alert alert-danger alert-scam" role="alert">
|
||||||
|
Warning! This account has been flagged as a scam account. Please be
|
||||||
|
cautious sending SOL to this account.
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
{<InfoSection account={account} />}
|
{<InfoSection account={account} />}
|
||||||
{<MoreSection account={account} tab={moreTab} tabs={tabs} />}
|
{<MoreSection account={account} tab={moreTab} tabs={tabs} />}
|
||||||
</>
|
</>
|
||||||
|
12
explorer/src/scamRegistry.ts
Normal file
12
explorer/src/scamRegistry.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
const scamAddresses = toHash(["GACpXND1SSfTSQMmqGuFvGwXB3jGEYBDRGNzmLfTYwSP"]);
|
||||||
|
|
||||||
|
export function isScamAccount(address: string) {
|
||||||
|
return address in scamAddresses;
|
||||||
|
}
|
||||||
|
|
||||||
|
function toHash(addresses: string[]) {
|
||||||
|
return addresses.reduce((prev: { [addr: string]: boolean }, addr) => {
|
||||||
|
prev[addr] = true;
|
||||||
|
return prev;
|
||||||
|
}, {});
|
||||||
|
}
|
@ -326,3 +326,8 @@ div.inner-cards {
|
|||||||
max-height: 20rem;
|
max-height: 20rem;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.alert-danger.alert-scam {
|
||||||
|
background: red;
|
||||||
|
border: 1px solid red;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user