stellar-plus
Version:
beta version of stellar-plus, an all-in-one sdk for the Stellar blockchain
68 lines (67 loc) • 2.6 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DAHError = exports.DefaultAccountHandlerErrorCodes = void 0;
const error_1 = require("../../../../stellar-plus/error");
var DefaultAccountHandlerErrorCodes;
(function (DefaultAccountHandlerErrorCodes) {
// DAH0 General
DefaultAccountHandlerErrorCodes["DAH001"] = "DAH001";
DefaultAccountHandlerErrorCodes["DAH002"] = "DAH002";
DefaultAccountHandlerErrorCodes["DAH003"] = "DAH003";
DefaultAccountHandlerErrorCodes["DAH004"] = "DAH004";
})(DefaultAccountHandlerErrorCodes || (exports.DefaultAccountHandlerErrorCodes = DefaultAccountHandlerErrorCodes = {}));
const failedToLoadSecretKeyError = (error) => {
return new error_1.StellarPlusError({
code: DefaultAccountHandlerErrorCodes.DAH001,
message: 'Failed to load secret key!',
source: 'DefaultAccountHandler',
details: 'The secret key could not be loaded. Make sure that the secret key is correct and that it is a valid Stellar secret key.',
meta: {
error,
},
});
};
const failedToSignTransactionError = (error) => {
return new error_1.StellarPlusError({
code: DefaultAccountHandlerErrorCodes.DAH002,
message: 'Failed to sign transaction!',
source: 'DefaultAccountHandler',
details: 'The transaction could not be signed. Review the secret key.',
meta: {
error,
},
});
};
const failedToSignAuthorizationEntryError = (error, authEntry, validUntilLedgerSeq, networkPassphrase) => {
return new error_1.StellarPlusError({
code: DefaultAccountHandlerErrorCodes.DAH003,
message: 'Failed to sign authorization entry!',
source: 'DefaultAccountHandler',
details: 'The soroban authorization entry could not be signed. Review the secret key and the parameters within the meta section.',
meta: {
error,
data: {
authEntry,
validUntilLedgerSeq,
networkPassphrase,
},
},
});
};
const failedToSignDataError = (error) => {
return new error_1.StellarPlusError({
code: DefaultAccountHandlerErrorCodes.DAH004,
message: 'Failed to sign data!',
source: 'DefaultAccountHandler',
details: 'The data could not be signed. Review the secret key.',
meta: {
error,
},
});
};
exports.DAHError = {
failedToLoadSecretKeyError,
failedToSignTransactionError,
failedToSignAuthorizationEntryError,
failedToSignDataError,
};