@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,92 @@
1
+ /**
2
+ * Org metadata documents.
3
+ *
4
+ * KEY ORDER IS A PROTOCOL CONTRACT: the subgraph metadata handlers and the
5
+ * frontend both parse these documents positionally-by-convention, so every
6
+ * object literal below is constructed with an explicit, load-bearing key
7
+ * order. Do not reorder, and do not let a spread introduce new keys after
8
+ * the canonical block.
9
+ *
10
+ * Shapes verified against:
11
+ * - `pop org deploy` — src/commands/org/deploy.ts (fresh document)
12
+ * - `pop org update-metadata` — src/commands/org/update-metadata.ts (merge)
13
+ */
14
+ export interface OrgLink {
15
+ name: string;
16
+ url: string;
17
+ }
18
+ export interface IndexedOrgLink extends OrgLink {
19
+ index: number;
20
+ }
21
+ /**
22
+ * Stamp each link with its array position, exactly like both CLI commands do
23
+ * (`(links || []).map((l, i) => ({ ...l, index: i }))` — spread first, so any
24
+ * extra keys on a link survive and `index` lands last / is overwritten).
25
+ */
26
+ export declare function stampLinkIndices(links: OrgLink[] | undefined | null): IndexedOrgLink[];
27
+ /** Fresh-deploy org metadata document (`pop org deploy`). */
28
+ export interface OrgDeployMetadata {
29
+ description: string;
30
+ links: IndexedOrgLink[];
31
+ template: string;
32
+ logo: null;
33
+ backgroundColor: null;
34
+ hideTreasury: boolean;
35
+ }
36
+ /**
37
+ * Port of the metadata document `pop org deploy` pins before calling
38
+ * OrgDeployer.deployFullOrg — src/commands/org/deploy.ts.
39
+ *
40
+ * Key order (load-bearing): description, links, template, logo,
41
+ * backgroundColor, hideTreasury.
42
+ */
43
+ export declare function buildOrgDeployMetadata(params: {
44
+ description?: string;
45
+ links?: OrgLink[];
46
+ }): OrgDeployMetadata;
47
+ /** Fields `pop org update-metadata` lets the caller override. */
48
+ export interface OrgMetadataUpdates {
49
+ description?: string;
50
+ /** Replacement link list — index-stamped here; omit to keep current links. */
51
+ links?: OrgLink[];
52
+ /** CID of a freshly pinned logo; omit to keep the current logo. */
53
+ logoCid?: string | null;
54
+ backgroundColor?: string;
55
+ hideTreasury?: boolean;
56
+ }
57
+ /**
58
+ * Canonical merged org metadata (`pop org update-metadata`). The canonical
59
+ * keys are typed; unknown keys from the current IPFS document ride along
60
+ * untyped (that is the point of the merge).
61
+ */
62
+ export interface OrgMetadata {
63
+ description: string;
64
+ links: IndexedOrgLink[];
65
+ template: string;
66
+ logo: string | null;
67
+ backgroundColor: string | null;
68
+ hideTreasury: boolean;
69
+ useTokenSymbol: boolean;
70
+ taskPayoutHoursOnly: boolean;
71
+ taskPayoutHourlyRate: number | null;
72
+ [key: string]: unknown;
73
+ }
74
+ /**
75
+ * Port of the merge in `pop org update-metadata` — src/commands/org/update-metadata.ts.
76
+ *
77
+ * Build metadata JSON — spread the fetched doc, then override only what was passed.
78
+ *
79
+ * Spreading first is what makes this robust: unknown keys survive (e.g.
80
+ * `zkEmailAllowlist`, which the web settings editor writes and reads back),
81
+ * and re-assigning an existing key keeps its original position, so a doc
82
+ * written by the frontend retains the frontend's key order (the subgraph/UI
83
+ * compatibility rule in CLAUDE.md). The explicit keys below then pin the
84
+ * canonical order for a doc that lacks them entirely.
85
+ *
86
+ * `currentMeta` should be the RAW IPFS document when one exists — the
87
+ * subgraph's typed projection only carries the fields schema.graphql
88
+ * declares, so merging over it silently drops everything else.
89
+ */
90
+ export declare function mergeOrgMetadata(currentMeta: Record<string, any>, updates: OrgMetadataUpdates): OrgMetadata;
91
+ /** Exact serialization both org commands pin (plain JSON.stringify). */
92
+ export declare function serializeOrgMetadata(metadata: OrgDeployMetadata | OrgMetadata): string;
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ /**
3
+ * Org metadata documents.
4
+ *
5
+ * KEY ORDER IS A PROTOCOL CONTRACT: the subgraph metadata handlers and the
6
+ * frontend both parse these documents positionally-by-convention, so every
7
+ * object literal below is constructed with an explicit, load-bearing key
8
+ * order. Do not reorder, and do not let a spread introduce new keys after
9
+ * the canonical block.
10
+ *
11
+ * Shapes verified against:
12
+ * - `pop org deploy` — src/commands/org/deploy.ts (fresh document)
13
+ * - `pop org update-metadata` — src/commands/org/update-metadata.ts (merge)
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.stampLinkIndices = stampLinkIndices;
17
+ exports.buildOrgDeployMetadata = buildOrgDeployMetadata;
18
+ exports.mergeOrgMetadata = mergeOrgMetadata;
19
+ exports.serializeOrgMetadata = serializeOrgMetadata;
20
+ /**
21
+ * Stamp each link with its array position, exactly like both CLI commands do
22
+ * (`(links || []).map((l, i) => ({ ...l, index: i }))` — spread first, so any
23
+ * extra keys on a link survive and `index` lands last / is overwritten).
24
+ */
25
+ function stampLinkIndices(links) {
26
+ return (links || []).map((l, i) => ({ ...l, index: i }));
27
+ }
28
+ /**
29
+ * Port of the metadata document `pop org deploy` pins before calling
30
+ * OrgDeployer.deployFullOrg — src/commands/org/deploy.ts.
31
+ *
32
+ * Key order (load-bearing): description, links, template, logo,
33
+ * backgroundColor, hideTreasury.
34
+ */
35
+ function buildOrgDeployMetadata(params) {
36
+ return {
37
+ description: params.description || '',
38
+ links: stampLinkIndices(params.links),
39
+ template: 'default',
40
+ logo: null,
41
+ backgroundColor: null,
42
+ hideTreasury: false,
43
+ };
44
+ }
45
+ /**
46
+ * Port of the merge in `pop org update-metadata` — src/commands/org/update-metadata.ts.
47
+ *
48
+ * Build metadata JSON — spread the fetched doc, then override only what was passed.
49
+ *
50
+ * Spreading first is what makes this robust: unknown keys survive (e.g.
51
+ * `zkEmailAllowlist`, which the web settings editor writes and reads back),
52
+ * and re-assigning an existing key keeps its original position, so a doc
53
+ * written by the frontend retains the frontend's key order (the subgraph/UI
54
+ * compatibility rule in CLAUDE.md). The explicit keys below then pin the
55
+ * canonical order for a doc that lacks them entirely.
56
+ *
57
+ * `currentMeta` should be the RAW IPFS document when one exists — the
58
+ * subgraph's typed projection only carries the fields schema.graphql
59
+ * declares, so merging over it silently drops everything else.
60
+ */
61
+ function mergeOrgMetadata(currentMeta, updates) {
62
+ let links = currentMeta.links || [];
63
+ if (updates.links !== undefined) {
64
+ links = stampLinkIndices(updates.links);
65
+ }
66
+ const metadata = {
67
+ ...currentMeta,
68
+ description: updates.description !== undefined ? updates.description : (currentMeta.description || ''),
69
+ links,
70
+ template: currentMeta.template || 'default',
71
+ logo: updates.logoCid || currentMeta.logo || null,
72
+ backgroundColor: updates.backgroundColor !== undefined ? updates.backgroundColor : (currentMeta.backgroundColor || null),
73
+ hideTreasury: updates.hideTreasury !== undefined ? updates.hideTreasury : (currentMeta.hideTreasury || false),
74
+ useTokenSymbol: currentMeta.useTokenSymbol === true,
75
+ taskPayoutHoursOnly: currentMeta.taskPayoutHoursOnly === true,
76
+ // BigDecimal arrives from the SUBGRAPH as a STRING ("12.5") while the raw IPFS doc holds
77
+ // a number. The metadata handler only reads this key when it is JSONValueKind.NUMBER, so
78
+ // echoing a string back would silently drop the rate. Coerce whichever form we got.
79
+ taskPayoutHourlyRate: currentMeta.taskPayoutHourlyRate != null
80
+ && Number.isFinite(Number(currentMeta.taskPayoutHourlyRate))
81
+ ? Number(currentMeta.taskPayoutHourlyRate)
82
+ : null,
83
+ };
84
+ // Subgraph-entity bookkeeping that is not part of the IPFS document. Only reachable when
85
+ // the IPFS fetch was skipped because the org has no metadata pointer yet.
86
+ for (const k of ['id', 'indexedAt', 'organization', '__typename'])
87
+ delete metadata[k];
88
+ return metadata;
89
+ }
90
+ /** Exact serialization both org commands pin (plain JSON.stringify). */
91
+ function serializeOrgMetadata(metadata) {
92
+ return JSON.stringify(metadata);
93
+ }
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Proposal metadata — the JSON document pinned to IPFS whose bytes32 digest
3
+ * becomes `descriptionHash` in createProposal.
4
+ *
5
+ * KEY ORDER IS A PROTOCOL CONTRACT: the subgraph and frontend parse this
6
+ * document, and every CLI site that pins it writes the keys in exactly this
7
+ * order — {description, optionNames, createdAt} — with no optional keys.
8
+ * Verified against every pinning site:
9
+ * - src/commands/vote/create.ts (pop vote create)
10
+ * - src/commands/vote/propose-quorum.ts (pop vote propose-quorum)
11
+ * - src/commands/vote/propose-config.ts (pop vote propose-config)
12
+ * - src/commands/vote/classes.ts (pop vote classes propose)
13
+ * - src/commands/task/perms.ts (pop task perms propose-global)
14
+ * - src/commands/org/set-metadata-admin.ts, src/commands/project/propose.ts
15
+ *
16
+ * The subgraph's ProposalMetadata entity also carries `actionSummaries` and
17
+ * `promotedFrom` (read by `pop vote results`), but the CLI never writes them
18
+ * — they come from the frontend's proposal flow. Do NOT add them here without
19
+ * a verified reference for their position.
20
+ */
21
+ export interface ProposalMetadata {
22
+ description: string;
23
+ optionNames: string[];
24
+ /** Unix time in MILLISECONDS (the CLI pins Date.now()). */
25
+ createdAt: number;
26
+ }
27
+ export interface BuildProposalMetadataParams {
28
+ description: string;
29
+ optionNames: string[];
30
+ /** Defaults to Date.now() (milliseconds), matching every CLI pin site. */
31
+ createdAt?: number;
32
+ }
33
+ /**
34
+ * Canonical proposal metadata object. Key order is load-bearing — see the
35
+ * module doc comment. Port of the inline object in `pop vote create`
36
+ * (src/commands/vote/create.ts) shared by every governance-wrap command.
37
+ */
38
+ export declare function buildProposalMetadata(params: BuildProposalMetadataParams): ProposalMetadata;
39
+ /**
40
+ * The exact serialization the CLI pins: JSON.stringify with no spacing.
41
+ * (The IPFS CID is content-addressed, so byte-identical serialization is what
42
+ * makes CLI-pinned and core-pinned documents hash identically.)
43
+ */
44
+ export declare function serializeProposalMetadata(metadata: ProposalMetadata): string;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ /**
3
+ * Proposal metadata — the JSON document pinned to IPFS whose bytes32 digest
4
+ * becomes `descriptionHash` in createProposal.
5
+ *
6
+ * KEY ORDER IS A PROTOCOL CONTRACT: the subgraph and frontend parse this
7
+ * document, and every CLI site that pins it writes the keys in exactly this
8
+ * order — {description, optionNames, createdAt} — with no optional keys.
9
+ * Verified against every pinning site:
10
+ * - src/commands/vote/create.ts (pop vote create)
11
+ * - src/commands/vote/propose-quorum.ts (pop vote propose-quorum)
12
+ * - src/commands/vote/propose-config.ts (pop vote propose-config)
13
+ * - src/commands/vote/classes.ts (pop vote classes propose)
14
+ * - src/commands/task/perms.ts (pop task perms propose-global)
15
+ * - src/commands/org/set-metadata-admin.ts, src/commands/project/propose.ts
16
+ *
17
+ * The subgraph's ProposalMetadata entity also carries `actionSummaries` and
18
+ * `promotedFrom` (read by `pop vote results`), but the CLI never writes them
19
+ * — they come from the frontend's proposal flow. Do NOT add them here without
20
+ * a verified reference for their position.
21
+ */
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.buildProposalMetadata = buildProposalMetadata;
24
+ exports.serializeProposalMetadata = serializeProposalMetadata;
25
+ /**
26
+ * Canonical proposal metadata object. Key order is load-bearing — see the
27
+ * module doc comment. Port of the inline object in `pop vote create`
28
+ * (src/commands/vote/create.ts) shared by every governance-wrap command.
29
+ */
30
+ function buildProposalMetadata(params) {
31
+ // Explicit key order: description, optionNames, createdAt.
32
+ return {
33
+ description: params.description,
34
+ optionNames: params.optionNames,
35
+ createdAt: params.createdAt ?? Date.now(),
36
+ };
37
+ }
38
+ /**
39
+ * The exact serialization the CLI pins: JSON.stringify with no spacing.
40
+ * (The IPFS CID is content-addressed, so byte-identical serialization is what
41
+ * makes CLI-pinned and core-pinned documents hash identically.)
42
+ */
43
+ function serializeProposalMetadata(metadata) {
44
+ return JSON.stringify(metadata);
45
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Role application metadata — the canonical document `pop role apply` pins to
3
+ * IPFS before calling EligibilityModuleNew.applyForRole(hatId, applicationHash).
4
+ *
5
+ * KEY ORDER IS A PROTOCOL CONTRACT. The subgraph and frontend read this
6
+ * document by shape, and the CLI has always pinned exactly
7
+ * `{ notes, experience, appliedAt }` in that order
8
+ * (src/commands/role/apply.ts — "key order preserved for frontend/subgraph
9
+ * parity"). Do not reorder, rename, or interleave keys.
10
+ */
11
+ /** The pinned document shape. Key order matches the CLI byte-for-byte. */
12
+ export interface RoleApplicationMetadata {
13
+ /** Application notes; empty string when the applicant provided none. */
14
+ notes: string;
15
+ /** Relevant experience; empty string when the applicant provided none. */
16
+ experience: string;
17
+ /** Unix MILLISECONDS (Date.now() in the CLI), not seconds. */
18
+ appliedAt: number;
19
+ }
20
+ export interface RoleApplicationMetadataInput {
21
+ notes?: string;
22
+ experience?: string;
23
+ /** Override the timestamp (unix ms). Default: Date.now(), as the CLI does. */
24
+ appliedAt?: number;
25
+ }
26
+ /**
27
+ * Port of `pop role apply`'s metadata construction —
28
+ * src/commands/role/apply.ts (`applicationData`).
29
+ *
30
+ * Key order is load-bearing (see module header): the object literal below is
31
+ * the canonical order and must not change.
32
+ */
33
+ export declare function buildRoleApplicationMetadata(input?: RoleApplicationMetadataInput): RoleApplicationMetadata;
34
+ /**
35
+ * The exact serialization the CLI pins: bare JSON.stringify with no spacing.
36
+ * `applicationHash` on chain is ipfsCidToBytes32(pinJson(this)).
37
+ */
38
+ export declare function serializeRoleApplicationMetadata(metadata: RoleApplicationMetadata): string;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ /**
3
+ * Role application metadata — the canonical document `pop role apply` pins to
4
+ * IPFS before calling EligibilityModuleNew.applyForRole(hatId, applicationHash).
5
+ *
6
+ * KEY ORDER IS A PROTOCOL CONTRACT. The subgraph and frontend read this
7
+ * document by shape, and the CLI has always pinned exactly
8
+ * `{ notes, experience, appliedAt }` in that order
9
+ * (src/commands/role/apply.ts — "key order preserved for frontend/subgraph
10
+ * parity"). Do not reorder, rename, or interleave keys.
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.buildRoleApplicationMetadata = buildRoleApplicationMetadata;
14
+ exports.serializeRoleApplicationMetadata = serializeRoleApplicationMetadata;
15
+ /**
16
+ * Port of `pop role apply`'s metadata construction —
17
+ * src/commands/role/apply.ts (`applicationData`).
18
+ *
19
+ * Key order is load-bearing (see module header): the object literal below is
20
+ * the canonical order and must not change.
21
+ */
22
+ function buildRoleApplicationMetadata(input = {}) {
23
+ return {
24
+ notes: input.notes || '',
25
+ experience: input.experience || '',
26
+ appliedAt: input.appliedAt ?? Date.now(),
27
+ };
28
+ }
29
+ /**
30
+ * The exact serialization the CLI pins: bare JSON.stringify with no spacing.
31
+ * `applicationHash` on chain is ipfsCidToBytes32(pinJson(this)).
32
+ */
33
+ function serializeRoleApplicationMetadata(metadata) {
34
+ return JSON.stringify(metadata);
35
+ }
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Task-domain metadata documents (task, rejection, application, project).
3
+ *
4
+ * KEY ORDER IS A PROTOCOL CONTRACT. The subgraph's IPFS templates and the
5
+ * frontend both parse these documents positionally-by-convention: a document
6
+ * whose keys are serialized in a different order breaks metadata indexing and
7
+ * the UI. Every builder below constructs its object with an explicit literal
8
+ * so the JSON.stringify key order is fixed at the source.
9
+ *
10
+ * Shapes verified against the CLI commands that pin them:
11
+ * task — src/commands/task/create.ts (buildMetadata in create-batch.ts,
12
+ * the merge sites in submit.ts / update.ts / edit-meta.ts)
13
+ * rejection — src/commands/task/review.ts (reject path)
14
+ * application — src/commands/task/apply.ts
15
+ * project — src/commands/project/create.ts + project/propose.ts
16
+ */
17
+ /**
18
+ * Canonical task metadata document.
19
+ *
20
+ * Exact key order: name, description, location, difficulty, estHours,
21
+ * submission — and dueDate LAST, present ONLY when set. The subgraph re-points
22
+ * task.metadata at whatever document was pinned most recently (submitTask,
23
+ * updateTask, updateTaskMetadata are full overwrites of the pointer), so a
24
+ * dueDate omitted from a re-pin is deleted for good. Mirrors the frontend,
25
+ * which appends the key last and only when set.
26
+ */
27
+ export interface TaskMetadata {
28
+ name: string;
29
+ description: string;
30
+ location: string;
31
+ difficulty: string;
32
+ /**
33
+ * number on create/submit; update/edit-meta pass the subgraph's BigDecimal
34
+ * STRING through unparsed (`metadata?.estimatedHours || metadata?.estHours
35
+ * || 0` in update.ts/edit-meta.ts) — preserved for byte parity.
36
+ */
37
+ estHours: number | string;
38
+ submission: string;
39
+ /**
40
+ * Soft due date (unix seconds). LAST key, present only when set. May be
41
+ * NaN-serialized-as-null when a merge carried a garbage raw value — see
42
+ * buildTaskMetadata.
43
+ */
44
+ dueDate?: number | null;
45
+ }
46
+ export interface TaskMetadataFields {
47
+ name: string;
48
+ description: string;
49
+ location: string;
50
+ difficulty: string;
51
+ /** See TaskMetadata.estHours for why strings are allowed. */
52
+ estHours: number | string;
53
+ submission: string;
54
+ /**
55
+ * RAW due-date value (unix seconds, or whatever a merge read back from
56
+ * IPFS). Truthiness is applied to THIS raw value, coercion happens after —
57
+ * matching the CLI merge sites exactly. Omit / 0 / '' ⇒ key absent.
58
+ */
59
+ dueDate?: number | string;
60
+ }
61
+ /**
62
+ * Build the canonical task metadata object with the load-bearing key order.
63
+ *
64
+ * Deliberately takes FINAL values with no defaulting: the CLI's commands
65
+ * default differently per site (create uses difficulty 'medium', submit's
66
+ * merge uses '' — see the Level-2 builders in ../tx/task), so defaults here
67
+ * would silently change pinned bytes. `dueDate` follows the CLI merge sites'
68
+ * convention EXACTLY: truthiness on the RAW value, coercion after — so a raw
69
+ * "0" (truthy string) is pinned as 0, and a truthy non-numeric raw value is
70
+ * pinned as NaN, which JSON-serializes to null. Testing the coerced number
71
+ * instead would drop keys the CLI keeps and change the pinned bytes.
72
+ */
73
+ export declare function buildTaskMetadata(fields: TaskMetadataFields): TaskMetadata;
74
+ /** Serialize exactly as the CLI pins it (JSON.stringify of the ordered object). */
75
+ export declare function serializeTaskMetadata(metadata: TaskMetadata): string;
76
+ /**
77
+ * Rejection document pinned by `pop task review --action reject`
78
+ * (src/commands/task/review.ts): a single `rejection` key.
79
+ */
80
+ export interface TaskRejectionMetadata {
81
+ rejection: string;
82
+ }
83
+ export declare function buildTaskRejectionMetadata(reason: string): TaskRejectionMetadata;
84
+ export declare function serializeTaskRejectionMetadata(metadata: TaskRejectionMetadata): string;
85
+ /**
86
+ * Application document pinned by `pop task apply`
87
+ * (src/commands/task/apply.ts). Key order: notes, experience.
88
+ */
89
+ export interface TaskApplicationMetadata {
90
+ notes: string;
91
+ experience: string;
92
+ }
93
+ export declare function buildTaskApplicationMetadata(fields: {
94
+ notes?: string;
95
+ experience?: string;
96
+ }): TaskApplicationMetadata;
97
+ export declare function serializeTaskApplicationMetadata(metadata: TaskApplicationMetadata): string;
98
+ /**
99
+ * Project metadata document pinned by `pop project create` / `pop project
100
+ * propose` (src/commands/project/create.ts, project/propose.ts): a single
101
+ * `description` key. The CLI only pins it when a description was given —
102
+ * otherwise the on-chain metaHash is HashZero, never a pin of `{description:''}`.
103
+ */
104
+ export interface ProjectMetadata {
105
+ description: string;
106
+ }
107
+ export declare function buildProjectMetadata(description: string): ProjectMetadata;
108
+ export declare function serializeProjectMetadata(metadata: ProjectMetadata): string;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ /**
3
+ * Task-domain metadata documents (task, rejection, application, project).
4
+ *
5
+ * KEY ORDER IS A PROTOCOL CONTRACT. The subgraph's IPFS templates and the
6
+ * frontend both parse these documents positionally-by-convention: a document
7
+ * whose keys are serialized in a different order breaks metadata indexing and
8
+ * the UI. Every builder below constructs its object with an explicit literal
9
+ * so the JSON.stringify key order is fixed at the source.
10
+ *
11
+ * Shapes verified against the CLI commands that pin them:
12
+ * task — src/commands/task/create.ts (buildMetadata in create-batch.ts,
13
+ * the merge sites in submit.ts / update.ts / edit-meta.ts)
14
+ * rejection — src/commands/task/review.ts (reject path)
15
+ * application — src/commands/task/apply.ts
16
+ * project — src/commands/project/create.ts + project/propose.ts
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.buildTaskMetadata = buildTaskMetadata;
20
+ exports.serializeTaskMetadata = serializeTaskMetadata;
21
+ exports.buildTaskRejectionMetadata = buildTaskRejectionMetadata;
22
+ exports.serializeTaskRejectionMetadata = serializeTaskRejectionMetadata;
23
+ exports.buildTaskApplicationMetadata = buildTaskApplicationMetadata;
24
+ exports.serializeTaskApplicationMetadata = serializeTaskApplicationMetadata;
25
+ exports.buildProjectMetadata = buildProjectMetadata;
26
+ exports.serializeProjectMetadata = serializeProjectMetadata;
27
+ /**
28
+ * Build the canonical task metadata object with the load-bearing key order.
29
+ *
30
+ * Deliberately takes FINAL values with no defaulting: the CLI's commands
31
+ * default differently per site (create uses difficulty 'medium', submit's
32
+ * merge uses '' — see the Level-2 builders in ../tx/task), so defaults here
33
+ * would silently change pinned bytes. `dueDate` follows the CLI merge sites'
34
+ * convention EXACTLY: truthiness on the RAW value, coercion after — so a raw
35
+ * "0" (truthy string) is pinned as 0, and a truthy non-numeric raw value is
36
+ * pinned as NaN, which JSON-serializes to null. Testing the coerced number
37
+ * instead would drop keys the CLI keeps and change the pinned bytes.
38
+ */
39
+ function buildTaskMetadata(fields) {
40
+ const rawDueDate = fields.dueDate;
41
+ const coerced = Math.floor(Number(rawDueDate));
42
+ return {
43
+ name: fields.name,
44
+ description: fields.description,
45
+ location: fields.location,
46
+ difficulty: fields.difficulty,
47
+ estHours: fields.estHours,
48
+ submission: fields.submission,
49
+ // Key order is load-bearing: dueDate is appended LAST and only when the
50
+ // RAW value is truthy (NaN → null via JSON, same as the CLI).
51
+ ...(rawDueDate ? { dueDate: Number.isNaN(coerced) ? null : coerced } : {}),
52
+ };
53
+ }
54
+ /** Serialize exactly as the CLI pins it (JSON.stringify of the ordered object). */
55
+ function serializeTaskMetadata(metadata) {
56
+ return JSON.stringify(metadata);
57
+ }
58
+ function buildTaskRejectionMetadata(reason) {
59
+ // Single key — order trivially fixed, kept explicit for symmetry.
60
+ return { rejection: reason };
61
+ }
62
+ function serializeTaskRejectionMetadata(metadata) {
63
+ return JSON.stringify(metadata);
64
+ }
65
+ function buildTaskApplicationMetadata(fields) {
66
+ // Key order is load-bearing: notes, then experience. Empty-string defaults
67
+ // match the CLI (`argv.notes || ''`).
68
+ return {
69
+ notes: fields.notes || '',
70
+ experience: fields.experience || '',
71
+ };
72
+ }
73
+ function serializeTaskApplicationMetadata(metadata) {
74
+ return JSON.stringify(metadata);
75
+ }
76
+ function buildProjectMetadata(description) {
77
+ return { description };
78
+ }
79
+ function serializeProjectMetadata(metadata) {
80
+ return JSON.stringify(metadata);
81
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Token-request metadata — the document `pop token request` pins to IPFS.
3
+ *
4
+ * Port of the metadata construction in src/commands/token/request.ts:
5
+ *
6
+ * const metadata = { reason: argv.reason, submittedAt: Date.now() };
7
+ * pinJson(JSON.stringify(metadata));
8
+ *
9
+ * KEY ORDER IS A PROTOCOL CONTRACT: {reason, submittedAt} matches the
10
+ * frontend exactly — the subgraph's TokenRequestMetadata mapping and the UI
11
+ * both consume this document. Do not reorder or insert keys.
12
+ */
13
+ /** Canonical token-request document. Key order: reason, submittedAt. */
14
+ export interface TokenRequestMetadata {
15
+ /** Free-text justification for the request (shown to approvers). */
16
+ reason: string;
17
+ /** Unix milliseconds at submission time (Date.now() in the CLI/frontend). */
18
+ submittedAt: number;
19
+ }
20
+ /**
21
+ * Build the token-request metadata object with the canonical key order.
22
+ * Port of `pop token request` — src/commands/token/request.ts.
23
+ *
24
+ * `submittedAt` defaults to Date.now(), exactly as the CLI does; pass it
25
+ * explicitly for deterministic documents (tests, replays).
26
+ */
27
+ export declare function buildTokenRequestMetadata(reason: string, submittedAt?: number): TokenRequestMetadata;
28
+ /**
29
+ * Serialize with the exact key order the CLI pins
30
+ * (JSON.stringify of an object constructed as {reason, submittedAt}).
31
+ */
32
+ export declare function serializeTokenRequestMetadata(metadata: TokenRequestMetadata): string;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ /**
3
+ * Token-request metadata — the document `pop token request` pins to IPFS.
4
+ *
5
+ * Port of the metadata construction in src/commands/token/request.ts:
6
+ *
7
+ * const metadata = { reason: argv.reason, submittedAt: Date.now() };
8
+ * pinJson(JSON.stringify(metadata));
9
+ *
10
+ * KEY ORDER IS A PROTOCOL CONTRACT: {reason, submittedAt} matches the
11
+ * frontend exactly — the subgraph's TokenRequestMetadata mapping and the UI
12
+ * both consume this document. Do not reorder or insert keys.
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.buildTokenRequestMetadata = buildTokenRequestMetadata;
16
+ exports.serializeTokenRequestMetadata = serializeTokenRequestMetadata;
17
+ /**
18
+ * Build the token-request metadata object with the canonical key order.
19
+ * Port of `pop token request` — src/commands/token/request.ts.
20
+ *
21
+ * `submittedAt` defaults to Date.now(), exactly as the CLI does; pass it
22
+ * explicitly for deterministic documents (tests, replays).
23
+ */
24
+ function buildTokenRequestMetadata(reason, submittedAt = Date.now()) {
25
+ // Key order is load-bearing — matches the frontend serialization exactly.
26
+ return { reason, submittedAt };
27
+ }
28
+ /**
29
+ * Serialize with the exact key order the CLI pins
30
+ * (JSON.stringify of an object constructed as {reason, submittedAt}).
31
+ */
32
+ function serializeTokenRequestMetadata(metadata) {
33
+ // Rebuilt with explicit key order so callers cannot accidentally pin a
34
+ // reordered document.
35
+ return JSON.stringify({ reason: metadata.reason, submittedAt: metadata.submittedAt });
36
+ }
@@ -0,0 +1,63 @@
1
+ /**
2
+ * User-profile metadata — the document `pop user update-profile` pins to IPFS
3
+ * before calling UniversalAccountRegistry.setProfileMetadata.
4
+ *
5
+ * Port of the merge logic in src/commands/user/update-profile.ts.
6
+ *
7
+ * KEY ORDER IS A PROTOCOL CONTRACT: keys are CONDITIONALLY PRESENT but appear
8
+ * in the fixed order {bio, avatar, github, twitter, website} — a key is
9
+ * included when the caller supplies a new value (even an empty string) OR the
10
+ * existing indexed metadata carries a truthy value for it. The subgraph's
11
+ * AccountMetadata mapping and the frontend both consume this document; do not
12
+ * reorder or unconditionally include keys.
13
+ */
14
+ /** The five profile fields, in canonical document order. */
15
+ export declare const USER_PROFILE_FIELDS: readonly ["bio", "avatar", "github", "twitter", "website"];
16
+ export type UserProfileField = (typeof USER_PROFILE_FIELDS)[number];
17
+ /**
18
+ * Canonical profile document. Every key is optional (conditionally present),
19
+ * but present keys always appear in the order bio, avatar, github, twitter,
20
+ * website.
21
+ */
22
+ export interface UserProfileMetadata {
23
+ /** Bio, max 280 chars. */
24
+ bio?: string;
25
+ /** Avatar IPFS CID (Qm...). */
26
+ avatar?: string;
27
+ /** GitHub username. */
28
+ github?: string;
29
+ /** Twitter/X handle. */
30
+ twitter?: string;
31
+ /** Website URL. */
32
+ website?: string;
33
+ }
34
+ /** New values for a profile edit. `undefined` = "leave this field alone". */
35
+ export interface UserProfileUpdates {
36
+ bio?: string;
37
+ avatar?: string;
38
+ github?: string;
39
+ twitter?: string;
40
+ website?: string;
41
+ }
42
+ /**
43
+ * Existing (indexed) metadata being merged over. Values may be null — the
44
+ * subgraph serves null for unset fields.
45
+ */
46
+ export type ExistingUserProfileMetadata = Partial<Record<UserProfileField, string | null | undefined>>;
47
+ /**
48
+ * Read-then-merge profile metadata builder.
49
+ * Port of `pop user update-profile` — src/commands/user/update-profile.ts.
50
+ *
51
+ * Replicates the CLI's inclusion + precedence rules EXACTLY:
52
+ * - a key is included when `updates.<k> !== undefined` OR `existing.<k>` is
53
+ * truthy (so single-flag edits preserve the other fields, and an explicit
54
+ * empty string clears a field while keeping the key);
55
+ * - value precedence: updates.<k> ?? existing.<k> ?? '';
56
+ * - bio is capped at 280 chars (same error message and exit code).
57
+ */
58
+ export declare function buildUserProfileMetadata(updates: UserProfileUpdates, existing?: ExistingUserProfileMetadata | null): UserProfileMetadata;
59
+ /**
60
+ * Serialize with the exact conditional key order the CLI pins. Rebuilt with
61
+ * explicit ordering so callers cannot accidentally pin a reordered document.
62
+ */
63
+ export declare function serializeUserProfileMetadata(metadata: UserProfileMetadata): string;