@axelar-network/axelar-cgp-sui
Version:
Axelar Sui Move contracts
65 lines • 3.27 kB
TypeScript
import { Bytes } from 'ethers';
import { TomlPrimitive } from 'smol-toml';
import { Dependency, InterchainTokenOptions } from "./types";
/**
* Prepare a move build by creating a temporary directory to store the compiled move code
* @returns {tmpdir: string, rmTmpDir: () => void}
* - tmpdir is the path to the temporary directory
* - rmTmpDir is a function to remove the temporary directory
*/
export declare function prepareMoveBuild(tmpDir: string): {
tmpdir: string;
rmTmpDir: () => void;
};
export declare const getInstalledSuiVersion: () => string | undefined;
export declare const getDefinedSuiVersion: () => string | undefined;
export declare function getContractBuild(packageName: string, moveDir: string): {
modules: string[];
dependencies: string[];
digest: Bytes;
};
export declare function writeInterchainToken(moveDir: string, options: InterchainTokenOptions): {
templateFilePath: string;
filePath: string;
templateContent: string;
};
export declare function removeFile(filePath: string): void;
export declare function addFile(filePath: string, content: string): void;
export declare function updateMoveToml(packageName: string, packageId: string, moveDir?: string, prepToml?: undefined | ((moveJson: Record<string, TomlPrimitive>) => Record<string, TomlPrimitive>)): void;
export declare function copyMovePackage(packageName: string, fromDir: null | string, toDir: string): void;
export declare function newInterchainToken(templateFilePath: string, options: InterchainTokenOptions): {
filePath: string;
content: string;
};
/**
* Get the local dependencies of a package from the Move.toml file.
* @param packageName The name of the package.
* @param baseMoveDir The parent directory of the Move.toml file.
* @returns An array of objects containing the name and path of the local dependencies.
*/
export declare function getLocalDependencies(packageName: string, baseMoveDir: string): Dependency[];
/**
* Determines the deployment order of Move packages based on their dependencies.
*
* @param packageDir - The directory of the main package to start the dependency resolution from.
* @param baseMoveDir - The base directory where all Move packages are located.
* @returns An array of package directory names in the order they should be deployed.
* The array is sorted such that packages with no dependencies come first,
* followed by packages whose dependencies have already appeared in the array.
*
* @description
* This function performs the following steps:
* 1. Recursively builds a dependency map starting from the given package.
* 2. Performs a topological sort on the dependency graph.
* 3. Returns the sorted list of package directories.
*
* The function handles circular dependencies and will include each package only once in the output.
* If a package has multiple dependencies, it will appear in the list after all its dependencies.
*
* @example
* const deploymentOrder = getDeploymentOrder('myPackage', '/path/to/move');
* console.log(deploymentOrder);
* Might output: ['dependency1', 'dependency2', 'myPackage']
*/
export declare function getDeploymentOrder(packageDir: string, baseMoveDir: string): string[];
//# sourceMappingURL=node-utils.d.ts.map