Skip to content

Commit

Permalink
Merge branch 'develop' into chore/refactor-workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
teebszet committed Dec 19, 2023
2 parents 907a62b + a2dd05a commit 689ef57
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 13 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
12 changes: 9 additions & 3 deletions src/app/screens/confirmFtTransaction/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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();

Expand Down
4 changes: 2 additions & 2 deletions src/app/screens/confirmNftTransaction/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions src/app/screens/confirmStxTransaction/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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' });
Expand Down
6 changes: 3 additions & 3 deletions src/app/screens/transactionRequest/index.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -10,6 +9,7 @@ import {
ContractFunction,
createDeployContractRequest,
extractFromPayload,
fetchStxPendingTxData,
} from '@secretkeylabs/xverse-core';
import { StacksTransaction } from '@stacks/transactions';
import { getNetworkType, isHardwareAccount } from '@utils/helper';
Expand Down Expand Up @@ -39,19 +39,19 @@ function TransactionRequest() {
const [coinsMetaData, setCoinsMetaData] = useState<Coin[] | null>(null);
const [codeBody, setCodeBody] = useState(undefined);
const [contractName, setContractName] = useState(undefined);
const stxPendingTxData = useStxPendingTxData();
const [hasSwitchedAccount, setHasSwitchedAccount] = useState(false);
const [attachment, setAttachment] = useState<Buffer | undefined>(undefined);

const handleTokenTransferRequest = async () => {
const stxPendingTxData = await fetchStxPendingTxData(stxAddress, selectedNetwork);
const unsignedSendStxTx = await getTokenTransferRequest(
payload.recipient,
payload.amount,
payload.memo!,
stxPublicKey,
feeMultipliers!,
selectedNetwork,
stxPendingTxData,
stxPendingTxData || [],
);
setUnsignedTx(unsignedSendStxTx);
navigate('/confirm-stx-tx', {
Expand Down

0 comments on commit 689ef57

Please sign in to comment.