diff --git a/src/App.tsx b/src/App.tsx index cf86b7a..c9e558b 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -5,31 +5,14 @@ import { getAddress, getCapabilities, getProviders, - request, } from "sats-connect"; -import CreateFileInscription from "./components/createFileInscription"; -import CreateTextInscription from "./components/createTextInscription"; -import SendBitcoin from "./components/sendBitcoin"; -import SignMessage from "./components/signMessage"; import SignTransaction from "./components/signTransaction"; -// Stacks -import StxCallContract from "./components/stacks/callContract"; -import StxDeployContract from "./components/stacks/deployContract"; -import StxGetAccounts from "./components/stacks/getAccounts"; -import StxGetAddresses from "./components/stacks/getAddresses"; -import StxSignMessage from "./components/stacks/signMessage"; -import StxSignStructuredMessage from "./components/stacks/signStructuredMessage"; -import StxSignTransaction from "./components/stacks/signTransaction"; -import StxTransferStx from "./components/stacks/transferStx"; - import { useLocalStorage } from "./useLocalStorage"; import { useEffect, useMemo, useState } from "react"; import "./App.css"; -import CreateRepeatInscriptions from "./components/createRepeatInscriptions"; -import SignBulkTransaction from "./components/signBulkTransaction"; function App() { const [paymentAddress, setPaymentAddress] = useLocalStorage("paymentAddress"); @@ -44,7 +27,7 @@ function App() { useLocalStorage("stacksPublicKey"); const [network, setNetwork] = useLocalStorage( "network", - BitcoinNetworkType.Testnet + BitcoinNetworkType.Mainnet ); const [capabilityState, setCapabilityState] = useState< "loading" | "loaded" | "missing" | "cancelled" @@ -103,22 +86,6 @@ function App() { setStacksAddress(undefined); }; - const handleGetInfo = async () => { - try { - const response = await request("getInfo", null); - - if (response.status === "success") { - alert("Success. Check console for response"); - console.log(response.result); - } else { - alert("Error getting info. Check console for error logs"); - console.error(response.error); - } - } catch (err) { - console.log(err); - } - }; - const toggleNetwork = () => { setNetwork( network === BitcoinNetworkType.Testnet @@ -232,10 +199,6 @@ function App() {

Disconnect wallet

-
-

Get Wallet Info

- -
- - - - - - - - - - - - - - -

Stacks

-
-

Stacks Address: {stacksAddress}

-

Stacks PubKey: {stacksPublicKey}

-
- - - - - - - - - - - - - - - -
); diff --git a/src/components/createFileInscription.tsx b/src/components/createFileInscription.tsx deleted file mode 100644 index 9df4ef4..0000000 --- a/src/components/createFileInscription.tsx +++ /dev/null @@ -1,100 +0,0 @@ -import { useState } from "react"; -import type { Capability } from "sats-connect"; -import { BitcoinNetworkType, createInscription } from "sats-connect"; - -type Props = { - network: BitcoinNetworkType; - capabilities: Set; -}; - -const CreateBinaryInscription = ({ network, capabilities }: Props) => { - const [content, setContent] = useState(""); - const [contentType, setContentType] = useState("image/jpeg"); - - const onCreateClick = async () => { - try { - await createInscription({ - payload: { - network: { - type: network, - }, - contentType, - content, - payloadType: "BASE_64", - /** Optional parameters: - appFeeAddress, // the address where the inscription fee should go - appFee: 1000 // the amount of sats that should be sent to the fee address - */ - }, - onFinish: (response) => { - alert(response.txId); - }, - onCancel: () => alert("Canceled"), - }); - } catch (error) { - alert(`An error ocurred: ${error.message}`); - } - }; - - const onFileSelect = (e: React.ChangeEvent) => { - const selectedFile = e.target.files?.[0]; - if (!selectedFile) { - setContent(""); - return; - } - const reader = new FileReader(); - reader.onload = (e) => { - const contentString = e.target?.result as string; - if (!contentString) { - return; - } - - const base64String = contentString.split(",")[1]; - setContent(base64String); - }; - reader.readAsDataURL(selectedFile); - }; - - if (!capabilities.has("createInscription")) { - return ( -
-

Create file inscription

- The wallet does not support this feature -
- ); - } - - return ( -
-

Create file inscription

-

- Creates an inscription from a desired file with specified content type. - The inscription will be sent to your ordinals address. -

-

- A service fee and service fee address can be added to the inscription - request as part of the payload if desired. -

-
-

- Content type -
- setContentType(e.target.value)} - /> -

-

- Content -
- {content} -
- -

- -
-
- ); -}; - -export default CreateBinaryInscription; diff --git a/src/components/createRepeatInscriptions.tsx b/src/components/createRepeatInscriptions.tsx deleted file mode 100644 index f54862f..0000000 --- a/src/components/createRepeatInscriptions.tsx +++ /dev/null @@ -1,113 +0,0 @@ -import { useState } from "react"; -import type { Capability, CreateRepeatInscriptionsResponse } from "sats-connect"; -import { BitcoinNetworkType, createRepeatInscriptions } from "sats-connect"; - -type Props = { - network: BitcoinNetworkType; - capabilities: Set; -}; - -const CreateRepeatInscriptions = ({ network, capabilities }: Props) => { - const [suggestedMinerFeeRate, setSuggestedMinerFeeRate] = useState(8); - - const [content, setContent] = useState( - '{"p":"brc-20","op":"mint","tick":"doge","amt":"4200"}' - ); - const [contentType, setContentType] = useState("application/json"); - const [repeat, setRepeat] = useState("12"); - const onCreateClick = async () => { - try { - await createRepeatInscriptions({ - payload: { - network: { - type: network, - }, - repeat: Number(repeat), - contentType, - content, - payloadType: "PLAIN_TEXT", - /** Optional parameters: - appFeeAddress: "", // the address where the inscription fee should go - appFee: 1000, // the amount of sats that should be sent to the fee address - */ - suggestedMinerFeeRate, - }, - onFinish: (response: CreateRepeatInscriptionsResponse) => { - alert(response.txId); - }, - onCancel: () => alert("Canceled"), - }); - } catch (error) { - alert(`An error ocurred: ${error.message}`); - } - }; - - if (!capabilities.has("createRepeatInscriptions")) { - return ( -
-

Create repeat inscriptions

- The wallet does not support this feature. Please update your wallet -
- ); - } - - return ( -
-

Create repeat inscriptions

-

- Creates a repeat inscription with the desired text and content type. The - inscription will be sent to your ordinals address. -

-

- A service fee and service fee address can be added to the inscription - request as part of the payload if desired. -

-
-

- Repeat -
- setRepeat(e.target.value)} - /> -

-

- Content type -
- setContentType(e.target.value)} - /> -

-

- Content -
-