Usage
Once initialized, the HatsDetailsClient can be used for reading and storing data from/to IPFS, in a predetermined format.
Store
Use the the following function in order to store/pin data to IPFS.
The data is expected to be compatible with the provided schema, otherwise an error will be thrown. If data was successfully pinned, its CID (content identifier). This can then be used for reading the data back from IPFS.
Read
Read data from IPFS.
The returned data has the following type:
If data was successfully fetched and is compatible with the client's schema, then the parsed data will be in the
parsedData
field, while therawData
anderror
fields will benull
.If data was successfully fetched but is not compatible with the client's schema, then the data will be in the
rawData
field, while thedata
anderror
fields will benull
.If an error occurred, then the
data
andrawData
fields will benull
, and theerror
field will contain an object with amessage
field.
Last updated