Skip to content

Commit 175b1ad

Browse files
committed
fix doc string generation
1 parent a09c73b commit 175b1ad

File tree

10 files changed

+122
-49
lines changed

10 files changed

+122
-49
lines changed

clients/spl-governance/src/generated/instructions/castVote.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,13 @@ export interface CastVoteInput<
171171
governanceAuthority: TransactionSigner<TAccountGovernanceAuthority>;
172172
/** Proposal VoteRecord account. PDA seeds: ['governance',proposal,token_owner_record] */
173173
proposalVoteRecord: Address<TAccountProposalVoteRecord>;
174-
/** The Governing Token Mint which is used to cast the vote (vote_governing_token_mint).
175-
The voting token mint is the governing_token_mint of the Proposal for Approve, Deny and Abstain votes.
176-
For Veto vote the voting token mint is the mint of the opposite voting population.
177-
Council mint to veto Community proposals and Community mint to veto Council proposals
178-
Note: In the current version only Council veto is supported */
174+
/**
175+
* The Governing Token Mint which is used to cast the vote (vote_governing_token_mint).
176+
* The voting token mint is the governing_token_mint of the Proposal for Approve, Deny and Abstain votes.
177+
* For Veto vote the voting token mint is the mint of the opposite voting population.
178+
* Council mint to veto Community proposals and Community mint to veto Council proposals
179+
* Note: In the current version only Council veto is supported
180+
*/
179181
governingTokenMint: Address<TAccountGoverningTokenMint>;
180182
payer: TransactionSigner<TAccountPayer>;
181183
systemProgram?: Address<TAccountSystemProgram>;
@@ -353,11 +355,13 @@ export interface ParsedCastVoteInstruction<
353355
governanceAuthority: TAccountMetas[5];
354356
/** Proposal VoteRecord account. PDA seeds: ['governance',proposal,token_owner_record] */
355357
proposalVoteRecord: TAccountMetas[6];
356-
/** The Governing Token Mint which is used to cast the vote (vote_governing_token_mint).
357-
The voting token mint is the governing_token_mint of the Proposal for Approve, Deny and Abstain votes.
358-
For Veto vote the voting token mint is the mint of the opposite voting population.
359-
Council mint to veto Community proposals and Community mint to veto Council proposals
360-
Note: In the current version only Council veto is supported */
358+
/**
359+
* The Governing Token Mint which is used to cast the vote (vote_governing_token_mint).
360+
* The voting token mint is the governing_token_mint of the Proposal for Approve, Deny and Abstain votes.
361+
* For Veto vote the voting token mint is the mint of the opposite voting population.
362+
* Council mint to veto Community proposals and Community mint to veto Council proposals
363+
* Note: In the current version only Council veto is supported
364+
*/
361365
governingTokenMint: TAccountMetas[7];
362366
payer: TAccountMetas[8];
363367
systemProgram: TAccountMetas[9];

clients/spl-governance/src/generated/instructions/createGovernance.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,10 @@ export interface CreateGovernanceInput<
147147
realmAccount: Address<TAccountRealmAccount>;
148148
/** seeds=['account-governance', realm, governed_account] */
149149
governanceAccount: Address<TAccountGovernanceAccount>;
150-
/** Account governed by this Governance (governing_account).
151-
Note: the account doesn't have to exist and can be used only as a unique identified for the Governance account */
150+
/**
151+
* Account governed by this Governance (governing_account).
152+
* Note: the account doesn't have to exist and can be used only as a unique identified for the Governance account
153+
*/
152154
governedAccount: Address<TAccountGovernedAccount>;
153155
/** Used only if not signed by RealmAuthority */
154156
governingTokenOwnerRecord: Address<TAccountGoverningTokenOwnerRecord>;
@@ -287,8 +289,10 @@ export interface ParsedCreateGovernanceInstruction<
287289
realmAccount: TAccountMetas[0];
288290
/** seeds=['account-governance', realm, governed_account] */
289291
governanceAccount: TAccountMetas[1];
290-
/** Account governed by this Governance (governing_account).
291-
Note: the account doesn't have to exist and can be used only as a unique identified for the Governance account */
292+
/**
293+
* Account governed by this Governance (governing_account).
294+
* Note: the account doesn't have to exist and can be used only as a unique identified for the Governance account
295+
*/
292296
governedAccount: TAccountMetas[2];
293297
/** Used only if not signed by RealmAuthority */
294298
governingTokenOwnerRecord: TAccountMetas[3];

