@geoprotocol/geo-sdk 0.18.2 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +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 +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- 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-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/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 +348 -0
- package/dist/src/client/dao-spaces.d.ts.map +1 -0
- package/dist/src/client/dao-spaces.js +494 -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 +263 -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 +155 -0
- package/dist/src/client/personal-spaces.d.ts.map +1 -0
- package/dist/src/client/personal-spaces.js +198 -0
- package/dist/src/client/personal-spaces.js.map +1 -0
- package/dist/src/client/proposals.d.ts +185 -0
- package/dist/src/client/proposals.d.ts.map +1 -0
- package/dist/src/client/proposals.js +294 -0
- package/dist/src/client/proposals.js.map +1 -0
- package/dist/src/client/proposals.test.d.ts +2 -0
- package/dist/src/client/proposals.test.d.ts.map +1 -0
- package/dist/src/client/proposals.test.js +243 -0
- package/dist/src/client/proposals.test.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 +155 -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 +325 -0
- package/dist/src/client.d.ts.map +1 -0
- package/dist/src/client.js +452 -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 +120 -0
- package/dist/src/client.test.js.map +1 -0
- package/dist/src/contracts-v2/abis.d.ts +196 -0
- package/dist/src/contracts-v2/abis.d.ts.map +1 -0
- package/dist/src/contracts-v2/abis.js +110 -0
- package/dist/src/contracts-v2/abis.js.map +1 -0
- package/dist/src/contracts-v2/actions.d.ts +56 -0
- package/dist/src/contracts-v2/actions.d.ts.map +1 -0
- package/dist/src/contracts-v2/actions.js +83 -0
- package/dist/src/contracts-v2/actions.js.map +1 -0
- package/dist/src/contracts-v2/encoding.d.ts +80 -0
- package/dist/src/contracts-v2/encoding.d.ts.map +1 -0
- package/dist/src/contracts-v2/encoding.js +193 -0
- package/dist/src/contracts-v2/encoding.js.map +1 -0
- package/dist/src/contracts-v2/encoding.test.d.ts +2 -0
- package/dist/src/contracts-v2/encoding.test.d.ts.map +1 -0
- package/dist/src/contracts-v2/encoding.test.js +93 -0
- package/dist/src/contracts-v2/encoding.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/contracts-v2/voting-settings.d.ts +48 -0
- package/dist/src/contracts-v2/voting-settings.d.ts.map +1 -0
- package/dist/src/contracts-v2/voting-settings.js +69 -0
- package/dist/src/contracts-v2/voting-settings.js.map +1 -0
- package/dist/src/dao-space/constants.d.ts +6 -3
- package/dist/src/dao-space/constants.d.ts.map +1 -1
- package/dist/src/dao-space/constants.js +6 -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/propose-add-editor.test.js +1 -1
- package/dist/src/dao-space/propose-add-editor.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 +8 -1
- package/dist/src/dao-space/propose-edit.test.js.map +1 -1
- package/dist/src/dao-space/propose-remove-editor.d.ts.map +1 -1
- package/dist/src/dao-space/propose-remove-editor.js +5 -5
- package/dist/src/dao-space/propose-remove-editor.js.map +1 -1
- package/dist/src/dao-space/propose-remove-editor.test.js +3 -8
- package/dist/src/dao-space/propose-remove-editor.test.js.map +1 -1
- package/dist/src/dao-space/propose-remove-member.d.ts.map +1 -1
- package/dist/src/dao-space/propose-remove-member.js +5 -5
- package/dist/src/dao-space/propose-remove-member.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/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/e2e/local-geobrowser.d.ts +9 -0
- package/dist/src/e2e/local-geobrowser.d.ts.map +1 -0
- package/dist/src/e2e/local-geobrowser.js +35 -0
- package/dist/src/e2e/local-geobrowser.js.map +1 -0
- package/dist/src/e2e/v2-contracts.test.d.ts +2 -0
- package/dist/src/e2e/v2-contracts.test.d.ts.map +1 -0
- package/dist/src/e2e/v2-contracts.test.js +25 -0
- package/dist/src/e2e/v2-contracts.test.js.map +1 -0
- package/dist/src/e2e-api-surface.test.d.ts +2 -0
- package/dist/src/e2e-api-surface.test.d.ts.map +1 -0
- package/dist/src/e2e-api-surface.test.js +1021 -0
- package/dist/src/e2e-api-surface.test.js.map +1 -0
- package/dist/src/e2e-flows.test.d.ts +2 -0
- package/dist/src/e2e-flows.test.d.ts.map +1 -0
- package/dist/src/e2e-flows.test.js +445 -0
- package/dist/src/e2e-flows.test.js.map +1 -0
- package/dist/src/e2e-legacy-api-surface.test.d.ts +2 -0
- package/dist/src/e2e-legacy-api-surface.test.d.ts.map +1 -0
- package/dist/src/e2e-legacy-api-surface.test.js +840 -0
- package/dist/src/e2e-legacy-api-surface.test.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 +3 -89
- package/dist/src/encodings/get-create-dao-space-calldata.d.ts.map +1 -1
- package/dist/src/encodings/get-create-dao-space-calldata.js +5 -95
- package/dist/src/encodings/get-create-dao-space-calldata.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/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 +37 -0
- package/dist/src/graph/entity-vote.d.ts.map +1 -0
- package/dist/src/graph/entity-vote.js +44 -0
- package/dist/src/graph/entity-vote.js.map +1 -0
- package/dist/src/graph/entity-vote.test.d.ts +2 -0
- package/dist/src/graph/entity-vote.test.d.ts.map +1 -0
- package/dist/src/graph/entity-vote.test.js +123 -0
- package/dist/src/graph/entity-vote.test.js.map +1 -0
- package/dist/src/graph/index.d.ts +1 -0
- package/dist/src/graph/index.d.ts.map +1 -1
- package/dist/src/graph/index.js +1 -0
- package/dist/src/graph/index.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/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/images.d.ts +37 -0
- package/dist/src/ops/images.d.ts.map +1 -0
- package/dist/src/ops/images.js +69 -0
- package/dist/src/ops/images.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 +1 -18
- package/dist/src/personal-space/create-space.d.ts.map +1 -1
- package/dist/src/personal-space/create-space.js +1 -18
- 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/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
|
@@ -0,0 +1,840 @@
|
|
|
1
|
+
import { createPublicClient, http } from 'viem';
|
|
2
|
+
import { privateKeyToAccount } from 'viem/accounts';
|
|
3
|
+
import { describe, expect, it } from 'vitest';
|
|
4
|
+
import { daoSpace, GeoTestnetConfig, Graph, getWalletClient, Ipfs, personalSpace } from '../index.js';
|
|
5
|
+
import { SpaceRegistryAbi } from './abis/index.js';
|
|
6
|
+
import { DESCRIPTION_PROPERTY, RELATION_TYPE, REPLY_TO_PROPERTY } from './core/ids/system.js';
|
|
7
|
+
import { deriveCommentName } from './graph/comment-utils.js';
|
|
8
|
+
import { toGrcId } from './id-utils.js';
|
|
9
|
+
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
|
|
10
|
+
const EMPTY_SPACE_ID = '0x00000000000000000000000000000000';
|
|
11
|
+
const INDEXER_TIMEOUT_MS = 120_000;
|
|
12
|
+
const TEST_TIMEOUT_MS = 600_000;
|
|
13
|
+
const replyToGrcId = toGrcId(REPLY_TO_PROPERTY);
|
|
14
|
+
function sleep(ms) {
|
|
15
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
16
|
+
}
|
|
17
|
+
function requireTestnetContract(name) {
|
|
18
|
+
const address = GeoTestnetConfig.contracts?.[name];
|
|
19
|
+
if (!address) {
|
|
20
|
+
throw new Error(`GeoTestnetConfig is missing ${name}`);
|
|
21
|
+
}
|
|
22
|
+
return address;
|
|
23
|
+
}
|
|
24
|
+
function requireTestnetRpcUrl() {
|
|
25
|
+
const rpcUrl = GeoTestnetConfig.chain?.rpcUrl;
|
|
26
|
+
if (!rpcUrl) {
|
|
27
|
+
throw new Error('GeoTestnetConfig is missing an RPC URL');
|
|
28
|
+
}
|
|
29
|
+
return rpcUrl;
|
|
30
|
+
}
|
|
31
|
+
function filterReplyToRelations(ops) {
|
|
32
|
+
return ops.filter((op) => op.type === 'createRelation' &&
|
|
33
|
+
'relationType' in op &&
|
|
34
|
+
op.relationType.every((b, i) => b === replyToGrcId[i]));
|
|
35
|
+
}
|
|
36
|
+
function hexToUuid(hex) {
|
|
37
|
+
return hex.slice(2, 34).toLowerCase();
|
|
38
|
+
}
|
|
39
|
+
function uniqueName(prefix) {
|
|
40
|
+
return `${prefix} ${Date.now().toString(36)}`;
|
|
41
|
+
}
|
|
42
|
+
function tinyPngBlob() {
|
|
43
|
+
return new Blob([
|
|
44
|
+
new Uint8Array([
|
|
45
|
+
137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 0, 1, 0, 0, 0, 1, 8, 6, 0, 0, 0, 31, 21,
|
|
46
|
+
196, 137, 0, 0, 0, 13, 73, 68, 65, 84, 120, 156, 99, 248, 255, 255, 63, 0, 5, 254, 2, 254, 167, 53, 129, 132, 0,
|
|
47
|
+
0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130,
|
|
48
|
+
]),
|
|
49
|
+
], { type: 'image/png' });
|
|
50
|
+
}
|
|
51
|
+
function entityQuery(id, spaceId) {
|
|
52
|
+
const normalizedSpaceId = spaceId.replaceAll('-', '');
|
|
53
|
+
return `query entity {
|
|
54
|
+
entity(id: ${JSON.stringify(id)}) {
|
|
55
|
+
id
|
|
56
|
+
name
|
|
57
|
+
valuesList(filter: { spaceId: { in: [${JSON.stringify(normalizedSpaceId)}] } }) {
|
|
58
|
+
propertyId
|
|
59
|
+
spaceId
|
|
60
|
+
}
|
|
61
|
+
relationsList(filter: { spaceId: { in: [${JSON.stringify(normalizedSpaceId)}] } }) {
|
|
62
|
+
id
|
|
63
|
+
spaceId
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}`;
|
|
67
|
+
}
|
|
68
|
+
function replyToRelationsQuery(id) {
|
|
69
|
+
return `query entity {
|
|
70
|
+
entity(id: ${JSON.stringify(id)}) {
|
|
71
|
+
relationsList(filter: { typeId: { in: [${JSON.stringify(REPLY_TO_PROPERTY)}] } }) {
|
|
72
|
+
toEntity { id }
|
|
73
|
+
toSpace { id }
|
|
74
|
+
position
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}`;
|
|
78
|
+
}
|
|
79
|
+
function proposalUuid(proposalId) {
|
|
80
|
+
return proposalId.replace(/^0x/, '').toLowerCase();
|
|
81
|
+
}
|
|
82
|
+
function proposalQuery(proposalId) {
|
|
83
|
+
const id = proposalUuid(proposalId);
|
|
84
|
+
return `query proposal {
|
|
85
|
+
proposals(condition: { id: ${JSON.stringify(id)} }) {
|
|
86
|
+
id
|
|
87
|
+
spaceId
|
|
88
|
+
proposedBy
|
|
89
|
+
votingMode
|
|
90
|
+
name
|
|
91
|
+
}
|
|
92
|
+
proposalActions(condition: { proposalId: ${JSON.stringify(id)} }) {
|
|
93
|
+
proposalId
|
|
94
|
+
actionType
|
|
95
|
+
targetId
|
|
96
|
+
contentUri
|
|
97
|
+
}
|
|
98
|
+
}`;
|
|
99
|
+
}
|
|
100
|
+
function proposalVoteQuery(proposalId, voterId, spaceId) {
|
|
101
|
+
return `query proposalVote {
|
|
102
|
+
proposalVotes(condition: {
|
|
103
|
+
proposalId: ${JSON.stringify(proposalUuid(proposalId))}
|
|
104
|
+
voterId: ${JSON.stringify(voterId.replaceAll('-', ''))}
|
|
105
|
+
spaceId: ${JSON.stringify(spaceId.replaceAll('-', ''))}
|
|
106
|
+
}) {
|
|
107
|
+
proposalId
|
|
108
|
+
voterId
|
|
109
|
+
spaceId
|
|
110
|
+
vote
|
|
111
|
+
}
|
|
112
|
+
}`;
|
|
113
|
+
}
|
|
114
|
+
function entityVoteQuery(entityId, voterId, spaceId) {
|
|
115
|
+
return `query entityVote {
|
|
116
|
+
votes(condition: {
|
|
117
|
+
voterId: ${JSON.stringify(voterId.replaceAll('-', ''))}
|
|
118
|
+
objectId: ${JSON.stringify(entityId.replaceAll('-', ''))}
|
|
119
|
+
objectType: 0
|
|
120
|
+
spaceId: ${JSON.stringify(spaceId.replaceAll('-', ''))}
|
|
121
|
+
}) {
|
|
122
|
+
voterId
|
|
123
|
+
objectId
|
|
124
|
+
objectType
|
|
125
|
+
spaceId
|
|
126
|
+
vote
|
|
127
|
+
}
|
|
128
|
+
}`;
|
|
129
|
+
}
|
|
130
|
+
async function queryGraph(query) {
|
|
131
|
+
const response = await fetch(`${GeoTestnetConfig.apiOrigin}/graphql`, {
|
|
132
|
+
method: 'POST',
|
|
133
|
+
headers: { 'Content-Type': 'application/json' },
|
|
134
|
+
body: JSON.stringify({ query }),
|
|
135
|
+
});
|
|
136
|
+
if (!response.ok) {
|
|
137
|
+
throw new Error(`GraphQL request failed: ${response.status} ${await response.text()}`);
|
|
138
|
+
}
|
|
139
|
+
const envelope = (await response.json());
|
|
140
|
+
if (envelope.errors) {
|
|
141
|
+
throw new Error(`GraphQL errors: ${JSON.stringify(envelope.errors)}`);
|
|
142
|
+
}
|
|
143
|
+
if (envelope.data === undefined) {
|
|
144
|
+
throw new Error('GraphQL response did not include data');
|
|
145
|
+
}
|
|
146
|
+
return envelope.data;
|
|
147
|
+
}
|
|
148
|
+
async function waitFor(label, read, predicate) {
|
|
149
|
+
const deadline = Date.now() + INDEXER_TIMEOUT_MS;
|
|
150
|
+
let lastValue;
|
|
151
|
+
let lastError;
|
|
152
|
+
while (Date.now() < deadline) {
|
|
153
|
+
try {
|
|
154
|
+
lastValue = await read();
|
|
155
|
+
lastError = undefined;
|
|
156
|
+
if (predicate(lastValue)) {
|
|
157
|
+
return lastValue;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
lastError = error;
|
|
162
|
+
}
|
|
163
|
+
await sleep(3_000);
|
|
164
|
+
}
|
|
165
|
+
throw new Error(`Timed out waiting for ${label}. Last value: ${JSON.stringify(lastValue)}. Last error: ${String(lastError)}`);
|
|
166
|
+
}
|
|
167
|
+
async function waitForEntityName(entityId, spaceId, expectedName) {
|
|
168
|
+
const data = await waitFor(`entity ${entityId} name "${expectedName}"`, () => queryGraph(entityQuery(entityId, spaceId)), value => value.entity?.name === expectedName);
|
|
169
|
+
expect(data.entity?.name).toBe(expectedName);
|
|
170
|
+
return data.entity;
|
|
171
|
+
}
|
|
172
|
+
async function waitForEntityDeleted(entityId, spaceId) {
|
|
173
|
+
await waitFor(`entity ${entityId} deletion in space ${spaceId}`, () => queryGraph(entityQuery(entityId, spaceId)), value => !value.entity || (value.entity.valuesList.length === 0 && value.entity.relationsList.length === 0));
|
|
174
|
+
}
|
|
175
|
+
async function waitForReplyToRelations(entityId, expectedTargets) {
|
|
176
|
+
const data = await waitFor(`reply-to relations for ${entityId}`, () => queryGraph(replyToRelationsQuery(entityId)), value => {
|
|
177
|
+
const targets = value.entity?.relationsList.map(relation => relation.toEntity.id) ?? [];
|
|
178
|
+
return expectedTargets.every(target => targets.includes(target));
|
|
179
|
+
});
|
|
180
|
+
const targets = data.entity?.relationsList.map(relation => relation.toEntity.id) ?? [];
|
|
181
|
+
expect(targets).toEqual(expect.arrayContaining(expectedTargets));
|
|
182
|
+
return data.entity?.relationsList ?? [];
|
|
183
|
+
}
|
|
184
|
+
async function waitForProposal(proposalId, expected) {
|
|
185
|
+
const data = await waitFor(`proposal ${proposalUuid(proposalId)}`, () => queryGraph(proposalQuery(proposalId)), value => {
|
|
186
|
+
const proposal = value.proposals[0];
|
|
187
|
+
if (!proposal)
|
|
188
|
+
return false;
|
|
189
|
+
if (proposal.spaceId !== expected.daoSpaceId.replaceAll('-', ''))
|
|
190
|
+
return false;
|
|
191
|
+
if (proposal.proposedBy !== expected.proposedBy.replaceAll('-', ''))
|
|
192
|
+
return false;
|
|
193
|
+
if (expected.votingMode && proposal.votingMode !== expected.votingMode)
|
|
194
|
+
return false;
|
|
195
|
+
if (!expected.actionType)
|
|
196
|
+
return true;
|
|
197
|
+
return value.proposalActions.some(action => action.actionType === expected.actionType &&
|
|
198
|
+
(expected.targetId === undefined ||
|
|
199
|
+
action.targetId === expected.targetId.replace(/^0x/, '').replaceAll('-', '')) &&
|
|
200
|
+
(expected.contentUri === undefined || action.contentUri === expected.contentUri));
|
|
201
|
+
});
|
|
202
|
+
expect(data.proposals[0]?.id).toBe(proposalUuid(proposalId));
|
|
203
|
+
if (expected.actionType) {
|
|
204
|
+
expect(data.proposalActions.map(action => action.actionType)).toContain(expected.actionType);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
async function waitForProposalVote(proposalId, voterId, daoSpaceId, vote) {
|
|
208
|
+
const data = await waitFor(`proposal ${proposalUuid(proposalId)} vote ${vote}`, () => queryGraph(proposalVoteQuery(proposalId, voterId, daoSpaceId)), value => value.proposalVotes.some(proposalVote => proposalVote.vote === vote));
|
|
209
|
+
expect(data.proposalVotes.map(proposalVote => proposalVote.vote)).toContain(vote);
|
|
210
|
+
}
|
|
211
|
+
async function waitForEntityVote(entityId, voterId, spaceId, predicate) {
|
|
212
|
+
const data = await waitFor(`entity vote for ${entityId}`, () => queryGraph(entityVoteQuery(entityId, voterId, spaceId)), value => predicate(value.votes));
|
|
213
|
+
expect(predicate(data.votes)).toBe(true);
|
|
214
|
+
}
|
|
215
|
+
async function getSpaceIdHex(publicClient, address) {
|
|
216
|
+
return (await publicClient.readContract({
|
|
217
|
+
address: requireTestnetContract('SPACE_REGISTRY_ADDRESS'),
|
|
218
|
+
abi: SpaceRegistryAbi,
|
|
219
|
+
functionName: 'addressToSpaceId',
|
|
220
|
+
args: [address],
|
|
221
|
+
}));
|
|
222
|
+
}
|
|
223
|
+
async function ensurePersonalSpace({ account, publicClient, walletClient }) {
|
|
224
|
+
let spaceIdHex = await getSpaceIdHex(publicClient, account.address);
|
|
225
|
+
const hasExistingSpace = await personalSpace.hasSpace({
|
|
226
|
+
address: account.address,
|
|
227
|
+
});
|
|
228
|
+
expect(hasExistingSpace).toBe(spaceIdHex.toLowerCase() !== EMPTY_SPACE_ID.toLowerCase());
|
|
229
|
+
if (spaceIdHex.toLowerCase() === EMPTY_SPACE_ID.toLowerCase()) {
|
|
230
|
+
const createSpace = personalSpace.createSpace();
|
|
231
|
+
await sendTransactionAndWait({ account, publicClient, walletClient }, {
|
|
232
|
+
label: 'legacy create personal space',
|
|
233
|
+
to: createSpace.to,
|
|
234
|
+
calldata: createSpace.calldata,
|
|
235
|
+
});
|
|
236
|
+
spaceIdHex = await getSpaceIdHex(publicClient, account.address);
|
|
237
|
+
}
|
|
238
|
+
if (spaceIdHex.toLowerCase() === EMPTY_SPACE_ID.toLowerCase()) {
|
|
239
|
+
throw new Error(`Failed to create personal space for address ${account.address}`);
|
|
240
|
+
}
|
|
241
|
+
return {
|
|
242
|
+
spaceIdHex,
|
|
243
|
+
spaceId: hexToUuid(spaceIdHex),
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
async function setupWallet() {
|
|
247
|
+
const privateKey = process.env.PRIVATE_KEY;
|
|
248
|
+
if (!privateKey) {
|
|
249
|
+
throw new Error('PRIVATE_KEY environment variable is required.');
|
|
250
|
+
}
|
|
251
|
+
if (!privateKey.startsWith('0x')) {
|
|
252
|
+
throw new Error('PRIVATE_KEY must be a hex string starting with 0x.');
|
|
253
|
+
}
|
|
254
|
+
const walletClient = await getWalletClient({
|
|
255
|
+
privateKey: privateKey,
|
|
256
|
+
rpcUrl: requireTestnetRpcUrl(),
|
|
257
|
+
});
|
|
258
|
+
const account = walletClient.account;
|
|
259
|
+
if (!account) {
|
|
260
|
+
throw new Error('Wallet client account is undefined');
|
|
261
|
+
}
|
|
262
|
+
expect(account.address).toBe(privateKeyToAccount(privateKey).address);
|
|
263
|
+
const publicClient = createPublicClient({
|
|
264
|
+
transport: http(requireTestnetRpcUrl()),
|
|
265
|
+
});
|
|
266
|
+
return { account, publicClient, walletClient };
|
|
267
|
+
}
|
|
268
|
+
async function sendTransactionAndWait({ account, publicClient, walletClient }, { label, to, calldata, value = 0n, }) {
|
|
269
|
+
const hash = await walletClient.sendTransaction({
|
|
270
|
+
account,
|
|
271
|
+
chain: walletClient.chain ?? null,
|
|
272
|
+
to,
|
|
273
|
+
value,
|
|
274
|
+
data: calldata,
|
|
275
|
+
});
|
|
276
|
+
const receipt = await publicClient.waitForTransactionReceipt({ hash });
|
|
277
|
+
expect(receipt.status, `${label} transaction ${hash}`).toBe('success');
|
|
278
|
+
return { hash, receipt };
|
|
279
|
+
}
|
|
280
|
+
let contextPromise;
|
|
281
|
+
let daoContextPromise;
|
|
282
|
+
async function getTestContext() {
|
|
283
|
+
contextPromise ??= (async () => {
|
|
284
|
+
const wallet = await setupWallet();
|
|
285
|
+
const { spaceId, spaceIdHex } = await ensurePersonalSpace(wallet);
|
|
286
|
+
return {
|
|
287
|
+
...wallet,
|
|
288
|
+
spaceId,
|
|
289
|
+
spaceIdHex,
|
|
290
|
+
};
|
|
291
|
+
})();
|
|
292
|
+
return contextPromise;
|
|
293
|
+
}
|
|
294
|
+
async function publishOps(context, name, ops, spaceId = context.spaceId) {
|
|
295
|
+
const publish = await personalSpace.publishEdit({
|
|
296
|
+
name,
|
|
297
|
+
spaceId,
|
|
298
|
+
author: context.spaceId,
|
|
299
|
+
ops,
|
|
300
|
+
network: 'TESTNET',
|
|
301
|
+
});
|
|
302
|
+
await sendTransactionAndWait(context, {
|
|
303
|
+
label: name,
|
|
304
|
+
to: publish.to,
|
|
305
|
+
calldata: publish.calldata,
|
|
306
|
+
});
|
|
307
|
+
return publish;
|
|
308
|
+
}
|
|
309
|
+
async function createIndexedEntity(context, name = uniqueName('E2E Legacy Entity')) {
|
|
310
|
+
const entity = Graph.createEntity({ name });
|
|
311
|
+
await publishOps(context, `Publish ${name}`, entity.ops);
|
|
312
|
+
await waitForEntityName(entity.id, context.spaceId, name);
|
|
313
|
+
return entity;
|
|
314
|
+
}
|
|
315
|
+
async function getDaoContext() {
|
|
316
|
+
daoContextPromise ??= (async () => {
|
|
317
|
+
const context = await getTestContext();
|
|
318
|
+
const daoName = uniqueName('E2E Legacy DAO Space');
|
|
319
|
+
const createdDaoSpace = await daoSpace.createSpace({
|
|
320
|
+
name: daoName,
|
|
321
|
+
votingSettings: {
|
|
322
|
+
slowPathPercentageThreshold: 50,
|
|
323
|
+
fastPathFlatThreshold: 1,
|
|
324
|
+
quorum: 1,
|
|
325
|
+
durationInDays: 2,
|
|
326
|
+
},
|
|
327
|
+
initialEditorSpaceIds: [context.spaceIdHex],
|
|
328
|
+
author: context.spaceId,
|
|
329
|
+
network: 'TESTNET',
|
|
330
|
+
});
|
|
331
|
+
const daoCreateTx = await sendTransactionAndWait(context, {
|
|
332
|
+
label: 'create legacy API DAO space',
|
|
333
|
+
to: createdDaoSpace.to,
|
|
334
|
+
calldata: createdDaoSpace.calldata,
|
|
335
|
+
});
|
|
336
|
+
const daoSpaceAddress = daoCreateTx.receipt.logs.find(log => log.address.toLowerCase() !== createdDaoSpace.to.toLowerCase())?.address;
|
|
337
|
+
if (!daoSpaceAddress) {
|
|
338
|
+
throw new Error('Could not find DAO space address in creation logs');
|
|
339
|
+
}
|
|
340
|
+
const daoSpaceIdHex = await getSpaceIdHex(context.publicClient, daoSpaceAddress);
|
|
341
|
+
expect(daoSpaceIdHex.toLowerCase()).not.toBe(EMPTY_SPACE_ID.toLowerCase());
|
|
342
|
+
const daoSpaceId = hexToUuid(daoSpaceIdHex);
|
|
343
|
+
await waitForEntityName(createdDaoSpace.spaceEntityId, daoSpaceId, daoName);
|
|
344
|
+
return {
|
|
345
|
+
...context,
|
|
346
|
+
daoSpaceAddress,
|
|
347
|
+
daoSpaceId,
|
|
348
|
+
daoSpaceIdHex,
|
|
349
|
+
};
|
|
350
|
+
})();
|
|
351
|
+
return daoContextPromise;
|
|
352
|
+
}
|
|
353
|
+
async function createLegacyAddMemberProposal(context, label) {
|
|
354
|
+
const proposal = daoSpace.proposeAddMember({
|
|
355
|
+
authorSpaceId: context.spaceIdHex,
|
|
356
|
+
spaceId: context.daoSpaceIdHex,
|
|
357
|
+
newMemberSpaceId: context.spaceIdHex,
|
|
358
|
+
network: 'TESTNET',
|
|
359
|
+
});
|
|
360
|
+
await sendTransactionAndWait(context, {
|
|
361
|
+
label,
|
|
362
|
+
to: proposal.to,
|
|
363
|
+
calldata: proposal.calldata,
|
|
364
|
+
});
|
|
365
|
+
await waitForProposal(proposal.proposalId, {
|
|
366
|
+
daoSpaceId: context.daoSpaceId,
|
|
367
|
+
proposedBy: context.spaceId,
|
|
368
|
+
votingMode: 'SLOW',
|
|
369
|
+
});
|
|
370
|
+
return proposal;
|
|
371
|
+
}
|
|
372
|
+
describe.skip('legacy deprecated API e2e surface', () => {
|
|
373
|
+
// describe.sequential('legacy deprecated API e2e surface', () => {
|
|
374
|
+
it('personalSpace.hasSpace validates the account space onchain', async () => {
|
|
375
|
+
const context = await getTestContext();
|
|
376
|
+
const hasSpace = await personalSpace.hasSpace({
|
|
377
|
+
address: context.account.address,
|
|
378
|
+
});
|
|
379
|
+
expect(hasSpace).toBe(true);
|
|
380
|
+
const spaceAddress = (await context.publicClient.readContract({
|
|
381
|
+
address: requireTestnetContract('SPACE_REGISTRY_ADDRESS'),
|
|
382
|
+
abi: SpaceRegistryAbi,
|
|
383
|
+
functionName: 'spaceIdToAddress',
|
|
384
|
+
args: [context.spaceIdHex],
|
|
385
|
+
}));
|
|
386
|
+
expect(spaceAddress.toLowerCase()).not.toBe(ZERO_ADDRESS.toLowerCase());
|
|
387
|
+
}, TEST_TIMEOUT_MS);
|
|
388
|
+
it('Ipfs.uploadCSV uploads CSV data', async () => {
|
|
389
|
+
const csvCid = await Ipfs.uploadCSV(`name,run\nLegacy API surface,${Date.now().toString(36)}`, 'TESTNET');
|
|
390
|
+
expect(csvCid).toMatch(/^ipfs:\/\//);
|
|
391
|
+
}, TEST_TIMEOUT_MS);
|
|
392
|
+
it('Ipfs.uploadImage uploads an image and returns dimensions', async () => {
|
|
393
|
+
const uploadedImage = await Ipfs.uploadImage({ blob: tinyPngBlob() }, 'TESTNET', true);
|
|
394
|
+
expect(uploadedImage.cid).toMatch(/^ipfs:\/\//);
|
|
395
|
+
expect(uploadedImage.dimensions).toEqual({ width: 1, height: 1 });
|
|
396
|
+
}, TEST_TIMEOUT_MS);
|
|
397
|
+
it('Graph.createImage builds publishable image ops', async () => {
|
|
398
|
+
const context = await getTestContext();
|
|
399
|
+
const imageName = uniqueName('E2E Legacy Image');
|
|
400
|
+
const image = await Graph.createImage({
|
|
401
|
+
blob: tinyPngBlob(),
|
|
402
|
+
name: imageName,
|
|
403
|
+
description: 'Created by the legacy API e2e surface test',
|
|
404
|
+
network: 'TESTNET',
|
|
405
|
+
});
|
|
406
|
+
expect(image.cid).toMatch(/^ipfs:\/\//);
|
|
407
|
+
await publishOps(context, 'E2E legacy API image', image.ops);
|
|
408
|
+
await waitForEntityName(image.id, context.spaceId, imageName);
|
|
409
|
+
}, TEST_TIMEOUT_MS);
|
|
410
|
+
it('Ipfs.publishEdit uploads an edit payload', async () => {
|
|
411
|
+
const context = await getTestContext();
|
|
412
|
+
const entity = Graph.createEntity({
|
|
413
|
+
name: uniqueName('E2E Legacy Upload Only Entity'),
|
|
414
|
+
});
|
|
415
|
+
const edit = await Ipfs.publishEdit({
|
|
416
|
+
name: 'E2E legacy upload-only edit',
|
|
417
|
+
ops: entity.ops,
|
|
418
|
+
author: context.spaceId,
|
|
419
|
+
network: 'TESTNET',
|
|
420
|
+
});
|
|
421
|
+
expect(edit.cid).toMatch(/^ipfs:\/\//);
|
|
422
|
+
}, TEST_TIMEOUT_MS);
|
|
423
|
+
it('personalSpace.publishEdit publishes ops into an indexed personal space', async () => {
|
|
424
|
+
const context = await getTestContext();
|
|
425
|
+
const entityName = uniqueName('E2E Legacy Publish Edit Entity');
|
|
426
|
+
const entity = Graph.createEntity({ name: entityName });
|
|
427
|
+
await publishOps(context, 'E2E legacy personal publish', entity.ops);
|
|
428
|
+
await waitForEntityName(entity.id, context.spaceId, entityName);
|
|
429
|
+
}, TEST_TIMEOUT_MS);
|
|
430
|
+
it('Graph.createProperty creates an indexed property entity', async () => {
|
|
431
|
+
const context = await getTestContext();
|
|
432
|
+
const propertyName = uniqueName('E2E Legacy Property');
|
|
433
|
+
const property = Graph.createProperty({
|
|
434
|
+
name: propertyName,
|
|
435
|
+
dataType: 'TEXT',
|
|
436
|
+
});
|
|
437
|
+
await publishOps(context, 'E2E legacy property', property.ops);
|
|
438
|
+
await waitForEntityName(property.id, context.spaceId, propertyName);
|
|
439
|
+
}, TEST_TIMEOUT_MS);
|
|
440
|
+
it('Graph.createType creates an indexed type entity', async () => {
|
|
441
|
+
const context = await getTestContext();
|
|
442
|
+
const property = Graph.createProperty({
|
|
443
|
+
name: uniqueName('E2E Legacy Type Property'),
|
|
444
|
+
dataType: 'TEXT',
|
|
445
|
+
});
|
|
446
|
+
const typeName = uniqueName('E2E Legacy Type');
|
|
447
|
+
const type = Graph.createType({
|
|
448
|
+
name: typeName,
|
|
449
|
+
properties: [property.id],
|
|
450
|
+
});
|
|
451
|
+
await publishOps(context, 'E2E legacy type', [...property.ops, ...type.ops]);
|
|
452
|
+
await waitForEntityName(type.id, context.spaceId, typeName);
|
|
453
|
+
}, TEST_TIMEOUT_MS);
|
|
454
|
+
it('Graph.createEntity creates an indexed entity', async () => {
|
|
455
|
+
const context = await getTestContext();
|
|
456
|
+
const entityName = uniqueName('E2E Legacy Entity');
|
|
457
|
+
const entity = Graph.createEntity({
|
|
458
|
+
name: entityName,
|
|
459
|
+
description: 'Created through the legacy API e2e surface test',
|
|
460
|
+
});
|
|
461
|
+
await publishOps(context, 'E2E legacy entity', entity.ops);
|
|
462
|
+
await waitForEntityName(entity.id, context.spaceId, entityName);
|
|
463
|
+
}, TEST_TIMEOUT_MS);
|
|
464
|
+
it('Graph.updateEntity updates an indexed entity', async () => {
|
|
465
|
+
const context = await getTestContext();
|
|
466
|
+
const entity = await createIndexedEntity(context, uniqueName('E2E Legacy Entity To Update'));
|
|
467
|
+
const updatedName = `${entity.id} updated`;
|
|
468
|
+
const update = Graph.updateEntity({
|
|
469
|
+
id: entity.id,
|
|
470
|
+
name: updatedName,
|
|
471
|
+
unset: [{ property: DESCRIPTION_PROPERTY }],
|
|
472
|
+
});
|
|
473
|
+
await publishOps(context, 'E2E legacy entity update', update.ops);
|
|
474
|
+
await waitForEntityName(entity.id, context.spaceId, updatedName);
|
|
475
|
+
}, TEST_TIMEOUT_MS);
|
|
476
|
+
it('Graph.createRelation creates an indexed relation', async () => {
|
|
477
|
+
const context = await getTestContext();
|
|
478
|
+
const fromName = uniqueName('E2E Legacy Relation From');
|
|
479
|
+
const from = Graph.createEntity({ name: fromName });
|
|
480
|
+
const to = Graph.createEntity({
|
|
481
|
+
name: uniqueName('E2E Legacy Relation To'),
|
|
482
|
+
});
|
|
483
|
+
const relation = Graph.createRelation({
|
|
484
|
+
fromEntity: from.id,
|
|
485
|
+
toEntity: to.id,
|
|
486
|
+
type: RELATION_TYPE,
|
|
487
|
+
position: 'a0',
|
|
488
|
+
});
|
|
489
|
+
await publishOps(context, 'E2E legacy relation', [...from.ops, ...to.ops, ...relation.ops]);
|
|
490
|
+
const entity = await waitForEntityName(from.id, context.spaceId, fromName);
|
|
491
|
+
expect(entity?.relationsList.map(item => item.id)).toContain(relation.id);
|
|
492
|
+
}, TEST_TIMEOUT_MS);
|
|
493
|
+
it('Graph.updateRelation keeps an updated relation indexed', async () => {
|
|
494
|
+
const context = await getTestContext();
|
|
495
|
+
const fromName = uniqueName('E2E Legacy Relation Update From');
|
|
496
|
+
const from = Graph.createEntity({ name: fromName });
|
|
497
|
+
const to = Graph.createEntity({
|
|
498
|
+
name: uniqueName('E2E Legacy Relation Update To'),
|
|
499
|
+
});
|
|
500
|
+
const relation = Graph.createRelation({
|
|
501
|
+
fromEntity: from.id,
|
|
502
|
+
toEntity: to.id,
|
|
503
|
+
type: RELATION_TYPE,
|
|
504
|
+
position: 'a0',
|
|
505
|
+
});
|
|
506
|
+
const update = Graph.updateRelation({
|
|
507
|
+
id: relation.id,
|
|
508
|
+
position: 'a1',
|
|
509
|
+
});
|
|
510
|
+
await publishOps(context, 'E2E legacy relation update', [...from.ops, ...to.ops, ...relation.ops, ...update.ops]);
|
|
511
|
+
const entity = await waitForEntityName(from.id, context.spaceId, fromName);
|
|
512
|
+
expect(entity?.relationsList.map(item => item.id)).toContain(relation.id);
|
|
513
|
+
}, TEST_TIMEOUT_MS);
|
|
514
|
+
it('Graph.deleteRelation removes an indexed relation', async () => {
|
|
515
|
+
const context = await getTestContext();
|
|
516
|
+
const fromName = uniqueName('E2E Legacy Relation Delete From');
|
|
517
|
+
const from = Graph.createEntity({ name: fromName });
|
|
518
|
+
const to = Graph.createEntity({
|
|
519
|
+
name: uniqueName('E2E Legacy Relation Delete To'),
|
|
520
|
+
});
|
|
521
|
+
const relation = Graph.createRelation({
|
|
522
|
+
fromEntity: from.id,
|
|
523
|
+
toEntity: to.id,
|
|
524
|
+
type: RELATION_TYPE,
|
|
525
|
+
});
|
|
526
|
+
await publishOps(context, 'E2E legacy relation delete setup', [...from.ops, ...to.ops, ...relation.ops]);
|
|
527
|
+
await waitForEntityName(from.id, context.spaceId, fromName);
|
|
528
|
+
const deleteRelation = Graph.deleteRelation({ id: relation.id });
|
|
529
|
+
await publishOps(context, 'E2E legacy relation delete', deleteRelation.ops);
|
|
530
|
+
await waitFor(`relation ${relation.id} deletion`, () => queryGraph(entityQuery(from.id, context.spaceId)), value => !(value.entity?.relationsList ?? []).some(item => item.id === relation.id));
|
|
531
|
+
}, TEST_TIMEOUT_MS);
|
|
532
|
+
it('Graph.createProposalReview creates an indexed proposal review', async () => {
|
|
533
|
+
const context = await getTestContext();
|
|
534
|
+
const proposal = await createIndexedEntity(context, uniqueName('E2E Legacy Reviewed Proposal'));
|
|
535
|
+
const reviewName = uniqueName('E2E Legacy Proposal Review');
|
|
536
|
+
const review = Graph.createProposalReview({
|
|
537
|
+
proposal: { id: proposal.id, name: reviewName },
|
|
538
|
+
pass: true,
|
|
539
|
+
content: 'The proposal looks good.',
|
|
540
|
+
completeness: 1,
|
|
541
|
+
accuracy: 0.8,
|
|
542
|
+
skill: 0.8,
|
|
543
|
+
effort: 0.6,
|
|
544
|
+
});
|
|
545
|
+
await publishOps(context, 'E2E legacy proposal review', review.ops);
|
|
546
|
+
await waitForEntityName(review.id, context.spaceId, reviewName);
|
|
547
|
+
}, TEST_TIMEOUT_MS);
|
|
548
|
+
it('Graph.updateProposalReview updates an indexed proposal review', async () => {
|
|
549
|
+
const context = await getTestContext();
|
|
550
|
+
const proposal = await createIndexedEntity(context, uniqueName('E2E Legacy Reviewed Proposal Update'));
|
|
551
|
+
const reviewName = uniqueName('E2E Legacy Proposal Review Update');
|
|
552
|
+
const review = Graph.createProposalReview({
|
|
553
|
+
proposal: { id: proposal.id, name: reviewName },
|
|
554
|
+
pass: true,
|
|
555
|
+
content: 'The proposal looks good.',
|
|
556
|
+
});
|
|
557
|
+
await publishOps(context, 'E2E legacy proposal review setup', review.ops);
|
|
558
|
+
await waitForEntityName(review.id, context.spaceId, reviewName);
|
|
559
|
+
const update = Graph.updateProposalReview({
|
|
560
|
+
proposalReviewId: review.id,
|
|
561
|
+
pass: false,
|
|
562
|
+
content: 'Updated legacy review content.',
|
|
563
|
+
});
|
|
564
|
+
await publishOps(context, 'E2E legacy proposal review update', update.ops);
|
|
565
|
+
await waitForEntityName(review.id, context.spaceId, reviewName);
|
|
566
|
+
}, TEST_TIMEOUT_MS);
|
|
567
|
+
it('Graph.createComment creates indexed comments with reply-to chains', async () => {
|
|
568
|
+
const context = await getTestContext();
|
|
569
|
+
const entity = await createIndexedEntity(context, uniqueName('E2E Legacy Commented Entity'));
|
|
570
|
+
const commentAContent = 'Legacy API comment A on the entity';
|
|
571
|
+
const commentA = await Graph.createComment({
|
|
572
|
+
content: commentAContent,
|
|
573
|
+
replyTo: { entityId: entity.id, spaceId: context.spaceId },
|
|
574
|
+
network: 'TESTNET',
|
|
575
|
+
});
|
|
576
|
+
expect(filterReplyToRelations(commentA.ops)).toHaveLength(1);
|
|
577
|
+
await publishOps(context, 'E2E legacy comment A', commentA.ops);
|
|
578
|
+
await waitForEntityName(commentA.id, context.spaceId, deriveCommentName(commentAContent));
|
|
579
|
+
await waitForReplyToRelations(commentA.id, [entity.id]);
|
|
580
|
+
const commentBContent = 'Legacy API comment B on comment A';
|
|
581
|
+
const commentB = await Graph.createComment({
|
|
582
|
+
content: commentBContent,
|
|
583
|
+
replyTo: { entityId: commentA.id, spaceId: context.spaceId },
|
|
584
|
+
network: 'TESTNET',
|
|
585
|
+
});
|
|
586
|
+
expect(filterReplyToRelations(commentB.ops)).toHaveLength(2);
|
|
587
|
+
await publishOps(context, 'E2E legacy comment B', commentB.ops);
|
|
588
|
+
await waitForEntityName(commentB.id, context.spaceId, deriveCommentName(commentBContent));
|
|
589
|
+
await waitForReplyToRelations(commentB.id, [commentA.id, entity.id]);
|
|
590
|
+
}, TEST_TIMEOUT_MS);
|
|
591
|
+
it('Graph.updateComment updates an indexed comment', async () => {
|
|
592
|
+
const context = await getTestContext();
|
|
593
|
+
const entity = await createIndexedEntity(context, uniqueName('E2E Legacy Comment Update Entity'));
|
|
594
|
+
const comment = await Graph.createComment({
|
|
595
|
+
content: 'Legacy API comment before update',
|
|
596
|
+
replyTo: { entityId: entity.id, spaceId: context.spaceId },
|
|
597
|
+
network: 'TESTNET',
|
|
598
|
+
});
|
|
599
|
+
await publishOps(context, 'E2E legacy comment update setup', comment.ops);
|
|
600
|
+
await waitForEntityName(comment.id, context.spaceId, deriveCommentName('Legacy API comment before update'));
|
|
601
|
+
const updatedContent = 'Legacy API comment after update';
|
|
602
|
+
const update = Graph.updateComment({
|
|
603
|
+
id: comment.id,
|
|
604
|
+
content: updatedContent,
|
|
605
|
+
resolved: true,
|
|
606
|
+
});
|
|
607
|
+
await publishOps(context, 'E2E legacy comment update', update.ops);
|
|
608
|
+
await waitForEntityName(comment.id, context.spaceId, deriveCommentName(updatedContent));
|
|
609
|
+
}, TEST_TIMEOUT_MS);
|
|
610
|
+
it('Graph.deleteEntity removes indexed entity values and relations', async () => {
|
|
611
|
+
const context = await getTestContext();
|
|
612
|
+
const related = await createIndexedEntity(context, uniqueName('E2E Legacy Delete Related Entity'));
|
|
613
|
+
const deleteContextName = uniqueName('E2E Legacy Entity To Delete');
|
|
614
|
+
const deleteContextEntity = Graph.createEntity({
|
|
615
|
+
name: deleteContextName,
|
|
616
|
+
});
|
|
617
|
+
const deleteContextRelation = Graph.createRelation({
|
|
618
|
+
fromEntity: deleteContextEntity.id,
|
|
619
|
+
toEntity: related.id,
|
|
620
|
+
type: RELATION_TYPE,
|
|
621
|
+
});
|
|
622
|
+
await publishOps(context, 'E2E legacy create entity for deletion', [
|
|
623
|
+
...deleteContextEntity.ops,
|
|
624
|
+
...deleteContextRelation.ops,
|
|
625
|
+
]);
|
|
626
|
+
await waitForEntityName(deleteContextEntity.id, context.spaceId, deleteContextName);
|
|
627
|
+
const deleteResult = await Graph.deleteEntity({
|
|
628
|
+
id: deleteContextEntity.id,
|
|
629
|
+
spaceId: context.spaceId,
|
|
630
|
+
network: 'TESTNET',
|
|
631
|
+
});
|
|
632
|
+
expect(deleteResult.ops.length).toBeGreaterThan(0);
|
|
633
|
+
await publishOps(context, 'E2E legacy delete entity', deleteResult.ops);
|
|
634
|
+
await waitForEntityDeleted(deleteContextEntity.id, context.spaceId);
|
|
635
|
+
}, TEST_TIMEOUT_MS);
|
|
636
|
+
it('Graph.upvoteEntity submits and indexes an upvote', async () => {
|
|
637
|
+
const context = await getTestContext();
|
|
638
|
+
const entity = await createIndexedEntity(context, uniqueName('E2E Legacy Upvoted Entity'));
|
|
639
|
+
const upvote = Graph.upvoteEntity({
|
|
640
|
+
authorSpaceId: context.spaceId,
|
|
641
|
+
spaceId: context.spaceId,
|
|
642
|
+
entityId: entity.id,
|
|
643
|
+
network: 'TESTNET',
|
|
644
|
+
});
|
|
645
|
+
await sendTransactionAndWait(context, {
|
|
646
|
+
label: 'E2E legacy upvote entity',
|
|
647
|
+
to: upvote.to,
|
|
648
|
+
calldata: upvote.calldata,
|
|
649
|
+
});
|
|
650
|
+
await waitForEntityVote(entity.id, context.spaceId, context.spaceId, votes => votes.some(vote => vote.vote === 0));
|
|
651
|
+
}, TEST_TIMEOUT_MS);
|
|
652
|
+
it('Graph.downvoteEntity submits and indexes a downvote', async () => {
|
|
653
|
+
const context = await getTestContext();
|
|
654
|
+
const entity = await createIndexedEntity(context, uniqueName('E2E Legacy Downvoted Entity'));
|
|
655
|
+
const downvote = Graph.downvoteEntity({
|
|
656
|
+
authorSpaceId: context.spaceId,
|
|
657
|
+
spaceId: context.spaceId,
|
|
658
|
+
entityId: entity.id,
|
|
659
|
+
network: 'TESTNET',
|
|
660
|
+
});
|
|
661
|
+
await sendTransactionAndWait(context, {
|
|
662
|
+
label: 'E2E legacy downvote entity',
|
|
663
|
+
to: downvote.to,
|
|
664
|
+
calldata: downvote.calldata,
|
|
665
|
+
});
|
|
666
|
+
await waitForEntityVote(entity.id, context.spaceId, context.spaceId, votes => votes.some(vote => vote.vote === 1));
|
|
667
|
+
}, TEST_TIMEOUT_MS);
|
|
668
|
+
it('Graph.withdrawEntityVote submits and indexes a vote withdrawal', async () => {
|
|
669
|
+
const context = await getTestContext();
|
|
670
|
+
const entity = await createIndexedEntity(context, uniqueName('E2E Legacy Vote Withdraw Entity'));
|
|
671
|
+
const upvote = Graph.upvoteEntity({
|
|
672
|
+
authorSpaceId: context.spaceId,
|
|
673
|
+
spaceId: context.spaceId,
|
|
674
|
+
entityId: entity.id,
|
|
675
|
+
network: 'TESTNET',
|
|
676
|
+
});
|
|
677
|
+
await sendTransactionAndWait(context, {
|
|
678
|
+
label: 'E2E legacy upvote before withdraw',
|
|
679
|
+
to: upvote.to,
|
|
680
|
+
calldata: upvote.calldata,
|
|
681
|
+
});
|
|
682
|
+
await waitForEntityVote(entity.id, context.spaceId, context.spaceId, votes => votes.length > 0);
|
|
683
|
+
const withdraw = Graph.withdrawEntityVote({
|
|
684
|
+
authorSpaceId: context.spaceId,
|
|
685
|
+
spaceId: context.spaceId,
|
|
686
|
+
entityId: entity.id,
|
|
687
|
+
network: 'TESTNET',
|
|
688
|
+
});
|
|
689
|
+
await sendTransactionAndWait(context, {
|
|
690
|
+
label: 'E2E legacy withdraw entity vote',
|
|
691
|
+
to: withdraw.to,
|
|
692
|
+
calldata: withdraw.calldata,
|
|
693
|
+
});
|
|
694
|
+
await waitForEntityVote(entity.id, context.spaceId, context.spaceId, votes => votes.some(vote => vote.vote === 2));
|
|
695
|
+
}, TEST_TIMEOUT_MS);
|
|
696
|
+
it('daoSpace.createSpace creates an indexed DAO space', async () => {
|
|
697
|
+
const dao = await getDaoContext();
|
|
698
|
+
expect(dao.daoSpaceAddress.toLowerCase()).not.toBe(ZERO_ADDRESS.toLowerCase());
|
|
699
|
+
expect(dao.daoSpaceIdHex.toLowerCase()).not.toBe(EMPTY_SPACE_ID.toLowerCase());
|
|
700
|
+
}, TEST_TIMEOUT_MS);
|
|
701
|
+
it('daoSpace.proposeEdit creates an indexed publish proposal', async () => {
|
|
702
|
+
const dao = await getDaoContext();
|
|
703
|
+
const daoEntity = Graph.createEntity({
|
|
704
|
+
name: uniqueName('E2E Legacy DAO Proposed Entity'),
|
|
705
|
+
});
|
|
706
|
+
const proposal = await daoSpace.proposeEdit({
|
|
707
|
+
name: 'E2E legacy API DAO propose edit',
|
|
708
|
+
ops: daoEntity.ops,
|
|
709
|
+
author: dao.spaceId,
|
|
710
|
+
daoSpaceAddress: dao.daoSpaceAddress,
|
|
711
|
+
callerSpaceId: dao.spaceIdHex,
|
|
712
|
+
daoSpaceId: dao.daoSpaceIdHex,
|
|
713
|
+
votingMode: 'FAST',
|
|
714
|
+
network: 'TESTNET',
|
|
715
|
+
});
|
|
716
|
+
await sendTransactionAndWait(dao, {
|
|
717
|
+
label: 'legacy API DAO propose edit',
|
|
718
|
+
to: proposal.to,
|
|
719
|
+
calldata: proposal.calldata,
|
|
720
|
+
});
|
|
721
|
+
await waitForProposal(proposal.proposalId, {
|
|
722
|
+
daoSpaceId: dao.daoSpaceId,
|
|
723
|
+
proposedBy: dao.spaceId,
|
|
724
|
+
votingMode: 'FAST',
|
|
725
|
+
actionType: 'PUBLISH',
|
|
726
|
+
contentUri: proposal.cid,
|
|
727
|
+
});
|
|
728
|
+
}, TEST_TIMEOUT_MS);
|
|
729
|
+
it('daoSpace.proposeAddMember creates an indexed add-member proposal', async () => {
|
|
730
|
+
const dao = await getDaoContext();
|
|
731
|
+
await createLegacyAddMemberProposal(dao, 'legacy API DAO propose add member');
|
|
732
|
+
}, TEST_TIMEOUT_MS);
|
|
733
|
+
it('daoSpace.proposeRemoveMember creates an indexed remove-member proposal', async () => {
|
|
734
|
+
const dao = await getDaoContext();
|
|
735
|
+
const proposal = daoSpace.proposeRemoveMember({
|
|
736
|
+
authorSpaceId: dao.spaceIdHex,
|
|
737
|
+
spaceId: dao.daoSpaceIdHex,
|
|
738
|
+
memberToRemoveSpaceId: dao.spaceIdHex,
|
|
739
|
+
network: 'TESTNET',
|
|
740
|
+
});
|
|
741
|
+
await sendTransactionAndWait(dao, {
|
|
742
|
+
label: 'legacy API DAO propose remove member',
|
|
743
|
+
to: proposal.to,
|
|
744
|
+
calldata: proposal.calldata,
|
|
745
|
+
});
|
|
746
|
+
await waitForProposal(proposal.proposalId, {
|
|
747
|
+
daoSpaceId: dao.daoSpaceId,
|
|
748
|
+
proposedBy: dao.spaceId,
|
|
749
|
+
votingMode: 'SLOW',
|
|
750
|
+
});
|
|
751
|
+
}, TEST_TIMEOUT_MS);
|
|
752
|
+
it('daoSpace.proposeAddEditor creates an indexed add-editor proposal', async () => {
|
|
753
|
+
const dao = await getDaoContext();
|
|
754
|
+
const proposal = daoSpace.proposeAddEditor({
|
|
755
|
+
authorSpaceId: dao.spaceIdHex,
|
|
756
|
+
spaceId: dao.daoSpaceIdHex,
|
|
757
|
+
newEditorSpaceId: dao.spaceIdHex,
|
|
758
|
+
network: 'TESTNET',
|
|
759
|
+
});
|
|
760
|
+
await sendTransactionAndWait(dao, {
|
|
761
|
+
label: 'legacy API DAO propose add editor',
|
|
762
|
+
to: proposal.to,
|
|
763
|
+
calldata: proposal.calldata,
|
|
764
|
+
});
|
|
765
|
+
await waitForProposal(proposal.proposalId, {
|
|
766
|
+
daoSpaceId: dao.daoSpaceId,
|
|
767
|
+
proposedBy: dao.spaceId,
|
|
768
|
+
votingMode: 'SLOW',
|
|
769
|
+
});
|
|
770
|
+
}, TEST_TIMEOUT_MS);
|
|
771
|
+
it('daoSpace.proposeRemoveEditor creates an indexed remove-editor proposal', async () => {
|
|
772
|
+
const dao = await getDaoContext();
|
|
773
|
+
const proposal = daoSpace.proposeRemoveEditor({
|
|
774
|
+
authorSpaceId: dao.spaceIdHex,
|
|
775
|
+
spaceId: dao.daoSpaceIdHex,
|
|
776
|
+
editorToRemoveSpaceId: dao.spaceIdHex,
|
|
777
|
+
network: 'TESTNET',
|
|
778
|
+
});
|
|
779
|
+
await sendTransactionAndWait(dao, {
|
|
780
|
+
label: 'legacy API DAO propose remove editor',
|
|
781
|
+
to: proposal.to,
|
|
782
|
+
calldata: proposal.calldata,
|
|
783
|
+
});
|
|
784
|
+
await waitForProposal(proposal.proposalId, {
|
|
785
|
+
daoSpaceId: dao.daoSpaceId,
|
|
786
|
+
proposedBy: dao.spaceId,
|
|
787
|
+
votingMode: 'SLOW',
|
|
788
|
+
});
|
|
789
|
+
}, TEST_TIMEOUT_MS);
|
|
790
|
+
it('daoSpace.proposeRequestMembership creates an indexed membership proposal', async () => {
|
|
791
|
+
const dao = await getDaoContext();
|
|
792
|
+
const proposal = daoSpace.proposeRequestMembership({
|
|
793
|
+
authorSpaceId: dao.spaceIdHex,
|
|
794
|
+
spaceId: dao.daoSpaceIdHex,
|
|
795
|
+
network: 'TESTNET',
|
|
796
|
+
});
|
|
797
|
+
await sendTransactionAndWait(dao, {
|
|
798
|
+
label: 'legacy API DAO propose request membership',
|
|
799
|
+
to: proposal.to,
|
|
800
|
+
calldata: proposal.calldata,
|
|
801
|
+
});
|
|
802
|
+
await waitForProposal(proposal.proposalId, {
|
|
803
|
+
daoSpaceId: dao.daoSpaceId,
|
|
804
|
+
proposedBy: dao.daoSpaceId,
|
|
805
|
+
votingMode: 'FAST',
|
|
806
|
+
actionType: 'ADD_MEMBER',
|
|
807
|
+
targetId: dao.spaceId,
|
|
808
|
+
});
|
|
809
|
+
}, TEST_TIMEOUT_MS);
|
|
810
|
+
it('daoSpace.voteProposal creates an indexed proposal vote', async () => {
|
|
811
|
+
const dao = await getDaoContext();
|
|
812
|
+
const proposal = await createLegacyAddMemberProposal(dao, 'legacy API DAO proposal for vote');
|
|
813
|
+
const vote = daoSpace.voteProposal({
|
|
814
|
+
authorSpaceId: dao.spaceIdHex,
|
|
815
|
+
spaceId: dao.daoSpaceIdHex,
|
|
816
|
+
proposalId: proposal.proposalId,
|
|
817
|
+
vote: 'YES',
|
|
818
|
+
network: 'TESTNET',
|
|
819
|
+
});
|
|
820
|
+
await sendTransactionAndWait(dao, {
|
|
821
|
+
label: 'legacy API DAO vote proposal',
|
|
822
|
+
to: vote.to,
|
|
823
|
+
calldata: vote.calldata,
|
|
824
|
+
});
|
|
825
|
+
await waitForProposalVote(proposal.proposalId, dao.spaceId, dao.daoSpaceId, 'YES');
|
|
826
|
+
}, TEST_TIMEOUT_MS);
|
|
827
|
+
it('daoSpace.executeProposal builds execute calldata for an indexed proposal', async () => {
|
|
828
|
+
const dao = await getDaoContext();
|
|
829
|
+
const proposal = await createLegacyAddMemberProposal(dao, 'legacy API DAO proposal for execute calldata');
|
|
830
|
+
const execute = daoSpace.executeProposal({
|
|
831
|
+
authorSpaceId: dao.spaceIdHex,
|
|
832
|
+
spaceId: dao.daoSpaceIdHex,
|
|
833
|
+
proposalId: proposal.proposalId,
|
|
834
|
+
network: 'TESTNET',
|
|
835
|
+
});
|
|
836
|
+
expect(execute.to).toBe(requireTestnetContract('SPACE_REGISTRY_ADDRESS'));
|
|
837
|
+
expect(execute.calldata).toMatch(/^0x[0-9a-fA-F]+$/);
|
|
838
|
+
}, TEST_TIMEOUT_MS);
|
|
839
|
+
});
|
|
840
|
+
//# sourceMappingURL=e2e-legacy-api-surface.test.js.map
|