Skip to content

Commit

Permalink
feat: new privacy type (#1087)
Browse files Browse the repository at this point in the history
* feat: Add new privacy type

* add privacy to update-proposal

* Update src/schemas/space.json

* Update test/examples/space.json

* add back blind

* add privacy on proposal or update-proposal
  • Loading branch information
ChaituVR authored Nov 29, 2024
1 parent 2c82f45 commit 592941a
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/schemas/proposal.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@
"type": "string",
"title": "app",
"maxLength": 128
},
"privacy": {
"type": "string",
"enum": ["", "shutter"]
}
},
"required": ["name", "body", "choices", "snapshot", "start", "end"],
Expand Down
2 changes: 1 addition & 1 deletion src/schemas/space.json
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@
},
"privacy": {
"type": "string",
"enum": ["", "shutter"]
"enum": ["", "shutter", "any"]
}
},
"additionalProperties": false
Expand Down
4 changes: 4 additions & 0 deletions src/schemas/update-proposal.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@
"metadata": {
"type": "object",
"title": "metadata"
},
"privacy": {
"type": "string",
"enum": ["", "shutter"]
}
},
"required": ["proposal", "name", "body", "discussion", "choices", "type", "metadata"],
Expand Down
4 changes: 3 additions & 1 deletion src/sign/hashedTypes.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,7 @@
"2ffbebcbd22ef48fd2f4a1182ff1feda7795b57689bd6f0dd73c89e925e7fefb": "profile",
"4288d50b713081aae77d60d596d75864bff7acf7791a00183401e58658ee9da5": "statement",
"d56782e3b50ac86c25ae292923da8c367e3c9e8e7ea9d8baa435051fe2f430fa": "proposal",
"df10a7eeabe19301d6018be8b6c5d13231320d7ece64d021043fa172b64f3796": "update-proposal"
"df10a7eeabe19301d6018be8b6c5d13231320d7ece64d021043fa172b64f3796": "update-proposal",
"beda1f464a6112f9ed6335c4614e32a97f0e18ef4ac10b4b1c8239c475f2d8e8": "proposal",
"ff74674f39ca59b60056ecddaada0cb513c4729e634e99cb778f53ee404ac806": "update-proposal"
}
2 changes: 2 additions & 0 deletions src/sign/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export default class Client {
) {
if (!message.discussion) message.discussion = '';
if (!message.app) message.app = '';
if (!message.privacy) message.privacy = '';
return await this.sign(web3, address, message, proposalTypes);
}

Expand All @@ -134,6 +135,7 @@ export default class Client {
address: string,
message: UpdateProposal
) {
if (!message.privacy) message.privacy = '';
return await this.sign(web3, address, message, updateProposalTypes);
}

Expand Down
6 changes: 5 additions & 1 deletion src/sign/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface Proposal {
title: string;
body: string;
discussion: string;
privacy?: string;
choices: string[];
labels?: string[];
start: number;
Expand All @@ -39,6 +40,7 @@ export interface UpdateProposal {
title: string;
body: string;
discussion: string;
privacy?: string;
choices: string[];
labels?: string[];
plugins: string;
Expand Down Expand Up @@ -150,6 +152,7 @@ export const proposalTypes = {
{ name: 'end', type: 'uint64' },
{ name: 'snapshot', type: 'uint64' },
{ name: 'plugins', type: 'string' },
{ name: 'privacy', type: 'string' },
{ name: 'app', type: 'string' }
]
};
Expand All @@ -166,7 +169,8 @@ export const updateProposalTypes = {
{ name: 'discussion', type: 'string' },
{ name: 'choices', type: 'string[]' },
{ name: 'labels', type: 'string[]' },
{ name: 'plugins', type: 'string' }
{ name: 'plugins', type: 'string' },
{ name: 'privacy', type: 'string' }
]
};

Expand Down
1 change: 1 addition & 0 deletions test/examples/proposal.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"end": 1620316800,
"snapshot": 12345167,
"discussion": "https://...",
"privacy": "shutter",
"metadata": {
"network": "1"
}
Expand Down
3 changes: 2 additions & 1 deletion test/examples/space.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"voting": {
"delay": 2592000,
"period": 15552000,
"quorum": 100
"quorum": 100,
"privacy": "any"
},
"treasuries": [
{
Expand Down

0 comments on commit 592941a

Please sign in to comment.