@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,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Voting Queries
|
|
4
|
+
* Ported from frontend queries.js
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.FETCH_VOTING_DATA_LEGACY = exports.FETCH_VOTING_DATA = exports.PROPOSAL_STATE_FOR_PREFLIGHT = exports.RECENT_PROPOSALS_FOR_RESOLVE = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* Fuzzy --proposal resolution: recent proposals for ONE voting contract,
|
|
10
|
+
* addressed directly by contract address (works for HybridVoting and
|
|
11
|
+
* DirectDemocracyVoting — whichever entity matches the address answers,
|
|
12
|
+
* the other root field returns null). Titles are stored decoded by the
|
|
13
|
+
* subgraph, so they can be scored with bestMatches directly.
|
|
14
|
+
*/
|
|
15
|
+
exports.RECENT_PROPOSALS_FOR_RESOLVE = `
|
|
16
|
+
query RecentProposalsForResolve($votingId: ID!, $first: Int!) {
|
|
17
|
+
hybridVotingContract(id: $votingId) {
|
|
18
|
+
id
|
|
19
|
+
proposals(orderBy: startTimestamp, orderDirection: desc, first: $first) {
|
|
20
|
+
proposalId
|
|
21
|
+
title
|
|
22
|
+
status
|
|
23
|
+
endTimestamp
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
directDemocracyVotingContract(id: $votingId) {
|
|
27
|
+
id
|
|
28
|
+
ddvProposals(orderBy: startTimestamp, orderDirection: desc, first: $first) {
|
|
29
|
+
proposalId
|
|
30
|
+
title
|
|
31
|
+
status
|
|
32
|
+
endTimestamp
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
/**
|
|
38
|
+
* One proposal's voting-window state for the cast pre-flight
|
|
39
|
+
* ("not obviously ended"). Same dual-entity addressing as above.
|
|
40
|
+
*/
|
|
41
|
+
exports.PROPOSAL_STATE_FOR_PREFLIGHT = `
|
|
42
|
+
query ProposalStateForPreflight($votingId: ID!, $proposalId: BigInt!) {
|
|
43
|
+
hybridVotingContract(id: $votingId) {
|
|
44
|
+
proposals(where: { proposalId: $proposalId }, first: 1) {
|
|
45
|
+
proposalId
|
|
46
|
+
status
|
|
47
|
+
endTimestamp
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
directDemocracyVotingContract(id: $votingId) {
|
|
51
|
+
ddvProposals(where: { proposalId: $proposalId }, first: 1) {
|
|
52
|
+
proposalId
|
|
53
|
+
status
|
|
54
|
+
endTimestamp
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
59
|
+
exports.FETCH_VOTING_DATA = `
|
|
60
|
+
query FetchVotingDataNew($orgId: Bytes!) {
|
|
61
|
+
organization(id: $orgId) {
|
|
62
|
+
id
|
|
63
|
+
hybridVoting {
|
|
64
|
+
id
|
|
65
|
+
thresholdPct
|
|
66
|
+
quorum
|
|
67
|
+
classVersion
|
|
68
|
+
votingClasses(where: { isActive: true }, orderBy: classIndex, orderDirection: asc) {
|
|
69
|
+
id
|
|
70
|
+
classIndex
|
|
71
|
+
version
|
|
72
|
+
strategy
|
|
73
|
+
slicePct
|
|
74
|
+
quadratic
|
|
75
|
+
minBalance
|
|
76
|
+
asset
|
|
77
|
+
hatIds
|
|
78
|
+
isActive
|
|
79
|
+
}
|
|
80
|
+
proposals(orderBy: startTimestamp, orderDirection: desc, first: 50) {
|
|
81
|
+
id
|
|
82
|
+
proposalId
|
|
83
|
+
title
|
|
84
|
+
descriptionHash
|
|
85
|
+
metadata {
|
|
86
|
+
id
|
|
87
|
+
description
|
|
88
|
+
optionNames
|
|
89
|
+
}
|
|
90
|
+
numOptions
|
|
91
|
+
startTimestamp
|
|
92
|
+
endTimestamp
|
|
93
|
+
status
|
|
94
|
+
winningOption
|
|
95
|
+
isValid
|
|
96
|
+
wasExecuted
|
|
97
|
+
executionFailed
|
|
98
|
+
executionError
|
|
99
|
+
isHatRestricted
|
|
100
|
+
restrictedHatIds
|
|
101
|
+
proposer
|
|
102
|
+
proposerUsername
|
|
103
|
+
creatorUsername
|
|
104
|
+
classesVersion
|
|
105
|
+
votes {
|
|
106
|
+
voter
|
|
107
|
+
voterUsername
|
|
108
|
+
optionIndexes
|
|
109
|
+
optionWeights
|
|
110
|
+
classRawPowers
|
|
111
|
+
votedAt
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
directDemocracyVoting {
|
|
116
|
+
id
|
|
117
|
+
thresholdPct
|
|
118
|
+
quorum
|
|
119
|
+
ddvProposals(orderBy: startTimestamp, orderDirection: desc, first: 50) {
|
|
120
|
+
id
|
|
121
|
+
proposalId
|
|
122
|
+
title
|
|
123
|
+
descriptionHash
|
|
124
|
+
metadata {
|
|
125
|
+
id
|
|
126
|
+
description
|
|
127
|
+
optionNames
|
|
128
|
+
}
|
|
129
|
+
numOptions
|
|
130
|
+
startTimestamp
|
|
131
|
+
endTimestamp
|
|
132
|
+
status
|
|
133
|
+
winningOption
|
|
134
|
+
isValid
|
|
135
|
+
executionFailed
|
|
136
|
+
executionError
|
|
137
|
+
isHatRestricted
|
|
138
|
+
restrictedHatIds
|
|
139
|
+
proposer
|
|
140
|
+
proposerUsername
|
|
141
|
+
votes {
|
|
142
|
+
voter
|
|
143
|
+
optionIndexes
|
|
144
|
+
optionWeights
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
`;
|
|
151
|
+
/**
|
|
152
|
+
* FETCH_VOTING_DATA without the subgraph #195 attribution fields.
|
|
153
|
+
*
|
|
154
|
+
* A GraphQL document is validated as a whole, so a single unknown field fails the entire
|
|
155
|
+
* query — not just that selection. `pop vote announce-all` (a WRITE that announces winners)
|
|
156
|
+
* shares this document, so against a subgraph pinned before #195 the org would lose the
|
|
157
|
+
* ability to announce ANY proposal. Derived from the full query by deletion so the two
|
|
158
|
+
* cannot drift apart.
|
|
159
|
+
*/
|
|
160
|
+
exports.FETCH_VOTING_DATA_LEGACY = exports.FETCH_VOTING_DATA
|
|
161
|
+
.split('\n')
|
|
162
|
+
.filter((line) => !/^\s*(proposer|proposerUsername|creatorUsername|classesVersion|classVersion)\s*$/.test(line))
|
|
163
|
+
.join('\n');
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vouching Queries
|
|
3
|
+
* Ported from frontend queries.js
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Vouch config for one hat — the subgraph mirror of
|
|
7
|
+
* EligibilityModule.getVouchConfig(hatId) / vouchConfigs(hatId).
|
|
8
|
+
*
|
|
9
|
+
* Field population VERIFIED live (2026-07-30) on BOTH deployments:
|
|
10
|
+
* poa-gnosis-v-1 → quorum=1, membershipHatId=2908…, enabled=true,
|
|
11
|
+
* combinesWithHierarchy=true/false (both values present)
|
|
12
|
+
* poa-arb-v-1 → same fields, same shape
|
|
13
|
+
* so no field-fallback tier is required. Callers still degrade to the RPC
|
|
14
|
+
* getter on ANY error (including a hypothetical unknown-field validation
|
|
15
|
+
* failure on a self-hosted older deployment), which is the correct answer
|
|
16
|
+
* rather than a partially-filled one.
|
|
17
|
+
*
|
|
18
|
+
* A MISSING row is deliberately NOT treated as "vouching disabled": callers
|
|
19
|
+
* fall back to RPC, because absence is ambiguous between "no VouchConfigSet
|
|
20
|
+
* event was ever emitted" and "not indexed yet".
|
|
21
|
+
*/
|
|
22
|
+
export declare const FETCH_VOUCH_CONFIG = "\n query FetchVouchConfig($eligibilityModuleId: Bytes!, $hatId: BigInt!) {\n vouchConfigs(\n where: { eligibilityModule: $eligibilityModuleId, hatId: $hatId }\n first: 1\n ) {\n id\n hatId\n quorum\n membershipHatId\n enabled\n combinesWithHierarchy\n }\n }\n";
|
|
23
|
+
/**
|
|
24
|
+
* TIER 0 — vouch progress read off the subgraph's epoch mirror.
|
|
25
|
+
*
|
|
26
|
+
* EligibilityModule kills stale vouches by bumping an epoch counter rather than
|
|
27
|
+
* emitting a per-vouch invalidation:
|
|
28
|
+
*
|
|
29
|
+
* configureVouching / batchConfigureVouching / resetVouches → vouchConfigEpoch[hatId]++
|
|
30
|
+
* clearWearerVouches → wearerVouchEpoch = 2^256-1
|
|
31
|
+
*
|
|
32
|
+
* and `currentVouchCount(hatId, wearer)` returns 0 whenever the two disagree. The
|
|
33
|
+
* subgraph mirrors both counters onto WearerVouchState, so this tier reproduces the
|
|
34
|
+
* getter EXACTLY:
|
|
35
|
+
*
|
|
36
|
+
* currentCount = (state.epoch == config.epoch) ? state.count : 0
|
|
37
|
+
*
|
|
38
|
+
* No row counting, so no 1000-row page cap and no cross-epoch overcount.
|
|
39
|
+
*
|
|
40
|
+
* `effectiveCount` is the subgraph's own materialisation of that same expression. It
|
|
41
|
+
* is read only as a CONSISTENCY CHECK: the count+epoch comparison is self-correcting
|
|
42
|
+
* while effectiveCount depends on a sweep, so a disagreement means the deployment is
|
|
43
|
+
* buggy and the caller falls back to RPC rather than picking a winner.
|
|
44
|
+
*
|
|
45
|
+
* This tier fails GraphQL validation (unknown field `epoch`) on deployments predating
|
|
46
|
+
* the epoch indexing, which is what drops callers to FETCH_VOUCH_STATUS below.
|
|
47
|
+
*/
|
|
48
|
+
export declare const FETCH_VOUCH_STATUS_EPOCH_AWARE = "\n query FetchVouchStatusEpochAware($eligibilityModuleId: Bytes!, $hatId: BigInt!, $wearer: Bytes!) {\n vouchConfigs(\n where: { eligibilityModule: $eligibilityModuleId, hatId: $hatId }\n first: 1\n ) {\n id\n hatId\n quorum\n membershipHatId\n enabled\n combinesWithHierarchy\n epoch\n }\n wearerVouchStates(\n where: {\n eligibilityModule: $eligibilityModuleId\n hatId: $hatId\n wearer: $wearer\n }\n first: 1\n ) {\n id\n count\n effectiveCount\n epoch\n cleared\n }\n }\n";
|
|
49
|
+
/**
|
|
50
|
+
* TIER 1 — legacy deployments with no epoch mirror.
|
|
51
|
+
*
|
|
52
|
+
* `vouches.length` approximates the on-chain currentVouchCount(hatId, wearer):
|
|
53
|
+
* EligibilityModule increments the counter in vouchFor (emits Vouched) and decrements
|
|
54
|
+
* it in revokeVouch (emits VouchRevoked), and the subgraph creates a Vouch on Vouched /
|
|
55
|
+
* flips isActive=false on VouchRevoked.
|
|
56
|
+
*
|
|
57
|
+
* VERIFIED live against Gnosis RPC on 5 real (hat, wearer) pairs, including three with
|
|
58
|
+
* a count of 2 — active-Vouch count matched currentVouchCount() exactly on all 5.
|
|
59
|
+
*
|
|
60
|
+
* It is only an APPROXIMATION: on these deployments an epoch bump leaves the superseded
|
|
61
|
+
* rows at isActive=true, so the count runs high after any reconfiguration. `updatedAtBlock`
|
|
62
|
+
* and `createdAtBlock` exist purely so the caller can detect that ambiguity (any vouch
|
|
63
|
+
* older than the config's last update) and refuse to derive.
|
|
64
|
+
*
|
|
65
|
+
* `first: 1000` is the Graph page cap; callers treat a full page as "cannot derive"
|
|
66
|
+
* and fall back to RPC rather than silently under-counting.
|
|
67
|
+
*/
|
|
68
|
+
export declare const FETCH_VOUCH_STATUS = "\n query FetchVouchStatus($eligibilityModuleId: Bytes!, $hatId: BigInt!, $wearer: Bytes!) {\n vouchConfigs(\n where: { eligibilityModule: $eligibilityModuleId, hatId: $hatId }\n first: 1\n ) {\n id\n hatId\n quorum\n membershipHatId\n enabled\n combinesWithHierarchy\n updatedAtBlock\n }\n vouches(\n where: {\n eligibilityModule: $eligibilityModuleId\n hatId: $hatId\n wearer: $wearer\n isActive: true\n }\n first: 1000\n ) {\n id\n createdAtBlock\n }\n }\n";
|
|
69
|
+
/**
|
|
70
|
+
* Recent vouch activity for `pop vouch list` — display only, never a quorum decision.
|
|
71
|
+
*
|
|
72
|
+
* `isActive` IS THE EPOCH FILTER HERE. On deployments that index the epoch, the indexer
|
|
73
|
+
* flips isActive=false for every vouch a configureVouching/resetVouches/clearWearerVouches
|
|
74
|
+
* voided (recording invalidatedAt to keep that distinct from a voucher's own revokedAt),
|
|
75
|
+
* so this listing is epoch-correct with no extra field. On older deployments the
|
|
76
|
+
* superseded rows are still isActive and will be listed — stale rather than wrong, which
|
|
77
|
+
* is acceptable for a listing but NOT for the quorum maths in FETCH_VOUCH_STATUS above.
|
|
78
|
+
*/
|
|
79
|
+
export declare const FETCH_VOUCHES_FOR_ORG = "\n query FetchVouchesForOrg($eligibilityModuleId: Bytes!) {\n vouches(\n where: { eligibilityModule: $eligibilityModuleId, isActive: true }\n orderBy: createdAt\n orderDirection: desc\n first: 200\n ) {\n id\n hatId\n wearer\n wearerUsername\n voucher\n voucherUsername\n vouchCount\n isActive\n createdAt\n }\n }\n";
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Vouching Queries
|
|
4
|
+
* Ported from frontend queries.js
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.FETCH_VOUCHES_FOR_ORG = exports.FETCH_VOUCH_STATUS = exports.FETCH_VOUCH_STATUS_EPOCH_AWARE = exports.FETCH_VOUCH_CONFIG = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* Vouch config for one hat — the subgraph mirror of
|
|
10
|
+
* EligibilityModule.getVouchConfig(hatId) / vouchConfigs(hatId).
|
|
11
|
+
*
|
|
12
|
+
* Field population VERIFIED live (2026-07-30) on BOTH deployments:
|
|
13
|
+
* poa-gnosis-v-1 → quorum=1, membershipHatId=2908…, enabled=true,
|
|
14
|
+
* combinesWithHierarchy=true/false (both values present)
|
|
15
|
+
* poa-arb-v-1 → same fields, same shape
|
|
16
|
+
* so no field-fallback tier is required. Callers still degrade to the RPC
|
|
17
|
+
* getter on ANY error (including a hypothetical unknown-field validation
|
|
18
|
+
* failure on a self-hosted older deployment), which is the correct answer
|
|
19
|
+
* rather than a partially-filled one.
|
|
20
|
+
*
|
|
21
|
+
* A MISSING row is deliberately NOT treated as "vouching disabled": callers
|
|
22
|
+
* fall back to RPC, because absence is ambiguous between "no VouchConfigSet
|
|
23
|
+
* event was ever emitted" and "not indexed yet".
|
|
24
|
+
*/
|
|
25
|
+
exports.FETCH_VOUCH_CONFIG = `
|
|
26
|
+
query FetchVouchConfig($eligibilityModuleId: Bytes!, $hatId: BigInt!) {
|
|
27
|
+
vouchConfigs(
|
|
28
|
+
where: { eligibilityModule: $eligibilityModuleId, hatId: $hatId }
|
|
29
|
+
first: 1
|
|
30
|
+
) {
|
|
31
|
+
id
|
|
32
|
+
hatId
|
|
33
|
+
quorum
|
|
34
|
+
membershipHatId
|
|
35
|
+
enabled
|
|
36
|
+
combinesWithHierarchy
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
/**
|
|
41
|
+
* TIER 0 — vouch progress read off the subgraph's epoch mirror.
|
|
42
|
+
*
|
|
43
|
+
* EligibilityModule kills stale vouches by bumping an epoch counter rather than
|
|
44
|
+
* emitting a per-vouch invalidation:
|
|
45
|
+
*
|
|
46
|
+
* configureVouching / batchConfigureVouching / resetVouches → vouchConfigEpoch[hatId]++
|
|
47
|
+
* clearWearerVouches → wearerVouchEpoch = 2^256-1
|
|
48
|
+
*
|
|
49
|
+
* and `currentVouchCount(hatId, wearer)` returns 0 whenever the two disagree. The
|
|
50
|
+
* subgraph mirrors both counters onto WearerVouchState, so this tier reproduces the
|
|
51
|
+
* getter EXACTLY:
|
|
52
|
+
*
|
|
53
|
+
* currentCount = (state.epoch == config.epoch) ? state.count : 0
|
|
54
|
+
*
|
|
55
|
+
* No row counting, so no 1000-row page cap and no cross-epoch overcount.
|
|
56
|
+
*
|
|
57
|
+
* `effectiveCount` is the subgraph's own materialisation of that same expression. It
|
|
58
|
+
* is read only as a CONSISTENCY CHECK: the count+epoch comparison is self-correcting
|
|
59
|
+
* while effectiveCount depends on a sweep, so a disagreement means the deployment is
|
|
60
|
+
* buggy and the caller falls back to RPC rather than picking a winner.
|
|
61
|
+
*
|
|
62
|
+
* This tier fails GraphQL validation (unknown field `epoch`) on deployments predating
|
|
63
|
+
* the epoch indexing, which is what drops callers to FETCH_VOUCH_STATUS below.
|
|
64
|
+
*/
|
|
65
|
+
exports.FETCH_VOUCH_STATUS_EPOCH_AWARE = `
|
|
66
|
+
query FetchVouchStatusEpochAware($eligibilityModuleId: Bytes!, $hatId: BigInt!, $wearer: Bytes!) {
|
|
67
|
+
vouchConfigs(
|
|
68
|
+
where: { eligibilityModule: $eligibilityModuleId, hatId: $hatId }
|
|
69
|
+
first: 1
|
|
70
|
+
) {
|
|
71
|
+
id
|
|
72
|
+
hatId
|
|
73
|
+
quorum
|
|
74
|
+
membershipHatId
|
|
75
|
+
enabled
|
|
76
|
+
combinesWithHierarchy
|
|
77
|
+
epoch
|
|
78
|
+
}
|
|
79
|
+
wearerVouchStates(
|
|
80
|
+
where: {
|
|
81
|
+
eligibilityModule: $eligibilityModuleId
|
|
82
|
+
hatId: $hatId
|
|
83
|
+
wearer: $wearer
|
|
84
|
+
}
|
|
85
|
+
first: 1
|
|
86
|
+
) {
|
|
87
|
+
id
|
|
88
|
+
count
|
|
89
|
+
effectiveCount
|
|
90
|
+
epoch
|
|
91
|
+
cleared
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
`;
|
|
95
|
+
/**
|
|
96
|
+
* TIER 1 — legacy deployments with no epoch mirror.
|
|
97
|
+
*
|
|
98
|
+
* `vouches.length` approximates the on-chain currentVouchCount(hatId, wearer):
|
|
99
|
+
* EligibilityModule increments the counter in vouchFor (emits Vouched) and decrements
|
|
100
|
+
* it in revokeVouch (emits VouchRevoked), and the subgraph creates a Vouch on Vouched /
|
|
101
|
+
* flips isActive=false on VouchRevoked.
|
|
102
|
+
*
|
|
103
|
+
* VERIFIED live against Gnosis RPC on 5 real (hat, wearer) pairs, including three with
|
|
104
|
+
* a count of 2 — active-Vouch count matched currentVouchCount() exactly on all 5.
|
|
105
|
+
*
|
|
106
|
+
* It is only an APPROXIMATION: on these deployments an epoch bump leaves the superseded
|
|
107
|
+
* rows at isActive=true, so the count runs high after any reconfiguration. `updatedAtBlock`
|
|
108
|
+
* and `createdAtBlock` exist purely so the caller can detect that ambiguity (any vouch
|
|
109
|
+
* older than the config's last update) and refuse to derive.
|
|
110
|
+
*
|
|
111
|
+
* `first: 1000` is the Graph page cap; callers treat a full page as "cannot derive"
|
|
112
|
+
* and fall back to RPC rather than silently under-counting.
|
|
113
|
+
*/
|
|
114
|
+
exports.FETCH_VOUCH_STATUS = `
|
|
115
|
+
query FetchVouchStatus($eligibilityModuleId: Bytes!, $hatId: BigInt!, $wearer: Bytes!) {
|
|
116
|
+
vouchConfigs(
|
|
117
|
+
where: { eligibilityModule: $eligibilityModuleId, hatId: $hatId }
|
|
118
|
+
first: 1
|
|
119
|
+
) {
|
|
120
|
+
id
|
|
121
|
+
hatId
|
|
122
|
+
quorum
|
|
123
|
+
membershipHatId
|
|
124
|
+
enabled
|
|
125
|
+
combinesWithHierarchy
|
|
126
|
+
updatedAtBlock
|
|
127
|
+
}
|
|
128
|
+
vouches(
|
|
129
|
+
where: {
|
|
130
|
+
eligibilityModule: $eligibilityModuleId
|
|
131
|
+
hatId: $hatId
|
|
132
|
+
wearer: $wearer
|
|
133
|
+
isActive: true
|
|
134
|
+
}
|
|
135
|
+
first: 1000
|
|
136
|
+
) {
|
|
137
|
+
id
|
|
138
|
+
createdAtBlock
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
`;
|
|
142
|
+
/**
|
|
143
|
+
* Recent vouch activity for `pop vouch list` — display only, never a quorum decision.
|
|
144
|
+
*
|
|
145
|
+
* `isActive` IS THE EPOCH FILTER HERE. On deployments that index the epoch, the indexer
|
|
146
|
+
* flips isActive=false for every vouch a configureVouching/resetVouches/clearWearerVouches
|
|
147
|
+
* voided (recording invalidatedAt to keep that distinct from a voucher's own revokedAt),
|
|
148
|
+
* so this listing is epoch-correct with no extra field. On older deployments the
|
|
149
|
+
* superseded rows are still isActive and will be listed — stale rather than wrong, which
|
|
150
|
+
* is acceptable for a listing but NOT for the quorum maths in FETCH_VOUCH_STATUS above.
|
|
151
|
+
*/
|
|
152
|
+
exports.FETCH_VOUCHES_FOR_ORG = `
|
|
153
|
+
query FetchVouchesForOrg($eligibilityModuleId: Bytes!) {
|
|
154
|
+
vouches(
|
|
155
|
+
where: { eligibilityModule: $eligibilityModuleId, isActive: true }
|
|
156
|
+
orderBy: createdAt
|
|
157
|
+
orderDirection: desc
|
|
158
|
+
first: 200
|
|
159
|
+
) {
|
|
160
|
+
id
|
|
161
|
+
hatId
|
|
162
|
+
wearer
|
|
163
|
+
wearerUsername
|
|
164
|
+
voucher
|
|
165
|
+
voucherUsername
|
|
166
|
+
vouchCount
|
|
167
|
+
isActive
|
|
168
|
+
createdAt
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
`;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ZkEmailInvites Queries
|
|
3
|
+
*
|
|
4
|
+
* The ZK Email role-invite module is optional per org: `organization.zkEmailInvites` is null
|
|
5
|
+
* for orgs deployed without it. A module with `activeRoot == null` is deployed but dormant —
|
|
6
|
+
* every claim reverts until governance sets an allowlist.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Full module read, including the fields added by subgraph-pop #197: the module wiring
|
|
10
|
+
* (executor + verifiers + registries) and the DKIM keys the trusted registry holds.
|
|
11
|
+
*
|
|
12
|
+
* Every one of those replaces an RPC call the CLI used to make — six eth_calls for the wiring
|
|
13
|
+
* and a full-range eth_getLogs scan for the DKIM keys. Until #197 is deployed the whole
|
|
14
|
+
* document fails validation, so callers must go through FETCH_ZKEMAIL_MODULE_TIERS rather than
|
|
15
|
+
* issuing this directly.
|
|
16
|
+
*/
|
|
17
|
+
export declare const FETCH_ZKEMAIL_MODULE = "\n query FetchZkEmailModule($orgId: Bytes!) {\n organization(id: $orgId) {\n id\n name\n zkEmailInvites {\n id\n activeRoot\n activeAllowlistCid\n executor\n domainVerifier\n emailVerifier\n accountRegistry\n universalFactory\n claimCount\n dkimRegistry {\n id\n owner\n keys(first: 1000) {\n id\n domainHash\n keyHash\n valid\n validUntil\n revokedAt\n }\n }\n activeAllowlist {\n id\n root\n indexedAt\n entries(orderBy: index, orderDirection: asc, first: 1000) {\n id\n index\n entryType\n identifier\n identifierHash\n hatIds\n roleIndexes\n }\n }\n }\n }\n }\n";
|
|
18
|
+
/**
|
|
19
|
+
* The pre-#197 field set: allowlist only, no wiring and no DKIM registry.
|
|
20
|
+
*
|
|
21
|
+
* Derived from the modern query by deletion so the two cannot drift. A GraphQL document is
|
|
22
|
+
* validated as a whole, so a single unknown field fails the entire request — without this tier
|
|
23
|
+
* every `pop zkemail` command would break against a subgraph that has not been redeployed yet.
|
|
24
|
+
*/
|
|
25
|
+
export declare const FETCH_ZKEMAIL_MODULE_LEGACY: string;
|
|
26
|
+
/** Modern tier first, pre-#197 tier as the fallback. */
|
|
27
|
+
export declare const FETCH_ZKEMAIL_MODULE_TIERS: string[];
|
|
28
|
+
/**
|
|
29
|
+
* Has this specific address already consumed its specific-address invite?
|
|
30
|
+
*
|
|
31
|
+
* Replaces an `isEmailRegistered` eth_call. Only meaningful post-#197; callers fall back to the
|
|
32
|
+
* contract when the entity is absent.
|
|
33
|
+
*/
|
|
34
|
+
export declare const FETCH_ZKEMAIL_REGISTERED_EMAIL = "\n query FetchZkEmailRegisteredEmail($id: ID!) {\n zkEmailRegisteredEmail(id: $id) {\n id\n registered\n claimer\n claimedAt\n clearedAt\n }\n }\n";
|
|
35
|
+
/**
|
|
36
|
+
* Resolve role hat IDs to human names so an allowlist can be shown as
|
|
37
|
+
* "gmail.com -> Member" instead of a raw uint256.
|
|
38
|
+
*/
|
|
39
|
+
export declare const FETCH_ORG_ROLE_NAMES = "\n query FetchOrgRoleNames($orgId: Bytes!) {\n organization(id: $orgId) {\n id\n roles {\n id\n hatId\n name\n isUserRole\n canVote\n }\n }\n }\n";
|
|
40
|
+
/**
|
|
41
|
+
* Claim history for a module (subgraph-pop #197).
|
|
42
|
+
*
|
|
43
|
+
* Two things to know when rendering these:
|
|
44
|
+
* - `nullifier` is null for the passkey onboarding variants (RegisteredAndClaimed*), which do
|
|
45
|
+
* not emit it. On the live Gnosis module that is most claims, so absence is normal.
|
|
46
|
+
* - `identifierHash` is the allowlist leaf id the claim used, which may belong to a SUPERSEDED
|
|
47
|
+
* allowlist. Resolve it against the active entries opportunistically, never assume it hits.
|
|
48
|
+
*/
|
|
49
|
+
export declare const FETCH_ZKEMAIL_CLAIMS = "\n query FetchZkEmailClaims($module: String!, $first: Int!) {\n zkEmailClaims(\n where: { module: $module }\n orderBy: claimedAt\n orderDirection: desc\n first: $first\n ) {\n id\n kind\n claimer\n claimerUsername\n identifierHash\n hatIds\n nullifier\n registeredUsername\n claimedAt\n claimedAtBlock\n transactionHash\n }\n }\n";
|
|
50
|
+
/**
|
|
51
|
+
* Just the committed allowlist pointer for an org's module.
|
|
52
|
+
*
|
|
53
|
+
* `activeRoot`/`activeAllowlistCid` are the two fields that exist on BOTH deployed schemas —
|
|
54
|
+
* Gnosis (post-#197) and Arbitrum (pre-#197, where ZkEmailInvites is only
|
|
55
|
+
* {id, organization, activeRoot, activeAllowlistCid, activeAllowlist, createdAt, lastUpdatedAt})
|
|
56
|
+
* — so this needs no queryWithFieldFallback tier. Verified populated on live Gnosis:
|
|
57
|
+
* activeRoot = 0x1d5d75df3ee05a0a90c42f0fe423f3c063dedf3466378e45a8343bfef18ebc46.
|
|
58
|
+
*
|
|
59
|
+
* A null `activeRoot` on a module row that EXISTS means dormant (no allowlist committed yet),
|
|
60
|
+
* which is the same thing the contract reports as merkleRoot() == 0. A missing row means "not
|
|
61
|
+
* indexed" and callers must fall back to the contract.
|
|
62
|
+
*/
|
|
63
|
+
export declare const FETCH_ZKEMAIL_ACTIVE_ROOT = "\n query FetchZkEmailActiveRoot($orgId: Bytes!) {\n organization(id: $orgId) {\n id\n zkEmailInvites {\n id\n activeRoot\n activeAllowlistCid\n }\n }\n }\n";
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ZkEmailInvites Queries
|
|
4
|
+
*
|
|
5
|
+
* The ZK Email role-invite module is optional per org: `organization.zkEmailInvites` is null
|
|
6
|
+
* for orgs deployed without it. A module with `activeRoot == null` is deployed but dormant —
|
|
7
|
+
* every claim reverts until governance sets an allowlist.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.FETCH_ZKEMAIL_ACTIVE_ROOT = exports.FETCH_ZKEMAIL_CLAIMS = exports.FETCH_ORG_ROLE_NAMES = exports.FETCH_ZKEMAIL_REGISTERED_EMAIL = exports.FETCH_ZKEMAIL_MODULE_TIERS = exports.FETCH_ZKEMAIL_MODULE_LEGACY = exports.FETCH_ZKEMAIL_MODULE = void 0;
|
|
11
|
+
/**
|
|
12
|
+
* Full module read, including the fields added by subgraph-pop #197: the module wiring
|
|
13
|
+
* (executor + verifiers + registries) and the DKIM keys the trusted registry holds.
|
|
14
|
+
*
|
|
15
|
+
* Every one of those replaces an RPC call the CLI used to make — six eth_calls for the wiring
|
|
16
|
+
* and a full-range eth_getLogs scan for the DKIM keys. Until #197 is deployed the whole
|
|
17
|
+
* document fails validation, so callers must go through FETCH_ZKEMAIL_MODULE_TIERS rather than
|
|
18
|
+
* issuing this directly.
|
|
19
|
+
*/
|
|
20
|
+
exports.FETCH_ZKEMAIL_MODULE = `
|
|
21
|
+
query FetchZkEmailModule($orgId: Bytes!) {
|
|
22
|
+
organization(id: $orgId) {
|
|
23
|
+
id
|
|
24
|
+
name
|
|
25
|
+
zkEmailInvites {
|
|
26
|
+
id
|
|
27
|
+
activeRoot
|
|
28
|
+
activeAllowlistCid
|
|
29
|
+
executor
|
|
30
|
+
domainVerifier
|
|
31
|
+
emailVerifier
|
|
32
|
+
accountRegistry
|
|
33
|
+
universalFactory
|
|
34
|
+
claimCount
|
|
35
|
+
dkimRegistry {
|
|
36
|
+
id
|
|
37
|
+
owner
|
|
38
|
+
keys(first: 1000) {
|
|
39
|
+
id
|
|
40
|
+
domainHash
|
|
41
|
+
keyHash
|
|
42
|
+
valid
|
|
43
|
+
validUntil
|
|
44
|
+
revokedAt
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
activeAllowlist {
|
|
48
|
+
id
|
|
49
|
+
root
|
|
50
|
+
indexedAt
|
|
51
|
+
entries(orderBy: index, orderDirection: asc, first: 1000) {
|
|
52
|
+
id
|
|
53
|
+
index
|
|
54
|
+
entryType
|
|
55
|
+
identifier
|
|
56
|
+
identifierHash
|
|
57
|
+
hatIds
|
|
58
|
+
roleIndexes
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
65
|
+
/**
|
|
66
|
+
* The pre-#197 field set: allowlist only, no wiring and no DKIM registry.
|
|
67
|
+
*
|
|
68
|
+
* Derived from the modern query by deletion so the two cannot drift. A GraphQL document is
|
|
69
|
+
* validated as a whole, so a single unknown field fails the entire request — without this tier
|
|
70
|
+
* every `pop zkemail` command would break against a subgraph that has not been redeployed yet.
|
|
71
|
+
*/
|
|
72
|
+
exports.FETCH_ZKEMAIL_MODULE_LEGACY = (() => {
|
|
73
|
+
const lines = exports.FETCH_ZKEMAIL_MODULE.split('\n');
|
|
74
|
+
const out = [];
|
|
75
|
+
let skipDepth = 0;
|
|
76
|
+
for (const line of lines) {
|
|
77
|
+
const t = line.trim();
|
|
78
|
+
if (skipDepth > 0) {
|
|
79
|
+
// Inside the dkimRegistry block: track braces until it closes.
|
|
80
|
+
if (t.endsWith('{'))
|
|
81
|
+
skipDepth++;
|
|
82
|
+
else if (t === '}')
|
|
83
|
+
skipDepth--;
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if (t === 'dkimRegistry {') {
|
|
87
|
+
skipDepth = 1;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (/^(executor|domainVerifier|emailVerifier|accountRegistry|universalFactory|claimCount)$/.test(t))
|
|
91
|
+
continue;
|
|
92
|
+
out.push(line);
|
|
93
|
+
}
|
|
94
|
+
return out.join('\n');
|
|
95
|
+
})();
|
|
96
|
+
/** Modern tier first, pre-#197 tier as the fallback. */
|
|
97
|
+
exports.FETCH_ZKEMAIL_MODULE_TIERS = [exports.FETCH_ZKEMAIL_MODULE, exports.FETCH_ZKEMAIL_MODULE_LEGACY];
|
|
98
|
+
/**
|
|
99
|
+
* Has this specific address already consumed its specific-address invite?
|
|
100
|
+
*
|
|
101
|
+
* Replaces an `isEmailRegistered` eth_call. Only meaningful post-#197; callers fall back to the
|
|
102
|
+
* contract when the entity is absent.
|
|
103
|
+
*/
|
|
104
|
+
exports.FETCH_ZKEMAIL_REGISTERED_EMAIL = `
|
|
105
|
+
query FetchZkEmailRegisteredEmail($id: ID!) {
|
|
106
|
+
zkEmailRegisteredEmail(id: $id) {
|
|
107
|
+
id
|
|
108
|
+
registered
|
|
109
|
+
claimer
|
|
110
|
+
claimedAt
|
|
111
|
+
clearedAt
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
`;
|
|
115
|
+
/**
|
|
116
|
+
* Resolve role hat IDs to human names so an allowlist can be shown as
|
|
117
|
+
* "gmail.com -> Member" instead of a raw uint256.
|
|
118
|
+
*/
|
|
119
|
+
exports.FETCH_ORG_ROLE_NAMES = `
|
|
120
|
+
query FetchOrgRoleNames($orgId: Bytes!) {
|
|
121
|
+
organization(id: $orgId) {
|
|
122
|
+
id
|
|
123
|
+
roles {
|
|
124
|
+
id
|
|
125
|
+
hatId
|
|
126
|
+
name
|
|
127
|
+
isUserRole
|
|
128
|
+
canVote
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
`;
|
|
133
|
+
/**
|
|
134
|
+
* Claim history for a module (subgraph-pop #197).
|
|
135
|
+
*
|
|
136
|
+
* Two things to know when rendering these:
|
|
137
|
+
* - `nullifier` is null for the passkey onboarding variants (RegisteredAndClaimed*), which do
|
|
138
|
+
* not emit it. On the live Gnosis module that is most claims, so absence is normal.
|
|
139
|
+
* - `identifierHash` is the allowlist leaf id the claim used, which may belong to a SUPERSEDED
|
|
140
|
+
* allowlist. Resolve it against the active entries opportunistically, never assume it hits.
|
|
141
|
+
*/
|
|
142
|
+
exports.FETCH_ZKEMAIL_CLAIMS = `
|
|
143
|
+
query FetchZkEmailClaims($module: String!, $first: Int!) {
|
|
144
|
+
zkEmailClaims(
|
|
145
|
+
where: { module: $module }
|
|
146
|
+
orderBy: claimedAt
|
|
147
|
+
orderDirection: desc
|
|
148
|
+
first: $first
|
|
149
|
+
) {
|
|
150
|
+
id
|
|
151
|
+
kind
|
|
152
|
+
claimer
|
|
153
|
+
claimerUsername
|
|
154
|
+
identifierHash
|
|
155
|
+
hatIds
|
|
156
|
+
nullifier
|
|
157
|
+
registeredUsername
|
|
158
|
+
claimedAt
|
|
159
|
+
claimedAtBlock
|
|
160
|
+
transactionHash
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
`;
|
|
164
|
+
/**
|
|
165
|
+
* Just the committed allowlist pointer for an org's module.
|
|
166
|
+
*
|
|
167
|
+
* `activeRoot`/`activeAllowlistCid` are the two fields that exist on BOTH deployed schemas —
|
|
168
|
+
* Gnosis (post-#197) and Arbitrum (pre-#197, where ZkEmailInvites is only
|
|
169
|
+
* {id, organization, activeRoot, activeAllowlistCid, activeAllowlist, createdAt, lastUpdatedAt})
|
|
170
|
+
* — so this needs no queryWithFieldFallback tier. Verified populated on live Gnosis:
|
|
171
|
+
* activeRoot = 0x1d5d75df3ee05a0a90c42f0fe423f3c063dedf3466378e45a8343bfef18ebc46.
|
|
172
|
+
*
|
|
173
|
+
* A null `activeRoot` on a module row that EXISTS means dormant (no allowlist committed yet),
|
|
174
|
+
* which is the same thing the contract reports as merkleRoot() == 0. A missing row means "not
|
|
175
|
+
* indexed" and callers must fall back to the contract.
|
|
176
|
+
*/
|
|
177
|
+
exports.FETCH_ZKEMAIL_ACTIVE_ROOT = `
|
|
178
|
+
query FetchZkEmailActiveRoot($orgId: Bytes!) {
|
|
179
|
+
organization(id: $orgId) {
|
|
180
|
+
id
|
|
181
|
+
zkEmailInvites {
|
|
182
|
+
id
|
|
183
|
+
activeRoot
|
|
184
|
+
activeAllowlistCid
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
`;
|