Merge pull request #33 from lbryio/claims-by-channel
Added claim actions. Added claim_list_by_channel call to lbry.js
This commit is contained in:
commit
8cbeed7929
5 changed files with 150 additions and 3 deletions
92
dist/bundle.js
vendored
92
dist/bundle.js
vendored
|
@ -89,8 +89,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 = undefined;
|
||||
exports.selectDownloadingByOutpoint = exports.selectIsFetchingFileListDownloadedOrPublished = exports.selectIsFetchingFileList = exports.selectFileInfosByOutpoint = exports.makeSelectLoadingForUri = exports.makeSelectDownloadingForUri = exports.makeSelectFileInfoForUri = exports.selectFetchingCostInfo = exports.selectCostForCurrentPageUri = exports.selectAllCostInfoByUri = exports.makeSelectCostInfoForUri = exports.makeSelectFetchingCostInfoForUri = exports.selectRewardContentClaimIds = exports.selectChannelClaimCounts = exports.selectPlayingUri = 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.makeSelectTotalPagesForChannel = exports.makeSelectTotalItemsForChannel = exports.makeSelectIsUriResolving = exports.makeSelectContentTypeForUri = exports.makeSelectTitleForUri = exports.makeSelectMetadataForUri = 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.doFetchFeaturedUris = exports.doResolveUri = exports.doResolveUris = exports.doAbandonClaim = exports.doFetchClaimListMine = exports.doHideNotification = exports.doNotify = exports.isNameValid = exports.isURIClaimable = exports.isURIValid = exports.normalizeURI = exports.buildURI = exports.parseURI = exports.regexAddress = exports.regexInvalidURI = exports.Lbryapi = exports.Lbry = exports.MODALS = exports.SETTINGS = 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 = undefined;
|
||||
exports.selectFileInfosByOutpoint = exports.makeSelectLoadingForUri = exports.makeSelectDownloadingForUri = exports.makeSelectFileInfoForUri = exports.selectFetchingCostInfo = exports.selectCostForCurrentPageUri = exports.selectAllCostInfoByUri = exports.makeSelectCostInfoForUri = exports.makeSelectFetchingCostInfoForUri = exports.selectRewardContentClaimIds = exports.selectChannelClaimCounts = exports.selectPlayingUri = 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.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.doFetchFeaturedUris = exports.doResolveUri = exports.doResolveUris = exports.doAbandonClaim = exports.doFetchClaimListMine = exports.doFetchClaimCountByChannel = exports.doFetchClaimsByChannel = exports.doHideNotification = exports.doNotify = exports.isNameValid = exports.isURIClaimable = exports.isURIValid = exports.normalizeURI = exports.buildURI = exports.parseURI = exports.regexAddress = exports.regexInvalidURI = exports.Lbryapi = exports.Lbry = exports.MODALS = exports.SETTINGS = exports.ACTIONS = exports.Notification = undefined;
|
||||
|
||||
var _Notification = __webpack_require__(1);
|
||||
|
||||
|
@ -169,6 +169,18 @@ Object.defineProperty(exports, 'doHideNotification', {
|
|||
|
||||
var _claims = __webpack_require__(5);
|
||||
|
||||
Object.defineProperty(exports, 'doFetchClaimsByChannel', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _claims.doFetchClaimsByChannel;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'doFetchClaimCountByChannel', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _claims.doFetchClaimCountByChannel;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'doFetchClaimListMine', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
|
@ -493,6 +505,12 @@ Object.defineProperty(exports, 'makeSelectClaimsInChannelForCurrentPage', {
|
|||
return _claims3.makeSelectClaimsInChannelForCurrentPage;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'makeSelectClaimsInChannelForPage', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _claims3.makeSelectClaimsInChannelForPage;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'makeSelectMetadataForUri', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
|
@ -1560,6 +1578,8 @@ exports.doFetchClaimListMine = doFetchClaimListMine;
|
|||
exports.doAbandonClaim = doAbandonClaim;
|
||||
exports.doFetchFeaturedUris = doFetchFeaturedUris;
|
||||
exports.doFetchRewardedContent = doFetchRewardedContent;
|
||||
exports.doFetchClaimsByChannel = doFetchClaimsByChannel;
|
||||
exports.doFetchClaimCountByChannel = doFetchClaimCountByChannel;
|
||||
|
||||
var _action_types = __webpack_require__(4);
|
||||
|
||||
|
@ -1774,6 +1794,53 @@ function doFetchRewardedContent() {
|
|||
};
|
||||
}
|
||||
|
||||
function doFetchClaimsByChannel(uri, page) {
|
||||
return function (dispatch, getState) {
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_CHANNEL_CLAIMS_STARTED,
|
||||
data: { uri: uri, page: page }
|
||||
});
|
||||
|
||||
_lbry2.default.claim_list_by_channel({ uri: uri, page: page || 1 }).then(function (result) {
|
||||
var claimResult = result[uri] || {};
|
||||
var claimsInChannel = claimResult.claims_in_channel,
|
||||
returnedPage = claimResult.returned_page;
|
||||
|
||||
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_CHANNEL_CLAIMS_COMPLETED,
|
||||
data: {
|
||||
uri: uri,
|
||||
claims: claimsInChannel || [],
|
||||
page: returnedPage || undefined
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function doFetchClaimCountByChannel(uri) {
|
||||
return function (dispatch) {
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_CHANNEL_CLAIM_COUNT_STARTED,
|
||||
data: { uri: uri }
|
||||
});
|
||||
|
||||
_lbry2.default.claim_list_by_channel({ uri: uri }).then(function (result) {
|
||||
var claimResult = result[uri];
|
||||
var totalClaims = claimResult ? claimResult.claims_in_channel : 0;
|
||||
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_CHANNEL_CLAIM_COUNT_COMPLETED,
|
||||
data: {
|
||||
uri: uri,
|
||||
totalClaims: totalClaims
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
/* 6 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
@ -1859,6 +1926,12 @@ Lbry.file_set_status = function () {
|
|||
return daemonCallWithResult('file_set_status', params);
|
||||
};
|
||||
|
||||
// claims
|
||||
Lbry.claim_list_by_channel = function () {
|
||||
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
return daemonCallWithResult('claim_list_by_channel', params);
|
||||
};
|
||||
|
||||
// wallet
|
||||
Lbry.wallet_balance = function () {
|
||||
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
@ -2712,7 +2785,7 @@ var objectKeys = Object.keys || function (obj) {
|
|||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.selectRewardContentClaimIds = exports.makeSelectTotalPagesForChannel = exports.makeSelectTotalItemsForChannel = exports.selectChannelClaimCounts = exports.selectPlayingUri = exports.selectFetchingFeaturedUris = exports.selectFeaturedUris = exports.makeSelectIsUriResolving = exports.selectResolvingUris = exports.selectMyChannelClaims = exports.selectFetchingMyChannels = exports.selectMyClaimsOutpoints = exports.selectAllMyClaimsByOutpoint = exports.selectMyClaimsWithoutChannels = exports.selectMyClaims = exports.selectPendingClaims = exports.selectIsFetchingClaimListMine = exports.makeSelectContentTypeForUri = exports.makeSelectTitleForUri = exports.makeSelectMetadataForUri = exports.makeSelectClaimsInChannelForCurrentPage = exports.makeSelectFetchingChannelClaims = exports.selectAllFetchingChannelClaims = exports.makeSelectClaimIsMine = exports.selectMyActiveClaims = exports.selectAbandoningIds = exports.selectMyClaimsRaw = exports.makeSelectClaimForUri = exports.selectAllClaimsByChannel = exports.selectClaimsByUri = exports.selectClaimsById = undefined;
|
||||
exports.selectRewardContentClaimIds = exports.makeSelectTotalPagesForChannel = exports.makeSelectTotalItemsForChannel = exports.selectChannelClaimCounts = exports.selectPlayingUri = exports.selectFetchingFeaturedUris = exports.selectFeaturedUris = exports.makeSelectIsUriResolving = exports.selectResolvingUris = exports.selectMyChannelClaims = exports.selectFetchingMyChannels = exports.selectMyClaimsOutpoints = exports.selectAllMyClaimsByOutpoint = exports.selectMyClaimsWithoutChannels = exports.selectMyClaims = exports.selectPendingClaims = exports.selectIsFetchingClaimListMine = exports.makeSelectContentTypeForUri = exports.makeSelectTitleForUri = exports.makeSelectMetadataForUri = exports.makeSelectClaimsInChannelForCurrentPage = exports.makeSelectClaimsInChannelForPage = exports.makeSelectFetchingChannelClaims = exports.selectAllFetchingChannelClaims = exports.makeSelectClaimIsMine = exports.selectMyActiveClaims = exports.selectAbandoningIds = exports.selectMyClaimsRaw = exports.makeSelectClaimForUri = exports.selectAllClaimsByChannel = exports.selectClaimsByUri = exports.selectClaimsById = undefined;
|
||||
|
||||
var _lbryURI = __webpack_require__(2);
|
||||
|
||||
|
@ -2793,6 +2866,19 @@ var makeSelectFetchingChannelClaims = exports.makeSelectFetchingChannelClaims =
|
|||
});
|
||||
};
|
||||
|
||||
var makeSelectClaimsInChannelForPage = exports.makeSelectClaimsInChannelForPage = function makeSelectClaimsInChannelForPage(uri, page) {
|
||||
return (0, _reselect.createSelector)(selectClaimsById, selectAllClaimsByChannel, function (byId, allClaims) {
|
||||
var byChannel = allClaims[uri] || {};
|
||||
var claimIds = byChannel[page || 1];
|
||||
|
||||
if (!claimIds) return claimIds;
|
||||
|
||||
return claimIds.map(function (claimId) {
|
||||
return byId[claimId];
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
var makeSelectClaimsInChannelForCurrentPage = exports.makeSelectClaimsInChannelForCurrentPage = function makeSelectClaimsInChannelForCurrentPage(uri) {
|
||||
var pageSelector = (0, _navigation.makeSelectCurrentParam)('page');
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@ export {
|
|||
export { doNotify, doHideNotification } from 'redux/actions/notifications';
|
||||
|
||||
export {
|
||||
doFetchClaimsByChannel,
|
||||
doFetchClaimCountByChannel,
|
||||
doFetchClaimListMine,
|
||||
doAbandonClaim,
|
||||
doResolveUris,
|
||||
|
@ -94,6 +96,7 @@ export {
|
|||
makeSelectClaimIsMine,
|
||||
makeSelectFetchingChannelClaims,
|
||||
makeSelectClaimsInChannelForCurrentPage,
|
||||
makeSelectClaimsInChannelForPage,
|
||||
makeSelectMetadataForUri,
|
||||
makeSelectTitleForUri,
|
||||
makeSelectContentTypeForUri,
|
||||
|
|
|
@ -67,6 +67,9 @@ Lbry.version = () => daemonCallWithResult('version', {});
|
|||
Lbry.file_delete = (params = {}) => daemonCallWithResult('file_delete', params);
|
||||
Lbry.file_set_status = (params = {}) => daemonCallWithResult('file_set_status', params);
|
||||
|
||||
// claims
|
||||
Lbry.claim_list_by_channel = (params = {}) => daemonCallWithResult('claim_list_by_channel', params);
|
||||
|
||||
// wallet
|
||||
Lbry.wallet_balance = (params = {}) => daemonCallWithResult('wallet_balance', params);
|
||||
Lbry.wallet_is_address_mine = (params = {}) =>
|
||||
|
|
|
@ -186,3 +186,48 @@ export function doFetchRewardedContent() {
|
|||
Lbryapi.call('reward', 'list_featured').then(success, failure);
|
||||
};
|
||||
}
|
||||
|
||||
export function doFetchClaimsByChannel(uri, page) {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_CHANNEL_CLAIMS_STARTED,
|
||||
data: { uri, page },
|
||||
});
|
||||
|
||||
Lbry.claim_list_by_channel({ uri, page: page || 1 }).then(result => {
|
||||
const claimResult = result[uri] || {};
|
||||
const { claims_in_channel: claimsInChannel, returned_page: returnedPage } = claimResult;
|
||||
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_CHANNEL_CLAIMS_COMPLETED,
|
||||
data: {
|
||||
uri,
|
||||
claims: claimsInChannel || [],
|
||||
page: returnedPage || undefined,
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function doFetchClaimCountByChannel(uri) {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_CHANNEL_CLAIM_COUNT_STARTED,
|
||||
data: { uri },
|
||||
});
|
||||
|
||||
Lbry.claim_list_by_channel({ uri }).then(result => {
|
||||
const claimResult = result[uri];
|
||||
const totalClaims = claimResult ? claimResult.claims_in_channel : 0;
|
||||
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_CHANNEL_CLAIM_COUNT_COMPLETED,
|
||||
data: {
|
||||
uri,
|
||||
totalClaims,
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
@ -70,6 +70,16 @@ export const selectAllFetchingChannelClaims = createSelector(
|
|||
export const makeSelectFetchingChannelClaims = uri =>
|
||||
createSelector(selectAllFetchingChannelClaims, fetching => fetching && fetching[uri]);
|
||||
|
||||
export const makeSelectClaimsInChannelForPage = (uri, page) =>
|
||||
createSelector(selectClaimsById, selectAllClaimsByChannel, (byId, allClaims) => {
|
||||
const byChannel = allClaims[uri] || {};
|
||||
const claimIds = byChannel[page || 1];
|
||||
|
||||
if (!claimIds) return claimIds;
|
||||
|
||||
return claimIds.map(claimId => byId[claimId]);
|
||||
});
|
||||
|
||||
export const makeSelectClaimsInChannelForCurrentPage = uri => {
|
||||
const pageSelector = makeSelectCurrentParam('page');
|
||||
|
||||
|
|
Loading…
Reference in a new issue