diff --git a/app/components/Modals/TransferNftModal/TransferNftModal.jsx b/app/components/Modals/TransferNftModal/TransferNftModal.jsx index 1cb24b5f0..5412471b7 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 && address[0] && 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,7 +145,15 @@ 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 @@ -165,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) } } @@ -218,6 +229,7 @@ export default function TransferNftModal(props: Props) { networkFee: fee, systemFee: 0, }) + setFeesInitialized(true) setLoading(false) } testInvoke() @@ -252,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}
- +