UNPKG

@j0nnyboi/amman

Version:

A modern mandatory toolbelt to help test solana SDK libraries and apps on a locally running validator.

76 lines (75 loc) 3.2 kB
/// <reference types="node" /> import { PersistedAccountInfo } from '@j0nnyboi/amman-client'; import { Keypair } from '@safecoin/web3.js'; import { ChildProcess } from 'child_process'; import { AccountStates } from 'src/accounts/state'; import { AmmanConfig } from '../types'; import { AmmanState } from './types'; export declare function buildSolanaValidatorArgs(config: Required<AmmanConfig>, forceClone: boolean): Promise<{ args: string[]; persistedAccountInfos: PersistedAccountInfo[]; persistedSnapshotAccountInfos: (PersistedAccountInfo & { label: string; accountPath: string; })[]; snapshotAccounts: import("./types").Account[]; accountsFolder: string; keypairs: Map<string, Keypair>; cleanupConfig: () => Promise<void>; }>; export declare function startSolanaValidator(args: string[], detached: boolean): Promise<ChildProcess>; export declare function waitForValidator(jsonRpcUrl: string, verifyFees: boolean, cleanupConfig: () => Promise<void>): Promise<void>; export declare function killValidatorChild(child: ChildProcess): Promise<unknown>; /** * Attempts to kill and restart the validator creating a snapshot of accounts and keypairs first. * That same snapshot is then loaded on restart. * * @param accountOverrides allow to override some accounts that are written to the snapshot * */ export declare function restartValidatorWithAccountOverrides(accountStates: AccountStates, ammanState: AmmanState, addresses: string[], accountLabels: Record<string, string>, keypairs: Map<string, { keypair: Keypair; id: string; }>, accountOverrides: Map<string, PersistedAccountInfo>): Promise<{ persistedAccountInfos: PersistedAccountInfo[]; persistedSnapshotAccountInfos: (PersistedAccountInfo & { label: string; accountPath: string; })[]; snapshotAccounts: import("./types").Account[]; accountsFolder: string; keypairs: Map<string, Keypair>; args: string[]; }>; /** * Attempts to kill and restart the validator with the given snapshot. */ export declare function restartValidatorWithSnapshot(accountStates: AccountStates, ammanState: AmmanState, snapshotLabel: string): Promise<{ persistedAccountInfos: PersistedAccountInfo[]; persistedSnapshotAccountInfos: (PersistedAccountInfo & { label: string; accountPath: string; })[]; snapshotAccounts: import("./types").Account[]; accountsFolder: string; keypairs: Map<string, Keypair>; args: string[]; }>; /** * Attempts to kill and restart the validator with the provided config. * * NOTE: that for now this seems to only work once, i.e. the validator fails to * handle transactions after it is restarted twice (they time out after 30secs) * */ export declare function restartValidator(accountStates: AccountStates, ammanState: AmmanState, config: Required<AmmanConfig>): Promise<{ persistedAccountInfos: PersistedAccountInfo[]; persistedSnapshotAccountInfos: (PersistedAccountInfo & { label: string; accountPath: string; })[]; snapshotAccounts: import("./types").Account[]; accountsFolder: string; keypairs: Map<string, Keypair>; args: string[]; }>;