From 215b6427cc9b0d3525b088e10a9c5559233495ff Mon Sep 17 00:00:00 2001 From: rodolfopietro97 Date: Fri, 27 Oct 2023 13:08:58 +0200 Subject: [PATCH] fix: missing file --- packages/errors/src/model/transaction.ts | 74 ++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 packages/errors/src/model/transaction.ts diff --git a/packages/errors/src/model/transaction.ts b/packages/errors/src/model/transaction.ts new file mode 100644 index 000000000..b2b091237 --- /dev/null +++ b/packages/errors/src/model/transaction.ts @@ -0,0 +1,74 @@ +import { ErrorBase } from './base'; +import { type DefaultErrorData } from '../types'; + +/** + * Invalid Transaction to sign. It is already signed. + * + * @param code - The error code from the error types enum. + * @param message - The error message. + * @param data - The error data. + * @returns The error object. + */ +class TransactionAlreadySignedError extends ErrorBase< + TRANSACTION.ALREADY_SIGNED, + DefaultErrorData +> {} + +/** + * Transaction not signed. + * + * @param code - The error code from the error types enum. + * @param message - The error message. + * @param data - The error data. + * @returns The error object. + */ +class TransactionNotSignedError extends ErrorBase< + TRANSACTION.NOT_SIGNED, + DefaultErrorData +> {} + +/** + * Invalid Transaction body. + * + * @param code - The error code from the error types enum. + * @param message - The error message. + * @param data - The error data. + * @returns The error object. + */ +class TransactionBodyError extends ErrorBase< + TRANSACTION.INVALID_TRANSACTION_BODY, + DefaultErrorData +> {} + +/** + * Invalid Delegation feature. + * + * @param code - The error code from the error types enum. + * @param message - The error message. + * @param data - The error data. + * @returns The error object. + */ +class TransactionDelegationError extends ErrorBase< + TRANSACTION.INVALID_DELEGATION, + DefaultErrorData +> {} + +/** + * Errors enum. + * + * @public + */ +enum TRANSACTION { + ALREADY_SIGNED = 'ALREADY_SIGNED', + NOT_SIGNED = 'NOT_SIGNED', + INVALID_TRANSACTION_BODY = 'INVALID_TRANSACTION_BODY', + INVALID_DELEGATION = 'INVALID_DELEGATION' +} + +export { + TransactionAlreadySignedError, + TransactionNotSignedError, + TransactionBodyError, + TransactionDelegationError, + TRANSACTION +};