Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Hierarchy

  • Ceramic

Implements

  • CeramicApi

Index

Constructors

constructor

Properties

Readonly _streamHandlers

_streamHandlers: HandlersMap

Readonly context

context: Context

Readonly dispatcher

dispatcher: Dispatcher

Readonly loggerProvider

loggerProvider: LoggerProvider

Readonly pin

pin: PinApi

Readonly repository

repository: Repository

Accessors

did

  • get did(): DID | undefined
  • set did(did: DID): void
  • Get DID

    Returns DID | undefined

  • 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

ipfs

Methods

_ensureGenesis

  • _ensureGenesis(genesis: CeramicCommit, streamRef: StreamRef): 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

    Returns Promise<void>

_init

  • _init(doPeerDiscovery: boolean): 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>

addStreamHandler

  • addStreamHandler<T>(streamHandler: StreamHandler<T>): void
  • Register new stream handler

    Type parameters

    • T: Stream

    Parameters

    • streamHandler: StreamHandler<T>

      Stream type handler

    Returns void

applyCommit

  • applyCommit<T>(streamId: string | StreamID, commit: CeramicCommit, opts?: CreateOpts | UpdateOpts): Promise<T>
  • Applies commit on a given stream

    Type parameters

    • T: Stream

    Parameters

    • streamId: string | StreamID

      Stream ID

    • commit: CeramicCommit

      Commit to be applied

    • Default value opts: CreateOpts | UpdateOpts = {}

      Initialization options

    Returns Promise<T>

close

  • close(): Promise<void>

createStreamFromGenesis

  • createStreamFromGenesis<T>(type: number, genesis: any, opts?: CreateOpts): Promise<T>
  • Creates stream from genesis commit

    Type parameters

    • T: Stream

    Parameters

    • type: number

      Stream type

    • genesis: any

      Genesis CID

    • Default value opts: CreateOpts = {}

      Initialization options

    Returns Promise<T>

getSupportedChains

  • getSupportedChains(): Promise<Array<string>>
  • Returns Promise<Array<string>>

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

loadStream

  • loadStream<T>(streamId: StreamID | CommitID | string, opts?: LoadOpts): Promise<T>
  • Load stream type instance

    Type parameters

    • T: Stream

    Parameters

    • streamId: StreamID | CommitID | string

      Stream ID

    • Default value opts: LoadOpts = {}

      Initialization options

    Returns Promise<T>

loadStreamCommits

  • loadStreamCommits(streamId: string | StreamID): Promise<Record<string, any>[]>
  • Load all stream commits by stream ID

    Parameters

    • streamId: string | StreamID

      Stream ID

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

multiQuery

  • multiQuery(queries: Array<MultiQuery>, timeout?: number): Promise<Record<string, Stream>>
  • Load all stream types instances for given multiqueries

    Parameters

    • queries: Array<MultiQuery>

      Array of MultiQueries

    • Default value timeout: number = 7000

      Timeout in milliseconds

    Returns Promise<Record<string, Stream>>

requestAnchor

  • requestAnchor(streamId: string | StreamID, opts?: LoadOpts): Promise<AnchorStatus>
  • 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
    • Default value opts: LoadOpts = {}

      used to load the current Stream state

    Returns Promise<AnchorStatus>

setDID

  • setDID(did: DID): Promise<void>

Static _processConfig

Static create