@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,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task & Project Queries
|
|
3
|
+
* Ported from frontend queries.js
|
|
4
|
+
*/
|
|
5
|
+
import type { FieldFallbackTier } from '../client';
|
|
6
|
+
export declare const FETCH_PROJECTS_DATA = "\n query FetchProjectsDataNew($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 metadataHash\n metadata {\n id\n description\n }\n cap\n bountyCaps {\n token\n cap\n }\n createdAt\n tasks(first: 1000, orderBy: taskId, orderDirection: desc) {\n id\n taskId\n title\n metadataHash\n submissionHash\n rejectionHash\n rejectionCount\n metadata {\n id\n name\n description\n location\n difficulty\n estimatedHours\n dueDate\n submission\n rejection\n }\n rejections(orderBy: rejectedAt, orderDirection: desc, first: 10) {\n rejectorUsername\n rejectedAt\n metadata {\n rejection\n }\n }\n payout\n bountyToken\n bountyPayout\n completionWindow\n absoluteDeadline\n claimDeadline\n reclaimCount\n status\n assignee\n assigneeUsername\n completer\n completerUsername\n requiresApplication\n createdAt\n assignedAt\n submittedAt\n completedAt\n applications {\n applicant\n applicantUsername\n applicationHash\n metadata {\n notes\n experience\n }\n approved\n approver\n approverUsername\n appliedAt\n }\n }\n }\n }\n }\n }\n";
|
|
7
|
+
/**
|
|
8
|
+
* FETCH_PROJECTS_DATA without the TaskManager v6 deadline fields (subgraph #192).
|
|
9
|
+
*
|
|
10
|
+
* A GraphQL document validates as a whole, so one unknown field fails the entire query. When
|
|
11
|
+
* this tier serves, callers fall back to reading deadlines on-chain via the task lens.
|
|
12
|
+
* Derived by deletion so the two cannot drift apart.
|
|
13
|
+
*/
|
|
14
|
+
export declare const FETCH_PROJECTS_DATA_LEGACY: string;
|
|
15
|
+
/**
|
|
16
|
+
* FETCH_PROJECTS_DATA plus the claim-release fields (subgraph #201, TaskManager v7).
|
|
17
|
+
*
|
|
18
|
+
* GNOSIS ONLY as of 2026-08-02. Verified live that poa-arb-v-1 rejects the document with
|
|
19
|
+
* ``Type `Task` has no field `releaseCount``` — which `isUnknownFieldError` matches on
|
|
20
|
+
* /has no field/i, so the tier drops cleanly to FETCH_PROJECTS_DATA. TaskManager v7 itself
|
|
21
|
+
* IS live on Arbitrum; it is only the indexing that has not shipped there.
|
|
22
|
+
*
|
|
23
|
+
* Both fields are structurally present but zero/null on every live Gnosis row (v7 shipped,
|
|
24
|
+
* no release has happened yet), so callers must gate rendering on the SERVED TIER, never on
|
|
25
|
+
* truthiness — `releaseCount: 0` ("indexed, never released") has to stay distinguishable
|
|
26
|
+
* from absent ("not indexed").
|
|
27
|
+
*
|
|
28
|
+
* Built by INSERTION, not by deletion like FETCH_PROJECTS_DATA_LEGACY: that idiom would
|
|
29
|
+
* silently no-op if a field were ever reflowed onto a shared line, leaving the "rich" tier
|
|
30
|
+
* byte-identical to the tier it exists to improve on. The task-release-tiers test asserts
|
|
31
|
+
* tier 0 is strictly longer than tier 1 for exactly this reason.
|
|
32
|
+
*/
|
|
33
|
+
export declare const FETCH_PROJECTS_DATA_WITH_RELEASES: string;
|
|
34
|
+
/**
|
|
35
|
+
* Tier order for consumers that want release data. Every consumer of the shared projects
|
|
36
|
+
* document that does NOT need releases must keep using bare `query(FETCH_PROJECTS_DATA)` —
|
|
37
|
+
* adding the v7 fields there would break those call sites outright on Arbitrum for no gain.
|
|
38
|
+
*/
|
|
39
|
+
export declare const PROJECTS_DATA_TIERS: string[];
|
|
40
|
+
/** Build the tier array for `queryWithFieldFallback`. */
|
|
41
|
+
export declare function projectsDataTiers(orgId: string): FieldFallbackTier[];
|
|
42
|
+
/**
|
|
43
|
+
* Chains whose deployed subgraph indexes `TaskUnclaimed` (subgraph #201).
|
|
44
|
+
*
|
|
45
|
+
* TaskManager v7 is live on EVERY chain — verified 2026-08-02, byte-identical
|
|
46
|
+
* implementation on Gnosis and Arbitrum — but only the Gnosis subgraph has the
|
|
47
|
+
* handler. So a release on any other chain succeeds on-chain and is then
|
|
48
|
+
* invisible to every read surface: the task keeps showing as claimed by the
|
|
49
|
+
* previous assignee, with `assignee`/`assignedAt` never cleared.
|
|
50
|
+
*
|
|
51
|
+
* Deliberately a chain-id allowlist rather than a runtime probe: `task unclaim`
|
|
52
|
+
* must be able to warn even under `--no-preflight`, with no extra round-trip.
|
|
53
|
+
* Delete an entry here only when that chain's subgraph is genuinely upgraded.
|
|
54
|
+
*/
|
|
55
|
+
export declare const TASK_RELEASE_INDEXING_CHAIN_IDS: ReadonlySet<number>;
|
|
56
|
+
/** Whether `chainId`'s subgraph indexes task releases. Unknown chains: assume not. */
|
|
57
|
+
export declare function chainIndexesTaskReleases(chainId: number | undefined): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* One task's full release history (subgraph #201). Issued only when the shared document
|
|
60
|
+
* already reported `releaseCount > 0`, so the common path stays at one round-trip.
|
|
61
|
+
*
|
|
62
|
+
* `$taskId` is the Task ENTITY id — `<lowercased taskManager address>-<numeric task id>`,
|
|
63
|
+
* not the bare numeric id.
|
|
64
|
+
*
|
|
65
|
+
* Every variable is scalar and the ordering args are inline on purpose: an `orderBy`/`where`
|
|
66
|
+
* that a deployment does not know produces ``Invalid value provided for argument `where``` /
|
|
67
|
+
* ``Variable `w` must have an input type``, and NONE of `isUnknownFieldError`'s regexes match
|
|
68
|
+
* those — they would escape the tier machinery and kill the command outright.
|
|
69
|
+
*/
|
|
70
|
+
export declare const FETCH_TASK_RELEASE_HISTORY = "\n query FetchTaskReleaseHistory($taskId: ID!, $first: Int!) {\n task(id: $taskId) {\n id\n taskId\n status\n releaseCount\n lastReleasedAt\n releases(first: $first, orderBy: releasedAt, orderDirection: desc) {\n id\n previousClaimer\n previousClaimerUsername\n caller\n callerUsername\n selfRelease\n releasedAt\n releasedAtBlock\n transactionHash\n }\n }\n }\n";
|
|
71
|
+
/**
|
|
72
|
+
* Tier 1 for the history read: deliberately minimal so `queryWithFieldFallback` resolves
|
|
73
|
+
* with tierIndex 1 ("release history not indexed here") instead of rethrowing the validation
|
|
74
|
+
* error, which is what it does when the LAST tier also fails.
|
|
75
|
+
*/
|
|
76
|
+
export declare const FETCH_TASK_RELEASE_HISTORY_LEGACY = "\n query FetchTaskReleaseHistoryLegacy($taskId: ID!) {\n task(id: $taskId) {\n id\n taskId\n status\n }\n }\n";
|
|
77
|
+
/**
|
|
78
|
+
* Org-wide recent releases (subgraph #201).
|
|
79
|
+
*
|
|
80
|
+
* Org scoping MUST route through the nested `task_` join: `TaskRelease` carries no org field
|
|
81
|
+
* and `Project` has no `organization` field. `$taskManager` must be LOWERCASED — a
|
|
82
|
+
* checksummed address returns `[]` silently rather than erroring.
|
|
83
|
+
*/
|
|
84
|
+
export declare const FETCH_ORG_TASK_RELEASES = "\n query FetchOrgTaskReleases($taskManager: Bytes!, $first: Int!, $skip: Int!) {\n taskReleases(\n where: { task_: { taskManager: $taskManager } }\n orderBy: releasedAt\n orderDirection: desc\n first: $first\n skip: $skip\n ) {\n id\n previousClaimer\n previousClaimerUsername\n caller\n callerUsername\n selfRelease\n releasedAt\n transactionHash\n task {\n id\n taskId\n title\n status\n releaseCount\n }\n }\n }\n";
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Task & Project Queries
|
|
4
|
+
* Ported from frontend queries.js
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.FETCH_ORG_TASK_RELEASES = exports.FETCH_TASK_RELEASE_HISTORY_LEGACY = exports.FETCH_TASK_RELEASE_HISTORY = exports.TASK_RELEASE_INDEXING_CHAIN_IDS = exports.PROJECTS_DATA_TIERS = exports.FETCH_PROJECTS_DATA_WITH_RELEASES = exports.FETCH_PROJECTS_DATA_LEGACY = exports.FETCH_PROJECTS_DATA = void 0;
|
|
8
|
+
exports.projectsDataTiers = projectsDataTiers;
|
|
9
|
+
exports.chainIndexesTaskReleases = chainIndexesTaskReleases;
|
|
10
|
+
exports.FETCH_PROJECTS_DATA = `
|
|
11
|
+
query FetchProjectsDataNew($orgId: Bytes!) {
|
|
12
|
+
organization(id: $orgId) {
|
|
13
|
+
id
|
|
14
|
+
taskManager {
|
|
15
|
+
id
|
|
16
|
+
creatorHatIds
|
|
17
|
+
projects(where: { deleted: false }, first: 50) {
|
|
18
|
+
id
|
|
19
|
+
title
|
|
20
|
+
metadataHash
|
|
21
|
+
metadata {
|
|
22
|
+
id
|
|
23
|
+
description
|
|
24
|
+
}
|
|
25
|
+
cap
|
|
26
|
+
bountyCaps {
|
|
27
|
+
token
|
|
28
|
+
cap
|
|
29
|
+
}
|
|
30
|
+
createdAt
|
|
31
|
+
tasks(first: 1000, orderBy: taskId, orderDirection: desc) {
|
|
32
|
+
id
|
|
33
|
+
taskId
|
|
34
|
+
title
|
|
35
|
+
metadataHash
|
|
36
|
+
submissionHash
|
|
37
|
+
rejectionHash
|
|
38
|
+
rejectionCount
|
|
39
|
+
metadata {
|
|
40
|
+
id
|
|
41
|
+
name
|
|
42
|
+
description
|
|
43
|
+
location
|
|
44
|
+
difficulty
|
|
45
|
+
estimatedHours
|
|
46
|
+
dueDate
|
|
47
|
+
submission
|
|
48
|
+
rejection
|
|
49
|
+
}
|
|
50
|
+
rejections(orderBy: rejectedAt, orderDirection: desc, first: 10) {
|
|
51
|
+
rejectorUsername
|
|
52
|
+
rejectedAt
|
|
53
|
+
metadata {
|
|
54
|
+
rejection
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
payout
|
|
58
|
+
bountyToken
|
|
59
|
+
bountyPayout
|
|
60
|
+
completionWindow
|
|
61
|
+
absoluteDeadline
|
|
62
|
+
claimDeadline
|
|
63
|
+
reclaimCount
|
|
64
|
+
status
|
|
65
|
+
assignee
|
|
66
|
+
assigneeUsername
|
|
67
|
+
completer
|
|
68
|
+
completerUsername
|
|
69
|
+
requiresApplication
|
|
70
|
+
createdAt
|
|
71
|
+
assignedAt
|
|
72
|
+
submittedAt
|
|
73
|
+
completedAt
|
|
74
|
+
applications {
|
|
75
|
+
applicant
|
|
76
|
+
applicantUsername
|
|
77
|
+
applicationHash
|
|
78
|
+
metadata {
|
|
79
|
+
notes
|
|
80
|
+
experience
|
|
81
|
+
}
|
|
82
|
+
approved
|
|
83
|
+
approver
|
|
84
|
+
approverUsername
|
|
85
|
+
appliedAt
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
`;
|
|
93
|
+
/**
|
|
94
|
+
* FETCH_PROJECTS_DATA without the TaskManager v6 deadline fields (subgraph #192).
|
|
95
|
+
*
|
|
96
|
+
* A GraphQL document validates as a whole, so one unknown field fails the entire query. When
|
|
97
|
+
* this tier serves, callers fall back to reading deadlines on-chain via the task lens.
|
|
98
|
+
* Derived by deletion so the two cannot drift apart.
|
|
99
|
+
*/
|
|
100
|
+
exports.FETCH_PROJECTS_DATA_LEGACY = exports.FETCH_PROJECTS_DATA
|
|
101
|
+
.split('\n')
|
|
102
|
+
.filter((line) => !/^\s*(completionWindow|absoluteDeadline|claimDeadline|reclaimCount)\s*$/.test(line))
|
|
103
|
+
.join('\n');
|
|
104
|
+
/**
|
|
105
|
+
* FETCH_PROJECTS_DATA plus the claim-release fields (subgraph #201, TaskManager v7).
|
|
106
|
+
*
|
|
107
|
+
* GNOSIS ONLY as of 2026-08-02. Verified live that poa-arb-v-1 rejects the document with
|
|
108
|
+
* ``Type `Task` has no field `releaseCount``` — which `isUnknownFieldError` matches on
|
|
109
|
+
* /has no field/i, so the tier drops cleanly to FETCH_PROJECTS_DATA. TaskManager v7 itself
|
|
110
|
+
* IS live on Arbitrum; it is only the indexing that has not shipped there.
|
|
111
|
+
*
|
|
112
|
+
* Both fields are structurally present but zero/null on every live Gnosis row (v7 shipped,
|
|
113
|
+
* no release has happened yet), so callers must gate rendering on the SERVED TIER, never on
|
|
114
|
+
* truthiness — `releaseCount: 0` ("indexed, never released") has to stay distinguishable
|
|
115
|
+
* from absent ("not indexed").
|
|
116
|
+
*
|
|
117
|
+
* Built by INSERTION, not by deletion like FETCH_PROJECTS_DATA_LEGACY: that idiom would
|
|
118
|
+
* silently no-op if a field were ever reflowed onto a shared line, leaving the "rich" tier
|
|
119
|
+
* byte-identical to the tier it exists to improve on. The task-release-tiers test asserts
|
|
120
|
+
* tier 0 is strictly longer than tier 1 for exactly this reason.
|
|
121
|
+
*/
|
|
122
|
+
exports.FETCH_PROJECTS_DATA_WITH_RELEASES = exports.FETCH_PROJECTS_DATA.replace(/^(\s*)reclaimCount$/m, '$1reclaimCount\n$1releaseCount\n$1lastReleasedAt');
|
|
123
|
+
/**
|
|
124
|
+
* Tier order for consumers that want release data. Every consumer of the shared projects
|
|
125
|
+
* document that does NOT need releases must keep using bare `query(FETCH_PROJECTS_DATA)` —
|
|
126
|
+
* adding the v7 fields there would break those call sites outright on Arbitrum for no gain.
|
|
127
|
+
*/
|
|
128
|
+
exports.PROJECTS_DATA_TIERS = [
|
|
129
|
+
exports.FETCH_PROJECTS_DATA_WITH_RELEASES, // 0: Gnosis — v6 deadlines + v7 releases
|
|
130
|
+
exports.FETCH_PROJECTS_DATA, // 1: Arbitrum today — v6 deadlines, no releases
|
|
131
|
+
exports.FETCH_PROJECTS_DATA_LEGACY, // 2: deployments predating subgraph #192
|
|
132
|
+
];
|
|
133
|
+
/** Build the tier array for `queryWithFieldFallback`. */
|
|
134
|
+
function projectsDataTiers(orgId) {
|
|
135
|
+
return exports.PROJECTS_DATA_TIERS.map((query) => ({ query, variables: { orgId } }));
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Chains whose deployed subgraph indexes `TaskUnclaimed` (subgraph #201).
|
|
139
|
+
*
|
|
140
|
+
* TaskManager v7 is live on EVERY chain — verified 2026-08-02, byte-identical
|
|
141
|
+
* implementation on Gnosis and Arbitrum — but only the Gnosis subgraph has the
|
|
142
|
+
* handler. So a release on any other chain succeeds on-chain and is then
|
|
143
|
+
* invisible to every read surface: the task keeps showing as claimed by the
|
|
144
|
+
* previous assignee, with `assignee`/`assignedAt` never cleared.
|
|
145
|
+
*
|
|
146
|
+
* Deliberately a chain-id allowlist rather than a runtime probe: `task unclaim`
|
|
147
|
+
* must be able to warn even under `--no-preflight`, with no extra round-trip.
|
|
148
|
+
* Delete an entry here only when that chain's subgraph is genuinely upgraded.
|
|
149
|
+
*/
|
|
150
|
+
exports.TASK_RELEASE_INDEXING_CHAIN_IDS = new Set([100]);
|
|
151
|
+
/** Whether `chainId`'s subgraph indexes task releases. Unknown chains: assume not. */
|
|
152
|
+
function chainIndexesTaskReleases(chainId) {
|
|
153
|
+
return chainId !== undefined && exports.TASK_RELEASE_INDEXING_CHAIN_IDS.has(chainId);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* One task's full release history (subgraph #201). Issued only when the shared document
|
|
157
|
+
* already reported `releaseCount > 0`, so the common path stays at one round-trip.
|
|
158
|
+
*
|
|
159
|
+
* `$taskId` is the Task ENTITY id — `<lowercased taskManager address>-<numeric task id>`,
|
|
160
|
+
* not the bare numeric id.
|
|
161
|
+
*
|
|
162
|
+
* Every variable is scalar and the ordering args are inline on purpose: an `orderBy`/`where`
|
|
163
|
+
* that a deployment does not know produces ``Invalid value provided for argument `where``` /
|
|
164
|
+
* ``Variable `w` must have an input type``, and NONE of `isUnknownFieldError`'s regexes match
|
|
165
|
+
* those — they would escape the tier machinery and kill the command outright.
|
|
166
|
+
*/
|
|
167
|
+
exports.FETCH_TASK_RELEASE_HISTORY = `
|
|
168
|
+
query FetchTaskReleaseHistory($taskId: ID!, $first: Int!) {
|
|
169
|
+
task(id: $taskId) {
|
|
170
|
+
id
|
|
171
|
+
taskId
|
|
172
|
+
status
|
|
173
|
+
releaseCount
|
|
174
|
+
lastReleasedAt
|
|
175
|
+
releases(first: $first, orderBy: releasedAt, orderDirection: desc) {
|
|
176
|
+
id
|
|
177
|
+
previousClaimer
|
|
178
|
+
previousClaimerUsername
|
|
179
|
+
caller
|
|
180
|
+
callerUsername
|
|
181
|
+
selfRelease
|
|
182
|
+
releasedAt
|
|
183
|
+
releasedAtBlock
|
|
184
|
+
transactionHash
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
`;
|
|
189
|
+
/**
|
|
190
|
+
* Tier 1 for the history read: deliberately minimal so `queryWithFieldFallback` resolves
|
|
191
|
+
* with tierIndex 1 ("release history not indexed here") instead of rethrowing the validation
|
|
192
|
+
* error, which is what it does when the LAST tier also fails.
|
|
193
|
+
*/
|
|
194
|
+
exports.FETCH_TASK_RELEASE_HISTORY_LEGACY = `
|
|
195
|
+
query FetchTaskReleaseHistoryLegacy($taskId: ID!) {
|
|
196
|
+
task(id: $taskId) {
|
|
197
|
+
id
|
|
198
|
+
taskId
|
|
199
|
+
status
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
`;
|
|
203
|
+
/**
|
|
204
|
+
* Org-wide recent releases (subgraph #201).
|
|
205
|
+
*
|
|
206
|
+
* Org scoping MUST route through the nested `task_` join: `TaskRelease` carries no org field
|
|
207
|
+
* and `Project` has no `organization` field. `$taskManager` must be LOWERCASED — a
|
|
208
|
+
* checksummed address returns `[]` silently rather than erroring.
|
|
209
|
+
*/
|
|
210
|
+
exports.FETCH_ORG_TASK_RELEASES = `
|
|
211
|
+
query FetchOrgTaskReleases($taskManager: Bytes!, $first: Int!, $skip: Int!) {
|
|
212
|
+
taskReleases(
|
|
213
|
+
where: { task_: { taskManager: $taskManager } }
|
|
214
|
+
orderBy: releasedAt
|
|
215
|
+
orderDirection: desc
|
|
216
|
+
first: $first
|
|
217
|
+
skip: $skip
|
|
218
|
+
) {
|
|
219
|
+
id
|
|
220
|
+
previousClaimer
|
|
221
|
+
previousClaimerUsername
|
|
222
|
+
caller
|
|
223
|
+
callerUsername
|
|
224
|
+
selfRelease
|
|
225
|
+
releasedAt
|
|
226
|
+
transactionHash
|
|
227
|
+
task {
|
|
228
|
+
id
|
|
229
|
+
taskId
|
|
230
|
+
title
|
|
231
|
+
status
|
|
232
|
+
releaseCount
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
`;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token Request Queries
|
|
3
|
+
* Ported from frontend queries.js
|
|
4
|
+
*/
|
|
5
|
+
export declare const FETCH_PENDING_TOKEN_REQUESTS = "\n query FetchPendingTokenRequests($tokenAddress: String!) {\n tokenRequests(\n where: { participationToken: $tokenAddress, status: Pending }\n orderBy: createdAt\n orderDirection: desc\n first: 100\n ) {\n id\n requestId\n requester\n amount\n ipfsHash\n metadata {\n reason\n submittedAt\n }\n status\n createdAt\n createdAtBlock\n transactionHash\n }\n }\n";
|
|
6
|
+
export declare const FETCH_USER_TOKEN_REQUESTS = "\n query FetchUserTokenRequests($tokenAddress: String!, $userAddress: Bytes!) {\n tokenRequests(\n where: { participationToken: $tokenAddress, requester: $userAddress }\n orderBy: createdAt\n orderDirection: desc\n first: 50\n ) {\n id\n requestId\n amount\n ipfsHash\n metadata {\n reason\n submittedAt\n }\n status\n createdAt\n approvedAt\n cancelledAt\n approver\n transactionHash\n }\n }\n";
|
|
7
|
+
export declare const FETCH_ALL_TOKEN_REQUESTS = "\n query FetchAllTokenRequests($tokenAddress: String!) {\n tokenRequests(\n where: { participationToken: $tokenAddress }\n orderBy: createdAt\n orderDirection: desc\n first: 100\n ) {\n id\n requestId\n requester\n amount\n ipfsHash\n metadata {\n reason\n submittedAt\n }\n status\n createdAt\n approvedAt\n cancelledAt\n approver\n transactionHash\n }\n }\n";
|
|
8
|
+
/** Single holder balance + token symbol — `pop token balance`. */
|
|
9
|
+
export declare const FETCH_TOKEN_BALANCE = "\n query FetchTokenBalance($token: ID!, $balanceId: ID!) {\n participationTokenContract(id: $token) {\n id\n symbol\n }\n tokenBalance(id: $balanceId) {\n id\n balance\n updatedAt\n }\n }\n";
|
|
10
|
+
/** Many holder balances in one round-trip — `pop vote analyze`. */
|
|
11
|
+
export declare const FETCH_TOKEN_BALANCES = "\n query FetchTokenBalances($token: String!, $accounts: [Bytes!]) {\n tokenBalances(first: 1000, where: { participationToken: $token, account_in: $accounts }) {\n account\n balance\n }\n }\n";
|
|
12
|
+
/** Compose the TokenBalance entity id from a token + holder address. */
|
|
13
|
+
export declare function tokenBalanceId(tokenAddress: string, holder: string): string;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Token Request Queries
|
|
4
|
+
* Ported from frontend queries.js
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.FETCH_TOKEN_BALANCES = exports.FETCH_TOKEN_BALANCE = exports.FETCH_ALL_TOKEN_REQUESTS = exports.FETCH_USER_TOKEN_REQUESTS = exports.FETCH_PENDING_TOKEN_REQUESTS = void 0;
|
|
8
|
+
exports.tokenBalanceId = tokenBalanceId;
|
|
9
|
+
exports.FETCH_PENDING_TOKEN_REQUESTS = `
|
|
10
|
+
query FetchPendingTokenRequests($tokenAddress: String!) {
|
|
11
|
+
tokenRequests(
|
|
12
|
+
where: { participationToken: $tokenAddress, status: Pending }
|
|
13
|
+
orderBy: createdAt
|
|
14
|
+
orderDirection: desc
|
|
15
|
+
first: 100
|
|
16
|
+
) {
|
|
17
|
+
id
|
|
18
|
+
requestId
|
|
19
|
+
requester
|
|
20
|
+
amount
|
|
21
|
+
ipfsHash
|
|
22
|
+
metadata {
|
|
23
|
+
reason
|
|
24
|
+
submittedAt
|
|
25
|
+
}
|
|
26
|
+
status
|
|
27
|
+
createdAt
|
|
28
|
+
createdAtBlock
|
|
29
|
+
transactionHash
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
exports.FETCH_USER_TOKEN_REQUESTS = `
|
|
34
|
+
query FetchUserTokenRequests($tokenAddress: String!, $userAddress: Bytes!) {
|
|
35
|
+
tokenRequests(
|
|
36
|
+
where: { participationToken: $tokenAddress, requester: $userAddress }
|
|
37
|
+
orderBy: createdAt
|
|
38
|
+
orderDirection: desc
|
|
39
|
+
first: 50
|
|
40
|
+
) {
|
|
41
|
+
id
|
|
42
|
+
requestId
|
|
43
|
+
amount
|
|
44
|
+
ipfsHash
|
|
45
|
+
metadata {
|
|
46
|
+
reason
|
|
47
|
+
submittedAt
|
|
48
|
+
}
|
|
49
|
+
status
|
|
50
|
+
createdAt
|
|
51
|
+
approvedAt
|
|
52
|
+
cancelledAt
|
|
53
|
+
approver
|
|
54
|
+
transactionHash
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
58
|
+
exports.FETCH_ALL_TOKEN_REQUESTS = `
|
|
59
|
+
query FetchAllTokenRequests($tokenAddress: String!) {
|
|
60
|
+
tokenRequests(
|
|
61
|
+
where: { participationToken: $tokenAddress }
|
|
62
|
+
orderBy: createdAt
|
|
63
|
+
orderDirection: desc
|
|
64
|
+
first: 100
|
|
65
|
+
) {
|
|
66
|
+
id
|
|
67
|
+
requestId
|
|
68
|
+
requester
|
|
69
|
+
amount
|
|
70
|
+
ipfsHash
|
|
71
|
+
metadata {
|
|
72
|
+
reason
|
|
73
|
+
submittedAt
|
|
74
|
+
}
|
|
75
|
+
status
|
|
76
|
+
createdAt
|
|
77
|
+
approvedAt
|
|
78
|
+
cancelledAt
|
|
79
|
+
approver
|
|
80
|
+
transactionHash
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
`;
|
|
84
|
+
// ─────────────────────── ParticipationToken balances ───────────────────────
|
|
85
|
+
//
|
|
86
|
+
// TokenBalance is a complete mirror of ERC20 balanceOf: verified live on
|
|
87
|
+
// poa-gnosis-v-1 that sum(TokenBalance.balance) == ParticipationTokenContract
|
|
88
|
+
// .totalSupply for a token with multiple holders (0x5cafc2fa…, 3 rows,
|
|
89
|
+
// 8273e18 both sides). Row id is `${tokenAddress}-${holderAddress}`, both
|
|
90
|
+
// lowercase.
|
|
91
|
+
//
|
|
92
|
+
// ParticipationTokenContract.symbol is populated on every live row ('PT',
|
|
93
|
+
// 'KUBIX', 'TEST'), which is strictly better than the hardcoded 'PT' guess the
|
|
94
|
+
// balance command used when the symbol() call failed.
|
|
95
|
+
//
|
|
96
|
+
// NOTE for future work: ParticipationTokenContract.executor and .hatsContract
|
|
97
|
+
// exist in this same schema but are ZERO on all 9 live Gnosis rows, and
|
|
98
|
+
// memberHatIds/approverHatIds are not indexed at all — the token hat gates
|
|
99
|
+
// still have to be read from the contract (see src/commands/token/helpers.ts).
|
|
100
|
+
/** Single holder balance + token symbol — `pop token balance`. */
|
|
101
|
+
exports.FETCH_TOKEN_BALANCE = `
|
|
102
|
+
query FetchTokenBalance($token: ID!, $balanceId: ID!) {
|
|
103
|
+
participationTokenContract(id: $token) {
|
|
104
|
+
id
|
|
105
|
+
symbol
|
|
106
|
+
}
|
|
107
|
+
tokenBalance(id: $balanceId) {
|
|
108
|
+
id
|
|
109
|
+
balance
|
|
110
|
+
updatedAt
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
`;
|
|
114
|
+
/** Many holder balances in one round-trip — `pop vote analyze`. */
|
|
115
|
+
exports.FETCH_TOKEN_BALANCES = `
|
|
116
|
+
query FetchTokenBalances($token: String!, $accounts: [Bytes!]) {
|
|
117
|
+
tokenBalances(first: 1000, where: { participationToken: $token, account_in: $accounts }) {
|
|
118
|
+
account
|
|
119
|
+
balance
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
`;
|
|
123
|
+
/** Compose the TokenBalance entity id from a token + holder address. */
|
|
124
|
+
function tokenBalanceId(tokenAddress, holder) {
|
|
125
|
+
return `${tokenAddress.toLowerCase()}-${holder.toLowerCase()}`;
|
|
126
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Treasury Queries
|
|
3
|
+
* Ported from frontend queries.js
|
|
4
|
+
*/
|
|
5
|
+
export declare const FETCH_TREASURY_DATA = "\n query FetchTreasuryData($orgId: Bytes!) {\n organization(id: $orgId) {\n id\n executorContract {\n id\n isPaused\n owner\n allowedCaller\n sweeps(first: 50, orderBy: sweptAt, orderDirection: desc) {\n id\n to\n amount\n sweptAt\n transactionHash\n }\n }\n participationToken {\n id\n name\n symbol\n totalSupply\n }\n paymentManager {\n id\n owner\n revenueShareToken\n distributionCounter\n distributions(first: 100, orderBy: createdAt, orderDirection: desc) {\n id\n distributionId\n payoutToken\n totalAmount\n totalClaimed\n checkpointBlock\n createdAtBlock\n merkleRoot\n status\n createdAt\n finalizedAt\n unclaimedAmount\n claims(first: 200) {\n id\n claimer\n claimerUsername\n amount\n claimedAt\n transactionHash\n }\n }\n payments(first: 100, orderBy: receivedAt, orderDirection: desc) {\n id\n payer\n payerUsername\n amount\n token\n receivedAt\n transactionHash\n }\n }\n }\n }\n";
|
|
6
|
+
/**
|
|
7
|
+
* Subgraph entity id for a distribution: `<paymentManager>-<distributionId>`, with the
|
|
8
|
+
* PaymentManager address lower-cased (the mapping keys off `event.address`, which the Graph
|
|
9
|
+
* node serialises lower-case). Verified against live Gnosis rows, e.g.
|
|
10
|
+
* `0x409f51250dc5c66bb1d6952f947d841192f1140e-1`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function distributionEntityId(paymentManager: string, distributionId: number | string): string;
|
|
13
|
+
/**
|
|
14
|
+
* One distribution, by entity id — the indexed twin of PaymentManager.getDistribution().
|
|
15
|
+
*
|
|
16
|
+
* Field mapping (all six on-chain struct members that have a getter):
|
|
17
|
+
* payoutToken -> payoutToken
|
|
18
|
+
* totalAmount -> totalAmount
|
|
19
|
+
* checkpointBlock -> checkpointBlock
|
|
20
|
+
* merkleRoot -> merkleRoot
|
|
21
|
+
* totalClaimed -> totalClaimed
|
|
22
|
+
* finalized -> status == "Finalized" (enum is exactly Active | Finalized)
|
|
23
|
+
*
|
|
24
|
+
* Plus `createdAtBlock`, which the contract has NO getter for — `Distribution.creationBlock`
|
|
25
|
+
* is private state — so the subgraph is the only source for it. All of these are populated on
|
|
26
|
+
* every live Gnosis row (verified 2026-07: 5/5 distributions non-null on every field) and the
|
|
27
|
+
* whole field set also exists on the Arbitrum deployment
|
|
28
|
+
* (QmYGCS4pXoaqXX7WjaPEhA56kiwgC14z7jsstZzEQgxgUp), so no queryWithFieldFallback tier is needed.
|
|
29
|
+
*
|
|
30
|
+
* `distribution(id:)` returns null (not an error) for an unknown id, which callers MUST treat as
|
|
31
|
+
* "not indexed yet" and resolve on-chain — never as DistributionNotFound.
|
|
32
|
+
*/
|
|
33
|
+
export declare const FETCH_DISTRIBUTION_BY_ID = "\n query FetchDistributionById($id: ID!) {\n distribution(id: $id) {\n id\n distributionId\n payoutToken\n totalAmount\n totalClaimed\n checkpointBlock\n createdAtBlock\n merkleRoot\n status\n }\n }\n";
|
|
34
|
+
/**
|
|
35
|
+
* Every still-claimable distribution for an org, with the claim log needed to skip the ones
|
|
36
|
+
* this wallet already took. Shared by `pop treasury claim-mine`; `pop treasury claim` reads the
|
|
37
|
+
* single-distribution form above so the two commands agree on one source for the same values.
|
|
38
|
+
*/
|
|
39
|
+
export declare const FETCH_ACTIVE_DISTRIBUTIONS = "\n query FetchActiveDistributions($orgId: Bytes!) {\n organization(id: $orgId) {\n paymentManager {\n distributions(where: { status: \"Active\" }, first: 50) {\n distributionId\n totalAmount\n merkleRoot\n checkpointBlock\n payoutToken\n claims { claimer }\n }\n }\n }\n }\n";
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Treasury Queries
|
|
4
|
+
* Ported from frontend queries.js
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.FETCH_ACTIVE_DISTRIBUTIONS = exports.FETCH_DISTRIBUTION_BY_ID = exports.FETCH_TREASURY_DATA = void 0;
|
|
8
|
+
exports.distributionEntityId = distributionEntityId;
|
|
9
|
+
exports.FETCH_TREASURY_DATA = `
|
|
10
|
+
query FetchTreasuryData($orgId: Bytes!) {
|
|
11
|
+
organization(id: $orgId) {
|
|
12
|
+
id
|
|
13
|
+
executorContract {
|
|
14
|
+
id
|
|
15
|
+
isPaused
|
|
16
|
+
owner
|
|
17
|
+
allowedCaller
|
|
18
|
+
sweeps(first: 50, orderBy: sweptAt, orderDirection: desc) {
|
|
19
|
+
id
|
|
20
|
+
to
|
|
21
|
+
amount
|
|
22
|
+
sweptAt
|
|
23
|
+
transactionHash
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
participationToken {
|
|
27
|
+
id
|
|
28
|
+
name
|
|
29
|
+
symbol
|
|
30
|
+
totalSupply
|
|
31
|
+
}
|
|
32
|
+
paymentManager {
|
|
33
|
+
id
|
|
34
|
+
owner
|
|
35
|
+
revenueShareToken
|
|
36
|
+
distributionCounter
|
|
37
|
+
distributions(first: 100, orderBy: createdAt, orderDirection: desc) {
|
|
38
|
+
id
|
|
39
|
+
distributionId
|
|
40
|
+
payoutToken
|
|
41
|
+
totalAmount
|
|
42
|
+
totalClaimed
|
|
43
|
+
checkpointBlock
|
|
44
|
+
createdAtBlock
|
|
45
|
+
merkleRoot
|
|
46
|
+
status
|
|
47
|
+
createdAt
|
|
48
|
+
finalizedAt
|
|
49
|
+
unclaimedAmount
|
|
50
|
+
claims(first: 200) {
|
|
51
|
+
id
|
|
52
|
+
claimer
|
|
53
|
+
claimerUsername
|
|
54
|
+
amount
|
|
55
|
+
claimedAt
|
|
56
|
+
transactionHash
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
payments(first: 100, orderBy: receivedAt, orderDirection: desc) {
|
|
60
|
+
id
|
|
61
|
+
payer
|
|
62
|
+
payerUsername
|
|
63
|
+
amount
|
|
64
|
+
token
|
|
65
|
+
receivedAt
|
|
66
|
+
transactionHash
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
72
|
+
/**
|
|
73
|
+
* Subgraph entity id for a distribution: `<paymentManager>-<distributionId>`, with the
|
|
74
|
+
* PaymentManager address lower-cased (the mapping keys off `event.address`, which the Graph
|
|
75
|
+
* node serialises lower-case). Verified against live Gnosis rows, e.g.
|
|
76
|
+
* `0x409f51250dc5c66bb1d6952f947d841192f1140e-1`.
|
|
77
|
+
*/
|
|
78
|
+
function distributionEntityId(paymentManager, distributionId) {
|
|
79
|
+
return `${paymentManager.toLowerCase()}-${distributionId}`;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* One distribution, by entity id — the indexed twin of PaymentManager.getDistribution().
|
|
83
|
+
*
|
|
84
|
+
* Field mapping (all six on-chain struct members that have a getter):
|
|
85
|
+
* payoutToken -> payoutToken
|
|
86
|
+
* totalAmount -> totalAmount
|
|
87
|
+
* checkpointBlock -> checkpointBlock
|
|
88
|
+
* merkleRoot -> merkleRoot
|
|
89
|
+
* totalClaimed -> totalClaimed
|
|
90
|
+
* finalized -> status == "Finalized" (enum is exactly Active | Finalized)
|
|
91
|
+
*
|
|
92
|
+
* Plus `createdAtBlock`, which the contract has NO getter for — `Distribution.creationBlock`
|
|
93
|
+
* is private state — so the subgraph is the only source for it. All of these are populated on
|
|
94
|
+
* every live Gnosis row (verified 2026-07: 5/5 distributions non-null on every field) and the
|
|
95
|
+
* whole field set also exists on the Arbitrum deployment
|
|
96
|
+
* (QmYGCS4pXoaqXX7WjaPEhA56kiwgC14z7jsstZzEQgxgUp), so no queryWithFieldFallback tier is needed.
|
|
97
|
+
*
|
|
98
|
+
* `distribution(id:)` returns null (not an error) for an unknown id, which callers MUST treat as
|
|
99
|
+
* "not indexed yet" and resolve on-chain — never as DistributionNotFound.
|
|
100
|
+
*/
|
|
101
|
+
exports.FETCH_DISTRIBUTION_BY_ID = `
|
|
102
|
+
query FetchDistributionById($id: ID!) {
|
|
103
|
+
distribution(id: $id) {
|
|
104
|
+
id
|
|
105
|
+
distributionId
|
|
106
|
+
payoutToken
|
|
107
|
+
totalAmount
|
|
108
|
+
totalClaimed
|
|
109
|
+
checkpointBlock
|
|
110
|
+
createdAtBlock
|
|
111
|
+
merkleRoot
|
|
112
|
+
status
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
`;
|
|
116
|
+
/**
|
|
117
|
+
* Every still-claimable distribution for an org, with the claim log needed to skip the ones
|
|
118
|
+
* this wallet already took. Shared by `pop treasury claim-mine`; `pop treasury claim` reads the
|
|
119
|
+
* single-distribution form above so the two commands agree on one source for the same values.
|
|
120
|
+
*/
|
|
121
|
+
exports.FETCH_ACTIVE_DISTRIBUTIONS = `
|
|
122
|
+
query FetchActiveDistributions($orgId: Bytes!) {
|
|
123
|
+
organization(id: $orgId) {
|
|
124
|
+
paymentManager {
|
|
125
|
+
distributions(where: { status: "Active" }, first: 50) {
|
|
126
|
+
distributionId
|
|
127
|
+
totalAmount
|
|
128
|
+
merkleRoot
|
|
129
|
+
checkpointBlock
|
|
130
|
+
payoutToken
|
|
131
|
+
claims { claimer }
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
`;
|