@macalinao/codama-rename-visitor
Version:
Codama visitor for renaming instructions and events within a program
26 lines • 1.04 kB
TypeScript
import type { InstructionNode, Node, NodeKind, Visitor } from "codama";
/**
* Transform function that renames an instruction node based on a mapping.
*
* @param node - The node to transform
* @param mapping - Object mapping old instruction names to new instruction names
* @returns The transformed instruction node
*/
export declare function renameInstructionTransform(node: Node, mapping: Record<string, string>): InstructionNode;
/**
* Creates a visitor that renames instructions in a Codama IDL.
*
* @param mapping - Object mapping old instruction names to new instruction names
* @returns A root node visitor that renames instructions
*
* @example
* ```typescript
* const visitor = renameInstructionsVisitor({
* "transfer": "transferTokens",
* "mint": "mintNft"
* });
* codama.update(visitor);
* ```
*/
export declare function renameInstructionsVisitor<TNodeKind extends NodeKind = NodeKind>(mapping: Record<string, string>): Visitor<Node | null, TNodeKind>;
//# sourceMappingURL=rename-instructions-visitor.d.ts.map