Skip to content

Commit

Permalink
fix: check with stacks testnet instead of bitcoin testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarkhanzadian committed Dec 14, 2023
1 parent d799836 commit 81430ca
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/app/pages/home/components/account-actions.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { useLocation, useNavigate } from 'react-router-dom';

import { ChainID } from '@stacks/transactions';
import { HomePageSelectors } from '@tests/selectors/home.selectors';
import { Flex, FlexProps } from 'leather-styles/jsx';

import { bitcoinNetworkModeToCoreNetworkMode } from '@shared/crypto/bitcoin/bitcoin.utils';
import { RouteUrls } from '@shared/route-urls';
import { whenNetwork } from '@shared/utils';

import { whenStacksChainId } from '@app/common/utils';
import { useConfigBitcoinEnabled } from '@app/query/common/remote-config/remote-config.query';
import { useCurrentStacksAccount } from '@app/store/accounts/blockchain/stacks/stacks-account.hooks';
import { useCurrentNetwork } from '@app/store/networks/networks.selectors';
Expand All @@ -23,9 +23,6 @@ export function AccountActions(props: FlexProps) {
const isBitcoinEnabled = useConfigBitcoinEnabled();
const stacksAccount = useCurrentStacksAccount();
const currentNetwork = useCurrentNetwork();
const networkType = bitcoinNetworkModeToCoreNetworkMode(
currentNetwork.chain.bitcoin.bitcoinNetwork
);

const receivePath = isBitcoinEnabled
? RouteUrls.Receive
Expand All @@ -49,16 +46,16 @@ export function AccountActions(props: FlexProps) {
onClick={() => navigate(RouteUrls.FundChooseCurrency)}
/>
)}
{whenNetwork(networkType)({
mainnet: (
{whenStacksChainId(currentNetwork.chain.stacks.chainId)({
[ChainID.Mainnet]: (
<ActionButton
data-testid={HomePageSelectors.SwapBtn}
icon={<SwapIcon />}
label="Swap"
onClick={() => navigate(RouteUrls.Swap)}
/>
),
testnet: null,
[ChainID.Testnet]: null,
})}
</Flex>
);
Expand Down

0 comments on commit 81430ca

Please sign in to comment.