Skip to main content

IpfsMetadataStorage

@bosonprotocol/ipfs-storage / Exports / IpfsMetadataStorage

Class: IpfsMetadataStorage

MetadataStorage implementation for IPFS.

Hierarchy

Implements

  • MetadataStorage

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new IpfsMetadataStorage(opts)

Parameters

NameType
optsOptions

Overrides

BaseIpfsStorage.constructor

Defined in

src/ipfs/metadata.ts:14

Properties

ipfsClient

ipfsClient: IPFSHTTPClient

Inherited from

BaseIpfsStorage.ipfsClient

Defined in

src/ipfs/base.ts:10

Methods

add

add(value): Promise<string>

Parameters

NameType
valueImportCandidate

Returns

Promise<string>

Inherited from

BaseIpfsStorage.add

Defined in

src/ipfs/base.ts:16


get

get<T>(uriOrHash, asJson?): Promise<string | T>

Type parameters

Name
T

Parameters

NameTypeDefault value
uriOrHashstringundefined
asJsonbooleantrue

Returns

Promise<string | T>

Inherited from

BaseIpfsStorage.get

Defined in

src/ipfs/base.ts:24


getByCID

getByCID<T>(cid, asJson?): Promise<string | T>

Type parameters

Name
T

Parameters

NameTypeDefault value
cidstringundefined
asJsonbooleantrue

Returns

Promise<string | T>

Inherited from

BaseIpfsStorage.getByCID

Defined in

src/ipfs/base.ts:42


getByURL

getByURL<T>(url, asJson?): Promise<string | T>

Type parameters

Name
T

Parameters

NameTypeDefault value
urlstringundefined
asJsonbooleantrue

Returns

Promise<string | T>

Inherited from

BaseIpfsStorage.getByURL

Defined in

src/ipfs/base.ts:55


getMetadata

getMetadata(metadataUriOrHash): Promise<AnyMetadata>

Returns supported offer metadata from IPFS. Throws if fetched JSON doesn't conform to supported types.

Parameters

NameType
metadataUriOrHashstring

Returns

Promise<AnyMetadata>

Offer metadata.

Implementation of

MetadataStorage.getMetadata

Defined in

src/ipfs/metadata.ts:37


storeMetadata

storeMetadata(metadata): Promise<string>

Validates and stores supported offer metadata on IPFS.

Parameters

NameTypeDescription
metadataAnyMetadataOffer metadata of type BASE or PRODUCT_V1.

Returns

Promise<string>

Metadata CID.

Implementation of

MetadataStorage.storeMetadata

Defined in

src/ipfs/metadata.ts:23