@macalinao/codama-rename-visitor
Version:
Codama visitor for renaming instructions and events within a program
35 lines • 1.06 kB
TypeScript
import type { ProgramRenameOptions } from "./types.js";
import { rootNodeVisitor } from "codama";
/**
* Creates a visitor that renames accounts, instructions, and defined types in specific programs.
* This follows the same pattern as addPdasVisitor from Codama.
*
* @param renamesByProgram - Object mapping program names to their rename configurations
* @returns A root node visitor that performs all specified renames
*
* @example
* ```typescript
* const visitor = renameVisitor({
* quarryMine: {
* instructions: {
* claimRewards: "claimRewardsMine"
* },
* accounts: {
* miner: "minerAccount"
* }
* },
* token: {
* instructions: {
* transfer: "transferTokens",
* mint: "mintNft"
* },
* definedTypes: {
* tokenData: "tokenMetadata"
* }
* }
* });
* codama.update(visitor);
* ```
*/
export declare function renameVisitor(renamesByProgram: Record<string, ProgramRenameOptions>): ReturnType<typeof rootNodeVisitor>;
//# sourceMappingURL=rename-visitor.d.ts.map