clients/spl-governance/src/generated/instructions/createProposal.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,11 @@ export interface CreateProposalInput<
214214
realmConfig: Address<TAccountRealmConfig>;
215215
/** Optional Voter Weight Record */
216216
voterWeightRecord?: Address<TAccountVoterWeightRecord>;
217-
/** Optional Proposal deposit is required when there are more active
218-
proposals than the configured deposit exempt amount.
219-
PDA seeds: ['proposal-deposit', proposal, deposit payer] */
217+
/**
218+
* Optional Proposal deposit is required when there are more active
219+
* proposals than the configured deposit exempt amount.
220+
* PDA seeds: ['proposal-deposit', proposal, deposit payer]
221+
*/
220222
proposalDepositAccount?: Address<TAccountProposalDepositAccount>;
221223
name: CreateProposalInstructionDataArgs["name"];
222224
descriptionLink: CreateProposalInstructionDataArgs["descriptionLink"];
@@ -377,9 +379,11 @@ export interface ParsedCreateProposalInstruction<
377379
realmConfig: TAccountMetas[8];
378380
/** Optional Voter Weight Record */
379381
voterWeightRecord?: TAccountMetas[9] | undefined;
380-
/** Optional Proposal deposit is required when there are more active
381-
proposals than the configured deposit exempt amount.
382-
PDA seeds: ['proposal-deposit', proposal, deposit payer] */
382+
/**
383+
* Optional Proposal deposit is required when there are more active
384+
* proposals than the configured deposit exempt amount.
385+
* PDA seeds: ['proposal-deposit', proposal, deposit payer]
386+
*/
383387
proposalDepositAccount?: TAccountMetas[10] | undefined;
384388
};
385389
data: CreateProposalInstructionData;

clients/spl-governance/src/generated/instructions/createRealm.ts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,10 @@ export interface CreateRealmInput<
195195
realmAuthority: Address<TAccountRealmAuthority>;
196196
/** The mint address of the token to be used as the community mint */
197197
communityTokenMint: Address<TAccountCommunityTokenMint>;
198-
/** The account to hold the community tokens.
199-
PDA seeds=['governance', realm, community_mint] */
198+
/**
199+
* The account to hold the community tokens.
200+
* PDA seeds=['governance', realm, community_mint]
201+
*/
200202
communityTokenHoldingAccount: Address<TAccountCommunityTokenHoldingAccount>;
201203
/** the payer of this transaction */
202204
payer: TransactionSigner<TAccountPayer>;
@@ -208,9 +210,11 @@ export interface CreateRealmInput<
208210
rent?: Address<TAccountRent>;
209211
/** The mint address of the token to be used as the council mint */
210212
councilTokenMint?: Address<TAccountCouncilTokenMint>;
211-
/** The account to hold the council tokens.
212-
PDA seeds: ['governance',realm,council_mint]
213-
*/
213+
/**
214+
* The account to hold the council tokens.
215+
* PDA seeds: ['governance',realm,council_mint]
216+
*
217+
*/
214218
councilTokenHoldingAccount?: Address<TAccountCouncilTokenHoldingAccount>;
215219
/** Realm Config account */
216220
realmConfig: Address<TAccountRealmConfig>;
@@ -403,8 +407,10 @@ export interface ParsedCreateRealmInstruction<
403407
realmAuthority: TAccountMetas[1];
404408
/** The mint address of the token to be used as the community mint */
405409
communityTokenMint: TAccountMetas[2];
406-
/** The account to hold the community tokens.
407-
PDA seeds=['governance', realm, community_mint] */
410+
/**
411+
* The account to hold the community tokens.
412+
* PDA seeds=['governance', realm, community_mint]
413+
*/
408414
communityTokenHoldingAccount: TAccountMetas[3];
409415
/** the payer of this transaction */
410416
payer: TAccountMetas[4];
@@ -416,8 +422,10 @@ export interface ParsedCreateRealmInstruction<
416422
rent: TAccountMetas[7];
417423
/** The mint address of the token to be used as the council mint */
418424
councilTokenMint?: TAccountMetas[8] | undefined;
419-
/** The account to hold the council tokens.
420-
PDA seeds: ['governance',realm,council_mint]
425+
/**
426+
* The account to hold the council tokens.
427+
* PDA seeds: ['governance',realm,council_mint]
428+
*
421429
*/
422430
councilTokenHoldingAccount?: TAccountMetas[9] | undefined;
423431
/** Realm Config account */

