phygital-token-mcp 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -0
- package/cursor-mcp.example.json +8 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +481 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/docs.d.ts +17 -0
- package/dist/lib/docs.js +121 -0
- package/dist/lib/docs.js.map +1 -0
- package/dist/lib/format.d.ts +13 -0
- package/dist/lib/format.js +12 -0
- package/dist/lib/format.js.map +1 -0
- package/dist/lib/gating-json.d.ts +127 -0
- package/dist/lib/gating-json.js +346 -0
- package/dist/lib/gating-json.js.map +1 -0
- package/dist/lib/graphify.d.ts +2 -0
- package/dist/lib/graphify.js +35 -0
- package/dist/lib/graphify.js.map +1 -0
- package/dist/lib/instructions.d.ts +131 -0
- package/dist/lib/instructions.js +232 -0
- package/dist/lib/instructions.js.map +1 -0
- package/dist/lib/paths.d.ts +14 -0
- package/dist/lib/paths.js +77 -0
- package/dist/lib/paths.js.map +1 -0
- package/dist/lib/rpc.d.ts +3 -0
- package/dist/lib/rpc.js +22 -0
- package/dist/lib/rpc.js.map +1 -0
- package/dist/lib/sdk-surface.d.ts +33 -0
- package/dist/lib/sdk-surface.js +101 -0
- package/dist/lib/sdk-surface.js.map +1 -0
- package/dist/lib/verification.d.ts +43 -0
- package/dist/lib/verification.js +166 -0
- package/dist/lib/verification.js.map +1 -0
- package/docs/building-on-phygital/overview.md +46 -0
- package/docs/building-on-phygital/rust-cpi.md +55 -0
- package/docs/glossary.md +43 -0
- package/docs/sdk/surface-area.md +77 -0
- package/docs/verification/methods.md +58 -0
- package/docs/verification/overview.md +70 -0
- package/docs/verification/verify-asset-composable.md +97 -0
- package/package.json +52 -0
package/dist/lib/docs.js
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { readdir, readFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { GLOSSARY_PATH, MCP_DOCS_DIR, pathExists, resolveSdkDocsDir, resolveSdkReadmePath, } from "./paths.js";
|
|
4
|
+
async function collectMarkdownFiles(dir, category, prefix = "") {
|
|
5
|
+
const entries = [];
|
|
6
|
+
const items = await readdir(dir, { withFileTypes: true });
|
|
7
|
+
for (const item of items.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
8
|
+
const relative = prefix ? `${prefix}/${item.name}` : item.name;
|
|
9
|
+
const fullPath = path.join(dir, item.name);
|
|
10
|
+
if (item.isDirectory()) {
|
|
11
|
+
entries.push(...(await collectMarkdownFiles(fullPath, category, relative)));
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
if (!item.name.endsWith(".md")) {
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
const title = item.name.replace(/\.md$/, "");
|
|
18
|
+
entries.push({
|
|
19
|
+
id: `${category}:${relative.replace(/\.md$/, "")}`,
|
|
20
|
+
title,
|
|
21
|
+
path: fullPath,
|
|
22
|
+
category,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return entries;
|
|
26
|
+
}
|
|
27
|
+
export async function listDocs() {
|
|
28
|
+
const docs = [];
|
|
29
|
+
const sdkDocsDir = await resolveSdkDocsDir();
|
|
30
|
+
if (sdkDocsDir) {
|
|
31
|
+
const gatingDir = path.join(sdkDocsDir, "gating");
|
|
32
|
+
if (await pathExists(gatingDir)) {
|
|
33
|
+
docs.push(...(await collectMarkdownFiles(gatingDir, "gating")));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (await pathExists(MCP_DOCS_DIR)) {
|
|
37
|
+
const verificationDir = path.join(MCP_DOCS_DIR, "verification");
|
|
38
|
+
const buildingDir = path.join(MCP_DOCS_DIR, "building-on-phygital");
|
|
39
|
+
const sdkDir = path.join(MCP_DOCS_DIR, "sdk");
|
|
40
|
+
if (await pathExists(verificationDir)) {
|
|
41
|
+
docs.push(...(await collectMarkdownFiles(verificationDir, "verification")));
|
|
42
|
+
}
|
|
43
|
+
if (await pathExists(buildingDir)) {
|
|
44
|
+
docs.push(...(await collectMarkdownFiles(buildingDir, "building-on-phygital")));
|
|
45
|
+
}
|
|
46
|
+
if (await pathExists(sdkDir)) {
|
|
47
|
+
docs.push(...(await collectMarkdownFiles(sdkDir, "sdk")));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (await pathExists(GLOSSARY_PATH)) {
|
|
51
|
+
docs.push({
|
|
52
|
+
id: "glossary",
|
|
53
|
+
title: "Glossary",
|
|
54
|
+
path: GLOSSARY_PATH,
|
|
55
|
+
category: "glossary",
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
const sdkReadmePath = await resolveSdkReadmePath();
|
|
59
|
+
if (sdkReadmePath) {
|
|
60
|
+
docs.push({
|
|
61
|
+
id: "readme",
|
|
62
|
+
title: "SDK README",
|
|
63
|
+
path: sdkReadmePath,
|
|
64
|
+
category: "readme",
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return docs;
|
|
68
|
+
}
|
|
69
|
+
export async function readDocById(docId) {
|
|
70
|
+
const docs = await listDocs();
|
|
71
|
+
const match = docs.find((doc) => doc.id === docId);
|
|
72
|
+
if (!match) {
|
|
73
|
+
throw new Error(`Unknown doc id "${docId}". Use list_docs or search_docs to discover ids.`);
|
|
74
|
+
}
|
|
75
|
+
return readFile(match.path, "utf8");
|
|
76
|
+
}
|
|
77
|
+
function scoreLine(line, query) {
|
|
78
|
+
const lowerLine = line.toLowerCase();
|
|
79
|
+
const lowerQuery = query.toLowerCase();
|
|
80
|
+
let score = 0;
|
|
81
|
+
if (lowerLine.includes(lowerQuery)) {
|
|
82
|
+
score += 10;
|
|
83
|
+
}
|
|
84
|
+
for (const term of lowerQuery.split(/\s+/).filter(Boolean)) {
|
|
85
|
+
if (lowerLine.includes(term)) {
|
|
86
|
+
score += 3;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return score;
|
|
90
|
+
}
|
|
91
|
+
export async function searchDocs(query, limit = 8) {
|
|
92
|
+
const docs = await listDocs();
|
|
93
|
+
const results = [];
|
|
94
|
+
for (const doc of docs) {
|
|
95
|
+
const content = await readFile(doc.path, "utf8");
|
|
96
|
+
const lines = content.split("\n");
|
|
97
|
+
let bestScore = 0;
|
|
98
|
+
let bestSnippet = "";
|
|
99
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
100
|
+
const line = lines[index] ?? "";
|
|
101
|
+
const score = scoreLine(line, query);
|
|
102
|
+
if (score > bestScore) {
|
|
103
|
+
bestScore = score;
|
|
104
|
+
const start = Math.max(0, index - 1);
|
|
105
|
+
const end = Math.min(lines.length, index + 2);
|
|
106
|
+
bestSnippet = lines.slice(start, end).join("\n").trim();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (bestScore > 0) {
|
|
110
|
+
results.push({
|
|
111
|
+
id: doc.id,
|
|
112
|
+
title: doc.title,
|
|
113
|
+
category: doc.category,
|
|
114
|
+
snippet: bestSnippet,
|
|
115
|
+
score: bestScore,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return results.sort((a, b) => b.score - a.score).slice(0, limit);
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=docs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs.js","sourceRoot":"","sources":["../../src/lib/docs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,aAAa,EACb,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AAiBpB,KAAK,UAAU,oBAAoB,CACjC,GAAW,EACX,QAAqB,EACrB,MAAM,GAAG,EAAE;IAEX,MAAM,OAAO,GAAe,EAAE,CAAC;IAC/B,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,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AAC,EAAE;gBACV,KAAK,EAAE,GAAG,CAAC,KAAK;gBAChB,QAAQ,EAAE,GAAG,CAAC,QAAQ;gBACtB,OAAO,EAAE,WAAW;gBACpB,KAAK,EAAE,SAAS;aACjB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare function jsonStringify(value: unknown): string;
|
|
2
|
+
export declare function textResult(text: string): {
|
|
3
|
+
content: {
|
|
4
|
+
type: "text";
|
|
5
|
+
text: string;
|
|
6
|
+
}[];
|
|
7
|
+
};
|
|
8
|
+
export declare function jsonResult(value: unknown): {
|
|
9
|
+
content: {
|
|
10
|
+
type: "text";
|
|
11
|
+
text: string;
|
|
12
|
+
}[];
|
|
13
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function jsonStringify(value) {
|
|
2
|
+
return JSON.stringify(value, (_key, current) => (typeof current === "bigint" ? current.toString() : current), 2);
|
|
3
|
+
}
|
|
4
|
+
export function textResult(text) {
|
|
5
|
+
return {
|
|
6
|
+
content: [{ type: "text", text }],
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export function jsonResult(value) {
|
|
10
|
+
return textResult(jsonStringify(value));
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/lib/format.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,IAAI,CAAC,SAAS,CACnB,KAAK,EACL,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAC/E,CAAC,CACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,CAAC;KAC3C,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,OAAO,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import type { GatingFilter, GatingTier } from "phygital-token-sdk";
|
|
2
|
+
export declare function parseGatingFilter(raw: unknown): GatingFilter;
|
|
3
|
+
export declare function parseGatingTiers(raw: unknown): GatingTier[];
|
|
4
|
+
export declare const GATING_FILTER_SCHEMA: {
|
|
5
|
+
readonly description: "Composable GatingFilter tree evaluated against wallet DAS assets";
|
|
6
|
+
readonly predicate: {
|
|
7
|
+
readonly description: "Per-asset match — all set fields must match the SAME owned asset row";
|
|
8
|
+
readonly fields: {
|
|
9
|
+
readonly collection: "{ op: \"eq\"|\"neq\"|\"in\"|\"notIn\", value?: string, values?: string[] }";
|
|
10
|
+
readonly mint: "same as collection";
|
|
11
|
+
readonly traits: "{ all: GatingTrait[] } | { any: GatingTrait[] }";
|
|
12
|
+
readonly balance: "{ min?: bigint|string, max?: bigint|string } — raw token units";
|
|
13
|
+
};
|
|
14
|
+
readonly trait: "{ trait_type: string, op: \"eq\"|\"neq\"|\"in\"|\"notIn\"|\"gte\"|\"lte\"|\"between\", value?, values?, min?, max? }";
|
|
15
|
+
};
|
|
16
|
+
readonly filterKinds: {
|
|
17
|
+
readonly count: "{ count: { min: number, max?: number, match: GatingAssetPredicate } }";
|
|
18
|
+
readonly totalBalance: "{ totalBalance: { mint: string, min?: bigint|string, max?: bigint|string } }";
|
|
19
|
+
readonly and: "{ and: GatingFilter[] }";
|
|
20
|
+
readonly or: "{ or: GatingFilter[] }";
|
|
21
|
+
readonly not: "{ not: GatingFilter }";
|
|
22
|
+
};
|
|
23
|
+
readonly tier: "{ id: string, filter: GatingFilter }";
|
|
24
|
+
readonly sdkBuilders: {
|
|
25
|
+
readonly Gating: readonly ["and", "or", "not", "tier", "count", "totalBalance", "eq", "neq", "in", "notIn", "trait", "traitsAll", "traitsAny", "balance"];
|
|
26
|
+
readonly GatingTraitValue: readonly ["eq", "neq", "in", "notIn", "gte", "lte", "between"];
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export declare const GATING_TIER_EXAMPLE: ({
|
|
30
|
+
id: string;
|
|
31
|
+
filter: {
|
|
32
|
+
count: {
|
|
33
|
+
min: number;
|
|
34
|
+
match: {
|
|
35
|
+
collection: {
|
|
36
|
+
op: string;
|
|
37
|
+
value: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
and?: undefined;
|
|
42
|
+
};
|
|
43
|
+
} | {
|
|
44
|
+
id: string;
|
|
45
|
+
filter: {
|
|
46
|
+
and: ({
|
|
47
|
+
count: {
|
|
48
|
+
min: number;
|
|
49
|
+
match: {
|
|
50
|
+
collection: {
|
|
51
|
+
op: string;
|
|
52
|
+
value: string;
|
|
53
|
+
};
|
|
54
|
+
traits: {
|
|
55
|
+
all: ({
|
|
56
|
+
trait_type: string;
|
|
57
|
+
op: string;
|
|
58
|
+
value: string;
|
|
59
|
+
} | {
|
|
60
|
+
trait_type: string;
|
|
61
|
+
op: string;
|
|
62
|
+
value: number;
|
|
63
|
+
})[];
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
totalBalance?: undefined;
|
|
68
|
+
} | {
|
|
69
|
+
totalBalance: {
|
|
70
|
+
mint: string;
|
|
71
|
+
min: string;
|
|
72
|
+
};
|
|
73
|
+
count?: undefined;
|
|
74
|
+
})[];
|
|
75
|
+
count?: undefined;
|
|
76
|
+
};
|
|
77
|
+
})[];
|
|
78
|
+
export type GatingRecipe = {
|
|
79
|
+
id: string;
|
|
80
|
+
title: string;
|
|
81
|
+
description: string;
|
|
82
|
+
filter?: unknown;
|
|
83
|
+
tiers?: unknown;
|
|
84
|
+
footgun?: boolean;
|
|
85
|
+
};
|
|
86
|
+
export declare const GATING_RECIPES: GatingRecipe[];
|
|
87
|
+
export declare function getGatingRecipe(id: string): GatingRecipe;
|
|
88
|
+
export declare const GATING_OVERVIEW: {
|
|
89
|
+
readonly question: "Given what this phygital asset owner holds in their wallet, do they qualify?";
|
|
90
|
+
readonly flow: readonly ["1. Resolve owner from asset secp256r1 public key (on-chain asset account)", "2. Paginate DAS searchAssets for that owner (NFTs, cNFTs, fungible)", "3. Evaluate filter tree(s) against loaded assets"];
|
|
91
|
+
readonly dimensions: readonly [{
|
|
92
|
+
readonly field: "collection";
|
|
93
|
+
readonly source: "DAS grouping key=collection";
|
|
94
|
+
readonly example: "hold any NFT from collection";
|
|
95
|
+
}, {
|
|
96
|
+
readonly field: "mint";
|
|
97
|
+
readonly source: "DAS asset id";
|
|
98
|
+
readonly example: "hold specific NFT/token mint";
|
|
99
|
+
}, {
|
|
100
|
+
readonly field: "traits";
|
|
101
|
+
readonly source: "metadata.attributes";
|
|
102
|
+
readonly example: "Rarity=Gold on same NFT";
|
|
103
|
+
}, {
|
|
104
|
+
readonly field: "balance";
|
|
105
|
+
readonly source: "token_info.balance raw units";
|
|
106
|
+
readonly example: "min balance on asset row";
|
|
107
|
+
}];
|
|
108
|
+
readonly aggregations: readonly [{
|
|
109
|
+
readonly api: "Gating.count(min, predicate, max?)";
|
|
110
|
+
readonly analogue: "COUNT … HAVING — use count(1,…) for existence";
|
|
111
|
+
}, {
|
|
112
|
+
readonly api: "Gating.totalBalance(mint, min?, max?)";
|
|
113
|
+
readonly analogue: "SUM(balance) wallet-wide for mint";
|
|
114
|
+
}, {
|
|
115
|
+
readonly api: "Gating.and / or / not";
|
|
116
|
+
readonly analogue: "boolean composition";
|
|
117
|
+
}];
|
|
118
|
+
readonly sameAssetVsWallet: readonly [{
|
|
119
|
+
readonly intent: "One NFT has Gold AND Level >= 5";
|
|
120
|
+
readonly correct: "Single predicate with traits: Gating.traitsAll(...)";
|
|
121
|
+
}, {
|
|
122
|
+
readonly intent: "Wallet holds mint A AND mint B";
|
|
123
|
+
readonly correct: "Gating.and(Gating.count(1,{mint:A}), Gating.count(1,{mint:B}))";
|
|
124
|
+
}];
|
|
125
|
+
readonly requirements: readonly ["DAS-capable RPC (Helius)", "assetPublicKey base64url secp256r1 pubkey"];
|
|
126
|
+
readonly docIds: readonly ["gating:README", "gating:overview", "gating:predicates", "gating:filters-and-composition", "gating:tiers", "gating:evaluation-and-errors", "gating:recipes"];
|
|
127
|
+
};
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
function reviveBigInts(value) {
|
|
2
|
+
if (Array.isArray(value)) {
|
|
3
|
+
return value.map(reviveBigInts);
|
|
4
|
+
}
|
|
5
|
+
if (value && typeof value === "object") {
|
|
6
|
+
const next = {};
|
|
7
|
+
for (const [key, child] of Object.entries(value)) {
|
|
8
|
+
if (key === "min" || key === "max") {
|
|
9
|
+
if (typeof child === "string" && /^-?\d+n?$/.test(child)) {
|
|
10
|
+
next[key] = BigInt(child.replace(/n$/, ""));
|
|
11
|
+
continue;
|
|
12
|
+
}
|
|
13
|
+
if (typeof child === "number" && Number.isInteger(child)) {
|
|
14
|
+
next[key] = BigInt(child);
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
next[key] = reviveBigInts(child);
|
|
19
|
+
}
|
|
20
|
+
return next;
|
|
21
|
+
}
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
export function parseGatingFilter(raw) {
|
|
25
|
+
if (!raw || typeof raw !== "object") {
|
|
26
|
+
throw new Error("filter must be a JSON object (GatingFilter tree).");
|
|
27
|
+
}
|
|
28
|
+
return reviveBigInts(raw);
|
|
29
|
+
}
|
|
30
|
+
export function parseGatingTiers(raw) {
|
|
31
|
+
if (!Array.isArray(raw)) {
|
|
32
|
+
throw new Error("tiers must be a JSON array of { id, filter } objects.");
|
|
33
|
+
}
|
|
34
|
+
const tiers = [];
|
|
35
|
+
for (const item of raw) {
|
|
36
|
+
if (!item || typeof item !== "object") {
|
|
37
|
+
throw new Error("Each tier must be an object with id and filter.");
|
|
38
|
+
}
|
|
39
|
+
const { id, filter } = item;
|
|
40
|
+
if (typeof id !== "string" || !id.trim()) {
|
|
41
|
+
throw new Error("Each tier requires a non-empty string id.");
|
|
42
|
+
}
|
|
43
|
+
tiers.push({
|
|
44
|
+
id,
|
|
45
|
+
filter: parseGatingFilter(filter),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return tiers;
|
|
49
|
+
}
|
|
50
|
+
export const GATING_FILTER_SCHEMA = {
|
|
51
|
+
description: "Composable GatingFilter tree evaluated against wallet DAS assets",
|
|
52
|
+
predicate: {
|
|
53
|
+
description: "Per-asset match — all set fields must match the SAME owned asset row",
|
|
54
|
+
fields: {
|
|
55
|
+
collection: '{ op: "eq"|"neq"|"in"|"notIn", value?: string, values?: string[] }',
|
|
56
|
+
mint: "same as collection",
|
|
57
|
+
traits: '{ all: GatingTrait[] } | { any: GatingTrait[] }',
|
|
58
|
+
balance: '{ min?: bigint|string, max?: bigint|string } — raw token units',
|
|
59
|
+
},
|
|
60
|
+
trait: '{ trait_type: string, op: "eq"|"neq"|"in"|"notIn"|"gte"|"lte"|"between", value?, values?, min?, max? }',
|
|
61
|
+
},
|
|
62
|
+
filterKinds: {
|
|
63
|
+
count: '{ count: { min: number, max?: number, match: GatingAssetPredicate } }',
|
|
64
|
+
totalBalance: '{ totalBalance: { mint: string, min?: bigint|string, max?: bigint|string } }',
|
|
65
|
+
and: '{ and: GatingFilter[] }',
|
|
66
|
+
or: '{ or: GatingFilter[] }',
|
|
67
|
+
not: '{ not: GatingFilter }',
|
|
68
|
+
},
|
|
69
|
+
tier: '{ id: string, filter: GatingFilter }',
|
|
70
|
+
sdkBuilders: {
|
|
71
|
+
Gating: ["and", "or", "not", "tier", "count", "totalBalance", "eq", "neq", "in", "notIn", "trait", "traitsAll", "traitsAny", "balance"],
|
|
72
|
+
GatingTraitValue: ["eq", "neq", "in", "notIn", "gte", "lte", "between"],
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
export const GATING_TIER_EXAMPLE = [
|
|
76
|
+
{
|
|
77
|
+
id: "bronze",
|
|
78
|
+
filter: {
|
|
79
|
+
count: {
|
|
80
|
+
min: 1,
|
|
81
|
+
match: {
|
|
82
|
+
collection: { op: "eq", value: "CollectionMintAddress..." },
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
id: "silver",
|
|
89
|
+
filter: {
|
|
90
|
+
count: {
|
|
91
|
+
min: 3,
|
|
92
|
+
match: {
|
|
93
|
+
collection: { op: "eq", value: "CollectionMintAddress..." },
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: "gold",
|
|
100
|
+
filter: {
|
|
101
|
+
and: [
|
|
102
|
+
{
|
|
103
|
+
count: {
|
|
104
|
+
min: 1,
|
|
105
|
+
match: {
|
|
106
|
+
collection: { op: "eq", value: "CollectionMintAddress..." },
|
|
107
|
+
traits: {
|
|
108
|
+
all: [
|
|
109
|
+
{ trait_type: "Rarity", op: "eq", value: "Gold" },
|
|
110
|
+
{ trait_type: "Level", op: "gte", value: 10 },
|
|
111
|
+
],
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
totalBalance: { mint: "RewardTokenMint...", min: "10000000" },
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
];
|
|
123
|
+
export const GATING_RECIPES = [
|
|
124
|
+
{
|
|
125
|
+
id: "collection_any",
|
|
126
|
+
title: "Hold any NFT from a collection",
|
|
127
|
+
description: "At least one asset from collection mint",
|
|
128
|
+
filter: {
|
|
129
|
+
count: {
|
|
130
|
+
min: 1,
|
|
131
|
+
match: { collection: { op: "eq", value: "CollectionMint..." } },
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: "specific_mint",
|
|
137
|
+
title: "Hold a specific NFT mint",
|
|
138
|
+
description: "Wallet owns a particular mint",
|
|
139
|
+
filter: {
|
|
140
|
+
count: { min: 1, match: { mint: { op: "eq", value: "NftMint..." } } },
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: "collection_count_n",
|
|
145
|
+
title: "Hold N NFTs from a collection",
|
|
146
|
+
description: "Minimum count from same collection",
|
|
147
|
+
filter: {
|
|
148
|
+
count: {
|
|
149
|
+
min: 5,
|
|
150
|
+
match: { collection: { op: "eq", value: "CollectionMint..." } },
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
id: "gold_trait_same_nft",
|
|
156
|
+
title: "Gold trait on same NFT",
|
|
157
|
+
description: "Traits must match on one asset row",
|
|
158
|
+
filter: {
|
|
159
|
+
count: {
|
|
160
|
+
min: 1,
|
|
161
|
+
match: {
|
|
162
|
+
collection: { op: "eq", value: "CollectionMint..." },
|
|
163
|
+
traits: {
|
|
164
|
+
all: [{ trait_type: "Rarity", op: "eq", value: "Gold" }],
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
id: "gold_or_platinum",
|
|
172
|
+
title: "Gold OR Platinum on same NFT",
|
|
173
|
+
description: "traits.any for alternates on one asset",
|
|
174
|
+
filter: {
|
|
175
|
+
count: {
|
|
176
|
+
min: 1,
|
|
177
|
+
match: {
|
|
178
|
+
collection: { op: "eq", value: "CollectionMint..." },
|
|
179
|
+
traits: {
|
|
180
|
+
any: [{ trait_type: "Rarity", op: "in", values: ["Gold", "Platinum"] }],
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
id: "min_token_balance",
|
|
188
|
+
title: "Minimum wallet token balance",
|
|
189
|
+
description: "Summed raw balance across wallet for a mint",
|
|
190
|
+
filter: {
|
|
191
|
+
totalBalance: { mint: "TokenMint...", min: "1000000" },
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
id: "mint_a_and_mint_b",
|
|
196
|
+
title: "Hold mint A and mint B (any two assets)",
|
|
197
|
+
description: "Use and + two count(1) — different assets OK",
|
|
198
|
+
filter: {
|
|
199
|
+
and: [
|
|
200
|
+
{ count: { min: 1, match: { mint: { op: "eq", value: "MintA..." } } } },
|
|
201
|
+
{ count: { min: 1, match: { mint: { op: "eq", value: "MintB..." } } } },
|
|
202
|
+
],
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
id: "vip_or_collection_plus_balance",
|
|
207
|
+
title: "VIP pass OR (collection + token balance)",
|
|
208
|
+
description: "or composition for alternative unlock paths",
|
|
209
|
+
filter: {
|
|
210
|
+
or: [
|
|
211
|
+
{ count: { min: 1, match: { mint: { op: "eq", value: "VIPPassMint..." } } } },
|
|
212
|
+
{
|
|
213
|
+
and: [
|
|
214
|
+
{
|
|
215
|
+
count: {
|
|
216
|
+
min: 1,
|
|
217
|
+
match: { collection: { op: "eq", value: "CollectionMint..." } },
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
{ totalBalance: { mint: "TokenMint...", min: "5000000" } },
|
|
221
|
+
],
|
|
222
|
+
},
|
|
223
|
+
],
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
id: "exclude_banned_collection",
|
|
228
|
+
title: "Exclude banned collection",
|
|
229
|
+
description: "not + count(1)",
|
|
230
|
+
filter: {
|
|
231
|
+
not: {
|
|
232
|
+
count: {
|
|
233
|
+
min: 1,
|
|
234
|
+
match: { collection: { op: "eq", value: "BannedCol..." } },
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
id: "bronze_silver_gold_tiers",
|
|
241
|
+
title: "Bronze / silver / gold tiers",
|
|
242
|
+
description: "Multi-tier evaluateAssetGating config",
|
|
243
|
+
tiers: GATING_TIER_EXAMPLE,
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
id: "footgun_traits_split_nfts",
|
|
247
|
+
title: "FOOTGUN: traits split across NFTs",
|
|
248
|
+
description: "WRONG — requires one NFT to be both Gold and Silver",
|
|
249
|
+
footgun: true,
|
|
250
|
+
filter: {
|
|
251
|
+
count: {
|
|
252
|
+
min: 1,
|
|
253
|
+
match: {
|
|
254
|
+
traits: {
|
|
255
|
+
all: [
|
|
256
|
+
{ trait_type: "Rarity", op: "eq", value: "Gold" },
|
|
257
|
+
{ trait_type: "Rarity", op: "eq", value: "Silver" },
|
|
258
|
+
],
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
id: "footgun_two_counts_for_traits",
|
|
266
|
+
title: "FOOTGUN: two count(1) for traits on one NFT",
|
|
267
|
+
description: "WRONG — checks two different assets. Use traitsAll on one predicate.",
|
|
268
|
+
footgun: true,
|
|
269
|
+
filter: {
|
|
270
|
+
and: [
|
|
271
|
+
{
|
|
272
|
+
count: {
|
|
273
|
+
min: 1,
|
|
274
|
+
match: {
|
|
275
|
+
traits: { all: [{ trait_type: "Rarity", op: "eq", value: "Gold" }] },
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
count: {
|
|
281
|
+
min: 1,
|
|
282
|
+
match: {
|
|
283
|
+
traits: { all: [{ trait_type: "Level", op: "gte", value: 5 }] },
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
],
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
id: "footgun_ui_decimals_in_balance",
|
|
292
|
+
title: "FOOTGUN: UI decimals in balance",
|
|
293
|
+
description: "WRONG for 6-decimal token — use raw units (1 USDC = 1000000)",
|
|
294
|
+
footgun: true,
|
|
295
|
+
filter: {
|
|
296
|
+
totalBalance: { mint: "USDC...", min: "1" },
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
];
|
|
300
|
+
export function getGatingRecipe(id) {
|
|
301
|
+
const recipe = GATING_RECIPES.find((r) => r.id === id);
|
|
302
|
+
if (!recipe) {
|
|
303
|
+
throw new Error(`Unknown recipe "${id}". Use list_gating_recipes for available ids.`);
|
|
304
|
+
}
|
|
305
|
+
return recipe;
|
|
306
|
+
}
|
|
307
|
+
export const GATING_OVERVIEW = {
|
|
308
|
+
question: "Given what this phygital asset owner holds in their wallet, do they qualify?",
|
|
309
|
+
flow: [
|
|
310
|
+
"1. Resolve owner from asset secp256r1 public key (on-chain asset account)",
|
|
311
|
+
"2. Paginate DAS searchAssets for that owner (NFTs, cNFTs, fungible)",
|
|
312
|
+
"3. Evaluate filter tree(s) against loaded assets",
|
|
313
|
+
],
|
|
314
|
+
dimensions: [
|
|
315
|
+
{ field: "collection", source: "DAS grouping key=collection", example: "hold any NFT from collection" },
|
|
316
|
+
{ field: "mint", source: "DAS asset id", example: "hold specific NFT/token mint" },
|
|
317
|
+
{ field: "traits", source: "metadata.attributes", example: "Rarity=Gold on same NFT" },
|
|
318
|
+
{ field: "balance", source: "token_info.balance raw units", example: "min balance on asset row" },
|
|
319
|
+
],
|
|
320
|
+
aggregations: [
|
|
321
|
+
{ api: "Gating.count(min, predicate, max?)", analogue: "COUNT … HAVING — use count(1,…) for existence" },
|
|
322
|
+
{ api: "Gating.totalBalance(mint, min?, max?)", analogue: "SUM(balance) wallet-wide for mint" },
|
|
323
|
+
{ api: "Gating.and / or / not", analogue: "boolean composition" },
|
|
324
|
+
],
|
|
325
|
+
sameAssetVsWallet: [
|
|
326
|
+
{
|
|
327
|
+
intent: "One NFT has Gold AND Level >= 5",
|
|
328
|
+
correct: "Single predicate with traits: Gating.traitsAll(...)",
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
intent: "Wallet holds mint A AND mint B",
|
|
332
|
+
correct: "Gating.and(Gating.count(1,{mint:A}), Gating.count(1,{mint:B}))",
|
|
333
|
+
},
|
|
334
|
+
],
|
|
335
|
+
requirements: ["DAS-capable RPC (Helius)", "assetPublicKey base64url secp256r1 pubkey"],
|
|
336
|
+
docIds: [
|
|
337
|
+
"gating:README",
|
|
338
|
+
"gating:overview",
|
|
339
|
+
"gating:predicates",
|
|
340
|
+
"gating:filters-and-composition",
|
|
341
|
+
"gating:tiers",
|
|
342
|
+
"gating:evaluation-and-errors",
|
|
343
|
+
"gating:recipes",
|
|
344
|
+
],
|
|
345
|
+
};
|
|
346
|
+
//# sourceMappingURL=gating-json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gating-json.js","sourceRoot":"","sources":["../../src/lib/gating-json.ts"],"names":[],"mappings":"AAWA,SAAS,aAAa,CAAC,KAAgB;IACrC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACvC,MAAM,IAAI,GAA8B,EAAE,CAAC;QAC3C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACjD,IAAI,GAAG,KAAK,KAAK,IAAI,GAAG,KAAK,KAAK,EAAE,C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