How to use the lisk-elements.default function in lisk-elements

To help you get started, we’ve selected a few lisk-elements 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 LiskHQ / lisk-sdk / test / integration / transactions / 2.delegates / 2.same.account.different.usernames.js View on Github external
* 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 */
github LiskHQ / lisk-sdk / test / common / utils / random.js View on Github external
*
 * 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,
github LiskHQ / lisk-sdk-examples / test / integration / rounds.js View on Github external
*
 * 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 async = require('async');
const elements = require('lisk-elements').default;
const Promise = require('bluebird');
const ed = require('../../helpers/ed.js');
const slots = require('../../helpers/slots');
const Bignum = require('../../helpers/bignum.js');
const accountsFixtures = require('../fixtures/accounts');
const randomUtil = require('../common/utils/random');
const QueriesHelper = require('../common/integration/sql/queriesHelper.js');
const localCommon = require('./common');

const { REWARDS, ACTIVE_DELEGATES } = global.constants;

describe('rounds', () => {
	let library;
	let Queries;
	let generateDelegateListPromise;
	let addTransactionsAndForgePromise;
github LiskHQ / lisk-sdk / test / integration / scenarios / stress / 4.register_multisignature.js View on Github external
*
 * 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 Promise = require('bluebird');
var lisk = require('lisk-elements').default;
var accountFixtures = require('../../../fixtures/accounts');
var constants = require('../../../../helpers/constants');
var randomUtil = require('../../../common/utils/random');
var waitFor = require('../../../common/utils/wait_for');
var createSignatureObject = require('../../../common/helpers/api')
	.createSignatureObject;
var sendSignaturePromise = require('../../../common/helpers/api')
	.sendSignaturePromise;
var sendTransactionPromise = require('../../../common/helpers/api')
	.sendTransactionPromise;
var confirmTransactionsOnAllNodes = require('../common/stress')
	.confirmTransactionsOnAllNodes;

var broadcastingDisabled = process.env.BROADCASTING_DISABLED === 'true';

module.exports = function(params) {
github LiskHQ / lisk-sdk / test / integration / transactions / 1.second_signature / 1.X.second_signature_validated.js View on Github external
* 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').default;
const accountFixtures = require('../../../fixtures/accounts');
const randomUtil = require('../../../common/utils/random');
const transactionTypes = require('../../../../helpers/transaction_types.js');
const localCommon = require('../../common');

const { NORMALIZER } = global.constants;

describe('system test (type 1) - checking validated second signature registrations against other transaction types', () => {
	let library;

	const account = randomUtil.account();
	const creditTransaction = lisk.transaction.transfer({
		amount: 1000 * NORMALIZER,
		passphrase: accountFixtures.genesis.passphrase,
		recipientId: account.address,
	});
github LiskHQ / lisk-sdk / test / functional / http / post / 3.votes.js View on Github external
* 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';

require('../../functional.js');
var Promise = require('bluebird');
var lisk = require('lisk-elements').default;
var phases = require('../../../common/phases');
var accountFixtures = require('../../../fixtures/accounts');
var randomUtil = require('../../../common/utils/random');
var waitFor = require('../../../common/utils/wait_for');
var elements = require('../../../common/utils/elements');
var apiHelpers = require('../../../common/helpers/api');
var errorCodes = require('../../../../helpers/api_codes');
var common = require('./common');

const {
	FEES,
	NORMALIZER,
	ACTIVE_DELEGATES,
	MAX_VOTES_PER_TRANSACTION,
} = global.constants;
var sendTransactionPromise = apiHelpers.sendTransactionPromise;
github LiskHQ / lisk-sdk-examples / test / functional / http / get / delegates.js View on Github external
* 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';

require('../../functional.js');
const Promise = require('bluebird');
const lisk = require('lisk-elements').default;
const genesisDelegates = require('../../../data/genesis_delegates.json');
const accountFixtures = require('../../../fixtures/accounts');
const slots = require('../../../../helpers/slots');
const randomUtil = require('../../../common/utils/random');
const waitFor = require('../../../common/utils/wait_for');
const SwaggerEndpoint = require('../../../common/swagger_spec');
const apiHelpers = require('../../../common/helpers/api');
const Bignum = require('../../../../helpers/bignum.js');

Promise.promisify(waitFor.newRound);
const { FEES } = global.constants;
const expectSwaggerParamError = apiHelpers.expectSwaggerParamError;

describe('GET /delegates', () => {
	const delegatesEndpoint = new SwaggerEndpoint('GET /delegates');
	const validDelegate = genesisDelegates.delegates[0];
github LiskHQ / lisk-sdk / test / functional / http / post / 4.multisignature.js View on Github external
*
 * 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';

require('../../functional.js');
var lisk = require('lisk-elements').default;
var phases = require('../../../common/phases');
var Scenarios = require('../../../common/scenarios');
var accountFixtures = require('../../../fixtures/accounts');
var apiCodes = require('../../../../helpers/api_codes');
var randomUtil = require('../../../common/utils/random');
var waitFor = require('../../../common/utils/wait_for');
var elements = require('../../../common/utils/elements');
var swaggerEndpoint = require('../../../common/swagger_spec');
var apiHelpers = require('../../../common/helpers/api');
var errorCodes = require('../../../../helpers/api_codes');
var common = require('./common');

const { FEES, MULTISIG_CONSTRAINTS } = global.constants;
var sendTransactionPromise = apiHelpers.sendTransactionPromise;

describe('POST /api/transactions (type 4) register multisignature', () => {
github LiskHQ / lisk-sdk / test / functional / http / get / dapps.js View on Github external
* 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';

require('../../functional.js');
var Promise = require('bluebird');
var lisk = require('lisk-elements').default;
var accountFixtures = require('../../../fixtures/accounts');
var randomUtil = require('../../../common/utils/random');
var waitFor = require('../../../common/utils/wait_for');
var swaggerEndpoint = require('../../../common/swagger_spec');
var apiHelpers = require('../../../common/helpers/api');

const { NORMALIZER } = global.constants;
var expectSwaggerParamError = apiHelpers.expectSwaggerParamError;

describe('GET /dapps', () => {
	var dappsEndpoint = new swaggerEndpoint('GET /dapps');

	var transactionsToWaitFor = [];

	var account = randomUtil.account();
	var dapp1 = randomUtil.application();
github LiskHQ / lisk-sdk / test / functional / http / get / node / transactions_unconfirmed.js View on Github external
* 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';

require('../../../functional.js');
var Promise = require('bluebird');
var lisk = require('lisk-elements').default;
var apiHelpers = require('../../../../common/helpers/api');
var randomUtil = require('../../../../common/utils/random');
var swaggerEndpoint = require('../../../../common/swagger_spec');
var accountFixtures = require('../../../../fixtures/accounts');

const { NORMALIZER } = global.constants;
var expectSwaggerParamError = apiHelpers.expectSwaggerParamError;
var sendTransactionPromise = apiHelpers.sendTransactionPromise;

describe('GET /api/node', () => {
	describe('/transactions', () => {
		describe('/unconfirmed', () => {
			var UnconfirmedEndpoint = new swaggerEndpoint(
				'GET /node/transactions/{state}'
			).addParameters({ state: 'unconfirmed' });