Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(flag proposal): add actions for flagging proposals #903

Merged
merged 4 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@snapshot-labs/snapshot.js",
"version": "0.6.2",
"version": "0.6.3",
"repository": "snapshot-labs/snapshot.js",
"license": "MIT",
"main": "dist/snapshot.cjs.js",
Expand Down
10 changes: 10 additions & 0 deletions src/sign/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
Space,
Proposal,
UpdateProposal,
FlagProposal,
CancelProposal,
Vote,
Follow,
Expand All @@ -19,6 +20,7 @@ import {
spaceTypes,
proposalTypes,
updateProposalTypes,
flagProposalTypes,
cancelProposalTypes,
cancelProposal2Types,
voteTypes,
Expand Down Expand Up @@ -121,6 +123,14 @@ export default class Client {
return await this.sign(web3, address, message, updateProposalTypes);
}

async flagProposal(
web3: Web3Provider | Wallet,
address: string,
message: FlagProposal
) {
return await this.sign(web3, address, message, flagProposalTypes);
}

async cancelProposal(
web3: Web3Provider | Wallet,
address: string,
Expand Down
1 change: 1 addition & 0 deletions src/sign/types.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"9ff8af4cfb586e2c7962d792b99328fb47e8a4e73cc89873c0980484bc1063a5": "delete-proposal",
"734df82cdad586386defa4cb55adda7cb1b2a56929c4e6c3dc676f9901947288": "delete-proposal",
"4e5fa89616761defa1274103441809c8445f8404306890ad36ec653d90201d58": "update-proposal",
"4bbf83a627c4afc26a1b9490127c1712d844fb0806131ee9860e7b298b0a828e": "flag-proposal",
"50084aae0fe117c83ddf855557dde35ae2872e9045443a15f72aa6c68ea3943b": "vote",
"1dfe3863f6333a85581fb150d4ee77c95a6d026c518ca1b11c08ae1d98acd598": "vote-array",
"1814c3dd303c5919ce488b924f92b9a42a0834972f514e55b1879fda48e67736": "vote-string",
Expand Down
16 changes: 16 additions & 0 deletions src/sign/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ export interface UpdateProposal {
plugins: string;
}

export interface FlagProposal {
from: string;
space: string;
proposal: string;
timestamp?: number;
}

export interface CancelProposal {
from?: string;
space: string;
Expand Down Expand Up @@ -154,6 +161,15 @@ export const updateProposalTypes = {
]
};

export const flagProposalTypes = {
FlagProposal: [
{ name: 'from', type: 'address' },
{ name: 'space', type: 'string' },
{ name: 'proposal', type: 'string' },
{ name: 'timestamp', type: 'uint64' }
]
};

export const cancelProposalTypes = {
CancelProposal: [
{ name: 'from', type: 'address' },
Expand Down
Loading