@geoprotocol/geo-sdk 0.18.3 → 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.
- package/README.md +995 -372
- package/dist/contracts.d.ts +0 -11
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +0 -11
- package/dist/contracts.js.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/lite.d.ts +2 -0
- package/dist/lite.d.ts.map +1 -1
- package/dist/lite.js +2 -0
- package/dist/lite.js.map +1 -1
- package/dist/src/abis/dao-space-factory.d.ts +43 -6
- package/dist/src/abis/dao-space-factory.d.ts.map +1 -1
- package/dist/src/abis/dao-space-factory.js +38 -27
- package/dist/src/abis/dao-space-factory.js.map +1 -1
- package/dist/src/abis/dao-space-v2.test.d.ts +2 -0
- package/dist/src/abis/dao-space-v2.test.d.ts.map +1 -0
- package/dist/src/abis/dao-space-v2.test.js +67 -0
- package/dist/src/abis/dao-space-v2.test.js.map +1 -0
- package/dist/src/abis/dao-space.d.ts +98 -7
- package/dist/src/abis/dao-space.d.ts.map +1 -1
- package/dist/src/abis/dao-space.js +61 -99
- package/dist/src/abis/dao-space.js.map +1 -1
- package/dist/src/abis/index.d.ts +2 -2
- package/dist/src/abis/index.d.ts.map +1 -1
- package/dist/src/abis/index.js +2 -2
- package/dist/src/abis/index.js.map +1 -1
- package/dist/src/abis/space-registry.d.ts +26 -0
- package/dist/src/abis/space-registry.d.ts.map +1 -1
- package/dist/src/abis/space-registry.js +33 -0
- package/dist/src/abis/space-registry.js.map +1 -1
- package/dist/src/api-surface.e2e.test.d.ts +2 -0
- package/dist/src/api-surface.e2e.test.d.ts.map +1 -0
- package/dist/src/api-surface.e2e.test.js +1206 -0
- package/dist/src/api-surface.e2e.test.js.map +1 -0
- package/dist/src/client/api.d.ts +86 -0
- package/dist/src/client/api.d.ts.map +1 -0
- package/dist/src/client/api.js +169 -0
- package/dist/src/client/api.js.map +1 -0
- package/dist/src/client/comments.d.ts +59 -0
- package/dist/src/client/comments.d.ts.map +1 -0
- package/dist/src/client/comments.js +96 -0
- package/dist/src/client/comments.js.map +1 -0
- package/dist/src/client/context.d.ts +20 -0
- package/dist/src/client/context.d.ts.map +1 -0
- package/dist/src/client/context.js +20 -0
- package/dist/src/client/context.js.map +1 -0
- package/dist/src/client/dao-spaces.d.ts +408 -0
- package/dist/src/client/dao-spaces.d.ts.map +1 -0
- package/dist/src/client/dao-spaces.js +626 -0
- package/dist/src/client/dao-spaces.js.map +1 -0
- package/dist/src/client/dao-spaces.test.d.ts +2 -0
- package/dist/src/client/dao-spaces.test.d.ts.map +1 -0
- package/dist/src/client/dao-spaces.test.js +497 -0
- package/dist/src/client/dao-spaces.test.js.map +1 -0
- package/dist/src/client/edits.d.ts +100 -0
- package/dist/src/client/edits.d.ts.map +1 -0
- package/dist/src/client/edits.js +131 -0
- package/dist/src/client/edits.js.map +1 -0
- package/dist/src/client/edits.test.d.ts +2 -0
- package/dist/src/client/edits.test.d.ts.map +1 -0
- package/dist/src/client/edits.test.js +98 -0
- package/dist/src/client/edits.test.js.map +1 -0
- package/dist/src/client/entities.d.ts +23 -0
- package/dist/src/client/entities.d.ts.map +1 -0
- package/dist/src/client/entities.js +88 -0
- package/dist/src/client/entities.js.map +1 -0
- package/dist/src/client/entity-votes.d.ts +141 -0
- package/dist/src/client/entity-votes.d.ts.map +1 -0
- package/dist/src/client/entity-votes.js +168 -0
- package/dist/src/client/entity-votes.js.map +1 -0
- package/dist/src/client/entity-votes.test.d.ts +2 -0
- package/dist/src/client/entity-votes.test.d.ts.map +1 -0
- package/dist/src/client/entity-votes.test.js +93 -0
- package/dist/src/client/entity-votes.test.js.map +1 -0
- package/dist/src/client/graph-workflows.test.d.ts +2 -0
- package/dist/src/client/graph-workflows.test.d.ts.map +1 -0
- package/dist/src/client/graph-workflows.test.js +83 -0
- package/dist/src/client/graph-workflows.test.js.map +1 -0
- package/dist/src/client/images-storage.test.d.ts +2 -0
- package/dist/src/client/images-storage.test.d.ts.map +1 -0
- package/dist/src/client/images-storage.test.js +52 -0
- package/dist/src/client/images-storage.test.js.map +1 -0
- package/dist/src/client/images.d.ts +35 -0
- package/dist/src/client/images.d.ts.map +1 -0
- package/dist/src/client/images.js +90 -0
- package/dist/src/client/images.js.map +1 -0
- package/dist/src/client/personal-spaces.d.ts +229 -0
- package/dist/src/client/personal-spaces.d.ts.map +1 -0
- package/dist/src/client/personal-spaces.js +278 -0
- package/dist/src/client/personal-spaces.js.map +1 -0
- package/dist/src/client/spaces.test.d.ts +2 -0
- package/dist/src/client/spaces.test.d.ts.map +1 -0
- package/dist/src/client/spaces.test.js +175 -0
- package/dist/src/client/spaces.test.js.map +1 -0
- package/dist/src/client/storage.d.ts +52 -0
- package/dist/src/client/storage.d.ts.map +1 -0
- package/dist/src/client/storage.js +53 -0
- package/dist/src/client/storage.js.map +1 -0
- package/dist/src/client.d.ts +338 -0
- package/dist/src/client.d.ts.map +1 -0
- package/dist/src/client.js +494 -0
- package/dist/src/client.js.map +1 -0
- package/dist/src/client.test.d.ts +2 -0
- package/dist/src/client.test.d.ts.map +1 -0
- package/dist/src/client.test.js +125 -0
- package/dist/src/client.test.js.map +1 -0
- package/dist/src/contracts-v2/local-geobrowser.e2e.test.d.ts +2 -0
- package/dist/src/contracts-v2/local-geobrowser.e2e.test.d.ts.map +1 -0
- package/dist/src/contracts-v2/local-geobrowser.e2e.test.js +239 -0
- package/dist/src/contracts-v2/local-geobrowser.e2e.test.js.map +1 -0
- package/dist/src/dao-space/constants.d.ts +16 -3
- package/dist/src/dao-space/constants.d.ts.map +1 -1
- package/dist/src/dao-space/constants.js +16 -5
- package/dist/src/dao-space/constants.js.map +1 -1
- package/dist/src/dao-space/create-space.d.ts +1 -31
- package/dist/src/dao-space/create-space.d.ts.map +1 -1
- package/dist/src/dao-space/create-space.js +5 -70
- package/dist/src/dao-space/create-space.js.map +1 -1
- package/dist/src/dao-space/execute-proposal.d.ts +1 -22
- package/dist/src/dao-space/execute-proposal.d.ts.map +1 -1
- package/dist/src/dao-space/execute-proposal.js +12 -59
- package/dist/src/dao-space/execute-proposal.js.map +1 -1
- package/dist/src/dao-space/index.d.ts +2 -1
- package/dist/src/dao-space/index.d.ts.map +1 -1
- package/dist/src/dao-space/index.js +1 -0
- package/dist/src/dao-space/index.js.map +1 -1
- package/dist/src/dao-space/propose-add-editor.d.ts +1 -20
- package/dist/src/dao-space/propose-add-editor.d.ts.map +1 -1
- package/dist/src/dao-space/propose-add-editor.js +12 -87
- package/dist/src/dao-space/propose-add-editor.js.map +1 -1
- package/dist/src/dao-space/propose-add-editor.test.js +16 -4
- package/dist/src/dao-space/propose-add-editor.test.js.map +1 -1
- package/dist/src/dao-space/propose-add-member.d.ts +1 -20
- package/dist/src/dao-space/propose-add-member.d.ts.map +1 -1
- package/dist/src/dao-space/propose-add-member.js +12 -87
- package/dist/src/dao-space/propose-add-member.js.map +1 -1
- package/dist/src/dao-space/propose-add-member.test.js +13 -0
- package/dist/src/dao-space/propose-add-member.test.js.map +1 -1
- package/dist/src/dao-space/propose-edit.d.ts +1 -30
- package/dist/src/dao-space/propose-edit.d.ts.map +1 -1
- package/dist/src/dao-space/propose-edit.js +12 -108
- package/dist/src/dao-space/propose-edit.js.map +1 -1
- package/dist/src/dao-space/propose-edit.test.js +53 -1
- package/dist/src/dao-space/propose-edit.test.js.map +1 -1
- package/dist/src/dao-space/propose-remove-editor.d.ts +1 -22
- package/dist/src/dao-space/propose-remove-editor.d.ts.map +1 -1
- package/dist/src/dao-space/propose-remove-editor.js +12 -94
- package/dist/src/dao-space/propose-remove-editor.js.map +1 -1
- package/dist/src/dao-space/propose-remove-editor.test.js +24 -11
- package/dist/src/dao-space/propose-remove-editor.test.js.map +1 -1
- package/dist/src/dao-space/propose-remove-member.d.ts +1 -22
- package/dist/src/dao-space/propose-remove-member.d.ts.map +1 -1
- package/dist/src/dao-space/propose-remove-member.js +12 -94
- package/dist/src/dao-space/propose-remove-member.js.map +1 -1
- package/dist/src/dao-space/propose-remove-member.test.js +19 -0
- package/dist/src/dao-space/propose-remove-member.test.js.map +1 -1
- package/dist/src/dao-space/propose-request-membership.d.ts.map +1 -1
- package/dist/src/dao-space/propose-request-membership.js +4 -4
- package/dist/src/dao-space/propose-request-membership.js.map +1 -1
- package/dist/src/dao-space/propose-update-voting-settings.d.ts +8 -0
- package/dist/src/dao-space/propose-update-voting-settings.d.ts.map +1 -0
- package/dist/src/dao-space/propose-update-voting-settings.js +19 -0
- package/dist/src/dao-space/propose-update-voting-settings.js.map +1 -0
- package/dist/src/dao-space/propose-update-voting-settings.test.d.ts +2 -0
- package/dist/src/dao-space/propose-update-voting-settings.test.d.ts.map +1 -0
- package/dist/src/dao-space/propose-update-voting-settings.test.js +118 -0
- package/dist/src/dao-space/propose-update-voting-settings.test.js.map +1 -0
- package/dist/src/dao-space/types.d.ts +72 -11
- package/dist/src/dao-space/types.d.ts.map +1 -1
- package/dist/src/dao-space/vote-proposal.d.ts +1 -24
- package/dist/src/dao-space/vote-proposal.d.ts.map +1 -1
- package/dist/src/dao-space/vote-proposal.js +12 -64
- package/dist/src/dao-space/vote-proposal.js.map +1 -1
- package/dist/src/dao-space/vote-proposal.test.js +54 -0
- package/dist/src/dao-space/vote-proposal.test.js.map +1 -1
- package/dist/src/e2e-test-environment.d.ts +26 -0
- package/dist/src/e2e-test-environment.d.ts.map +1 -0
- package/dist/src/e2e-test-environment.js +150 -0
- package/dist/src/e2e-test-environment.js.map +1 -0
- package/dist/src/encoding.d.ts +3 -0
- package/dist/src/encoding.d.ts.map +1 -1
- package/dist/src/encoding.js +3 -0
- package/dist/src/encoding.js.map +1 -1
- package/dist/src/encodings/get-create-dao-space-calldata.d.ts +34 -97
- package/dist/src/encodings/get-create-dao-space-calldata.d.ts.map +1 -1
- package/dist/src/encodings/get-create-dao-space-calldata.js +66 -109
- package/dist/src/encodings/get-create-dao-space-calldata.js.map +1 -1
- package/dist/src/encodings/get-create-dao-space-calldata.test.js +90 -23
- package/dist/src/encodings/get-create-dao-space-calldata.test.js.map +1 -1
- package/dist/src/encodings/get-create-personal-space-calldata.d.ts +2 -0
- package/dist/src/encodings/get-create-personal-space-calldata.d.ts.map +1 -1
- package/dist/src/encodings/get-create-personal-space-calldata.js +2 -0
- package/dist/src/encodings/get-create-personal-space-calldata.js.map +1 -1
- package/dist/src/full-flow-test.test.js +5 -2
- package/dist/src/full-flow-test.test.js.map +1 -1
- package/dist/src/graph/comment-utils.d.ts +4 -0
- package/dist/src/graph/comment-utils.d.ts.map +1 -1
- package/dist/src/graph/comment-utils.js +4 -0
- package/dist/src/graph/comment-utils.js.map +1 -1
- package/dist/src/graph/constants.d.ts +12 -3
- package/dist/src/graph/constants.d.ts.map +1 -1
- package/dist/src/graph/constants.js +11 -5
- package/dist/src/graph/constants.js.map +1 -1
- package/dist/src/graph/create-comment.d.ts +3 -22
- package/dist/src/graph/create-comment.d.ts.map +1 -1
- package/dist/src/graph/create-comment.js +6 -136
- package/dist/src/graph/create-comment.js.map +1 -1
- package/dist/src/graph/create-comment.test.js +19 -8
- package/dist/src/graph/create-comment.test.js.map +1 -1
- package/dist/src/graph/create-entity.d.ts +2 -0
- package/dist/src/graph/create-entity.d.ts.map +1 -1
- package/dist/src/graph/create-entity.js +2 -0
- package/dist/src/graph/create-entity.js.map +1 -1
- package/dist/src/graph/create-image.d.ts +2 -21
- package/dist/src/graph/create-image.d.ts.map +1 -1
- package/dist/src/graph/create-image.js +7 -69
- package/dist/src/graph/create-image.js.map +1 -1
- package/dist/src/graph/create-property.d.ts +2 -0
- package/dist/src/graph/create-property.d.ts.map +1 -1
- package/dist/src/graph/create-property.js +2 -0
- package/dist/src/graph/create-property.js.map +1 -1
- package/dist/src/graph/create-proposal-review.d.ts +1 -27
- package/dist/src/graph/create-proposal-review.d.ts.map +1 -1
- package/dist/src/graph/create-proposal-review.js +4 -61
- package/dist/src/graph/create-proposal-review.js.map +1 -1
- package/dist/src/graph/create-relation.d.ts +2 -0
- package/dist/src/graph/create-relation.d.ts.map +1 -1
- package/dist/src/graph/create-relation.js +2 -0
- package/dist/src/graph/create-relation.js.map +1 -1
- package/dist/src/graph/create-type.d.ts +2 -0
- package/dist/src/graph/create-type.d.ts.map +1 -1
- package/dist/src/graph/create-type.js +2 -0
- package/dist/src/graph/create-type.js.map +1 -1
- package/dist/src/graph/delete-entity.d.ts +2 -14
- package/dist/src/graph/delete-entity.d.ts.map +1 -1
- package/dist/src/graph/delete-entity.js +5 -78
- package/dist/src/graph/delete-entity.js.map +1 -1
- package/dist/src/graph/delete-entity.test.js +7 -0
- package/dist/src/graph/delete-entity.test.js.map +1 -1
- package/dist/src/graph/delete-relation.d.ts +2 -0
- package/dist/src/graph/delete-relation.d.ts.map +1 -1
- package/dist/src/graph/delete-relation.js +2 -0
- package/dist/src/graph/delete-relation.js.map +1 -1
- package/dist/src/graph/entity-vote.d.ts +3 -3
- package/dist/src/graph/entity-vote.d.ts.map +1 -1
- package/dist/src/graph/entity-vote.js +21 -46
- package/dist/src/graph/entity-vote.js.map +1 -1
- package/dist/src/graph/update-comment.d.ts +3 -0
- package/dist/src/graph/update-comment.d.ts.map +1 -1
- package/dist/src/graph/update-comment.js +3 -0
- package/dist/src/graph/update-comment.js.map +1 -1
- package/dist/src/graph/update-entity.d.ts +2 -0
- package/dist/src/graph/update-entity.d.ts.map +1 -1
- package/dist/src/graph/update-entity.js +2 -0
- package/dist/src/graph/update-entity.js.map +1 -1
- package/dist/src/graph/update-proposal-review.d.ts +2 -27
- package/dist/src/graph/update-proposal-review.d.ts.map +1 -1
- package/dist/src/graph/update-proposal-review.js +4 -50
- package/dist/src/graph/update-proposal-review.js.map +1 -1
- package/dist/src/graph/update-relation.d.ts +2 -0
- package/dist/src/graph/update-relation.d.ts.map +1 -1
- package/dist/src/graph/update-relation.js +2 -0
- package/dist/src/graph/update-relation.js.map +1 -1
- package/dist/src/ipfs-core.d.ts +42 -0
- package/dist/src/ipfs-core.d.ts.map +1 -0
- package/dist/src/ipfs-core.js +165 -0
- package/dist/src/ipfs-core.js.map +1 -0
- package/dist/src/ipfs-core.test.d.ts +2 -0
- package/dist/src/ipfs-core.test.d.ts.map +1 -0
- package/dist/src/ipfs-core.test.js +56 -0
- package/dist/src/ipfs-core.test.js.map +1 -0
- package/dist/src/ipfs.d.ts +7 -52
- package/dist/src/ipfs.d.ts.map +1 -1
- package/dist/src/ipfs.js +27 -170
- package/dist/src/ipfs.js.map +1 -1
- package/dist/src/legacy-api-surface.e2e.test.d.ts +2 -0
- package/dist/src/legacy-api-surface.e2e.test.d.ts.map +1 -0
- package/dist/src/legacy-api-surface.e2e.test.js +860 -0
- package/dist/src/legacy-api-surface.e2e.test.js.map +1 -0
- package/dist/src/networks.d.ts +46 -0
- package/dist/src/networks.d.ts.map +1 -0
- package/dist/src/networks.js +90 -0
- package/dist/src/networks.js.map +1 -0
- package/dist/src/ops/comments.d.ts +80 -0
- package/dist/src/ops/comments.d.ts.map +1 -0
- package/dist/src/ops/comments.js +142 -0
- package/dist/src/ops/comments.js.map +1 -0
- package/dist/src/ops/entities.d.ts +50 -0
- package/dist/src/ops/entities.d.ts.map +1 -0
- package/dist/src/ops/entities.js +51 -0
- package/dist/src/ops/entities.js.map +1 -0
- package/dist/src/ops/index.d.ts +7 -0
- package/dist/src/ops/index.d.ts.map +1 -0
- package/dist/src/ops/index.js +7 -0
- package/dist/src/ops/index.js.map +1 -0
- package/dist/src/ops/index.test.d.ts +2 -0
- package/dist/src/ops/index.test.d.ts.map +1 -0
- package/dist/src/ops/index.test.js +115 -0
- package/dist/src/ops/index.test.js.map +1 -0
- package/dist/src/ops/properties.d.ts +20 -0
- package/dist/src/ops/properties.d.ts.map +1 -0
- package/dist/src/ops/properties.js +20 -0
- package/dist/src/ops/properties.js.map +1 -0
- package/dist/src/ops/proposal-reviews.d.ts +43 -0
- package/dist/src/ops/proposal-reviews.d.ts.map +1 -0
- package/dist/src/ops/proposal-reviews.js +103 -0
- package/dist/src/ops/proposal-reviews.js.map +1 -0
- package/dist/src/ops/relations.d.ts +57 -0
- package/dist/src/ops/relations.d.ts.map +1 -0
- package/dist/src/ops/relations.js +59 -0
- package/dist/src/ops/relations.js.map +1 -0
- package/dist/src/ops/types.d.ts +20 -0
- package/dist/src/ops/types.d.ts.map +1 -0
- package/dist/src/ops/types.js +20 -0
- package/dist/src/ops/types.js.map +1 -0
- package/dist/src/personal-space/constants.d.ts +1 -0
- package/dist/src/personal-space/constants.d.ts.map +1 -1
- package/dist/src/personal-space/constants.js +1 -0
- package/dist/src/personal-space/constants.js.map +1 -1
- package/dist/src/personal-space/create-space.d.ts +3 -20
- package/dist/src/personal-space/create-space.d.ts.map +1 -1
- package/dist/src/personal-space/create-space.js +5 -21
- package/dist/src/personal-space/create-space.js.map +1 -1
- package/dist/src/personal-space/has-space.d.ts +9 -2
- package/dist/src/personal-space/has-space.d.ts.map +1 -1
- package/dist/src/personal-space/has-space.js +9 -13
- package/dist/src/personal-space/has-space.js.map +1 -1
- package/dist/src/personal-space/has-space.test.d.ts +2 -0
- package/dist/src/personal-space/has-space.test.d.ts.map +1 -0
- package/dist/src/personal-space/has-space.test.js +30 -0
- package/dist/src/personal-space/has-space.test.js.map +1 -0
- package/dist/src/personal-space/publish-edit.d.ts +1 -22
- package/dist/src/personal-space/publish-edit.d.ts.map +1 -1
- package/dist/src/personal-space/publish-edit.js +10 -64
- package/dist/src/personal-space/publish-edit.js.map +1 -1
- package/dist/src/personal-space/types.d.ts +4 -1
- package/dist/src/personal-space/types.d.ts.map +1 -1
- package/dist/src/smart-wallet.d.ts +2 -4
- package/dist/src/smart-wallet.d.ts.map +1 -1
- package/dist/src/smart-wallet.js +6 -9
- package/dist/src/smart-wallet.js.map +1 -1
- package/dist/src/types.d.ts +25 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js.map +1 -1
- package/package.json +14 -1
- package/dist/proto.d.ts +0 -5
- package/dist/proto.d.ts.map +0 -1
- package/dist/proto.js +0 -5
- package/dist/proto.js.map +0 -1
- package/dist/src/graph/create-space.d.ts +0 -37
- package/dist/src/graph/create-space.d.ts.map +0 -1
- package/dist/src/graph/create-space.js +0 -67
- package/dist/src/graph/create-space.js.map +0 -1
- package/dist/src/proto/index.d.ts +0 -7
- package/dist/src/proto/index.d.ts.map +0 -1
- package/dist/src/proto/index.js +0 -7
- package/dist/src/proto/index.js.map +0 -1
|
@@ -3,104 +3,76 @@
|
|
|
3
3
|
* 100% = 10e6 (10,000,000), so 50% = 5e6 (5,000,000)
|
|
4
4
|
*/
|
|
5
5
|
export declare const RATIO_BASE: bigint;
|
|
6
|
-
/** Minimum voting duration in seconds
|
|
6
|
+
/** Minimum voting duration in seconds, matching the contracts v2 lower bound. */
|
|
7
7
|
export declare const MINIMUM_VOTING_DURATION: bigint;
|
|
8
8
|
/** Minimum voting duration in days */
|
|
9
|
-
export declare const MINIMUM_VOTING_DURATION_DAYS
|
|
9
|
+
export declare const MINIMUM_VOTING_DURATION_DAYS: number;
|
|
10
|
+
/** Minimum execution grace period in seconds, matching the contracts v2 lower bound. */
|
|
11
|
+
export declare const MINIMUM_EXECUTION_GRACE_PERIOD: bigint;
|
|
12
|
+
/** Minimum execution grace period in days */
|
|
13
|
+
export declare const MINIMUM_EXECUTION_GRACE_PERIOD_DAYS: number;
|
|
10
14
|
/**
|
|
11
15
|
* User-friendly voting settings input (using percentages and days)
|
|
12
16
|
*/
|
|
13
17
|
export interface VotingSettingsInput {
|
|
14
|
-
/**
|
|
15
|
-
|
|
18
|
+
/** Partial percentage threshold for slow path late execution (0-100) */
|
|
19
|
+
partialPercentageSupportThreshold: number;
|
|
20
|
+
/** Universal percentage threshold for slow path early execution (0-100) */
|
|
21
|
+
universalPercentageSupportThreshold: number;
|
|
16
22
|
/** Number of editors required for fast path approval */
|
|
17
|
-
|
|
23
|
+
flatSupportThreshold: number;
|
|
18
24
|
/** Minimum number of editors required to vote */
|
|
19
25
|
quorum: number;
|
|
20
|
-
/** Voting duration in days
|
|
26
|
+
/** Voting duration in days */
|
|
21
27
|
durationInDays: number;
|
|
28
|
+
/** Whether newly added members start without fast-path access */
|
|
29
|
+
disableFastPathAccessForNewMembers: boolean;
|
|
30
|
+
/** Execution grace period in days */
|
|
31
|
+
executionGracePeriodInDays: number;
|
|
22
32
|
}
|
|
23
33
|
/**
|
|
24
34
|
* Contract-level voting settings (using raw values)
|
|
25
35
|
*/
|
|
26
36
|
export interface VotingSettings {
|
|
27
|
-
|
|
28
|
-
|
|
37
|
+
partialPercentageSupportThreshold: bigint;
|
|
38
|
+
universalPercentageSupportThreshold: bigint;
|
|
39
|
+
flatSupportThreshold: bigint;
|
|
29
40
|
quorum: bigint;
|
|
30
41
|
duration: bigint;
|
|
42
|
+
disableFastPathAccessForNewMembers: boolean;
|
|
43
|
+
executionGracePeriod: bigint;
|
|
31
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Sensible user-friendly defaults for contracts v2 DAO spaces.
|
|
47
|
+
*/
|
|
48
|
+
export declare const DEFAULT_VOTING_SETTINGS: VotingSettingsInput;
|
|
32
49
|
/**
|
|
33
50
|
* Convert a percentage (0-100) to the contract's ratio format.
|
|
34
|
-
*
|
|
35
|
-
* @param percentage - A number between 0 and 100
|
|
36
|
-
* @returns The ratio value used by the contract (where 10e6 = 100%)
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* ```ts
|
|
40
|
-
* percentageToRatio(100) // 10000000n (100%)
|
|
41
|
-
* percentageToRatio(50) // 5000000n (50%)
|
|
42
|
-
* percentageToRatio(0) // 0n (0%)
|
|
43
|
-
* ```
|
|
44
51
|
*/
|
|
45
52
|
export declare function percentageToRatio(percentage: number): bigint;
|
|
46
53
|
/**
|
|
47
54
|
* Convert days to seconds.
|
|
48
|
-
*
|
|
49
|
-
* @param days - Number of days
|
|
50
|
-
* @returns The equivalent duration in seconds as a bigint
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```ts
|
|
54
|
-
* daysToSeconds(1) // 86400n
|
|
55
|
-
* daysToSeconds(7) // 604800n
|
|
56
|
-
* ```
|
|
57
55
|
*/
|
|
58
56
|
export declare function daysToSeconds(days: number): bigint;
|
|
59
57
|
/**
|
|
60
58
|
* Convert user-friendly voting settings to contract format.
|
|
61
|
-
*
|
|
62
|
-
* @param input - User-friendly voting settings with percentages and days
|
|
63
|
-
* @returns Contract-level voting settings with bigint values
|
|
64
|
-
*
|
|
65
|
-
* @example
|
|
66
|
-
* ```ts
|
|
67
|
-
* const contractSettings = toContractVotingSettings({
|
|
68
|
-
* slowPathPercentageThreshold: 50, // 50%
|
|
69
|
-
* fastPathFlatThreshold: 3, // 3 editors
|
|
70
|
-
* quorum: 2, // 2 editors minimum
|
|
71
|
-
* durationInDays: 7, // 7 days
|
|
72
|
-
* });
|
|
73
|
-
* // Returns: { slowPathPercentageThreshold: 5000000n, fastPathFlatThreshold: 3n, quorum: 2n, duration: 604800n }
|
|
74
|
-
* ```
|
|
75
59
|
*/
|
|
76
60
|
export declare function toContractVotingSettings(input: VotingSettingsInput): VotingSettings;
|
|
77
61
|
/**
|
|
78
62
|
* Validate an IPFS URI format.
|
|
79
|
-
*
|
|
80
|
-
* @param uri - The URI to validate
|
|
81
|
-
* @returns Error message if invalid, null if valid
|
|
82
63
|
*/
|
|
83
64
|
export declare function validateIpfsUri(uri: string): string | null;
|
|
84
65
|
/**
|
|
85
66
|
* Validate voting settings input.
|
|
86
67
|
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
* ```ts
|
|
93
|
-
* const error = validateVotingSettingsInput(
|
|
94
|
-
* { slowPathPercentageThreshold: 50, fastPathFlatThreshold: 3, quorum: 2, durationInDays: 7 },
|
|
95
|
-
* 5 // total editors
|
|
96
|
-
* );
|
|
97
|
-
* if (error) {
|
|
98
|
-
* console.error(error);
|
|
99
|
-
* }
|
|
100
|
-
* ```
|
|
68
|
+
* When `totalEditors` is provided, the flat support threshold and quorum are
|
|
69
|
+
* also checked against that known editor count. For existing DAO spaces the
|
|
70
|
+
* current editor count may be unknown client-side, so callers can omit it and
|
|
71
|
+
* still get deterministic local validation for numeric shape, percentages, and
|
|
72
|
+
* duration lower bounds before the contract enforces editor-count limits.
|
|
101
73
|
*/
|
|
102
|
-
export declare function validateVotingSettingsInput(settings: VotingSettingsInput, totalEditors
|
|
103
|
-
type CreateDaoSpaceCalldataParams = {
|
|
74
|
+
export declare function validateVotingSettingsInput(settings: VotingSettingsInput, totalEditors?: number): string | null;
|
|
75
|
+
export type CreateDaoSpaceCalldataParams = {
|
|
104
76
|
/** Voting settings for the DAO space */
|
|
105
77
|
votingSettings: VotingSettingsInput;
|
|
106
78
|
/** Space IDs of initial editors (at least one required). Must be bytes16 hex strings without dashes. */
|
|
@@ -115,43 +87,8 @@ type CreateDaoSpaceCalldataParams = {
|
|
|
115
87
|
/**
|
|
116
88
|
* Get the calldata for creating a DAO space proxy.
|
|
117
89
|
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
* @param args - The parameters for creating the DAO space
|
|
122
|
-
* @returns Encoded calldata for the transaction
|
|
123
|
-
* @throws Error if validation fails (e.g., no editors, invalid voting settings)
|
|
124
|
-
*
|
|
125
|
-
* @example
|
|
126
|
-
* ```ts
|
|
127
|
-
* import { getCreateDaoSpaceCalldata, TESTNET } from '@geoprotocol/geo-sdk';
|
|
128
|
-
* import { createWalletClient, http } from 'viem';
|
|
129
|
-
*
|
|
130
|
-
* const calldata = getCreateDaoSpaceCalldata({
|
|
131
|
-
* votingSettings: {
|
|
132
|
-
* slowPathPercentageThreshold: 50, // 50% approval needed
|
|
133
|
-
* fastPathFlatThreshold: 3, // 3 editors for fast path
|
|
134
|
-
* quorum: 2, // minimum 2 editors must vote
|
|
135
|
-
* durationInDays: 7, // 7 day voting period
|
|
136
|
-
* },
|
|
137
|
-
* initialEditorSpaceIds: ['0x01234567890abcdef01234567890abcd', '0x56789abcdef01234567890abcdef0123'],
|
|
138
|
-
* initialMemberSpaceIds: ['0xabcdef01234567890abcdef012345678'],
|
|
139
|
-
* });
|
|
140
|
-
*
|
|
141
|
-
* // Using viem
|
|
142
|
-
* const hash = await walletClient.sendTransaction({
|
|
143
|
-
* to: TESTNET.DAO_SPACE_FACTORY_ADDRESS,
|
|
144
|
-
* data: calldata,
|
|
145
|
-
* });
|
|
146
|
-
*
|
|
147
|
-
* // Using wagmi
|
|
148
|
-
* const { sendTransaction } = useSendTransaction();
|
|
149
|
-
* sendTransaction({
|
|
150
|
-
* to: TESTNET.DAO_SPACE_FACTORY_ADDRESS,
|
|
151
|
-
* data: calldata,
|
|
152
|
-
* });
|
|
153
|
-
* ```
|
|
90
|
+
* @deprecated Use `createGeoClient({ network: GeoTestnetConfig }).daoSpaces.create(...)` for the workflow, or keep
|
|
91
|
+
* this helper temporarily for legacy calldata compatibility.
|
|
154
92
|
*/
|
|
155
93
|
export declare function getCreateDaoSpaceCalldata(args: CreateDaoSpaceCalldataParams): `0x${string}`;
|
|
156
|
-
export {};
|
|
157
94
|
//# sourceMappingURL=get-create-dao-space-calldata.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-create-dao-space-calldata.d.ts","sourceRoot":"","sources":["../../../src/encodings/get-create-dao-space-calldata.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-create-dao-space-calldata.d.ts","sourceRoot":"","sources":["../../../src/encodings/get-create-dao-space-calldata.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,eAAO,MAAM,UAAU,QAAe,CAAC;AAEvC,iFAAiF;AACjF,eAAO,MAAM,uBAAuB,QAAa,CAAC;AAElD,sCAAsC;AACtC,eAAO,MAAM,4BAA4B,QAAc,CAAC;AAExD,wFAAwF;AACxF,eAAO,MAAM,8BAA8B,QAAkB,CAAC;AAE9D,6CAA6C;AAC7C,eAAO,MAAM,mCAAmC,QAAS,C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CAAC;IACpC,wGAAwG;IACxG,qBAAqB,EAAE,KAAK,MAAM,EAAE,EAAE,CAAC;IACvC,+FAA+F;IAC/F,qBAAqB,EAAE,KAAK,MAAM,EAAE,EAAE,CAAC;IACvC,gEAAgE;IAChE,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,6FAA6F;IAC7F,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,4BAA4B,GAAG,KAAK,MAAM,EAAE,CAiD3F"}
|
|
@@ -1,86 +1,67 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { encodeFunctionData, toHex } from 'viem';
|
|
2
2
|
import { DaoSpaceFactoryAbi } from '../abis/index.js';
|
|
3
|
-
// Contract constants from DAOSpace.sol
|
|
4
3
|
/**
|
|
5
4
|
* The base value for percentage ratios in the contract.
|
|
6
5
|
* 100% = 10e6 (10,000,000), so 50% = 5e6 (5,000,000)
|
|
7
6
|
*/
|
|
8
7
|
export const RATIO_BASE = BigInt(10e6);
|
|
9
|
-
/** Minimum voting duration in seconds
|
|
10
|
-
export const MINIMUM_VOTING_DURATION = BigInt(
|
|
8
|
+
/** Minimum voting duration in seconds, matching the contracts v2 lower bound. */
|
|
9
|
+
export const MINIMUM_VOTING_DURATION = BigInt(60);
|
|
11
10
|
/** Minimum voting duration in days */
|
|
12
|
-
export const MINIMUM_VOTING_DURATION_DAYS =
|
|
11
|
+
export const MINIMUM_VOTING_DURATION_DAYS = 1 / 24 / 60;
|
|
12
|
+
/** Minimum execution grace period in seconds, matching the contracts v2 lower bound. */
|
|
13
|
+
export const MINIMUM_EXECUTION_GRACE_PERIOD = BigInt(60 * 60);
|
|
14
|
+
/** Minimum execution grace period in days */
|
|
15
|
+
export const MINIMUM_EXECUTION_GRACE_PERIOD_DAYS = 1 / 24;
|
|
16
|
+
/**
|
|
17
|
+
* Sensible user-friendly defaults for contracts v2 DAO spaces.
|
|
18
|
+
*/
|
|
19
|
+
export const DEFAULT_VOTING_SETTINGS = {
|
|
20
|
+
partialPercentageSupportThreshold: 50,
|
|
21
|
+
universalPercentageSupportThreshold: 90,
|
|
22
|
+
flatSupportThreshold: 1,
|
|
23
|
+
quorum: 1,
|
|
24
|
+
durationInDays: 2,
|
|
25
|
+
disableFastPathAccessForNewMembers: true,
|
|
26
|
+
executionGracePeriodInDays: 14,
|
|
27
|
+
};
|
|
13
28
|
/**
|
|
14
29
|
* Convert a percentage (0-100) to the contract's ratio format.
|
|
15
|
-
*
|
|
16
|
-
* @param percentage - A number between 0 and 100
|
|
17
|
-
* @returns The ratio value used by the contract (where 10e6 = 100%)
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```ts
|
|
21
|
-
* percentageToRatio(100) // 10000000n (100%)
|
|
22
|
-
* percentageToRatio(50) // 5000000n (50%)
|
|
23
|
-
* percentageToRatio(0) // 0n (0%)
|
|
24
|
-
* ```
|
|
25
30
|
*/
|
|
26
31
|
export function percentageToRatio(percentage) {
|
|
27
32
|
return BigInt(Math.floor((percentage * 10e6) / 100));
|
|
28
33
|
}
|
|
29
34
|
/**
|
|
30
35
|
* Convert days to seconds.
|
|
31
|
-
*
|
|
32
|
-
* @param days - Number of days
|
|
33
|
-
* @returns The equivalent duration in seconds as a bigint
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* ```ts
|
|
37
|
-
* daysToSeconds(1) // 86400n
|
|
38
|
-
* daysToSeconds(7) // 604800n
|
|
39
|
-
* ```
|
|
40
36
|
*/
|
|
41
37
|
export function daysToSeconds(days) {
|
|
42
38
|
return BigInt(Math.floor(days * 24 * 60 * 60));
|
|
43
39
|
}
|
|
44
40
|
/**
|
|
45
41
|
* Convert user-friendly voting settings to contract format.
|
|
46
|
-
*
|
|
47
|
-
* @param input - User-friendly voting settings with percentages and days
|
|
48
|
-
* @returns Contract-level voting settings with bigint values
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* ```ts
|
|
52
|
-
* const contractSettings = toContractVotingSettings({
|
|
53
|
-
* slowPathPercentageThreshold: 50, // 50%
|
|
54
|
-
* fastPathFlatThreshold: 3, // 3 editors
|
|
55
|
-
* quorum: 2, // 2 editors minimum
|
|
56
|
-
* durationInDays: 7, // 7 days
|
|
57
|
-
* });
|
|
58
|
-
* // Returns: { slowPathPercentageThreshold: 5000000n, fastPathFlatThreshold: 3n, quorum: 2n, duration: 604800n }
|
|
59
|
-
* ```
|
|
60
42
|
*/
|
|
61
43
|
export function toContractVotingSettings(input) {
|
|
62
44
|
return {
|
|
63
|
-
|
|
64
|
-
|
|
45
|
+
partialPercentageSupportThreshold: percentageToRatio(input.partialPercentageSupportThreshold),
|
|
46
|
+
universalPercentageSupportThreshold: percentageToRatio(input.universalPercentageSupportThreshold),
|
|
47
|
+
flatSupportThreshold: BigInt(input.flatSupportThreshold),
|
|
65
48
|
quorum: BigInt(input.quorum),
|
|
66
49
|
duration: daysToSeconds(input.durationInDays),
|
|
50
|
+
disableFastPathAccessForNewMembers: input.disableFastPathAccessForNewMembers,
|
|
51
|
+
executionGracePeriod: daysToSeconds(input.executionGracePeriodInDays),
|
|
67
52
|
};
|
|
68
53
|
}
|
|
69
54
|
/**
|
|
70
55
|
* Validate an IPFS URI format.
|
|
71
|
-
*
|
|
72
|
-
* @param uri - The URI to validate
|
|
73
|
-
* @returns Error message if invalid, null if valid
|
|
74
56
|
*/
|
|
75
57
|
export function validateIpfsUri(uri) {
|
|
76
58
|
if (!uri.startsWith('ipfs://')) {
|
|
77
59
|
return 'IPFS URI must start with "ipfs://"';
|
|
78
60
|
}
|
|
79
|
-
const cid = uri.slice(7);
|
|
61
|
+
const cid = uri.slice(7);
|
|
80
62
|
if (cid.length === 0) {
|
|
81
63
|
return 'IPFS URI must contain a CID after "ipfs://"';
|
|
82
64
|
}
|
|
83
|
-
// CIDv0 starts with Qm (46 chars), CIDv1 starts with bafy (59 chars for base32)
|
|
84
65
|
const isValidCidV0 = /^Qm[1-9A-HJ-NP-Za-km-z]{44}$/.test(cid);
|
|
85
66
|
const isValidCidV1 = /^b[a-z2-7]{58,}$/.test(cid);
|
|
86
67
|
if (!isValidCidV0 && !isValidCidV1) {
|
|
@@ -88,78 +69,55 @@ export function validateIpfsUri(uri) {
|
|
|
88
69
|
}
|
|
89
70
|
return null;
|
|
90
71
|
}
|
|
72
|
+
function isNonNegativeInteger(value) {
|
|
73
|
+
return Number.isInteger(value) && value >= 0;
|
|
74
|
+
}
|
|
91
75
|
/**
|
|
92
76
|
* Validate voting settings input.
|
|
93
77
|
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* ```ts
|
|
100
|
-
* const error = validateVotingSettingsInput(
|
|
101
|
-
* { slowPathPercentageThreshold: 50, fastPathFlatThreshold: 3, quorum: 2, durationInDays: 7 },
|
|
102
|
-
* 5 // total editors
|
|
103
|
-
* );
|
|
104
|
-
* if (error) {
|
|
105
|
-
* console.error(error);
|
|
106
|
-
* }
|
|
107
|
-
* ```
|
|
78
|
+
* When `totalEditors` is provided, the flat support threshold and quorum are
|
|
79
|
+
* also checked against that known editor count. For existing DAO spaces the
|
|
80
|
+
* current editor count may be unknown client-side, so callers can omit it and
|
|
81
|
+
* still get deterministic local validation for numeric shape, percentages, and
|
|
82
|
+
* duration lower bounds before the contract enforces editor-count limits.
|
|
108
83
|
*/
|
|
109
84
|
export function validateVotingSettingsInput(settings, totalEditors) {
|
|
110
|
-
if (
|
|
111
|
-
|
|
85
|
+
if (!Number.isFinite(settings.partialPercentageSupportThreshold) ||
|
|
86
|
+
settings.partialPercentageSupportThreshold < 0 ||
|
|
87
|
+
settings.partialPercentageSupportThreshold > 100) {
|
|
88
|
+
return 'partialPercentageSupportThreshold must be between 0 and 100';
|
|
89
|
+
}
|
|
90
|
+
if (!Number.isFinite(settings.universalPercentageSupportThreshold) ||
|
|
91
|
+
settings.universalPercentageSupportThreshold < 0 ||
|
|
92
|
+
settings.universalPercentageSupportThreshold > 100) {
|
|
93
|
+
return 'universalPercentageSupportThreshold must be between 0 and 100';
|
|
94
|
+
}
|
|
95
|
+
if (!isNonNegativeInteger(settings.flatSupportThreshold)) {
|
|
96
|
+
return 'flatSupportThreshold must be a non-negative integer';
|
|
112
97
|
}
|
|
113
|
-
if (
|
|
114
|
-
return `
|
|
98
|
+
if (totalEditors !== undefined && settings.flatSupportThreshold > totalEditors) {
|
|
99
|
+
return `flatSupportThreshold must be between 0 and ${totalEditors} (number of initial editors)`;
|
|
115
100
|
}
|
|
116
|
-
if (settings.quorum
|
|
101
|
+
if (!isNonNegativeInteger(settings.quorum)) {
|
|
102
|
+
return 'quorum must be a non-negative integer';
|
|
103
|
+
}
|
|
104
|
+
if (totalEditors !== undefined && settings.quorum > totalEditors) {
|
|
117
105
|
return `quorum must be between 0 and ${totalEditors} (number of initial editors)`;
|
|
118
106
|
}
|
|
119
|
-
if (settings.durationInDays < MINIMUM_VOTING_DURATION_DAYS) {
|
|
107
|
+
if (!Number.isFinite(settings.durationInDays) || settings.durationInDays < MINIMUM_VOTING_DURATION_DAYS) {
|
|
120
108
|
return `durationInDays must be at least ${MINIMUM_VOTING_DURATION_DAYS} days`;
|
|
121
109
|
}
|
|
110
|
+
if (!Number.isFinite(settings.executionGracePeriodInDays) ||
|
|
111
|
+
settings.executionGracePeriodInDays < MINIMUM_EXECUTION_GRACE_PERIOD_DAYS) {
|
|
112
|
+
return `executionGracePeriodInDays must be at least ${MINIMUM_EXECUTION_GRACE_PERIOD_DAYS} days`;
|
|
113
|
+
}
|
|
122
114
|
return null;
|
|
123
115
|
}
|
|
124
116
|
/**
|
|
125
117
|
* Get the calldata for creating a DAO space proxy.
|
|
126
118
|
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
* @param args - The parameters for creating the DAO space
|
|
131
|
-
* @returns Encoded calldata for the transaction
|
|
132
|
-
* @throws Error if validation fails (e.g., no editors, invalid voting settings)
|
|
133
|
-
*
|
|
134
|
-
* @example
|
|
135
|
-
* ```ts
|
|
136
|
-
* import { getCreateDaoSpaceCalldata, TESTNET } from '@geoprotocol/geo-sdk';
|
|
137
|
-
* import { createWalletClient, http } from 'viem';
|
|
138
|
-
*
|
|
139
|
-
* const calldata = getCreateDaoSpaceCalldata({
|
|
140
|
-
* votingSettings: {
|
|
141
|
-
* slowPathPercentageThreshold: 50, // 50% approval needed
|
|
142
|
-
* fastPathFlatThreshold: 3, // 3 editors for fast path
|
|
143
|
-
* quorum: 2, // minimum 2 editors must vote
|
|
144
|
-
* durationInDays: 7, // 7 day voting period
|
|
145
|
-
* },
|
|
146
|
-
* initialEditorSpaceIds: ['0x01234567890abcdef01234567890abcd', '0x56789abcdef01234567890abcdef0123'],
|
|
147
|
-
* initialMemberSpaceIds: ['0xabcdef01234567890abcdef012345678'],
|
|
148
|
-
* });
|
|
149
|
-
*
|
|
150
|
-
* // Using viem
|
|
151
|
-
* const hash = await walletClient.sendTransaction({
|
|
152
|
-
* to: TESTNET.DAO_SPACE_FACTORY_ADDRESS,
|
|
153
|
-
* data: calldata,
|
|
154
|
-
* });
|
|
155
|
-
*
|
|
156
|
-
* // Using wagmi
|
|
157
|
-
* const { sendTransaction } = useSendTransaction();
|
|
158
|
-
* sendTransaction({
|
|
159
|
-
* to: TESTNET.DAO_SPACE_FACTORY_ADDRESS,
|
|
160
|
-
* data: calldata,
|
|
161
|
-
* });
|
|
162
|
-
* ```
|
|
119
|
+
* @deprecated Use `createGeoClient({ network: GeoTestnetConfig }).daoSpaces.create(...)` for the workflow, or keep
|
|
120
|
+
* this helper temporarily for legacy calldata compatibility.
|
|
163
121
|
*/
|
|
164
122
|
export function getCreateDaoSpaceCalldata(args) {
|
|
165
123
|
const initialEditorSpaceIds = args.initialEditorSpaceIds;
|
|
@@ -178,13 +136,10 @@ export function getCreateDaoSpaceCalldata(args) {
|
|
|
178
136
|
if (ipfsError) {
|
|
179
137
|
throw new Error(ipfsError);
|
|
180
138
|
}
|
|
181
|
-
|
|
182
|
-
initialEditsContentUri = encodeAbiParameters([{ type: 'string' }], [args.initialEditsContentUri]);
|
|
139
|
+
initialEditsContentUri = toHex(args.initialEditsContentUri);
|
|
183
140
|
}
|
|
184
|
-
// Convert UUID to bytes16 hex if provided
|
|
185
141
|
let initialTopicId = '0x00000000000000000000000000000000';
|
|
186
142
|
if (args.initialTopicId) {
|
|
187
|
-
// Remove dashes from UUID and add 0x prefix
|
|
188
143
|
initialTopicId = `0x${args.initialTopicId.replace(/-/g, '')}`;
|
|
189
144
|
}
|
|
190
145
|
return encodeFunctionData({
|
|
@@ -192,17 +147,19 @@ export function getCreateDaoSpaceCalldata(args) {
|
|
|
192
147
|
functionName: 'createDAOSpaceProxy',
|
|
193
148
|
args: [
|
|
194
149
|
{
|
|
195
|
-
|
|
196
|
-
|
|
150
|
+
partialPercentageSupportThreshold: contractVotingSettings.partialPercentageSupportThreshold,
|
|
151
|
+
universalPercentageSupportThreshold: contractVotingSettings.universalPercentageSupportThreshold,
|
|
152
|
+
flatSupportThreshold: contractVotingSettings.flatSupportThreshold,
|
|
197
153
|
quorum: contractVotingSettings.quorum,
|
|
198
154
|
duration: contractVotingSettings.duration,
|
|
155
|
+
disableFastPathAccessForNewMembers: contractVotingSettings.disableFastPathAccessForNewMembers,
|
|
156
|
+
executionGracePeriod: contractVotingSettings.executionGracePeriod,
|
|
199
157
|
},
|
|
200
158
|
initialEditorSpaceIds,
|
|
201
159
|
initialMemberSpaceIds,
|
|
202
160
|
initialEditsContentUri,
|
|
203
|
-
'0x',
|
|
161
|
+
'0x',
|
|
204
162
|
initialTopicId,
|
|
205
|
-
'0x', // initialTopicData
|
|
206
163
|
],
|
|
207
164
|
});
|
|
208
165
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-create-dao-space-calldata.js","sourceRoot":"","sources":["../../../src/encodings/get-create-dao-space-calldata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"get-create-dao-space-calldata.js","sourceRoot":"","sources":["../../../src/encodings/get-create-dao-space-calldata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAEjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AAEvC,iFAAiF;AACjF,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AAElD,sCAAsC;AACtC,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;AAExD,wFAAwF;AACxF,MAAM,CAAC,MAAM,8BAA8B,GAAG,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;AAE9D,6CAA6C;AAC7C,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,GAAG,EAAE,CAAC;AAmC1D;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAwB;IAC1D,iCAAiC,EAAE,EAAE;IACrC,mCAAmC,EAAE,EAAE;IACvC,oBAAoB,EAAE,CAAC;IACvB,MAAM,EAAE,CAAC;IACT,cAAc,EAAE,CAAC;IACjB,kCAAkC,EAAE,IAAI;IACxC,0BAA0B,EAAE,EAAE;CAC/B,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAAkB;IAClD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;AACvD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AACjD,CA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