diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 6ae34e2..2edcc0e 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -741,7 +741,7 @@ const Lbry = { blob_list: (params = {}) => daemonCallWithResult('blob_list', params), // Wallet utilities - account_balance: (params = {}) => daemonCallWithResult('account_balance', params), + account_balance: () => daemonCallWithResult('account_balance'), account_decrypt: () => daemonCallWithResult('account_decrypt', {}), account_encrypt: (params = {}) => daemonCallWithResult('account_encrypt', params), account_unlock: (params = {}) => daemonCallWithResult('account_unlock', params), @@ -1777,12 +1777,15 @@ function creditsToString(amount) { return creditString; } +// + function doUpdateBalance() { return (dispatch, getState) => { const { wallet: { balance: balanceInStore } } = getState(); - lbryProxy.account_balance().then(({ available }) => { + lbryProxy.account_balance().then(response => { + const { available } = response; const balance = parseFloat(available); if (balanceInStore !== balance) { dispatch({ diff --git a/dist/flow-typed/Lbry.js b/dist/flow-typed/Lbry.js index a403ffb..6f32b2b 100644 --- a/dist/flow-typed/Lbry.js +++ b/dist/flow-typed/Lbry.js @@ -63,6 +63,17 @@ declare type VersionResponse = { python_version: string, }; +declare type BalanceResponse = { + available: string, + reserved: string, + reserved_subtotals: ? { + claims: string, + supports: string, + tips: string, + }, + total: string, +}; + declare type ResolveResponse = { // Keys are the url(s) passed to resolve [string]: Claim | { error?: {} }, diff --git a/flow-typed/Lbry.js b/flow-typed/Lbry.js index a403ffb..d9f1a7a 100644 --- a/flow-typed/Lbry.js +++ b/flow-typed/Lbry.js @@ -63,6 +63,17 @@ declare type VersionResponse = { python_version: string, }; +declare type BalanceResponse = { + available: string, + reserved: string, + reserved_subtotals: ?{ + claims: string, + supports: string, + tips: string, + }, + total: string, +}; + declare type ResolveResponse = { // Keys are the url(s) passed to resolve [string]: Claim | { error?: {} }, @@ -194,7 +205,7 @@ declare type LbryTypes = { comment_list: (params: {}) => Promise, comment_create: (params: {}) => Promise, // Wallet utilities - account_balance: (params: {}) => Promise, + account_balance: (params: {}) => Promise, account_decrypt: (prams: {}) => Promise, account_encrypt: (params: {}) => Promise, account_unlock: (params: {}) => Promise, diff --git a/src/lbry.js b/src/lbry.js index 6313063..44b57cd 100644 --- a/src/lbry.js +++ b/src/lbry.js @@ -90,7 +90,7 @@ const Lbry: LbryTypes = { blob_list: (params = {}) => daemonCallWithResult('blob_list', params), // Wallet utilities - account_balance: (params = {}) => daemonCallWithResult('account_balance', params), + account_balance: () => daemonCallWithResult('account_balance'), account_decrypt: () => daemonCallWithResult('account_decrypt', {}), account_encrypt: (params = {}) => daemonCallWithResult('account_encrypt', params), account_unlock: (params = {}) => daemonCallWithResult('account_unlock', params), diff --git a/src/redux/actions/wallet.js b/src/redux/actions/wallet.js index 8757422..55f0751 100644 --- a/src/redux/actions/wallet.js +++ b/src/redux/actions/wallet.js @@ -1,3 +1,4 @@ +// @flow import * as ACTIONS from 'constants/action_types'; import Lbry from 'lbry'; import { doToast } from 'redux/actions/notifications'; @@ -10,7 +11,8 @@ export function doUpdateBalance() { const { wallet: { balance: balanceInStore }, } = getState(); - Lbry.account_balance().then(({ available }) => { + Lbry.account_balance().then((response: BalanceResponse) => { + const { available } = response; const balance = parseFloat(available); if (balanceInStore !== balance) { dispatch({