open-libra-sdk
Version:
A minimalist Typescript library for interacting with the Open Libra blockchain.
37 lines • 1.52 kB
TypeScript
import type { ViewArgs } from "../types/clientPayloads";
type ViewFunction = {
name: string;
args: Array<{
name: string;
type: string;
}>;
file: string;
};
/**
* Main function: Given a directory, return all view functions as TypeScript types
*/
export declare function extractViewFunctions(dir: string): ViewFunction[];
export declare function generateViewTypes(viewFns: ViewFunction[]): string;
/**
* Convert a ViewFunction to a ViewArgs payload (Aptos SDK compatible)
* @param fn ViewFunction
* @param params Array of argument values to use as functionArguments
* @param moduleAddress Optional module address (defaults to 0x1)
* @returns ViewArgs
*/
export declare function viewFunctionToViewArgs(fn: ViewFunction, params?: unknown[], moduleAddress?: string): ViewArgs;
/**
* Generate a TypeScript file with constants for each discovered ViewFunction.
* @param moveDir Directory to search for .move files
* @param outFile Output .ts file path
*/
export declare function generate(moveDir: string, outFile: string, importPath?: string): void;
/**
* Generate a TypeScript file with sugar functions for each discovered ViewFunction.
* Each function mirrors the Move view function signature and returns a ViewArgs payload.
* @param moveDir Directory to search for .move files
* @param outFile Output .ts file path
*/
export declare function generateSugar(moveDir: string, outFile: string, importPath?: string): void;
export {};
//# sourceMappingURL=parseViewFunctions.d.ts.map