@geoprotocol/geo-sdk 0.19.0 → 0.19.1

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 (176) hide show
  1. package/README.md +2 -2
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +1 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/src/abis/dao-space-factory.d.ts +43 -6
  7. package/dist/src/abis/dao-space-factory.d.ts.map +1 -1
  8. package/dist/src/abis/dao-space-factory.js +38 -27
  9. package/dist/src/abis/dao-space-factory.js.map +1 -1
  10. package/dist/src/abis/dao-space.d.ts +98 -7
  11. package/dist/src/abis/dao-space.d.ts.map +1 -1
  12. package/dist/src/abis/dao-space.js +61 -99
  13. package/dist/src/abis/dao-space.js.map +1 -1
  14. package/dist/src/abis/index.d.ts +2 -2
  15. package/dist/src/abis/index.d.ts.map +1 -1
  16. package/dist/src/abis/index.js +2 -2
  17. package/dist/src/abis/index.js.map +1 -1
  18. package/dist/src/abis/space-registry.d.ts +26 -0
  19. package/dist/src/abis/space-registry.d.ts.map +1 -1
  20. package/dist/src/abis/space-registry.js +33 -0
  21. package/dist/src/abis/space-registry.js.map +1 -1
  22. package/dist/src/api-surface.e2e.test.d.ts +2 -0
  23. package/dist/src/api-surface.e2e.test.d.ts.map +1 -0
  24. package/dist/src/{e2e-api-surface.test.js → api-surface.e2e.test.js} +287 -102
  25. package/dist/src/api-surface.e2e.test.js.map +1 -0
  26. package/dist/src/client/dao-spaces.d.ts +93 -33
  27. package/dist/src/client/dao-spaces.d.ts.map +1 -1
  28. package/dist/src/client/dao-spaces.js +174 -42
  29. package/dist/src/client/dao-spaces.js.map +1 -1
  30. package/dist/src/client/dao-spaces.test.js +313 -79
  31. package/dist/src/client/dao-spaces.test.js.map +1 -1
  32. package/dist/src/client/personal-spaces.d.ts +74 -0
  33. package/dist/src/client/personal-spaces.d.ts.map +1 -1
  34. package/dist/src/client/personal-spaces.js +82 -2
  35. package/dist/src/client/personal-spaces.js.map +1 -1
  36. package/dist/src/client/spaces.test.js +27 -7
  37. package/dist/src/client/spaces.test.js.map +1 -1
  38. package/dist/src/client.d.ts +29 -16
  39. package/dist/src/client.d.ts.map +1 -1
  40. package/dist/src/client.js +101 -59
  41. package/dist/src/client.js.map +1 -1
  42. package/dist/src/client.test.js +8 -3
  43. package/dist/src/client.test.js.map +1 -1
  44. package/dist/src/dao-space/constants.d.ts +10 -0
  45. package/dist/src/dao-space/constants.d.ts.map +1 -1
  46. package/dist/src/dao-space/constants.js +10 -0
  47. package/dist/src/dao-space/constants.js.map +1 -1
  48. package/dist/src/dao-space/execute-proposal.d.ts +1 -1
  49. package/dist/src/dao-space/execute-proposal.js +2 -2
  50. package/dist/src/dao-space/execute-proposal.js.map +1 -1
  51. package/dist/src/dao-space/index.d.ts +2 -1
  52. package/dist/src/dao-space/index.d.ts.map +1 -1
  53. package/dist/src/dao-space/index.js +1 -0
  54. package/dist/src/dao-space/index.js.map +1 -1
  55. package/dist/src/dao-space/propose-add-editor.d.ts +1 -20
  56. package/dist/src/dao-space/propose-add-editor.d.ts.map +1 -1
  57. package/dist/src/dao-space/propose-add-editor.js +12 -87
  58. package/dist/src/dao-space/propose-add-editor.js.map +1 -1
  59. package/dist/src/dao-space/propose-add-editor.test.js +16 -4
  60. package/dist/src/dao-space/propose-add-editor.test.js.map +1 -1
  61. package/dist/src/dao-space/propose-add-member.d.ts +1 -20
  62. package/dist/src/dao-space/propose-add-member.d.ts.map +1 -1
  63. package/dist/src/dao-space/propose-add-member.js +12 -87
  64. package/dist/src/dao-space/propose-add-member.js.map +1 -1
  65. package/dist/src/dao-space/propose-add-member.test.js +13 -0
  66. package/dist/src/dao-space/propose-add-member.test.js.map +1 -1
  67. package/dist/src/dao-space/propose-edit.test.js +45 -0
  68. package/dist/src/dao-space/propose-edit.test.js.map +1 -1
  69. package/dist/src/dao-space/propose-remove-editor.d.ts +1 -22
  70. package/dist/src/dao-space/propose-remove-editor.d.ts.map +1 -1
  71. package/dist/src/dao-space/propose-remove-editor.js +12 -94
  72. package/dist/src/dao-space/propose-remove-editor.js.map +1 -1
  73. package/dist/src/dao-space/propose-remove-editor.test.js +22 -4
  74. package/dist/src/dao-space/propose-remove-editor.test.js.map +1 -1
  75. package/dist/src/dao-space/propose-remove-member.d.ts +1 -22
  76. package/dist/src/dao-space/propose-remove-member.d.ts.map +1 -1
  77. package/dist/src/dao-space/propose-remove-member.js +12 -94
  78. package/dist/src/dao-space/propose-remove-member.js.map +1 -1
  79. package/dist/src/dao-space/propose-remove-member.test.js +19 -0
  80. package/dist/src/dao-space/propose-remove-member.test.js.map +1 -1
  81. package/dist/src/dao-space/types.d.ts +72 -11
  82. package/dist/src/dao-space/types.d.ts.map +1 -1
  83. package/dist/src/dao-space/vote-proposal.d.ts +1 -1
  84. package/dist/src/dao-space/vote-proposal.js +2 -2
  85. package/dist/src/dao-space/vote-proposal.js.map +1 -1
  86. package/dist/src/dao-space/vote-proposal.test.js +54 -0
  87. package/dist/src/dao-space/vote-proposal.test.js.map +1 -1
  88. package/dist/src/e2e-test-environment.d.ts +26 -0
  89. package/dist/src/e2e-test-environment.d.ts.map +1 -0
  90. package/dist/src/e2e-test-environment.js +150 -0
  91. package/dist/src/e2e-test-environment.js.map +1 -0
  92. package/dist/src/encodings/get-create-dao-space-calldata.d.ts +32 -9
  93. package/dist/src/encodings/get-create-dao-space-calldata.d.ts.map +1 -1
  94. package/dist/src/encodings/get-create-dao-space-calldata.js +63 -16
  95. package/dist/src/encodings/get-create-dao-space-calldata.js.map +1 -1
  96. package/dist/src/encodings/get-create-dao-space-calldata.test.js +90 -23
  97. package/dist/src/encodings/get-create-dao-space-calldata.test.js.map +1 -1
  98. package/dist/src/full-flow-test.test.js +5 -2
  99. package/dist/src/full-flow-test.test.js.map +1 -1
  100. package/dist/src/legacy-api-surface.e2e.test.d.ts +2 -0
  101. package/dist/src/legacy-api-surface.e2e.test.d.ts.map +1 -0
  102. package/dist/src/{e2e-legacy-api-surface.test.js → legacy-api-surface.e2e.test.js} +91 -71
  103. package/dist/src/legacy-api-surface.e2e.test.js.map +1 -0
  104. package/dist/src/personal-space/constants.d.ts +1 -1
  105. package/dist/src/personal-space/constants.d.ts.map +1 -1
  106. package/dist/src/personal-space/constants.js +1 -1
  107. package/dist/src/personal-space/constants.js.map +1 -1
  108. package/dist/src/personal-space/create-space.d.ts +2 -2
  109. package/dist/src/personal-space/create-space.d.ts.map +1 -1
  110. package/dist/src/personal-space/create-space.js +4 -3
  111. package/dist/src/personal-space/create-space.js.map +1 -1
  112. package/dist/src/personal-space/types.d.ts +4 -1
  113. package/dist/src/personal-space/types.d.ts.map +1 -1
  114. package/package.json +1 -1
  115. package/dist/proto.d.ts +0 -5
  116. package/dist/proto.d.ts.map +0 -1
  117. package/dist/proto.js +0 -5
  118. package/dist/proto.js.map +0 -1
  119. package/dist/src/client/proposals.d.ts +0 -185
  120. package/dist/src/client/proposals.d.ts.map +0 -1
  121. package/dist/src/client/proposals.js +0 -294
  122. package/dist/src/client/proposals.js.map +0 -1
  123. package/dist/src/client/proposals.test.d.ts +0 -2
  124. package/dist/src/client/proposals.test.d.ts.map +0 -1
  125. package/dist/src/client/proposals.test.js +0 -243
  126. package/dist/src/client/proposals.test.js.map +0 -1
  127. package/dist/src/contracts-v2/abis.d.ts +0 -196
  128. package/dist/src/contracts-v2/abis.d.ts.map +0 -1
  129. package/dist/src/contracts-v2/abis.js +0 -110
  130. package/dist/src/contracts-v2/abis.js.map +0 -1
  131. package/dist/src/contracts-v2/actions.d.ts +0 -56
  132. package/dist/src/contracts-v2/actions.d.ts.map +0 -1
  133. package/dist/src/contracts-v2/actions.js +0 -83
  134. package/dist/src/contracts-v2/actions.js.map +0 -1
  135. package/dist/src/contracts-v2/encoding.d.ts +0 -80
  136. package/dist/src/contracts-v2/encoding.d.ts.map +0 -1
  137. package/dist/src/contracts-v2/encoding.js +0 -193
  138. package/dist/src/contracts-v2/encoding.js.map +0 -1
  139. package/dist/src/contracts-v2/encoding.test.d.ts +0 -2
  140. package/dist/src/contracts-v2/encoding.test.d.ts.map +0 -1
  141. package/dist/src/contracts-v2/encoding.test.js +0 -93
  142. package/dist/src/contracts-v2/encoding.test.js.map +0 -1
  143. package/dist/src/contracts-v2/voting-settings.d.ts +0 -48
  144. package/dist/src/contracts-v2/voting-settings.d.ts.map +0 -1
  145. package/dist/src/contracts-v2/voting-settings.js +0 -69
  146. package/dist/src/contracts-v2/voting-settings.js.map +0 -1
  147. package/dist/src/e2e/local-geobrowser.d.ts +0 -9
  148. package/dist/src/e2e/local-geobrowser.d.ts.map +0 -1
  149. package/dist/src/e2e/local-geobrowser.js +0 -35
  150. package/dist/src/e2e/local-geobrowser.js.map +0 -1
  151. package/dist/src/e2e/v2-contracts.test.d.ts +0 -2
  152. package/dist/src/e2e/v2-contracts.test.d.ts.map +0 -1
  153. package/dist/src/e2e/v2-contracts.test.js +0 -25
  154. package/dist/src/e2e/v2-contracts.test.js.map +0 -1
  155. package/dist/src/e2e-api-surface.test.d.ts +0 -2
  156. package/dist/src/e2e-api-surface.test.d.ts.map +0 -1
  157. package/dist/src/e2e-api-surface.test.js.map +0 -1
  158. package/dist/src/e2e-flows.test.d.ts +0 -2
  159. package/dist/src/e2e-flows.test.d.ts.map +0 -1
  160. package/dist/src/e2e-flows.test.js +0 -445
  161. package/dist/src/e2e-flows.test.js.map +0 -1
  162. package/dist/src/e2e-legacy-api-surface.test.d.ts +0 -2
  163. package/dist/src/e2e-legacy-api-surface.test.d.ts.map +0 -1
  164. package/dist/src/e2e-legacy-api-surface.test.js.map +0 -1
  165. package/dist/src/graph/create-space.d.ts +0 -37
  166. package/dist/src/graph/create-space.d.ts.map +0 -1
  167. package/dist/src/graph/create-space.js +0 -67
  168. package/dist/src/graph/create-space.js.map +0 -1
  169. package/dist/src/ops/images.d.ts +0 -37
  170. package/dist/src/ops/images.d.ts.map +0 -1
  171. package/dist/src/ops/images.js +0 -69
  172. package/dist/src/ops/images.js.map +0 -1
  173. package/dist/src/proto/index.d.ts +0 -7
  174. package/dist/src/proto/index.d.ts.map +0 -1
  175. package/dist/src/proto/index.js +0 -7
  176. package/dist/src/proto/index.js.map +0 -1
