Ceramic core implementation.

To install this library:
$ npm install --save @ceramicnetwork/core

Hierarchy

  • Ceramic

Implements

  • StreamReaderWriter
  • StreamStateLoader

Constructors

Properties

_streamHandlers: HandlersMap
admin: AdminApi
anchorService: AnchorService
dispatcher: Dispatcher
feed: PublicFeed
loggerProvider: LoggerProvider
repository: Repository

Accessors

  • get did(): DID
  • Get DID. This should only be used if you need to interrogate the DID that was set for this ceramic. For most instances, prefer signer, as it has the necessary information for creating and verifying signatures.

    Returns DID

  • set did(did: DID): void
  • Sets the DID instance that will be used to author commits to streams. The DID instance also includes the DID Resolver that will be used to verify commits from others.

    Parameters

    • did: DID

    Returns void

  • get signer(): CeramicSigner
  • Get the signer for this ceramic, used in creating and verifying signatures. This should be used for all of those instances rather than did, since the signer has any additional logic related to creating and verifying signatures.

    Returns CeramicSigner

Methods

  • Used at startup to do a sanity check that the IPFS node has the commit data for pinned streams as expected.

    Returns Promise<void>

  • Used to ensure that the given genesis commit contents already exist on IPFS so we don't time out trying to load it.

    Parameters

    • genesis: CeramicCommit
    • streamRef: StreamRef
    • opts: LoadOpts

    Returns Promise<void>

  • Finishes initialization and startup of a Ceramic instance. This usually should not be called directly - most users will prefer to call Ceramic.create() instead which calls this internally.

    Parameters

    • doPeerDiscovery: boolean

      Controls whether we connect to the "peerlist" to manually perform IPFS peer discovery

    Returns Promise<void>

  • Runs some checks at node startup to ensure that the node is healthy and properly configured. Throws an Error if any issues are detected

    Returns Promise<void>

  • Register new stream handler

    Type Parameters

    • T extends Stream<T>

    Parameters

    • streamHandler: StreamHandler<T>

      Stream type handler

    Returns void

  • Applies commit on a given stream

    Type Parameters

    • T extends Stream<T>

    Parameters

    • streamId: string | StreamID

      Stream ID

    • commit: CeramicCommit

      Commit to be applied

    • opts: UpdateOpts = {}

      Initialization options

    Returns Promise<T>

  • Turns +state+ into a Stream instance of the appropriate StreamType. Does not add the resulting instance to a cache.

    Type Parameters

    • T extends Stream<T> = Stream

    Parameters

    • state: StreamState<StreamMetadata>

      StreamState for a stream.

    Returns T

  • Creates stream from genesis commit

    Type Parameters

    • T extends Stream<T>

    Parameters

    • type: number

      Stream type

    • genesis: any

      Genesis CID

    • opts: CreateOpts = {}

      Initialization options

    Returns Promise<T>

  • Returns

    An array of the CAIP-2 chain IDs of the blockchains that are supported for anchoring streams.

    Returns Promise<string[]>

  • Load stream type instance

    Type Parameters

    • T extends Stream<T>

    Parameters

    • streamId: string | StreamID | CommitID

      Stream ID

    • opts: LoadOpts = {}

      Initialization options

    Returns Promise<T>

  • Load all stream commits by stream ID

    Parameters

    • streamId: string | StreamID

      Stream ID

    Returns Promise<Record<string, any>[]>

  • Load stream state for indexing queries, bypassing the stream cache and repository loading queue

    Parameters

    • streamId: StreamID

      Stream ID

    Returns Promise<StreamState<StreamMetadata>>

  • Load all stream types instances for given multiqueries

    Parameters

    • queries: MultiQuery[]

      Array of MultiQueries

    • timeout: number = 7000

      Timeout in milliseconds

    Returns Promise<Record<string, Stream>>

  • Requests an anchor for the given StreamID if the Stream isn't already anchored. Returns the new AnchorStatus for the Stream.

    Parameters

    • streamId: string | StreamID
    • opts: LoadOpts & AnchorOpts = {}

      used to load the current Stream state

    Returns Promise<AnchorStatus>