How to use the lisk-elements.default.transaction 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 / rounds.js View on Github external
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
github LiskHQ / lisk-sdk / test / functional / http / post / 0.transfer.js View on Github external
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);
			});
		});
	});
github LiskHQ / lisk-sdk-examples / test / unit / logic / multisignature.js View on Github external
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'
				);
			});
github LiskHQ / lisk-sdk / test / functional / http / post / 4.multisignature.advanced.js View on Github external
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);
				});
			});
		});
github LiskHQ / lisk-sdk / test / integration / transactions / 1.second_signature / 1.1.second_signature.js View on Github external
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();
		});
	});
github LiskHQ / lisk-sdk / test / integration / transactions / expire_transactions.js View on Github external
const createTransaction = (amount, recipientId) => {
		return lisk.transaction.transfer({
			recipientId,
			amount,
			passphrase: accountsFixtures.genesis.passphrase,
		});
	};
github LiskHQ / lisk-sdk / test / functional / http / get / dapps.js View on Github external
before(() => {
				var promises = [];
				var transaction;
				var transactionsToWaitFor = [];

				for (var i = 1; i <= 20; i++) {
					transaction = lisk.transaction.createDapp({
						passphrase: account.passphrase,
						options: randomUtil.application(),
					});
					transactionsToWaitFor.push(transaction.id);
					promises.push(apiHelpers.sendTransactionPromise(transaction));
				}

				return Promise.all(promises).then(results => {
					results.forEach(res => {
						expect(res)
							.to.have.property('status')
							.to.equal(200);
					});
					return waitFor.confirmations(transactionsToWaitFor);
				});
			});
github LiskHQ / lisk-sdk / test / functional / http / post / 3.votes.js View on Github external
before(() => {
		var transactions = [];
		var transaction1 = lisk.transaction.transfer({
			amount: 1000 * NORMALIZER,
			passphrase: accountFixtures.genesis.passphrase,
			recipientId: delegateAccount.address,
		});
		var transaction2 = lisk.transaction.transfer({
			amount: FEES.VOTE,
			passphrase: accountFixtures.genesis.passphrase,
			recipientId: accountMinimalFunds.address,
		});
		var transaction3 = lisk.transaction.transfer({
			amount: 1000 * NORMALIZER,
			passphrase: accountFixtures.genesis.passphrase,
			recipientId: accountFixtures.existingDelegate.address,
		});
		var transaction4 = lisk.transaction.transfer({
			amount: 1000 * NORMALIZER,
github LiskHQ / lisk-sdk / test / integration / scenarios / stress / 3.cast_vote.js View on Github external
_.range(maximum).map(() => {
						var tmpAccount = randomUtil.account();
						var transaction = lisk.transaction.transfer({
							amount: 2500000000,
							passphrase: accountFixtures.genesis.passphrase,
							recipientId: tmpAccount.address,
						});
						accounts.push(tmpAccount);
						transactions.push(transaction);
						return sendTransactionsPromise([transaction]);
					})
				);
github LiskHQ / lisk-sdk / test / integration / common.js View on Github external
if (secondPassphrase === true) {
		accountCopy.secondPassphrase = null;
	} else if (secondPassphrase === false) {
		accountCopy.secondPassphrase = 'invalid_second_passphrase';
	}
	switch (key) {
		case 'SEND':
			transaction = lisk.transaction.transfer({
				amount: 1,
				passphrase: accountCopy.passphrase,
				secondPassphrase: accountCopy.secondPassphrase,
				recipientId: randomUtil.account().address,
			});
			break;
		case 'SIGNATURE':
			transaction = lisk.transaction.registerSecondPassphrase({
				passphrase: account.passphrase,
				secondPassphrase: account.secondPassphrase,
			});
			break;
		case 'DELEGATE':
			transaction = lisk.transaction.registerDelegate({
				passphrase: accountCopy.passphrase,
				secondPassphrase: accountCopy.secondPassphrase,
				username: accountCopy.username,
			});
			break;
		case 'VOTE':
			transaction = lisk.transaction.castVotes({
				passphrase: accountCopy.passphrase,
				secondPassphrase: accountCopy.secondPassphrase,
				votes: [accountFixtures.existingDelegate.publicKey],