diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 1937fbb..af5c7a8 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -2234,6 +2234,8 @@ const makeSelectClaimIsPending = uri => reselect.createSelector(selectClaimIdsBy const selectReflectingById = reselect.createSelector(selectState$1, state => state.reflectingById); +const makeSelectClaimForClaimId = claimId => reselect.createSelector(selectClaimsById, byId => byId[claimId]); + const makeSelectClaimForUri = (uri, returnRepost = true) => reselect.createSelector(selectClaimIdsByUri, selectClaimsById, (byUri, byId) => { let validUri; let channelClaimId; @@ -2726,6 +2728,7 @@ function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, a const FIFTEEN_SECONDS = 15000; let walletBalancePromise = null; + function doUpdateBalance() { return (dispatch, getState) => { const { @@ -2797,6 +2800,29 @@ function doFetchTxoPage() { const queryParams = selectTxoPageParams(state); lbryProxy.txo_list(queryParams).then(res => { + const items = res.items || []; + const claimsById = selectClaimsById(state); + + const channelIds = items.reduce((acc, cur) => { + if (cur.type === 'support' && cur.signing_channel && !claimsById[cur.signing_channel.channel_id]) { + acc.push(cur.signing_channel.channel_id); + } + return acc; + }, []); + + if (channelIds.length) { + const searchParams = { + page_size: 9999, + page: 1, + no_totals: true, + claim_ids: channelIds + }; + // make sure redux has these channels resolved + dispatch(doClaimSearch(searchParams)); + } + + return res; + }).then(res => { dispatch({ type: FETCH_TXO_PAGE_COMPLETED, data: res @@ -3193,6 +3219,7 @@ function doWalletReconnect() { }); }; } + function doWalletDecrypt() { return dispatch => { dispatch({ @@ -6538,6 +6565,7 @@ exports.makeSelectAmountForUri = makeSelectAmountForUri; exports.makeSelectCanonicalUrlForUri = makeSelectCanonicalUrlForUri; exports.makeSelectChannelForClaimUri = makeSelectChannelForClaimUri; exports.makeSelectChannelPermUrlForClaimUri = makeSelectChannelPermUrlForClaimUri; +exports.makeSelectClaimForClaimId = makeSelectClaimForClaimId; exports.makeSelectClaimForUri = makeSelectClaimForUri; exports.makeSelectClaimIsMine = makeSelectClaimIsMine; exports.makeSelectClaimIsNsfw = makeSelectClaimIsNsfw; diff --git a/src/index.js b/src/index.js index 5464d69..fd999e4 100644 --- a/src/index.js +++ b/src/index.js @@ -188,6 +188,7 @@ export { makeSelectIsAbandoningClaimForUri, selectPendingIds, selectReflectingById, + makeSelectClaimForClaimId, selectClaimsById, selectClaimsByUri, selectAllClaimsByChannel, diff --git a/src/redux/actions/claims.js b/src/redux/actions/claims.js index 3e4f028..b142f8d 100644 --- a/src/redux/actions/claims.js +++ b/src/redux/actions/claims.js @@ -65,7 +65,7 @@ export function doResolveUris( } = {}; return Lbry.resolve({ urls: urisToResolve, ...options }).then( - async (result: ResolveResponse) => { + async(result: ResolveResponse) => { let repostedResults = {}; const repostsToResolve = []; const fallbackResolveInfo = { @@ -573,6 +573,7 @@ export function doClaimSearch( page: number, no_totals: boolean, any_tags?: Array, + claim_ids?: Array, channel_ids?: Array, not_channel_ids?: Array, not_tags?: Array, diff --git a/src/redux/actions/wallet.js b/src/redux/actions/wallet.js index b8bbe0f..9ff0e1a 100644 --- a/src/redux/actions/wallet.js +++ b/src/redux/actions/wallet.js @@ -10,11 +10,12 @@ import { selectPendingMassClaimTxid, } from 'redux/selectors/wallet'; import { creditsToString } from 'util/format-credits'; -import { selectMyClaimsRaw } from 'redux/selectors/claims'; -import { doFetchChannelListMine, doFetchClaimListMine } from 'redux/actions/claims'; +import { selectMyClaimsRaw, selectClaimsById } from 'redux/selectors/claims'; +import { doFetchChannelListMine, doFetchClaimListMine, doClaimSearch } from 'redux/actions/claims'; const FIFTEEN_SECONDS = 15000; let walletBalancePromise = null; + export function doUpdateBalance() { return (dispatch, getState) => { const { @@ -88,6 +89,34 @@ export function doFetchTxoPage() { const queryParams = selectTxoPageParams(state); Lbry.txo_list(queryParams) + .then(res => { + const items = res.items || []; + const claimsById = selectClaimsById(state); + + const channelIds = items.reduce((acc, cur) => { + if ( + cur.type === 'support' && + cur.signing_channel && + !claimsById[cur.signing_channel.channel_id] + ) { + acc.push(cur.signing_channel.channel_id); + } + return acc; + }, []); + + if (channelIds.length) { + const searchParams = { + page_size: 9999, + page: 1, + no_totals: true, + claim_ids: channelIds, + }; + // make sure redux has these channels resolved + dispatch(doClaimSearch(searchParams)); + } + + return res; + }) .then(res => { dispatch({ type: ACTIONS.FETCH_TXO_PAGE_COMPLETED, @@ -517,6 +546,7 @@ export function doWalletReconnect() { }); }; } + export function doWalletDecrypt() { return dispatch => { dispatch({ diff --git a/src/redux/selectors/claims.js b/src/redux/selectors/claims.js index 46f8158..e20a8d3 100644 --- a/src/redux/selectors/claims.js +++ b/src/redux/selectors/claims.js @@ -94,6 +94,12 @@ export const selectReflectingById = createSelector( state => state.reflectingById ); +export const makeSelectClaimForClaimId = (claimId: string) => + createSelector( + selectClaimsById, + byId => byId[claimId] + ); + export const makeSelectClaimForUri = (uri: string, returnRepost: boolean = true) => createSelector( selectClaimIdsByUri,