@@ -20,6 +20,7 @@ export type CreateProposalParams = {
20
20
  proposalId?: string;
21
21
  votingMode?: VotingMode;
22
22
  actions: ProposalAction[];
23
+ updateProposal?: boolean;
23
24
  };
24
25
  export type ProposeEditParams = {
25
26
  name: string;
@@ -30,11 +31,14 @@ export type ProposeEditParams = {
30
31
  daoSpaceId: string;
31
32
  votingMode?: VotingMode;
32
33
  proposalId?: string;
34
+ updateProposal?: boolean;
35
+ versionId?: number;
33
36
  };
34
37
  export type VoteProposalParams = {
35
38
  authorSpaceId: string;
36
39
  spaceId: string;
37
40
  proposalId: string;
41
+ versionId?: number;
38
42
  vote: VoteOption;
39
43
  };
40
44
  export type ExecuteProposalParams = {
@@ -69,6 +73,15 @@ export type ProposeRequestMembershipParams = {
69
73
  spaceId: string;
70
74
  proposalId?: string;
71
75
  };
76
+ export type ProposeArchiveSpaceParams = {
77
+ authorSpaceId: string;
78
+ spaceId: string;
79
+ proposalId?: string;
80
+ votingMode?: 'SLOW';
81
+ };
82
+ export type ProposeUpdateVotingSettingsParams = SlowDaoSpaceRoleProposalBaseParams & {
83
+ votingSettings: VotingSettingsInput;
84
+ };
72
85
  declare function encodePublishEditProposalAction(daoSpaceAddress: `0x${string}`, cid: string): ProposalAction;
73
86
  declare function encodeUpdateVotingSettingsAction(daoSpaceAddress: `0x${string}`, votingSettings: VotingSettingsInput): ProposalAction;
74
87
  /**
@@ -87,10 +100,13 @@ declare function encodeUpdateVotingSettingsAction(daoSpaceAddress: `0x${string}`
87
100
  * author: authorSpaceId,
88
101
  * initialEditorSpaceIds: [authorSpaceId],
89
102
  * votingSettings: {
90
- * slowPathPercentageThreshold: 50,
91
- * fastPathFlatThreshold: 1,
103
+ * partialPercentageSupportThreshold: 50,
104
+ * universalPercentageSupportThreshold: 90,
105
+ * flatSupportThreshold: 1,
92
106
  * quorum: 1,
93
- * durationInDays: 3,
107
+ * durationInDays: 2,
108
+ * disableFastPathAccessForNewMembers: true,
109
+ * executionGracePeriodInDays: 14,
94
110
  * },
95
111
  * });
96
112
  *
@@ -112,28 +128,20 @@ export declare function create(context: GeoClientContext, params: CreateDaoSpace
112
128
  cid: `ipfs://${string}`;
113
129
  }>;
114
130
  /**
115
- * Builds calldata for creating a DAO proposal from prebuilt proposal actions.
131
+ * Builds calldata for creating or updating a DAO proposal from prebuilt proposal actions.
116
132
  *
117
133
  * This uses the configured `SPACE_REGISTRY_ADDRESS` and encodes a
118
- * `GOVERNANCE.PROPOSAL_CREATED` `SpaceRegistry.enter(...)` call.
134
+ * `GOVERNANCE.PROPOSAL_CREATED` or `GOVERNANCE.PROPOSAL_UPDATED`
135
+ * `SpaceRegistry.enter(...)` call. Prefer the high-level
136
+ * `geo.daoSpaces.propose*` helpers for public client code.
119
137
  *
120
138
  * @example
121
139
  * ```ts
122
- * const actions = [
123
- * geo.daoSpaces.proposals.actions.addMember(daoSpaceAddress, memberSpaceId),
124
- * geo.daoSpaces.proposals.actions.updateVotingSettings(daoSpaceAddress, {
125
- * slowPathPercentageThreshold: 60,
126
- * fastPathFlatThreshold: 2,
127
- * quorum: 3,
128
- * durationInDays: 5,
129
- * }),
130
- * ];
131
- *
132
- * const tx = geo.daoSpaces.proposals.create({
133
- * fromSpaceId: authorSpaceId,
134
- * daoSpaceId,
135
- * votingMode: 'SLOW',
136
- * actions,
140
+ * const tx = geo.daoSpaces.proposeAddMember({
141
+ * authorSpaceId,
142
+ * spaceId: daoSpaceId,
143
+ * daoSpaceAddress,
144
+ * newMemberSpaceId,
137
145
  * });
138
146
  * ```
139
147
  *
@@ -141,6 +149,7 @@ export declare function create(context: GeoClientContext, params: CreateDaoSpace
141
149
  * @param params Caller space, DAO space, voting mode, optional proposal ID, and actions.
142
150
  * @returns Target registry address, calldata, and proposal ID.
143
151
  * @throws When IDs are invalid or the configured network is missing `SPACE_REGISTRY_ADDRESS`.
152
+ * @internal
144
153
  */
145
154
  export declare function createProposal(context: GeoClientContext, params: CreateProposalParams): {
146
155
  to: `0x${string}`;
@@ -151,7 +160,7 @@ export declare function createProposal(context: GeoClientContext, params: Create
151
160
  * Publishes an edit and wraps it in a DAO-space proposal.
152
161
  *
153
162
  * This helper validates the proposal shape before upload, publishes the edit
154
- * through the configured API, creates a DAO `publish(...)` action with the
163
+ * through the configured API, creates a DAO `ping(...)` action with the
155
164
  * resulting CID, and returns calldata for proposal creation.
156
165
  *
157
166
  * @example
@@ -177,6 +186,7 @@ export declare function proposeEdit(context: GeoClientContext, params: ProposeEd
177
186
  proposalId: `0x${string}`;
178
187
  editId: Id;
179
188
  cid: `ipfs://${string}`;
189
+ versionId: number;
180
190
  }>;
181
191
  /**
182
192
  * Builds calldata for a DAO proposal that adds a member space.
@@ -257,6 +267,37 @@ export declare function proposeRemoveEditor(context: GeoClientContext, params: P
257
267
  calldata: `0x${string}`;
258
268
  proposalId: `0x${string}`;
259
269
  };
270
+ /**
271
+ * Builds calldata for a DAO proposal that updates voting settings.
272
+ *
273
+ * Updating voting settings only supports SLOW voting.
274
+ * The client validates deterministic numeric bounds before encoding; the DAO
275
+ * contract still enforces flat threshold and quorum against the current editor
276
+ * count when the proposal executes.
277
+ *
278
+ * @example
279
+ * ```ts
280
+ * const tx = geo.daoSpaces.proposeUpdateVotingSettings({
281
+ * authorSpaceId,
282
+ * spaceId: daoSpaceId,
283
+ * daoSpaceAddress,
284
+ * votingSettings: {
285
+ * partialPercentageSupportThreshold: 50,
286
+ * universalPercentageSupportThreshold: 90,
287
+ * flatSupportThreshold: 1,
288
+ * quorum: 1,
289
+ * durationInDays: 2,
290
+ * disableFastPathAccessForNewMembers: true,
291
+ * executionGracePeriodInDays: 14,
292
+ * },
293
+ * });
294
+ * ```
295
+ */
296
+ export declare function proposeUpdateVotingSettings(context: GeoClientContext, params: ProposeUpdateVotingSettingsParams): {
297
+ to: `0x${string}`;
298
+ calldata: `0x${string}`;
299
+ proposalId: `0x${string}`;
300
+ };
260
301
  /**
261
302
  * Builds calldata for requesting membership in a DAO space.
262
303
  *
@@ -276,15 +317,37 @@ export declare function proposeRequestMembership(context: GeoClientContext, para
276
317
  calldata: `0x${string}`;
277
318
  proposalId: `0x${string}`;
278
319
  };
320
+ /**
321
+ * Builds calldata for a DAO proposal that archives the DAO space.
322
+ *
323
+ * The proposal action targets the Space Registry and calls `archiveSpaceId()`.
324
+ * When the proposal executes, the DAO space contract is `msg.sender`, so the
325
+ * registry archives the DAO space's registered ID. Archiving is a destructive
326
+ * governance action and only supports SLOW voting.
327
+ *
328
+ * @example
329
+ * ```ts
330
+ * const tx = geo.daoSpaces.proposeArchiveSpace({
331
+ * authorSpaceId,
332
+ * spaceId: daoSpaceId,
333
+ * });
334
+ * ```
335
+ */
336
+ export declare function proposeArchiveSpace(context: GeoClientContext, params: ProposeArchiveSpaceParams): {
337
+ to: `0x${string}`;
338
+ calldata: `0x${string}`;
339
+ proposalId: `0x${string}`;
340
+ };
279
341
  /**
280
342
  * Builds calldata for voting on a DAO proposal.
281
343
  *
282
344
  * @example
283
345
  * ```ts
284
- * const tx = geo.daoSpaces.proposals.vote({
346
+ * const tx = geo.daoSpaces.voteProposal({
285
347
  * authorSpaceId,
286
348
  * spaceId: daoSpaceId,
287
349
  * proposalId,
350
+ * versionId: 1,
288
351
  * vote: 'YES',
289
352
  * });
290
353
  * ```
@@ -303,7 +366,7 @@ export declare function voteProposal(context: GeoClientContext, params: VoteProp
303
366
  *
304
367
  * @example
305
368
  * ```ts
306
- * const tx = geo.daoSpaces.proposals.execute({
369
+ * const tx = geo.daoSpaces.executeProposal({
307
370
  * authorSpaceId,
308
371
  * spaceId: daoSpaceId,
309
372
  * proposalId,
@@ -320,24 +383,21 @@ export declare function executeProposal(context: GeoClientContext, params: Execu
320
383
  calldata: `0x${string}`;
321
384
  };
322
385
  /**
323
- * Helpers for constructing DAO proposal actions.
386
+ * Internal helpers for constructing DAO proposal actions.
324
387
  *
325
- * These helpers only encode DAO-space action payloads. Pass their results to
326
- * `geo.daoSpaces.proposals.create(...)` when building a proposal from explicit actions.
388
+ * These helpers only encode DAO-space action payloads for the higher-level
389
+ * proposal helpers in this module.
327
390
  *
328
391
  * @example
329
392
  * ```ts
330
- * const action = geo.daoSpaces.proposals.actions.addEditor(daoSpaceAddress, editorSpaceId);
331
- * const proposal = geo.daoSpaces.proposals.create({
332
- * fromSpaceId: authorSpaceId,
333
- * daoSpaceId,
334
- * votingMode: 'SLOW',
335
- * actions: [action],
336
- * });
393
+ * const action = actions.addEditor(daoSpaceAddress, editorSpaceId);
337
394
  * ```
395
+ *
396
+ * @internal
338
397
  */
339
398
  export declare const actions: {
340
399
  publishEdit: typeof encodePublishEditProposalAction;
400
+ archiveSpace: (spaceRegistryAddress: `0x${string}`) => ProposalAction;
341
401
  addEditor: (daoSpaceAddress: `0x${string}`, spaceId: string) => ProposalAction;
342
402
  removeEditor: (daoSpaceAddress: `0x${string}`, spaceId: string) => ProposalAction;
343
403
  addMember: (daoSpaceAddress: `0x${string}`, spaceId: string) => ProposalAction;
@@ -1 +1 @@
1
- {"version":3,"file":"dao-spaces.d.ts","sourceRoot":"","sources":["../../../src/client/dao-spaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AAiB9C,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EACL,KAAK,4BAA4B,EAGjC,KAAK,mBAAmB,EAEzB,MAAM,+CAA+C,CAAC;AACvD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAKnC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAIrD,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACrC,4BAA4B,EAC5B,wBAAwB,GAAG,uBAAuB,CACnD,GAAG;IACF,IAAI,E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;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,sBAAsB;;;;EAWzF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,yBAAyB;;;;EAW/F;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,iCAAiC;;;;EAW/G;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,8BAA8B;;;;EAwBzG;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,yBAAyB;;;;EAe/F;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,kBAAkB;;;EAwBjF;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,qBAAqB;;;EAgBvF;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,OAAO;;yCAEmB,KAAK,MAAM,EAAE;iCAErB,KAAK,MAAM,EAAE,WAAW,MAAM;oCAE3B,KAAK,MAAM,EAAE,WAAW,MAAM;iCAEjC,KAAK,MAAM,EAAE,WAAW,MAAM;oCAE3B,KAAK,MAAM,EAAE,WAAW,MAAM;;CAG/D,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
- import { encodeAbiParameters, encodeFunctionData } from 'viem';
2
+ import { createPublicClient, encodeAbiParameters, encodeFunctionData, http, toHex } from 'viem';
3
3
  import { DaoSpaceAbi, SpaceRegistryAbi } from '../abis/index.js';
4
4
  import { SPACE_TYPE } from '../core/ids/system.js';
5
- import { bytes16ToBytes32LeftAligned, EMPTY_SIGNATURE, EMPTY_TOPIC, ensure0xPrefix, isBytes16Hex, MEMBERSHIP_REQUESTED_ACTION, PROPOSAL_CREATED_ACTION, PROPOSAL_EXECUTED_ACTION, PROPOSAL_VOTED_ACTION, VOTE_OPTION_VALUES, } from '../dao-space/constants.js';
6
- import { getCreateDaoSpaceCalldata, toContractVotingSettings, validateIpfsUri, } from '../encodings/get-create-dao-space-calldata.js';
5
+ import { bytes16ToBytes32LeftAligned, EDITS_PUBLISHED_ACTION, EMPTY_SIGNATURE, EMPTY_TOPIC, ensure0xPrefix, isBytes16Hex, MEMBERSHIP_REQUESTED_ACTION, PROPOSAL_CREATED_ACTION, PROPOSAL_EXECUTED_ACTION, PROPOSAL_UPDATED_ACTION, PROPOSAL_VOTED_ACTION, VOTE_OPTION_VALUES, } from '../dao-space/constants.js';
6
+ import { getCreateDaoSpaceCalldata, toContractVotingSettings, validateIpfsUri, validateVotingSettingsInput, } from '../encodings/get-create-dao-space-calldata.js';
7
7
  import * as IdUtils from '../id-utils.js';
8
8
  import { assertValid } from '../id-utils.js';
9
9
  import { requireGeoContract } from '../networks.js';
@@ -31,6 +31,43 @@ function requireDaoSpaceAddress(daoSpaceAddress) {
31
31
  }
32
32
  return daoSpaceAddress;
33
33
  }
34
+ function validateProposalVersion(versionId, fallback = 1) {
35
+ const version = versionId ?? fallback;
36
+ if (!Number.isInteger(version) || version < 1 || version > 255) {
37
+ throw new Error('versionId must be an integer between 1 and 255');
38
+ }
39
+ return version;
40
+ }
41
+ async function resolveProposalVersion(context, params) {
42
+ if (!params.updateProposal) {
43
+ if (params.versionId !== undefined) {
44
+ throw new Error('versionId can only be provided when updateProposal is true');
45
+ }
46
+ return 1;
47
+ }
48
+ const requestedVersion = params.versionId === undefined ? undefined : validateProposalVersion(params.versionId);
49
+ const rpcUrl = context.network.chain?.rpcUrl;
50
+ if (!rpcUrl) {
51
+ if (requestedVersion !== undefined) {
52
+ return requestedVersion;
53
+ }
54
+ throw new Error('versionId is required when updateProposal is true and the network has no RPC URL');
55
+ }
56
+ const publicClient = createPublicClient({
57
+ transport: http(rpcUrl),
58
+ });
59
+ const latestVersion = await publicClient.readContract({
60
+ address: params.daoSpaceAddress,
61
+ abi: DaoSpaceAbi,
62
+ functionName: 'latestProposalVersion',
63
+ args: [params.proposalId],
64
+ });
65
+ const nextVersion = validateProposalVersion(Number(latestVersion) + 1);
66
+ if (requestedVersion !== undefined && requestedVersion !== nextVersion) {
67
+ throw new Error(`versionId ${requestedVersion} does not match next on-chain proposal version ${nextVersion}`);
68
+ }
69
+ return nextVersion;
70
+ }
34
71
  function encodeCreateProposal(params) {
35
72
  const fromSpaceId = bytes16Id(params.fromSpaceId, 'fromSpaceId');
36
73
  const daoSpaceId = bytes16Id(params.daoSpaceId, 'daoSpaceId');
@@ -60,7 +97,7 @@ function encodeCreateProposal(params) {
60
97
  args: [
61
98
  fromSpaceId,
62
99
  daoSpaceId,
63
- PROPOSAL_CREATED_ACTION,
100
+ params.updateProposal ? PROPOSAL_UPDATED_ACTION : PROPOSAL_CREATED_ACTION,
64
101
  bytes16ToBytes32LeftAligned(proposalId),
65
102
  data,
66
103
  EMPTY_SIGNATURE,
@@ -82,8 +119,15 @@ function encodePublishEditProposalAction(daoSpaceAddress, cid) {
82
119
  value: 0n,
83
120
  data: encodeFunctionData({
84
121
  abi: DaoSpaceAbi,
85
- functionName: 'publish',
86
- args: [EMPTY_TOPIC, encodeAbiParameters([{ type: 'string' }], [cid]), '0x'],
122
+ functionName: 'ping',
123
+ args: [
124
+ EDITS_PUBLISHED_ACTION,
125
+ EMPTY_TOPIC,
126
+ encodeAbiParameters([
127
+ { type: 'bytes', name: 'editsContentUri' },
128
+ { type: 'bytes', name: 'editsMetadata' },
129
+ ], [toHex(cid), '0x']),
130
+ ],
87
131
  }),
88
132
  };
89
133
  }
@@ -99,6 +143,10 @@ function encodeDaoRoleAction(daoSpaceAddress, functionName, spaceId) {
99
143
  };
100
144
  }
101
145
  function encodeUpdateVotingSettingsAction(daoSpaceAddress, votingSettings) {
146
+ const validationError = validateVotingSettingsInput(votingSettings);
147
+ if (validationError) {
148
+ throw new Error(validationError);
149
+ }
102
150
  const contractVotingSettings = toContractVotingSettings(votingSettings);
103
151
  return {
104
152
  to: daoSpaceAddress,
@@ -108,15 +156,28 @@ function encodeUpdateVotingSettingsAction(daoSpaceAddress, votingSettings) {
108
156
  functionName: 'updateVotingSettings',
109
157
  args: [
110
158
  {
111
- slowPathPercentageThreshold: contractVotingSettings.slowPathPercentageThreshold,
112
- fastPathFlatThreshold: contractVotingSettings.fastPathFlatThreshold,
159
+ partialPercentageSupportThreshold: contractVotingSettings.partialPercentageSupportThreshold,
160
+ universalPercentageSupportThreshold: contractVotingSettings.universalPercentageSupportThreshold,
161
+ flatSupportThreshold: contractVotingSettings.flatSupportThreshold,
113
162
  quorum: contractVotingSettings.quorum,
114
163
  duration: contractVotingSettings.duration,
164
+ disableFastPathAccessForNewMembers: contractVotingSettings.disableFastPathAccessForNewMembers,
165
+ executionGracePeriod: contractVotingSettings.executionGracePeriod,
115
166
  },
116
167
  ],
117
168
  }),
118
169
  };
119
170
  }
171
+ function encodeSpaceRegistryLifecycleAction(spaceRegistryAddress, functionName) {
172
+ return {
173
+ to: spaceRegistryAddress,
174
+ value: 0n,
175
+ data: encodeFunctionData({
176
+ abi: SpaceRegistryAbi,
177
+ functionName,
178
+ }),
179
+ };
180
+ }
120
181
  /**
121
182
  * Publishes the initial DAO edit and returns calldata for creating a DAO space.
122
183
  *
@@ -133,10 +194,13 @@ function encodeUpdateVotingSettingsAction(daoSpaceAddress, votingSettings) {
133
194
  * author: authorSpaceId,
134
195
  * initialEditorSpaceIds: [authorSpaceId],
135
196
  * votingSettings: {
136
- * slowPathPercentageThreshold: 50,
137
- * fastPathFlatThreshold: 1,
197
+ * partialPercentageSupportThreshold: 50,
198
+ * universalPercentageSupportThreshold: 90,
199
+ * flatSupportThreshold: 1,
138
200
  * quorum: 1,
139
- * durationInDays: 3,
201
+ * durationInDays: 2,
202
+ * disableFastPathAccessForNewMembers: true,
203
+ * executionGracePeriodInDays: 14,
140
204
  * },
141
205
  * });
142
206
  *
@@ -191,28 +255,20 @@ export async function create(context, params) {
191
255
  };
192
256
  }
193
257
  /**
194
- * Builds calldata for creating a DAO proposal from prebuilt proposal actions.
258
+ * Builds calldata for creating or updating a DAO proposal from prebuilt proposal actions.
195
259
  *
196
260
  * This uses the configured `SPACE_REGISTRY_ADDRESS` and encodes a
197
- * `GOVERNANCE.PROPOSAL_CREATED` `SpaceRegistry.enter(...)` call.
261
+ * `GOVERNANCE.PROPOSAL_CREATED` or `GOVERNANCE.PROPOSAL_UPDATED`
262
+ * `SpaceRegistry.enter(...)` call. Prefer the high-level
263
+ * `geo.daoSpaces.propose*` helpers for public client code.
198
264
  *
199
265
  * @example
200
266
  * ```ts
201
- * const actions = [
202
- * geo.daoSpaces.proposals.actions.addMember(daoSpaceAddress, memberSpaceId),
203
- * geo.daoSpaces.proposals.actions.updateVotingSettings(daoSpaceAddress, {
204
- * slowPathPercentageThreshold: 60,
205
- * fastPathFlatThreshold: 2,
206
- * quorum: 3,
207
- * durationInDays: 5,
208
- * }),
209
- * ];
210
- *
211
- * const tx = geo.daoSpaces.proposals.create({
212
- * fromSpaceId: authorSpaceId,
213
- * daoSpaceId,
214
- * votingMode: 'SLOW',
215
- * actions,
267
+ * const tx = geo.daoSpaces.proposeAddMember({
268
+ * authorSpaceId,
269
+ * spaceId: daoSpaceId,
270
+ * daoSpaceAddress,
271
+ * newMemberSpaceId,
216
272
  * });
217
273
  * ```
218
274
  *
@@ -220,6 +276,7 @@ export async function create(context, params) {
220
276
  * @param params Caller space, DAO space, voting mode, optional proposal ID, and actions.
221
277
  * @returns Target registry address, calldata, and proposal ID.
222
278
  * @throws When IDs are invalid or the configured network is missing `SPACE_REGISTRY_ADDRESS`.
279
+ * @internal
223
280
  */
224
281
  export function createProposal(context, params) {
225
282
  return encodeCreateProposal({
@@ -231,7 +288,7 @@ export function createProposal(context, params) {
231
288
  * Publishes an edit and wraps it in a DAO-space proposal.
232
289
  *
233
290
  * This helper validates the proposal shape before upload, publishes the edit
234
- * through the configured API, creates a DAO `publish(...)` action with the
291
+ * through the configured API, creates a DAO `ping(...)` action with the
235
292
  * resulting CID, and returns calldata for proposal creation.
236
293
  *
237
294
  * @example
@@ -253,15 +310,25 @@ export function createProposal(context, params) {
253
310
  */
254
311
  export async function proposeEdit(context, params) {
255
312
  assertValid(String(params.author), '`author` in `proposeEdit`');
313
+ if (params.updateProposal && !params.proposalId) {
314
+ throw new Error('proposalId is required when updateProposal is true');
315
+ }
256
316
  const spaceRegistryAddress = requireGeoContract(context.network, 'SPACE_REGISTRY_ADDRESS');
257
317
  const validated = encodeCreateProposal({
258
318
  fromSpaceId: params.callerSpaceId,
259
319
  daoSpaceId: params.daoSpaceId,
260
320
  proposalId: params.proposalId,
261
321
  votingMode: params.votingMode ?? 'FAST',
322
+ updateProposal: params.updateProposal,
262
323
  actions: [encodePublishEditProposalAction(params.daoSpaceAddress, VALIDATION_CID)],
263
324
  spaceRegistryAddress,
264
325
  });
326
+ const versionId = await resolveProposalVersion(context, {
327
+ daoSpaceAddress: params.daoSpaceAddress,
328
+ proposalId: validated.proposalId,
329
+ updateProposal: params.updateProposal,
330
+ versionId: params.versionId,
331
+ });
265
332
  const { publish } = await import('./edits.js');
266
333
  const { cid, editId } = await publish(context, {
267
334
  name: params.name,
@@ -273,12 +340,14 @@ export async function proposeEdit(context, params) {
273
340
  daoSpaceId: params.daoSpaceId,
274
341
  proposalId: validated.proposalId,
275
342
  votingMode: params.votingMode ?? 'FAST',
343
+ updateProposal: params.updateProposal,
276
344
  actions: [encodePublishEditProposalAction(params.daoSpaceAddress, cid)],
277
345
  spaceRegistryAddress,
278
346
  });
279
347
  return {
280
348
  editId,
281
349
  cid,
350
+ versionId,
282
351
  ...result,
283
352
  };
284
353
  }
@@ -361,6 +430,39 @@ export function proposeRemoveEditor(context, params) {
361
430
  }
362
431
  return createRoleProposal(context, params, actions.removeEditor(requireDaoSpaceAddress(params.daoSpaceAddress), params.editorToRemoveSpaceId));
363
432
  }
433
+ /**
434
+ * Builds calldata for a DAO proposal that updates voting settings.
435
+ *
436
+ * Updating voting settings only supports SLOW voting.
437
+ * The client validates deterministic numeric bounds before encoding; the DAO
438
+ * contract still enforces flat threshold and quorum against the current editor
439
+ * count when the proposal executes.
440
+ *
441
+ * @example
442
+ * ```ts
443
+ * const tx = geo.daoSpaces.proposeUpdateVotingSettings({
444
+ * authorSpaceId,
445
+ * spaceId: daoSpaceId,
446
+ * daoSpaceAddress,
447
+ * votingSettings: {
448
+ * partialPercentageSupportThreshold: 50,
449
+ * universalPercentageSupportThreshold: 90,
450
+ * flatSupportThreshold: 1,
451
+ * quorum: 1,
452
+ * durationInDays: 2,
453
+ * disableFastPathAccessForNewMembers: true,
454
+ * executionGracePeriodInDays: 14,
455
+ * },
456
+ * });
457
+ * ```
458
+ */
459
+ export function proposeUpdateVotingSettings(context, params) {
460
+ const votingMode = params.votingMode ?? 'SLOW';
461
+ if (votingMode !== 'SLOW') {
462
+ throw new Error('proposeUpdateVotingSettings only supports SLOW voting mode');
463
+ }
464
+ return createRoleProposal(context, params, actions.updateVotingSettings(requireDaoSpaceAddress(params.daoSpaceAddress), params.votingSettings));
465
+ }
364
466
  /**
365
467
  * Builds calldata for requesting membership in a DAO space.
366
468
  *
@@ -396,15 +498,46 @@ export function proposeRequestMembership(context, params) {
396
498
  proposalId,
397
499
  };
398
500
  }
501
+ /**
502
+ * Builds calldata for a DAO proposal that archives the DAO space.
503
+ *
504
+ * The proposal action targets the Space Registry and calls `archiveSpaceId()`.
505
+ * When the proposal executes, the DAO space contract is `msg.sender`, so the
506
+ * registry archives the DAO space's registered ID. Archiving is a destructive
507
+ * governance action and only supports SLOW voting.
508
+ *
509
+ * @example
510
+ * ```ts
511
+ * const tx = geo.daoSpaces.proposeArchiveSpace({
512
+ * authorSpaceId,
513
+ * spaceId: daoSpaceId,
514
+ * });
515
+ * ```
516
+ */
517
+ export function proposeArchiveSpace(context, params) {
518
+ const votingMode = params.votingMode ?? 'SLOW';
519
+ if (votingMode !== 'SLOW') {
520
+ throw new Error('proposeArchiveSpace only supports SLOW voting mode');
521
+ }
522
+ const spaceRegistryAddress = requireGeoContract(context.network, 'SPACE_REGISTRY_ADDRESS');
523
+ return createProposal(context, {
524
+ fromSpaceId: params.authorSpaceId,
525
+ daoSpaceId: params.spaceId,
526
+ proposalId: params.proposalId,
527
+ votingMode,
528
+ actions: [actions.archiveSpace(spaceRegistryAddress)],
529
+ });
530
+ }
399
531
  /**
400
532
  * Builds calldata for voting on a DAO proposal.
401
533
  *
402
534
  * @example
403
535
  * ```ts
404
- * const tx = geo.daoSpaces.proposals.vote({
536
+ * const tx = geo.daoSpaces.voteProposal({
405
537
  * authorSpaceId,
406
538
  * spaceId: daoSpaceId,
407
539
  * proposalId,
540
+ * versionId: 1,
408
541
  * vote: 'YES',
409
542
  * });
410
543
  * ```
@@ -418,11 +551,13 @@ export function voteProposal(context, params) {
418
551
  const authorSpaceId = bytes16Id(params.authorSpaceId, 'authorSpaceId');
419
552
  const spaceId = bytes16Id(params.spaceId, 'spaceId');
420
553
  const proposalId = bytes16Id(params.proposalId, 'proposalId');
554
+ const versionId = validateProposalVersion(params.versionId, 1);
421
555
  const topic = bytes16ToBytes32LeftAligned(proposalId);
422
556
  const data = encodeAbiParameters([
423
557
  { type: 'bytes16', name: 'proposalId' },
558
+ { type: 'uint8', name: 'versionId' },
424
559
  { type: 'uint8', name: 'voteOption' },
425
- ], [proposalId, VOTE_OPTION_VALUES[params.vote]]);
560
+ ], [proposalId, versionId, VOTE_OPTION_VALUES[params.vote]]);
426
561
  const calldata = encodeFunctionData({
427
562
  abi: SpaceRegistryAbi,
428
563
  functionName: 'enter',
@@ -438,7 +573,7 @@ export function voteProposal(context, params) {
438
573
  *
439
574
  * @example
440
575
  * ```ts
441
- * const tx = geo.daoSpaces.proposals.execute({
576
+ * const tx = geo.daoSpaces.executeProposal({
442
577
  * authorSpaceId,
443
578
  * spaceId: daoSpaceId,
444
579
  * proposalId,
@@ -467,24 +602,21 @@ export function executeProposal(context, params) {
467
602
  };
468
603
  }
469
604
  /**
470
- * Helpers for constructing DAO proposal actions.
605
+ * Internal helpers for constructing DAO proposal actions.
471
606
  *
472
- * These helpers only encode DAO-space action payloads. Pass their results to
473
- * `geo.daoSpaces.proposals.create(...)` when building a proposal from explicit actions.
607
+ * These helpers only encode DAO-space action payloads for the higher-level
608
+ * proposal helpers in this module.
474
609
  *
475
610
  * @example
476
611
  * ```ts
477
- * const action = geo.daoSpaces.proposals.actions.addEditor(daoSpaceAddress, editorSpaceId);
478
- * const proposal = geo.daoSpaces.proposals.create({
479
- * fromSpaceId: authorSpaceId,
480
- * daoSpaceId,
481
- * votingMode: 'SLOW',
482
- * actions: [action],
483
- * });
612
+ * const action = actions.addEditor(daoSpaceAddress, editorSpaceId);
484
613
  * ```
614
+ *
615
+ * @internal
485
616
  */
486
617
  export const actions = {
487
618
  publishEdit: encodePublishEditProposalAction,
619
+ archiveSpace: (spaceRegistryAddress) => encodeSpaceRegistryLifecycleAction(spaceRegistryAddress, 'archiveSpaceId'),
488
620
  addEditor: (daoSpaceAddress, spaceId) => encodeDaoRoleAction(daoSpaceAddress, 'addEditor', spaceId),
489
621
  removeEditor: (daoSpaceAddress, spaceId) => encodeDaoRoleAction(daoSpaceAddress, 'removeEditor', spaceId),
490
622
  addMember: (daoSpaceAddress, spaceId) => encodeDaoRoleAction(daoSpaceAddress, 'addMember', spaceId),