clients/spl-governance/src/generated/instructions/relinquishVote.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,10 @@ export interface RelinquishVoteInput<
131131
/** The Governing Token Mint which was used to cast the vote (vote_governing_token_mint) */
132132
governingTokenMint: Address<TAccountGoverningTokenMint>;
133133
governanceAuthority?: TransactionSigner<TAccountGovernanceAuthority>;
134-
/** Optional Beneficiary account which would receive lamports when VoteRecord Account is disposed.
135-
It's required only when Proposal is still being voted on */
134+
/**
135+
* Optional Beneficiary account which would receive lamports when VoteRecord Account is disposed.
136+
* It's required only when Proposal is still being voted on
137+
*/
136138
beneficiaryAccount?: Address<TAccountBeneficiaryAccount>;
137139
}
138140

@@ -250,8 +252,10 @@ export interface ParsedRelinquishVoteInstruction<
250252
/** The Governing Token Mint which was used to cast the vote (vote_governing_token_mint) */
251253
governingTokenMint: TAccountMetas[5];
252254
governanceAuthority?: TAccountMetas[6] | undefined;
253-
/** Optional Beneficiary account which would receive lamports when VoteRecord Account is disposed.
254-
It's required only when Proposal is still being voted on */
255+
/**
256+
* Optional Beneficiary account which would receive lamports when VoteRecord Account is disposed.
257+
* It's required only when Proposal is still being voted on
258+
*/
255259
beneficiaryAccount?: TAccountMetas[7] | undefined;
256260
};
257261
data: RelinquishVoteInstructionData;

