We will be sunsetting Advisor during Jan, 2026 and will instead be providing information in Snyk Security DB.

You can begin to take advantage of Snyk Security DB today for a unified, package-centric experience.

How to use the @nimiq/core.Policy function in @nimiq/core

To help you get started, we’ve selected a few @nimiq/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MatthewDLudwig / NimiqWrapper / releases / browser / NimiqWrapper.js View on Github external
estimateRewardPerHour() {
		if (!this.wrappedMiner) {
			this.theWrapper.callbacks.error("MinerHelper:estimateRewardPerHour", NimiqWrapper.ERROR_MESSAGES.NO_MINER_YET);
			return;
		}

		let myHash = this.wrappedMiner.hashrate;
		let goHash = this.theWrapper.globalHashrate;
		let reward = Nimiq.Policy.lunasToCoins(Nimiq.Policy.blockRewardAt(this.theWrapper.blockHeight));
		let perBlock = (myHash / goHash) * reward;

		return perBlock * (60 / 1); //1 block per minute, 60 minutes in an hour.
	}
github MatthewDLudwig / NimiqWrapper / releases / browser / NimiqWrapper.js View on Github external
get globalHashrate() {
		const nBits = this.wrappedNode.blockchain.head.header.nBits;
		const difficulty = Nimiq.BlockUtils.compactToDifficulty(nBits);
		return difficulty * Math.pow(2, 16) / Nimiq.Policy.BLOCK_TIME;
	}
github MatthewDLudwig / NimiqWrapper / releases / browser / NimiqWrapper.js View on Github external
convertNIMToLuna(value) {
		return Nimiq.Policy.coinsToLunas(value);
	}