From f7e631d7f3d3e874f9618fb9841d0113d6c42d6e Mon Sep 17 00:00:00 2001 From: Mahmoud Aboelenein Date: Mon, 18 Dec 2023 13:31:08 +0200 Subject: [PATCH 1/5] fix nonce not being set correctly for tx requests --- src/app/screens/transactionRequest/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/screens/transactionRequest/index.tsx b/src/app/screens/transactionRequest/index.tsx index ffec77882..6fc4de4e5 100644 --- a/src/app/screens/transactionRequest/index.tsx +++ b/src/app/screens/transactionRequest/index.tsx @@ -51,7 +51,7 @@ function TransactionRequest() { stxPublicKey, feeMultipliers!, selectedNetwork, - stxPendingTxData, + stxPendingTxData.data, ); setUnsignedTx(unsignedSendStxTx); navigate('/confirm-stx-tx', { From bc96e5be365627f5b77a217bc3f445a113051918 Mon Sep 17 00:00:00 2001 From: Denys Hriaznov Date: Mon, 18 Dec 2023 13:08:11 +0100 Subject: [PATCH 2/5] [ENG-3455] fix: Fix the sharp fee change on tx confirmation --- src/app/screens/confirmFtTransaction/index.tsx | 12 +++++++++--- src/app/screens/confirmNftTransaction/index.tsx | 4 ++-- src/app/screens/confirmStxTransaction/index.tsx | 4 ++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/app/screens/confirmFtTransaction/index.tsx b/src/app/screens/confirmFtTransaction/index.tsx index 70a16c393..00d68aaf6 100644 --- a/src/app/screens/confirmFtTransaction/index.tsx +++ b/src/app/screens/confirmFtTransaction/index.tsx @@ -13,7 +13,7 @@ import { deserializeTransaction } from '@stacks/transactions'; import { useMutation } from '@tanstack/react-query'; import { isLedgerAccount } from '@utils/helper'; import BigNumber from 'bignumber.js'; -import { useEffect } from 'react'; +import { useEffect, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { useLocation, useNavigate } from 'react-router-dom'; @@ -22,8 +22,14 @@ function ConfirmFtTransaction() { const navigate = useNavigate(); const selectedNetwork = useNetworkSelector(); const location = useLocation(); - const { unsignedTx: seedHex, amount, fungibleToken, memo, recepientAddress } = location.state; - const unsignedTx = deserializeTransaction(seedHex); + const { + unsignedTx: unsignedTxHex, + amount, + fungibleToken, + memo, + recepientAddress, + } = location.state; + const unsignedTx = useMemo(() => deserializeTransaction(unsignedTxHex), [unsignedTxHex]); const { refetch } = useStxWalletData(); const { network, selectedAccount } = useWalletSelector(); diff --git a/src/app/screens/confirmNftTransaction/index.tsx b/src/app/screens/confirmNftTransaction/index.tsx index d93103bfb..a3f6b209e 100644 --- a/src/app/screens/confirmNftTransaction/index.tsx +++ b/src/app/screens/confirmNftTransaction/index.tsx @@ -17,7 +17,7 @@ import { deserializeTransaction } from '@stacks/transactions'; import { useMutation } from '@tanstack/react-query'; import { isLedgerAccount } from '@utils/helper'; import BigNumber from 'bignumber.js'; -import { useEffect } from 'react'; +import { useEffect, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { useLocation, useNavigate, useParams } from 'react-router-dom'; import styled from 'styled-components'; @@ -74,7 +74,7 @@ function ConfirmNftTransaction() { const nft = nftDetailQuery.data?.data; const { unsignedTx: unsignedTxHex, recipientAddress } = location.state; - const unsignedTx = deserializeTransaction(unsignedTxHex); + const unsignedTx = useMemo(() => deserializeTransaction(unsignedTxHex), [unsignedTxHex]); const { network } = useWalletSelector(); const { refetch } = useStxWalletData(); const selectedNetwork = useNetworkSelector(); diff --git a/src/app/screens/confirmStxTransaction/index.tsx b/src/app/screens/confirmStxTransaction/index.tsx index 71d1c03fc..1f1ea17e5 100644 --- a/src/app/screens/confirmStxTransaction/index.tsx +++ b/src/app/screens/confirmStxTransaction/index.tsx @@ -24,7 +24,7 @@ import { deserializeTransaction } from '@stacks/transactions'; import { useMutation } from '@tanstack/react-query'; import { isLedgerAccount } from '@utils/helper'; import BigNumber from 'bignumber.js'; -import { useEffect, useState } from 'react'; +import { useEffect, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useLocation, useNavigate } from 'react-router-dom'; import styled from 'styled-components'; @@ -49,7 +49,7 @@ function ConfirmStxTransaction() { const location = useLocation(); const selectedNetwork = useNetworkSelector(); const { unsignedTx: stringHex, sponsored, isBrowserTx, tabId, requestToken } = location.state; - const unsignedTx = deserializeTransaction(stringHex); + const unsignedTx = useMemo(() => deserializeTransaction(stringHex), [stringHex]); useOnOriginTabClose(Number(tabId), () => { setHasTabClosed(true); window.scrollTo({ top: 0, behavior: 'smooth' }); From 5cac557b4a6c8cf999eaaeed68c4f853d29eb72b Mon Sep 17 00:00:00 2001 From: Mahmoud Aboelenein Date: Mon, 18 Dec 2023 17:12:31 +0200 Subject: [PATCH 3/5] fix nonce calc persisted --- src/app/screens/transactionRequest/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/screens/transactionRequest/index.tsx b/src/app/screens/transactionRequest/index.tsx index 6fc4de4e5..dff53f42c 100644 --- a/src/app/screens/transactionRequest/index.tsx +++ b/src/app/screens/transactionRequest/index.tsx @@ -1,6 +1,5 @@ import ContractCallRequest from '@components/transactionsRequests/ContractCallRequest'; import ContractDeployRequest from '@components/transactionsRequests/ContractDeployTransaction'; -import useStxPendingTxData from '@hooks/queries/useStxPendingTxData'; import useNetworkSelector from '@hooks/useNetwork'; import useDappRequest from '@hooks/useTransationRequest'; import useWalletReducer from '@hooks/useWalletReducer'; @@ -10,6 +9,7 @@ import { ContractFunction, createDeployContractRequest, extractFromPayload, + fetchStxPendingTxData, } from '@secretkeylabs/xverse-core'; import { StacksTransaction } from '@stacks/transactions'; import { getNetworkType, isHardwareAccount } from '@utils/helper'; @@ -39,11 +39,11 @@ function TransactionRequest() { const [coinsMetaData, setCoinsMetaData] = useState(null); const [codeBody, setCodeBody] = useState(undefined); const [contractName, setContractName] = useState(undefined); - const stxPendingTxData = useStxPendingTxData(); const [hasSwitchedAccount, setHasSwitchedAccount] = useState(false); const [attachment, setAttachment] = useState(undefined); const handleTokenTransferRequest = async () => { + const stxPendingTxData = await fetchStxPendingTxData(stxAddress, selectedNetwork); const unsignedSendStxTx = await getTokenTransferRequest( payload.recipient, payload.amount, @@ -51,7 +51,7 @@ function TransactionRequest() { stxPublicKey, feeMultipliers!, selectedNetwork, - stxPendingTxData.data, + stxPendingTxData || [], ); setUnsignedTx(unsignedSendStxTx); navigate('/confirm-stx-tx', { From de4441a017695707fe264e924efa613be915ab4e Mon Sep 17 00:00:00 2001 From: Yukan Date: Mon, 18 Dec 2023 23:23:10 +0800 Subject: [PATCH 4/5] release v0.26.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8ecb9e6ec..6f68ab457 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "xverse-web-extension", "description": "A Bitcoin wallet for Web3", - "version": "0.26.0", + "version": "0.26.1", "private": true, "engines": { "node": "^18.18.2" From a087c0d242379042b3c42bb9830b01df0d29f16c Mon Sep 17 00:00:00 2001 From: Yukan Date: Mon, 18 Dec 2023 23:29:55 +0800 Subject: [PATCH 5/5] package-lock update --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index a23843935..ff73ffab8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "xverse-web-extension", - "version": "0.26.0", + "version": "0.26.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "xverse-web-extension", - "version": "0.26.0", + "version": "0.26.1", "dependencies": { "@ledgerhq/hw-transport-webusb": "^6.27.13", "@phosphor-icons/react": "^2.0.10",