PHP WebShell

Текущая директория: /opt/BitGoJS/node_modules/@aptos-labs/ts-sdk/dist/common/cli

Просмотр файла: index.d.ts

import { ChildProcessWithoutNullStreams } from 'child_process';
import { N as Network, g as AccountAddress } from '../accountAddress-BHsGaOsa.js';

/**
 * Represents a local node for running a testnet environment.
 * This class provides methods to start, stop, and check the status of the local testnet process.
 * It manages the lifecycle of the node process and ensures that it is operational before executing tests.
 */
declare class LocalNode {
    readonly MAXIMUM_WAIT_TIME_SEC = 75;
    readonly READINESS_ENDPOINT = "http://127.0.0.1:8070/";
    showStdout: boolean;
    process: ChildProcessWithoutNullStreams | null;
    constructor(args?: {
        showStdout?: boolean;
    });
    /**
     * Kills the current process and all its descendant processes.
     *
     * @returns {Promise<void>} A promise that resolves to true if the process was successfully killed.
     * @throws {Error} If there is an error while attempting to kill the process.
     */
    stop(): Promise<void>;
    /**
     * Runs a local testnet and waits for the process to be up.
     * If the local node process is already running, it returns without starting the process.
     *
     * @returns {Promise<void>} A promise that resolves when the process is up.
     */
    run(): Promise<void>;
    /**
     * Starts the local testnet by running the Aptos node with the specified command-line arguments.
     *
     * @returns {void}
     *
     * @throws {Error} If there is an issue starting the local testnet.
     */
    start(): void;
    /**
     * Waits for the local testnet process to be operational within a specified maximum wait time.
     * This function continuously checks if the process is up and will throw an error if it fails to start.
     *
     * @returns Promise<boolean> - Resolves to true if the process is up, otherwise throws an error.
     */
    waitUntilProcessIsUp(): Promise<boolean>;
    /**
     * Checks if the local testnet is up by querying the readiness endpoint.
     *
     * @returns Promise<boolean> - A promise that resolves to true if the testnet is up, otherwise false.
     */
    checkIfProcessIsUp(): Promise<boolean>;
}

/**
 * Class representing a Move package management utility for the Aptos blockchain.
 * This class provides methods to initialize directories, compile packages, run tests, publish modules, create objects, upgrade
 * packages, build transaction payloads, and run scripts.
 */
