/// import MoneroAltChain from "./model/MoneroAltChain"; import MoneroBan from "./model/MoneroBan"; import MoneroBlock from "./model/MoneroBlock"; import MoneroBlockHeader from "./model/MoneroBlockHeader"; import MoneroBlockTemplate from "./model/MoneroBlockTemplate"; import MoneroConnectionSpan from "./model/MoneroConnectionSpan"; import MoneroDaemon from "./MoneroDaemon"; import MoneroDaemonConfig from "./model/MoneroDaemonConfig"; import MoneroDaemonInfo from "./model/MoneroDaemonInfo"; import MoneroDaemonListener from "./model/MoneroDaemonListener"; import MoneroDaemonSyncInfo from "./model/MoneroDaemonSyncInfo"; import MoneroDaemonUpdateCheckResult from "./model/MoneroDaemonUpdateCheckResult"; import MoneroDaemonUpdateDownloadResult from "./model/MoneroDaemonUpdateDownloadResult"; import MoneroFeeEstimate from "./model/MoneroFeeEstimate"; import MoneroHardForkInfo from "./model/MoneroHardForkInfo"; import MoneroKeyImageSpentStatus from "./model/MoneroKeyImageSpentStatus"; import MoneroMinerTxSum from "./model/MoneroMinerTxSum"; import MoneroMiningStatus from "./model/MoneroMiningStatus"; import MoneroOutput from "./model/MoneroOutput"; import MoneroOutputHistogramEntry from "./model/MoneroOutputHistogramEntry"; import MoneroPeer from "./model/MoneroPeer"; import MoneroPruneResult from "./model/MoneroPruneResult"; import MoneroRpcConnection from "../common/MoneroRpcConnection"; import MoneroSubmitTxResult from "./model/MoneroSubmitTxResult"; import MoneroTx from "./model/MoneroTx"; import MoneroTxPoolStats from "./model/MoneroTxPoolStats"; import MoneroVersion from "./model/MoneroVersion"; import { ChildProcess } from "child_process"; /** * Copyright (c) woodser * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /** * Implements a MoneroDaemon as a client of monerod. */ declare class MoneroDaemonRpc extends MoneroDaemon { protected static readonly MAX_REQ_SIZE = "3000000"; protected static readonly DEFAULT_ID = "0000000000000000000000000000000000000000000000000000000000000000"; protected static readonly NUM_HEADERS_PER_REQ = 750; protected static readonly DEFAULT_POLL_PERIOD = 20000; protected config: Partial; protected listeners: MoneroDaemonListener[]; protected cachedHeaders: any; protected process: any; protected pollListener: any; protected proxyDaemon: any; /** @private */ constructor(config: MoneroDaemonConfig, proxyDaemon: MoneroDaemonRpcProxy); /** * Get the internal process running monerod. * * @return {ChildProcess} the node process running monerod, undefined if not created from new process */ getProcess(): ChildProcess; /** * Stop the internal process running monerod, if applicable. * * @param {boolean} [force] specifies if the process should be destroyed forcibly (default false) * @return {Promise} the exit code from stopping the process */ stopProcess(force?: boolean): Promise; addListener(listener: MoneroDaemonListener): Promise; removeListener(listener: MoneroDaemonListener): Promise; getListeners(): MoneroDaemonListener[]; /** * Get the daemon's RPC connection. * * @return {MoneroRpcConnection} the daemon's rpc connection */ getRpcConnection(): Promise; isConnected(): Promise; getVersion(): Promise; isTrusted(): Promise; getHeight(): Promise; getBlockHash(height: number): Promise; getBlockTemplate(walletAddress: string, reserveSize?: number): Promise; getLastBlockHeader(): Promise; getBlockHeaderByHash(blockHash: string): Promise; getBlockHeaderByHeight(height: number): Promise; getBlockHeadersByRange(startHeight?: number, endHeight?: number): Promise; getBlockByHash(blockHash: string): Promise; getBlockByHeight(height: number): Promise; getBlocksByHeight(heights: number[]): Promise; getBlocksByRange(startHeight?: number, endHeight?: number): Promise; getBlocksByRangeChunked(startHeight?: number, endHeight?: number, maxChunkSize?: number): Promise; getTxs(txHashes: string[], prune?: boolean): Promise; getTxHexes(txHashes: string[], prune?: boolean): Promise; getMinerTxSum(height: number, numBlocks: number): Promise; getFeeEstimate(graceBlocks?: number): Promise; submitTxHex(txHex: string, doNotRelay: boolean): Promise; relayTxsByHash(txHashes: string[]): Promise; getTxPool(): Promise; getTxPoolHashes(): Promise; getTxPoolStats(): Promise; flushTxPool(hashes?: string | string[]): Promise; getKeyImageSpentStatuses(keyImages: string[]): Promise; getOutputHistogram(amounts?: bigint[], minCount?: number, maxCount?: number, isUnlocked?: boolean, recentCutoff?: number): Promise; getOutputDistribution(amounts: any, cumulative: any, startHeight: any, endHeight: any): Promise; getInfo(): Promise; getSyncInfo(): Promise; getHardForkInfo(): Promise; getAltChains(): Promise; getAltBlockHashes(): Promise; getDownloadLimit(): Promise; setDownloadLimit(limit: number): Promise; resetDownloadLimit(): Promise; getUploadLimit(): Promise; setUploadLimit(limit: number): Promise; resetUploadLimit(): Promise; getPeers(): Promise; getKnownPeers(): Promise; setOutgoingPeerLimit(limit: number): Promise; setIncomingPeerLimit(limit: number): Promise; getPeerBans(): Promise; setPeerBans(bans: MoneroBan[]): Promise; startMining(address: string, numThreads?: number, isBackground?: boolean, ignoreBattery?: boolean): Promise; stopMining(): Promise; getMiningStatus(): Promise; submitBlocks(blockBlobs: string[]): Promise; pruneBlockchain(check: boolean): Promise; checkForUpdate(): Promise; downloadUpdate(path?: string): Promise; stop(): Promise; waitForNextBlockHeader(): Promise; getPollInterval(): number; getTx(txHash?: string, prune?: boolean): Promise; getTxHex(txHash: string, prune?: boolean): Promise; getKeyImageSpentStatus(keyImage: string): Promise; setPeerBan(ban: MoneroBan): Promise; submitBlock(blockBlob: string): Promise; protected refreshListening(): void; protected getBandwidthLimits(): Promise; protected setBandwidthLimits(downLimit: any, upLimit: any): Promise; /** * Get a contiguous chunk of blocks starting from a given height up to a maximum * height or amount of block data fetched from the blockchain, whichever comes first. * * @param {number} [startHeight] - start height to retrieve blocks (default 0) * @param {number} [maxHeight] - maximum end height to retrieve blocks (default blockchain height) * @param {number} [maxReqSize] - maximum amount of block data to fetch from the blockchain in bytes (default 3,000,000 bytes) * @return {MoneroBlock[]} are the resulting chunk of blocks */ protected getMaxBlocks(startHeight: any, maxHeight: any, maxReqSize: any): Promise; /** * Retrieves a header by height from the cache or fetches and caches a header * range if not already in the cache. * * @param {number} height - height of the header to retrieve from the cache * @param {number} maxHeight - maximum height of headers to cache */ protected getBlockHeaderByHeightCached(height: any, maxHeight: any): Promise; static connectToDaemonRpc(uriOrConfig: string | Partial | Partial | string[], username?: string, password?: string): Promise; protected static startMonerodProcess(config: MoneroDaemonConfig): Promise; protected static normalizeConfig(uriOrConfig: string | Partial | Partial | string[], username?: string, password?: string): MoneroDaemonConfig; protected static checkResponseStatus(resp: any): void; protected static convertRpcBlockHeader(rpcHeader: any): MoneroBlockHeader; protected static convertRpcBlock(rpcBlock: any): MoneroBlock; /** * Transfers RPC tx fields to a given MoneroTx without overwriting previous values. * * TODO: switch from safe set * * @param rpcTx - RPC map containing transaction fields * @param tx - MoneroTx to populate with values (optional) * @return tx - same tx that was passed in or a new one if none given */ protected static convertRpcTx(rpcTx: any, tx: any): any; protected static convertRpcOutput(rpcOutput: any, tx: any): MoneroOutput; protected static convertRpcBlockTemplate(rpcTemplate: any): MoneroBlockTemplate; protected static convertRpcInfo(rpcInfo: any): MoneroDaemonInfo; /** * Initializes sync info from RPC sync info. * * @param rpcSyncInfo - rpc map to initialize the sync info from * @return {MoneroDaemonSyncInfo} is sync info initialized from the map */ protected static convertRpcSyncInfo(rpcSyncInfo: any): MoneroDaemonSyncInfo; protected static convertRpcHardForkInfo(rpcHardForkInfo: any): MoneroHardForkInfo; protected static convertRpcConnectionSpan(rpcConnectionSpan: any): MoneroConnectionSpan; protected static convertRpcOutputHistogramEntry(rpcEntry: any): MoneroOutputHistogramEntry; protected static convertRpcSubmitTxResult(rpcResult: any): MoneroSubmitTxResult; protected static convertRpcTxPoolStats(rpcStats: any): MoneroTxPoolStats; protected static convertRpcAltChain(rpcChain: any): MoneroAltChain; protected static convertRpcPeer(rpcPeer: any): MoneroPeer; protected static convertRpcConnection(rpcConnection: any): MoneroPeer; protected static convertToRpcBan(ban: MoneroBan): any; protected static convertRpcMiningStatus(rpcStatus: any): MoneroMiningStatus; protected static convertRpcUpdateCheckResult(rpcResult: any): MoneroDaemonUpdateCheckResult; protected static convertRpcUpdateDownloadResult(rpcResult: any): MoneroDaemonUpdateDownloadResult; /** * Converts a '0x' prefixed hexidecimal string to a bigint. * * @param {string} hex is the '0x' prefixed hexidecimal string to convert * @return {bigint} the hexicedimal converted to decimal */ protected static prefixedHexToBI(hex: any): bigint; } /** * Implements a MoneroDaemon by proxying requests to a worker. * * @private */ declare class MoneroDaemonRpcProxy { private daemonId; private worker; private wrappedListeners; private process; constructor(daemonId: any, worker: any); static connect(config: MoneroDaemonConfig): Promise; addListener(listener: any): Promise; removeListener(listener: any): Promise; getListeners(): Promise; getRpcConnection(): Promise; isConnected(): Promise; getVersion(): Promise; isTrusted(): Promise; getHeight(): Promise; getBlockHash(height: any): Promise; getBlockTemplate(walletAddress: any, reserveSize: any): Promise; getLastBlockHeader(): Promise; getBlockHeaderByHash(blockHash: any): Promise; getBlockHeaderByHeight(height: any): Promise; getBlockHeadersByRange(startHeight: any, endHeight: any): Promise; getBlockByHash(blockHash: any): Promise; getBlocksByHash(blockHashes: any, startHeight: any, prune: any): Promise; getBlockByHeight(height: any): Promise; getBlocksByHeight(heights: any): Promise; getBlocksByRange(startHeight: any, endHeight: any): Promise; getBlocksByRangeChunked(startHeight: any, endHeight: any, maxChunkSize: any): Promise; getBlockHashes(blockHashes: any, startHeight: any): Promise; getTxs(txHashes: any, prune?: boolean): Promise; getTxHexes(txHashes: any, prune?: boolean): Promise; getMinerTxSum(height: any, numBlocks: any): Promise; getFeeEstimate(graceBlocks?: any): Promise; submitTxHex(txHex: any, doNotRelay: any): Promise; relayTxsByHash(txHashes: any): Promise; getTxPool(): Promise; getTxPoolHashes(): Promise; getTxPoolBacklog(): Promise; getTxPoolStats(): Promise; flushTxPool(hashes: any): Promise; getKeyImageSpentStatuses(keyImages: any): Promise; getOutputs(outputs: any): Promise; getOutputHistogram(amounts: any, minCount: any, maxCount: any, isUnlocked: any, recentCutoff: any): Promise; getOutputDistribution(amounts: any, cumulative: any, startHeight: any, endHeight: any): Promise; getInfo(): Promise; getSyncInfo(): Promise; getHardForkInfo(): Promise; getAltChains(): Promise; getAltBlockHashes(): Promise; getDownloadLimit(): Promise; setDownloadLimit(limit: any): Promise; resetDownloadLimit(): Promise; getUploadLimit(): Promise; setUploadLimit(limit: any): Promise; resetUploadLimit(): Promise; getPeers(): Promise; getKnownPeers(): Promise; setOutgoingPeerLimit(limit: any): Promise; setIncomingPeerLimit(limit: any): Promise; getPeerBans(): Promise; setPeerBans(bans: any): Promise; startMining(address: any, numThreads: any, isBackground: any, ignoreBattery: any): Promise; stopMining(): Promise; getMiningStatus(): Promise; submitBlocks(blockBlobs: any): Promise; pruneBlockchain(check: any): Promise; checkForUpdate(): Promise; downloadUpdate(path: any): Promise; stop(): Promise; waitForNextBlockHeader(): Promise; protected invokeWorker(fnName: string, args?: any): Promise; } export default MoneroDaemonRpc;