Merge pull request #180 from lbryio/account_balance_039_fix
feat: 0.39 account balance basic API support
This commit is contained in:
commit
f4413a8ab4
5 changed files with 32 additions and 5 deletions
7
dist/bundle.es.js
vendored
7
dist/bundle.es.js
vendored
|
@ -741,7 +741,7 @@ const Lbry = {
|
||||||
blob_list: (params = {}) => daemonCallWithResult('blob_list', params),
|
blob_list: (params = {}) => daemonCallWithResult('blob_list', params),
|
||||||
|
|
||||||
// Wallet utilities
|
// Wallet utilities
|
||||||
account_balance: (params = {}) => daemonCallWithResult('account_balance', params),
|
account_balance: () => daemonCallWithResult('account_balance'),
|
||||||
account_decrypt: () => daemonCallWithResult('account_decrypt', {}),
|
account_decrypt: () => daemonCallWithResult('account_decrypt', {}),
|
||||||
account_encrypt: (params = {}) => daemonCallWithResult('account_encrypt', params),
|
account_encrypt: (params = {}) => daemonCallWithResult('account_encrypt', params),
|
||||||
account_unlock: (params = {}) => daemonCallWithResult('account_unlock', params),
|
account_unlock: (params = {}) => daemonCallWithResult('account_unlock', params),
|
||||||
|
@ -1777,12 +1777,15 @@ function creditsToString(amount) {
|
||||||
return creditString;
|
return creditString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
function doUpdateBalance() {
|
function doUpdateBalance() {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
const {
|
const {
|
||||||
wallet: { balance: balanceInStore }
|
wallet: { balance: balanceInStore }
|
||||||
} = getState();
|
} = getState();
|
||||||
lbryProxy.account_balance().then(({ available }) => {
|
lbryProxy.account_balance().then(response => {
|
||||||
|
const { available } = response;
|
||||||
const balance = parseFloat(available);
|
const balance = parseFloat(available);
|
||||||
if (balanceInStore !== balance) {
|
if (balanceInStore !== balance) {
|
||||||
dispatch({
|
dispatch({
|
||||||
|
|
11
dist/flow-typed/Lbry.js
vendored
11
dist/flow-typed/Lbry.js
vendored
|
@ -63,6 +63,17 @@ declare type VersionResponse = {
|
||||||
python_version: string,
|
python_version: string,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
declare type BalanceResponse = {
|
||||||
|
available: string,
|
||||||
|
reserved: string,
|
||||||
|
reserved_subtotals: ? {
|
||||||
|
claims: string,
|
||||||
|
supports: string,
|
||||||
|
tips: string,
|
||||||
|
},
|
||||||
|
total: string,
|
||||||
|
};
|
||||||
|
|
||||||
declare type ResolveResponse = {
|
declare type ResolveResponse = {
|
||||||
// Keys are the url(s) passed to resolve
|
// Keys are the url(s) passed to resolve
|
||||||
[string]: Claim | { error?: {} },
|
[string]: Claim | { error?: {} },
|
||||||
|
|
13
flow-typed/Lbry.js
vendored
13
flow-typed/Lbry.js
vendored
|
@ -63,6 +63,17 @@ declare type VersionResponse = {
|
||||||
python_version: string,
|
python_version: string,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
declare type BalanceResponse = {
|
||||||
|
available: string,
|
||||||
|
reserved: string,
|
||||||
|
reserved_subtotals: ?{
|
||||||
|
claims: string,
|
||||||
|
supports: string,
|
||||||
|
tips: string,
|
||||||
|
},
|
||||||
|
total: string,
|
||||||
|
};
|
||||||
|
|
||||||
declare type ResolveResponse = {
|
declare type ResolveResponse = {
|
||||||
// Keys are the url(s) passed to resolve
|
// Keys are the url(s) passed to resolve
|
||||||
[string]: Claim | { error?: {} },
|
[string]: Claim | { error?: {} },
|
||||||
|
@ -194,7 +205,7 @@ declare type LbryTypes = {
|
||||||
comment_list: (params: {}) => Promise<CommentListResponse>,
|
comment_list: (params: {}) => Promise<CommentListResponse>,
|
||||||
comment_create: (params: {}) => Promise<CommentCreateResponse>,
|
comment_create: (params: {}) => Promise<CommentCreateResponse>,
|
||||||
// Wallet utilities
|
// Wallet utilities
|
||||||
account_balance: (params: {}) => Promise<string>,
|
account_balance: (params: {}) => Promise<BalanceResponse>,
|
||||||
account_decrypt: (prams: {}) => Promise<boolean>,
|
account_decrypt: (prams: {}) => Promise<boolean>,
|
||||||
account_encrypt: (params: {}) => Promise<boolean>,
|
account_encrypt: (params: {}) => Promise<boolean>,
|
||||||
account_unlock: (params: {}) => Promise<boolean>,
|
account_unlock: (params: {}) => Promise<boolean>,
|
||||||
|
|
|
@ -90,7 +90,7 @@ const Lbry: LbryTypes = {
|
||||||
blob_list: (params = {}) => daemonCallWithResult('blob_list', params),
|
blob_list: (params = {}) => daemonCallWithResult('blob_list', params),
|
||||||
|
|
||||||
// Wallet utilities
|
// Wallet utilities
|
||||||
account_balance: (params = {}) => daemonCallWithResult('account_balance', params),
|
account_balance: () => daemonCallWithResult('account_balance'),
|
||||||
account_decrypt: () => daemonCallWithResult('account_decrypt', {}),
|
account_decrypt: () => daemonCallWithResult('account_decrypt', {}),
|
||||||
account_encrypt: (params = {}) => daemonCallWithResult('account_encrypt', params),
|
account_encrypt: (params = {}) => daemonCallWithResult('account_encrypt', params),
|
||||||
account_unlock: (params = {}) => daemonCallWithResult('account_unlock', params),
|
account_unlock: (params = {}) => daemonCallWithResult('account_unlock', params),
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// @flow
|
||||||
import * as ACTIONS from 'constants/action_types';
|
import * as ACTIONS from 'constants/action_types';
|
||||||
import Lbry from 'lbry';
|
import Lbry from 'lbry';
|
||||||
import { doToast } from 'redux/actions/notifications';
|
import { doToast } from 'redux/actions/notifications';
|
||||||
|
@ -10,7 +11,8 @@ export function doUpdateBalance() {
|
||||||
const {
|
const {
|
||||||
wallet: { balance: balanceInStore },
|
wallet: { balance: balanceInStore },
|
||||||
} = getState();
|
} = getState();
|
||||||
Lbry.account_balance().then(({ available }) => {
|
Lbry.account_balance().then((response: BalanceResponse) => {
|
||||||
|
const { available } = response;
|
||||||
const balance = parseFloat(available);
|
const balance = parseFloat(available);
|
||||||
if (balanceInStore !== balance) {
|
if (balanceInStore !== balance) {
|
||||||
dispatch({
|
dispatch({
|
||||||
|
|
Loading…
Reference in a new issue