Skip to content

Commit 5a5db05

Browse files
authored
Merge pull request #2 from joshdoman/testnet4-support
Testnet4 Support (close #1)
2 parents 06d9f8c + 390ebd0 commit 5a5db05

5 files changed

Lines changed: 253 additions & 26 deletions

File tree

package-lock.json

Lines changed: 145 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@
2020
"@radix-ui/react-slot": "^1.1.0",
2121
"@radix-ui/react-tabs": "^1.1.0",
2222
"@radix-ui/react-toast": "^1.2.1",
23+
"@scure/base": "^1.1.9",
24+
"@scure/btc-signer": "^1.4.0",
2325
"@trezor/connect-web": "^9.4.2",
2426
"bs58check": "^4.0.0",
2527
"class-variance-authority": "^0.7.0",
2628
"clsx": "^2.1.1",
2729
"ledger-bitcoin": "^0.2.3",
2830
"lucide-react": "^0.408.0",
31+
"micro-ordinals": "^0.1.1",
2932
"react": "^18.3.1",
3033
"react-dom": "^18.3.1",
3134
"shamir-secret-sharing": "^0.0.3",

src/components/Inscribe.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ interface InscribeProps {
1313

1414
const Inscribe: React.FC<InscribeProps> = ({ descriptor, setDescriptor }) => {
1515
const [encryptedData, setEncryptedData] = useState<string>('');
16+
const [isTestnet, setIsTestnet] = useState<boolean>(false);
1617
const [encryptWarning, setEncryptWarning] = useState<string>('');
1718
const [encryptError, setEncryptError] = useState<string>('');
1819

@@ -24,8 +25,9 @@ const Inscribe: React.FC<InscribeProps> = ({ descriptor, setDescriptor }) => {
2425
throw new Error('Please enter a descriptor');
2526
}
2627

27-
const { encryptedText, missingXfps } = await encrypt(descriptor);
28+
const { encryptedText, missingXfps, isTestnet } = await encrypt(descriptor);
2829
setEncryptedData(encryptedText);
30+
setIsTestnet(isTestnet);
2931

3032
if (missingXfps) {
3133
setEncryptWarning(`
@@ -39,6 +41,8 @@ const Inscribe: React.FC<InscribeProps> = ({ descriptor, setDescriptor }) => {
3941
}
4042
};
4143

44+
const inscribeUrl = isTestnet ? 'https://testnet4.btcscribe.org' : 'https://btcscribe.org';
45+
4246
return (
4347
<>
4448
<Input
@@ -58,8 +62,8 @@ const Inscribe: React.FC<InscribeProps> = ({ descriptor, setDescriptor }) => {
5862
<>
5963
<CopyableTextarea value={encryptedData} />
6064
<Button variant="outline" className="w-full" asChild>
61-
<a href={`https://btcscribe.org?msg=${encodeURIComponent(encryptedData)}`} target="_blank">
62-
Inscribe on Bitcoin
65+
<a href={`${inscribeUrl}?msg=${encodeURIComponent(encryptedData)}`} target="_blank">
66+
{isTestnet ? "Inscribe on Testnet4" : "Inscribe on Bitcoin"}
6367
</a>
6468
</Button>
6569
</>

0 commit comments

Comments
 (0)