declare class Move {
    /**
     * Initialize the current directory for Aptos by configuring the necessary settings.
     * Configuration will be pushed into .aptos/config.yaml.
     *
     * @param args - The arguments for initialization.
     * @param args.network - Optional Network type argument to use for default settings; defaults to local.
     * @param args.profile - Optional Profile to use from the config file; defaults to 'default'. This will override associated
     * settings such as the REST URL, the Faucet URL, and the private key arguments.
     * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.
     * Ex. ["--assume-yes","--gas-unit-price=10"]
     * @returns stdout
     */
    init(args: {
        network?: Network;
        profile?: string;
        extraArguments?: Array<string>;
        showStdout?: boolean;
    }): Promise<{
        output: string;
    }>;
    /**
     * Compile a Move package located at the specified directory path.
     * This function helps in preparing the Move package for deployment or further processing.
     *
     * @param args - The arguments for compiling the package.
     * @param args.packageDirectoryPath - Path to a Move package (the folder with a Move.toml file).
     * @param args.namedAddresses - Named addresses for the move binary. Ex. { alice: 0x1234, bob: 0x5678 }
     * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.
     * Ex. ["--assume-yes","--gas-unit-price=10"]
     * @returns stdout
     */
    compile(args: {
        packageDirectoryPath: string;
        namedAddresses: Record<string, AccountAddress>;
        extraArguments?: Array<string>;
        showStdout?: boolean;
    }): Promise<{
        output: string;
    }>;
    /**
     * Run Move unit tests for a specified package.
     *
     * @param args - The arguments for running the tests.
     * @param args.packageDirectoryPath - The path to a Move package (the folder containing a Move.toml file).
     * @param args.namedAddresses - Named addresses for the move binary. Ex. { alice: 0x1234, bob: 0x5678 }
     * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.
     * Ex. ["--assume-yes","--gas-unit-price=10"]
     * @returns The stdout output from running the tests.
     */
    test(args: {
        packageDirectoryPath: string;
        namedAddresses: Record<string, AccountAddress>;
        extraArguments?: Array<string>;
        showStdout?: boolean;
    }): Promise<{
        output: string;
    }>;
    /**
     * Publishes the modules to the publisher account on the Aptos blockchain.
     *
     * @param args - The arguments for publishing the modules.
     * @param args.packageDirectoryPath - The path to a move package (the folder with a Move.toml file).
     * @param args.namedAddresses - Named addresses for the move binary. Ex. { alice: 0x1234, bob: 0x5678 }
     * @param args.profile - Optional profile to use from the config file.
     * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.
     * Ex. ["--assume-yes","--gas-unit-price=10"]
     * @returns stdout
     */
    publish(args: {
        packageDirectoryPath: string;
        namedAddresses: Record<string, AccountAddress>;
        profile?: string;
        extraArguments?: Array<string>;
        showStdout?: boolean;
    }): Promise<{
        output: string;
    }>;
    /**
     * Create a new object and publish the Move package to it on the Aptos blockchain.
     *
     * @param args - The arguments for creating the object and publishing the package.
     * @param args.packageDirectoryPath - Path to a Move package (the folder with a Move.toml file).
     * @param args.addressName - Address name for the Move package.
     * @param args.namedAddresses - Named addresses for the Move binary.
     * @param args.profile - Optional profile to use from the config file.
     * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.
     * Ex. ["--assume-yes","--gas-unit-price=10"]
     * @returns The object address.
     *
     * A complete example in CLI:
     * aptos move create-object-and-publish-package \
     * --package-dir path_to_directory_that_has_move.toml \
     * --address-name launchpad_addr \
     * --named-addresses "launchpad_addr=0x123,initial_creator_addr=0x456" \
     * --profile my_profile \
     * --assume-yes
     */
    createObjectAndPublishPackage(args: {
        packageDirectoryPath: string;
        addressName: string;
        namedAddresses: Record<string, AccountAddress>;
        profile?: string;
        extraArguments?: Array<string>;
        showStdout?: boolean;
    }): Promise<{
        objectAddress: string;
    }>;
    /**
     * Upgrade a Move package previously published to an object on the Aptos blockchain.
     * The caller must be the object owner to execute this function.
     *
     * @param args - The arguments for upgrading the object package.
     * @param args.packageDirectoryPath - Path to a Move package (the folder with a Move.toml file).
     * @param args.objectAddress - Address of the object that the Move package published to. Ex. 0x1000
     * @param args.namedAddresses - Named addresses for the move binary. Ex. { alice: 0x1234, bob: 0x5678 }
     * @param args.profile - Optional profile to use from the config file.
     * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.
     * Ex. ["--assume-yes","--gas-unit-price=10"]
     * @returns stdout
     */
    upgradeObjectPackage(args: {
        packageDirectoryPath: string;
        objectAddress: string;
        namedAddresses: Record<string, AccountAddress>;
        profile?: string;
        extraArguments?: Array<string>;
        showStdout?: boolean;
    }): Promise<{
        output: string;
    }>;
    /**
     * Build a publication transaction payload and store it in a JSON output file.
     *
     * @param args - The arguments for building the publishing payload.
     * @param args.packageDirectoryPath - Path to a move package (the folder with a Move.toml file).
     * @param args.outputFile - Output file to write the publication transaction to.
     * @param args.namedAddresses - Named addresses for the move binary. Ex. { alice: 0x1234, bob: 0x5678 }
     * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.
     * Ex. ["--assume-yes","--gas-unit-price=10"]   *
     * @returns stdout
     */
    buildPublishPayload(args: {
        packageDirectoryPath: string;
        outputFile: string;
        namedAddresses: Record<string, AccountAddress>;
        extraArguments?: Array<string>;
        showStdout?: boolean;
    }): Promise<{
        output: string;
    }>;
    /**
     * Runs a Move script using the provided compiled script path and optional parameters. Ensure that the script is compiled
     * before executing this function.
     *
     * @param args - The arguments for running the script.
     * @param args.compiledScriptPath - Path to a compiled Move script bytecode file.
     * Ex. "build/my_package/bytecode_scripts/my_move_script.mv"
     * @param args.profile - Optional profile to use from the config file.
     * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.
     * Ex. ["--assume-yes","--gas-unit-price=10"]
     *
     * @returns The standard output from running the script.
     */
    runScript(args: {
        compiledScriptPath: string;
        profile?: string;
        extraArguments?: Array<string>;
        showStdout?: boolean;
    }): Promise<{
        output: string;
    }>;
    gasProfile(args: {
        network: string;
        transactionId: string;
        extraArguments?: Array<string>;
        showStdout?: boolean;
    }): Promise<{
        output: string;
        result?: any;
    }>;
    /**
     * Run a command with the specified arguments and return the output.
     *
     * @param args - An array of strings representing the command-line arguments to be passed to the command.
     * @param showStdout - Show the standard output generated by the command.
     * @returns The standard output generated by the command.
     */
    private runCommand;
    /**
     * Convert named addresses from a Map into an array separated by a comma.
     *
     * @param namedAddresses - A Map where the key is a string representing the name and the value is an AccountAddress.
     * Ex. {'alice' => '0x123', 'bob' => '0x456'}
     * @returns An array of named addresses formatted as strings separated by a comma. Ex. "alice=0x123,bob=0x456"
     */
    private prepareNamedAddresses;
    /**
     * Parse named addresses from a Record type into a Map.
     *
     * This function transforms a collection of named addresses into a more accessible format by mapping each name to its
     * corresponding address.
     *
     * @param namedAddresses - A record containing named addresses where the key is the name and the value is the AccountAddress.
     * @returns A Map where each key is a name and each value is the corresponding address.
     */
    private parseNamedAddresses;
    /**
     * Extracts the object address from the provided output string.
     *
     * @param output - The output string containing the object address.
     * @returns The extracted object address.
     * @throws Error if the object address cannot be extracted from the output.
     */
    private extractAddressFromOutput;
}

export { LocalNode, Move };

Выполнить команду


Для локальной разработки. Не используйте в интернете!