@aptos-labs/ts-sdk
Version:
Aptos TypeScript SDK
131 lines (127 loc) • 3.88 kB
TypeScript
import { ChildProcessWithoutNullStreams } from 'child_process';
import { N as Network, g as AccountAddress } from '../accountAddress-ccLvlUQe.js';
declare class LocalNode {
readonly MAXIMUM_WAIT_TIME_SEC = 75;
readonly READINESS_ENDPOINT = "http://127.0.0.1:8070/";
process: ChildProcessWithoutNullStreams | null;
/**
* kills all the descendent processes
* of the node process, including the node process itself
*/
stop(): void;
/**
* Runs a local testnet and waits for process to be up.
*
* If local node process is already up it returns and does
* not start the process
*/
run(): Promise<void>;
/**
* Starts the local testnet by running the aptos node run-local-testnet command
*/
start(): void;
/**
* Waits for the local testnet process to be up
*
* @returns Promise<boolean>
*/
waitUntilProcessIsUp(): Promise<boolean>;
/**
* Checks if the local testnet is up
*
* @returns Promise<boolean>
*/
checkIfProcessIsUp(): Promise<boolean>;
}
declare class Move {
/**
* Function to initialize current directory for Aptos
*
* Configuration will be pushed into .aptos/config.yaml
* @param args.network optional Netowrk type argument to use for default settings, default is local
* @param args.profile optional Profile to use from the config file, default is 'default'
* This will be used to override associated settings such as the REST URL, the Faucet URL, and the private key arguments.
*
* @returns
*/
init(args: {
network?: Network;
profile?: string;
}): Promise<boolean>;
/**
* Function to compile a 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
* @example
* {
* alice:0x1234, bob:0x5678
* }
*
* @returns
*/
compile(args: {
packageDirectoryPath: string;
namedAddresses: Record<string, AccountAddress>;
}): Promise<boolean>;
/**
* Function to run Move unit tests for a 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
* @example
* {
* alice:0x1234, bob:0x5678
* }
*
* @returns
*/
test(args: {
packageDirectoryPath: string;
namedAddresses: Record<string, AccountAddress>;
}): Promise<boolean>;
/**
* Function to publishe the modules in a Move package to the Aptos blockchain
*
* @param args.packageDirectoryPath Path to a move package (the folder with a Move.toml file)
* @param args.namedAddresses Named addresses for the move binary
* @example
* {
* alice:0x1234, bob:0x5678
* }
* @param args.profile optional Profile to use from the config file.
*
* @returns
*/
publish(args: {
packageDirectoryPath: string;
namedAddresses: Record<string, AccountAddress>;
profile?: string;
}): Promise<boolean>;
/**
* Run a move command
*
* @param args
* @returns
*/
private runCommand;
/**
* Convert named addresses from a Map into an array seperated by a comma
*
* @example
* input: {'alice' => '0x123', 'bob' => '0x456'}
* output: "alice=0x123,bob=0x456"
*
* @param namedAddresses
* @returns An array of names addresses seperated by a comma
*/
private prepareNamedAddresses;
/**
* Parse named addresses from a Record type into a Map
*
* @param namedAddresses
* @returns Map<name,address>
*/
private parseNamedAddresses;
}
export { LocalNode, Move };