Getting Started
Last updated
Last updated
The package supports storing and reading a hat's metadata from IPFS.
Data is stored in a JSON format, and follows a custom schema which is passed by the user at the client's initialization. By using a schema for the data, we're able to validate that the data is compatible with an expected format.
The package uses the library for the schema definition and validation. The schema is also used for type inference, providing type-safety for its users.
yarn:
npm:
A HatsDetailsClient instance is initialized with an IPFS provider (currently only is supported) and a schema, defined with the library.
If the client is initialized without a custom schema, then the default schema will be used. This schema is compatible with the , meaning that this app will properly display hats with this type of details.
Here's the default schema:
The corresponding type for this schema is:
You can define a custom schema for the client, for example:
The client is initialized with an IPFS provider that will be used for storing and reading to/from IPFS. Currently, Pinata is the only supported provider and is initialized with the following properties:
pinningKey
- this as a JWT that's used for pinning data, and is required at the client's initialization.
gatewayKey
- optional key that is used to secure dedicated Pinata gateways. If provided along with a gateway, then the key will be used for fetching data.
gateway
- a dedicated gateway URL, that's provided by Pinata and is used to read IPFS data. This property is optional. If not, provided then the default gateway that's provided by will be used.