wallet-storage-client
Version:
Client only Wallet Storage
114 lines • 5.72 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.WERR_INVALID_PUBLIC_KEY = exports.WERR_INSUFFICIENT_FUNDS = exports.WERR_NOT_ACTIVE = exports.WERR_UNAUTHORIZED = exports.WERR_NETWORK_CHAIN = exports.WERR_BAD_REQUEST = exports.WERR_MISSING_PARAMETER = exports.WERR_INVALID_PARAMETER = exports.WERR_INVALID_OPERATION = exports.WERR_INTERNAL = exports.WERR_NOT_IMPLEMENTED = void 0;
const WalletError_1 = require("./WalletError");
/**
* Not implemented.
*/
class WERR_NOT_IMPLEMENTED extends WalletError_1.WalletError {
constructor(message) { super('WERR_NOT_IMPLEMENTED', message !== null && message !== void 0 ? message : 'Not implemented.'); }
}
exports.WERR_NOT_IMPLEMENTED = WERR_NOT_IMPLEMENTED;
/**
* An internal error has occurred.
*
* This is an example of an error with an optional custom `message`.
*/
class WERR_INTERNAL extends WalletError_1.WalletError {
constructor(message) { super('WERR_INTERNAL', message !== null && message !== void 0 ? message : 'An internal error has occurred.'); }
}
exports.WERR_INTERNAL = WERR_INTERNAL;
/**
* The ${parameter} parameter is invalid.
*
* This is an example of an error object with a custom property `parameter` and templated `message`.
*/
class WERR_INVALID_OPERATION extends WalletError_1.WalletError {
constructor(message) { super('WERR_INVALID_OPERATION', message !== null && message !== void 0 ? message : `An invalid operation was requested.`); }
}
exports.WERR_INVALID_OPERATION = WERR_INVALID_OPERATION;
/**
* The ${parameter} parameter is invalid.
*
* This is an example of an error object with a custom property `parameter` and templated `message`.
*/
class WERR_INVALID_PARAMETER extends WalletError_1.WalletError {
constructor(parameter, mustBe) {
super('WERR_INVALID_PARAMETER', `The ${parameter} parameter must be ${mustBe !== null && mustBe !== void 0 ? mustBe : 'valid.'}`);
this.parameter = parameter;
}
}
exports.WERR_INVALID_PARAMETER = WERR_INVALID_PARAMETER;
/**
* The required ${parameter} parameter is missing.
*
* This is an example of an error object with a custom property `parameter`
*/
class WERR_MISSING_PARAMETER extends WalletError_1.WalletError {
constructor(parameter) {
super('WERR_MISSING_PARAMETER', `The required ${parameter} parameter is missing.`);
this.parameter = parameter;
}
}
exports.WERR_MISSING_PARAMETER = WERR_MISSING_PARAMETER;
/**
* The request is invalid.
*/
class WERR_BAD_REQUEST extends WalletError_1.WalletError {
constructor(message) { super('WERR_BAD_REQUEST', message !== null && message !== void 0 ? message : 'The request is invalid.'); }
}
exports.WERR_BAD_REQUEST = WERR_BAD_REQUEST;
/**
* Configured network chain is invalid or does not match across services.
*/
class WERR_NETWORK_CHAIN extends WalletError_1.WalletError {
constructor(message) { super('WERR_NETWORK_CHAIN', message !== null && message !== void 0 ? message : 'Configured network chain is invalid or does not match across services.'); }
}
exports.WERR_NETWORK_CHAIN = WERR_NETWORK_CHAIN;
/**
* Access is denied due to an authorization error.
*/
class WERR_UNAUTHORIZED extends WalletError_1.WalletError {
constructor(message) { super('WERR_UNAUTHORIZED', message !== null && message !== void 0 ? message : 'Access is denied due to an authorization error.'); }
}
exports.WERR_UNAUTHORIZED = WERR_UNAUTHORIZED;
/**
* WalletStorageManager is not accessing user's active storage.
*/
class WERR_NOT_ACTIVE extends WalletError_1.WalletError {
constructor(message) { super('WERR_NOT_ACTIVE', message !== null && message !== void 0 ? message : `WalletStorageManager is not accessing user's active storage.`); }
}
exports.WERR_NOT_ACTIVE = WERR_NOT_ACTIVE;
/**
* Insufficient funds in the available inputs to cover the cost of the required outputs
* and the transaction fee (${moreSatoshisNeeded} more satoshis are needed,
* for a total of ${totalSatoshisNeeded}), plus whatever would be required in order
* to pay the fee to unlock and spend the outputs used to provide the additional satoshis.
*/
class WERR_INSUFFICIENT_FUNDS extends WalletError_1.WalletError {
/**
* @param totalSatoshisNeeded Total satoshis required to fund transactions after net of required inputs and outputs.
* @param moreSatoshisNeeded Shortfall on total satoshis required to fund transactions after net of required inputs and outputs.
*/
constructor(totalSatoshisNeeded, moreSatoshisNeeded) {
super('WERR_INSUFFICIENT_FUNDS', `Insufficient funds in the available inputs to cover the cost of the required outputs and the transaction fee (${moreSatoshisNeeded} more satoshis are needed, for a total of ${totalSatoshisNeeded}), plus whatever would be required in order to pay the fee to unlock and spend the outputs used to provide the additional satoshis.`);
this.totalSatoshisNeeded = totalSatoshisNeeded;
this.moreSatoshisNeeded = moreSatoshisNeeded;
}
}
exports.WERR_INSUFFICIENT_FUNDS = WERR_INSUFFICIENT_FUNDS;
class WERR_INVALID_PUBLIC_KEY extends WalletError_1.WalletError {
/**
* @param key The invalid public key that caused the error.
* @param environment Optional environment flag to control whether the key is included in the message.
*/
constructor(key, network = 'mainnet') {
const message = network === 'mainnet'
? `The provided public key "${key}" is invalid or malformed.`
: `The provided public key is invalid or malformed.`;
super('WERR_INVALID_PUBLIC_KEY', message);
this.key = key;
}
}
exports.WERR_INVALID_PUBLIC_KEY = WERR_INVALID_PUBLIC_KEY;
//# sourceMappingURL=WERR_errors.js.map