Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ord io inscription links, closes #3980 #5098

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading