From fae70f37aa05661f1b3531738de8c774d45cc38e Mon Sep 17 00:00:00 2001 From: pbca26 Date: Sat, 2 Dec 2017 19:24:17 +0300 Subject: [PATCH] receive zaddr render fix, z_exportkey --- react/src/actions/actions/settings.js | 6 +++--- .../components/dashboard/receiveCoin/receiveCoin.js | 10 ++++++---- .../dashboard/receiveCoin/receiveCoin.render.js | 8 ++++++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/react/src/actions/actions/settings.js b/react/src/actions/actions/settings.js index 5db5ebf..cf33cfc 100644 --- a/react/src/actions/actions/settings.js +++ b/react/src/actions/actions/settings.js @@ -3,7 +3,7 @@ import { GET_WIF_KEY, GET_DEBUG_LOG, GET_PEERS_LIST, - LOAD_APP_CONFIG + LOAD_APP_CONFIG, } from '../storeType'; import { translate } from '../../translate/translate'; import { triggerToaster } from '../actionCreators'; @@ -442,12 +442,12 @@ export function getWalletDatKeys(chain, keyMatchPattern) { }); } -export function dumpPrivKey(coin, address) { +export function dumpPrivKey(coin, address, isZaddr) { return new Promise((resolve, reject) => { const payload = { mode: null, chain: coin, - cmd: 'dumpprivkey', + cmd: isZaddr ? 'z_exportkey' : 'dumpprivkey', params: [ address ] }; diff --git a/react/src/components/dashboard/receiveCoin/receiveCoin.js b/react/src/components/dashboard/receiveCoin/receiveCoin.js index a9ce840..681a428 100644 --- a/react/src/components/dashboard/receiveCoin/receiveCoin.js +++ b/react/src/components/dashboard/receiveCoin/receiveCoin.js @@ -60,9 +60,9 @@ class ReceiveCoin extends React.Component { ); } - dumpPrivKey(address) { + dumpPrivKey(address, isZaddr) { this.toggleAddressMenu(address); - dumpPrivKey(this.props.coin, address) + dumpPrivKey(this.props.coin, address, isZaddr) .then((json) => { if (json.length && json.length > 10) { @@ -157,7 +157,8 @@ class ReceiveCoin extends React.Component { } if (!this.state.toggleIsMine && - !address.canspend) { + !address.canspend && + address.address.substring(0, 2) !== 'zc') { items.pop(); } } else { @@ -166,7 +167,8 @@ class ReceiveCoin extends React.Component { ); if (!this.state.toggleIsMine && - !address.canspend) { + !address.canspend && + address.address.substring(0, 2) !== 'zc') { items.pop(); } } diff --git a/react/src/components/dashboard/receiveCoin/receiveCoin.render.js b/react/src/components/dashboard/receiveCoin/receiveCoin.render.js index e4c4b7c..52b45a2 100644 --- a/react/src/components/dashboard/receiveCoin/receiveCoin.render.js +++ b/react/src/components/dashboard/receiveCoin/receiveCoin.render.js @@ -3,6 +3,8 @@ import { translate } from '../../../translate/translate'; import QRModal from '../qrModal/qrModal'; import InvoiceModal from '../invoiceModal/invoiceModal'; +// TODO: zaddr match length > 64 chars + export const AddressActionsNonBasiliskModeRender = function(address, type) { return ( @@ -25,7 +27,7 @@ export const AddressActionsNonBasiliskModeRender = function(address, type) { { translate('INDEX.COPY') + ' pub key' } { !address.canspend && -
  • this.dumpPrivKey(address) }> +
  • this.dumpPrivKey(address, type !== 'public' ? true : null) }> { translate('INDEX.COPY') + ' priv key (WIF)' }
  • } @@ -43,9 +45,10 @@ export const AddressItemRender = function(address, type) { return ( { this.renderAddressActions(address.address, type) } - + { type === 'public' ? address.address : `${address.address.substring(0, 34)}...` } { !address.canspend && + address.address.substring(0, 2) !== 'zc' && @@ -54,6 +57,7 @@ export const AddressItemRender = function(address, type) { { address.amount } { !address.canspend && + address.address.substring(0, 2) !== 'zc' && (0) }