The ordinalImage.tsx
file contains a React component named OrdinalImage
.
This component is designed to facilitate the inscription of images using the OrdiNFTP2PKH
class from the scrypt-ord library.
Let's break down the key features of this component.
The component starts by importing necessary dependencies and initializing state variables using the useState hook. It also defines a Ref for handling text input.
The connected()
function checks whether the user is connected by verifying the existence of the _ordiAddress
variable.
The component uses the ImageUploading
component for handling image selection. It provides buttons for uploading, removing, and inscribing selected images.
The component renders a user interface with a title, image selection buttons, and a button to inscribe the selected image. The result of the inscription is displayed below the UI.
If the user is not connected (!connected()
), the component redirects the user to the home page using the Navigate component from React Router.
_ordiAddress
to create a OrdiNFTP2PKH
instance.instance.connect()
to connect a signer.inscribeImage
method of the instance to inscribe a image.Complete code at Github