-
Notifications
You must be signed in to change notification settings - Fork 12
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: add single choice and approval voting type #46
Conversation
Co-authored-by: Wiktor Tkaczyński <wiktor.tkaczynski@gmail.com>
…b.com/snapshot-labs/sx-monorepo into fix-15-add-voting-for-offchain-spaces
…b.com/snapshot-labs/sx-monorepo into fix-15-add-voting-for-offchain-spaces
…github.com/snapshot-labs/sx-monorepo into add-approval-and-single-choice-voting-type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After I voted it shows a message You have already votes on this proposal
but I see zero votes and no current results until I refresh the page. Shouldn't it refresh the results after I voted?
For SX it will take some time before vote is indexed so we do not refresh (it can take few minutes sometimes for indexer to see transaction). Maybe it makes more sense here but it shouldn’t be part of this PR |
I agree with it not being part of this PR. We have a pendingTransaction store on the UI, which receive the tx after a vote. What I would to would be to add some kind of watcher there, and refresh the related UI store (proposal, space, etc ...) when tx pass, then all dependent component will refresh by themselves. |
Co-authored-by: Wiktor Tkaczyński <wiktor.tkaczynski@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than this one small change all looks good to me, great job!
}>(); | ||
|
||
const emit = defineEmits<{ | ||
(e: 'handleVoteClick', value: Choice); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(e: 'handleVoteClick', value: Choice); | |
(e: 'voteClick', value: Choice); |
We tend to call handler function with handle
prefix, but emit names don't have that prefix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to keep the Click
suffix ? If not, it will look better like
@vote="handleVoteClick"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, we have a handleVoteClick
function in 2 places: ProposalListsItem.vue and Proposal.vue.
Wouldn't it be cleaner if we move this inside ProposalVote ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed vote
makes more sense as I took better look at the usage.
Also, we have a handleVoteClick function in 2 places: ProposalListsItem.vue and Proposal.vue.
I don't think we can as it's just wrapper that gets actual buttons from the outside.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, we could move everything inside ProposalVote, and just call it with
<ProposalVote v-if="proposal" :proposal="proposal" show-type="['basic']"> // To show only basic type
<ProposalVote v-if="proposal" :proposal="proposal"> // To show everything
Also CI is failing. |
This one is due to a typing issue, which I am not able to resolve. If you have some advices |
diff --git a/packages/sx.js/src/clients/offchain/types.ts b/packages/sx.js/src/clients/offchain/types.ts
index 01e9ab22..87dd8e02 100644
--- a/packages/sx.js/src/clients/offchain/types.ts
+++ b/packages/sx.js/src/clients/offchain/types.ts
@@ -1,10 +1,6 @@
import type { TypedDataDomain, TypedDataField } from '@ethersproject/abstract-signer';
-enum Choice {
- Against = 2,
- For = 1,
- Abstain = 3
-}
+type Choice = number | number[];
export type SignatureData = {
address: string; |
Still no luck, for some reasons, it's using the |
@wa0x6e it will work if you run |
Fixed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK
Summary
Closes: #15
Add support for approval voting
Changes
number[]
as choices typeHow to test