Skip to content

Commit e716ec1

Browse files
authored
feat(flag proposal): add actions for flagging proposals (#903)
* feat(flag proposal): add actions for flagging proposals * fix(sign): add timestamp to the message * fix(flag proposal): removes redundant adding timestamp check in function
1 parent 4e7b0e1 commit e716ec1

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@snapshot-labs/snapshot.js",
3-
"version": "0.6.2",
3+
"version": "0.6.3",
44
"repository": "snapshot-labs/snapshot.js",
55
"license": "MIT",
66
"main": "dist/snapshot.cjs.js",

src/sign/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
Space,
77
Proposal,
88
UpdateProposal,
9+
FlagProposal,
910
CancelProposal,
1011
Vote,
1112
Follow,
@@ -19,6 +20,7 @@ import {
1920
spaceTypes,
2021
proposalTypes,
2122
updateProposalTypes,
23+
flagProposalTypes,
2224
cancelProposalTypes,
2325
cancelProposal2Types,
2426
voteTypes,
@@ -121,6 +123,14 @@ export default class Client {
121123
return await this.sign(web3, address, message, updateProposalTypes);
122124
}
123125

126+
async flagProposal(
127+
web3: Web3Provider | Wallet,
128+
address: string,
129+
message: FlagProposal
130+
) {
131+
return await this.sign(web3, address, message, flagProposalTypes);
132+
}
133+
124134
async cancelProposal(
125135
web3: Web3Provider | Wallet,
126136
address: string,

src/sign/types.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"9ff8af4cfb586e2c7962d792b99328fb47e8a4e73cc89873c0980484bc1063a5": "delete-proposal",
66
"734df82cdad586386defa4cb55adda7cb1b2a56929c4e6c3dc676f9901947288": "delete-proposal",
77
"4e5fa89616761defa1274103441809c8445f8404306890ad36ec653d90201d58": "update-proposal",
8+
"4bbf83a627c4afc26a1b9490127c1712d844fb0806131ee9860e7b298b0a828e": "flag-proposal",
89
"50084aae0fe117c83ddf855557dde35ae2872e9045443a15f72aa6c68ea3943b": "vote",
910
"1dfe3863f6333a85581fb150d4ee77c95a6d026c518ca1b11c08ae1d98acd598": "vote-array",
1011
"1814c3dd303c5919ce488b924f92b9a42a0834972f514e55b1879fda48e67736": "vote-string",

src/sign/types.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ export interface UpdateProposal {
4242
plugins: string;
4343
}
4444

45+
export interface FlagProposal {
46+
from: string;
47+
space: string;
48+
proposal: string;
49+
timestamp?: number;
50+
}
51+
4552
export interface CancelProposal {
4653
from?: string;
4754
space: string;
@@ -154,6 +161,15 @@ export const updateProposalTypes = {
154161
]
155162
};
156163

164+
export const flagProposalTypes = {
165+
FlagProposal: [
166+
{ name: 'from', type: 'address' },
167+
{ name: 'space', type: 'string' },
168+
{ name: 'proposal', type: 'string' },
169+
{ name: 'timestamp', type: 'uint64' }
170+
]
171+
};
172+
157173
export const cancelProposalTypes = {
158174
CancelProposal: [
159175
{ name: 'from', type: 'address' },

0 commit comments

Comments
 (0)