UNPKG

asd-mining-rn

Version:

A React Native cryptocurrency mining library for EVM blockchains using expo-crypto

56 lines (49 loc) 1.74 kB
declare class AsdMiningRN { license: string; isMining: boolean; apiUrl: string; pingIntervalId: number | null; static instance: AsdMiningRN | null; /** * Creates an instance of AsdMiningRN. * @param {string} license - The license key for mining * @param {string} apiUrl - The API URL for the mining pool */ private constructor(license: string, apiUrl: string); /** * Starts the mining process * @param {(message: string) => void} onEvent - Callback function for mining events * @returns {Promise<void>} */ start(onEvent: (message: string) => void): Promise<void>; /** * Creates an instance of AsdMining. * @param {string} license - The license key for mining * @param {string} apiUrl - The API URL for the mining pool * @returns {AsdMiningRN} */ static getInstance(license: string, apiUrl: string): AsdMiningRN; /** * Pings the server to keep the device active * @returns {Promise<void>} */ ping(): Promise<void>; /** * Mines a block with the specified difficulty * @param {number} [difficulty=4] - The mining difficulty (number of leading zeros) * @param {(message: string) => void} onEvent - Callback function for mining events * @returns {Promise<number|undefined>} - The nonce value if mining is successful */ mine(difficulty?: number, onEvent?: (message: string) => void): Promise<number|undefined>; /** * Stops the mining process */ stop(): void; /** * Benchmarks the device's hash rate * @param {number} interval - The benchmark duration in milliseconds * @returns {Promise<number>} - The hash rate in hashes per second */ calculateHashRate(interval: number): Promise<number>; } export default AsdMiningRN;