@radixdlt/application
Version:
A JavaScript client library for interacting with the Radix Distributed Ledger.
69 lines • 4.46 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.validatorsErr = exports.lookupValidatorErr = exports.lookupTxErr = exports.networkIdErr = exports.finalizeTxErr = exports.submitSignedTxErr = exports.buildTxFromIntentErr = exports.NetworkTxDemandErr = exports.NetworkTxThroughputErr = exports.txStatusErr = exports.unstakesForAddressErr = exports.stakesForAddressErr = exports.tokenInfoErr = exports.nativeTokenErr = exports.recentTransactionsErr = exports.transactionHistoryErr = exports.tokenBalancesErr = exports.walletError = exports.nodeError = exports.APIErrorCause = exports.NodeErrorCause = exports.WalletErrorCause = exports.ErrorCategory = void 0;
var ErrorCategory;
(function (ErrorCategory) {
ErrorCategory["NODE"] = "node";
ErrorCategory["WALLET"] = "wallet";
ErrorCategory["API"] = "api";
})(ErrorCategory = exports.ErrorCategory || (exports.ErrorCategory = {}));
var WalletErrorCause;
(function (WalletErrorCause) {
WalletErrorCause["LOAD_KEYSTORE_FAILED"] = "LOAD_KEYSTORE_FAILED";
})(WalletErrorCause = exports.WalletErrorCause || (exports.WalletErrorCause = {}));
var NodeErrorCause;
(function (NodeErrorCause) {
NodeErrorCause["GET_NODE_FAILED"] = "GET_NODE_FAILED";
})(NodeErrorCause = exports.NodeErrorCause || (exports.NodeErrorCause = {}));
var APIErrorCause;
(function (APIErrorCause) {
APIErrorCause["TOKEN_BALANCES_FAILED"] = "TOKEN_BALANCES_FAILED";
APIErrorCause["TRANSACTION_HISTORY_FAILED"] = "TRANSACTION_HISTORY_FAILED";
APIErrorCause["RECENT_TRANSACTIONS_FAILED"] = "RECENT_TRANSACTIONS_FAILED";
APIErrorCause["NATIVE_TOKEN_FAILED"] = "NATIVE_TOKEN_FAILED";
APIErrorCause["TOKEN_INFO_FAILED"] = "TOKEN_INFO_FAILED";
APIErrorCause["STAKES_FOR_ADDRESS_FAILED"] = "STAKES_FOR_ADDRESS_FAILED";
APIErrorCause["UNSTAKES_FOR_ADDRESS_FAILED"] = "UNSTAKES_FOR_ADDRESS_FAILED";
APIErrorCause["TX_STATUS_FAILED"] = "TX_STATUS_FAILED";
APIErrorCause["NETWORK_TX_THROUGHPUT_FAILED"] = "NETWORK_TX_THROUGHPUT_FAILED";
APIErrorCause["NETWORK_TX_DEMAND_FAILED"] = "NETWORK_TX_DEMAND_FAILED";
APIErrorCause["LOOKUP_TX_FAILED"] = "LOOKUP_TX_FAILED";
APIErrorCause["LOOKUP_VALIDATOR_FAILED"] = "LOOKUP_VALIDATOR_FAILED";
APIErrorCause["VALIDATORS_FAILED"] = "VALIDATORS_FAILED";
APIErrorCause["BUILD_TRANSACTION_FAILED"] = "BUILD_TRANSACTION_FAILED";
APIErrorCause["SUBMIT_SIGNED_TX_FAILED"] = "SUBMIT_SIGNED_TX_FAILED";
APIErrorCause["FINALIZE_TX_FAILED"] = "FINALIZE_TX_FAILED";
APIErrorCause["NETWORK_ID_FAILED"] = "NETWORK_ID_FAILED";
})(APIErrorCause = exports.APIErrorCause || (exports.APIErrorCause = {}));
const APIError = (cause) => (error) => (Object.assign({ cause }, error));
const nodeError = (error) => ({
cause: NodeErrorCause.GET_NODE_FAILED,
category: ErrorCategory.NODE,
message: error.message,
});
exports.nodeError = nodeError;
const walletError = (error) => ({
cause: WalletErrorCause.LOAD_KEYSTORE_FAILED,
category: ErrorCategory.WALLET,
message: error.message,
});
exports.walletError = walletError;
exports.tokenBalancesErr = APIError(APIErrorCause.TOKEN_BALANCES_FAILED);
exports.transactionHistoryErr = APIError(APIErrorCause.TRANSACTION_HISTORY_FAILED);
exports.recentTransactionsErr = APIError(APIErrorCause.RECENT_TRANSACTIONS_FAILED);
exports.nativeTokenErr = APIError(APIErrorCause.NATIVE_TOKEN_FAILED);
exports.tokenInfoErr = APIError(APIErrorCause.TOKEN_INFO_FAILED);
exports.stakesForAddressErr = APIError(APIErrorCause.STAKES_FOR_ADDRESS_FAILED);
exports.unstakesForAddressErr = APIError(APIErrorCause.UNSTAKES_FOR_ADDRESS_FAILED);
exports.txStatusErr = APIError(APIErrorCause.TX_STATUS_FAILED);
exports.NetworkTxThroughputErr = APIError(APIErrorCause.NETWORK_TX_THROUGHPUT_FAILED);
exports.NetworkTxDemandErr = APIError(APIErrorCause.NETWORK_TX_DEMAND_FAILED);
const buildTxFromIntentErr = (error) => APIError(APIErrorCause.BUILD_TRANSACTION_FAILED)(error);
exports.buildTxFromIntentErr = buildTxFromIntentErr;
exports.submitSignedTxErr = APIError(APIErrorCause.SUBMIT_SIGNED_TX_FAILED);
exports.finalizeTxErr = APIError(APIErrorCause.FINALIZE_TX_FAILED);
exports.networkIdErr = APIError(APIErrorCause.NETWORK_ID_FAILED);
exports.lookupTxErr = APIError(APIErrorCause.LOOKUP_TX_FAILED);
exports.lookupValidatorErr = APIError(APIErrorCause.LOOKUP_VALIDATOR_FAILED);
exports.validatorsErr = APIError(APIErrorCause.VALIDATORS_FAILED);
//# sourceMappingURL=errors.js.map