diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 2977116..e706f2a 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -1975,13 +1975,22 @@ function doResolveUris(uris, returnCachedClaims = false) { // Flow has terrible Object.entries support // https://github.com/facebook/flow/issues/2221 - // $FlowFixMe - if (uriResolveInfo.error) { - resolveInfo[uri] = _extends$3({}, fallbackResolveInfo); - } else { - // $FlowFixMe - const { claim, certificate, claims_in_channel: claimsInChannel } = uriResolveInfo; - resolveInfo[uri] = { claim, certificate, claimsInChannel }; + if (uriResolveInfo) { + if (uriResolveInfo.error) { + resolveInfo[uri] = _extends$3({}, fallbackResolveInfo); + } else { + let result = {}; + if (uriResolveInfo.value_type === 'channel') { + result.certificate = uriResolveInfo; + // $FlowFixMe + result.claimsInChannel = uriResolveInfo.meta.claims_in_channel; + } else { + result.claim = uriResolveInfo; + } + + // $FlowFixMe + resolveInfo[uri] = result; + } } }); @@ -2095,7 +2104,7 @@ function doFetchClaimsByChannel(uri, page = 1) { data: { uri, page } }); - lbryProxy.claim_search({ channel_name: uri, page: page || 1, winning: true }).then(result => { + lbryProxy.claim_search({ channel: uri, controlling: true, page: page || 1 }).then(result => { const { items: claimsInChannel, page: returnedPage } = result; dispatch({ @@ -3155,16 +3164,6 @@ reducers$2[LOADING_VIDEO_FAILED] = (state, action) => { }); }; -reducers$2[FETCH_DATE] = (state, action) => { - const { time } = action.data; - if (time) { - return Object.assign({}, state, { - publishedDate: time - }); - } - return null; -}; - reducers$2[SET_FILE_LIST_SORT] = (state, action) => { const pageSortStates = { [PUBLISHED]: 'fileListPublishedSort', diff --git a/dist/flow-typed/Claim.js b/dist/flow-typed/Claim.js index 69ac31b..0cb2167 100644 --- a/dist/flow-typed/Claim.js +++ b/dist/flow-typed/Claim.js @@ -44,6 +44,20 @@ declare type GenericClaim = { type: 'claim' | 'update' | 'support', valid_at_height?: number, // BUG: this should always exist https://github.com/lbryio/lbry/issues/1728 value_type: 'stream' | 'channel', + meta: { + activation_height: number, + creation_height: number, + creation_timestamp: number, + effective_amount: string, + expiration_height: number, + is_controlling: boolean, + support_amount: string, + trending_global: number, + trending_group: number, + trending_local: number, + trending_mixed: number, + claims_in_channel?: number, + }, }; declare type GenericMetadata = { diff --git a/dist/flow-typed/Lbry.js b/dist/flow-typed/Lbry.js index 303de6f..d9ff6f3 100644 --- a/dist/flow-typed/Lbry.js +++ b/dist/flow-typed/Lbry.js @@ -67,7 +67,9 @@ declare type ResolveResponse = { // Keys are the url(s) passed to resolve [string]: | { error: {}, certificate: ChannelClaim, claims_in_channel: number } - | { error?: {}, claim: StreamClaim, certificate?: ChannelClaim }, + | StreamClaim + | ChannelClaim + | { error?: {} }, }; declare type GetResponse = FileListItem; diff --git a/flow-typed/Claim.js b/flow-typed/Claim.js index 69ac31b..0cb2167 100644 --- a/flow-typed/Claim.js +++ b/flow-typed/Claim.js @@ -44,6 +44,20 @@ declare type GenericClaim = { type: 'claim' | 'update' | 'support', valid_at_height?: number, // BUG: this should always exist https://github.com/lbryio/lbry/issues/1728 value_type: 'stream' | 'channel', + meta: { + activation_height: number, + creation_height: number, + creation_timestamp: number, + effective_amount: string, + expiration_height: number, + is_controlling: boolean, + support_amount: string, + trending_global: number, + trending_group: number, + trending_local: number, + trending_mixed: number, + claims_in_channel?: number, + }, }; declare type GenericMetadata = { diff --git a/flow-typed/Lbry.js b/flow-typed/Lbry.js index 303de6f..d9ff6f3 100644 --- a/flow-typed/Lbry.js +++ b/flow-typed/Lbry.js @@ -67,7 +67,9 @@ declare type ResolveResponse = { // Keys are the url(s) passed to resolve [string]: | { error: {}, certificate: ChannelClaim, claims_in_channel: number } - | { error?: {}, claim: StreamClaim, certificate?: ChannelClaim }, + | StreamClaim + | ChannelClaim + | { error?: {} }, }; declare type GetResponse = FileListItem; diff --git a/src/redux/actions/claims.js b/src/redux/actions/claims.js index 33dd119..51c2712 100644 --- a/src/redux/actions/claims.js +++ b/src/redux/actions/claims.js @@ -50,13 +50,22 @@ export function doResolveUris(uris: Array, returnCachedClaims: boolean = // Flow has terrible Object.entries support // https://github.com/facebook/flow/issues/2221 - // $FlowFixMe - if (uriResolveInfo.error) { - resolveInfo[uri] = { ...fallbackResolveInfo }; - } else { - // $FlowFixMe - const { claim, certificate, claims_in_channel: claimsInChannel } = uriResolveInfo; - resolveInfo[uri] = { claim, certificate, claimsInChannel }; + if (uriResolveInfo) { + if (uriResolveInfo.error) { + resolveInfo[uri] = { ...fallbackResolveInfo }; + } else { + let result = {}; + if (uriResolveInfo.value_type === 'channel') { + result.certificate = uriResolveInfo; + // $FlowFixMe + result.claimsInChannel = uriResolveInfo.meta.claims_in_channel; + } else { + result.claim = uriResolveInfo; + } + + // $FlowFixMe + resolveInfo[uri] = result; + } } }); @@ -182,7 +191,7 @@ export function doFetchClaimsByChannel(uri: string, page: number = 1) { data: { uri, page }, }); - Lbry.claim_search({ channel_name: uri, page: page || 1, winning: true }).then( + Lbry.claim_search({ channel: uri, controlling: true, page: page || 1 }).then( (result: ClaimSearchResponse) => { const { items: claimsInChannel, page: returnedPage } = result; diff --git a/src/redux/reducers/file_info.js b/src/redux/reducers/file_info.js index 1d9f950..dbc5e86 100644 --- a/src/redux/reducers/file_info.js +++ b/src/redux/reducers/file_info.js @@ -161,16 +161,6 @@ reducers[ACTIONS.LOADING_VIDEO_FAILED] = (state, action) => { }); }; -reducers[ACTIONS.FETCH_DATE] = (state, action) => { - const { time } = action.data; - if (time) { - return Object.assign({}, state, { - publishedDate: time, - }); - } - return null; -}; - reducers[ACTIONS.SET_FILE_LIST_SORT] = (state, action) => { const pageSortStates = { [PAGES.PUBLISHED]: 'fileListPublishedSort',