From 64f3f8352dd52865b4d42dc65dcb48ad3af3b8dc Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Thu, 18 Aug 2022 11:28:32 +0500 Subject: [PATCH 1/5] added fallback value to 0 for vp and rc values --- src/screens/profile/screen/profileScreen.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/screens/profile/screen/profileScreen.js b/src/screens/profile/screen/profileScreen.js index 8991ce225..c788ed3e5 100644 --- a/src/screens/profile/screen/profileScreen.js +++ b/src/screens/profile/screen/profileScreen.js @@ -74,11 +74,11 @@ const ProfileScreen = () => ( isProfileLoading={isProfileLoading} isReady={isReady} quickProfile={quickProfile} - resourceCredits={resourceCredits} + resourceCredits={resourceCredits || 0} selectedUser={selectedUser} setEstimatedWalletValue={setEstimatedWalletValue} username={username} - votingPower={votingPower} + votingPower={votingPower || 0} isHideImage={isHideImage} reverseHeader={reverseHeader} deepLinkFilter={deepLinkFilter} From 5cb973669749255e931f90587e13fb894f0f2c4f Mon Sep 17 00:00:00 2001 From: Nouman Tahir Date: Thu, 18 Aug 2022 12:10:30 +0500 Subject: [PATCH 2/5] fixed bad transfer type check logic --- src/screens/transfer/screen/transferScreen.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/screens/transfer/screen/transferScreen.js b/src/screens/transfer/screen/transferScreen.js index b192524a2..adfe6cb20 100644 --- a/src/screens/transfer/screen/transferScreen.js +++ b/src/screens/transfer/screen/transferScreen.js @@ -75,7 +75,7 @@ const TransferView = ({ let path; if (hsTransfer) { - if (transferType !== transferTypes.CONVERT) { + if (transferType === transferTypes.PURCHASE_ESTM) { const json = JSON.stringify({ sender: get(selectedAccount, 'name'), receiver: destination, From 30778e731e7c29bb0a73d5a52d69ee4d6b27f4f8 Mon Sep 17 00:00:00 2001 From: Nouman Tahir Date: Thu, 18 Aug 2022 12:53:49 +0500 Subject: [PATCH 3/5] commented points purchase --- src/screens/transfer/screen/transferScreen.js | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/screens/transfer/screen/transferScreen.js b/src/screens/transfer/screen/transferScreen.js index adfe6cb20..90d93adbb 100644 --- a/src/screens/transfer/screen/transferScreen.js +++ b/src/screens/transfer/screen/transferScreen.js @@ -75,20 +75,25 @@ const TransferView = ({ let path; if (hsTransfer) { - if (transferType === transferTypes.PURCHASE_ESTM) { - const json = JSON.stringify({ - sender: get(selectedAccount, 'name'), - receiver: destination, - amount: `${Number(amount).toFixed(3)} ${fundType}`, - memo, - }); - path = `sign/custom-json?authority=active&required_auths=%5B%22${get( - selectedAccount, - 'name', - )}%22%5D&required_posting_auths=%5B%5D&id=ecency_point_transfer&json=${encodeURIComponent( - json, - )}`; - } else if (transferType === transferTypes.TRANSFER_TO_SAVINGS) { + //NOTE: Keepping point purchase url here for referemnce in case we have to put it back again, + //the path formatting seems quite complex so perhaps it's better to just let it live here + //as comment + // if (transferType === transferTypes.PURCHASE_ESTM) { + // const json = JSON.stringify({ + // sender: get(selectedAccount, 'name'), + // receiver: destination, + // amount: `${Number(amount).toFixed(3)} ${fundType}`, + // memo, + // }); + // path = `sign/custom-json?authority=active&required_auths=%5B%22${get( + // selectedAccount, + // 'name', + // )}%22%5D&required_posting_auths=%5B%5D&id=ecency_point_transfer&json=${encodeURIComponent( + // json, + // )}`; + // } else + + if (transferType === transferTypes.TRANSFER_TO_SAVINGS) { path = `sign/transfer_to_savings?from=${currentAccountName}&to=${destination}&amount=${encodeURIComponent( `${amount} ${fundType}`, )}&memo=${encodeURIComponent(memo)}`; From b50ea6c5564464c4017558d5b146d35bfe812350 Mon Sep 17 00:00:00 2001 From: Nouman Tahir Date: Thu, 18 Aug 2022 13:27:10 +0500 Subject: [PATCH 4/5] added hsClient handler to community subscribe and pin community post methods --- src/providers/hive/dhive.js | 56 ++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 20 deletions(-) diff --git a/src/providers/hive/dhive.js b/src/providers/hive/dhive.js index 3e5775e0b..6b6c9e244 100644 --- a/src/providers/hive/dhive.js +++ b/src/providers/hive/dhive.js @@ -1874,8 +1874,8 @@ export const profileUpdate = async (params, pin, currentAccount) => { }; export const subscribeCommunity = (currentAccount, pinCode, data) => { - const pin = getDigitPinCode(pinCode); - const key = getActiveKey(get(currentAccount, 'local'), pin); + const digitPinCode = getDigitPinCode(pinCode); + const key = getActiveKey(get(currentAccount, 'local'), digitPinCode); const username = get(currentAccount, 'name'); const json = JSON.stringify([ @@ -1883,16 +1883,24 @@ export const subscribeCommunity = (currentAccount, pinCode, data) => { { community: data.communityId }, ]); + const op = { + id: 'community', + json, + required_auths: [], + required_posting_auths: [username], + }; + const opArray = [['custom_json', op]]; + + if (currentAccount.local.authType === AUTH_TYPE.STEEM_CONNECT) { + const token = decryptKey(currentAccount.local.accessToken, digitPinCode); + const api = new hsClient({ + accessToken: token, + }); + return api.broadcast(opArray); + } + if (key) { const privateKey = PrivateKey.fromString(key); - - const op = { - id: 'community', - json, - required_auths: [], - required_posting_auths: [username], - }; - const opArray = [['custom_json', op]]; return sendHiveOperations(opArray, privateKey); } @@ -1909,8 +1917,8 @@ export const pinCommunityPost = ( permlink, unpinPost = false, ) => { - const pin = getDigitPinCode(pinCode); - const key = getActiveKey(get(currentAccount, 'local'), pin); + const digitPinCode = getDigitPinCode(pinCode); + const key = getActiveKey(get(currentAccount, 'local'), digitPinCode); const username = get(currentAccount, 'name'); const json = JSON.stringify([ @@ -1922,16 +1930,24 @@ export const pinCommunityPost = ( }, ]); + const op = { + id: 'community', + json, + required_auths: [], + required_posting_auths: [username], + }; + const opArray = [['custom_json', op]]; + + if (currentAccount.local.authType === AUTH_TYPE.STEEM_CONNECT) { + const token = decryptKey(currentAccount.local.accessToken, digitPinCode); + const api = new hsClient({ + accessToken: token, + }); + return api.broadcast(opArray); + } + if (key) { const privateKey = PrivateKey.fromString(key); - - const op = { - id: 'community', - json, - required_auths: [], - required_posting_auths: [username], - }; - const opArray = [['custom_json', op]]; return sendHiveOperations(opArray, privateKey); } From 9da634e18166d7c659dc304dc81590945def2259 Mon Sep 17 00:00:00 2001 From: Nouman Tahir Date: Thu, 18 Aug 2022 14:59:09 +0500 Subject: [PATCH 5/5] fixed delegate verification not showing when using hive signer --- src/screens/transfer/screen/delegateScreen.js | 42 ++++++++----------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index e0d66c703..e67c31119 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -25,7 +25,7 @@ import { } from '../../../components'; // Styles import styles from './transferStyles'; -import { OptionsModal } from '../../../components/atoms'; + // Redux import { showActionModal } from '../../../redux/actions/uiAction'; // Utils @@ -63,9 +63,9 @@ class DelegateScreen extends Component { usersResult: [], step: 1, delegatedHP: 0, + confirmModalOpen: true, }; - this.startActionSheet = React.createRef(); this.destinationTextInput = React.createRef(); this.amountTextInput = React.createRef(); } @@ -144,11 +144,10 @@ class DelegateScreen extends Component { const { transferToAccount, accountType } = this.props; const { from, destination, amount } = this.state; - this.setState({ isTransfering: true }); - if (accountType === AUTH_TYPE.STEEM_CONNECT) { this.setState({ steemConnectTransfer: true }); } else { + this.setState({ isTransfering: true }); transferToAccount(from, destination, amount, ''); } }; @@ -254,6 +253,7 @@ class DelegateScreen extends Component { : ''); if (amountValid) { + this.setState({ confirmModalOpen: true }); dispatch( showActionModal({ title: intl.formatMessage({ id: 'transfer.confirm' }), @@ -269,6 +269,7 @@ class DelegateScreen extends Component { }, ], headerContent: this._renderToFromAvatars(), + onClosed: () => this.setState({ confirmModalOpen: false }), }), ); } else { @@ -447,6 +448,7 @@ class DelegateScreen extends Component { step, delegatedHP, hp, + confirmModalOpen, isAmountValid, } = this.state; let availableVestingShares = 0; @@ -588,26 +590,18 @@ class DelegateScreen extends Component { - (index === 0 ? this._handleTransferAction() : null)} - /> - - - + + {path && !confirmModalOpen && ( + + + + )} ); }