@cenoa/waas-js-sdk
Version:
Official Cenoa Wallet as a Service SDK
213 lines (212 loc) • 10.9 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TransactionManagerErrorCodes = exports.WalletManagerErrorCodes = exports.UserManagerErrorCodes = void 0;
var UserManagerErrorCodes;
(function (UserManagerErrorCodes) {
UserManagerErrorCodes["INVALID_REQUEST_ID"] = "INVALID_REQUEST_ID";
UserManagerErrorCodes["INVALID_CENOA_USER_ID"] = "INVALID_CENOA_USER_ID";
UserManagerErrorCodes["INVALID_PHONE_NUMBER"] = "INVALID_PHONE_NUMBER";
UserManagerErrorCodes["INVALID_OTP"] = "INVALID_OTP";
UserManagerErrorCodes["INVALID_EMAIL"] = "INVALID_EMAIL";
})(UserManagerErrorCodes = exports.UserManagerErrorCodes || (exports.UserManagerErrorCodes = {}));
var WalletManagerErrorCodes;
(function (WalletManagerErrorCodes) {
WalletManagerErrorCodes["INVALID_PRIVATE_KEY"] = "INVALID_PRIVATE_KEY";
WalletManagerErrorCodes["INVALID_WALLET_ADDRESS"] = "INVALID_WALLET_ADDRESS";
WalletManagerErrorCodes["INVALID_CLIENT_WALLET_KEY"] = "INVALID_CLIENT_WALLET_KEY";
WalletManagerErrorCodes["INVALID_CRYPTO_CURRENCY"] = "INVALID_CRYPTO_CURRENCY";
WalletManagerErrorCodes["INVALID_CRYPTO_AMOUNT"] = "INVALID_CRYPTO_AMOUNT";
WalletManagerErrorCodes["INVALID_NETWORK"] = "INVALID_NETWORK";
})(WalletManagerErrorCodes = exports.WalletManagerErrorCodes || (exports.WalletManagerErrorCodes = {}));
var TransactionManagerErrorCodes;
(function (TransactionManagerErrorCodes) {
TransactionManagerErrorCodes["INVALID_TRANSACTION_ID"] = "INVALID_TRANSACTION_ID";
TransactionManagerErrorCodes["INVALID_SENDER_WALLET_ADDRESS"] = "INVALID_SENDER_WALLET_ADDRESS";
TransactionManagerErrorCodes["INVALID_TRANSACTION_TYPE"] = "INVALID_TRANSACTION_TYPE";
TransactionManagerErrorCodes["ATTEMPTED_TO_SIGN_FAILED_TRANSACTION"] = "ATTEMPTED_TO_SIGN_FAILED_TRANSACTION";
TransactionManagerErrorCodes["ATTEMPTED_TO_SIGN_COMPLETED_TRANSACTION"] = "ATTEMPTED_TO_SIGN_COMPLETED_TRANSACTION";
TransactionManagerErrorCodes["ATTEMPTED_TO_SIGN_IN_PROGRESS_TRANSACTION"] = "ATTEMPTED_TO_SIGN_IN_PROGRESS_TRANSACTION";
TransactionManagerErrorCodes["INVALID_TRANSACTION_STATUS"] = "INVALID_TRANSACTION_STATUS";
TransactionManagerErrorCodes["INVALID_SIGNS_FIELD_ERROR"] = "INVALID_SIGNS_FIELD_ERROR";
TransactionManagerErrorCodes["INVALID_ACCOUNT_TYPE"] = "INVALID_ACCOUNT_TYPE";
})(TransactionManagerErrorCodes = exports.TransactionManagerErrorCodes || (exports.TransactionManagerErrorCodes = {}));
class CenoaWaasSdkError extends Error {
constructor(message, code) {
super(message);
this.name = 'CenoaWaasSdkError';
this.code = code;
}
}
var Errors;
(function (Errors) {
/*
* User Manager Errors
*/
class InvalidRequestIdError extends CenoaWaasSdkError {
constructor() {
super('Invalid request ID', UserManagerErrorCodes.INVALID_REQUEST_ID);
this.name = 'InvalidRequestIdError';
Object.setPrototypeOf(this, InvalidRequestIdError.prototype);
}
}
Errors.InvalidRequestIdError = InvalidRequestIdError;
class InvalidCenoaUserIdError extends CenoaWaasSdkError {
constructor() {
super('Invalid Cenoa User ID', UserManagerErrorCodes.INVALID_CENOA_USER_ID);
this.name = 'InvalidCenoaUserIdError';
Object.setPrototypeOf(this, InvalidCenoaUserIdError.prototype);
}
}
Errors.InvalidCenoaUserIdError = InvalidCenoaUserIdError;
class InvalidPhoneNumberError extends CenoaWaasSdkError {
constructor() {
super('Invalid phone number', UserManagerErrorCodes.INVALID_PHONE_NUMBER);
this.name = 'InvalidPhoneNumberError';
Object.setPrototypeOf(this, InvalidPhoneNumberError.prototype);
}
}
Errors.InvalidPhoneNumberError = InvalidPhoneNumberError;
class InvalidOTPError extends CenoaWaasSdkError {
constructor() {
super('Invalid OTP', UserManagerErrorCodes.INVALID_OTP);
this.name = 'InvalidOTPError';
Object.setPrototypeOf(this, InvalidOTPError.prototype);
}
}
Errors.InvalidOTPError = InvalidOTPError;
class InvalidEmailError extends CenoaWaasSdkError {
constructor() {
super('Invalid email', UserManagerErrorCodes.INVALID_EMAIL);
this.name = 'InvalidEmailError';
Object.setPrototypeOf(this, InvalidEmailError.prototype);
}
}
Errors.InvalidEmailError = InvalidEmailError;
/*
* Wallet Manager Errors
*/
class InvalidPrivateKeyError extends CenoaWaasSdkError {
constructor() {
super('Invalid private key', WalletManagerErrorCodes.INVALID_PRIVATE_KEY);
this.name = 'InvalidPrivateKeyError';
Object.setPrototypeOf(this, InvalidPrivateKeyError.prototype);
}
}
Errors.InvalidPrivateKeyError = InvalidPrivateKeyError;
class InvalidWalletAddressError extends CenoaWaasSdkError {
constructor() {
super('Invalid wallet address', WalletManagerErrorCodes.INVALID_WALLET_ADDRESS);
this.name = 'InvalidWalletAddressError';
Object.setPrototypeOf(this, InvalidWalletAddressError.prototype);
}
}
Errors.InvalidWalletAddressError = InvalidWalletAddressError;
class InvalidClientWalletKeyError extends CenoaWaasSdkError {
constructor() {
super('Invalid client wallet key', WalletManagerErrorCodes.INVALID_CLIENT_WALLET_KEY);
this.name = 'InvalidClientWalletKeyError';
Object.setPrototypeOf(this, InvalidClientWalletKeyError.prototype);
}
}
Errors.InvalidClientWalletKeyError = InvalidClientWalletKeyError;
class InvalidCryptoCurrencyError extends CenoaWaasSdkError {
constructor() {
super('Invalid crypto currency', WalletManagerErrorCodes.INVALID_CRYPTO_CURRENCY);
this.name = 'InvalidCryptoCurrencyError';
Object.setPrototypeOf(this, InvalidCryptoCurrencyError.prototype);
}
}
Errors.InvalidCryptoCurrencyError = InvalidCryptoCurrencyError;
class InvalidCryptoAmountError extends CenoaWaasSdkError {
constructor() {
super('Invalid crypto amount', WalletManagerErrorCodes.INVALID_CRYPTO_AMOUNT);
this.name = 'InvalidCryptoAmountError';
Object.setPrototypeOf(this, InvalidCryptoAmountError.prototype);
}
}
Errors.InvalidCryptoAmountError = InvalidCryptoAmountError;
class InvalidNetworkError extends CenoaWaasSdkError {
constructor() {
super('Invalid network', WalletManagerErrorCodes.INVALID_NETWORK);
this.name = 'InvalidNetworkError';
Object.setPrototypeOf(this, InvalidNetworkError.prototype);
}
}
Errors.InvalidNetworkError = InvalidNetworkError;
/*
* Transaction Manager Errors
*/
class InvalidTransactionIdError extends CenoaWaasSdkError {
constructor() {
super('Invalid transaction ID', TransactionManagerErrorCodes.INVALID_TRANSACTION_ID);
this.name = 'InvalidTransactionIdError';
Object.setPrototypeOf(this, InvalidTransactionIdError.prototype);
}
}
Errors.InvalidTransactionIdError = InvalidTransactionIdError;
class InvalidSenderWalletAddressError extends CenoaWaasSdkError {
constructor() {
super('Invalid sender wallet address', TransactionManagerErrorCodes.INVALID_SENDER_WALLET_ADDRESS);
this.name = 'InvalidSenderWalletAddressError';
Object.setPrototypeOf(this, InvalidSenderWalletAddressError.prototype);
}
}
Errors.InvalidSenderWalletAddressError = InvalidSenderWalletAddressError;
class InvalidTransactionTypeError extends CenoaWaasSdkError {
constructor() {
super('Invalid transaction type', TransactionManagerErrorCodes.INVALID_TRANSACTION_TYPE);
this.name = 'InvalidTransactionTypeError';
Object.setPrototypeOf(this, InvalidTransactionTypeError.prototype);
}
}
Errors.InvalidTransactionTypeError = InvalidTransactionTypeError;
class AttemptedToSignFailedTransactionError extends CenoaWaasSdkError {
constructor() {
super('Attempted to sign failed transaction', TransactionManagerErrorCodes.ATTEMPTED_TO_SIGN_FAILED_TRANSACTION);
this.name = 'AttemptedToSignFailedTransactionError';
Object.setPrototypeOf(this, AttemptedToSignFailedTransactionError.prototype);
}
}
Errors.AttemptedToSignFailedTransactionError = AttemptedToSignFailedTransactionError;
class AttemptedToSignCompletedTransactionError extends CenoaWaasSdkError {
constructor() {
super('Attempted to sign completed transaction', TransactionManagerErrorCodes.ATTEMPTED_TO_SIGN_COMPLETED_TRANSACTION);
this.name = 'AttemptedToSignCompletedTransactionError';
Object.setPrototypeOf(this, AttemptedToSignCompletedTransactionError.prototype);
}
}
Errors.AttemptedToSignCompletedTransactionError = AttemptedToSignCompletedTransactionError;
class AttemptedToSignInProgressTransactionError extends CenoaWaasSdkError {
constructor() {
super('Attempted to sign in progress transaction', TransactionManagerErrorCodes.ATTEMPTED_TO_SIGN_IN_PROGRESS_TRANSACTION);
this.name = 'AttemptedToSignInProgressTransactionError';
Object.setPrototypeOf(this, AttemptedToSignInProgressTransactionError.prototype);
}
}
Errors.AttemptedToSignInProgressTransactionError = AttemptedToSignInProgressTransactionError;
class InvalidTransactionStatusError extends CenoaWaasSdkError {
constructor() {
super('Invalid transaction status', TransactionManagerErrorCodes.INVALID_TRANSACTION_STATUS);
this.name = 'InvalidTransactionStatusError';
Object.setPrototypeOf(this, InvalidTransactionStatusError.prototype);
}
}
Errors.InvalidTransactionStatusError = InvalidTransactionStatusError;
class InvalidSignsFieldError extends CenoaWaasSdkError {
constructor() {
super('Invalid signs field', TransactionManagerErrorCodes.INVALID_SIGNS_FIELD_ERROR);
this.name = 'InvalidSignsFieldError';
Object.setPrototypeOf(this, InvalidSignsFieldError.prototype);
}
}
Errors.InvalidSignsFieldError = InvalidSignsFieldError;
class InvalidAccountTypeError extends CenoaWaasSdkError {
constructor() {
super('Invalid account type', TransactionManagerErrorCodes.INVALID_ACCOUNT_TYPE);
this.name = 'InvalidAccountTypeError';
Object.setPrototypeOf(this, InvalidAccountTypeError.prototype);
}
}
Errors.InvalidAccountTypeError = InvalidAccountTypeError;
})(Errors || (Errors = {}));
exports.default = Errors;