@poa-box/core 0.1.0
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 +201 -0
- package/dist/abis/DirectDemocracyVotingNew.d.ts +749 -0
- package/dist/abis/DirectDemocracyVotingNew.js +961 -0
- package/dist/abis/ERC20.d.ts +90 -0
- package/dist/abis/ERC20.js +125 -0
- package/dist/abis/EducationHubNew.d.ts +590 -0
- package/dist/abis/EducationHubNew.js +762 -0
- package/dist/abis/EligibilityModuleNew.d.ts +1615 -0
- package/dist/abis/EligibilityModuleNew.js +2082 -0
- package/dist/abis/Executor.d.ts +619 -0
- package/dist/abis/Executor.js +796 -0
- package/dist/abis/HybridVotingNew.d.ts +898 -0
- package/dist/abis/HybridVotingNew.js +1149 -0
- package/dist/abis/ImplementationRegistry.d.ts +270 -0
- package/dist/abis/ImplementationRegistry.js +355 -0
- package/dist/abis/OrgDeployerNew.d.ts +1275 -0
- package/dist/abis/OrgDeployerNew.js +1630 -0
- package/dist/abis/OrgRegistry.d.ts +670 -0
- package/dist/abis/OrgRegistry.js +868 -0
- package/dist/abis/ParticipationToken.d.ts +1086 -0
- package/dist/abis/ParticipationToken.js +1415 -0
- package/dist/abis/PasskeyAccount.d.ts +788 -0
- package/dist/abis/PasskeyAccount.js +1019 -0
- package/dist/abis/PasskeyAccountFactory.d.ts +344 -0
- package/dist/abis/PasskeyAccountFactory.js +449 -0
- package/dist/abis/PaymasterHub.d.ts +1603 -0
- package/dist/abis/PaymasterHub.js +2048 -0
- package/dist/abis/PaymentManager.d.ts +520 -0
- package/dist/abis/PaymentManager.js +671 -0
- package/dist/abis/PoaManager.d.ts +344 -0
- package/dist/abis/PoaManager.js +449 -0
- package/dist/abis/QuickJoinNew.d.ts +855 -0
- package/dist/abis/QuickJoinNew.js +1098 -0
- package/dist/abis/TaskManagerNew.d.ts +1236 -0
- package/dist/abis/TaskManagerNew.js +1573 -0
- package/dist/abis/ToggleModule.d.ts +193 -0
- package/dist/abis/ToggleModule.js +255 -0
- package/dist/abis/UniversalAccountRegistry.d.ts +577 -0
- package/dist/abis/UniversalAccountRegistry.js +750 -0
- package/dist/abis/ZkEmailInvites.d.ts +823 -0
- package/dist/abis/ZkEmailInvites.js +1060 -0
- package/dist/abis/external/AaveGovernanceV2.d.ts +128 -0
- package/dist/abis/external/AaveGovernanceV2.js +177 -0
- package/dist/abis/external/AaveGovernanceV3.d.ts +160 -0
- package/dist/abis/external/AaveGovernanceV3.js +220 -0
- package/dist/abis/external/AragonVoting.d.ts +107 -0
- package/dist/abis/external/AragonVoting.js +150 -0
- package/dist/abis/external/CurveGaugeController.d.ts +95 -0
- package/dist/abis/external/CurveGaugeController.js +130 -0
- package/dist/abis/external/CurveVotingEscrow.d.ts +86 -0
- package/dist/abis/external/CurveVotingEscrow.js +116 -0
- package/dist/abis/external/GovernorAlpha.d.ts +172 -0
- package/dist/abis/external/GovernorAlpha.js +228 -0
- package/dist/abis/external/MakerDAOChief.d.ts +92 -0
- package/dist/abis/external/MakerDAOChief.js +129 -0
- package/dist/abis/external/OZGovernor.d.ts +227 -0
- package/dist/abis/external/OZGovernor.js +317 -0
- package/dist/abis/external/SolidlyVotingEscrow.d.ts +196 -0
- package/dist/abis/external/SolidlyVotingEscrow.js +260 -0
- package/dist/abis/index.d.ts +62 -0
- package/dist/abis/index.js +98 -0
- package/dist/chains.d.ts +150 -0
- package/dist/chains.js +320 -0
- package/dist/context.d.ts +48 -0
- package/dist/context.js +38 -0
- package/dist/contracts.d.ts +24 -0
- package/dist/contracts.js +41 -0
- package/dist/encoding.d.ts +58 -0
- package/dist/encoding.js +243 -0
- package/dist/env.d.ts +10 -0
- package/dist/env.js +4 -0
- package/dist/error-catalog.d.ts +41 -0
- package/dist/error-catalog.js +941 -0
- package/dist/errors.d.ts +27 -0
- package/dist/errors.js +60 -0
- package/dist/execute/ethers.d.ts +93 -0
- package/dist/execute/ethers.js +323 -0
- package/dist/execute/index.d.ts +7 -0
- package/dist/execute/index.js +23 -0
- package/dist/execute/sponsored.d.ts +68 -0
- package/dist/execute/sponsored.js +277 -0
- package/dist/exit-codes.d.ts +18 -0
- package/dist/exit-codes.js +21 -0
- package/dist/format.d.ts +21 -0
- package/dist/format.js +89 -0
- package/dist/graph/client.d.ts +298 -0
- package/dist/graph/client.js +702 -0
- package/dist/graph/documents/activity.d.ts +9 -0
- package/dist/graph/documents/activity.js +164 -0
- package/dist/graph/documents/beacons.d.ts +172 -0
- package/dist/graph/documents/beacons.js +345 -0
- package/dist/graph/documents/index.d.ts +21 -0
- package/dist/graph/documents/index.js +57 -0
- package/dist/graph/documents/infrastructure.d.ts +30 -0
- package/dist/graph/documents/infrastructure.js +34 -0
- package/dist/graph/documents/org.d.ts +15 -0
- package/dist/graph/documents/org.js +249 -0
- package/dist/graph/documents/paymaster.d.ts +95 -0
- package/dist/graph/documents/paymaster.js +101 -0
- package/dist/graph/documents/role.d.ts +6 -0
- package/dist/graph/documents/role.js +41 -0
- package/dist/graph/documents/roles.d.ts +50 -0
- package/dist/graph/documents/roles.js +112 -0
- package/dist/graph/documents/task.d.ts +84 -0
- package/dist/graph/documents/task.js +236 -0
- package/dist/graph/documents/token.d.ts +13 -0
- package/dist/graph/documents/token.js +126 -0
- package/dist/graph/documents/treasury.d.ts +39 -0
- package/dist/graph/documents/treasury.js +136 -0
- package/dist/graph/documents/user.d.ts +120 -0
- package/dist/graph/documents/user.js +302 -0
- package/dist/graph/documents/voting-classes.d.ts +69 -0
- package/dist/graph/documents/voting-classes.js +149 -0
- package/dist/graph/documents/voting.d.ts +28 -0
- package/dist/graph/documents/voting.js +163 -0
- package/dist/graph/documents/vouch.d.ts +79 -0
- package/dist/graph/documents/vouch.js +171 -0
- package/dist/graph/documents/zkemail.d.ts +63 -0
- package/dist/graph/documents/zkemail.js +188 -0
- package/dist/graph/index.d.ts +2 -0
- package/dist/graph/index.js +41 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.js +92 -0
- package/dist/ipfs.d.ts +39 -0
- package/dist/ipfs.js +214 -0
- package/dist/label-aliases.d.ts +31 -0
- package/dist/label-aliases.js +70 -0
- package/dist/metadata/education.d.ts +30 -0
- package/dist/metadata/education.js +31 -0
- package/dist/metadata/index.d.ts +12 -0
- package/dist/metadata/index.js +48 -0
- package/dist/metadata/org.d.ts +92 -0
- package/dist/metadata/org.js +93 -0
- package/dist/metadata/proposal.d.ts +44 -0
- package/dist/metadata/proposal.js +45 -0
- package/dist/metadata/role.d.ts +38 -0
- package/dist/metadata/role.js +35 -0
- package/dist/metadata/task.d.ts +108 -0
- package/dist/metadata/task.js +81 -0
- package/dist/metadata/token.d.ts +32 -0
- package/dist/metadata/token.js +36 -0
- package/dist/metadata/user.d.ts +63 -0
- package/dist/metadata/user.js +70 -0
- package/dist/multicall.d.ts +32 -0
- package/dist/multicall.js +96 -0
- package/dist/payout.d.ts +59 -0
- package/dist/payout.js +96 -0
- package/dist/perms.d.ts +47 -0
- package/dist/perms.js +120 -0
- package/dist/preflight.d.ts +72 -0
- package/dist/preflight.js +269 -0
- package/dist/reads/education.d.ts +79 -0
- package/dist/reads/education.js +122 -0
- package/dist/reads/eligibility.d.ts +377 -0
- package/dist/reads/eligibility.js +687 -0
- package/dist/reads/index.d.ts +16 -0
- package/dist/reads/index.js +55 -0
- package/dist/reads/org.d.ts +258 -0
- package/dist/reads/org.js +220 -0
- package/dist/reads/paymaster.d.ts +147 -0
- package/dist/reads/paymaster.js +235 -0
- package/dist/reads/project.d.ts +33 -0
- package/dist/reads/project.js +62 -0
- package/dist/reads/resolve.d.ts +34 -0
- package/dist/reads/resolve.js +64 -0
- package/dist/reads/task.d.ts +286 -0
- package/dist/reads/task.js +280 -0
- package/dist/reads/token.d.ts +94 -0
- package/dist/reads/token.js +75 -0
- package/dist/reads/treasury.d.ts +222 -0
- package/dist/reads/treasury.js +241 -0
- package/dist/reads/user.d.ts +229 -0
- package/dist/reads/user.js +155 -0
- package/dist/reads/vote.d.ts +296 -0
- package/dist/reads/vote.js +392 -0
- package/dist/reads/zkemail.d.ts +117 -0
- package/dist/reads/zkemail.js +217 -0
- package/dist/similarity.d.ts +36 -0
- package/dist/similarity.js +67 -0
- package/dist/sponsorship-config.d.ts +47 -0
- package/dist/sponsorship-config.js +41 -0
- package/dist/stats.d.ts +11 -0
- package/dist/stats.js +27 -0
- package/dist/task-lens.d.ts +113 -0
- package/dist/task-lens.js +210 -0
- package/dist/tx/education.d.ts +169 -0
- package/dist/tx/education.js +344 -0
- package/dist/tx/eligibility.d.ts +511 -0
- package/dist/tx/eligibility.js +818 -0
- package/dist/tx/governance.d.ts +85 -0
- package/dist/tx/governance.js +87 -0
- package/dist/tx/index.d.ts +17 -0
- package/dist/tx/index.js +56 -0
- package/dist/tx/intent.d.ts +67 -0
- package/dist/tx/intent.js +48 -0
- package/dist/tx/org.d.ts +321 -0
- package/dist/tx/org.js +544 -0
- package/dist/tx/paymaster.d.ts +140 -0
- package/dist/tx/paymaster.js +251 -0
- package/dist/tx/project.d.ts +146 -0
- package/dist/tx/project.js +217 -0
- package/dist/tx/task.d.ts +480 -0
- package/dist/tx/task.js +1149 -0
- package/dist/tx/token.d.ts +96 -0
- package/dist/tx/token.js +165 -0
- package/dist/tx/treasury.d.ts +474 -0
- package/dist/tx/treasury.js +911 -0
- package/dist/tx/user.d.ts +177 -0
- package/dist/tx/user.js +292 -0
- package/dist/tx/vote.d.ts +332 -0
- package/dist/tx/vote.js +762 -0
- package/dist/tx/zkemail.d.ts +90 -0
- package/dist/tx/zkemail.js +210 -0
- package/dist/validation.d.ts +8 -0
- package/dist/validation.js +39 -0
- package/dist/version.d.ts +142 -0
- package/dist/version.js +257 -0
- package/dist/zkemail.d.ts +161 -0
- package/dist/zkemail.js +299 -0
- package/package.json +130 -0
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task-domain subgraph reads: the projects/tasks tree, task stats, permission
|
|
3
|
+
* masks, folders root, and v7 release history.
|
|
4
|
+
*
|
|
5
|
+
* Ports the read paths of `pop task list` / `view` / `stats` /
|
|
6
|
+
* `perms show` / `folders show` (src/commands/task/{list,view,stats,perms,
|
|
7
|
+
* folders}.ts) onto the injected GraphClient. Tier arrays come from
|
|
8
|
+
* ../graph/documents/task where they already exist; the stats / perms /
|
|
9
|
+
* folders documents lived inline in the CLI command files and are ported here
|
|
10
|
+
* verbatim, comments included — the live-verification notes are load-bearing.
|
|
11
|
+
*/
|
|
12
|
+
import type { GraphClient, FieldFallbackTier } from '../graph/client';
|
|
13
|
+
/** Subgraph Task entity as served by FETCH_PROJECTS_DATA (fields vary by tier). */
|
|
14
|
+
export interface SubgraphTask {
|
|
15
|
+
/** Composite entity id `<taskManager>-<taskId>`. */
|
|
16
|
+
id: string;
|
|
17
|
+
/** Bare numeric task id (string). */
|
|
18
|
+
taskId: string;
|
|
19
|
+
title: string | null;
|
|
20
|
+
metadataHash: string | null;
|
|
21
|
+
metadata: Record<string, any> | null;
|
|
22
|
+
status: string;
|
|
23
|
+
payout: string | null;
|
|
24
|
+
bountyToken?: string | null;
|
|
25
|
+
bountyPayout?: string | null;
|
|
26
|
+
assignee?: string | null;
|
|
27
|
+
assigneeUsername?: string | null;
|
|
28
|
+
requiresApplication?: boolean | null;
|
|
29
|
+
createdAt?: string | null;
|
|
30
|
+
/** v6 deadline fields — null means unset on-chain, absent means tier didn't serve them. */
|
|
31
|
+
completionWindow?: string | null;
|
|
32
|
+
absoluteDeadline?: string | null;
|
|
33
|
+
claimDeadline?: string | null;
|
|
34
|
+
reclaimCount?: string | null;
|
|
35
|
+
/** v7 release fields — tier 0 (Gnosis) only. */
|
|
36
|
+
releaseCount?: string | null;
|
|
37
|
+
lastReleasedAt?: string | null;
|
|
38
|
+
[key: string]: any;
|
|
39
|
+
}
|
|
40
|
+
/** Subgraph Project entity as served by FETCH_PROJECTS_DATA. */
|
|
41
|
+
export interface SubgraphProject {
|
|
42
|
+
/** Composite entity id `<taskManager>-<projectIdHex>`. */
|
|
43
|
+
id: string;
|
|
44
|
+
title: string | null;
|
|
45
|
+
metadataHash?: string | null;
|
|
46
|
+
metadata?: Record<string, any> | null;
|
|
47
|
+
cap?: string | null;
|
|
48
|
+
createdAt?: string | null;
|
|
49
|
+
tasks?: SubgraphTask[];
|
|
50
|
+
[key: string]: any;
|
|
51
|
+
}
|
|
52
|
+
export interface ProjectsDataResult {
|
|
53
|
+
organization: {
|
|
54
|
+
id: string;
|
|
55
|
+
taskManager: {
|
|
56
|
+
id: string;
|
|
57
|
+
creatorHatIds?: string[];
|
|
58
|
+
projects: SubgraphProject[];
|
|
59
|
+
} | null;
|
|
60
|
+
} | null;
|
|
61
|
+
}
|
|
62
|
+
export interface ProjectsDataRead {
|
|
63
|
+
data: ProjectsDataResult;
|
|
64
|
+
/** Which tier served (see PROJECTS_DATA_TIERS in ../graph/documents/task). */
|
|
65
|
+
tierIndex: number;
|
|
66
|
+
/**
|
|
67
|
+
* Tier 0 adds the v7 release fields (subgraph #201, Gnosis only today);
|
|
68
|
+
* tier 1 is the same document WITHOUT them, so it still carries deadlines.
|
|
69
|
+
* `<= 1` and not `=== 0`: inserting the release tier shifted every index,
|
|
70
|
+
* and reading this as `=== 0` would silently degrade every non-Gnosis org.
|
|
71
|
+
*/
|
|
72
|
+
hasDeadlineData: boolean;
|
|
73
|
+
/** Gate release-field rendering on the SERVED TIER, never on truthiness. */
|
|
74
|
+
hasReleaseData: boolean;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The org's full projects → tasks tree with tier fallback.
|
|
78
|
+
* Port of the read at src/commands/task/list.ts:129 (also view.ts:95).
|
|
79
|
+
*/
|
|
80
|
+
export declare function fetchProjectsData(client: GraphClient, orgId: string, chainId?: number): Promise<ProjectsDataRead>;
|
|
81
|
+
/** A task row flattened out of the projects tree, with its project attached. */
|
|
82
|
+
export interface TaskListRow extends SubgraphTask {
|
|
83
|
+
/** Composite project entity id the task belongs to. */
|
|
84
|
+
projectId: string;
|
|
85
|
+
projectTitle: string | null;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Flat list of an org's tasks — the friendliest first read (`pop task list`'s
|
|
89
|
+
* data, sans rendering). Sugar over fetchProjectsData: same tiered query, the
|
|
90
|
+
* projects → tasks tree flattened with each row keeping its project identity.
|
|
91
|
+
*/
|
|
92
|
+
export declare function listTasks(client: GraphClient, orgId: string, chainId?: number): Promise<TaskListRow[]>;
|
|
93
|
+
/**
|
|
94
|
+
* Find a task in a FETCH_PROJECTS_DATA result by its NUMERIC task id.
|
|
95
|
+
* Port of src/commands/task/helpers.ts findSubgraphTask.
|
|
96
|
+
*
|
|
97
|
+
* The subgraph keys tasks by the composite `<taskManager>-<taskId>` while the contract (and
|
|
98
|
+
* `parseTaskId`) uses the bare number, so callers must pass the parsed id — matching on the raw
|
|
99
|
+
* `--task` argument silently misses whenever a user pastes the composite form back in.
|
|
100
|
+
*
|
|
101
|
+
* Shared because the write commands re-pin metadata from whatever this returns: a miss means
|
|
102
|
+
* they rebuild the doc from defaults and the full-overwrite write erases the task's real
|
|
103
|
+
* name/description/location/dueDate.
|
|
104
|
+
*/
|
|
105
|
+
export declare function findSubgraphTask(projects: SubgraphProject[], taskId: string): SubgraphTask | null;
|
|
106
|
+
/** Port of the inline document at src/commands/task/stats.ts:12. */
|
|
107
|
+
export declare const FETCH_TASK_STATS = "\n query FetchTaskStats($orgId: Bytes!) {\n organization(id: $orgId) {\n users(first: 100) {\n address\n participationTokenBalance\n membershipStatus\n totalTasksCompleted\n totalTasksReleased\n totalTasksLostToExpiry\n account { username }\n }\n taskManager {\n projects(where: { deleted: false }, first: 100) {\n title\n tasks(first: 1000) {\n taskId\n title\n status\n payout\n assignee\n assigneeUsername\n completer\n completerUsername\n createdAt\n }\n }\n }\n }\n }\n";
|
|
108
|
+
/**
|
|
109
|
+
* FETCH_TASK_STATS without the claim-churn counters (subgraph #201, TaskManager v7).
|
|
110
|
+
*
|
|
111
|
+
* The two counters are asymmetric: `totalTasksLostToExpiry` is live on Arbitrum too, but
|
|
112
|
+
* `totalTasksReleased` is Gnosis-only as of 2026-08-02 (verified: poa-arb-v-1 answers
|
|
113
|
+
* ``Type `User` has no field `totalTasksReleased```, which `isUnknownFieldError` matches).
|
|
114
|
+
* A document validates as a whole, so they have to share tier 0 — asking for the portable
|
|
115
|
+
* one alongside the Gnosis-only one costs nothing, since the whole query would fail anyway.
|
|
116
|
+
* Derived by deletion so the two tiers cannot drift apart.
|
|
117
|
+
*/
|
|
118
|
+
export declare const FETCH_TASK_STATS_LEGACY: string;
|
|
119
|
+
export interface TaskStatsUser {
|
|
120
|
+
address: string;
|
|
121
|
+
participationTokenBalance: string | null;
|
|
122
|
+
membershipStatus: string | null;
|
|
123
|
+
totalTasksCompleted?: string | null;
|
|
124
|
+
/** Tier 0 only — null row means "not indexed on this chain", not zero. */
|
|
125
|
+
totalTasksReleased?: string | null;
|
|
126
|
+
totalTasksLostToExpiry?: string | null;
|
|
127
|
+
account: {
|
|
128
|
+
username: string | null;
|
|
129
|
+
} | null;
|
|
130
|
+
}
|
|
131
|
+
export interface TaskStatsResult {
|
|
132
|
+
organization: {
|
|
133
|
+
users: TaskStatsUser[];
|
|
134
|
+
taskManager: {
|
|
135
|
+
projects: Array<{
|
|
136
|
+
title: string | null;
|
|
137
|
+
tasks: SubgraphTask[];
|
|
138
|
+
}>;
|
|
139
|
+
} | null;
|
|
140
|
+
} | null;
|
|
141
|
+
}
|
|
142
|
+
export interface TaskStatsRead {
|
|
143
|
+
data: TaskStatsResult;
|
|
144
|
+
tierIndex: number;
|
|
145
|
+
/** True when the v7 claim-churn counters were served (tier 0). */
|
|
146
|
+
hasChurnCounters: boolean;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Raw per-member + per-project task analytics inputs.
|
|
150
|
+
* Port of the read at src/commands/task/stats.ts:62 (aggregation stays host-side).
|
|
151
|
+
*/
|
|
152
|
+
export declare function fetchTaskStats(client: GraphClient, orgId: string, chainId?: number): Promise<TaskStatsRead>;
|
|
153
|
+
/**
|
|
154
|
+
* Tier 0: deployed v4 schema — GlobalRolePermission masks, organizerHatIds,
|
|
155
|
+
* per-project ProjectRolePermission masks.
|
|
156
|
+
* Port of PERMS_QUERY_FULL at src/commands/task/perms.ts:55. Masks are
|
|
157
|
+
* subgraph-only: they are NOT readable per-wearer on-chain.
|
|
158
|
+
*/
|
|
159
|
+
export declare const PERMS_QUERY_FULL = "\n query TaskPermsFull($orgId: Bytes!) {\n organization(id: $orgId) {\n id\n taskManager {\n id\n creatorHatIds\n organizerHatIds\n globalRolePermissions { hatId mask }\n projects(where: { deleted: false }, first: 50) {\n id\n title\n rolePermissions { hatId mask }\n }\n }\n }\n }\n";
|
|
160
|
+
/** Tier 1: older schema — no global perms/organizer hats; boolean per-project flags. */
|
|
161
|
+
export declare const PERMS_QUERY_LEGACY = "\n query TaskPermsLegacy($orgId: Bytes!) {\n organization(id: $orgId) {\n id\n taskManager {\n id\n creatorHatIds\n projects(where: { deleted: false }, first: 50) {\n id\n title\n rolePermissions { hatId canCreate canClaim canReview canAssign }\n }\n }\n }\n }\n";
|
|
162
|
+
/** Tier array for `queryWithFieldFallback`, matching the CLI's order. */
|
|
163
|
+
export declare function taskPermsTiers(orgId: string): FieldFallbackTier[];
|
|
164
|
+
export interface SubgraphRolePermission {
|
|
165
|
+
hatId: string;
|
|
166
|
+
/** Tier 0 field. */
|
|
167
|
+
mask?: number | string;
|
|
168
|
+
/** Tier 1 (legacy) boolean fields. */
|
|
169
|
+
canCreate?: boolean;
|
|
170
|
+
canClaim?: boolean;
|
|
171
|
+
canReview?: boolean;
|
|
172
|
+
canAssign?: boolean;
|
|
173
|
+
}
|
|
174
|
+
export interface TaskPermsResult {
|
|
175
|
+
organization: {
|
|
176
|
+
id: string;
|
|
177
|
+
taskManager: {
|
|
178
|
+
id: string;
|
|
179
|
+
creatorHatIds?: string[];
|
|
180
|
+
organizerHatIds?: string[];
|
|
181
|
+
globalRolePermissions?: SubgraphRolePermission[];
|
|
182
|
+
projects: Array<{
|
|
183
|
+
id: string;
|
|
184
|
+
title: string | null;
|
|
185
|
+
rolePermissions?: SubgraphRolePermission[];
|
|
186
|
+
}>;
|
|
187
|
+
} | null;
|
|
188
|
+
} | null;
|
|
189
|
+
}
|
|
190
|
+
export interface TaskPermsRead {
|
|
191
|
+
data: TaskPermsResult;
|
|
192
|
+
tierIndex: number;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Global + per-project permission masks. Port of the read at
|
|
196
|
+
* src/commands/task/perms.ts:175 (`pop task perms show`).
|
|
197
|
+
*/
|
|
198
|
+
export declare function fetchTaskPerms(client: GraphClient, orgId: string, chainId?: number): Promise<TaskPermsRead>;
|
|
199
|
+
/**
|
|
200
|
+
* Rebuild a mask from tier-1 boolean flags (partial: only bits 1..8 indexable).
|
|
201
|
+
* Port of src/commands/task/perms.ts maskFromBooleans.
|
|
202
|
+
*/
|
|
203
|
+
export declare function maskFromBooleans(rp: SubgraphRolePermission): number;
|
|
204
|
+
/**
|
|
205
|
+
* Resolve --project-style input (bytes32 hex, subgraph composite ID, or title)
|
|
206
|
+
* to the on-chain bytes32 pid using an already-fetched projects list.
|
|
207
|
+
* Port of src/commands/task/perms.ts resolveProjectFromList (same messages).
|
|
208
|
+
*/
|
|
209
|
+
export declare function resolveProjectFromList(projects: Array<{
|
|
210
|
+
id: string;
|
|
211
|
+
title?: string | null;
|
|
212
|
+
}>, input: string): {
|
|
213
|
+
pid: string;
|
|
214
|
+
title?: string;
|
|
215
|
+
};
|
|
216
|
+
/**
|
|
217
|
+
* Tier 0: v4 schema with folders provenance on Organization.
|
|
218
|
+
* Port of FOLDERS_QUERY_FULL at src/commands/task/folders.ts:54 — foldersRoot
|
|
219
|
+
* verified populated on live Gnosis (org Test6 = 0x8694f683…).
|
|
220
|
+
*/
|
|
221
|
+
export declare const FOLDERS_QUERY_FULL = "\n query OrgFolders($orgId: Bytes!) {\n organization(id: $orgId) {\n id\n foldersRoot\n foldersUpdatedAt\n foldersUpdatedBy\n }\n }\n";
|
|
222
|
+
/** Tier 1: pre-folders schema. */
|
|
223
|
+
export declare const FOLDERS_QUERY_LEGACY = "\n query OrgFoldersLegacy($orgId: Bytes!) {\n organization(id: $orgId) {\n id\n }\n }\n";
|
|
224
|
+
export interface OrgFoldersResult {
|
|
225
|
+
organization: {
|
|
226
|
+
id: string;
|
|
227
|
+
foldersRoot?: string | null;
|
|
228
|
+
foldersUpdatedAt?: string | null;
|
|
229
|
+
foldersUpdatedBy?: string | null;
|
|
230
|
+
} | null;
|
|
231
|
+
}
|
|
232
|
+
export interface OrgFoldersRead {
|
|
233
|
+
data: OrgFoldersResult;
|
|
234
|
+
tierIndex: number;
|
|
235
|
+
/**
|
|
236
|
+
* Normalised root, or null. A null foldersRoot means "no FoldersUpdated ever
|
|
237
|
+
* indexed", which is NOT the same as "root is zero" — callers must fall back
|
|
238
|
+
* to the on-chain lens (getFoldersRoot) rather than assume.
|
|
239
|
+
*/
|
|
240
|
+
indexedRoot: string | null;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* The org's indexed folders root + provenance. Port of the read at
|
|
244
|
+
* src/commands/task/folders.ts:169 (`pop task folders show`).
|
|
245
|
+
*/
|
|
246
|
+
export declare function fetchOrgFolders(client: GraphClient, orgId: string, chainId?: number): Promise<OrgFoldersRead>;
|
|
247
|
+
/**
|
|
248
|
+
* Normalise a subgraph bytes32 to the 0x-prefixed lowercase form the lens returns.
|
|
249
|
+
* Port of src/commands/task/folders.ts normalizeRoot.
|
|
250
|
+
*/
|
|
251
|
+
export declare function normalizeRoot(value: string | null | undefined): string | null;
|
|
252
|
+
export interface TaskReleaseEntry {
|
|
253
|
+
id: string;
|
|
254
|
+
previousClaimer: string;
|
|
255
|
+
previousClaimerUsername: string | null;
|
|
256
|
+
caller: string;
|
|
257
|
+
callerUsername: string | null;
|
|
258
|
+
selfRelease: boolean;
|
|
259
|
+
releasedAt: string;
|
|
260
|
+
releasedAtBlock?: string;
|
|
261
|
+
transactionHash: string;
|
|
262
|
+
}
|
|
263
|
+
export interface TaskReleaseHistoryResult {
|
|
264
|
+
task: {
|
|
265
|
+
id: string;
|
|
266
|
+
taskId: string;
|
|
267
|
+
status: string;
|
|
268
|
+
releaseCount?: string | null;
|
|
269
|
+
lastReleasedAt?: string | null;
|
|
270
|
+
releases?: TaskReleaseEntry[];
|
|
271
|
+
} | null;
|
|
272
|
+
}
|
|
273
|
+
export interface TaskReleaseHistoryRead {
|
|
274
|
+
data: TaskReleaseHistoryResult;
|
|
275
|
+
tierIndex: number;
|
|
276
|
+
/** tierIndex 1 means "release history not indexed here" — releases absent, not empty. */
|
|
277
|
+
hasReleaseHistory: boolean;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* One task's release history (subgraph #201, Gnosis-only today). Port of the
|
|
281
|
+
* read at src/commands/task/view.ts:277. `taskEntityId` is the Task ENTITY id
|
|
282
|
+
* — `<lowercased taskManager address>-<numeric task id>`, not the bare number.
|
|
283
|
+
* The CLI issues this only when the shared projects document already reported
|
|
284
|
+
* `releaseCount > 0`, keeping the common path at one round-trip.
|
|
285
|
+
*/
|
|
286
|
+
export declare function fetchTaskReleaseHistory(client: GraphClient, taskEntityId: string, first?: number, chainId?: number): Promise<TaskReleaseHistoryRead>;
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Task-domain subgraph reads: the projects/tasks tree, task stats, permission
|
|
4
|
+
* masks, folders root, and v7 release history.
|
|
5
|
+
*
|
|
6
|
+
* Ports the read paths of `pop task list` / `view` / `stats` /
|
|
7
|
+
* `perms show` / `folders show` (src/commands/task/{list,view,stats,perms,
|
|
8
|
+
* folders}.ts) onto the injected GraphClient. Tier arrays come from
|
|
9
|
+
* ../graph/documents/task where they already exist; the stats / perms /
|
|
10
|
+
* folders documents lived inline in the CLI command files and are ported here
|
|
11
|
+
* verbatim, comments included — the live-verification notes are load-bearing.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.FOLDERS_QUERY_LEGACY = exports.FOLDERS_QUERY_FULL = exports.PERMS_QUERY_LEGACY = exports.PERMS_QUERY_FULL = exports.FETCH_TASK_STATS_LEGACY = exports.FETCH_TASK_STATS = void 0;
|
|
15
|
+
exports.fetchProjectsData = fetchProjectsData;
|
|
16
|
+
exports.listTasks = listTasks;
|
|
17
|
+
exports.findSubgraphTask = findSubgraphTask;
|
|
18
|
+
exports.fetchTaskStats = fetchTaskStats;
|
|
19
|
+
exports.taskPermsTiers = taskPermsTiers;
|
|
20
|
+
exports.fetchTaskPerms = fetchTaskPerms;
|
|
21
|
+
exports.maskFromBooleans = maskFromBooleans;
|
|
22
|
+
exports.resolveProjectFromList = resolveProjectFromList;
|
|
23
|
+
exports.fetchOrgFolders = fetchOrgFolders;
|
|
24
|
+
exports.normalizeRoot = normalizeRoot;
|
|
25
|
+
exports.fetchTaskReleaseHistory = fetchTaskReleaseHistory;
|
|
26
|
+
const task_1 = require("../graph/documents/task");
|
|
27
|
+
const encoding_1 = require("../encoding");
|
|
28
|
+
const perms_1 = require("../perms");
|
|
29
|
+
const errors_1 = require("../errors");
|
|
30
|
+
const exit_codes_1 = require("../exit-codes");
|
|
31
|
+
const ethers_1 = require("ethers");
|
|
32
|
+
/**
|
|
33
|
+
* The org's full projects → tasks tree with tier fallback.
|
|
34
|
+
* Port of the read at src/commands/task/list.ts:129 (also view.ts:95).
|
|
35
|
+
*/
|
|
36
|
+
async function fetchProjectsData(client, orgId, chainId) {
|
|
37
|
+
const { data, tierIndex } = await client.queryWithFieldFallback((0, task_1.projectsDataTiers)(orgId), { chainId });
|
|
38
|
+
return {
|
|
39
|
+
data,
|
|
40
|
+
tierIndex,
|
|
41
|
+
hasDeadlineData: tierIndex <= 1,
|
|
42
|
+
hasReleaseData: tierIndex === 0,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Flat list of an org's tasks — the friendliest first read (`pop task list`'s
|
|
47
|
+
* data, sans rendering). Sugar over fetchProjectsData: same tiered query, the
|
|
48
|
+
* projects → tasks tree flattened with each row keeping its project identity.
|
|
49
|
+
*/
|
|
50
|
+
async function listTasks(client, orgId, chainId) {
|
|
51
|
+
const { data } = await fetchProjectsData(client, orgId, chainId);
|
|
52
|
+
const projects = data.organization?.taskManager?.projects ?? [];
|
|
53
|
+
return projects.flatMap(p => (p.tasks ?? []).map(t => ({ ...t, projectId: p.id, projectTitle: p.title ?? null })));
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Find a task in a FETCH_PROJECTS_DATA result by its NUMERIC task id.
|
|
57
|
+
* Port of src/commands/task/helpers.ts findSubgraphTask.
|
|
58
|
+
*
|
|
59
|
+
* The subgraph keys tasks by the composite `<taskManager>-<taskId>` while the contract (and
|
|
60
|
+
* `parseTaskId`) uses the bare number, so callers must pass the parsed id — matching on the raw
|
|
61
|
+
* `--task` argument silently misses whenever a user pastes the composite form back in.
|
|
62
|
+
*
|
|
63
|
+
* Shared because the write commands re-pin metadata from whatever this returns: a miss means
|
|
64
|
+
* they rebuild the doc from defaults and the full-overwrite write erases the task's real
|
|
65
|
+
* name/description/location/dueDate.
|
|
66
|
+
*/
|
|
67
|
+
function findSubgraphTask(projects, taskId) {
|
|
68
|
+
for (const project of projects || []) {
|
|
69
|
+
for (const task of project.tasks || []) {
|
|
70
|
+
if (task.taskId === taskId || task.id?.endsWith(`-${taskId}`))
|
|
71
|
+
return task;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
// ────────────────────── task stats ──────────────────────
|
|
77
|
+
/** Port of the inline document at src/commands/task/stats.ts:12. */
|
|
78
|
+
exports.FETCH_TASK_STATS = `
|
|
79
|
+
query FetchTaskStats($orgId: Bytes!) {
|
|
80
|
+
organization(id: $orgId) {
|
|
81
|
+
users(first: 100) {
|
|
82
|
+
address
|
|
83
|
+
participationTokenBalance
|
|
84
|
+
membershipStatus
|
|
85
|
+
totalTasksCompleted
|
|
86
|
+
totalTasksReleased
|
|
87
|
+
totalTasksLostToExpiry
|
|
88
|
+
account { username }
|
|
89
|
+
}
|
|
90
|
+
taskManager {
|
|
91
|
+
projects(where: { deleted: false }, first: 100) {
|
|
92
|
+
title
|
|
93
|
+
tasks(first: 1000) {
|
|
94
|
+
taskId
|
|
95
|
+
title
|
|
96
|
+
status
|
|
97
|
+
payout
|
|
98
|
+
assignee
|
|
99
|
+
assigneeUsername
|
|
100
|
+
completer
|
|
101
|
+
completerUsername
|
|
102
|
+
createdAt
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
`;
|
|
109
|
+
/**
|
|
110
|
+
* FETCH_TASK_STATS without the claim-churn counters (subgraph #201, TaskManager v7).
|
|
111
|
+
*
|
|
112
|
+
* The two counters are asymmetric: `totalTasksLostToExpiry` is live on Arbitrum too, but
|
|
113
|
+
* `totalTasksReleased` is Gnosis-only as of 2026-08-02 (verified: poa-arb-v-1 answers
|
|
114
|
+
* ``Type `User` has no field `totalTasksReleased```, which `isUnknownFieldError` matches).
|
|
115
|
+
* A document validates as a whole, so they have to share tier 0 — asking for the portable
|
|
116
|
+
* one alongside the Gnosis-only one costs nothing, since the whole query would fail anyway.
|
|
117
|
+
* Derived by deletion so the two tiers cannot drift apart.
|
|
118
|
+
*/
|
|
119
|
+
exports.FETCH_TASK_STATS_LEGACY = exports.FETCH_TASK_STATS
|
|
120
|
+
.split('\n')
|
|
121
|
+
.filter((line) => !/^\s*(totalTasksReleased|totalTasksLostToExpiry)\s*$/.test(line))
|
|
122
|
+
.join('\n');
|
|
123
|
+
/**
|
|
124
|
+
* Raw per-member + per-project task analytics inputs.
|
|
125
|
+
* Port of the read at src/commands/task/stats.ts:62 (aggregation stays host-side).
|
|
126
|
+
*/
|
|
127
|
+
async function fetchTaskStats(client, orgId, chainId) {
|
|
128
|
+
const { data, tierIndex } = await client.queryWithFieldFallback([
|
|
129
|
+
{ query: exports.FETCH_TASK_STATS, variables: { orgId } },
|
|
130
|
+
{ query: exports.FETCH_TASK_STATS_LEGACY, variables: { orgId } },
|
|
131
|
+
], { chainId });
|
|
132
|
+
return { data, tierIndex, hasChurnCounters: tierIndex === 0 };
|
|
133
|
+
}
|
|
134
|
+
// ────────────────────── permission masks ──────────────────────
|
|
135
|
+
/**
|
|
136
|
+
* Tier 0: deployed v4 schema — GlobalRolePermission masks, organizerHatIds,
|
|
137
|
+
* per-project ProjectRolePermission masks.
|
|
138
|
+
* Port of PERMS_QUERY_FULL at src/commands/task/perms.ts:55. Masks are
|
|
139
|
+
* subgraph-only: they are NOT readable per-wearer on-chain.
|
|
140
|
+
*/
|
|
141
|
+
exports.PERMS_QUERY_FULL = `
|
|
142
|
+
query TaskPermsFull($orgId: Bytes!) {
|
|
143
|
+
organization(id: $orgId) {
|
|
144
|
+
id
|
|
145
|
+
taskManager {
|
|
146
|
+
id
|
|
147
|
+
creatorHatIds
|
|
148
|
+
organizerHatIds
|
|
149
|
+
globalRolePermissions { hatId mask }
|
|
150
|
+
projects(where: { deleted: false }, first: 50) {
|
|
151
|
+
id
|
|
152
|
+
title
|
|
153
|
+
rolePermissions { hatId mask }
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
`;
|
|
159
|
+
/** Tier 1: older schema — no global perms/organizer hats; boolean per-project flags. */
|
|
160
|
+
exports.PERMS_QUERY_LEGACY = `
|
|
161
|
+
query TaskPermsLegacy($orgId: Bytes!) {
|
|
162
|
+
organization(id: $orgId) {
|
|
163
|
+
id
|
|
164
|
+
taskManager {
|
|
165
|
+
id
|
|
166
|
+
creatorHatIds
|
|
167
|
+
projects(where: { deleted: false }, first: 50) {
|
|
168
|
+
id
|
|
169
|
+
title
|
|
170
|
+
rolePermissions { hatId canCreate canClaim canReview canAssign }
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
`;
|
|
176
|
+
/** Tier array for `queryWithFieldFallback`, matching the CLI's order. */
|
|
177
|
+
function taskPermsTiers(orgId) {
|
|
178
|
+
return [
|
|
179
|
+
{ query: exports.PERMS_QUERY_FULL, variables: { orgId } },
|
|
180
|
+
{ query: exports.PERMS_QUERY_LEGACY, variables: { orgId } },
|
|
181
|
+
];
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Global + per-project permission masks. Port of the read at
|
|
185
|
+
* src/commands/task/perms.ts:175 (`pop task perms show`).
|
|
186
|
+
*/
|
|
187
|
+
async function fetchTaskPerms(client, orgId, chainId) {
|
|
188
|
+
return client.queryWithFieldFallback(taskPermsTiers(orgId), { chainId });
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Rebuild a mask from tier-1 boolean flags (partial: only bits 1..8 indexable).
|
|
192
|
+
* Port of src/commands/task/perms.ts maskFromBooleans.
|
|
193
|
+
*/
|
|
194
|
+
function maskFromBooleans(rp) {
|
|
195
|
+
let mask = 0;
|
|
196
|
+
if (rp.canCreate)
|
|
197
|
+
mask |= perms_1.PERM_BITS.create;
|
|
198
|
+
if (rp.canClaim)
|
|
199
|
+
mask |= perms_1.PERM_BITS.claim;
|
|
200
|
+
if (rp.canReview)
|
|
201
|
+
mask |= perms_1.PERM_BITS.review;
|
|
202
|
+
if (rp.canAssign)
|
|
203
|
+
mask |= perms_1.PERM_BITS.assign;
|
|
204
|
+
return mask;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Resolve --project-style input (bytes32 hex, subgraph composite ID, or title)
|
|
208
|
+
* to the on-chain bytes32 pid using an already-fetched projects list.
|
|
209
|
+
* Port of src/commands/task/perms.ts resolveProjectFromList (same messages).
|
|
210
|
+
*/
|
|
211
|
+
function resolveProjectFromList(projects, input) {
|
|
212
|
+
if (input.startsWith('0x') && input.length === 66) {
|
|
213
|
+
const match = projects.find((p) => (0, encoding_1.parseProjectId)(p.id) === input);
|
|
214
|
+
return { pid: input, title: match?.title ?? undefined };
|
|
215
|
+
}
|
|
216
|
+
const byTitle = projects.find((p) => (p.title || '').toLowerCase() === input.toLowerCase());
|
|
217
|
+
if (byTitle)
|
|
218
|
+
return { pid: (0, encoding_1.parseProjectId)(byTitle.id), title: byTitle.title ?? undefined };
|
|
219
|
+
const available = projects.map((p) => p.title).filter(Boolean).join(', ');
|
|
220
|
+
throw new errors_1.CliError(`Project "${input}" not found.`, exit_codes_1.EXIT.USAGE, `Available projects: ${available || 'none'} (or pass the 0x-prefixed bytes32 project ID).`);
|
|
221
|
+
}
|
|
222
|
+
// ────────────────────── folders root ──────────────────────
|
|
223
|
+
/**
|
|
224
|
+
* Tier 0: v4 schema with folders provenance on Organization.
|
|
225
|
+
* Port of FOLDERS_QUERY_FULL at src/commands/task/folders.ts:54 — foldersRoot
|
|
226
|
+
* verified populated on live Gnosis (org Test6 = 0x8694f683…).
|
|
227
|
+
*/
|
|
228
|
+
exports.FOLDERS_QUERY_FULL = `
|
|
229
|
+
query OrgFolders($orgId: Bytes!) {
|
|
230
|
+
organization(id: $orgId) {
|
|
231
|
+
id
|
|
232
|
+
foldersRoot
|
|
233
|
+
foldersUpdatedAt
|
|
234
|
+
foldersUpdatedBy
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
`;
|
|
238
|
+
/** Tier 1: pre-folders schema. */
|
|
239
|
+
exports.FOLDERS_QUERY_LEGACY = `
|
|
240
|
+
query OrgFoldersLegacy($orgId: Bytes!) {
|
|
241
|
+
organization(id: $orgId) {
|
|
242
|
+
id
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
`;
|
|
246
|
+
/**
|
|
247
|
+
* The org's indexed folders root + provenance. Port of the read at
|
|
248
|
+
* src/commands/task/folders.ts:169 (`pop task folders show`).
|
|
249
|
+
*/
|
|
250
|
+
async function fetchOrgFolders(client, orgId, chainId) {
|
|
251
|
+
const { data, tierIndex } = await client.queryWithFieldFallback([
|
|
252
|
+
{ query: exports.FOLDERS_QUERY_FULL, variables: { orgId } },
|
|
253
|
+
{ query: exports.FOLDERS_QUERY_LEGACY, variables: { orgId } },
|
|
254
|
+
], { chainId });
|
|
255
|
+
return { data, tierIndex, indexedRoot: normalizeRoot(data.organization?.foldersRoot) };
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Normalise a subgraph bytes32 to the 0x-prefixed lowercase form the lens returns.
|
|
259
|
+
* Port of src/commands/task/folders.ts normalizeRoot.
|
|
260
|
+
*/
|
|
261
|
+
function normalizeRoot(value) {
|
|
262
|
+
if (typeof value !== 'string')
|
|
263
|
+
return null;
|
|
264
|
+
const trimmed = value.trim().toLowerCase();
|
|
265
|
+
return ethers_1.ethers.utils.isHexString(trimmed, 32) ? trimmed : null;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* One task's release history (subgraph #201, Gnosis-only today). Port of the
|
|
269
|
+
* read at src/commands/task/view.ts:277. `taskEntityId` is the Task ENTITY id
|
|
270
|
+
* — `<lowercased taskManager address>-<numeric task id>`, not the bare number.
|
|
271
|
+
* The CLI issues this only when the shared projects document already reported
|
|
272
|
+
* `releaseCount > 0`, keeping the common path at one round-trip.
|
|
273
|
+
*/
|
|
274
|
+
async function fetchTaskReleaseHistory(client, taskEntityId, first = 20, chainId) {
|
|
275
|
+
const { data, tierIndex } = await client.queryWithFieldFallback([
|
|
276
|
+
{ query: task_1.FETCH_TASK_RELEASE_HISTORY, variables: { taskId: taskEntityId, first } },
|
|
277
|
+
{ query: task_1.FETCH_TASK_RELEASE_HISTORY_LEGACY, variables: { taskId: taskEntityId } },
|
|
278
|
+
], { chainId });
|
|
279
|
+
return { data, tierIndex, hasReleaseHistory: tierIndex === 0 };
|
|
280
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Participation-token reads — typed wrappers over graph/documents/token.
|
|
3
|
+
*
|
|
4
|
+
* Serves the read paths of `pop token balance` (src/commands/token/balance.ts)
|
|
5
|
+
* and `pop token requests` (src/commands/token/requests.ts), plus the
|
|
6
|
+
* subgraph half of the token-address resolution in
|
|
7
|
+
* src/commands/token/helpers.ts.
|
|
8
|
+
*
|
|
9
|
+
* NOT ported here (deliberately — see the header of
|
|
10
|
+
* src/commands/token/helpers.ts): readTokenGates / checkWearsAnyHat /
|
|
11
|
+
* readTokenRequest. Those are provider-bound revert predictors that MUST stay
|
|
12
|
+
* on RPC: ParticipationTokenContract.executor/.hatsContract are the zero
|
|
13
|
+
* address on all live subgraph rows, memberHatIds/approverHatIds are not
|
|
14
|
+
* indexed at all, and requests(id) is the existence/state gate evaluated
|
|
15
|
+
* immediately before a write — subgraph lag there means knowingly
|
|
16
|
+
* broadcasting a doomed transaction.
|
|
17
|
+
*/
|
|
18
|
+
import type { GraphClient } from '../graph/client';
|
|
19
|
+
/**
|
|
20
|
+
* Resolve an org (name or hex ID) to its ParticipationToken address.
|
|
21
|
+
* Port of resolveTokenAddress in src/commands/token/helpers.ts — the
|
|
22
|
+
* subgraph-only half of that file (the hat-gate readers stay in the CLI).
|
|
23
|
+
*/
|
|
24
|
+
export declare function resolveParticipationToken(client: GraphClient, orgIdOrName: string | undefined, chainId?: number): Promise<{
|
|
25
|
+
orgId: string;
|
|
26
|
+
tokenAddress: string;
|
|
27
|
+
}>;
|
|
28
|
+
/**
|
|
29
|
+
* Indexed balance snapshot for one holder.
|
|
30
|
+
*
|
|
31
|
+
* `balanceWei === null` means NO INDEXED ROW — not a zero balance. A missing
|
|
32
|
+
* TokenBalance row and a genuine zero are indistinguishable from the subgraph
|
|
33
|
+
* alone, so callers that must tell them apart settle it with an on-chain
|
|
34
|
+
* balanceOf (the CLI keeps that RPC fallback; see `pop token balance`).
|
|
35
|
+
*/
|
|
36
|
+
export interface TokenBalanceSnapshot {
|
|
37
|
+
tokenAddress: string;
|
|
38
|
+
/** Indexed ERC20 symbol ('PT', 'KUBIX', ... — populated on every live row), or null when the token contract is not indexed. */
|
|
39
|
+
symbol: string | null;
|
|
40
|
+
/** 18-decimal wei balance as a decimal string, or null when no row is indexed for this holder. */
|
|
41
|
+
balanceWei: string | null;
|
|
42
|
+
/** Unix seconds of the last indexed balance change, or null when no row. */
|
|
43
|
+
updatedAt: string | null;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Subgraph read behind `pop token balance` — src/commands/token/balance.ts.
|
|
47
|
+
* TokenBalance mirrors ERC20 balanceOf exactly (verified live: the sum of a
|
|
48
|
+
* token's TokenBalance rows equals its indexed totalSupply).
|
|
49
|
+
*/
|
|
50
|
+
export declare function getTokenBalance(client: GraphClient, tokenAddress: string, holder: string, chainId?: number): Promise<TokenBalanceSnapshot>;
|
|
51
|
+
/**
|
|
52
|
+
* Raw indexed token-request row. Field availability depends on the query that
|
|
53
|
+
* served it: the pending query carries `createdAtBlock` but not the
|
|
54
|
+
* resolution fields; the all/user queries carry
|
|
55
|
+
* `approvedAt`/`cancelledAt`/`approver` but not `createdAtBlock`; the
|
|
56
|
+
* user-scoped query omits `requester` (it is the filter). `metadata` is the
|
|
57
|
+
* indexed {reason, submittedAt} document and may be null when the IPFS
|
|
58
|
+
* document was not resolvable at indexing time.
|
|
59
|
+
*/
|
|
60
|
+
export interface TokenRequestRow {
|
|
61
|
+
id: string;
|
|
62
|
+
requestId: string;
|
|
63
|
+
requester?: string;
|
|
64
|
+
/** 18-decimal wei as a decimal string. */
|
|
65
|
+
amount: string;
|
|
66
|
+
ipfsHash: string;
|
|
67
|
+
metadata: {
|
|
68
|
+
reason: string | null;
|
|
69
|
+
submittedAt: string | null;
|
|
70
|
+
} | null;
|
|
71
|
+
status: string;
|
|
72
|
+
createdAt: string;
|
|
73
|
+
createdAtBlock?: string;
|
|
74
|
+
approvedAt?: string | null;
|
|
75
|
+
cancelledAt?: string | null;
|
|
76
|
+
approver?: string | null;
|
|
77
|
+
transactionHash?: string | null;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* List token requests for a ParticipationToken.
|
|
81
|
+
* Subgraph read behind `pop token requests` — src/commands/token/requests.ts
|
|
82
|
+
* (`status: 'pending'` ⇒ FETCH_PENDING_TOKEN_REQUESTS, `'all'` ⇒
|
|
83
|
+
* FETCH_ALL_TOKEN_REQUESTS; pending is the CLI default).
|
|
84
|
+
*/
|
|
85
|
+
export declare function listTokenRequests(client: GraphClient, tokenAddress: string, opts?: {
|
|
86
|
+
status?: 'pending' | 'all';
|
|
87
|
+
chainId?: number;
|
|
88
|
+
}): Promise<TokenRequestRow[]>;
|
|
89
|
+
/**
|
|
90
|
+
* One requester's token-request history (newest first, max 50) —
|
|
91
|
+
* FETCH_USER_TOKEN_REQUESTS from graph/documents/token. Rows omit
|
|
92
|
+
* `requester` (it is the filter variable).
|
|
93
|
+
*/
|
|
94
|
+
export declare function listUserTokenRequests(client: GraphClient, tokenAddress: string, userAddress: string, chainId?: number): Promise<TokenRequestRow[]>;
|