@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.
Files changed (220) hide show
  1. package/README.md +201 -0
  2. package/dist/abis/DirectDemocracyVotingNew.d.ts +749 -0
  3. package/dist/abis/DirectDemocracyVotingNew.js +961 -0
  4. package/dist/abis/ERC20.d.ts +90 -0
  5. package/dist/abis/ERC20.js +125 -0
  6. package/dist/abis/EducationHubNew.d.ts +590 -0
  7. package/dist/abis/EducationHubNew.js +762 -0
  8. package/dist/abis/EligibilityModuleNew.d.ts +1615 -0
  9. package/dist/abis/EligibilityModuleNew.js +2082 -0
  10. package/dist/abis/Executor.d.ts +619 -0
  11. package/dist/abis/Executor.js +796 -0
  12. package/dist/abis/HybridVotingNew.d.ts +898 -0
  13. package/dist/abis/HybridVotingNew.js +1149 -0
  14. package/dist/abis/ImplementationRegistry.d.ts +270 -0
  15. package/dist/abis/ImplementationRegistry.js +355 -0
  16. package/dist/abis/OrgDeployerNew.d.ts +1275 -0
  17. package/dist/abis/OrgDeployerNew.js +1630 -0
  18. package/dist/abis/OrgRegistry.d.ts +670 -0
  19. package/dist/abis/OrgRegistry.js +868 -0
  20. package/dist/abis/ParticipationToken.d.ts +1086 -0
  21. package/dist/abis/ParticipationToken.js +1415 -0
  22. package/dist/abis/PasskeyAccount.d.ts +788 -0
  23. package/dist/abis/PasskeyAccount.js +1019 -0
  24. package/dist/abis/PasskeyAccountFactory.d.ts +344 -0
  25. package/dist/abis/PasskeyAccountFactory.js +449 -0
  26. package/dist/abis/PaymasterHub.d.ts +1603 -0
  27. package/dist/abis/PaymasterHub.js +2048 -0
  28. package/dist/abis/PaymentManager.d.ts +520 -0
  29. package/dist/abis/PaymentManager.js +671 -0
  30. package/dist/abis/PoaManager.d.ts +344 -0
  31. package/dist/abis/PoaManager.js +449 -0
  32. package/dist/abis/QuickJoinNew.d.ts +855 -0
  33. package/dist/abis/QuickJoinNew.js +1098 -0
  34. package/dist/abis/TaskManagerNew.d.ts +1236 -0
  35. package/dist/abis/TaskManagerNew.js +1573 -0
  36. package/dist/abis/ToggleModule.d.ts +193 -0
  37. package/dist/abis/ToggleModule.js +255 -0
  38. package/dist/abis/UniversalAccountRegistry.d.ts +577 -0
  39. package/dist/abis/UniversalAccountRegistry.js +750 -0
  40. package/dist/abis/ZkEmailInvites.d.ts +823 -0
  41. package/dist/abis/ZkEmailInvites.js +1060 -0
  42. package/dist/abis/external/AaveGovernanceV2.d.ts +128 -0
  43. package/dist/abis/external/AaveGovernanceV2.js +177 -0
  44. package/dist/abis/external/AaveGovernanceV3.d.ts +160 -0
  45. package/dist/abis/external/AaveGovernanceV3.js +220 -0
  46. package/dist/abis/external/AragonVoting.d.ts +107 -0
  47. package/dist/abis/external/AragonVoting.js +150 -0
  48. package/dist/abis/external/CurveGaugeController.d.ts +95 -0
  49. package/dist/abis/external/CurveGaugeController.js +130 -0
  50. package/dist/abis/external/CurveVotingEscrow.d.ts +86 -0
  51. package/dist/abis/external/CurveVotingEscrow.js +116 -0
  52. package/dist/abis/external/GovernorAlpha.d.ts +172 -0
  53. package/dist/abis/external/GovernorAlpha.js +228 -0
  54. package/dist/abis/external/MakerDAOChief.d.ts +92 -0
  55. package/dist/abis/external/MakerDAOChief.js +129 -0
  56. package/dist/abis/external/OZGovernor.d.ts +227 -0
  57. package/dist/abis/external/OZGovernor.js +317 -0
  58. package/dist/abis/external/SolidlyVotingEscrow.d.ts +196 -0
  59. package/dist/abis/external/SolidlyVotingEscrow.js +260 -0
  60. package/dist/abis/index.d.ts +62 -0
  61. package/dist/abis/index.js +98 -0
  62. package/dist/chains.d.ts +150 -0
  63. package/dist/chains.js +320 -0
  64. package/dist/context.d.ts +48 -0
  65. package/dist/context.js +38 -0
  66. package/dist/contracts.d.ts +24 -0
  67. package/dist/contracts.js +41 -0
  68. package/dist/encoding.d.ts +58 -0
  69. package/dist/encoding.js +243 -0
  70. package/dist/env.d.ts +10 -0
  71. package/dist/env.js +4 -0
  72. package/dist/error-catalog.d.ts +41 -0
  73. package/dist/error-catalog.js +941 -0
  74. package/dist/errors.d.ts +27 -0
  75. package/dist/errors.js +60 -0
  76. package/dist/execute/ethers.d.ts +93 -0
  77. package/dist/execute/ethers.js +323 -0
  78. package/dist/execute/index.d.ts +7 -0
  79. package/dist/execute/index.js +23 -0
  80. package/dist/execute/sponsored.d.ts +68 -0
  81. package/dist/execute/sponsored.js +277 -0
  82. package/dist/exit-codes.d.ts +18 -0
  83. package/dist/exit-codes.js +21 -0
  84. package/dist/format.d.ts +21 -0
  85. package/dist/format.js +89 -0
  86. package/dist/graph/client.d.ts +298 -0
  87. package/dist/graph/client.js +702 -0
  88. package/dist/graph/documents/activity.d.ts +9 -0
  89. package/dist/graph/documents/activity.js +164 -0
  90. package/dist/graph/documents/beacons.d.ts +172 -0
  91. package/dist/graph/documents/beacons.js +345 -0
  92. package/dist/graph/documents/index.d.ts +21 -0
  93. package/dist/graph/documents/index.js +57 -0
  94. package/dist/graph/documents/infrastructure.d.ts +30 -0
  95. package/dist/graph/documents/infrastructure.js +34 -0
  96. package/dist/graph/documents/org.d.ts +15 -0
  97. package/dist/graph/documents/org.js +249 -0
  98. package/dist/graph/documents/paymaster.d.ts +95 -0
  99. package/dist/graph/documents/paymaster.js +101 -0
  100. package/dist/graph/documents/role.d.ts +6 -0
  101. package/dist/graph/documents/role.js +41 -0
  102. package/dist/graph/documents/roles.d.ts +50 -0
  103. package/dist/graph/documents/roles.js +112 -0
  104. package/dist/graph/documents/task.d.ts +84 -0
  105. package/dist/graph/documents/task.js +236 -0
  106. package/dist/graph/documents/token.d.ts +13 -0
  107. package/dist/graph/documents/token.js +126 -0
  108. package/dist/graph/documents/treasury.d.ts +39 -0
  109. package/dist/graph/documents/treasury.js +136 -0
  110. package/dist/graph/documents/user.d.ts +120 -0
  111. package/dist/graph/documents/user.js +302 -0
  112. package/dist/graph/documents/voting-classes.d.ts +69 -0
  113. package/dist/graph/documents/voting-classes.js +149 -0
  114. package/dist/graph/documents/voting.d.ts +28 -0
  115. package/dist/graph/documents/voting.js +163 -0
  116. package/dist/graph/documents/vouch.d.ts +79 -0
  117. package/dist/graph/documents/vouch.js +171 -0
  118. package/dist/graph/documents/zkemail.d.ts +63 -0
  119. package/dist/graph/documents/zkemail.js +188 -0
  120. package/dist/graph/index.d.ts +2 -0
  121. package/dist/graph/index.js +41 -0
  122. package/dist/index.d.ts +49 -0
  123. package/dist/index.js +92 -0
  124. package/dist/ipfs.d.ts +39 -0
  125. package/dist/ipfs.js +214 -0
  126. package/dist/label-aliases.d.ts +31 -0
  127. package/dist/label-aliases.js +70 -0
  128. package/dist/metadata/education.d.ts +30 -0
  129. package/dist/metadata/education.js +31 -0
  130. package/dist/metadata/index.d.ts +12 -0
  131. package/dist/metadata/index.js +48 -0
  132. package/dist/metadata/org.d.ts +92 -0
  133. package/dist/metadata/org.js +93 -0
  134. package/dist/metadata/proposal.d.ts +44 -0
  135. package/dist/metadata/proposal.js +45 -0
  136. package/dist/metadata/role.d.ts +38 -0
  137. package/dist/metadata/role.js +35 -0
  138. package/dist/metadata/task.d.ts +108 -0
  139. package/dist/metadata/task.js +81 -0
  140. package/dist/metadata/token.d.ts +32 -0
  141. package/dist/metadata/token.js +36 -0
  142. package/dist/metadata/user.d.ts +63 -0
  143. package/dist/metadata/user.js +70 -0
  144. package/dist/multicall.d.ts +32 -0
  145. package/dist/multicall.js +96 -0
  146. package/dist/payout.d.ts +59 -0
  147. package/dist/payout.js +96 -0
  148. package/dist/perms.d.ts +47 -0
  149. package/dist/perms.js +120 -0
  150. package/dist/preflight.d.ts +72 -0
  151. package/dist/preflight.js +269 -0
  152. package/dist/reads/education.d.ts +79 -0
  153. package/dist/reads/education.js +122 -0
  154. package/dist/reads/eligibility.d.ts +377 -0
  155. package/dist/reads/eligibility.js +687 -0
  156. package/dist/reads/index.d.ts +16 -0
  157. package/dist/reads/index.js +55 -0
  158. package/dist/reads/org.d.ts +258 -0
  159. package/dist/reads/org.js +220 -0
  160. package/dist/reads/paymaster.d.ts +147 -0
  161. package/dist/reads/paymaster.js +235 -0
  162. package/dist/reads/project.d.ts +33 -0
  163. package/dist/reads/project.js +62 -0
  164. package/dist/reads/resolve.d.ts +34 -0
  165. package/dist/reads/resolve.js +64 -0
  166. package/dist/reads/task.d.ts +286 -0
  167. package/dist/reads/task.js +280 -0
  168. package/dist/reads/token.d.ts +94 -0
  169. package/dist/reads/token.js +75 -0
  170. package/dist/reads/treasury.d.ts +222 -0
  171. package/dist/reads/treasury.js +241 -0
  172. package/dist/reads/user.d.ts +229 -0
  173. package/dist/reads/user.js +155 -0
  174. package/dist/reads/vote.d.ts +296 -0
  175. package/dist/reads/vote.js +392 -0
  176. package/dist/reads/zkemail.d.ts +117 -0
  177. package/dist/reads/zkemail.js +217 -0
  178. package/dist/similarity.d.ts +36 -0
  179. package/dist/similarity.js +67 -0
  180. package/dist/sponsorship-config.d.ts +47 -0
  181. package/dist/sponsorship-config.js +41 -0
  182. package/dist/stats.d.ts +11 -0
  183. package/dist/stats.js +27 -0
  184. package/dist/task-lens.d.ts +113 -0
  185. package/dist/task-lens.js +210 -0
  186. package/dist/tx/education.d.ts +169 -0
  187. package/dist/tx/education.js +344 -0
  188. package/dist/tx/eligibility.d.ts +511 -0
  189. package/dist/tx/eligibility.js +818 -0
  190. package/dist/tx/governance.d.ts +85 -0
  191. package/dist/tx/governance.js +87 -0
  192. package/dist/tx/index.d.ts +17 -0
  193. package/dist/tx/index.js +56 -0
  194. package/dist/tx/intent.d.ts +67 -0
  195. package/dist/tx/intent.js +48 -0
  196. package/dist/tx/org.d.ts +321 -0
  197. package/dist/tx/org.js +544 -0
  198. package/dist/tx/paymaster.d.ts +140 -0
  199. package/dist/tx/paymaster.js +251 -0
  200. package/dist/tx/project.d.ts +146 -0
  201. package/dist/tx/project.js +217 -0
  202. package/dist/tx/task.d.ts +480 -0
  203. package/dist/tx/task.js +1149 -0
  204. package/dist/tx/token.d.ts +96 -0
  205. package/dist/tx/token.js +165 -0
  206. package/dist/tx/treasury.d.ts +474 -0
  207. package/dist/tx/treasury.js +911 -0
  208. package/dist/tx/user.d.ts +177 -0
  209. package/dist/tx/user.js +292 -0
  210. package/dist/tx/vote.d.ts +332 -0
  211. package/dist/tx/vote.js +762 -0
  212. package/dist/tx/zkemail.d.ts +90 -0
  213. package/dist/tx/zkemail.js +210 -0
  214. package/dist/validation.d.ts +8 -0
  215. package/dist/validation.js +39 -0
  216. package/dist/version.d.ts +142 -0
  217. package/dist/version.js +257 -0
  218. package/dist/zkemail.d.ts +161 -0
  219. package/dist/zkemail.js +299 -0
  220. package/package.json +130 -0
