Skip to main content

Function: createVoteRecord()

createVoteRecord(agent, data): Promise<CreateRecordResult>

Defined in: web/lib/atproto/record-creator.ts:732

Create a vote record in the user's PDS.

Parameters​

agent​

Agent

Authenticated ATProto Agent

data​

Omit<{ createdAt: string; proposalUri: string; rationale: string; vote: "approve" | "reject" | "abstain" | "request-changes"; }, "createdAt">

Vote data

Returns​

Promise<CreateRecordResult>

Created record result

Remarks​

Records a vote on a governance proposal. The vote is stored in the voter's PDS and indexed by Chive for tallying.

The caller supplies rationale, matching the form and UI vocabulary; it is written to the lexicon's comment field, which is the only one the indexer reads.

Throws​

Error if agent is not authenticated

Throws​

Error if record creation fails

Example​

const result = await createVoteRecord(agent, {
proposalUri: 'at://did:plc:abc/pub.chive.graph.fieldProposal/123',
vote: 'approve',
rationale: 'This field is well-defined and needed.',
});