mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-22 12:51:42 +03:00
Merge branch 'wallet-improvements' of https://github.com/esteemapp/esteem-mobile into wallet-improvements
This commit is contained in:
commit
cc07e4271a
@ -37,6 +37,7 @@ const WalletContainer = ({
|
||||
setEstimatedWalletValue,
|
||||
steemPerMVests,
|
||||
isPinCodeOpen,
|
||||
currency,
|
||||
}) => {
|
||||
const [isClaiming, setIsClaiming] = useState(false);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
@ -129,7 +130,7 @@ const WalletContainer = ({
|
||||
|
||||
const _getWalletData = useCallback(
|
||||
async _selectedUser => {
|
||||
const _walletData = await groomingWalletData(_selectedUser, globalProps);
|
||||
const _walletData = await groomingWalletData(_selectedUser, globalProps, currency);
|
||||
|
||||
setWalletData(_walletData);
|
||||
setIsLoading(false);
|
||||
@ -297,6 +298,7 @@ const mapStateToProps = state => ({
|
||||
currentAccount: state.account.currentAccount,
|
||||
pinCode: state.application.pin,
|
||||
globalProps: state.account.globalProps,
|
||||
currency: state.application.currency.currency,
|
||||
steemPerMVests: state.account.globalProps.steemPerMVests,
|
||||
isPinCodeOpen: state.application.isPinCodeOpen,
|
||||
});
|
||||
|
@ -4,25 +4,23 @@ import imageApi from '../../config/imageApi';
|
||||
import serverList from '../../config/serverListApi';
|
||||
import { jsonStringify } from '../../utils/jsonUtils';
|
||||
import bugsnag from '../../config/bugsnag';
|
||||
// market-data/currency-rate/USD/estm
|
||||
|
||||
// SBD=$1 for post values
|
||||
export const getCurrencyRate = currency =>
|
||||
api
|
||||
.get(`/market-data/currency-rate/${currency.toUpperCase()}/sbd?fixed=1`)
|
||||
.get(`/market-data/currency-rate/${currency}/sbd?fixed=1`)
|
||||
.then(resp => resp.data)
|
||||
.catch(err => {
|
||||
console.log('err :', err);
|
||||
bugsnag.notify(err);
|
||||
//TODO: save currency rate of offline values
|
||||
return 1;
|
||||
});
|
||||
|
||||
export const getCurrencyTokenRate = (currency, token) =>
|
||||
api
|
||||
.get(`/market-data/currency-rate/${currency.toUpperCase()}/${token}`)
|
||||
.get(`/market-data/currency-rate/${currency}/${token}`)
|
||||
.then(resp => resp.data)
|
||||
.catch(err => {
|
||||
console.log('err :', err);
|
||||
bugsnag.notify(err);
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -423,6 +423,8 @@ export const getCurrency = async () => {
|
||||
try {
|
||||
const setting = await getItemFromStorage(SETTINGS_SCHEMA);
|
||||
if (setting) {
|
||||
console.log(setting);
|
||||
console.log('ugur');
|
||||
return setting.currency;
|
||||
}
|
||||
return false;
|
||||
|
@ -116,7 +116,7 @@ export const groomingTransactionData = (transaction, steemPerMVests, formatNumbe
|
||||
return result;
|
||||
};
|
||||
|
||||
export const groomingWalletData = async (user, globalProps) => {
|
||||
export const groomingWalletData = async (user, globalProps, userCurrency) => {
|
||||
const walletData = {};
|
||||
|
||||
if (!user) {
|
||||
@ -161,7 +161,6 @@ export const groomingWalletData = async (user, globalProps) => {
|
||||
const totalSbd = walletData.sbdBalance + walletData.savingBalanceSbd;
|
||||
|
||||
walletData.estimatedValue = totalSteem * pricePerSteem + totalSbd;
|
||||
const userCurrency = await getCurrency();
|
||||
|
||||
const ppSbd = await getCurrencyTokenRate(userCurrency, 'sbd');
|
||||
const ppSteem = await getCurrencyTokenRate(userCurrency, 'steem');
|
||||
|
Loading…
Reference in New Issue
Block a user