How to use the @liskhq/lisk-transactions.Status.FAIL function in @liskhq/lisk-transactions

To help you get started, we’ve selected a few @liskhq/lisk-transactions 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-examples / framework / src / modules / chain / submodules / multisignatures.js View on Github external
.then(transactionResponse => {
			if (
				transactionResponse.status === TransactionStatus.FAIL &&
				transactionResponse.errors.length > 0
			) {
				const message = `Error processing signature: ${
					transactionResponse.errors[0].message
				}`;
				library.logger.error(message, { signature });
				return setImmediate(cb, new Error(message));
			}
			// Emit events
			library.channel.publish(
				'chain:multisignatures:signature:change',
				transaction.id
			);
			library.bus.message('signature', signature, true);

			return setImmediate(cb);
github LiskHQ / lisk-sdk / framework / src / modules / chain / submodules / multisignatures.js View on Github external
.then(transactionResponse => {
				if (
					transactionResponse.status === TransactionStatus.FAIL &&
					transactionResponse.errors.length > 0
				) {
					const message = transactionResponse.errors[0].message;
					library.logger.error(message, { signature });
					return setImmediate(cb, transactionResponse.errors);
				}
				// Emit events
				library.channel.publish(
					'chain:multisignatures:signature:change',
					transaction.id
				);
				library.bus.message('signature', signature, true);

				return setImmediate(cb);
			})
			.catch(err => setImmediate(cb, [err]));
github LiskHQ / lisk-sdk / framework / src / modules / chain / transaction_pool / transaction_pool.js View on Github external
signature.transactionId,
		);

		if (!transaction) {
			const message =
				'Unable to process signature, corresponding transaction not found';
			this.logger.error({ signature }, message);
			throw [new TransactionError(message, '', '.signature')];
		}

		const transactionResponse = await this.blocks.processSignature(
			transaction,
			signature,
		);
		if (
			transactionResponse.status === TransactionStatus.FAIL &&
			transactionResponse.errors.length > 0
		) {
			const { message } = transactionResponse.errors[0];
			this.logger.error(message, { signature });
			throw transactionResponse.errors;
		}

		this.emit(EVENT_MULTISIGNATURE_SIGNATURE, signature);
		return transactionResponse;
	}
github LiskHQ / lisk-sdk / framework / src / modules / chain / transaction_pool / transaction_pool.js View on Github external
const transaction = this.getMultisignatureTransaction(
			signature.transactionId
		);

		if (!transaction) {
			const message =
				'Unable to process signature, corresponding transaction not found';
			this.logger.error(message, { signature });
			throw [new TransactionError(message, '', '.signature')];
		}

		const transactionResponse = await transactionsModule.processSignature(
			this.storage
		)(transaction, signature);
		if (
			transactionResponse.status === TransactionStatus.FAIL &&
			transactionResponse.errors.length > 0
		) {
			const message = transactionResponse.errors[0].message;
			this.logger.error(message, { signature });
			throw transactionResponse.errors;
		}
		return transactionResponse;
	}
github LiskHQ / lisk-sdk / framework / src / modules / chain / blocks / transactions / transactions_handlers.js View on Github external
transactionsResponses: transactions.map(transaction => {
		const context = typeof contexter === 'function' ? contexter() : contexter;
		const allowed = !transaction.matcher || transaction.matcher(context);

		return {
			id: transaction.id,
			status: allowed ? TransactionStatus.OK : TransactionStatus.FAIL,
			errors: allowed
				? []
				: [
						new TransactionError(
							`Transaction type ${transaction.type} is currently not allowed.`,
							transaction.id,
						),
				  ],
		};
	}),
});
github LiskHQ / lisk-sdk / framework / src / modules / chain / blocks / transactions / transactions_handlers.js View on Github external
const transactionsResponses = transactions.map(transaction => {
		stateStore.createSnapshot();
		const transactionResponse = transaction.apply(stateStore);
		if (slots.getSlotNumber(transaction.timestamp) > slots.getSlotNumber()) {
			transactionResponse.status = TransactionStatus.FAIL;
			transactionResponse.errors.push(
				new TransactionError(
					'Invalid transaction timestamp. Timestamp is in the future',
					transaction.id,
					'.timestamp',
				),
			);
		}
		stateStore.restoreSnapshot();
		return transactionResponse;
	});
github LiskHQ / lisk-sdk / framework / src / modules / chain / blocks / transactions / transactions_handlers.js View on Github external
const transactionsResponses = transactions.map(transaction => {
		stateStore.createSnapshot();
		const transactionResponse = transaction.apply(stateStore);
		if (slots.getSlotNumber(transaction.timestamp) > slots.getSlotNumber()) {
			transactionResponse.status = TransactionStatus.FAIL;
			transactionResponse.errors.push(
				new TransactionError(
					'Invalid transaction timestamp. Timestamp is in the future',
					transaction.id,
					'.timestamp',
				),
			);
		}
		stateStore.restoreSnapshot();
		return transactionResponse;
	});
github LiskHQ / lisk-sdk / framework / src / modules / chain / submodules / process_transactions.js View on Github external
transactionsResponses: transactions.map(transaction => {
				const allowed =
					!transaction.matcher ||
					transaction.matcher(
						context || ProcessTransactions._getCurrentContext()
					);

				return {
					id: transaction.id,
					status: allowed ? TransactionStatus.OK : TransactionStatus.FAIL,
					errors: allowed
						? []
						: [
								new TransactionError(
									`Transaction type ${
										transaction.type
									} is currently not allowed.`,
									transaction.id
								),
						  ],
				};
			}),
		};
github LiskHQ / lisk-sdk / framework / src / modules / chain / blocks / transactions / transactions_handlers.js View on Github external
transactionsResponses: transactions.map(transaction => {
		const context = typeof contexter === 'function' ? contexter() : contexter;
		const allowed = !transaction.matcher || transaction.matcher(context);

		return {
			id: transaction.id,
			status: allowed ? TransactionStatus.OK : TransactionStatus.FAIL,
			errors: allowed
				? []
				: [
						new TransactionError(
							`Transaction type ${transaction.type} is currently not allowed.`,
							transaction.id,
						),
				  ],
		};
	}),
});