@@ -0,0 +1,249 @@
1
+ "use strict";
2
+ /**
3
+ * Organization Queries
4
+ * Ported from frontend queries.js
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.FETCH_ORG_PAYOUT_CONFIG = exports.FETCH_USER_ORGANIZATIONS = exports.GET_ORG_BY_NAME = exports.FETCH_ORG_FULL_DATA = exports.FETCH_ORG_BY_ID = void 0;
8
+ exports.FETCH_ORG_BY_ID = `
9
+ query FetchOrgById($id: Bytes!) {
10
+ organization(id: $id) {
11
+ id
12
+ name
13
+ metadataHash
14
+ deployedAt
15
+ topHatId
16
+ roleHatIds
17
+ participationToken {
18
+ id
19
+ name
20
+ symbol
21
+ totalSupply
22
+ }
23
+ quickJoin {
24
+ id
25
+ }
26
+ hybridVoting {
27
+ id
28
+ thresholdPct
29
+ quorum
30
+ }
31
+ directDemocracyVoting {
32
+ id
33
+ thresholdPct
34
+ quorum
35
+ }
36
+ taskManager {
37
+ id
38
+ projects {
39
+ id
40
+ title
41
+ deleted
42
+ }
43
+ }
44
+ educationHub {
45
+ id
46
+ nextModuleId
47
+ }
48
+ executorContract {
49
+ id
50
+ }
51
+ eligibilityModule {
52
+ id
53
+ }
54
+ paymentManager {
55
+ id
56
+ }
57
+ zkEmailInvites {
58
+ id
59
+ }
60
+ users {
61
+ id
62
+ address
63
+ account {
64
+ username
65
+ metadata {
66
+ avatar
67
+ }
68
+ }
69
+ participationTokenBalance
70
+ membershipStatus
71
+ currentHatIds
72
+ }
73
+ roles(where: { isUserRole: true }) {
74
+ id
75
+ hatId
76
+ name
77
+ image
78
+ canVote
79
+ isUserRole
80
+ }
81
+ }
82
+ }
83
+ `;
84
+ exports.FETCH_ORG_FULL_DATA = `
85
+ query FetchOrgFullData($orgId: Bytes!) {
86
+ organization(id: $orgId) {
87
+ id
88
+ name
89
+ metadataHash
90
+ metadataAdminHatId
91
+ metadata {
92
+ id
93
+ description
94
+ template
95
+ backgroundColor
96
+ logo
97
+ hideTreasury
98
+ useTokenSymbol
99
+ taskPayoutHoursOnly
100
+ taskPayoutHourlyRate
101
+ links {
102
+ name
103
+ url
104
+ index
105
+ }
106
+ }
107
+ deployedAt
108
+ topHatId
109
+ roleHatIds
110
+ participationToken {
111
+ id
112
+ name
113
+ symbol
114
+ totalSupply
115
+ }
116
+ quickJoin {
117
+ id
118
+ }
119
+ hybridVoting {
120
+ id
121
+ thresholdPct
122
+ quorum
123
+ }
124
+ directDemocracyVoting {
125
+ id
126
+ thresholdPct
127
+ quorum
128
+ }
129
+ zkEmailInvites {
130
+ id
131
+ }
132
+ taskManager {
133
+ id
134
+ creatorHatIds
135
+ projects(where: { deleted: false }, first: 100) {
136
+ id
137
+ tasks(first: 1000) {
138
+ id
139
+ status
140
+ }
141
+ }
142
+ }
143
+ educationHub {
144
+ id
145
+ modules {
146
+ id
147
+ moduleId
148
+ title
149
+ contentHash
150
+ metadata {
151
+ description
152
+ link
153
+ quiz
154
+ answersJson
155
+ }
156
+ payout
157
+ status
158
+ completions {
159
+ learner
160
+ }
161
+ }
162
+ }
163
+ executorContract {
164
+ id
165
+ }
166
+ eligibilityModule {
167
+ id
168
+ }
169
+ paymentManager {
170
+ id
171
+ }
172
+ users(orderBy: participationTokenBalance, orderDirection: desc, first: 100) {
173
+ id
174
+ address
175
+ account {
176
+ username
177
+ metadata {
178
+ avatar
179
+ }
180
+ }
181
+ participationTokenBalance
182
+ membershipStatus
183
+ currentHatIds
184
+ totalTasksCompleted
185
+ totalVotes
186
+ firstSeenAt
187
+ }
188
+ roles(where: { isUserRole: true }) {
189
+ id
190
+ hatId
191
+ name
192
+ image
193
+ canVote
194
+ isUserRole
195
+ hat {
196
+ name
197
+ }
198
+ }
199
+ }
200
+ }
201
+ `;
202
+ exports.GET_ORG_BY_NAME = `
203
+ query GetOrgByName($name: String!) {
204
+ organizations(where: { name: $name }, first: 1) {
205
+ id
206
+ name
207
+ }
208
+ }
209
+ `;
210
+ exports.FETCH_USER_ORGANIZATIONS = `
211
+ query FetchUserOrganizations($userAddress: Bytes!) {
212
+ users(where: { address: $userAddress, membershipStatus: Active }) {
213
+ id
214
+ membershipStatus
215
+ participationTokenBalance
216
+ totalTasksCompleted
217
+ totalVotes
218
+ organization {
219
+ id
220
+ name
221
+ metadataHash
222
+ participationToken {
223
+ symbol
224
+ }
225
+ }
226
+ }
227
+ }
228
+ `;
229
+ /**
230
+ * Just the org's payout convention + token symbol.
231
+ *
232
+ * Deliberately narrow: `pop task create` needs it on every invocation to price a task the way
233
+ * the web app would, and FETCH_ORG_FULL_DATA pulls every user, role, task and proposal.
234
+ */
235
+ exports.FETCH_ORG_PAYOUT_CONFIG = `
236
+ query FetchOrgPayoutConfig($orgId: Bytes!) {
237
+ organization(id: $orgId) {
238
+ id
239
+ metadata {
240
+ useTokenSymbol
241
+ taskPayoutHoursOnly
242
+ taskPayoutHourlyRate
243
+ }
244
+ participationToken {
245
+ symbol
246
+ }
247
+ }
248
+ }
249
+ `;
@@ -0,0 +1,95 @@
1
+ /**
2
+ * PaymasterHub Queries
3
+ *
4
+ * Everything here was verified field-by-field against BOTH live deployments
5
+ * (poa-gnosis-v-1 hub 0xdef1…4108, poa-arb-v-1 hub 0xd665…8a11) by comparing the
6
+ * indexed value to the same value read straight off the contract. Only the
7
+ * fields that matched EXACTLY are requested:
8
+ *
9
+ * entryPoint == PaymasterHub.ENTRY_POINT() (both chains)
10
+ * adminHatId/operatorHatId/isPaused/registeredAt/isBannedFromSolidarity
11
+ * == PaymasterHub.getOrgConfig() (5 orgs, both chains)
12
+ * feeCaps.* == PaymasterHub.getFeeCaps() (Argus; and a null
13
+ * `feeCaps` edge always corresponded to an all-zero
14
+ * on-chain struct on 5 further orgs, which is the
15
+ * contract's "never configured" default)
16
+ * budgets.* == PaymasterHub.getBudget() (9 budgets, 4 orgs,
17
+ * both chains — cap, used, epochLen and epochStart
18
+ * matched to the wei)
19
+ *
20
+ * DELIBERATELY NOT REQUESTED (schema has them, the values are WRONG):
21
+ * PaymasterOrgConfig.totalSpent / .depositBalance — the indexer accumulates the
22
+ * gas cost but not the solidarity fee the hub also debits, so it runs exactly
23
+ * 1/1.01 of the contract's `spent`. Proven on Gnosis (1251669883200000000 ×
24
+ * 1.01 == 1264186582032000000 == on-chain spent, to the wei) and on Arbitrum
25
+ * (141261159757737 × 1.01 == 142673771355313). `available = deposited - spent`
26
+ * is the number that decides whether sponsorship still works, so it stays on
27
+ * getOrgFinancials().
28
+ * PaymasterHubContract.solidarityBalance — matches on Arbitrum but is
29
+ * 6376552300000000 wei HIGH on Gnosis (5115224471702250000 indexed vs
30
+ * 5108847919402250000 on-chain).
31
+ * PaymasterHubContract.solidarityDistributionPaused — reads `false` on Arbitrum
32
+ * while the contract reports `true`. The pause toggle is not indexed.
33
+ *
34
+ * `numActiveOrgs`, `feePercentageBps`, `solidarityUsedThisPeriod` and
35
+ * `periodStart` have no field at all. See docs in commands/paymaster/status.ts.
36
+ */
37
+ /**
38
+ * Hub-wide immutables + one org's paymaster configuration, in a single document.
39
+ *
40
+ * Filtered on `orgId` only rather than the `<hub>-<orgId>` composite entity id:
41
+ * the id-construction convention is a subgraph implementation detail, and there
42
+ * is exactly one PaymasterHubContract per chain. Callers still cross-check
43
+ * `paymasterHub.id` against the hub address they resolved independently and
44
+ * fall back to RPC on a mismatch.
45
+ */
46
+ export declare const FETCH_PAYMASTER_STATE = "\n query FetchPaymasterState($orgId: Bytes!) {\n paymasterHubContracts(first: 1) {\n id\n entryPoint\n }\n paymasterOrgConfigs(first: 1, where: { orgId: $orgId }) {\n id\n orgId\n paymasterHub {\n id\n }\n adminHatId\n operatorHatId\n isPaused\n isBannedFromSolidarity\n registeredAt\n feeCaps {\n maxFeePerGas\n maxPriorityFeePerGas\n maxCallGas\n maxVerificationGas\n maxPreVerificationGas\n }\n budgets(first: 500, orderBy: setAt, orderDirection: asc) {\n subjectKey\n capPerEpoch\n usedInEpoch\n epochLen\n epochStart\n totalUsed\n }\n }\n }\n";
47
+ /**
48
+ * Same document without `PaymasterBudget.totalUsed`.
49
+ *
50
+ * totalUsed is the one field here with no getter counterpart (getBudget() returns
51
+ * only the four in-epoch numbers), which makes it the field most likely to be
52
+ * missing from an older deployment. GraphQL validates a document as a whole, so
53
+ * one unknown field would fail the ENTIRE query and drop `pop paymaster status`
54
+ * back to the full RPC path — hence the tier rather than a bare query.
55
+ *
56
+ * Derived from the modern tier by deletion so the two cannot drift; the
57
+ * derivation is line-based, which test/queries/paymaster-tiers.test.ts pins.
58
+ */
59
+ export declare const FETCH_PAYMASTER_STATE_LEGACY: string;
60
+ /** Modern tier first; the pre-totalUsed shape as the fallback. */
61
+ export declare const FETCH_PAYMASTER_STATE_TIERS: string[];
62
+ export interface PaymasterStateResponse {
63
+ paymasterHubContracts: Array<{
64
+ id: string;
65
+ entryPoint: string;
66
+ }>;
67
+ paymasterOrgConfigs: Array<{
68
+ id: string;
69
+ orgId: string;
70
+ paymasterHub: {
71
+ id: string;
72
+ };
73
+ adminHatId: string;
74
+ operatorHatId: string;
75
+ isPaused: boolean;
76
+ isBannedFromSolidarity: boolean;
77
+ registeredAt: string;
78
+ feeCaps: {
79
+ maxFeePerGas: string;
80
+ maxPriorityFeePerGas: string;
81
+ maxCallGas: number;
82
+ maxVerificationGas: number;
83
+ maxPreVerificationGas: number;
84
+ } | null;
85
+ budgets: Array<{
86
+ subjectKey: string;
87
+ capPerEpoch: string;
88
+ usedInEpoch: string;
89
+ epochLen: number;
90
+ epochStart: number;
91
+ /** Absent on the legacy tier. */
92
+ totalUsed?: string;
93
+ }>;
94
+ }>;
95
+ }
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ /**
3
+ * PaymasterHub Queries
4
+ *
5
+ * Everything here was verified field-by-field against BOTH live deployments
6
+ * (poa-gnosis-v-1 hub 0xdef1…4108, poa-arb-v-1 hub 0xd665…8a11) by comparing the
7
+ * indexed value to the same value read straight off the contract. Only the
8
+ * fields that matched EXACTLY are requested:
9
+ *
10
+ * entryPoint == PaymasterHub.ENTRY_POINT() (both chains)
11
+ * adminHatId/operatorHatId/isPaused/registeredAt/isBannedFromSolidarity
12
+ * == PaymasterHub.getOrgConfig() (5 orgs, both chains)
13
+ * feeCaps.* == PaymasterHub.getFeeCaps() (Argus; and a null
14
+ * `feeCaps` edge always corresponded to an all-zero
15
+ * on-chain struct on 5 further orgs, which is the
16
+ * contract's "never configured" default)
17
+ * budgets.* == PaymasterHub.getBudget() (9 budgets, 4 orgs,
18
+ * both chains — cap, used, epochLen and epochStart
19
+ * matched to the wei)
20
+ *
21
+ * DELIBERATELY NOT REQUESTED (schema has them, the values are WRONG):
22
+ * PaymasterOrgConfig.totalSpent / .depositBalance — the indexer accumulates the
23
+ * gas cost but not the solidarity fee the hub also debits, so it runs exactly
24
+ * 1/1.01 of the contract's `spent`. Proven on Gnosis (1251669883200000000 ×
25
+ * 1.01 == 1264186582032000000 == on-chain spent, to the wei) and on Arbitrum
26
+ * (141261159757737 × 1.01 == 142673771355313). `available = deposited - spent`
27
+ * is the number that decides whether sponsorship still works, so it stays on
28
+ * getOrgFinancials().
29
+ * PaymasterHubContract.solidarityBalance — matches on Arbitrum but is
30
+ * 6376552300000000 wei HIGH on Gnosis (5115224471702250000 indexed vs
31
+ * 5108847919402250000 on-chain).
32
+ * PaymasterHubContract.solidarityDistributionPaused — reads `false` on Arbitrum
33
+ * while the contract reports `true`. The pause toggle is not indexed.
34
+ *
35
+ * `numActiveOrgs`, `feePercentageBps`, `solidarityUsedThisPeriod` and
36
+ * `periodStart` have no field at all. See docs in commands/paymaster/status.ts.
37
+ */
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.FETCH_PAYMASTER_STATE_TIERS = exports.FETCH_PAYMASTER_STATE_LEGACY = exports.FETCH_PAYMASTER_STATE = void 0;
40
+ /**
41
+ * Hub-wide immutables + one org's paymaster configuration, in a single document.
42
+ *
43
+ * Filtered on `orgId` only rather than the `<hub>-<orgId>` composite entity id:
44
+ * the id-construction convention is a subgraph implementation detail, and there
45
+ * is exactly one PaymasterHubContract per chain. Callers still cross-check
46
+ * `paymasterHub.id` against the hub address they resolved independently and
47
+ * fall back to RPC on a mismatch.
48
+ */
49
+ exports.FETCH_PAYMASTER_STATE = `
50
+ query FetchPaymasterState($orgId: Bytes!) {
51
+ paymasterHubContracts(first: 1) {
52
+ id
53
+ entryPoint
54
+ }
55
+ paymasterOrgConfigs(first: 1, where: { orgId: $orgId }) {
56
+ id
57
+ orgId
58
+ paymasterHub {
59
+ id
60
+ }
61
+ adminHatId
62
+ operatorHatId
63
+ isPaused
64
+ isBannedFromSolidarity
65
+ registeredAt
66
+ feeCaps {
67
+ maxFeePerGas
68
+ maxPriorityFeePerGas
69
+ maxCallGas
70
+ maxVerificationGas
71
+ maxPreVerificationGas
72
+ }
73
+ budgets(first: 500, orderBy: setAt, orderDirection: asc) {
74
+ subjectKey
75
+ capPerEpoch
76
+ usedInEpoch
77
+ epochLen
78
+ epochStart
79
+ totalUsed
80
+ }
81
+ }
82
+ }
83
+ `;
84
+ /**
85
+ * Same document without `PaymasterBudget.totalUsed`.
86
+ *
87
+ * totalUsed is the one field here with no getter counterpart (getBudget() returns
88
+ * only the four in-epoch numbers), which makes it the field most likely to be
89
+ * missing from an older deployment. GraphQL validates a document as a whole, so
90
+ * one unknown field would fail the ENTIRE query and drop `pop paymaster status`
91
+ * back to the full RPC path — hence the tier rather than a bare query.
92
+ *
93
+ * Derived from the modern tier by deletion so the two cannot drift; the
94
+ * derivation is line-based, which test/queries/paymaster-tiers.test.ts pins.
95
+ */
96
+ exports.FETCH_PAYMASTER_STATE_LEGACY = exports.FETCH_PAYMASTER_STATE
97
+ .split('\n')
98
+ .filter(line => line.trim() !== 'totalUsed')
99
+ .join('\n');
100
+ /** Modern tier first; the pre-totalUsed shape as the fallback. */
101
+ exports.FETCH_PAYMASTER_STATE_TIERS = [exports.FETCH_PAYMASTER_STATE, exports.FETCH_PAYMASTER_STATE_LEGACY];
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Role Application Queries
3
+ * Ported from frontend queries.js
4
+ */
5
+ export declare const FETCH_USER_ROLE_APPLICATIONS = "\n query FetchUserRoleApplications($eligibilityModuleId: Bytes!, $applicant: Bytes!) {\n roleApplications(\n where: { eligibilityModule: $eligibilityModuleId, applicant: $applicant, active: true }\n first: 50\n ) {\n id\n hatId\n applicant\n applicantUsername\n applicationHash\n active\n appliedAt\n }\n }\n";
6
+ export declare const FETCH_ALL_ROLE_APPLICATIONS = "\n query FetchAllRoleApplications($eligibilityModuleId: Bytes!) {\n roleApplications(\n where: { eligibilityModule: $eligibilityModuleId, active: true }\n orderBy: appliedAt\n orderDirection: desc\n first: 200\n ) {\n id\n hatId\n applicant\n applicantUsername\n applicationHash\n active\n appliedAt\n }\n }\n";
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ /**
3
+ * Role Application Queries
4
+ * Ported from frontend queries.js
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.FETCH_ALL_ROLE_APPLICATIONS = exports.FETCH_USER_ROLE_APPLICATIONS = void 0;
8
+ exports.FETCH_USER_ROLE_APPLICATIONS = `
9
+ query FetchUserRoleApplications($eligibilityModuleId: Bytes!, $applicant: Bytes!) {
10
+ roleApplications(
11
+ where: { eligibilityModule: $eligibilityModuleId, applicant: $applicant, active: true }
12
+ first: 50
13
+ ) {
14
+ id
15
+ hatId
16
+ applicant
17
+ applicantUsername
18
+ applicationHash
19
+ active
20
+ appliedAt
21
+ }
22
+ }
23
+ `;
24
+ exports.FETCH_ALL_ROLE_APPLICATIONS = `
25
+ query FetchAllRoleApplications($eligibilityModuleId: Bytes!) {
26
+ roleApplications(
27
+ where: { eligibilityModule: $eligibilityModuleId, active: true }
28
+ orderBy: appliedAt
29
+ orderDirection: desc
30
+ first: 200
31
+ ) {
32
+ id
33
+ hatId
34
+ applicant
35
+ applicantUsername
36
+ applicationHash
37
+ active
38
+ appliedAt
39
+ }
40
+ }
41
+ `;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Role / hat-admin queries (pop org roles, pop org view, pop org set-metadata-admin).
3
+ *
4
+ * Kept separate from queries/org.ts and queries/role.ts so the roles commands
5
+ * can carry the vouch-config fields without touching the shared org document.
6
+ *
7
+ * VERIFIED against the live Gnosis (poa-gnosis-v-1) and Arbitrum (poa-arb-v-1)
8
+ * deployments on 2026-07-30:
9
+ * - Hat.vouchConfig exists on BOTH schemas and is populated. Every non-null
10
+ * row has enabled=true, quorum>=1, membershipHatId!=0.
11
+ * - A null Hat.vouchConfig means "vouching was never configured for this
12
+ * hat", not "the subgraph is missing data": for every role whose
13
+ * vouchConfig is null (ELIGIBILITY_ADMIN on all 9 Gnosis orgs + Arb's
14
+ * "Poa", plus Test6/TaskRunner, Test6/Treasurer, Decentral Park/Neighbor)
15
+ * an eth_call to EligibilityModule returned isVouchingEnabled()==false and
16
+ * vouchConfigs().quorum==0 — exactly what the CLI renders for a null row.
17
+ * - Role.hat is non-null on all 31 Gnosis roles and all 3 Arbitrum roles.
18
+ * - subgraph src/eligibility-module.ts handleVouchConfigSet writes quorum /
19
+ * membershipHatId / enabled / combinesWithHierarchy on EVERY VouchConfigSet
20
+ * event, including disables, so the row does not go stale after a change.
21
+ * - Organization.metadataAdminHatId is non-null on all 9 Gnosis orgs and the
22
+ * 1 Arbitrum org, and subgraph src/org-registry.ts
23
+ * handleOrgMetadataAdminHatSet rewrites it on every OrgMetadataAdminHatSet.
24
+ * Spot-checked Argus against OrgRegistry.getOrgMetadataAdminHat on Gnosis:
25
+ * identical (30222100625258283641858621132055137413908072809768050515156576961036288).
26
+ */
27
+ /**
28
+ * Tier 0 for `pop org roles`: roles + members + the vouch config inlined via
29
+ * Role.hat.vouchConfig. Serving this tier means the command issues ZERO
30
+ * eth_calls (previously 2 per role: isVouchingEnabled + vouchConfigs).
31
+ */
32
+ export declare const FETCH_ROLES_MEMBERS_AND_VOUCH = "\n query FetchRolesMembersAndVouch($id: Bytes!) {\n organization(id: $id) {\n roles(where: { isUserRole: true }) {\n id\n hatId\n name\n image\n canVote\n isUserRole\n hat {\n id\n vouchConfig {\n enabled\n quorum\n membershipHatId\n combinesWithHierarchy\n }\n }\n }\n users {\n address\n participationTokenBalance\n membershipStatus\n currentHatIds\n account {\n username\n }\n }\n eligibilityModule {\n id\n }\n }\n }\n";
33
+ /**
34
+ * Tier 1 for `pop org roles`: the legacy shape, for any deployment whose
35
+ * schema predates Hat.vouchConfig. When this tier serves, the command falls
36
+ * back to batched EligibilityModule reads through Multicall3.
37
+ */
38
+ export declare const FETCH_ROLES_AND_MEMBERS = "\n query FetchRolesAndMembers($id: Bytes!) {\n organization(id: $id) {\n roles(where: { isUserRole: true }) {\n id\n hatId\n name\n image\n canVote\n isUserRole\n }\n users {\n address\n participationTokenBalance\n membershipStatus\n currentHatIds\n account {\n username\n }\n }\n eligibilityModule {\n id\n }\n }\n }\n";
39
+ /**
40
+ * Current metadata-admin hat for one org — the subgraph mirror of
41
+ * OrgRegistry.getOrgMetadataAdminHat(orgId).
42
+ */
43
+ export declare const FETCH_ORG_METADATA_ADMIN_HAT = "\n query FetchOrgMetadataAdminHat($orgId: Bytes!) {\n organization(id: $orgId) {\n id\n metadataAdminHatId\n }\n }\n";
44
+ /** Shape of the FETCH_ORG_METADATA_ADMIN_HAT response. */
45
+ export interface OrgMetadataAdminHatResult {
46
+ organization: {
47
+ id: string;
48
+ metadataAdminHatId: string | null;
49
+ } | null;
50
+ }
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ /**
3
+ * Role / hat-admin queries (pop org roles, pop org view, pop org set-metadata-admin).
4
+ *
5
+ * Kept separate from queries/org.ts and queries/role.ts so the roles commands
6
+ * can carry the vouch-config fields without touching the shared org document.
7
+ *
8
+ * VERIFIED against the live Gnosis (poa-gnosis-v-1) and Arbitrum (poa-arb-v-1)
9
+ * deployments on 2026-07-30:
10
+ * - Hat.vouchConfig exists on BOTH schemas and is populated. Every non-null
11
+ * row has enabled=true, quorum>=1, membershipHatId!=0.
12
+ * - A null Hat.vouchConfig means "vouching was never configured for this
13
+ * hat", not "the subgraph is missing data": for every role whose
14
+ * vouchConfig is null (ELIGIBILITY_ADMIN on all 9 Gnosis orgs + Arb's
15
+ * "Poa", plus Test6/TaskRunner, Test6/Treasurer, Decentral Park/Neighbor)
16
+ * an eth_call to EligibilityModule returned isVouchingEnabled()==false and
17
+ * vouchConfigs().quorum==0 — exactly what the CLI renders for a null row.
18
+ * - Role.hat is non-null on all 31 Gnosis roles and all 3 Arbitrum roles.
19
+ * - subgraph src/eligibility-module.ts handleVouchConfigSet writes quorum /
20
+ * membershipHatId / enabled / combinesWithHierarchy on EVERY VouchConfigSet
21
+ * event, including disables, so the row does not go stale after a change.
22
+ * - Organization.metadataAdminHatId is non-null on all 9 Gnosis orgs and the
23
+ * 1 Arbitrum org, and subgraph src/org-registry.ts
24
+ * handleOrgMetadataAdminHatSet rewrites it on every OrgMetadataAdminHatSet.
25
+ * Spot-checked Argus against OrgRegistry.getOrgMetadataAdminHat on Gnosis:
26
+ * identical (30222100625258283641858621132055137413908072809768050515156576961036288).
27
+ */
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.FETCH_ORG_METADATA_ADMIN_HAT = exports.FETCH_ROLES_AND_MEMBERS = exports.FETCH_ROLES_MEMBERS_AND_VOUCH = void 0;
30
+ /**
31
+ * Tier 0 for `pop org roles`: roles + members + the vouch config inlined via
32
+ * Role.hat.vouchConfig. Serving this tier means the command issues ZERO
33
+ * eth_calls (previously 2 per role: isVouchingEnabled + vouchConfigs).
34
+ */
35
+ exports.FETCH_ROLES_MEMBERS_AND_VOUCH = `
36
+ query FetchRolesMembersAndVouch($id: Bytes!) {
37
+ organization(id: $id) {
38
+ roles(where: { isUserRole: true }) {
39
+ id
40
+ hatId
41
+ name
42
+ image
43
+ canVote
44
+ isUserRole
45
+ hat {
46
+ id
47
+ vouchConfig {
48
+ enabled
49
+ quorum
50
+ membershipHatId
51
+ combinesWithHierarchy
52
+ }
53
+ }
54
+ }
55
+ users {
56
+ address
57
+ participationTokenBalance
58
+ membershipStatus
59
+ currentHatIds
60
+ account {
61
+ username
62
+ }
63
+ }
64
+ eligibilityModule {
65
+ id
66
+ }
67
+ }
68
+ }
69
+ `;
70
+ /**
71
+ * Tier 1 for `pop org roles`: the legacy shape, for any deployment whose
72
+ * schema predates Hat.vouchConfig. When this tier serves, the command falls
73
+ * back to batched EligibilityModule reads through Multicall3.
74
+ */
75
+ exports.FETCH_ROLES_AND_MEMBERS = `
76
+ query FetchRolesAndMembers($id: Bytes!) {
77
+ organization(id: $id) {
78
+ roles(where: { isUserRole: true }) {
79
+ id
80
+ hatId
81
+ name
82
+ image
83
+ canVote
84
+ isUserRole
85
+ }
86
+ users {
87
+ address
88
+ participationTokenBalance
89
+ membershipStatus
90
+ currentHatIds
91
+ account {
92
+ username
93
+ }
94
+ }
95
+ eligibilityModule {
96
+ id
97
+ }
98
+ }
99
+ }
100
+ `;
101
+ /**
102
+ * Current metadata-admin hat for one org — the subgraph mirror of
103
+ * OrgRegistry.getOrgMetadataAdminHat(orgId).
104
+ */
105
+ exports.FETCH_ORG_METADATA_ADMIN_HAT = `
106
+ query FetchOrgMetadataAdminHat($orgId: Bytes!) {
107
+ organization(id: $orgId) {
108
+ id
109
+ metadataAdminHatId
110
+ }
111
+ }
112
+ `;