2019-04-23 19:22:14 +02:00
|
|
|
// @flow
|
|
|
|
declare type StatusResponse = {
|
|
|
|
blob_manager: {
|
|
|
|
finished_blobs: number,
|
|
|
|
},
|
|
|
|
blockchain_headers: {
|
|
|
|
download_progress: number,
|
|
|
|
downloading_headers: boolean,
|
|
|
|
},
|
|
|
|
dht: {
|
|
|
|
node_id: string,
|
|
|
|
peers_in_routing_table: number,
|
|
|
|
},
|
|
|
|
hash_announcer: {
|
|
|
|
announce_queue_size: number,
|
|
|
|
},
|
|
|
|
installation_id: string,
|
|
|
|
is_running: boolean,
|
|
|
|
skipped_components: Array<string>,
|
|
|
|
startup_status: {
|
|
|
|
blob_manager: boolean,
|
|
|
|
blockchain_headers: boolean,
|
|
|
|
database: boolean,
|
|
|
|
dht: boolean,
|
|
|
|
exchange_rate_manager: boolean,
|
|
|
|
hash_announcer: boolean,
|
|
|
|
peer_protocol_server: boolean,
|
|
|
|
stream_manager: boolean,
|
|
|
|
upnp: boolean,
|
|
|
|
wallet: boolean,
|
|
|
|
},
|
|
|
|
stream_manager: {
|
|
|
|
managed_files: number,
|
|
|
|
},
|
|
|
|
upnp: {
|
|
|
|
aioupnp_version: string,
|
|
|
|
dht_redirect_set: boolean,
|
|
|
|
external_ip: string,
|
|
|
|
gateway: string,
|
|
|
|
peer_redirect_set: boolean,
|
|
|
|
redirects: {},
|
|
|
|
},
|
|
|
|
wallet: ?{
|
2021-03-15 20:40:55 +01:00
|
|
|
connected: string,
|
2019-04-23 19:22:14 +02:00
|
|
|
best_blockhash: string,
|
|
|
|
blocks: number,
|
|
|
|
blocks_behind: number,
|
|
|
|
is_encrypted: boolean,
|
|
|
|
is_locked: boolean,
|
2019-12-13 20:47:16 +01:00
|
|
|
headers_synchronization_progress: number,
|
|
|
|
available_servers: number,
|
2019-04-23 19:22:14 +02:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
declare type VersionResponse = {
|
|
|
|
build: string,
|
|
|
|
lbrynet_version: string,
|
|
|
|
os_release: string,
|
|
|
|
os_system: string,
|
|
|
|
platform: string,
|
|
|
|
processor: string,
|
|
|
|
python_version: string,
|
|
|
|
};
|
|
|
|
|
2019-08-13 20:40:55 +02:00
|
|
|
declare type BalanceResponse = {
|
|
|
|
available: string,
|
|
|
|
reserved: string,
|
|
|
|
reserved_subtotals: ?{
|
|
|
|
claims: string,
|
|
|
|
supports: string,
|
|
|
|
tips: string,
|
|
|
|
},
|
|
|
|
total: string,
|
|
|
|
};
|
|
|
|
|
2019-04-23 19:22:14 +02:00
|
|
|
declare type ResolveResponse = {
|
|
|
|
// Keys are the url(s) passed to resolve
|
2019-08-20 22:00:26 +02:00
|
|
|
[string]: { error?: {}, stream?: StreamClaim, channel?: ChannelClaim, claimsInChannel?: number },
|
2019-04-23 19:22:14 +02:00
|
|
|
};
|
|
|
|
|
2019-08-02 08:21:28 +02:00
|
|
|
declare type GetResponse = FileListItem & { error?: string };
|
2019-04-23 19:22:14 +02:00
|
|
|
|
|
|
|
declare type GenericTxResponse = {
|
|
|
|
height: number,
|
|
|
|
hex: string,
|
|
|
|
inputs: Array<{}>,
|
|
|
|
outputs: Array<{}>,
|
|
|
|
total_fee: string,
|
|
|
|
total_input: string,
|
|
|
|
total_output: string,
|
|
|
|
txid: string,
|
|
|
|
};
|
|
|
|
|
|
|
|
declare type PublishResponse = GenericTxResponse & {
|
|
|
|
// Only first value in outputs is a claim
|
|
|
|
// That's the only value we care about
|
2019-06-06 23:37:36 +02:00
|
|
|
outputs: Array<Claim>,
|
2019-04-23 19:22:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
declare type ClaimSearchResponse = {
|
2019-06-06 23:37:36 +02:00
|
|
|
items: Array<Claim>,
|
2019-04-23 19:22:14 +02:00
|
|
|
page: number,
|
|
|
|
page_size: number,
|
2019-06-06 23:37:36 +02:00
|
|
|
total_items: number,
|
|
|
|
total_pages: number,
|
2019-04-23 19:22:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
declare type ClaimListResponse = {
|
2019-11-01 20:08:42 +01:00
|
|
|
items: Array<ChannelClaim | Claim>,
|
2019-11-05 19:24:41 +01:00
|
|
|
page: number,
|
|
|
|
page_size: number,
|
|
|
|
total_items: number,
|
|
|
|
total_pages: number,
|
2019-04-23 19:22:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
declare type ChannelCreateResponse = GenericTxResponse & {
|
|
|
|
outputs: Array<ChannelClaim>,
|
|
|
|
};
|
|
|
|
|
2019-07-02 19:47:42 +02:00
|
|
|
declare type ChannelUpdateResponse = GenericTxResponse & {
|
|
|
|
outputs: Array<ChannelClaim>,
|
|
|
|
};
|
|
|
|
|
2019-06-12 03:14:37 +02:00
|
|
|
declare type CommentCreateResponse = Comment;
|
2020-01-13 22:52:23 +01:00
|
|
|
declare type CommentUpdateResponse = Comment;
|
2020-01-09 23:09:37 +01:00
|
|
|
|
2019-11-05 19:24:41 +01:00
|
|
|
declare type CommentListResponse = {
|
|
|
|
items: Array<Comment>,
|
|
|
|
page: number,
|
|
|
|
page_size: number,
|
|
|
|
total_items: number,
|
|
|
|
total_pages: number,
|
|
|
|
};
|
2019-06-12 03:14:37 +02:00
|
|
|
|
2020-09-28 23:54:33 +02:00
|
|
|
declare type MyReactions = {
|
|
|
|
// Keys are the commentId
|
2021-02-11 16:04:52 +01:00
|
|
|
[string]: Array<string>,
|
|
|
|
};
|
2020-09-28 23:54:33 +02:00
|
|
|
|
|
|
|
declare type OthersReactions = {
|
|
|
|
// Keys are the commentId
|
|
|
|
[string]: {
|
|
|
|
// Keys are the reaction_type, e.g. 'like'
|
|
|
|
[string]: number,
|
|
|
|
},
|
2021-02-11 16:04:52 +01:00
|
|
|
};
|
2020-09-28 23:54:33 +02:00
|
|
|
|
|
|
|
declare type CommentReactListResponse = {
|
|
|
|
my_reactions: Array<MyReactions>,
|
|
|
|
others_reactions: Array<OthersReactions>,
|
2021-02-11 16:04:52 +01:00
|
|
|
};
|
2020-09-28 23:54:33 +02:00
|
|
|
|
2020-01-09 23:09:37 +01:00
|
|
|
declare type CommentHideResponse = {
|
|
|
|
// keyed by the CommentIds entered
|
|
|
|
[string]: { hidden: boolean },
|
|
|
|
};
|
|
|
|
|
2020-10-14 20:07:00 +02:00
|
|
|
declare type CommentPinResponse = {
|
|
|
|
// keyed by the CommentIds entered
|
|
|
|
items: Comment,
|
|
|
|
};
|
|
|
|
|
2020-01-09 23:09:37 +01:00
|
|
|
declare type CommentAbandonResponse = {
|
|
|
|
// keyed by the CommentId given
|
2020-01-21 06:46:14 +01:00
|
|
|
abandoned: boolean,
|
2020-01-09 23:09:37 +01:00
|
|
|
};
|
|
|
|
|
2019-11-05 19:24:41 +01:00
|
|
|
declare type ChannelListResponse = {
|
|
|
|
items: Array<ChannelClaim>,
|
|
|
|
page: number,
|
|
|
|
page_size: number,
|
|
|
|
total_items: number,
|
|
|
|
total_pages: number,
|
|
|
|
};
|
2019-04-23 19:22:14 +02:00
|
|
|
|
2021-02-11 16:04:52 +01:00
|
|
|
declare type ChannelSignResponse = {
|
|
|
|
signature: string,
|
|
|
|
signing_ts: string,
|
|
|
|
};
|
|
|
|
|
2019-11-05 19:24:41 +01:00
|
|
|
declare type FileListResponse = {
|
|
|
|
items: Array<FileListItem>,
|
|
|
|
page: number,
|
|
|
|
page_size: number,
|
|
|
|
total_items: number,
|
|
|
|
total_pages: number,
|
|
|
|
};
|
2019-04-23 19:22:14 +02:00
|
|
|
|
2019-11-05 19:24:41 +01:00
|
|
|
declare type TxListResponse = {
|
|
|
|
items: Array<Transaction>,
|
|
|
|
page: number,
|
|
|
|
page_size: number,
|
|
|
|
total_items: number,
|
|
|
|
total_pages: number,
|
|
|
|
};
|
|
|
|
|
|
|
|
declare type SupportListResponse = {
|
|
|
|
items: Array<Support>,
|
|
|
|
page: number,
|
|
|
|
page_size: number,
|
|
|
|
total_items: number,
|
|
|
|
total_pages: number,
|
|
|
|
};
|
2019-04-23 19:22:14 +02:00
|
|
|
|
2019-11-05 19:24:41 +01:00
|
|
|
declare type BlobListResponse = { items: Array<string> };
|
2019-04-23 19:22:14 +02:00
|
|
|
|
2019-10-16 00:11:03 +02:00
|
|
|
declare type WalletListResponse = Array<{
|
2019-04-23 19:22:14 +02:00
|
|
|
id: string,
|
|
|
|
name: string,
|
|
|
|
}>;
|
|
|
|
|
2019-10-16 00:11:03 +02:00
|
|
|
declare type WalletStatusResponse = {
|
|
|
|
is_encrypted: boolean,
|
|
|
|
is_locked: boolean,
|
2020-03-31 18:33:08 +02:00
|
|
|
is_syncing: boolean,
|
2019-10-16 00:11:03 +02:00
|
|
|
};
|
|
|
|
|
2019-04-24 08:10:55 +02:00
|
|
|
declare type SyncApplyResponse = {
|
|
|
|
hash: string,
|
|
|
|
data: string,
|
|
|
|
};
|
|
|
|
|
2019-05-10 07:02:03 +02:00
|
|
|
declare type SupportAbandonResponse = GenericTxResponse;
|
|
|
|
|
2019-11-05 19:24:41 +01:00
|
|
|
declare type StreamListResponse = {
|
|
|
|
items: Array<StreamClaim>,
|
|
|
|
page: number,
|
|
|
|
page_size: number,
|
|
|
|
total_items: number,
|
|
|
|
total_pages: number,
|
|
|
|
};
|
2019-11-01 20:08:42 +01:00
|
|
|
|
2020-02-10 16:49:45 +01:00
|
|
|
declare type StreamRepostOptions = {
|
|
|
|
name: string,
|
|
|
|
bid: string,
|
|
|
|
claim_id: string,
|
2020-12-04 16:10:17 +01:00
|
|
|
channel_id?: string,
|
2020-02-10 16:49:45 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
declare type StreamRepostResponse = GenericTxResponse;
|
|
|
|
|
2020-05-08 22:47:33 +02:00
|
|
|
declare type PurchaseListResponse = {
|
|
|
|
items: Array<PurchaseReceipt & { claim: StreamClaim }>,
|
|
|
|
page: number,
|
|
|
|
page_size: number,
|
|
|
|
total_items: number,
|
|
|
|
total_pages: number,
|
|
|
|
};
|
|
|
|
|
|
|
|
declare type PurchaseListOptions = {
|
|
|
|
page: number,
|
|
|
|
page_size: number,
|
|
|
|
resolve: boolean,
|
|
|
|
claim_id?: string,
|
|
|
|
channel_id?: string,
|
|
|
|
};
|
|
|
|
|
2019-04-23 19:22:14 +02:00
|
|
|
//
|
|
|
|
// Types used in the generic Lbry object that is exported
|
|
|
|
//
|
|
|
|
declare type LbryTypes = {
|
|
|
|
isConnected: boolean,
|
|
|
|
connectPromise: ?Promise<any>,
|
|
|
|
connect: () => void,
|
|
|
|
daemonConnectionString: string,
|
2020-03-18 18:11:03 +01:00
|
|
|
alternateConnectionString: string,
|
|
|
|
methodsUsingAlternateConnectionString: Array<string>,
|
2019-07-02 19:47:42 +02:00
|
|
|
apiRequestHeaders: { [key: string]: string },
|
2019-04-23 19:22:14 +02:00
|
|
|
setDaemonConnectionString: string => void,
|
2019-05-30 17:24:46 +02:00
|
|
|
setApiHeader: (string, string) => void,
|
2019-07-02 19:47:42 +02:00
|
|
|
unsetApiHeader: string => void,
|
2019-04-23 19:22:14 +02:00
|
|
|
overrides: { [string]: ?Function },
|
|
|
|
setOverride: (string, Function) => void,
|
|
|
|
getMediaType: (string, ?string) => string,
|
|
|
|
|
|
|
|
// Lbry Methods
|
|
|
|
stop: () => Promise<string>,
|
|
|
|
status: () => Promise<StatusResponse>,
|
|
|
|
version: () => Promise<VersionResponse>,
|
|
|
|
resolve: (params: {}) => Promise<ResolveResponse>,
|
|
|
|
get: (params: {}) => Promise<GetResponse>,
|
2019-11-01 20:08:42 +01:00
|
|
|
publish: (params: {}) => Promise<PublishResponse>,
|
2019-04-23 19:22:14 +02:00
|
|
|
|
|
|
|
claim_search: (params: {}) => Promise<ClaimSearchResponse>,
|
2019-11-05 19:52:17 +01:00
|
|
|
claim_list: (params: {}) => Promise<ClaimListResponse>,
|
2019-04-23 19:22:14 +02:00
|
|
|
channel_create: (params: {}) => Promise<ChannelCreateResponse>,
|
2019-07-02 19:47:42 +02:00
|
|
|
channel_update: (params: {}) => Promise<ChannelUpdateResponse>,
|
2019-09-12 21:06:49 +02:00
|
|
|
channel_import: (params: {}) => Promise<string>,
|
2019-11-05 19:52:17 +01:00
|
|
|
channel_list: (params: {}) => Promise<ChannelListResponse>,
|
2021-02-11 16:04:52 +01:00
|
|
|
channel_sign: (params: {}) => Promise<ChannelSignResponse>,
|
2019-04-23 19:22:14 +02:00
|
|
|
stream_abandon: (params: {}) => Promise<GenericTxResponse>,
|
2019-11-01 20:08:42 +01:00
|
|
|
stream_list: (params: {}) => Promise<StreamListResponse>,
|
2019-04-23 19:22:14 +02:00
|
|
|
channel_abandon: (params: {}) => Promise<GenericTxResponse>,
|
|
|
|
support_create: (params: {}) => Promise<GenericTxResponse>,
|
2019-11-05 19:24:41 +01:00
|
|
|
support_list: (params: {}) => Promise<SupportListResponse>,
|
|
|
|
support_abandon: (params: {}) => Promise<SupportAbandonResponse>,
|
2020-02-10 16:49:45 +01:00
|
|
|
stream_repost: (params: StreamRepostOptions) => Promise<StreamRepostResponse>,
|
2020-05-08 22:47:33 +02:00
|
|
|
purchase_list: (params: PurchaseListOptions) => Promise<PurchaseListResponse>,
|
2019-04-23 19:22:14 +02:00
|
|
|
|
|
|
|
// File fetching and manipulation
|
|
|
|
file_list: (params: {}) => Promise<FileListResponse>,
|
|
|
|
file_delete: (params: {}) => Promise<boolean>,
|
|
|
|
blob_delete: (params: {}) => Promise<string>,
|
|
|
|
blob_list: (params: {}) => Promise<BlobListResponse>,
|
|
|
|
|
2019-09-30 23:52:41 +02:00
|
|
|
// Preferences
|
|
|
|
preference_get: (params: {}) => Promise<any>,
|
|
|
|
preference_set: (params: {}) => Promise<any>,
|
|
|
|
|
2019-06-12 03:14:37 +02:00
|
|
|
// Commenting
|
|
|
|
comment_list: (params: {}) => Promise<CommentListResponse>,
|
|
|
|
comment_create: (params: {}) => Promise<CommentCreateResponse>,
|
2020-01-13 23:00:04 +01:00
|
|
|
comment_update: (params: {}) => Promise<CommentUpdateResponse>,
|
|
|
|
comment_hide: (params: {}) => Promise<CommentHideResponse>,
|
|
|
|
comment_abandon: (params: {}) => Promise<CommentAbandonResponse>,
|
|
|
|
|
2019-04-23 19:22:14 +02:00
|
|
|
// Wallet utilities
|
2019-10-15 05:35:38 +02:00
|
|
|
wallet_balance: (params: {}) => Promise<BalanceResponse>,
|
2019-10-16 00:11:03 +02:00
|
|
|
wallet_decrypt: (prams: {}) => Promise<boolean>,
|
|
|
|
wallet_encrypt: (params: {}) => Promise<boolean>,
|
|
|
|
wallet_unlock: (params: {}) => Promise<boolean>,
|
|
|
|
wallet_list: (params: {}) => Promise<WalletListResponse>,
|
2019-10-15 05:35:38 +02:00
|
|
|
wallet_send: (params: {}) => Promise<GenericTxResponse>,
|
2019-10-16 00:11:03 +02:00
|
|
|
wallet_status: (params: {}) => Promise<WalletStatusResponse>,
|
2019-04-23 19:22:14 +02:00
|
|
|
address_is_mine: (params: {}) => Promise<boolean>,
|
|
|
|
address_unused: (params: {}) => Promise<string>, // New address
|
2019-09-17 19:48:41 +02:00
|
|
|
address_list: (params: {}) => Promise<string>,
|
2019-04-23 19:22:14 +02:00
|
|
|
transaction_list: (params: {}) => Promise<TxListResponse>,
|
2019-04-24 08:10:55 +02:00
|
|
|
|
|
|
|
// Sync
|
|
|
|
sync_hash: (params: {}) => Promise<string>,
|
|
|
|
sync_apply: (params: {}) => Promise<SyncApplyResponse>,
|
|
|
|
|
2019-04-23 19:22:14 +02:00
|
|
|
// The app shouldn't need to do this
|
|
|
|
utxo_release: () => Promise<any>,
|
|
|
|
};
|