From 1e569b23a325b66883924fff5b537475b3e08201 Mon Sep 17 00:00:00 2001 From: Maxwell Lasky Date: Mon, 12 Jun 2023 14:20:46 -0600 Subject: [PATCH 1/3] Fixes error related to NFT transfer on ledger --- .../Modals/TransferNftModal/TransferNftModal.jsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/components/Modals/TransferNftModal/TransferNftModal.jsx b/app/components/Modals/TransferNftModal/TransferNftModal.jsx index 1cb24b5f0..fc74d7196 100644 --- a/app/components/Modals/TransferNftModal/TransferNftModal.jsx +++ b/app/components/Modals/TransferNftModal/TransferNftModal.jsx @@ -142,7 +142,14 @@ export default function TransferNftModal(props: Props) { }, }, } - const results = await new N3Helper(endpoint, 0).rpcCall(account, testReq) + const results = await new N3Helper(endpoint, 0).rpcCall( + account, + testReq, + isHardwareLogin, + signingFunction, + showInfoNotification, + hideNotification, + ) const { result } = results From cc6cff8709706d0b547f47d4ec53089f859f771b Mon Sep 17 00:00:00 2001 From: Maxwell Lasky Date: Tue, 13 Jun 2023 10:22:52 -0600 Subject: [PATCH 2/3] Fix notification UX and z-index issues --- .../TransferNftModal/TransferNftModal.jsx | 17 +++++++++++------ app/containers/App/App.jsx | 3 ++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/components/Modals/TransferNftModal/TransferNftModal.jsx b/app/components/Modals/TransferNftModal/TransferNftModal.jsx index fc74d7196..1da40ea5c 100644 --- a/app/components/Modals/TransferNftModal/TransferNftModal.jsx +++ b/app/components/Modals/TransferNftModal/TransferNftModal.jsx @@ -36,6 +36,7 @@ type Props = { dispatch: any => any, isHardwareLogin: boolean, signingFunction: () => void, + publicKey: string, } export default function TransferNftModal(props: Props) { @@ -55,6 +56,7 @@ export default function TransferNftModal(props: Props) { showErrorNotification, showInfoNotification, hideNotification, + publicKey, } = props function handleSubmit() {} @@ -66,6 +68,7 @@ export default function TransferNftModal(props: Props) { const [recipientAddress, setRecipientAddress] = useState('') const [recipientAddressError, setRecipientAddressError] = useState('') const [gasFee, setGasFee] = useState(DEFAULT_FEES) + const [feesInitialized, setFeesInitialized] = useState(false) const [sendButtonDisabled, setSendButtonDisabled] = useState(false) const [loading, setLoading] = useState(true) @@ -74,7 +77,7 @@ export default function TransferNftModal(props: Props) { } function isValidAddress(address: string) { - if (address[0].toLocaleUpperCase() !== 'N') { + if (address[0]?.toLocaleUpperCase() !== 'N') { setRecipientAddressError( intl.formatMessage({ id: 'errors.send.invalidN3Address', @@ -117,7 +120,7 @@ export default function TransferNftModal(props: Props) { if (!endpoint) { endpoint = await getRPCEndpoint(net) } - const account = new n3Wallet.Account(wif) + const account = new n3Wallet.Account(isHardwareLogin ? publicKey : wif) const testReq = { params: { request: { @@ -142,6 +145,7 @@ export default function TransferNftModal(props: Props) { }, }, } + const results = await new N3Helper(endpoint, 0).rpcCall( account, testReq, @@ -172,11 +176,11 @@ export default function TransferNftModal(props: Props) { setLoading(false) hideModal() } catch (e) { - setLoading(false) - console.error({ e }) + hideModal() showErrorNotification({ - message: 'An unknown error has occurred. Please try again.', + message: e.message, }) + setLoading(false) } } @@ -225,6 +229,7 @@ export default function TransferNftModal(props: Props) { networkFee: fee, systemFee: 0, }) + setFeesInitialized(true) setLoading(false) } testInvoke() @@ -259,7 +264,7 @@ export default function TransferNftModal(props: Props) { /> diff --git a/app/containers/App/App.jsx b/app/containers/App/App.jsx index aabe2f5d9..27e6d11a0 100644 --- a/app/containers/App/App.jsx +++ b/app/containers/App/App.jsx @@ -186,6 +186,7 @@ const App = ({ return (
+ {address && routesWithSideBar.includes(location.pathname) && ( @@ -193,7 +194,7 @@ const App = ({
{children}
- +
From 36def670198efcfd35a2690d74346f8fd77d178e Mon Sep 17 00:00:00 2001 From: Maxwell Lasky Date: Tue, 13 Jun 2023 10:34:34 -0600 Subject: [PATCH 3/3] Fix flow --- app/components/Modals/TransferNftModal/TransferNftModal.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/Modals/TransferNftModal/TransferNftModal.jsx b/app/components/Modals/TransferNftModal/TransferNftModal.jsx index 1da40ea5c..5412471b7 100644 --- a/app/components/Modals/TransferNftModal/TransferNftModal.jsx +++ b/app/components/Modals/TransferNftModal/TransferNftModal.jsx @@ -77,7 +77,7 @@ export default function TransferNftModal(props: Props) { } function isValidAddress(address: string) { - if (address[0]?.toLocaleUpperCase() !== 'N') { + if (address && address[0] && address[0].toLocaleUpperCase() !== 'N') { setRecipientAddressError( intl.formatMessage({ id: 'errors.send.invalidN3Address',