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.BufferUtils 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
		return this.mempoolTxs.map(it => Nimiq.BufferUtils.toHex(it._hash._obj));
	}
github MatthewDLudwig / NimiqWrapper / releases / browser / NimiqWrapper.js View on Github external
importWalletFromHexKey(key) {
		let privateKey = Nimiq.PrivateKey.unserialize(Nimiq.BufferUtils.fromHex(key.replace("0x", "")));
		let keypair = Nimiq.KeyPair.derive(privateKey);
		return new Nimiq.Wallet(keypair);
	}
github MatthewDLudwig / NimiqWrapper / releases / browser / NimiqWrapper.js View on Github external
let trackID = this.theWrapper.wrappedNode.mempool.on("transaction-added", (tx) => {
				if (tx.sender.equals(watchAddr) || tx.recipient.equals(watchAddr)) {
					if (!onlyMined) callback(tx, "mining");

					let txHash = Nimiq.BufferUtils.toHex(tx._hash._obj);
					let tracker = setInterval(() => {
						if (!this.theWrapper.mempoolTxHashes.includes(txHash)) {
							clearInterval(tracker);
							callback(tx, "mined");
						}
					}, 1000);
				}
			});
github MatthewDLudwig / NimiqWrapper / releases / browser / NimiqWrapper.js View on Github external
initMiner(options = { }) {
	  	this.minerOptions = {
			pool : true,
			addr : Nimiq.Address.fromUserFriendlyAddress("NQ07 0000 0000 0000 0000 0000 0000 0000 0000"),
			data : new Uint8Array(0),
			host : "us.nimpool.io",
			port : 8444
		};

		if (options.soloMine) this.minerOptions.pool = false;
		if (options.poolHost) this.minerOptions.host = options.poolHost;
		if (options.poolPort) this.minerOptions.port = options.poolPort;
		if (options.extraData) {
			if (typeof options.extraData == "string") {
				this.minerOptions.data = Nimiq.BufferUtils.fromAscii(options.extraData);
			} else if (options.extraData instanceof Uint8Array) {
				this.minerOptions.data = options.extraData;
			} else {
				this.theWrapper.callbacks.error("MinerHelper:initMiner", NimiqWrapper.ERROR_MESSAGES.BAD_DATA);
			}
		}
		if (options.address) {
			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);
			}