commit
4491b975cc
19 changed files with 344 additions and 161 deletions
156
dist/bundle.es.js
vendored
156
dist/bundle.es.js
vendored
|
@ -657,9 +657,11 @@ var transaction_types = /*#__PURE__*/Object.freeze({
|
|||
|
||||
// PAGE SIZE
|
||||
const PAGE_SIZE$1 = 50;
|
||||
const LATEST_PAGE_SIZE = 20;
|
||||
|
||||
var transaction_list = /*#__PURE__*/Object.freeze({
|
||||
PAGE_SIZE: PAGE_SIZE$1
|
||||
PAGE_SIZE: PAGE_SIZE$1,
|
||||
LATEST_PAGE_SIZE: LATEST_PAGE_SIZE
|
||||
});
|
||||
|
||||
const SPEECH_STATUS = 'https://spee.ch/api/config/site/publishing';
|
||||
|
@ -770,8 +772,10 @@ const Lbry = {
|
|||
channel_import: params => daemonCallWithResult('channel_import', params),
|
||||
channel_list: params => daemonCallWithResult('channel_list', params),
|
||||
stream_abandon: params => daemonCallWithResult('stream_abandon', params),
|
||||
stream_list: params => daemonCallWithResult('stream_list', params),
|
||||
channel_abandon: params => daemonCallWithResult('channel_abandon', params),
|
||||
support_create: params => daemonCallWithResult('support_create', params),
|
||||
support_list: params => daemonCallWithResult('support_list', params),
|
||||
|
||||
// File fetching and manipulation
|
||||
file_list: (params = {}) => daemonCallWithResult('file_list', params),
|
||||
|
@ -829,16 +833,16 @@ const Lbry = {
|
|||
// Flow thinks this could be empty, but it will always reuturn a promise
|
||||
// $FlowFixMe
|
||||
return Lbry.connectPromise;
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
Lbry.publish = (params = {}) => new Promise((resolve, reject) => {
|
||||
if (Lbry.overrides.publish) {
|
||||
Lbry.overrides.publish(params).then(resolve, reject);
|
||||
} else {
|
||||
apiCall('publish', params, resolve, reject);
|
||||
}
|
||||
});
|
||||
publish: (params = {}) => new Promise((resolve, reject) => {
|
||||
if (Lbry.overrides.publish) {
|
||||
Lbry.overrides.publish(params).then(resolve, reject);
|
||||
} else {
|
||||
apiCall('publish', params, resolve, reject);
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
function checkAndParse(response) {
|
||||
if (response.status >= 200 && response.status < 300) {
|
||||
|
@ -1712,6 +1716,10 @@ const makeSelectFilteredTransactionsForPage = (page = 1) => reselect.createSelec
|
|||
return filteredTransactions && filteredTransactions.length ? filteredTransactions.slice(start, end) : [];
|
||||
});
|
||||
|
||||
const makeSelectLatestTransactions = reselect.createSelector(selectTransactionItems, transactions => {
|
||||
return transactions && transactions.length ? transactions.slice(0, LATEST_PAGE_SIZE) : [];
|
||||
});
|
||||
|
||||
const selectFilteredTransactionCount = reselect.createSelector(selectFilteredTransactions, filteredTransactions => filteredTransactions.length);
|
||||
|
||||
var _extends$3 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
@ -2178,30 +2186,38 @@ function creditsToString(amount) {
|
|||
return creditString;
|
||||
}
|
||||
|
||||
let walletBalancePromise = null;
|
||||
function doUpdateBalance() {
|
||||
return (dispatch, getState) => {
|
||||
const {
|
||||
wallet: { totalBalance: totalInStore }
|
||||
} = getState();
|
||||
return lbryProxy.wallet_balance({ reserved_subtotals: true }).then(response => {
|
||||
const { available, reserved, reserved_subtotals, total } = response;
|
||||
const { claims, supports, tips } = reserved_subtotals;
|
||||
const totalFloat = parseFloat(total);
|
||||
|
||||
if (totalInStore !== totalFloat) {
|
||||
dispatch({
|
||||
type: UPDATE_BALANCE,
|
||||
data: {
|
||||
totalBalance: totalFloat,
|
||||
balance: parseFloat(available),
|
||||
reservedBalance: parseFloat(reserved),
|
||||
claimsBalance: parseFloat(claims),
|
||||
supportsBalance: parseFloat(supports),
|
||||
tipsBalance: parseFloat(tips)
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
if (walletBalancePromise === null) {
|
||||
walletBalancePromise = lbryProxy.wallet_balance().then(response => {
|
||||
walletBalancePromise = null;
|
||||
|
||||
const { available, reserved, reserved_subtotals, total } = response;
|
||||
const { claims, supports, tips } = reserved_subtotals;
|
||||
const totalFloat = parseFloat(total);
|
||||
|
||||
if (totalInStore !== totalFloat) {
|
||||
dispatch({
|
||||
type: UPDATE_BALANCE,
|
||||
data: {
|
||||
totalBalance: totalFloat,
|
||||
balance: parseFloat(available),
|
||||
reservedBalance: parseFloat(reserved),
|
||||
claimsBalance: parseFloat(claims),
|
||||
supportsBalance: parseFloat(supports),
|
||||
tipsBalance: parseFloat(tips)
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return walletBalancePromise;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -2212,35 +2228,35 @@ function doBalanceSubscribe() {
|
|||
};
|
||||
}
|
||||
|
||||
function doFetchTransactions() {
|
||||
function doFetchTransactions(page = 1, pageSize = 99999) {
|
||||
return dispatch => {
|
||||
dispatch(doFetchSupports());
|
||||
dispatch({
|
||||
type: FETCH_TRANSACTIONS_STARTED
|
||||
});
|
||||
|
||||
lbryProxy.utxo_release().then(() => lbryProxy.transaction_list()).then(results => {
|
||||
lbryProxy.utxo_release().then(() => lbryProxy.transaction_list({ page, page_size: pageSize })).then(result => {
|
||||
dispatch({
|
||||
type: FETCH_TRANSACTIONS_COMPLETED,
|
||||
data: {
|
||||
transactions: results
|
||||
transactions: result.items
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function doFetchSupports() {
|
||||
function doFetchSupports(page = 1, pageSize = 99999) {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: FETCH_SUPPORTS_STARTED
|
||||
});
|
||||
|
||||
lbryProxy.support_list().then(results => {
|
||||
lbryProxy.support_list({ page, page_size: pageSize }).then(result => {
|
||||
dispatch({
|
||||
type: FETCH_SUPPORTS_COMPLETED,
|
||||
data: {
|
||||
supports: results
|
||||
supports: result.items
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -2599,13 +2615,15 @@ function doResolveUri(uri) {
|
|||
return doResolveUris([uri]);
|
||||
}
|
||||
|
||||
function doFetchClaimListMine() {
|
||||
function doFetchClaimListMine(page = 1, pageSize = 99999) {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: FETCH_CLAIM_LIST_MINE_STARTED
|
||||
});
|
||||
|
||||
lbryProxy.claim_list().then(claims => {
|
||||
lbryProxy.stream_list({ page, page_size: pageSize }).then(result => {
|
||||
const claims = result.items;
|
||||
|
||||
dispatch({
|
||||
type: FETCH_CLAIM_LIST_MINE_COMPLETED,
|
||||
data: {
|
||||
|
@ -2670,10 +2688,12 @@ function doAbandonClaim(txid, nout) {
|
|||
message: abandonMessage
|
||||
}));
|
||||
|
||||
// After abandoning, call claim_list to show the claim as abandoned
|
||||
// Also fetch transactions to show the new abandon transaction
|
||||
if (isClaim) dispatch(doFetchClaimListMine());
|
||||
dispatch(doFetchTransactions());
|
||||
// After abandoning, fetch transactions to show the new abandon transaction
|
||||
// Only fetch the latest few transactions since we don't care about old ones
|
||||
// Not very robust, but better than calling the entire list for large wallets
|
||||
const page = 1;
|
||||
const pageSize = 10;
|
||||
dispatch(doFetchTransactions(page, pageSize));
|
||||
};
|
||||
|
||||
const abandonParams = {
|
||||
|
@ -2855,25 +2875,27 @@ function doImportChannel(certificate) {
|
|||
};
|
||||
}
|
||||
|
||||
function doFetchChannelListMine() {
|
||||
function doFetchChannelListMine(page = 1, pageSize = 99999) {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: FETCH_CHANNEL_LIST_STARTED
|
||||
});
|
||||
|
||||
const callback = channels => {
|
||||
const callback = response => {
|
||||
dispatch({
|
||||
type: FETCH_CHANNEL_LIST_COMPLETED,
|
||||
data: { claims: channels }
|
||||
data: { claims: response.items }
|
||||
});
|
||||
};
|
||||
|
||||
lbryProxy.channel_list().then(callback);
|
||||
lbryProxy.channel_list({ page, page_size: pageSize }).then(callback);
|
||||
};
|
||||
}
|
||||
|
||||
function doClaimSearch(options = {
|
||||
page_size: 10
|
||||
no_totals: true,
|
||||
page_size: 10,
|
||||
page: 1
|
||||
}) {
|
||||
const query = createNormalizedClaimSearchKey(options);
|
||||
return dispatch => {
|
||||
|
@ -2995,7 +3017,7 @@ const selectFileListDownloadedSort = reselect.createSelector(selectState$3, stat
|
|||
|
||||
const selectDownloadedUris = reselect.createSelector(selectFileInfosDownloaded,
|
||||
// We should use permament_url but it doesn't exist in file_list
|
||||
info => info.slice().reverse().map(claim => `lbry://${claim.claim_name}#${claim.claim_id}`));
|
||||
info => info.slice().map(claim => `lbry://${claim.claim_name}#${claim.claim_id}`));
|
||||
|
||||
const makeSelectMediaTypeForUri = uri => reselect.createSelector(makeSelectFileInfoForUri(uri), makeSelectContentTypeForUri(uri), (fileInfo, contentType) => {
|
||||
if (!fileInfo && !contentType) {
|
||||
|
@ -3046,7 +3068,11 @@ const makeSelectSearchDownloadUrlsForPage = (query, page = 1) => reselect.create
|
|||
const start = (Number(page) - 1) * Number(PAGE_SIZE);
|
||||
const end = Number(page) * Number(PAGE_SIZE);
|
||||
|
||||
return matchingFileInfos && matchingFileInfos.length ? matchingFileInfos.slice(start, end).map(fileInfo => buildURI({ streamName: fileInfo.claim_name, channelName: fileInfo.channel_name, channelClaimId: fileInfo.channel_claim_id })) : [];
|
||||
return matchingFileInfos && matchingFileInfos.length ? matchingFileInfos.slice(start, end).map(fileInfo => buildURI({
|
||||
streamName: fileInfo.claim_name,
|
||||
channelName: fileInfo.channel_name,
|
||||
channelClaimId: fileInfo.channel_claim_id
|
||||
})) : [];
|
||||
});
|
||||
|
||||
const makeSelectSearchDownloadUrlsCount = query => reselect.createSelector(selectFileInfosDownloaded, fileInfos => {
|
||||
|
@ -3189,12 +3215,15 @@ function doFetchFileInfo(uri) {
|
|||
}
|
||||
});
|
||||
|
||||
lbryProxy.file_list({ outpoint, full_status: true }).then(fileInfos => {
|
||||
lbryProxy.file_list({ outpoint, full_status: true, page: 1, page_size: 1 }).then(result => {
|
||||
const { items: fileInfos } = result;
|
||||
const fileInfo = fileInfos[0];
|
||||
|
||||
dispatch({
|
||||
type: FETCH_FILE_INFO_COMPLETED,
|
||||
data: {
|
||||
outpoint,
|
||||
fileInfo: fileInfos && fileInfos.length ? fileInfos[0] : null
|
||||
fileInfo: fileInfo || null
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -3202,7 +3231,7 @@ function doFetchFileInfo(uri) {
|
|||
};
|
||||
}
|
||||
|
||||
function doFileList() {
|
||||
function doFileList(page = 1, pageSize = 99999) {
|
||||
return (dispatch, getState) => {
|
||||
const state = getState();
|
||||
const isFetching = selectIsFetchingFileList(state);
|
||||
|
@ -3212,11 +3241,12 @@ function doFileList() {
|
|||
type: FILE_LIST_STARTED
|
||||
});
|
||||
|
||||
lbryProxy.file_list().then(fileInfos => {
|
||||
lbryProxy.file_list({ page, page_size: pageSize }).then(result => {
|
||||
const { items: fileInfos } = result;
|
||||
dispatch({
|
||||
type: FILE_LIST_SUCCEEDED,
|
||||
data: {
|
||||
fileInfos
|
||||
fileInfos: fileInfos.reverse()
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -3437,6 +3467,7 @@ const doUploadThumbnail = (filePath, thumbnailBlob, fsAdapter, fs, path) => disp
|
|||
const name = makeid();
|
||||
const file = thumbnailBlob || thumbnail && new File([thumbnail], fileName, { type: fileType });
|
||||
data.append('name', name);
|
||||
// $FlowFixMe
|
||||
data.append('file', file);
|
||||
|
||||
return fetch(SPEECH_PUBLISH, {
|
||||
|
@ -3624,8 +3655,9 @@ const doCheckPendingPublishes = onConfirmed => (dispatch, getState) => {
|
|||
let publishCheckInterval;
|
||||
|
||||
const checkFileList = () => {
|
||||
lbryProxy.claim_list().then(claims => {
|
||||
// $FlowFixMe
|
||||
lbryProxy.stream_list({ page: 1, page_size: 10 }).then(result => {
|
||||
const claims = result.items;
|
||||
|
||||
claims.forEach(claim => {
|
||||
// If it's confirmed, check if it was pending previously
|
||||
if (claim.confirmations > 0 && pendingById[claim.claim_id]) {
|
||||
|
@ -3866,7 +3898,7 @@ const doDeleteTag = name => ({
|
|||
|
||||
//
|
||||
|
||||
function doCommentList(uri) {
|
||||
function doCommentList(uri, page = 1, pageSize = 99999) {
|
||||
return (dispatch, getState) => {
|
||||
const state = getState();
|
||||
const claim = selectClaimsByUri(state)[uri];
|
||||
|
@ -3876,12 +3908,15 @@ function doCommentList(uri) {
|
|||
type: COMMENT_LIST_STARTED
|
||||
});
|
||||
lbryProxy.comment_list({
|
||||
claim_id: claimId
|
||||
}).then(results => {
|
||||
claim_id: claimId,
|
||||
page,
|
||||
page_size: pageSize
|
||||
}).then(result => {
|
||||
const { items: comments } = result;
|
||||
dispatch({
|
||||
type: COMMENT_LIST_COMPLETED,
|
||||
data: {
|
||||
comments: results,
|
||||
comments,
|
||||
claimId: claimId,
|
||||
uri: uri
|
||||
}
|
||||
|
@ -4364,8 +4399,8 @@ const commentReducer = handleActions({
|
|||
const byId = Object.assign({}, state.byId);
|
||||
const commentsByUri = Object.assign({}, state.commentsByUri);
|
||||
|
||||
if (comments['items']) {
|
||||
byId[claimId] = comments['items'];
|
||||
if (comments) {
|
||||
byId[claimId] = comments;
|
||||
commentsByUri[uri] = claimId;
|
||||
}
|
||||
return _extends$7({}, state, {
|
||||
|
@ -5426,6 +5461,7 @@ exports.makeSelectFilteredTransactionsForPage = makeSelectFilteredTransactionsFo
|
|||
exports.makeSelectFirstRecommendedFileForUri = makeSelectFirstRecommendedFileForUri;
|
||||
exports.makeSelectIsFollowingTag = makeSelectIsFollowingTag;
|
||||
exports.makeSelectIsUriResolving = makeSelectIsUriResolving;
|
||||
exports.makeSelectLatestTransactions = makeSelectLatestTransactions;
|
||||
exports.makeSelectLoadingForUri = makeSelectLoadingForUri;
|
||||
exports.makeSelectMediaTypeForUri = makeSelectMediaTypeForUri;
|
||||
exports.makeSelectMetadataForUri = makeSelectMetadataForUri;
|
||||
|
|
1
dist/flow-typed/File.js
vendored
1
dist/flow-typed/File.js
vendored
|
@ -2,6 +2,7 @@
|
|||
|
||||
declare type FileListItem = {
|
||||
metadata: StreamMetadata,
|
||||
added_on: number,
|
||||
blobs_completed: number,
|
||||
blobs_in_stream: number,
|
||||
blobs_remaining: number,
|
||||
|
|
66
dist/flow-typed/Lbry.js
vendored
66
dist/flow-typed/Lbry.js
vendored
|
@ -107,7 +107,11 @@ declare type ClaimSearchResponse = {
|
|||
};
|
||||
|
||||
declare type ClaimListResponse = {
|
||||
claims: Array<ChannelClaim | Claim>,
|
||||
items: Array<ChannelClaim | Claim>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number,
|
||||
total_pages: number,
|
||||
};
|
||||
|
||||
declare type ChannelCreateResponse = GenericTxResponse & {
|
||||
|
@ -119,15 +123,47 @@ declare type ChannelUpdateResponse = GenericTxResponse & {
|
|||
};
|
||||
|
||||
declare type CommentCreateResponse = Comment;
|
||||
declare type CommentListResponse = Array<Comment>;
|
||||
declare type CommentListResponse = {
|
||||
items: Array<Comment>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number,
|
||||
total_pages: number,
|
||||
};
|
||||
|
||||
declare type ChannelListResponse = Array<ChannelClaim>;
|
||||
declare type ChannelListResponse = {
|
||||
items: Array<ChannelClaim>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number,
|
||||
total_pages: number,
|
||||
};
|
||||
|
||||
declare type FileListResponse = Array<FileListItem>;
|
||||
declare type FileListResponse = {
|
||||
items: Array<FileListItem>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number,
|
||||
total_pages: number,
|
||||
};
|
||||
|
||||
declare type TxListResponse = Array<Transaction>;
|
||||
declare type TxListResponse = {
|
||||
items: Array<Transaction>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number,
|
||||
total_pages: number,
|
||||
};
|
||||
|
||||
declare type BlobListResponse = Array<string>;
|
||||
declare type SupportListResponse = {
|
||||
items: Array<Support>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number,
|
||||
total_pages: number,
|
||||
};
|
||||
|
||||
declare type BlobListResponse = { items: Array<string> };
|
||||
|
||||
declare type WalletListResponse = Array<{
|
||||
id: string,
|
||||
|
@ -146,6 +182,14 @@ declare type SyncApplyResponse = {
|
|||
|
||||
declare type SupportAbandonResponse = GenericTxResponse;
|
||||
|
||||
declare type StreamListResponse = {
|
||||
items: Array<StreamClaim>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number,
|
||||
total_pages: number,
|
||||
};
|
||||
|
||||
//
|
||||
// Types used in the generic Lbry object that is exported
|
||||
//
|
||||
|
@ -168,17 +212,20 @@ declare type LbryTypes = {
|
|||
version: () => Promise<VersionResponse>,
|
||||
resolve: (params: {}) => Promise<ResolveResponse>,
|
||||
get: (params: {}) => Promise<GetResponse>,
|
||||
publish?: (params: {}) => Promise<PublishResponse>,
|
||||
publish: (params: {}) => Promise<PublishResponse>,
|
||||
|
||||
claim_search: (params: {}) => Promise<ClaimSearchResponse>,
|
||||
claim_list: (params?: {}) => Promise<ClaimListResponse>,
|
||||
claim_list: (params: {}) => Promise<ClaimListResponse>,
|
||||
channel_create: (params: {}) => Promise<ChannelCreateResponse>,
|
||||
channel_update: (params: {}) => Promise<ChannelUpdateResponse>,
|
||||
channel_import: (params: {}) => Promise<string>,
|
||||
channel_list: () => Promise<ChannelListResponse>,
|
||||
channel_list: (params: {}) => Promise<ChannelListResponse>,
|
||||
stream_abandon: (params: {}) => Promise<GenericTxResponse>,
|
||||
stream_list: (params: {}) => Promise<StreamListResponse>,
|
||||
channel_abandon: (params: {}) => Promise<GenericTxResponse>,
|
||||
support_create: (params: {}) => Promise<GenericTxResponse>,
|
||||
support_list: (params: {}) => Promise<SupportListResponse>,
|
||||
support_abandon: (params: {}) => Promise<SupportAbandonResponse>,
|
||||
|
||||
// File fetching and manipulation
|
||||
file_list: (params: {}) => Promise<FileListResponse>,
|
||||
|
@ -205,7 +252,6 @@ declare type LbryTypes = {
|
|||
address_unused: (params: {}) => Promise<string>, // New address
|
||||
address_list: (params: {}) => Promise<string>,
|
||||
transaction_list: (params: {}) => Promise<TxListResponse>,
|
||||
support_abandon: (params: {}) => Promise<SupportAbandonResponse>,
|
||||
|
||||
// Sync
|
||||
sync_hash: (params: {}) => Promise<string>,
|
||||
|
|
1
dist/flow-typed/Transaction.js
vendored
1
dist/flow-typed/Transaction.js
vendored
|
@ -19,6 +19,7 @@ declare type Support = {
|
|||
is_change: string,
|
||||
is_mine: string,
|
||||
name: string,
|
||||
normalized_name: string,
|
||||
nout: string,
|
||||
permanent_url: string,
|
||||
timestamp: number,
|
||||
|
|
1
flow-typed/File.js
vendored
1
flow-typed/File.js
vendored
|
@ -2,6 +2,7 @@
|
|||
|
||||
declare type FileListItem = {
|
||||
metadata: StreamMetadata,
|
||||
added_on: number,
|
||||
blobs_completed: number,
|
||||
blobs_in_stream: number,
|
||||
blobs_remaining: number,
|
||||
|
|
66
flow-typed/Lbry.js
vendored
66
flow-typed/Lbry.js
vendored
|
@ -107,7 +107,11 @@ declare type ClaimSearchResponse = {
|
|||
};
|
||||
|
||||
declare type ClaimListResponse = {
|
||||
claims: Array<ChannelClaim | Claim>,
|
||||
items: Array<ChannelClaim | Claim>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number,
|
||||
total_pages: number,
|
||||
};
|
||||
|
||||
declare type ChannelCreateResponse = GenericTxResponse & {
|
||||
|
@ -119,15 +123,47 @@ declare type ChannelUpdateResponse = GenericTxResponse & {
|
|||
};
|
||||
|
||||
declare type CommentCreateResponse = Comment;
|
||||
declare type CommentListResponse = Array<Comment>;
|
||||
declare type CommentListResponse = {
|
||||
items: Array<Comment>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number,
|
||||
total_pages: number,
|
||||
};
|
||||
|
||||
declare type ChannelListResponse = Array<ChannelClaim>;
|
||||
declare type ChannelListResponse = {
|
||||
items: Array<ChannelClaim>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number,
|
||||
total_pages: number,
|
||||
};
|
||||
|
||||
declare type FileListResponse = Array<FileListItem>;
|
||||
declare type FileListResponse = {
|
||||
items: Array<FileListItem>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number,
|
||||
total_pages: number,
|
||||
};
|
||||
|
||||
declare type TxListResponse = Array<Transaction>;
|
||||
declare type TxListResponse = {
|
||||
items: Array<Transaction>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number,
|
||||
total_pages: number,
|
||||
};
|
||||
|
||||
declare type BlobListResponse = Array<string>;
|
||||
declare type SupportListResponse = {
|
||||
items: Array<Support>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number,
|
||||
total_pages: number,
|
||||
};
|
||||
|
||||
declare type BlobListResponse = { items: Array<string> };
|
||||
|
||||
declare type WalletListResponse = Array<{
|
||||
id: string,
|
||||
|
@ -146,6 +182,14 @@ declare type SyncApplyResponse = {
|
|||
|
||||
declare type SupportAbandonResponse = GenericTxResponse;
|
||||
|
||||
declare type StreamListResponse = {
|
||||
items: Array<StreamClaim>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number,
|
||||
total_pages: number,
|
||||
};
|
||||
|
||||
//
|
||||
// Types used in the generic Lbry object that is exported
|
||||
//
|
||||
|
@ -168,17 +212,20 @@ declare type LbryTypes = {
|
|||
version: () => Promise<VersionResponse>,
|
||||
resolve: (params: {}) => Promise<ResolveResponse>,
|
||||
get: (params: {}) => Promise<GetResponse>,
|
||||
publish?: (params: {}) => Promise<PublishResponse>,
|
||||
publish: (params: {}) => Promise<PublishResponse>,
|
||||
|
||||
claim_search: (params: {}) => Promise<ClaimSearchResponse>,
|
||||
claim_list: (params?: {}) => Promise<ClaimListResponse>,
|
||||
claim_list: (params: {}) => Promise<ClaimListResponse>,
|
||||
channel_create: (params: {}) => Promise<ChannelCreateResponse>,
|
||||
channel_update: (params: {}) => Promise<ChannelUpdateResponse>,
|
||||
channel_import: (params: {}) => Promise<string>,
|
||||
channel_list: () => Promise<ChannelListResponse>,
|
||||
channel_list: (params: {}) => Promise<ChannelListResponse>,
|
||||
stream_abandon: (params: {}) => Promise<GenericTxResponse>,
|
||||
stream_list: (params: {}) => Promise<StreamListResponse>,
|
||||
channel_abandon: (params: {}) => Promise<GenericTxResponse>,
|
||||
support_create: (params: {}) => Promise<GenericTxResponse>,
|
||||
support_list: (params: {}) => Promise<SupportListResponse>,
|
||||
support_abandon: (params: {}) => Promise<SupportAbandonResponse>,
|
||||
|
||||
// File fetching and manipulation
|
||||
file_list: (params: {}) => Promise<FileListResponse>,
|
||||
|
@ -205,7 +252,6 @@ declare type LbryTypes = {
|
|||
address_unused: (params: {}) => Promise<string>, // New address
|
||||
address_list: (params: {}) => Promise<string>,
|
||||
transaction_list: (params: {}) => Promise<TxListResponse>,
|
||||
support_abandon: (params: {}) => Promise<SupportAbandonResponse>,
|
||||
|
||||
// Sync
|
||||
sync_hash: (params: {}) => Promise<string>,
|
||||
|
|
1
flow-typed/Transaction.js
vendored
1
flow-typed/Transaction.js
vendored
|
@ -19,6 +19,7 @@ declare type Support = {
|
|||
is_change: string,
|
||||
is_mine: string,
|
||||
name: string,
|
||||
normalized_name: string,
|
||||
nout: string,
|
||||
permanent_url: string,
|
||||
timestamp: number,
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
// PAGE SIZE
|
||||
export const PAGE_SIZE = 50;
|
||||
export const LATEST_PAGE_SIZE = 20;
|
||||
|
|
|
@ -301,6 +301,7 @@ export {
|
|||
selectWalletUnlockResult,
|
||||
selectTransactionListFilter,
|
||||
selectFilteredTransactions,
|
||||
makeSelectLatestTransactions,
|
||||
makeSelectFilteredTransactionsForPage,
|
||||
selectFilteredTransactionCount,
|
||||
} from 'redux/selectors/wallet';
|
||||
|
|
20
src/lbry.js
20
src/lbry.js
|
@ -82,8 +82,10 @@ const Lbry: LbryTypes = {
|
|||
channel_import: params => daemonCallWithResult('channel_import', params),
|
||||
channel_list: params => daemonCallWithResult('channel_list', params),
|
||||
stream_abandon: params => daemonCallWithResult('stream_abandon', params),
|
||||
stream_list: params => daemonCallWithResult('stream_list', params),
|
||||
channel_abandon: params => daemonCallWithResult('channel_abandon', params),
|
||||
support_create: params => daemonCallWithResult('support_create', params),
|
||||
support_list: params => daemonCallWithResult('support_list', params),
|
||||
|
||||
// File fetching and manipulation
|
||||
file_list: (params = {}) => daemonCallWithResult('file_list', params),
|
||||
|
@ -144,16 +146,16 @@ const Lbry: LbryTypes = {
|
|||
// $FlowFixMe
|
||||
return Lbry.connectPromise;
|
||||
},
|
||||
};
|
||||
|
||||
Lbry.publish = (params = {}) =>
|
||||
new Promise((resolve, reject) => {
|
||||
if (Lbry.overrides.publish) {
|
||||
Lbry.overrides.publish(params).then(resolve, reject);
|
||||
} else {
|
||||
apiCall('publish', params, resolve, reject);
|
||||
}
|
||||
});
|
||||
publish: (params = {}) =>
|
||||
new Promise((resolve, reject) => {
|
||||
if (Lbry.overrides.publish) {
|
||||
Lbry.overrides.publish(params).then(resolve, reject);
|
||||
} else {
|
||||
apiCall('publish', params, resolve, reject);
|
||||
}
|
||||
}),
|
||||
};
|
||||
|
||||
function checkAndParse(response) {
|
||||
if (response.status >= 200 && response.status < 300) {
|
||||
|
|
|
@ -94,13 +94,15 @@ export function doResolveUri(uri: string) {
|
|||
return doResolveUris([uri]);
|
||||
}
|
||||
|
||||
export function doFetchClaimListMine() {
|
||||
export function doFetchClaimListMine(page: number = 1, pageSize: number = 99999) {
|
||||
return (dispatch: Dispatch) => {
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_CLAIM_LIST_MINE_STARTED,
|
||||
});
|
||||
|
||||
Lbry.claim_list().then((claims: ClaimListResponse) => {
|
||||
Lbry.stream_list({ page, page_size: pageSize }).then((result: StreamListResponse) => {
|
||||
const claims = result.items;
|
||||
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED,
|
||||
data: {
|
||||
|
@ -175,10 +177,12 @@ export function doAbandonClaim(txid: string, nout: number) {
|
|||
})
|
||||
);
|
||||
|
||||
// After abandoning, call claim_list to show the claim as abandoned
|
||||
// Also fetch transactions to show the new abandon transaction
|
||||
if (isClaim) dispatch(doFetchClaimListMine());
|
||||
dispatch(doFetchTransactions());
|
||||
// After abandoning, fetch transactions to show the new abandon transaction
|
||||
// Only fetch the latest few transactions since we don't care about old ones
|
||||
// Not very robust, but better than calling the entire list for large wallets
|
||||
const page = 1;
|
||||
const pageSize = 10;
|
||||
dispatch(doFetchTransactions(page, pageSize));
|
||||
};
|
||||
|
||||
const abandonParams = {
|
||||
|
@ -378,26 +382,38 @@ export function doImportChannel(certificate: string) {
|
|||
};
|
||||
}
|
||||
|
||||
export function doFetchChannelListMine() {
|
||||
export function doFetchChannelListMine(page: number = 1, pageSize: number = 99999) {
|
||||
return (dispatch: Dispatch) => {
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_CHANNEL_LIST_STARTED,
|
||||
});
|
||||
|
||||
const callback = (channels: Array<ChannelClaim>) => {
|
||||
const callback = (response: ChannelListResponse) => {
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_CHANNEL_LIST_COMPLETED,
|
||||
data: { claims: channels },
|
||||
data: { claims: response.items },
|
||||
});
|
||||
};
|
||||
|
||||
Lbry.channel_list().then(callback);
|
||||
Lbry.channel_list({ page, page_size: pageSize }).then(callback);
|
||||
};
|
||||
}
|
||||
|
||||
export function doClaimSearch(
|
||||
options: { tags?: Array<string>, page?: number, page_size?: number, release_time?: string } = {
|
||||
options: {
|
||||
page_size: number,
|
||||
page: number,
|
||||
no_totals: boolean,
|
||||
any_tags?: Array<string>,
|
||||
channel_ids?: Array<string>,
|
||||
not_channel_ids?: Array<string>,
|
||||
not_tags?: Array<string>,
|
||||
order_by?: Array<string>,
|
||||
release_time?: string,
|
||||
} = {
|
||||
no_totals: true,
|
||||
page_size: 10,
|
||||
page: 1,
|
||||
}
|
||||
) {
|
||||
const query = createNormalizedClaimSearchKey(options);
|
||||
|
|
|
@ -4,7 +4,7 @@ import Lbry from 'lbry';
|
|||
import { selectClaimsByUri, selectMyChannelClaims } from 'redux/selectors/claims';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
|
||||
export function doCommentList(uri: string) {
|
||||
export function doCommentList(uri: string, page: number = 1, pageSize: number = 99999) {
|
||||
return (dispatch: Dispatch, getState: GetState) => {
|
||||
const state = getState();
|
||||
const claim = selectClaimsByUri(state)[uri];
|
||||
|
@ -15,12 +15,15 @@ export function doCommentList(uri: string) {
|
|||
});
|
||||
Lbry.comment_list({
|
||||
claim_id: claimId,
|
||||
page,
|
||||
page_size: pageSize,
|
||||
})
|
||||
.then((results: CommentListResponse) => {
|
||||
.then((result: CommentListResponse) => {
|
||||
const { items: comments } = result;
|
||||
dispatch({
|
||||
type: ACTIONS.COMMENT_LIST_COMPLETED,
|
||||
data: {
|
||||
comments: results,
|
||||
comments,
|
||||
claimId: claimId,
|
||||
uri: uri,
|
||||
},
|
||||
|
|
|
@ -19,12 +19,15 @@ export function doFetchFileInfo(uri) {
|
|||
},
|
||||
});
|
||||
|
||||
Lbry.file_list({ outpoint, full_status: true }).then(fileInfos => {
|
||||
Lbry.file_list({ outpoint, full_status: true, page: 1, page_size: 1 }).then(result => {
|
||||
const { items: fileInfos } = result;
|
||||
const fileInfo = fileInfos[0];
|
||||
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_FILE_INFO_COMPLETED,
|
||||
data: {
|
||||
outpoint,
|
||||
fileInfo: fileInfos && fileInfos.length ? fileInfos[0] : null,
|
||||
fileInfo: fileInfo || null,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
@ -32,7 +35,7 @@ export function doFetchFileInfo(uri) {
|
|||
};
|
||||
}
|
||||
|
||||
export function doFileList() {
|
||||
export function doFileList(page: number = 1, pageSize: number = 99999) {
|
||||
return (dispatch, getState) => {
|
||||
const state = getState();
|
||||
const isFetching = selectIsFetchingFileList(state);
|
||||
|
@ -42,11 +45,12 @@ export function doFileList() {
|
|||
type: ACTIONS.FILE_LIST_STARTED,
|
||||
});
|
||||
|
||||
Lbry.file_list().then(fileInfos => {
|
||||
Lbry.file_list({ page, page_size: pageSize }).then(result => {
|
||||
const { items: fileInfos } = result;
|
||||
dispatch({
|
||||
type: ACTIONS.FILE_LIST_SUCCEEDED,
|
||||
data: {
|
||||
fileInfos,
|
||||
fileInfos: fileInfos.reverse(),
|
||||
},
|
||||
});
|
||||
});
|
||||
|
|
|
@ -145,8 +145,10 @@ export const doUploadThumbnail = (
|
|||
|
||||
const data = new FormData();
|
||||
const name = makeid();
|
||||
const file = thumbnailBlob || (thumbnail && new File([thumbnail], fileName, { type: fileType }));
|
||||
const file =
|
||||
thumbnailBlob || (thumbnail && new File([thumbnail], fileName, { type: fileType }));
|
||||
data.append('name', name);
|
||||
// $FlowFixMe
|
||||
data.append('file', file);
|
||||
|
||||
return fetch(SPEECH_PUBLISH, {
|
||||
|
@ -275,7 +277,9 @@ export const doPublish = (success: Function, fail: Function) => (
|
|||
}
|
||||
|
||||
// get the claim id from the channel name, we will use that instead
|
||||
const namedChannelClaim = myChannels ? myChannels.find(myChannel => myChannel.name === channel) : null;
|
||||
const namedChannelClaim = myChannels
|
||||
? myChannels.find(myChannel => myChannel.name === channel)
|
||||
: null;
|
||||
const channelId = namedChannelClaim ? namedChannelClaim.claim_id : '';
|
||||
|
||||
const publishPayload: {
|
||||
|
@ -336,7 +340,7 @@ export const doPublish = (success: Function, fail: Function) => (
|
|||
}
|
||||
|
||||
if (myClaimForUri && myClaimForUri.value && myClaimForUri.value.locations) {
|
||||
publishPayload.locations = myClaimForUri.value.locations;
|
||||
publishPayload.locations = myClaimForUri.value.locations;
|
||||
}
|
||||
|
||||
if (!contentIsFree && fee && (fee.currency && Number(fee.amount) > 0)) {
|
||||
|
@ -366,8 +370,9 @@ export const doCheckPendingPublishes = (onConfirmed: Function) => (
|
|||
let publishCheckInterval;
|
||||
|
||||
const checkFileList = () => {
|
||||
Lbry.claim_list().then(claims => {
|
||||
// $FlowFixMe
|
||||
Lbry.stream_list({ page: 1, page_size: 10 }).then(result => {
|
||||
const claims = result.items;
|
||||
|
||||
claims.forEach(claim => {
|
||||
// If it's confirmed, check if it was pending previously
|
||||
if (claim.confirmations > 0 && pendingById[claim.claim_id]) {
|
||||
|
|
|
@ -5,30 +5,38 @@ import { selectBalance } from 'redux/selectors/wallet';
|
|||
import { creditsToString } from 'util/format-credits';
|
||||
import { selectMyClaimsRaw } from 'redux/selectors/claims';
|
||||
|
||||
let walletBalancePromise = null;
|
||||
export function doUpdateBalance() {
|
||||
return (dispatch, getState) => {
|
||||
const {
|
||||
wallet: { totalBalance: totalInStore },
|
||||
} = getState();
|
||||
return Lbry.wallet_balance({ reserved_subtotals: true }).then(response => {
|
||||
const { available, reserved, reserved_subtotals, total } = response;
|
||||
const { claims, supports, tips } = reserved_subtotals;
|
||||
const totalFloat = parseFloat(total);
|
||||
|
||||
if (totalInStore !== totalFloat) {
|
||||
dispatch({
|
||||
type: ACTIONS.UPDATE_BALANCE,
|
||||
data: {
|
||||
totalBalance: totalFloat,
|
||||
balance: parseFloat(available),
|
||||
reservedBalance: parseFloat(reserved),
|
||||
claimsBalance: parseFloat(claims),
|
||||
supportsBalance: parseFloat(supports),
|
||||
tipsBalance: parseFloat(tips),
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
if (walletBalancePromise === null) {
|
||||
walletBalancePromise = Lbry.wallet_balance().then(response => {
|
||||
walletBalancePromise = null;
|
||||
|
||||
const { available, reserved, reserved_subtotals, total } = response;
|
||||
const { claims, supports, tips } = reserved_subtotals;
|
||||
const totalFloat = parseFloat(total);
|
||||
|
||||
if (totalInStore !== totalFloat) {
|
||||
dispatch({
|
||||
type: ACTIONS.UPDATE_BALANCE,
|
||||
data: {
|
||||
totalBalance: totalFloat,
|
||||
balance: parseFloat(available),
|
||||
reservedBalance: parseFloat(reserved),
|
||||
claimsBalance: parseFloat(claims),
|
||||
supportsBalance: parseFloat(supports),
|
||||
tipsBalance: parseFloat(tips),
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return walletBalancePromise;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -39,7 +47,7 @@ export function doBalanceSubscribe() {
|
|||
};
|
||||
}
|
||||
|
||||
export function doFetchTransactions() {
|
||||
export function doFetchTransactions(page = 1, pageSize = 99999) {
|
||||
return dispatch => {
|
||||
dispatch(doFetchSupports());
|
||||
dispatch({
|
||||
|
@ -47,29 +55,29 @@ export function doFetchTransactions() {
|
|||
});
|
||||
|
||||
Lbry.utxo_release()
|
||||
.then(() => Lbry.transaction_list())
|
||||
.then(results => {
|
||||
.then(() => Lbry.transaction_list({ page, page_size: pageSize }))
|
||||
.then(result => {
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_TRANSACTIONS_COMPLETED,
|
||||
data: {
|
||||
transactions: results,
|
||||
transactions: result.items,
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function doFetchSupports() {
|
||||
export function doFetchSupports(page = 1, pageSize = 99999) {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_SUPPORTS_STARTED,
|
||||
});
|
||||
|
||||
Lbry.support_list().then(results => {
|
||||
Lbry.support_list({ page, page_size: pageSize }).then(result => {
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_SUPPORTS_COMPLETED,
|
||||
data: {
|
||||
supports: results,
|
||||
supports: result.items,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
|
|
@ -42,8 +42,8 @@ export const commentReducer = handleActions(
|
|||
const byId = Object.assign({}, state.byId);
|
||||
const commentsByUri = Object.assign({}, state.commentsByUri);
|
||||
|
||||
if (comments['items']) {
|
||||
byId[claimId] = comments['items'];
|
||||
if (comments) {
|
||||
byId[claimId] = comments;
|
||||
commentsByUri[uri] = claimId;
|
||||
}
|
||||
return {
|
||||
|
|
|
@ -146,11 +146,7 @@ export const selectFileListDownloadedSort = createSelector(
|
|||
export const selectDownloadedUris = createSelector(
|
||||
selectFileInfosDownloaded,
|
||||
// We should use permament_url but it doesn't exist in file_list
|
||||
info =>
|
||||
info
|
||||
.slice()
|
||||
.reverse()
|
||||
.map(claim => `lbry://${claim.claim_name}#${claim.claim_id}`)
|
||||
info => info.slice().map(claim => `lbry://${claim.claim_name}#${claim.claim_id}`)
|
||||
);
|
||||
|
||||
export const makeSelectMediaTypeForUri = uri =>
|
||||
|
@ -214,9 +210,11 @@ function filterFileInfos(fileInfos, query) {
|
|||
const queryMatchRegExp = new RegExp(query, 'i');
|
||||
return fileInfos.filter(fileInfo => {
|
||||
const { metadata } = fileInfo;
|
||||
return (metadata.title && metadata.title.match(queryMatchRegExp)) ||
|
||||
return (
|
||||
(metadata.title && metadata.title.match(queryMatchRegExp)) ||
|
||||
(fileInfo.channel_name && fileInfo.channel_name.match(queryMatchRegExp)) ||
|
||||
(fileInfo.claim_name && fileInfo.claim_name.match(queryMatchRegExp));
|
||||
(fileInfo.claim_name && fileInfo.claim_name.match(queryMatchRegExp))
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -228,22 +226,25 @@ export const makeSelectSearchDownloadUrlsForPage = (query, page = 1) =>
|
|||
selectFileInfosDownloaded,
|
||||
fileInfos => {
|
||||
const matchingFileInfos = filterFileInfos(fileInfos, query);
|
||||
const start = ((Number(page) - 1) * Number(PAGE_SIZE));
|
||||
const end = (Number(page) * Number(PAGE_SIZE));
|
||||
const start = (Number(page) - 1) * Number(PAGE_SIZE);
|
||||
const end = Number(page) * Number(PAGE_SIZE);
|
||||
|
||||
return (matchingFileInfos && matchingFileInfos.length)
|
||||
return matchingFileInfos && matchingFileInfos.length
|
||||
? matchingFileInfos.slice(start, end).map(fileInfo =>
|
||||
buildURI({ streamName: fileInfo.claim_name, channelName: fileInfo.channel_name, channelClaimId: fileInfo.channel_claim_id }))
|
||||
buildURI({
|
||||
streamName: fileInfo.claim_name,
|
||||
channelName: fileInfo.channel_name,
|
||||
channelClaimId: fileInfo.channel_claim_id,
|
||||
})
|
||||
)
|
||||
: [];
|
||||
}
|
||||
);
|
||||
|
||||
export const makeSelectSearchDownloadUrlsCount = (query) =>
|
||||
export const makeSelectSearchDownloadUrlsCount = query =>
|
||||
createSelector(
|
||||
selectFileInfosDownloaded,
|
||||
fileInfos => {
|
||||
return fileInfos && fileInfos.length
|
||||
? filterFileInfos(fileInfos, query).length
|
||||
: 0;
|
||||
return fileInfos && fileInfos.length ? filterFileInfos(fileInfos, query).length : 0;
|
||||
}
|
||||
);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { createSelector } from 'reselect';
|
||||
import * as TRANSACTIONS from 'constants/transaction_types';
|
||||
import { PAGE_SIZE } from 'constants/transaction_list';
|
||||
import { PAGE_SIZE, LATEST_PAGE_SIZE } from 'constants/transaction_list';
|
||||
|
||||
export const selectState = state => state.wallet || {};
|
||||
|
||||
|
@ -300,7 +300,7 @@ export const selectFilteredTransactions = createSelector(
|
|||
}
|
||||
);
|
||||
|
||||
export const makeSelectFilteredTransactionsForPage = (page: number = 1): Array<any> =>
|
||||
export const makeSelectFilteredTransactionsForPage = (page = 1) =>
|
||||
createSelector(
|
||||
selectFilteredTransactions,
|
||||
filteredTransactions => {
|
||||
|
@ -312,6 +312,13 @@ export const makeSelectFilteredTransactionsForPage = (page: number = 1): Array<a
|
|||
}
|
||||
);
|
||||
|
||||
export const makeSelectLatestTransactions = createSelector(
|
||||
selectTransactionItems,
|
||||
transactions => {
|
||||
return transactions && transactions.length ? transactions.slice(0, LATEST_PAGE_SIZE) : [];
|
||||
}
|
||||
);
|
||||
|
||||
export const selectFilteredTransactionCount = createSelector(
|
||||
selectFilteredTransactions,
|
||||
filteredTransactions => filteredTransactions.length
|
||||
|
|
|
@ -23,7 +23,7 @@ export const isClaimNsfw = (claim: Claim): boolean => {
|
|||
return false;
|
||||
};
|
||||
|
||||
export function createNormalizedClaimSearchKey(options: { page?: number, release_time?: string }) {
|
||||
export function createNormalizedClaimSearchKey(options: { page: number, release_time?: string }) {
|
||||
// Ignore page because we don't care what the last page searched was, we want everything
|
||||
// Ignore release_time because that will change depending on when you call claim_search ex: release_time: ">12344567"
|
||||
const { page: optionToIgnoreForQuery, release_time: anotherToIgnore, ...rest } = options;
|
||||
|
@ -31,20 +31,23 @@ export function createNormalizedClaimSearchKey(options: { page?: number, release
|
|||
return query;
|
||||
}
|
||||
|
||||
export function concatClaims(claimList: Array<Claim> = [], concatClaimList: Array<any> = []): Array<Claim> {
|
||||
export function concatClaims(
|
||||
claimList: Array<Claim> = [],
|
||||
concatClaimList: Array<any> = []
|
||||
): Array<Claim> {
|
||||
if (!claimList || claimList.length === 0) {
|
||||
if (!concatClaimList) {
|
||||
return [];
|
||||
}
|
||||
return concatClaimList.slice();
|
||||
}
|
||||
|
||||
|
||||
const claims = claimList.slice();
|
||||
concatClaimList.forEach(claim => {
|
||||
if (!claims.some(item => item.claim_id === claim.claim_id)) {
|
||||
claims.push(claim);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return claims;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue