import { Numeric } from "."; import { FlushResponse, IncreaseTimeResponse, LoadL1MessagingContractResponse, SetTimeResponse, PredeployedAccount, L1ToL2MockTxResponse, L2ToL1MockTxResponse, NewBlockResponse } from "../devnet-utils"; import { MintResponse } from "../starknet-types"; export interface Devnet { /** * Restarts the devnet. * @returns void * @throws {@link StarknetPluginError} */ restart(): Promise; /** * Handles all pending L1 to L2 messages and sends them to the other layer * @returns {Promise} - Metadata for the flushed messages */ flush: () => Promise; /** * Deploys or loads the L1 messaging contract. * @param {string} networkUrl - L1 network url. * @param {string} [address] - Address of the contract to be loaded. * @param {string} [networkId] - Determines if the ganache or testnet should be used/ * @returns */ loadL1MessagingContract: (networkUrl: string, address?: string, networkId?: string) => Promise; /** * Sends a mock message from L1 to L2 without running L1. * @param {string} l2ContractAddress - Address of the L2 contract. * @param {string} functionName - Function name for entry point selector. * @param {string} l1ContractAddress - Address of the L1 contract. * @param {Array} payload - Payload to send to the L2 network. * @param {string} nonce - Nonce value * @param {string} paidFeeOnL1 - Paid fee on L1 * @returns Transaction hash */ sendMessageToL2: (l2ContractAddress: string, functionName: string, l1ContractAddress: string, payload: Array, nonce: Numeric, paidFeeOnL1: Numeric) => Promise; /** * Sends a mock message from L2 to L1 * @param {string} l2ContractAddress - Address of the L2 contract. * @param {string} l1ContractAddress - Address of the L1 contract. * @param {Array} payload - Payload to send to the L1 network. * @returns Message hash */ consumeMessageFromL2: (l2ContractAddress: string, l1ContractAddress: string, payload: Array) => Promise; /** * Increases block time offset * @param seconds the offset increase in seconds * @returns an object containing the increased block time offset */ increaseTime: (seconds: number) => Promise; /** * Sets the timestamp of next block * @param seconds timestamp in seconds * @returns an object containing next block timestamp */ setTime: (seconds: number) => Promise; /** * Fetch the predeployed accounts * @returns an object containing array of account's metadata */ getPredeployedAccounts: () => Promise; /** * Preserves devnet instance to a file * @param path path for the dumping * @return void */ dump: (path: string) => Promise; /** * Loads stored Starknet chain state * @param path path for the dump file * @returns void */ load: (path: string) => Promise; /** * Creates an empty block * @returns NewBlockResponse with block hash */ createBlock: () => Promise; /** * Assumes there is a /mint endpoint on the current starknet network * @param address the address to fund * @param amount the amount to fund * @param lite whether to make it lite or not */ mint: (address: string, amount: number, lite?: boolean) => Promise; }