populate channel claims for txo signing_channels

This commit is contained in:
zeppi 2021-03-05 13:32:27 -05:00
parent f8a4264307
commit 3f7d6c7f8e
5 changed files with 69 additions and 3 deletions

28
dist/bundle.es.js vendored
View file

@ -2234,6 +2234,8 @@ const makeSelectClaimIsPending = uri => reselect.createSelector(selectClaimIdsBy
const selectReflectingById = reselect.createSelector(selectState$1, state => state.reflectingById); 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) => { const makeSelectClaimForUri = (uri, returnRepost = true) => reselect.createSelector(selectClaimIdsByUri, selectClaimsById, (byUri, byId) => {
let validUri; let validUri;
let channelClaimId; let channelClaimId;
@ -2726,6 +2728,7 @@ function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, a
const FIFTEEN_SECONDS = 15000; const FIFTEEN_SECONDS = 15000;
let walletBalancePromise = null; let walletBalancePromise = null;
function doUpdateBalance() { function doUpdateBalance() {
return (dispatch, getState) => { return (dispatch, getState) => {
const { const {
@ -2797,6 +2800,29 @@ function doFetchTxoPage() {
const queryParams = selectTxoPageParams(state); const queryParams = selectTxoPageParams(state);
lbryProxy.txo_list(queryParams).then(res => { 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({ dispatch({
type: FETCH_TXO_PAGE_COMPLETED, type: FETCH_TXO_PAGE_COMPLETED,
data: res data: res
@ -3193,6 +3219,7 @@ function doWalletReconnect() {
}); });
}; };
} }
function doWalletDecrypt() { function doWalletDecrypt() {
return dispatch => { return dispatch => {
dispatch({ dispatch({
@ -6538,6 +6565,7 @@ exports.makeSelectAmountForUri = makeSelectAmountForUri;
exports.makeSelectCanonicalUrlForUri = makeSelectCanonicalUrlForUri; exports.makeSelectCanonicalUrlForUri = makeSelectCanonicalUrlForUri;
exports.makeSelectChannelForClaimUri = makeSelectChannelForClaimUri; exports.makeSelectChannelForClaimUri = makeSelectChannelForClaimUri;
exports.makeSelectChannelPermUrlForClaimUri = makeSelectChannelPermUrlForClaimUri; exports.makeSelectChannelPermUrlForClaimUri = makeSelectChannelPermUrlForClaimUri;
exports.makeSelectClaimForClaimId = makeSelectClaimForClaimId;
exports.makeSelectClaimForUri = makeSelectClaimForUri; exports.makeSelectClaimForUri = makeSelectClaimForUri;
exports.makeSelectClaimIsMine = makeSelectClaimIsMine; exports.makeSelectClaimIsMine = makeSelectClaimIsMine;
exports.makeSelectClaimIsNsfw = makeSelectClaimIsNsfw; exports.makeSelectClaimIsNsfw = makeSelectClaimIsNsfw;

View file

@ -188,6 +188,7 @@ export {
makeSelectIsAbandoningClaimForUri, makeSelectIsAbandoningClaimForUri,
selectPendingIds, selectPendingIds,
selectReflectingById, selectReflectingById,
makeSelectClaimForClaimId,
selectClaimsById, selectClaimsById,
selectClaimsByUri, selectClaimsByUri,
selectAllClaimsByChannel, selectAllClaimsByChannel,

View file

@ -65,7 +65,7 @@ export function doResolveUris(
} = {}; } = {};
return Lbry.resolve({ urls: urisToResolve, ...options }).then( return Lbry.resolve({ urls: urisToResolve, ...options }).then(
async (result: ResolveResponse) => { async(result: ResolveResponse) => {
let repostedResults = {}; let repostedResults = {};
const repostsToResolve = []; const repostsToResolve = [];
const fallbackResolveInfo = { const fallbackResolveInfo = {
@ -573,6 +573,7 @@ export function doClaimSearch(
page: number, page: number,
no_totals: boolean, no_totals: boolean,
any_tags?: Array<string>, any_tags?: Array<string>,
claim_ids?: Array<string>,
channel_ids?: Array<string>, channel_ids?: Array<string>,
not_channel_ids?: Array<string>, not_channel_ids?: Array<string>,
not_tags?: Array<string>, not_tags?: Array<string>,

View file

@ -10,11 +10,12 @@ import {
selectPendingMassClaimTxid, selectPendingMassClaimTxid,
} from 'redux/selectors/wallet'; } from 'redux/selectors/wallet';
import { creditsToString } from 'util/format-credits'; import { creditsToString } from 'util/format-credits';
import { selectMyClaimsRaw } from 'redux/selectors/claims'; import { selectMyClaimsRaw, selectClaimsById } from 'redux/selectors/claims';
import { doFetchChannelListMine, doFetchClaimListMine } from 'redux/actions/claims'; import { doFetchChannelListMine, doFetchClaimListMine, doClaimSearch } from 'redux/actions/claims';
const FIFTEEN_SECONDS = 15000; const FIFTEEN_SECONDS = 15000;
let walletBalancePromise = null; let walletBalancePromise = null;
export function doUpdateBalance() { export function doUpdateBalance() {
return (dispatch, getState) => { return (dispatch, getState) => {
const { const {
@ -88,6 +89,34 @@ export function doFetchTxoPage() {
const queryParams = selectTxoPageParams(state); const queryParams = selectTxoPageParams(state);
Lbry.txo_list(queryParams) 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 => { .then(res => {
dispatch({ dispatch({
type: ACTIONS.FETCH_TXO_PAGE_COMPLETED, type: ACTIONS.FETCH_TXO_PAGE_COMPLETED,
@ -517,6 +546,7 @@ export function doWalletReconnect() {
}); });
}; };
} }
export function doWalletDecrypt() { export function doWalletDecrypt() {
return dispatch => { return dispatch => {
dispatch({ dispatch({

View file

@ -94,6 +94,12 @@ export const selectReflectingById = createSelector(
state => state.reflectingById state => state.reflectingById
); );
export const makeSelectClaimForClaimId = (claimId: string) =>
createSelector(
selectClaimsById,
byId => byId[claimId]
);
export const makeSelectClaimForUri = (uri: string, returnRepost: boolean = true) => export const makeSelectClaimForUri = (uri: string, returnRepost: boolean = true) =>
createSelector( createSelector(
selectClaimIdsByUri, selectClaimIdsByUri,