Skip to content

Commit

Permalink
Merge pull request #263 from echennells/main
Browse files Browse the repository at this point in the history
Add testnet support for transaction links, corrected whatsonchain variable name
  • Loading branch information
danwag06 authored Jan 9, 2025
2 parents 5278891 + 52de08d commit d5a7b51
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/components/TxHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Theme, WhiteLabelTheme } from '../theme.types';
import { useServiceContext } from '../hooks/useServiceContext';
import { useEffect, useMemo, useState } from 'react';
import { HeaderText, Text } from './Reusable';
import { BSV_DECIMAL_CONVERSION, GENERIC_NFT_ICON, GENERIC_TOKEN_ICON, URL_WHATSINCHAIN } from '../utils/constants';
import { BSV_DECIMAL_CONVERSION, GENERIC_NFT_ICON, GENERIC_TOKEN_ICON, URL_WHATSONCHAIN, URL_WHATSONCHAIN_TESTNET } from '../utils/constants';
import { FaTimes, FaChevronDown, FaChevronUp, FaLink, FaTag } from 'react-icons/fa'; // Import FaTag
import { TxLog } from 'spv-store';
import { Button } from './Button';
Expand Down Expand Up @@ -132,6 +132,7 @@ export const TxHistory = (props: TxHistoryProps) => {
const itemsPerPage = 25;
const { gorillaPoolService, chromeStorageService } = useServiceContext();
const [expandedRows, setExpandedRows] = useState<Set<string>>(new Set());
const isTestnet = chromeStorageService.getNetwork() === 'testnet';

const tagPriorityOrder: Tag[] = ['list', 'bsv21', 'bsv20', 'origin', 'lock', 'fund']; // The order of these tags will determine the order of the icons and which is prioritized

Expand Down Expand Up @@ -174,7 +175,8 @@ export const TxHistory = (props: TxHistoryProps) => {
};

const handleOpenLink = (txid: string) => {
window.open(`${URL_WHATSINCHAIN}${txid}`, '_blank');
const url = isTestnet ? `${URL_WHATSONCHAIN_TESTNET}${txid}` : `${URL_WHATSONCHAIN}${txid}`;
window.open(url, '_blank');
};

const getIconForSummary = (tag: Tag, icon?: string) => {
Expand Down
3 changes: 2 additions & 1 deletion src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ export const WOC_BASE_URL = 'https://api.whatsonchain.com/v1/bsv/main';

export const WOC_TESTNET_BASE_URL = 'https://api.whatsonchain.com/v1/bsv/test';

export const URL_WHATSINCHAIN = 'https://whatsonchain.com/tx/';
export const URL_WHATSONCHAIN = 'https://whatsonchain.com/tx/';
export const URL_WHATSONCHAIN_TESTNET = 'https://test.whatsonchain.com/tx/';

export const GP_BASE_URL = 'https://ordinals.gorillapool.io';
export const JUNGLE_BUS_URL = 'https://junglebus.gorillapool.io';
Expand Down

0 comments on commit d5a7b51

Please sign in to comment.