IpfsMetadataStorage
@bosonprotocol/ipfs-storage / Exports / IpfsMetadataStorage
Class: IpfsMetadataStorage
MetadataStorage
implementation for IPFS.
Hierarchy
↳
IpfsMetadataStorage
Implements
MetadataStorage
Table of contents
Constructors
Properties
Methods
Constructors
constructor
• new IpfsMetadataStorage(opts
)
Parameters
Name | Type |
---|---|
opts | Options |
Overrides
Defined in
Properties
ipfsClient
• ipfsClient: IPFSHTTPClient
Inherited from
Defined in
Methods
add
▸ add(value
): Promise
<string
>
Parameters
Name | Type |
---|---|
value | ImportCandidate |
Returns
Promise
<string
>
Inherited from
Defined in
get
▸ get<T
>(uriOrHash
, asJson?
): Promise
<string
| T
>
Type parameters
Name |
---|
T |
Parameters
Name | Type | Default value |
---|---|---|
uriOrHash | string | undefined |
asJson | boolean | true |
Returns
Promise
<string
| T
>
Inherited from
Defined in
getByCID
▸ getByCID<T
>(cid
, asJson?
): Promise
<string
| T
>
Type parameters
Name |
---|
T |
Parameters
Name | Type | Default value |
---|---|---|
cid | string | undefined |
asJson | boolean | true |
Returns
Promise
<string
| T
>
Inherited from
Defined in
getByURL
▸ getByURL<T
>(url
, asJson?
): Promise
<string
| T
>
Type parameters
Name |
---|
T |
Parameters
Name | Type | Default value |
---|---|---|
url | string | undefined |
asJson | boolean | true |
Returns
Promise
<string
| T
>
Inherited from
Defined in
getMetadata
▸ getMetadata(metadataUriOrHash
): Promise
<AnyMetadata
>
Returns supported offer metadata from IPFS. Throws if fetched JSON doesn't conform to supported types.
Parameters
Name | Type |
---|---|
metadataUriOrHash | string |
Returns
Promise
<AnyMetadata
>
Offer metadata.
Implementation of
MetadataStorage.getMetadata
Defined in
storeMetadata
▸ storeMetadata(metadata
): Promise
<string
>
Validates and stores supported offer metadata on IPFS.
Parameters
Name | Type | Description |
---|---|---|
metadata | AnyMetadata | Offer metadata of type BASE or PRODUCT_V1 . |
Returns
Promise
<string
>
Metadata CID.
Implementation of
MetadataStorage.storeMetadata