clients/spl-governance/src/generated/instructions/setRealmConfig.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,12 @@ export interface SetRealmConfigInput<
166166
> {
167167
realmAccount: Address<TAccountRealmAccount>;
168168
realmAuthority: TransactionSigner<TAccountRealmAuthority>;
169-
/** Council Token Mint - optional.
170-
Note: In the current version it's only possible to remove council mint (set it to None)
171-
After setting council to None it won't be possible to withdraw the tokens from the Realm any longer.
172-
If that's required then it must be done before executing this instruction */
169+
/**
170+
* Council Token Mint - optional.
171+
* Note: In the current version it's only possible to remove council mint (set it to None)
172+
* After setting council to None it won't be possible to withdraw the tokens from the Realm any longer.
173+
* If that's required then it must be done before executing this instruction
174+
*/
173175
councilTokenMint?: Address<TAccountCouncilTokenMint>;
174176
/** Optional unless council is used. seeds=['governance', realm, council_mint] */
175177
councilTokenHoldingAccount?: Address<TAccountCouncilTokenHoldingAccount>;
@@ -324,10 +326,12 @@ export interface ParsedSetRealmConfigInstruction<
324326
accounts: {
325327
realmAccount: TAccountMetas[0];
326328
realmAuthority: TAccountMetas[1];
327-
/** Council Token Mint - optional.
328-
Note: In the current version it's only possible to remove council mint (set it to None)
329-
After setting council to None it won't be possible to withdraw the tokens from the Realm any longer.
330-
If that's required then it must be done before executing this instruction */
329+
/**
330+
* Council Token Mint - optional.
331+
* Note: In the current version it's only possible to remove council mint (set it to None)
332+
* After setting council to None it won't be possible to withdraw the tokens from the Realm any longer.
333+
* If that's required then it must be done before executing this instruction
334+
*/
331335
councilTokenMint?: TAccountMetas[2] | undefined;
332336
/** Optional unless council is used. seeds=['governance', realm, council_mint] */
333337
councilTokenHoldingAccount?: TAccountMetas[3] | undefined;

clients/spl-governance/src/generated/instructions/signOffProposal.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,15 @@ export interface SignOffProposalInput<
109109
realmAccount: Address<TAccountRealmAccount>;
110110
governanceAccount: Address<TAccountGovernanceAccount>;
111111
proposalAccount: Address<TAccountProposalAccount>;
112-
/** Signatory account signing off the Proposal.
113-
Or Proposal owner if the owner hasn't appointed any signatories */
112+
/**
113+
* Signatory account signing off the Proposal.
114+
* Or Proposal owner if the owner hasn't appointed any signatories
115+
*/
114116
signatoryAccount: TransactionSigner<TAccountSignatoryAccount>;
115-
/** TokenOwnerRecord for the Proposal owner, required when the owner signs off the Proposal.
116-
Or `[writable]` SignatoryRecord account, required when non owner signs off the Proposal */
117+
/**
118+
* TokenOwnerRecord for the Proposal owner, required when the owner signs off the Proposal.
119+
* Or `[writable]` SignatoryRecord account, required when non owner signs off the Proposal
120+
*/
117121
tokenOwnerRecord: Address<TAccountTokenOwnerRecord>;
118122
}
119123

@@ -197,11 +201,15 @@ export interface ParsedSignOffProposalInstruction<
197201
realmAccount: TAccountMetas[0];
198202
governanceAccount: TAccountMetas[1];
199203
proposalAccount: TAccountMetas[2];
200-
/** Signatory account signing off the Proposal.
201-
Or Proposal owner if the owner hasn't appointed any signatories */
204+
/**
205+
* Signatory account signing off the Proposal.
206+
* Or Proposal owner if the owner hasn't appointed any signatories
207+
*/
202208
signatoryAccount: TAccountMetas[3];
203-
/** TokenOwnerRecord for the Proposal owner, required when the owner signs off the Proposal.
204-
Or `[writable]` SignatoryRecord account, required when non owner signs off the Proposal */
209+
/**
210+
* TokenOwnerRecord for the Proposal owner, required when the owner signs off the Proposal.
211+
* Or `[writable]` SignatoryRecord account, required when non owner signs off the Proposal
212+
*/
205213
tokenOwnerRecord: TAccountMetas[4];
206214
};
207215
data: SignOffProposalInstructionData;
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import type { Node } from "codama";
2+
import { bottomUpTransformerVisitor } from "codama";
3+
4+
/**
5+
* Creates a visitor that fixes docs by splitting lines that contain newline characters.
6+
* This ensures that each doc line is a separate array element.
7+
*
8+
* @returns A bottom-up transformer visitor that splits docs
9+
*
10+
* @example
11+
* ```typescript
12+
* const visitor = fixDocsVisitor();
13+
* codama.update(visitor);
14+
* ```
15+
*/
16+
export function fixDocsVisitor() {
17+
return bottomUpTransformerVisitor([
18+
{
19+
select: "*",
20+
transform: (node: Node) => {
21+
// Check if node has docs property
22+
const nodeWithDocs = node as Node & { docs?: string[] };
23+
if (nodeWithDocs.docs) {
24+
return {
25+
...node,
26+
docs: nodeWithDocs.docs.flatMap((line) => line.split("\n")),
27+
};
28+
}
29+
return node;
30+
},
31+
},
32+
]);
33+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export * from "./add-nodes-visitor.js";
2+
export * from "./fix-docs-visitor.js";
23
export * from "./nodes/index.js";

packages/coda/src/utils/process-idls.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { AnchorIdl } from "@codama/nodes-from-anchor";
22
import type { Codama } from "codama";
33
import type { CodaConfig } from "../config.js";
44
import { resolve } from "node:path";
5+
import { fixDocsVisitor } from "@macalinao/coda-visitors";
56
import {
67
getCommonInstructionAccountDefaultRules,
78
setInstructionAccountDefaultValuesVisitor,
@@ -43,6 +44,8 @@ export async function processIdls(options: {
4344
// Create Codama instance
4445
const codama = createCodamaFromIdls(idls);
4546

47+
codama.update(fixDocsVisitor());
48+
4649
// Default instruction accounts
4750
codama.update(
4851
setInstructionAccountDefaultValuesVisitor([

0 commit comments

Comments
 (0)