Skip to content

Commit 22884c1

Browse files
authored
Fix DAO method paths to match node implementation (#30)
Fixed 7 DAO method issues to match actual node endpoints: 1. getDaoTreasury: /treasury/balance → /treasury/status - Updated response parsing to treasury.total_balance 2. getTreasuryHistory: /treasury/history → /treasury/transactions - Added limit/offset query parameter support - Updated response parsing to transactions array 3. createProposal: /dao/proposals → /dao/proposal/create - Fixed singular 'proposal' path 4. getProposalDetails: /dao/proposals/{id} → /dao/proposal/{id} - Fixed singular 'proposal' path 5. submitVote: Updated request body format - Changed to voter_identity_id, proposal_id, vote_choice - Added support for yes/no/abstain and justification 6. registerDelegate: Fixed request body field names - Changed userDid → user_did - Changed delegateInfo → delegate_info 7. revokeDelegation: Fixed request body field name - Changed userDid → user_did All paths now match node's dao/mod.rs implementation (lines 957-1029)
1 parent 2784977 commit 22884c1

File tree

5 files changed

+57
-29
lines changed

5 files changed

+57
-29
lines changed

dist/core/zhtp-api-methods.d.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,18 @@ export declare abstract class ZhtpApiMethods extends ZhtpApiCore {
125125
getDaoProposals(): Promise<DaoProposal[]>;
126126
getDaoStats(): Promise<DaoStats>;
127127
createProposal(proposal: any): Promise<DaoProposal>;
128-
submitVote(proposalId: string, vote: boolean, voterDid: string): Promise<void>;
128+
submitVote(voterIdentityId: string, proposalId: string, voteChoice: 'yes' | 'no' | 'abstain', justification?: string): Promise<void>;
129129
getDaoTreasury(): Promise<number>;
130130
getProposalDetails(proposalId: string): Promise<ProposalDetails>;
131131
getDaoData(): Promise<Record<string, any>>;
132132
getDaoDelegates(): Promise<Delegate[]>;
133133
getDelegateProfile(delegateId: string): Promise<Delegate>;
134-
registerDelegate(userDid: string, delegateInfo: Record<string, any>): Promise<Delegate>;
134+
registerDelegate(userDid: string, delegateInfo: {
135+
name: string;
136+
bio: string;
137+
}): Promise<Delegate>;
135138
revokeDelegation(userDid: string): Promise<void>;
136-
getTreasuryHistory(): Promise<TreasuryRecord[]>;
139+
getTreasuryHistory(limit?: number, offset?: number): Promise<TreasuryRecord[]>;
137140
createSpendingProposal(proposalData: Record<string, any>): Promise<DaoProposal>;
138141
getVotingPower(userDid: string): Promise<number>;
139142
getUserVotes(userDid: string): Promise<Array<{

dist/core/zhtp-api-methods.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/core/zhtp-api-methods.js

Lines changed: 25 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)