import { waitPort } from '@hackbg/port'; import { Path, SyncFS } from '@hackbg/file'; import * as OCI from '@fadroma/oci'; import { Core, Program, Chain, Token } from '@fadroma/agent'; import type { Address, CodeId, Uint128 } from '@fadroma/agent'; /** Identifiers of supported platforms. */ export type Platform = 'scrt' | 'okp4'; /** Identifiers of supported API endpoints. * These are different APIs exposed by a node at different ports. * One of these is used by default - can be a different one * depending on platform version. */ export type APIMode = 'http' | 'rpc' | 'grpc' | 'grpcWeb'; export declare class DevnetContainerState { /** Whether the devnet container is started. */ running: boolean; /** Chain ID of chain node running inside devnet container. */ chainId?: string; /** Denomination of base gas token for this chain. */ gasToken?: Token.Native; /** Whether more detailed output is preferred. */ verbose: boolean; /** Name of devnet platform. */ platformName: Platform; /** Version of devnet platform. */ platformVersion: string; /** Container instance of devnet. */ container: OCI.Container; /** URL for connecting to a remote devnet. */ url?: string | URL; /** The protocol of the API URL without the trailing colon. */ nodeProtocol: string; /** The hostname of the API URL. */ nodeHost: string; /** Which service does the API URL port correspond to. */ nodePortMode?: APIMode; /** The port of the API URL. */ nodePort?: string | number; /** Name of binary in container to start. */ nodeBinary?: string; /** Initial accounts. */ genesisAccounts: Record; /** Initial uploads. */ genesisUploads: Record>; /** If set, overrides the script that launches the devnet in the container. */ initScript: Path; /** Function that waits for port to open after launching container. * Tests override this to save time. */ waitPort: typeof waitPort; /** Once this phrase is encountered in the log output * from the container, the devnet is ready to accept requests. */ waitString: string; /** Seconds to wait after first block. * Tests override this to save time. */ waitMore: number; /** This directory contains the state of all devnets, e.g. `~/.local/share/fadroma/devnets`. * The devnet container will create a subdirectory named after the chain ID. */ stateRoot: SyncFS.Directory; /** What to do with the devnet once the process that has spawned it exits. * - "remain": the devnet container keeps running * - "pause": the devnet container is stopped * - "remove": the devnet container is stopped and removed, along with the state directory */ onScriptExit: 'remain' | 'pause' | 'remove'; /** The exit handler that cleans up external resources. */ exitHandler?: (...args: any) => void; constructor(options?: Partial); get platform(): string; /** This directory contains the state of the devnet, * such as statefile, runfile, genesis accounts. */ get stateDir(): SyncFS.Directory; /** This file contains the state of the devnet, * such as container ID. */ get stateFile(): SyncFS.File; /** This file is created when the container is started. * Deleting it tells the script running inside the container to kill the devnet. */ get runFile(): SyncFS.File; } /** A private local instance of a network, * running in a container managed by @fadroma/oci. */ export default abstract class DevnetContainer extends DevnetContainerState implements Chain.Backend { /** Logger. */ log: Core.Console; constructor(options?: Partial); /** Wait for the devnet to be created. */ readonly created: Promise; /** Wait for the devnet to be removed. */ readonly removed: Promise; /** Wait for the devnet to be started. */ readonly started: Promise; /** Wait for the devnet to be stopped. */ readonly paused: Promise; /** Obtain a Connection object to this devnet, optionally with a specific Identity. */ abstract connect(parameter?: string | Partial): Promise; /** Get info for named genesis account, including the mnemonic */ getIdentity(name: string | { name?: string; }): Promise & { mnemonic: string; }>; /** Export the contents of the devnet as a container image. */ export(repository?: string, tag?: string): Promise; } //# sourceMappingURL=devnet-base.d.ts.map