maint: support 0.44 SDK

maint: support 0.44 SDK
This commit is contained in:
Thomas Zarebczan 2019-11-05 13:24:41 -05:00
parent d5ffdeaec4
commit 03d53fb4dd
13 changed files with 162 additions and 56 deletions

48
dist/bundle.es.js vendored
View file

@ -775,6 +775,7 @@ const Lbry = {
stream_list: params => daemonCallWithResult('stream_list', params), stream_list: params => daemonCallWithResult('stream_list', params),
channel_abandon: params => daemonCallWithResult('channel_abandon', params), channel_abandon: params => daemonCallWithResult('channel_abandon', params),
support_create: params => daemonCallWithResult('support_create', params), support_create: params => daemonCallWithResult('support_create', params),
support_list: params => daemonCallWithResult('support_list', params),
// File fetching and manipulation // File fetching and manipulation
file_list: (params = {}) => daemonCallWithResult('file_list', params), file_list: (params = {}) => daemonCallWithResult('file_list', params),
@ -2193,7 +2194,7 @@ function doUpdateBalance() {
} = getState(); } = getState();
if (walletBalancePromise === null) { if (walletBalancePromise === null) {
walletBalancePromise = lbryProxy.wallet_balance({ reserved_subtotals: true }).then(response => { walletBalancePromise = lbryProxy.wallet_balance().then(response => {
walletBalancePromise = null; walletBalancePromise = null;
const { available, reserved, reserved_subtotals, total } = response; const { available, reserved, reserved_subtotals, total } = response;
@ -2245,17 +2246,17 @@ function doFetchTransactions(page = 1, pageSize = 99999) {
}; };
} }
function doFetchSupports() { function doFetchSupports(page = 1, pageSize = 99999) {
return dispatch => { return dispatch => {
dispatch({ dispatch({
type: FETCH_SUPPORTS_STARTED type: FETCH_SUPPORTS_STARTED
}); });
lbryProxy.support_list().then(results => { lbryProxy.support_list({ page, page_size: pageSize }).then(result => {
dispatch({ dispatch({
type: FETCH_SUPPORTS_COMPLETED, type: FETCH_SUPPORTS_COMPLETED,
data: { data: {
supports: results supports: result.items
} }
}); });
}); });
@ -2614,13 +2615,13 @@ function doResolveUri(uri) {
return doResolveUris([uri]); return doResolveUris([uri]);
} }
function doFetchClaimListMine(page = 1, pageSize = 9999) { function doFetchClaimListMine(page = 1, pageSize = 99999) {
return dispatch => { return dispatch => {
dispatch({ dispatch({
type: FETCH_CLAIM_LIST_MINE_STARTED type: FETCH_CLAIM_LIST_MINE_STARTED
}); });
lbryProxy.claim_list({ page, page_size: pageSize }).then(result => { lbryProxy.stream_list({ page, page_size: pageSize }).then(result => {
const claims = result.items; const claims = result.items;
dispatch({ dispatch({
@ -2874,7 +2875,7 @@ function doImportChannel(certificate) {
}; };
} }
function doFetchChannelListMine() { function doFetchChannelListMine(page = 1, pageSize = 99999) {
return dispatch => { return dispatch => {
dispatch({ dispatch({
type: FETCH_CHANNEL_LIST_STARTED type: FETCH_CHANNEL_LIST_STARTED
@ -2883,11 +2884,11 @@ function doFetchChannelListMine() {
const callback = channels => { const callback = channels => {
dispatch({ dispatch({
type: FETCH_CHANNEL_LIST_COMPLETED, type: FETCH_CHANNEL_LIST_COMPLETED,
data: { claims: channels } data: { claims: channels.items }
}); });
}; };
lbryProxy.channel_list().then(callback); lbryProxy.channel_list({ page, page_size: pageSize }).then(callback);
}; };
} }
@ -3210,12 +3211,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({ dispatch({
type: FETCH_FILE_INFO_COMPLETED, type: FETCH_FILE_INFO_COMPLETED,
data: { data: {
outpoint, outpoint,
fileInfo: fileInfos && fileInfos.length ? fileInfos[0] : null fileInfo: fileInfo || null
} }
}); });
}); });
@ -3223,7 +3227,7 @@ function doFetchFileInfo(uri) {
}; };
} }
function doFileList() { function doFileList(page = 1, pageSize = 99999) {
return (dispatch, getState) => { return (dispatch, getState) => {
const state = getState(); const state = getState();
const isFetching = selectIsFetchingFileList(state); const isFetching = selectIsFetchingFileList(state);
@ -3233,11 +3237,12 @@ function doFileList() {
type: FILE_LIST_STARTED type: FILE_LIST_STARTED
}); });
lbryProxy.file_list().then(fileInfos => { lbryProxy.file_list({ page, page_size: pageSize }).then(result => {
const { items: fileInfos } = result;
dispatch({ dispatch({
type: FILE_LIST_SUCCEEDED, type: FILE_LIST_SUCCEEDED,
data: { data: {
fileInfos fileInfos: fileInfos.reverse()
} }
}); });
}); });
@ -3889,7 +3894,7 @@ const doDeleteTag = name => ({
// //
function doCommentList(uri) { function doCommentList(uri, page = 1, pageSize = 99999) {
return (dispatch, getState) => { return (dispatch, getState) => {
const state = getState(); const state = getState();
const claim = selectClaimsByUri(state)[uri]; const claim = selectClaimsByUri(state)[uri];
@ -3899,12 +3904,15 @@ function doCommentList(uri) {
type: COMMENT_LIST_STARTED type: COMMENT_LIST_STARTED
}); });
lbryProxy.comment_list({ lbryProxy.comment_list({
claim_id: claimId claim_id: claimId,
}).then(results => { page,
page_size: pageSize
}).then(result => {
const { items: comments } = result;
dispatch({ dispatch({
type: COMMENT_LIST_COMPLETED, type: COMMENT_LIST_COMPLETED,
data: { data: {
comments: results, comments,
claimId: claimId, claimId: claimId,
uri: uri uri: uri
} }
@ -4387,8 +4395,8 @@ const commentReducer = handleActions({
const byId = Object.assign({}, state.byId); const byId = Object.assign({}, state.byId);
const commentsByUri = Object.assign({}, state.commentsByUri); const commentsByUri = Object.assign({}, state.commentsByUri);
if (comments['items']) { if (comments) {
byId[claimId] = comments['items']; byId[claimId] = comments;
commentsByUri[uri] = claimId; commentsByUri[uri] = claimId;
} }
return _extends$7({}, state, { return _extends$7({}, state, {

View file

@ -2,6 +2,7 @@
declare type FileListItem = { declare type FileListItem = {
metadata: StreamMetadata, metadata: StreamMetadata,
added_on: number,
blobs_completed: number, blobs_completed: number,
blobs_in_stream: number, blobs_in_stream: number,
blobs_remaining: number, blobs_remaining: number,

View file

@ -108,6 +108,10 @@ declare type ClaimSearchResponse = {
declare type ClaimListResponse = { declare type ClaimListResponse = {
items: Array<ChannelClaim | Claim>, items: Array<ChannelClaim | Claim>,
page: number,
page_size: number,
total_items: number,
total_pages: number,
}; };
declare type ChannelCreateResponse = GenericTxResponse & { declare type ChannelCreateResponse = GenericTxResponse & {
@ -119,15 +123,47 @@ declare type ChannelUpdateResponse = GenericTxResponse & {
}; };
declare type CommentCreateResponse = Comment; 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 = { items: 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<{ declare type WalletListResponse = Array<{
id: string, id: string,
@ -146,7 +182,13 @@ declare type SyncApplyResponse = {
declare type SupportAbandonResponse = GenericTxResponse; declare type SupportAbandonResponse = GenericTxResponse;
declare type StreamListResponse = { items: Array<StreamClaim> }; 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 // Types used in the generic Lbry object that is exported
@ -177,11 +219,13 @@ declare type LbryTypes = {
channel_create: (params: {}) => Promise<ChannelCreateResponse>, channel_create: (params: {}) => Promise<ChannelCreateResponse>,
channel_update: (params: {}) => Promise<ChannelUpdateResponse>, channel_update: (params: {}) => Promise<ChannelUpdateResponse>,
channel_import: (params: {}) => Promise<string>, channel_import: (params: {}) => Promise<string>,
channel_list: () => Promise<ChannelListResponse>, channel_list: (params?: {}) => Promise<ChannelListResponse>,
stream_abandon: (params: {}) => Promise<GenericTxResponse>, stream_abandon: (params: {}) => Promise<GenericTxResponse>,
stream_list: (params: {}) => Promise<StreamListResponse>, stream_list: (params: {}) => Promise<StreamListResponse>,
channel_abandon: (params: {}) => Promise<GenericTxResponse>, channel_abandon: (params: {}) => Promise<GenericTxResponse>,
support_create: (params: {}) => Promise<GenericTxResponse>, support_create: (params: {}) => Promise<GenericTxResponse>,
support_list: (params: {}) => Promise<SupportListResponse>,
support_abandon: (params: {}) => Promise<SupportAbandonResponse>,
// File fetching and manipulation // File fetching and manipulation
file_list: (params: {}) => Promise<FileListResponse>, file_list: (params: {}) => Promise<FileListResponse>,
@ -208,7 +252,6 @@ declare type LbryTypes = {
address_unused: (params: {}) => Promise<string>, // New address address_unused: (params: {}) => Promise<string>, // New address
address_list: (params: {}) => Promise<string>, address_list: (params: {}) => Promise<string>,
transaction_list: (params: {}) => Promise<TxListResponse>, transaction_list: (params: {}) => Promise<TxListResponse>,
support_abandon: (params: {}) => Promise<SupportAbandonResponse>,
// Sync // Sync
sync_hash: (params: {}) => Promise<string>, sync_hash: (params: {}) => Promise<string>,

View file

@ -19,6 +19,7 @@ declare type Support = {
is_change: string, is_change: string,
is_mine: string, is_mine: string,
name: string, name: string,
normalized_name: string,
nout: string, nout: string,
permanent_url: string, permanent_url: string,
timestamp: number, timestamp: number,

1
flow-typed/File.js vendored
View file

@ -2,6 +2,7 @@
declare type FileListItem = { declare type FileListItem = {
metadata: StreamMetadata, metadata: StreamMetadata,
added_on: number,
blobs_completed: number, blobs_completed: number,
blobs_in_stream: number, blobs_in_stream: number,
blobs_remaining: number, blobs_remaining: number,

59
flow-typed/Lbry.js vendored
View file

@ -108,6 +108,10 @@ declare type ClaimSearchResponse = {
declare type ClaimListResponse = { declare type ClaimListResponse = {
items: Array<ChannelClaim | Claim>, items: Array<ChannelClaim | Claim>,
page: number,
page_size: number,
total_items: number,
total_pages: number,
}; };
declare type ChannelCreateResponse = GenericTxResponse & { declare type ChannelCreateResponse = GenericTxResponse & {
@ -119,15 +123,47 @@ declare type ChannelUpdateResponse = GenericTxResponse & {
}; };
declare type CommentCreateResponse = Comment; 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 = { items: 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<{ declare type WalletListResponse = Array<{
id: string, id: string,
@ -146,7 +182,13 @@ declare type SyncApplyResponse = {
declare type SupportAbandonResponse = GenericTxResponse; declare type SupportAbandonResponse = GenericTxResponse;
declare type StreamListResponse = { items: Array<StreamClaim> }; 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 // Types used in the generic Lbry object that is exported
@ -177,11 +219,13 @@ declare type LbryTypes = {
channel_create: (params: {}) => Promise<ChannelCreateResponse>, channel_create: (params: {}) => Promise<ChannelCreateResponse>,
channel_update: (params: {}) => Promise<ChannelUpdateResponse>, channel_update: (params: {}) => Promise<ChannelUpdateResponse>,
channel_import: (params: {}) => Promise<string>, channel_import: (params: {}) => Promise<string>,
channel_list: () => Promise<ChannelListResponse>, channel_list: (params?: {}) => Promise<ChannelListResponse>,
stream_abandon: (params: {}) => Promise<GenericTxResponse>, stream_abandon: (params: {}) => Promise<GenericTxResponse>,
stream_list: (params: {}) => Promise<StreamListResponse>, stream_list: (params: {}) => Promise<StreamListResponse>,
channel_abandon: (params: {}) => Promise<GenericTxResponse>, channel_abandon: (params: {}) => Promise<GenericTxResponse>,
support_create: (params: {}) => Promise<GenericTxResponse>, support_create: (params: {}) => Promise<GenericTxResponse>,
support_list: (params: {}) => Promise<SupportListResponse>,
support_abandon: (params: {}) => Promise<SupportAbandonResponse>,
// File fetching and manipulation // File fetching and manipulation
file_list: (params: {}) => Promise<FileListResponse>, file_list: (params: {}) => Promise<FileListResponse>,
@ -208,7 +252,6 @@ declare type LbryTypes = {
address_unused: (params: {}) => Promise<string>, // New address address_unused: (params: {}) => Promise<string>, // New address
address_list: (params: {}) => Promise<string>, address_list: (params: {}) => Promise<string>,
transaction_list: (params: {}) => Promise<TxListResponse>, transaction_list: (params: {}) => Promise<TxListResponse>,
support_abandon: (params: {}) => Promise<SupportAbandonResponse>,
// Sync // Sync
sync_hash: (params: {}) => Promise<string>, sync_hash: (params: {}) => Promise<string>,

View file

@ -19,6 +19,7 @@ declare type Support = {
is_change: string, is_change: string,
is_mine: string, is_mine: string,
name: string, name: string,
normalized_name: string,
nout: string, nout: string,
permanent_url: string, permanent_url: string,
timestamp: number, timestamp: number,

View file

@ -85,6 +85,7 @@ const Lbry: LbryTypes = {
stream_list: params => daemonCallWithResult('stream_list', params), stream_list: params => daemonCallWithResult('stream_list', params),
channel_abandon: params => daemonCallWithResult('channel_abandon', params), channel_abandon: params => daemonCallWithResult('channel_abandon', params),
support_create: params => daemonCallWithResult('support_create', params), support_create: params => daemonCallWithResult('support_create', params),
support_list: params => daemonCallWithResult('support_list', params),
// File fetching and manipulation // File fetching and manipulation
file_list: (params = {}) => daemonCallWithResult('file_list', params), file_list: (params = {}) => daemonCallWithResult('file_list', params),

View file

@ -94,13 +94,13 @@ export function doResolveUri(uri: string) {
return doResolveUris([uri]); return doResolveUris([uri]);
} }
export function doFetchClaimListMine(page: number = 1, pageSize: number = 9999) { export function doFetchClaimListMine(page: number = 1, pageSize: number = 99999) {
return (dispatch: Dispatch) => { return (dispatch: Dispatch) => {
dispatch({ dispatch({
type: ACTIONS.FETCH_CLAIM_LIST_MINE_STARTED, type: ACTIONS.FETCH_CLAIM_LIST_MINE_STARTED,
}); });
Lbry.claim_list({ page, page_size: pageSize }).then((result: ClaimListResponse) => { Lbry.stream_list({ page, page_size: pageSize }).then((result: StreamListResponse) => {
const claims = result.items; const claims = result.items;
dispatch({ dispatch({
@ -382,20 +382,20 @@ export function doImportChannel(certificate: string) {
}; };
} }
export function doFetchChannelListMine() { export function doFetchChannelListMine(page: number = 1, pageSize: number = 99999) {
return (dispatch: Dispatch) => { return (dispatch: Dispatch) => {
dispatch({ dispatch({
type: ACTIONS.FETCH_CHANNEL_LIST_STARTED, type: ACTIONS.FETCH_CHANNEL_LIST_STARTED,
}); });
const callback = (channels: Array<ChannelClaim>) => { const callback = (channels: ChannelListResponse) => {
dispatch({ dispatch({
type: ACTIONS.FETCH_CHANNEL_LIST_COMPLETED, type: ACTIONS.FETCH_CHANNEL_LIST_COMPLETED,
data: { claims: channels }, data: { claims: channels.items },
}); });
}; };
Lbry.channel_list().then(callback); Lbry.channel_list({ page, page_size: pageSize }).then(callback);
}; };
} }

View file

@ -4,7 +4,7 @@ import Lbry from 'lbry';
import { selectClaimsByUri, selectMyChannelClaims } from 'redux/selectors/claims'; import { selectClaimsByUri, selectMyChannelClaims } from 'redux/selectors/claims';
import { doToast } from 'redux/actions/notifications'; 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) => { return (dispatch: Dispatch, getState: GetState) => {
const state = getState(); const state = getState();
const claim = selectClaimsByUri(state)[uri]; const claim = selectClaimsByUri(state)[uri];
@ -15,12 +15,15 @@ export function doCommentList(uri: string) {
}); });
Lbry.comment_list({ Lbry.comment_list({
claim_id: claimId, claim_id: claimId,
page,
page_size: pageSize,
}) })
.then((results: CommentListResponse) => { .then((result: CommentListResponse) => {
const { items: comments } = result;
dispatch({ dispatch({
type: ACTIONS.COMMENT_LIST_COMPLETED, type: ACTIONS.COMMENT_LIST_COMPLETED,
data: { data: {
comments: results, comments,
claimId: claimId, claimId: claimId,
uri: uri, uri: uri,
}, },

View file

@ -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({ dispatch({
type: ACTIONS.FETCH_FILE_INFO_COMPLETED, type: ACTIONS.FETCH_FILE_INFO_COMPLETED,
data: { data: {
outpoint, 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) => { return (dispatch, getState) => {
const state = getState(); const state = getState();
const isFetching = selectIsFetchingFileList(state); const isFetching = selectIsFetchingFileList(state);
@ -42,11 +45,12 @@ export function doFileList() {
type: ACTIONS.FILE_LIST_STARTED, type: ACTIONS.FILE_LIST_STARTED,
}); });
Lbry.file_list().then(fileInfos => { Lbry.file_list({ page, page_size: pageSize }).then(result => {
const { items: fileInfos } = result;
dispatch({ dispatch({
type: ACTIONS.FILE_LIST_SUCCEEDED, type: ACTIONS.FILE_LIST_SUCCEEDED,
data: { data: {
fileInfos, fileInfos: fileInfos.reverse(),
}, },
}); });
}); });

View file

@ -13,7 +13,7 @@ export function doUpdateBalance() {
} = getState(); } = getState();
if (walletBalancePromise === null) { if (walletBalancePromise === null) {
walletBalancePromise = Lbry.wallet_balance({ reserved_subtotals: true }).then(response => { walletBalancePromise = Lbry.wallet_balance().then(response => {
walletBalancePromise = null; walletBalancePromise = null;
const { available, reserved, reserved_subtotals, total } = response; const { available, reserved, reserved_subtotals, total } = response;
@ -67,17 +67,17 @@ export function doFetchTransactions(page = 1, pageSize = 99999) {
}; };
} }
export function doFetchSupports() { export function doFetchSupports(page = 1, pageSize = 99999) {
return dispatch => { return dispatch => {
dispatch({ dispatch({
type: ACTIONS.FETCH_SUPPORTS_STARTED, type: ACTIONS.FETCH_SUPPORTS_STARTED,
}); });
Lbry.support_list().then(results => { Lbry.support_list({ page, page_size: pageSize }).then(result => {
dispatch({ dispatch({
type: ACTIONS.FETCH_SUPPORTS_COMPLETED, type: ACTIONS.FETCH_SUPPORTS_COMPLETED,
data: { data: {
supports: results, supports: result.items,
}, },
}); });
}); });

View file

@ -42,8 +42,8 @@ export const commentReducer = handleActions(
const byId = Object.assign({}, state.byId); const byId = Object.assign({}, state.byId);
const commentsByUri = Object.assign({}, state.commentsByUri); const commentsByUri = Object.assign({}, state.commentsByUri);
if (comments['items']) { if (comments) {
byId[claimId] = comments['items']; byId[claimId] = comments;
commentsByUri[uri] = claimId; commentsByUri[uri] = claimId;
} }
return { return {