From 77a6bf99183da69886da4ecd5003be5b900679e0 Mon Sep 17 00:00:00 2001 From: JasonHJ Date: Wed, 16 Feb 2022 16:25:38 +0800 Subject: [PATCH] Optimize code and fix bugs --- src/app/componentUtils/trezor/index.js | 2 +- src/app/components/SendNormalTrans/SendXRPNormalTrans.js | 4 ++-- src/controllers/index.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/componentUtils/trezor/index.js b/src/app/componentUtils/trezor/index.js index a1a6e0e1..ce465bfd 100644 --- a/src/app/componentUtils/trezor/index.js +++ b/src/app/componentUtils/trezor/index.js @@ -73,7 +73,7 @@ export const getPublicKey = callback => { export const signPersonalMessage = async (path, message) => { let bHex = false; - if (message.indexOf('0x') !== -1) { + if (message.startsWith('0x')) { bHex = true; message = message.slice(2); } diff --git a/src/app/components/SendNormalTrans/SendXRPNormalTrans.js b/src/app/components/SendNormalTrans/SendXRPNormalTrans.js index 4b210538..2ce5261e 100644 --- a/src/app/components/SendNormalTrans/SendXRPNormalTrans.js +++ b/src/app/components/SendNormalTrans/SendXRPNormalTrans.js @@ -9,7 +9,7 @@ import XRPNormalTransForm from 'components/NormalTransForm/XRPNormalTrans/XRPNor const CollectionCreateForm = Form.create({ name: 'XRPNormalTransForm' })(XRPNormalTransForm); const SendXRPNormalTrans = observer(({ record }) => { - const { orignBalance, address: from, path, balance } = record + const { orignBalance, address: from, path, balance, wid } = record const { languageIntl, session, sendTransParams: { updateXRPTransParams, XRPTransParams } } = useContext(MobXProviderContext) const [visible, setVisible] = useState(false); @@ -20,7 +20,7 @@ const SendXRPNormalTrans = observer(({ record }) => { } setVisible(true); try { - updateXRPTransParams({ from, chainId: session.chainId, BIP44Path: path }); + updateXRPTransParams({ from, chainId: session.chainId, BIP44Path: path, walletID: wid }); } catch (err) { console.log(`showModal: ${err}`) message.warn(intl.get('network.down')); diff --git a/src/controllers/index.js b/src/controllers/index.js index f280e17a..2e5ecae9 100755 --- a/src/controllers/index.js +++ b/src/controllers/index.js @@ -2442,7 +2442,7 @@ ipc.on(ROUTE_STOREMAN, async (event, actionUni, payload) => { case 'openStoremanAction': try { let { tx, action, isEstimateFee } = payload; - if (!tx.gasLimit) { + if (!tx.gasLimit || !Number(tx.gasLimit)) { tx.gasLimit = 2000000; } // let gasPrice = await ccUtil.getGasPrice('wan');