Skip to content

Commit

Permalink
feat: ord io inscription links, closes #3980
Browse files Browse the repository at this point in the history
  • Loading branch information
alter-eggo committed Mar 19, 2024
1 parent b0eb524 commit 35f4ec0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/app/features/collectibles/components/bitcoin/inscription.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useLocation, useNavigate } from 'react-router-dom';

import { ORD_IO_URL } from '@shared/constants';
import { Inscription as InscriptionType } from '@shared/models/inscription.model';
import { RouteUrls } from '@shared/route-urls';

Expand All @@ -16,6 +17,11 @@ import { InscriptionText } from './inscription-text';
interface InscriptionProps {
rawInscription: InscriptionType;
}

function openInscriptionUrl(num: number) {
return openInNewTab(`${ORD_IO_URL}/${num}`);
}

export function Inscription({ rawInscription }: InscriptionProps) {
const inscription = convertInscriptionToSupportedInscriptionType(rawInscription);
const navigate = useNavigate();
Expand All @@ -33,7 +39,7 @@ export function Inscription({ rawInscription }: InscriptionProps) {
<CollectibleAudio
icon={<OrdinalAvatarIcon size="lg" />}
key={inscription.title}
onClickCallToAction={() => openInNewTab(inscription.infoUrl)}
onClickCallToAction={() => openInscriptionUrl(inscription.number)}
onClickSend={() => openSendInscriptionModal()}
subtitle="Ordinal inscription"
title={`# ${inscription.number}`}
Expand All @@ -46,7 +52,7 @@ export function Inscription({ rawInscription }: InscriptionProps) {
<CollectibleIframe
icon={<OrdinalAvatarIcon size="lg" />}
key={inscription.title}
onClickCallToAction={() => openInNewTab(inscription.infoUrl)}
onClickCallToAction={() => openInscriptionUrl(inscription.number)}
onClickSend={() => openSendInscriptionModal()}
src={inscription.src}
subtitle="Ordinal inscription"
Expand All @@ -58,7 +64,7 @@ export function Inscription({ rawInscription }: InscriptionProps) {
<CollectibleImage
icon={<OrdinalAvatarIcon size="lg" />}
key={inscription.title}
onClickCallToAction={() => openInNewTab(inscription.infoUrl)}
onClickCallToAction={() => openInscriptionUrl(inscription.number)}
onClickSend={() => openSendInscriptionModal()}
src={inscription.src}
subtitle="Ordinal inscription"
Expand All @@ -70,15 +76,15 @@ export function Inscription({ rawInscription }: InscriptionProps) {
<InscriptionText
contentSrc={inscription.contentSrc}
inscriptionNumber={inscription.number}
onClickCallToAction={() => openInNewTab(inscription.infoUrl)}
onClickCallToAction={() => openInscriptionUrl(inscription.number)}
onClickSend={() => openSendInscriptionModal()}
/>
);
case 'other':
return (
<CollectibleOther
key={inscription.title}
onClickCallToAction={() => openInNewTab(inscription.infoUrl)}
onClickCallToAction={() => openInscriptionUrl(inscription.number)}
onClickSend={() => openSendInscriptionModal()}
subtitle="Ordinal inscription"
title={`# ${inscription.number}`}
Expand Down
2 changes: 2 additions & 0 deletions src/shared/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ export const BITCOIN_API_BASE_URL_MAINNET = 'https://blockstream.info/api';
export const BITCOIN_API_BASE_URL_TESTNET = 'https://blockstream.info/testnet/api';
const BITCOIN_API_BASE_URL_SIGNET = 'https://mempool.space/signet/api';

export const ORD_IO_URL = 'https://ord.io';

const networkMainnet: NetworkConfiguration = {
id: WalletDefaultNetworkConfigurationIds.mainnet,
name: 'Mainnet',
Expand Down

0 comments on commit 35f4ec0

Please sign in to comment.