add get estm for steem and sbd

This commit is contained in:
feruz 2020-02-13 14:15:06 +02:00
parent 59cbe2341b
commit c54c3c661e
6 changed files with 36 additions and 11 deletions

View File

@ -11,8 +11,8 @@ import { vestsToSp } from '../../../utils/conversions';
import styles from './walletDetailsStyles';
const WalletDetailsView = ({ walletData, intl, navigate, isShowDropdowns }) => {
const steemDropdown = ['transfer_token', 'transfer_to_saving', 'powerUp'];
const sbdDropdown = ['transfer_token', 'transfer_to_saving'];
const steemDropdown = ['purchase_estm', 'transfer_token', 'transfer_to_saving', 'powerUp'];
const sbdDropdown = ['purchase_estm', 'transfer_token', 'transfer_to_saving'];
const savingSteemDropdown = ['withdraw_steem'];
const savingSbdDropdown = ['withdraw_sbd'];
const steemPowerDropdown = ['delegate', 'power_down'];

View File

@ -59,6 +59,7 @@
"to_placeholder": "Username",
"memo_placeholder": "Enter your notes here",
"transfer_token": "Transfer",
"purchase_estm": "GET ESTM",
"points": "Gift ESTM to someone",
"transfer_to_saving": "To Saving",
"powerUp": "Power Up",
@ -412,6 +413,7 @@
"to_placeholder": "Username",
"memo_placeholder": "Enter your notes here",
"transfer_token": "Transfer",
"purchase_estm": "Purchase ESTM",
"points": "Gift ESTM to someone",
"transfer_to_saving": "Transfer To Saving",
"powerUp": "Power Up",

View File

@ -21,8 +21,8 @@ import { getEstimatedAmount } from '../utils/vote';
// Constants
import ROUTES from '../constants/routeNames';
const STEEM_DROPDOWN = ['transfer_token', 'transfer_to_saving', 'powerUp'];
const SBD_DROPDOWN = ['transfer_token', 'transfer_to_saving'];
const STEEM_DROPDOWN = ['purchase_estm', 'transfer_token', 'transfer_to_saving', 'powerUp'];
const SBD_DROPDOWN = ['purchase_estm', 'transfer_token', 'transfer_to_saving'];
const SAVING_STEEM_DROPDOWN = ['withdraw_steem'];
const SAVING_SBD_DROPDOWN = ['withdraw_sbd'];
const STEEM_POWER_DROPDOWN = ['delegate', 'power_down'];
@ -235,10 +235,16 @@ const WalletContainer = ({
const _navigate = async (transferType, fundType) => {
let balance;
if (transferType === 'transfer_token' && fundType === 'STEEM') {
if (
(transferType === 'transfer_token' || transferType === 'purchase_estm') &&
fundType === 'STEEM'
) {
balance = Math.round(walletData.balance * 1000) / 1000;
}
if (transferType === 'transfer_token' && fundType === 'SBD') {
if (
(transferType === 'transfer_token' || transferType === 'purchase_estm') &&
fundType === 'SBD'
) {
balance = Math.round(walletData.sbdBalance * 1000) / 1000;
}
if (transferType === 'withdraw_steem' && fundType === 'STEEM') {

View File

@ -70,10 +70,16 @@ class TransferContainer extends Component {
getAccount(username).then(async account => {
let balance;
if (transferType === 'transfer_token' && fundType === 'STEEM') {
if (
(transferType === 'purchase_estm' || transferType === 'transfer_token') &&
fundType === 'STEEM'
) {
balance = account[0].balance.replace(fundType, '');
}
if (transferType === 'transfer_token' && fundType === 'SBD') {
if (
(transferType === 'purchase_estm' || transferType === 'transfer_token') &&
fundType === 'SBD'
) {
balance = account[0].sbd_balance.replace(fundType, '');
}
if (transferType === 'points' && fundType === 'ESTM') {
@ -132,6 +138,9 @@ class TransferContainer extends Component {
case 'transfer_token':
func = transferToken;
break;
case 'purchase_estm':
func = transferToken;
break;
case 'transfer_to_saving':
func = transferToSavings;
break;

View File

@ -25,6 +25,7 @@ const Transfer = ({ navigation }) => (
}) => {
switch (transferType) {
case 'transfer_token':
case 'purchase_estm':
case 'transfer_to_saving':
case 'powerUp':
case 'points':

View File

@ -36,10 +36,13 @@ class TransferView extends Component {
props.transferType === 'withdraw_steem' ||
props.transferType === 'withdraw_steem'
? props.currentAccountName
: props.transferType === 'purchase_estm'
? 'esteem.app'
: '',
amount: '',
memo: '',
memo: props.transferType === 'purchase_estm' ? 'estm-purchase' : '',
isUsernameValid: !!(
props.transferType === 'purchase_estm' ||
props.transferType === 'powerUp' ||
props.transferType === 'withdraw_steem' ||
(props.transferType === 'withdraw_steem' && props.currentAccountName)
@ -226,7 +229,9 @@ class TransferView extends Component {
</TouchableOpacity>
)}
/>
{(transferType === 'points' || transferType === 'transfer_token') && (
{(transferType === 'points' ||
transferType === 'transfer_token' ||
transferType === 'purchase_estm') && (
<TransferFormItem
label={intl.formatMessage({ id: 'transfer.memo' })}
rightComponent={() =>
@ -239,7 +244,9 @@ class TransferView extends Component {
}
/>
)}
{(transferType === 'points' || transferType === 'transfer_token') && (
{(transferType === 'points' ||
transferType === 'transfer_token' ||
transferType === 'purchase_estm') && (
<TransferFormItem
rightComponent={() =>
this._renderDescription(intl.formatMessage({ id: 'transfer.memo_desc' }))