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.BasePoolMiner 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
if (options.address instanceof Nimiq.Wallet) {
				this.minerOptions.addr = options.address.address;
			} else if (options.address instanceof Nimiq.Address) {
				this.minerOptions.addr = options.address;
			} else if (typeof options.address == "string") {
				this.minerOptions.addr = Nimiq.Address.fromUserFriendlyAddress(options.address);
			} else {
				this.theWrapper.callbacks.error("MinerHelper:initMiner", NimiqWrapper.ERROR_MESSAGES.BAD_ADDRESS);
			}
		}

		if (this.minerOptions.pool) {
			if (this.theWrapper.nodeType == "NANO") {
				this.wrappedMiner = new Nimiq.NanoPoolMiner(this.theWrapper.wrappedNode.blockchain, this.theWrapper.wrappedNode.network.time, this.minerOptions.addr, Nimiq.BasePoolMiner.generateDeviceId(this.theWrapper.wrappedNode.network.config), this.minerOptions.data);
			} else {
				this.wrappedMiner = new Nimiq.SmartPoolMiner(this.theWrapper.wrappedNode.blockchain, this.theWrapper.wrappedNode.accounts, this.theWrapper.wrappedNode.mempool, this.theWrapper.wrappedNode.network.time, this.minerOptions.addr, Nimiq.BasePoolMiner.generateDeviceId(this.theWrapper.wrappedNode.network.config), this.minerOptions.data);
			}
		} else {
			this.wrappedMiner = new Nimiq.Miner(this.theWrapper.wrappedNode.blockchain, this.theWrapper.wrappedNode.accounts, this.theWrapper.wrappedNode.mempool, this.theWrapper.wrappedNode.network.time, this.minerOptions.addr, this.minerOptions.data);

		}

		this.theWrapper.wrappedNode.miner = this.wrappedMiner;
		this.wrappedMiner.on('start', () => this.theWrapper.callbacks.minerChanged('started'));
		this.wrappedMiner.on('stop', () => this.theWrapper.callbacks.minerChanged('stopped'));

		if (this.minerOptions.pool) {
			this.wrappedMiner.on('connection-state', state => {
				if (state == Nimiq.BasePoolMiner.ConnectionState.CONNECTED) {
					this.theWrapper.callbacks.connectionState("connected");
				} else if (state == Nimiq.BasePoolMiner.ConnectionState.CONNECTING) {
					this.theWrapper.callbacks.connectionState("connecting");
github MatthewDLudwig / NimiqWrapper / releases / browser / NimiqWrapper.js View on Github external
this.wrappedMiner.on('connection-state', state => {
				if (state == Nimiq.BasePoolMiner.ConnectionState.CONNECTED) {
					this.theWrapper.callbacks.connectionState("connected");
				} else if (state == Nimiq.BasePoolMiner.ConnectionState.CONNECTING) {
					this.theWrapper.callbacks.connectionState("connecting");
				} else if (state == Nimiq.BasePoolMiner.ConnectionState.CLOSED) {
					this.theWrapper.callbacks.connectionState("disconnected");
				} else {
					this.theWrapper.callbacks.error("MinerHelper:initMiner", NimiqWrapper.ERROR_MESSAGES.UNKNOWN_STATE);
				}
			});
github MatthewDLudwig / NimiqWrapper / releases / browser / NimiqWrapper.js View on Github external
this.wrappedMiner.on('connection-state', state => {
				if (state == Nimiq.BasePoolMiner.ConnectionState.CONNECTED) {
					this.theWrapper.callbacks.connectionState("connected");
				} else if (state == Nimiq.BasePoolMiner.ConnectionState.CONNECTING) {
					this.theWrapper.callbacks.connectionState("connecting");
				} else if (state == Nimiq.BasePoolMiner.ConnectionState.CLOSED) {
					this.theWrapper.callbacks.connectionState("disconnected");
				} else {
					this.theWrapper.callbacks.error("MinerHelper:initMiner", NimiqWrapper.ERROR_MESSAGES.UNKNOWN_STATE);
				}
			});