From a806be8f5e2c08618fc25b203f693175947796df Mon Sep 17 00:00:00 2001 From: gRoussac Date: Fri, 28 Aug 2026 22:29:15 +0200 Subject: [PATCH] fix(aquachain): send LocalDAO vote as string enum CosmWasm VoteOption expects "yes"|"no"|"abstain", not { yes: {} }. Co-authored-by: Cursor --- .../src/app/services/local-dao/local-dao.ts | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/apps/aquachain/src/app/services/local-dao/local-dao.ts b/apps/aquachain/src/app/services/local-dao/local-dao.ts index 5dfb82c..7e5498c 100644 --- a/apps/aquachain/src/app/services/local-dao/local-dao.ts +++ b/apps/aquachain/src/app/services/local-dao/local-dao.ts @@ -93,7 +93,10 @@ export interface ParsedProposal extends DaoProposal { export class LocalDaoService { private readonly contractService = inject(ContractService); - async getProposal(contract: string, proposalId: number): Promise { + async getProposal( + contract: string, + proposalId: number, + ): Promise { const client = await this.contractService.getqueryClient(); return client.queryContractSmart(contract, { get_proposal: { proposal_id: proposalId }, @@ -151,17 +154,10 @@ export class LocalDaoService { proposalId: number, choice: VoteChoice, ) { - const votePayload = - choice === 'yes' - ? { yes: {} } - : choice === 'no' - ? { no: {} } - : { abstain: {} }; - return this.contractService.simulateAndExecute( sender, contract, - { vote: { proposal_id: proposalId, vote: votePayload } }, + { vote: { proposal_id: proposalId, vote: choice } }, 'cast vote', ); } @@ -182,7 +178,9 @@ export class LocalDaoService { } } -export function daoActionDefinition(actionTag: string): DaoActionDefinition | undefined { +export function daoActionDefinition( + actionTag: string, +): DaoActionDefinition | undefined { return DAO_ACTIONS.find((action) => action.tag === actionTag); } @@ -309,7 +307,10 @@ export function proposalStatusLabel(status: ProposalStatus): string { } } -export function isVotingOpen(proposal: DaoProposal, nowSeconds: number): boolean { +export function isVotingOpen( + proposal: DaoProposal, + nowSeconds: number, +): boolean { if (proposal.status !== 'open') { return false; }