Skip to content

Commit

Permalink
Enables the check for community validated = true and includes excepti…
Browse files Browse the repository at this point in the history
…ons (#1230)

* rename AllowedDuplicate type to AllowedException to generalize usage, and record Community Validated field for exceptions

* exceptions for community validated=false

* explain that there are exceptions in stdout - improves usability
  • Loading branch information
randomshinichi authored Jan 24, 2024
1 parent dee28ef commit a414f92
Show file tree
Hide file tree
Showing 4 changed files with 3,813 additions and 101 deletions.
9 changes: 5 additions & 4 deletions src/logic.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import * as core from "@actions/core";
import { exec } from "@actions/exec";
import { canOnlyAddOneToken, detectDuplicateSymbol, detectDuplicateMints as detectDuplicateMints, validMintAddress, noEditsToPreviousLinesAllowed } from "./utils/validate";
import { detectDuplicateSymbol, detectDuplicateMints, canOnlyAddOneToken, validMintAddress, noEditsToPreviousLinesAllowed, isCommunityValidated } from "./utils/validate";
import { ValidatedTokensData } from "./types/types";
import { indexToLineNumber } from "./utils/validate";
import { parse } from "csv-parse/sync";
import fs from "fs";
import { allowedDuplicateSymbols, allowedNotCommunityValidated } from "./utils/duplicate-symbols";

export async function validateValidatedTokensCsv(filename: string): Promise<number> {
const [records, recordsRaw] = parseCsv(filename);
Expand All @@ -25,13 +26,13 @@ export async function validateValidatedTokensCsv(filename: string): Promise<numb
attemptsToAddMultipleTokens = canOnlyAddOneToken(recordsPrevious, records)
invalidMintAddresses = validMintAddress(records);
noEditsAllowed = noEditsToPreviousLinesAllowed(recordsPrevious, records);
// notCommunityValidated = validCommunityValidated(records);
notCommunityValidated = isCommunityValidated(records);

console.log("No More Duplicate Symbols:", duplicateSymbols);
console.log("No More Duplicate Symbols:", duplicateSymbols, `(${allowedDuplicateSymbols.length} exceptions)`);
console.log("Duplicate Mints:", duplicateMints);
console.log("Attempts to Add Multiple Tokens:", attemptsToAddMultipleTokens);
console.log("Invalid Mint Addresses:", invalidMintAddresses);
console.log("Not Community Validated:", notCommunityValidated);
console.log("Not Community Validated:", notCommunityValidated, `(${allowedNotCommunityValidated.length} exceptions)`);
console.log("Edits to Existing Tokens:", noEditsAllowed);
return (duplicateSymbols + duplicateMints + attemptsToAddMultipleTokens + invalidMintAddresses + noEditsAllowed)
}
Expand Down
3 changes: 2 additions & 1 deletion src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ export interface ValidatedTokensData {
Line: number;
}

export interface DuplicateSymbol {
export interface AllowedException {
Name: string;
Symbol: string;
Mint: string;
"Community Validated": boolean;
}
Loading

0 comments on commit a414f92

Please sign in to comment.