populate channel claims for txo signing_channels #386

Merged
jessopb merged 1 commit from txo-signingChannels into master 2021-03-05 21:29:04 +01:00
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 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;

View file

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

View file

@ -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<string>,
claim_ids?: Array<string>,
channel_ids?: Array<string>,
not_channel_ids?: Array<string>,
not_tags?: Array<string>,

View file

@ -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({

View file

@ -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,