mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-22 04:41:43 +03:00
Working on transfer feature
This commit is contained in:
parent
215368e888
commit
35864aea09
@ -52,6 +52,8 @@ class TransactionView extends PureComponent {
|
|||||||
{transactions
|
{transactions
|
||||||
&& transactions.map((item, index) => {
|
&& transactions.map((item, index) => {
|
||||||
const transactionData = groomingTransactionData(item, steemPerMVests, formatNumber);
|
const transactionData = groomingTransactionData(item, steemPerMVests, formatNumber);
|
||||||
|
if (transactionData.length === 0) return null;
|
||||||
|
|
||||||
const value = transactionData.value.split(' ');
|
const value = transactionData.value.split(' ');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -26,16 +26,21 @@ class WalletContainer extends PureComponent {
|
|||||||
// Component Life Cycle Functions
|
// Component Life Cycle Functions
|
||||||
|
|
||||||
// Component Functions
|
// Component Functions
|
||||||
_navigate = () => {
|
_navigate = (a,b) => {
|
||||||
const { dispatch, setPinCodeState, navigation } = this.props;
|
const { dispatch, setPinCodeState } = this.props;
|
||||||
|
|
||||||
navigation.navigate(ROUTES.SCREENS.TRANSFER, {
|
// navigation.navigate(ROUTES.SCREENS.TRANSFER, {
|
||||||
transferType: 'transferToSaving',
|
// transferType: 'withdrawToSaving',
|
||||||
fundType: 'STEEM',
|
// fundType: 'STEEM',
|
||||||
|
// });
|
||||||
|
|
||||||
|
console.log('a,b :', a,b);
|
||||||
|
|
||||||
|
setPinCodeState({
|
||||||
|
navigateTo: ROUTES.SCREENS.TRANSFER,
|
||||||
|
navigateParams: { transferType: 'transferToken', fundType: 'STEEM' },
|
||||||
});
|
});
|
||||||
|
dispatch(openPinCodeModal());
|
||||||
// setPinCodeState({ navigateTo: ROUTES.SCREENS.TRANSFER, navigateParams: {transferType: 'sbd'} });
|
|
||||||
// dispatch(openPinCodeModal());
|
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -40,7 +40,7 @@ class WalletDetailsView extends PureComponent {
|
|||||||
isBoldText
|
isBoldText
|
||||||
dropdown
|
dropdown
|
||||||
dropdownOptions={['Transfer']}
|
dropdownOptions={['Transfer']}
|
||||||
onDropdownSelect={test => navigate()}
|
onDropdownSelect={(a,b) => navigate(a,b)}
|
||||||
/>
|
/>
|
||||||
<GrayWrapper isGray>
|
<GrayWrapper isGray>
|
||||||
<WalletLineItem
|
<WalletLineItem
|
||||||
|
@ -544,7 +544,8 @@ export const transferToSavings = (currentAccount, pin, data) => {
|
|||||||
|
|
||||||
if (key) {
|
if (key) {
|
||||||
const privateKey = PrivateKey.fromString(key);
|
const privateKey = PrivateKey.fromString(key);
|
||||||
const args = [
|
|
||||||
|
const args = [[
|
||||||
'transfer_to_savings',
|
'transfer_to_savings',
|
||||||
{
|
{
|
||||||
from: data.from,
|
from: data.from,
|
||||||
@ -552,9 +553,7 @@ export const transferToSavings = (currentAccount, pin, data) => {
|
|||||||
amount: data.amount,
|
amount: data.amount,
|
||||||
memo: data.memo,
|
memo: data.memo,
|
||||||
},
|
},
|
||||||
];
|
]];
|
||||||
|
|
||||||
console.log('args :', args);
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
client.broadcast
|
client.broadcast
|
||||||
@ -577,7 +576,7 @@ export const transferFromSavings = (currentAccount, pin, data) => {
|
|||||||
|
|
||||||
if (key) {
|
if (key) {
|
||||||
const privateKey = PrivateKey.fromString(key);
|
const privateKey = PrivateKey.fromString(key);
|
||||||
const args = [
|
const args = [[
|
||||||
'transfer_from_savings',
|
'transfer_from_savings',
|
||||||
{
|
{
|
||||||
from: data.from,
|
from: data.from,
|
||||||
@ -586,7 +585,7 @@ export const transferFromSavings = (currentAccount, pin, data) => {
|
|||||||
memo: data.memo,
|
memo: data.memo,
|
||||||
request_id: data.requestId,
|
request_id: data.requestId,
|
||||||
},
|
},
|
||||||
];
|
]];
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
client.broadcast
|
client.broadcast
|
||||||
@ -609,14 +608,14 @@ export const transferToVesting = (currentAccount, pin, data) => {
|
|||||||
|
|
||||||
if (key) {
|
if (key) {
|
||||||
const privateKey = PrivateKey.fromString(key);
|
const privateKey = PrivateKey.fromString(key);
|
||||||
const args = [
|
const args = [[
|
||||||
'transfer_to_vesting',
|
'transfer_to_vesting',
|
||||||
{
|
{
|
||||||
from: data.from,
|
from: data.from,
|
||||||
to: data.destination,
|
to: data.destination,
|
||||||
amount: data.amount,
|
amount: data.amount,
|
||||||
},
|
},
|
||||||
];
|
]];
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
client.broadcast
|
client.broadcast
|
||||||
|
@ -80,7 +80,7 @@ class PinCodeContainer extends Component {
|
|||||||
|
|
||||||
_resetPinCode = pin => new Promise((resolve, reject) => {
|
_resetPinCode = pin => new Promise((resolve, reject) => {
|
||||||
const {
|
const {
|
||||||
currentAccount, dispatch, accessToken, navigateTo, navigation, intl,
|
currentAccount, dispatch, accessToken, navigateTo, navigateParams, navigation, intl,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const { isOldPinVerified, oldPinCode } = this.state;
|
const { isOldPinVerified, oldPinCode } = this.state;
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ class PinCodeContainer extends Component {
|
|||||||
|
|
||||||
dispatch(closePinCodeModal());
|
dispatch(closePinCodeModal());
|
||||||
if (navigateTo) {
|
if (navigateTo) {
|
||||||
navigation.navigate(navigateTo);
|
navigation.navigate(navigateTo, navigateParams);
|
||||||
}
|
}
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
@ -135,7 +135,7 @@ class PinCodeContainer extends Component {
|
|||||||
|
|
||||||
_setFirstPinCode = pin => new Promise((resolve) => {
|
_setFirstPinCode = pin => new Promise((resolve) => {
|
||||||
const {
|
const {
|
||||||
currentAccount, dispatch, accessToken, navigateTo, navigation,
|
currentAccount, dispatch, accessToken, navigateTo, navigateParams, navigation,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const pinData = {
|
const pinData = {
|
||||||
@ -155,7 +155,7 @@ class PinCodeContainer extends Component {
|
|||||||
this._savePinCode(pin);
|
this._savePinCode(pin);
|
||||||
dispatch(closePinCodeModal());
|
dispatch(closePinCodeModal());
|
||||||
if (navigateTo) {
|
if (navigateTo) {
|
||||||
navigation.navigate(navigateTo);
|
navigation.navigate(navigateTo, navigateParams);
|
||||||
}
|
}
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
@ -165,7 +165,7 @@ class PinCodeContainer extends Component {
|
|||||||
|
|
||||||
_verifyPinCode = pin => new Promise((resolve, reject) => {
|
_verifyPinCode = pin => new Promise((resolve, reject) => {
|
||||||
const {
|
const {
|
||||||
currentAccount, dispatch, accessToken, navigateTo, navigation, intl,
|
currentAccount, dispatch, accessToken, navigateTo, navigateParams, navigation, intl,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
// If the user is exist, we are just checking to pin and navigating to home screen
|
// If the user is exist, we are just checking to pin and navigating to home screen
|
||||||
@ -184,8 +184,9 @@ class PinCodeContainer extends Component {
|
|||||||
[_currentAccount.local] = realmData;
|
[_currentAccount.local] = realmData;
|
||||||
dispatch(updateCurrentAccount({ ..._currentAccount }));
|
dispatch(updateCurrentAccount({ ..._currentAccount }));
|
||||||
dispatch(closePinCodeModal());
|
dispatch(closePinCodeModal());
|
||||||
|
console.log('navigateParams :', navigateParams);
|
||||||
if (navigateTo) {
|
if (navigateTo) {
|
||||||
navigation.navigate(navigateTo);
|
navigation.navigate(navigateTo, navigateParams);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
@ -55,15 +55,14 @@ class ExampleContainer extends Component {
|
|||||||
amount,
|
amount,
|
||||||
memo,
|
memo,
|
||||||
};
|
};
|
||||||
|
data.amount = `${data.amount} ${fundType}`;
|
||||||
|
|
||||||
switch (transferType) {
|
switch (transferType) {
|
||||||
case 'transferToken':
|
case 'transferToken':
|
||||||
func = transferToken;
|
func = transferToken;
|
||||||
data.amount = `${data.amount} ${fundType}`;
|
|
||||||
break;
|
break;
|
||||||
case 'transferToSaving':
|
case 'transferToSaving':
|
||||||
func = transferToSavings;
|
func = transferToSavings;
|
||||||
data.amount = `${data.amount} ${fundType}`;
|
|
||||||
break;
|
break;
|
||||||
case 'powerUp':
|
case 'powerUp':
|
||||||
func = transferToVesting;
|
func = transferToVesting;
|
||||||
@ -71,22 +70,18 @@ class ExampleContainer extends Component {
|
|||||||
case 'withdrawToSaving':
|
case 'withdrawToSaving':
|
||||||
func = transferFromSavings;
|
func = transferFromSavings;
|
||||||
data.requestId = new Date().getTime() >>> 0;
|
data.requestId = new Date().getTime() >>> 0;
|
||||||
data.amount = `${data.amount} ${fundType}`;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('func :', func);
|
|
||||||
return func(currentAccount, pinCode, data)
|
return func(currentAccount, pinCode, data)
|
||||||
.then((res) => {
|
.then(() => {
|
||||||
console.log('res :', res);
|
|
||||||
dispatch(toastNotification('Successfull'));
|
dispatch(toastNotification('Successfull'));
|
||||||
navigation.goBack();
|
navigation.goBack();
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log('err :', err);
|
|
||||||
dispatch(toastNotification(err.message));
|
dispatch(toastNotification(err.message));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -95,7 +95,7 @@ export const groomingTransactionData = (transaction, steemPerMVests, formatNumbe
|
|||||||
result.icon = 'reorder';
|
result.icon = 'reorder';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
return [];
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user