Cardinal
Search…
⌃K

Identifying a CCS Token

Identifying a ruleset is as simple as checking if a mint's freeze and mint authority address is a properly derived Mint Manager address for that given mint.
1
// Imports
2
import { getMint } from "@solana/spl-token";
3
import { PublicKey } from "@solana/web3.js";
4
import { findMintManagerId } from "@cardinal/creator-standard";
5
6
// Identify token
7
const mintId = new PublicKey("mint-id");
8
const mintInfo = await getMint(connection, mintId);
9
const mintManagerId = findMintManagerId(mintId);
10
if (
11
mintInfo.freezeAuthority?.toString() === mintManagerId.toString() &&
12
mintInfo.mintAuthority?.toString() === mintManagerId.toString()
13
) {
14
console.log("Found CCS token.");
15
} else {
16
console.log(`Token with mint id ${mintId.toString()} is not a CCS token.`);
17
}