Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Top 10 Examples of "lisk-elements in functional component" in JavaScript

Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'lisk-elements' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.

localCommon.getNextForger(library, null, (err, delegatePublicKey) => {
					lastBlock = library.modules.blocks.lastBlock.get();
					lastBlockForger = delegatePublicKey;
					tmpAccount = randomUtil.account();

					// Create transfer transaction (fund new account)
					let transaction = elements.transaction.transfer({
						recipientId: tmpAccount.address,
						amount: 5000000000,
						passphrase: accountsFixtures.genesis.passphrase,
					});
					transactions.transfer.push(transaction);

					// Create register delegate transaction
					transaction = elements.transaction.registerDelegate({
						passphrase: tmpAccount.passphrase,
						username: 'my_little_delegate',
					});
					transactions.delegate.push(transaction);

					transaction = elements.transaction.castVotes({
						passphrase: accountsFixtures.genesis.passphrase,
						unvotes: [lastBlockForger],
						votes: [tmpAccount.publicKey],
					});
					transactions.vote.push(transaction);

					const transactionPool = library.rewiredModules.transactions.__get__(
						'__private.transactionPool'
					);
					// Delete two blocks more
* Copyright © 2018 Lisk Foundation
 *
 * See the LICENSE file at the top-level directory of this distribution
 * for licensing information.
 *
 * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,
 * no part of this software, including this file, may be copied, modified,
 * propagated, or distributed except according to the terms contained in the
 * LICENSE file.
 *
 * Removal or modification of this copyright notice is prohibited.
 */

'use strict';

var lisk = require('lisk-elements').default;
var accountFixtures = require('../../../fixtures/accounts');
var randomUtil = require('../../../common/utils/random');
var localCommon = require('../../common');

const { NORMALIZER } = global.constants;

describe('system test (type 2) - double delegate registrations', () => {
	var library;
	localCommon.beforeBlock('system_2_2_delegates_2', lib => {
		library = lib;
	});

	var i = 0;
	var t = 0;

	/* eslint-disable no-loop-func */
*
 * See the LICENSE file at the top-level directory of this distribution
 * for licensing information.
 *
 * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,
 * no part of this software, including this file, may be copied, modified,
 * propagated, or distributed except according to the terms contained in the
 * LICENSE file.
 *
 * Removal or modification of this copyright notice is prohibited.
 */

'use strict';

var randomstring = require('randomstring');
var lisk = require('lisk-elements').default;
var Bignum = require('../../../helpers/bignum.js');
var accountFixtures = require('../../fixtures/accounts');

var random = {};

// Returns a random number between min (inclusive) and max (exclusive)
random.number = function(min, max) {
	min = Math.ceil(min);
	max = Math.floor(max);
	return Math.floor(Math.random() * (max - min)) + min;
};

// Returns a random username of 16 characters
random.username = function() {
	var randomLetter = randomstring.generate({
		length: 1,
it('with lowercase recipientId should fail', () => {
			transaction = randomUtil.transaction();
			transaction.recipientId = transaction.recipientId.toLowerCase();
			transaction.signature = crypto.randomBytes(64).toString('hex');
			transaction.id = lisk.transaction.utils.getTransactionId(transaction);

			return sendTransactionPromise(transaction, 400).then(res => {
				expect(res.body.message).to.be.equal('Validation errors');
				badTransactions.push(transaction);
			});
		});
	});
it('should return error when value is greater than maximum acceptable value', () => {
				const minimum = MULTISIG_CONSTRAINTS.MIN.MAXIMUM + 1;
				const keysgroup = [
					multiSigAccount1.publicKey,
					multiSigAccount2.publicKey,
				];
				const multisigRegistration6 = lisk.transaction.registerMultisignature({
					passphrase: accountFixtures.genesis.passphrase,
					keysgroup,
					lifetime: 1,
					minimum,
				});

				return expect(() => {
					multisignature.objectNormalize(multisigRegistration6);
				}).to.throw(
					'Failed to validate multisignature schema: Value 16 is greater than maximum 15'
				);
			});
it('requesting multisig group transaction from non author account', () => {
				var scenario = scenarios.requesterPublicKey;

				var transaction = lisk.transaction.transfer({
					amount: 1 * NORMALIZER,
					passphrase: scenario.members[0].passphrase,
					recipientId: randomUtil.account().address,
				});
				transaction.requesterPublicKey = scenario.account.publicKey;
				transaction.id = lisk.transaction.utils.getTransactionId(transaction);

				return sendTransactionPromise(
					transaction,
					errorCodes.PROCESSING_ERROR
				).then(res => {
					expect(res.body.message).to.equal('Multisig request is not allowed');
					badTransactions.push(transaction);
				});
			});
		});
it('adding to pool second signature registration should be ok', done => {
		transaction1 = lisk.transaction.registerSecondPassphrase({
			passphrase: account.passphrase,
			secondPassphrase: account.secondPassphrase,
			timeOffset: -10000,
		});
		localCommon.addTransaction(library, transaction1, (err, res) => {
			expect(res).to.equal(transaction1.id);
			done();
		});
	});
* Copyright © 2018 Lisk Foundation
 *
 * See the LICENSE file at the top-level directory of this distribution
 * for licensing information.
 *
 * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,
 * no part of this software, including this file, may be copied, modified,
 * propagated, or distributed except according to the terms contained in the
 * LICENSE file.
 *
 * Removal or modification of this copyright notice is prohibited.
 */

'use strict';

const lisk = require('lisk-elements').cryptography;
const genesisDelegates = require('../../data/genesis_delegates.json');
const delegatesRoundsList = require('../../data/delegates_rounds_list.json');
const accountFixtures = require('../../fixtures/accounts');
const application = require('../../common/application');
const seeder = require('../../common/storage_seed');

let storage;

const exceptions = global.exceptions;
const { ACTIVE_DELEGATES } = global.constants;

describe('delegates', () => {
	let library;

	before(done => {
		application.init(
it('both passphrases should have the same address', done => {
		expect(lisk.cryptography.getAddressFromPublicKey(publicKeys[0])).to.equal(
			lisk.cryptography.getAddressFromPublicKey(publicKeys[1])
		);
		done();
	});
it('without should fail', () => {
				transaction = lisk.transfer.createOutTransfer(
					randomUtil.guestbookDapp.id,
					randomUtil.transaction().id,
					accountFixtures.genesis.address,
					Date.now(),
					account.passphrase
				);
				delete transaction.asset.outTransfer.dappId;

				return sendTransactionPromise(
					transaction,
					errorCodes.PROCESSING_ERROR
				).then(res => {
					expect(res.body.message).to.be.equal(
						'Invalid transaction body - Failed to validate outTransfer schema: Missing required property: dappId'
					);
					badTransactions.push(transaction);

Is your System Free of Underlying Vulnerabilities?
Find Out Now