Merge pull request #58 from lbryio/transaction-type-constants

define transaction type constants
This commit is contained in:
Sean Yesmunt 2018-07-18 09:08:32 -04:00 committed by GitHub
commit 52a0143eba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 91 additions and 47 deletions

111
dist/bundle.js vendored
View file

@ -104,8 +104,8 @@ return /******/ (function(modules) { // webpackBootstrap
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.selectBlocks = exports.selectDraftTransactionError = exports.selectDraftTransactionAddress = exports.selectDraftTransactionAmount = exports.selectDraftTransaction = exports.selectGettingNewAddress = exports.selectReceiveAddress = exports.selectIsSendingSupport = exports.selectIsFetchingTransactions = exports.selectHasTransactions = exports.selectRecentTransactions = exports.selectTransactionItems = exports.selectTransactionsById = exports.selectBalance = exports.makeSelectBlockDate = exports.selectSearchBarFocused = exports.selectWunderBarAddress = exports.selectSearchUrisByQuery = exports.selectIsSearching = exports.selectSearchValue = exports.selectSearchQuery = exports.makeSelectSearchUris = exports.selectSearchState = exports.selectNavLinks = exports.selectActiveHistoryEntry = exports.selectHistoryStack = exports.selectHistoryIndex = exports.selectIsForwardDisabled = exports.selectIsBackDisabled = exports.selectPathAfterAuth = exports.selectPageTitle = exports.selectHeaderLinks = exports.selectCurrentParams = exports.selectCurrentPage = exports.selectCurrentPath = exports.makeSelectCurrentParam = exports.computePageFromPath = exports.selectSearchDownloadUris = exports.selectTotalDownloadProgress = exports.selectDownloadingFileInfos = exports.selectFileInfosDownloaded = exports.selectUrisLoading = exports.selectDownloadingByOutpoint = exports.selectIsFetchingFileListDownloadedOrPublished = exports.selectIsFetchingFileList = exports.selectFileInfosByOutpoint = exports.makeSelectLoadingForUri = exports.makeSelectDownloadingForUri = exports.makeSelectFileInfoForUri = exports.selectFetchingCostInfo = exports.selectCostForCurrentPageUri = exports.selectAllCostInfoByUri = exports.makeSelectCostInfoForUri = undefined;
exports.makeSelectFetchingCostInfoForUri = exports.selectRewardContentClaimIds = exports.selectChannelClaimCounts = exports.selectPlayingUri = exports.selectFetchingTrendingUris = exports.selectTrendingUris = exports.selectFetchingFeaturedUris = exports.selectFeaturedUris = exports.selectResolvingUris = exports.selectMyChannelClaims = exports.selectFetchingMyChannels = exports.selectMyClaimsOutpoints = exports.selectAllMyClaimsByOutpoint = exports.selectMyClaimsWithoutChannels = exports.selectMyClaims = exports.selectPendingClaims = exports.selectIsFetchingClaimListMine = exports.selectAllFetchingChannelClaims = exports.selectMyActiveClaims = exports.selectAbandoningIds = exports.selectMyClaimsRaw = exports.selectAllClaimsByChannel = exports.selectClaimsByUri = exports.selectClaimsById = exports.makeSelectNsfwCountForChannel = exports.makeSelectNsfwCountFromUris = exports.makeSelectTotalPagesForChannel = exports.makeSelectTotalItemsForChannel = exports.makeSelectIsUriResolving = exports.makeSelectContentTypeForUri = exports.makeSelectTitleForUri = exports.makeSelectMetadataForUri = exports.makeSelectClaimsInChannelForPage = exports.makeSelectClaimsInChannelForCurrentPage = exports.makeSelectFetchingChannelClaims = exports.makeSelectClaimIsMine = exports.makeSelectClaimForUri = exports.selectSnack = exports.selectNotificationProps = exports.selectNotification = exports.selectBlackListedOutpoints = exports.blacklistReducer = exports.walletReducer = exports.searchReducer = exports.notificationsReducer = exports.fileInfoReducer = exports.costInfoReducer = exports.claimsReducer = exports.formatFullPrice = exports.formatCredits = exports.toQueryString = exports.parseQueryParams = exports.batchActions = exports.doSendSupport = exports.doSetDraftTransactionAddress = exports.doSetDraftTransactionAmount = exports.doSendDraftTransaction = exports.doCheckAddressIsMine = exports.doGetNewAddress = exports.doFetchBlock = exports.doFetchTransactions = exports.doBalanceSubscribe = exports.doUpdateBalance = exports.doBlackListedOutpointsSubscribe = exports.doBlurSearchInput = exports.doFocusSearchInput = exports.doUpdateSearchQuery = exports.doSearch = exports.doFetchFileInfosAndPublishedClaims = exports.doFileList = exports.doFetchFileInfo = exports.doFetchCostInfoForUri = exports.doFetchRewardedContent = exports.doFetchTrendingUris = exports.doFetchFeaturedUris = exports.doResolveUri = exports.doResolveUris = exports.doAbandonClaim = exports.doFetchClaimListMine = exports.doFetchClaimCountByChannel = exports.doFetchClaimsByChannel = exports.doHideNotification = exports.doNotify = exports.convertToShareLink = exports.isNameValid = exports.isURIClaimable = exports.isURIValid = exports.normalizeURI = exports.buildURI = exports.parseURI = exports.regexAddress = exports.regexInvalidURI = exports.Lbryapi = exports.Lbry = exports.SETTINGS = exports.SEARCH_TYPES = exports.THUMBNAIL_STATUSES = exports.MODALS = exports.ACTIONS = exports.Notification = undefined;
exports.selectBlocks = exports.selectDraftTransactionError = exports.selectDraftTransactionAddress = exports.selectDraftTransactionAmount = exports.selectDraftTransaction = exports.selectGettingNewAddress = exports.selectReceiveAddress = exports.selectIsSendingSupport = exports.selectIsFetchingTransactions = exports.selectHasTransactions = exports.selectRecentTransactions = exports.selectTransactionItems = exports.selectTransactionsById = exports.selectBalance = exports.makeSelectBlockDate = exports.selectSearchBarFocused = exports.selectWunderBarAddress = exports.selectSearchUrisByQuery = exports.selectIsSearching = exports.selectSearchValue = exports.selectSearchQuery = exports.makeSelectSearchUris = exports.selectSearchState = exports.selectNavLinks = exports.selectActiveHistoryEntry = exports.selectHistoryStack = exports.selectHistoryIndex = exports.selectIsForwardDisabled = exports.selectIsBackDisabled = exports.selectPathAfterAuth = exports.selectPageTitle = exports.selectHeaderLinks = exports.selectCurrentParams = exports.selectCurrentPage = exports.selectCurrentPath = exports.makeSelectCurrentParam = exports.computePageFromPath = exports.selectSearchDownloadUris = exports.selectTotalDownloadProgress = exports.selectDownloadingFileInfos = exports.selectFileInfosDownloaded = exports.selectUrisLoading = exports.selectDownloadingByOutpoint = exports.selectIsFetchingFileListDownloadedOrPublished = exports.selectIsFetchingFileList = exports.selectFileInfosByOutpoint = exports.makeSelectLoadingForUri = exports.makeSelectDownloadingForUri = exports.makeSelectFileInfoForUri = exports.selectFetchingCostInfo = exports.selectCostForCurrentPageUri = exports.selectAllCostInfoByUri = exports.makeSelectCostInfoForUri = exports.makeSelectFetchingCostInfoForUri = undefined;
exports.selectRewardContentClaimIds = exports.selectChannelClaimCounts = exports.selectPlayingUri = exports.selectFetchingTrendingUris = exports.selectTrendingUris = exports.selectFetchingFeaturedUris = exports.selectFeaturedUris = exports.selectResolvingUris = exports.selectMyChannelClaims = exports.selectFetchingMyChannels = exports.selectMyClaimsOutpoints = exports.selectAllMyClaimsByOutpoint = exports.selectMyClaimsWithoutChannels = exports.selectMyClaims = exports.selectPendingClaims = exports.selectIsFetchingClaimListMine = exports.selectAllFetchingChannelClaims = exports.selectMyActiveClaims = exports.selectAbandoningIds = exports.selectMyClaimsRaw = exports.selectAllClaimsByChannel = exports.selectClaimsByUri = exports.selectClaimsById = exports.makeSelectNsfwCountForChannel = exports.makeSelectNsfwCountFromUris = exports.makeSelectTotalPagesForChannel = exports.makeSelectTotalItemsForChannel = exports.makeSelectIsUriResolving = exports.makeSelectContentTypeForUri = exports.makeSelectTitleForUri = exports.makeSelectMetadataForUri = exports.makeSelectClaimsInChannelForPage = exports.makeSelectClaimsInChannelForCurrentPage = exports.makeSelectFetchingChannelClaims = exports.makeSelectClaimIsMine = exports.makeSelectClaimForUri = exports.selectSnack = exports.selectNotificationProps = exports.selectNotification = exports.selectBlackListedOutpoints = exports.blacklistReducer = exports.walletReducer = exports.searchReducer = exports.notificationsReducer = exports.fileInfoReducer = exports.costInfoReducer = exports.claimsReducer = exports.formatFullPrice = exports.formatCredits = exports.toQueryString = exports.parseQueryParams = exports.batchActions = exports.doSendSupport = exports.doSetDraftTransactionAddress = exports.doSetDraftTransactionAmount = exports.doSendDraftTransaction = exports.doCheckAddressIsMine = exports.doGetNewAddress = exports.doFetchBlock = exports.doFetchTransactions = exports.doBalanceSubscribe = exports.doUpdateBalance = exports.doBlackListedOutpointsSubscribe = exports.doBlurSearchInput = exports.doFocusSearchInput = exports.doUpdateSearchQuery = exports.doSearch = exports.doFetchFileInfosAndPublishedClaims = exports.doFileList = exports.doFetchFileInfo = exports.doFetchCostInfoForUri = exports.doFetchRewardedContent = exports.doFetchTrendingUris = exports.doFetchFeaturedUris = exports.doResolveUri = exports.doResolveUris = exports.doAbandonClaim = exports.doFetchClaimListMine = exports.doFetchClaimCountByChannel = exports.doFetchClaimsByChannel = exports.doHideNotification = exports.doNotify = exports.convertToShareLink = exports.isNameValid = exports.isURIClaimable = exports.isURIValid = exports.normalizeURI = exports.buildURI = exports.parseURI = exports.regexAddress = exports.regexInvalidURI = exports.Lbryapi = exports.Lbry = exports.TRANSACTIONS = exports.SETTINGS = exports.SEARCH_TYPES = exports.THUMBNAIL_STATUSES = exports.MODALS = exports.ACTIONS = exports.Notification = undefined;
var _Notification = __webpack_require__(1);
@ -398,7 +398,7 @@ Object.defineProperty(exports, 'toQueryString', {
}
});
var _formatCredits = __webpack_require__(30);
var _formatCredits = __webpack_require__(31);
Object.defineProperty(exports, 'formatCredits', {
enumerable: true,
@ -413,7 +413,7 @@ Object.defineProperty(exports, 'formatFullPrice', {
}
});
var _claims2 = __webpack_require__(31);
var _claims2 = __webpack_require__(32);
Object.defineProperty(exports, 'claimsReducer', {
enumerable: true,
@ -422,7 +422,7 @@ Object.defineProperty(exports, 'claimsReducer', {
}
});
var _cost_info2 = __webpack_require__(32);
var _cost_info2 = __webpack_require__(33);
Object.defineProperty(exports, 'costInfoReducer', {
enumerable: true,
@ -431,7 +431,7 @@ Object.defineProperty(exports, 'costInfoReducer', {
}
});
var _file_info2 = __webpack_require__(33);
var _file_info2 = __webpack_require__(34);
Object.defineProperty(exports, 'fileInfoReducer', {
enumerable: true,
@ -440,7 +440,7 @@ Object.defineProperty(exports, 'fileInfoReducer', {
}
});
var _notifications2 = __webpack_require__(34);
var _notifications2 = __webpack_require__(35);
Object.defineProperty(exports, 'notificationsReducer', {
enumerable: true,
@ -449,7 +449,7 @@ Object.defineProperty(exports, 'notificationsReducer', {
}
});
var _search2 = __webpack_require__(36);
var _search2 = __webpack_require__(37);
Object.defineProperty(exports, 'searchReducer', {
enumerable: true,
@ -458,7 +458,7 @@ Object.defineProperty(exports, 'searchReducer', {
}
});
var _wallet2 = __webpack_require__(38);
var _wallet2 = __webpack_require__(39);
Object.defineProperty(exports, 'walletReducer', {
enumerable: true,
@ -467,7 +467,7 @@ Object.defineProperty(exports, 'walletReducer', {
}
});
var _blacklist2 = __webpack_require__(39);
var _blacklist2 = __webpack_require__(40);
Object.defineProperty(exports, 'blacklistReducer', {
enumerable: true,
@ -476,7 +476,7 @@ Object.defineProperty(exports, 'blacklistReducer', {
}
});
var _blacklist3 = __webpack_require__(40);
var _blacklist3 = __webpack_require__(41);
Object.defineProperty(exports, 'selectBlackListedOutpoints', {
enumerable: true,
@ -485,7 +485,7 @@ Object.defineProperty(exports, 'selectBlackListedOutpoints', {
}
});
var _notifications3 = __webpack_require__(41);
var _notifications3 = __webpack_require__(42);
Object.defineProperty(exports, 'selectNotification', {
enumerable: true,
@ -725,7 +725,7 @@ Object.defineProperty(exports, 'selectRewardContentClaimIds', {
}
});
var _cost_info3 = __webpack_require__(42);
var _cost_info3 = __webpack_require__(43);
Object.defineProperty(exports, 'makeSelectFetchingCostInfoForUri', {
enumerable: true,
@ -1062,11 +1062,11 @@ var _action_types = __webpack_require__(4);
var ACTIONS = _interopRequireWildcard(_action_types);
var _modal_types = __webpack_require__(35);
var _modal_types = __webpack_require__(36);
var MODALS = _interopRequireWildcard(_modal_types);
var _thumbnail_upload_statuses = __webpack_require__(43);
var _thumbnail_upload_statuses = __webpack_require__(44);
var THUMBNAIL_STATUSES = _interopRequireWildcard(_thumbnail_upload_statuses);
@ -1074,10 +1074,14 @@ var _search4 = __webpack_require__(24);
var SEARCH_TYPES = _interopRequireWildcard(_search4);
var _settings = __webpack_require__(44);
var _settings = __webpack_require__(45);
var SETTINGS = _interopRequireWildcard(_settings);
var _transaction_types = __webpack_require__(30);
var TRANSACTIONS = _interopRequireWildcard(_transaction_types);
var _lbry = __webpack_require__(6);
var _lbry2 = _interopRequireDefault(_lbry);
@ -1096,6 +1100,7 @@ exports.MODALS = MODALS;
exports.THUMBNAIL_STATUSES = THUMBNAIL_STATUSES;
exports.SEARCH_TYPES = SEARCH_TYPES;
exports.SETTINGS = SETTINGS;
exports.TRANSACTIONS = TRANSACTIONS;
// common
@ -3080,7 +3085,7 @@ var selectMyChannelClaims = exports.selectMyChannelClaims = (0, _reselect.create
ids.forEach(function (id) {
if (byId[id]) {
// I'm not sure why this check is necessary, but it ought to be a quick fix for https://github.com/lbryio/lbry-app/issues/544
// I'm not sure why this check is necessary, but it ought to be a quick fix for https://github.com/lbryio/lbry-desktop/issues/544
claims.push(byId[id]);
}
});
@ -4636,6 +4641,12 @@ exports.makeSelectBlockDate = exports.selectBlocks = exports.selectDraftTransact
var _reselect = __webpack_require__(16);
var _transaction_types = __webpack_require__(30);
var TRANSACTIONS = _interopRequireWildcard(_transaction_types);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var selectState = exports.selectState = function selectState(state) {
@ -4666,24 +4677,24 @@ var selectTransactionItems = exports.selectTransactionItems = (0, _reselect.crea
append.push.apply(append, _toConsumableArray(tx.claim_info.map(function (item) {
return Object.assign({}, tx, item, {
type: item.claim_name[0] === '@' ? 'channel' : 'publish'
type: item.claim_name[0] === '@' ? TRANSACTIONS.CHANNEL : TRANSACTIONS.PUBLISH
});
})));
append.push.apply(append, _toConsumableArray(tx.support_info.map(function (item) {
return Object.assign({}, tx, item, {
type: !item.is_tip ? 'support' : 'tip'
type: !item.is_tip ? TRANSACTIONS.SUPPORT : TRANSACTIONS.TIP
});
})));
append.push.apply(append, _toConsumableArray(tx.update_info.map(function (item) {
return Object.assign({}, tx, item, { type: 'update' });
return Object.assign({}, tx, item, { type: TRANSACTIONS.UPDATE });
})));
append.push.apply(append, _toConsumableArray(tx.abandon_info.map(function (item) {
return Object.assign({}, tx, item, { type: 'abandon' });
return Object.assign({}, tx, item, { type: TRANSACTIONS.ABANDON });
})));
if (!append.length) {
append.push(Object.assign({}, tx, {
type: tx.value < 0 ? 'spend' : 'receive'
type: tx.value < 0 ? TRANSACTIONS.SPEND : TRANSACTIONS.RECEIVE
}));
}
@ -4699,7 +4710,7 @@ var selectTransactionItems = exports.selectTransactionItems = (0, _reselect.crea
fee: amount < 0 ? -1 * tx.fee / append.length : 0,
claim_id: item.claim_id,
claim_name: item.claim_name,
type: item.type || 'send',
type: item.type || TRANSACTIONS.SPEND,
nout: item.nout
};
})));
@ -4768,6 +4779,26 @@ var makeSelectBlockDate = exports.makeSelectBlockDate = function makeSelectBlock
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
// eslint-disable-next-line import/prefer-default-export
var SPEND = exports.SPEND = 'spend';
var RECEIVE = exports.RECEIVE = 'receive';
var PUBLISH = exports.PUBLISH = 'publish';
var CHANNEL = exports.CHANNEL = 'channel';
var TIP = exports.TIP = 'tip';
var SUPPORT = exports.SUPPORT = 'support';
var UPDATE = exports.UPDATE = 'update';
var ABANDON = exports.ABANDON = 'abandon';
/***/ }),
/* 31 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
@ -4800,7 +4831,7 @@ function formatFullPrice(amount) {
}
/***/ }),
/* 31 */
/* 32 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -5127,7 +5158,7 @@ function claimsReducer() {
}
/***/ }),
/* 32 */
/* 33 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -5185,7 +5216,7 @@ function costInfoReducer() {
}
/***/ }),
/* 33 */
/* 34 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -5382,7 +5413,7 @@ function fileInfoReducer() {
}
/***/ }),
/* 34 */
/* 35 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -5397,7 +5428,7 @@ var _action_types = __webpack_require__(4);
var ACTIONS = _interopRequireWildcard(_action_types);
var _modal_types = __webpack_require__(35);
var _modal_types = __webpack_require__(36);
var MODALS = _interopRequireWildcard(_modal_types);
@ -5468,7 +5499,7 @@ function notificationsReducer() {
}
/***/ }),
/* 35 */
/* 36 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -5504,7 +5535,7 @@ var CONFIRM_TRANSACTION = exports.CONFIRM_TRANSACTION = 'confirm_transaction';
var CONFIRM_THUMBNAIL_UPLOAD = exports.CONFIRM_THUMBNAIL_UPLOAD = 'confirm_thumbnail_upload';
/***/ }),
/* 36 */
/* 37 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -5524,7 +5555,7 @@ var _action_types = __webpack_require__(4);
var ACTIONS = _interopRequireWildcard(_action_types);
var _reduxUtils = __webpack_require__(37);
var _reduxUtils = __webpack_require__(38);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
@ -5628,7 +5659,7 @@ var searchReducer = exports.searchReducer = (0, _reduxUtils.handleActions)((_han
}), _handleActions), defaultState);
/***/ }),
/* 37 */
/* 38 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -5661,7 +5692,7 @@ var handleActions = exports.handleActions = function handleActions(actionMap, de
};
/***/ }),
/* 38 */
/* 39 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -5843,7 +5874,7 @@ function walletReducer() {
}
/***/ }),
/* 39 */
/* 40 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -5862,7 +5893,7 @@ var _action_types = __webpack_require__(4);
var ACTIONS = _interopRequireWildcard(_action_types);
var _reduxUtils = __webpack_require__(37);
var _reduxUtils = __webpack_require__(38);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
@ -5902,7 +5933,7 @@ var blacklistReducer = exports.blacklistReducer = (0, _reduxUtils.handleActions)
}), _handleActions), defaultState);
/***/ }),
/* 40 */
/* 41 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -5924,7 +5955,7 @@ var selectBlackListedOutpoints = exports.selectBlackListedOutpoints = (0, _resel
});
/***/ }),
/* 41 */
/* 42 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -5964,7 +5995,7 @@ selectNotification, function (notification) {
});
/***/ }),
/* 42 */
/* 43 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -6008,7 +6039,7 @@ var makeSelectFetchingCostInfoForUri = exports.makeSelectFetchingCostInfoForUri
};
/***/ }),
/* 43 */
/* 44 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -6024,7 +6055,7 @@ var COMPLETE = exports.COMPLETE = 'complete';
var MANUAL = exports.MANUAL = 'manual';
/***/ }),
/* 44 */
/* 45 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";

View file

@ -1,2 +1,9 @@
// eslint-disable-next-line import/prefer-default-export
export const SPEND = 'spend';
export const RECEIVE = 'receive';
export const PUBLISH = 'publish';
export const CHANNEL = 'channel';
export const TIP = 'tip';
export const SUPPORT = 'support';
export const UPDATE = 'update';
export const ABANDON = 'abandon';

View file

@ -3,6 +3,7 @@ import * as MODALS from 'constants/modal_types';
import * as THUMBNAIL_STATUSES from 'constants/thumbnail_upload_statuses';
import * as SEARCH_TYPES from 'constants/search';
import * as SETTINGS from 'constants/settings';
import * as TRANSACTIONS from 'constants/transaction_types';
import Lbry from 'lbry';
import Lbryapi from 'lbryapi';
import { selectState as selectSearchState } from 'redux/selectors/search';
@ -11,7 +12,7 @@ import { selectState as selectSearchState } from 'redux/selectors/search';
export { Notification } from 'types/Notification';
// constants
export { ACTIONS, MODALS, THUMBNAIL_STATUSES, SEARCH_TYPES, SETTINGS };
export { ACTIONS, MODALS, THUMBNAIL_STATUSES, SEARCH_TYPES, SETTINGS, TRANSACTIONS };
// common
export { Lbry, Lbryapi };

View file

@ -1,4 +1,5 @@
import { createSelector } from 'reselect';
import * as TRANSACTIONS from 'constants/transaction_types';
export const selectState = state => state.wallet || {};
@ -29,24 +30,28 @@ export const selectTransactionItems = createSelector(selectTransactionsById, byI
append.push(
...tx.claim_info.map(item =>
Object.assign({}, tx, item, {
type: item.claim_name[0] === '@' ? 'channel' : 'publish',
type: item.claim_name[0] === '@' ? TRANSACTIONS.CHANNEL : TRANSACTIONS.PUBLISH,
})
)
);
append.push(
...tx.support_info.map(item =>
Object.assign({}, tx, item, {
type: !item.is_tip ? 'support' : 'tip',
type: !item.is_tip ? TRANSACTIONS.SUPPORT : TRANSACTIONS.TIP,
})
)
);
append.push(...tx.update_info.map(item => Object.assign({}, tx, item, { type: 'update' })));
append.push(...tx.abandon_info.map(item => Object.assign({}, tx, item, { type: 'abandon' })));
append.push(
...tx.update_info.map(item => Object.assign({}, tx, item, { type: TRANSACTIONS.UPDATE }))
);
append.push(
...tx.abandon_info.map(item => Object.assign({}, tx, item, { type: TRANSACTIONS.ABANDON }))
);
if (!append.length) {
append.push(
Object.assign({}, tx, {
type: tx.value < 0 ? 'spend' : 'receive',
type: tx.value < 0 ? TRANSACTIONS.SPEND : TRANSACTIONS.RECEIVE,
})
);
}
@ -64,7 +69,7 @@ export const selectTransactionItems = createSelector(selectTransactionsById, byI
fee: amount < 0 ? (-1 * tx.fee) / append.length : 0,
claim_id: item.claim_id,
claim_name: item.claim_name,
type: item.type || 'send',
type: item.type || TRANSACTIONS.SPEND,
nout: item.nout,
};
})