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

ipfs

Methods

_init

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

    • restoreStreams: boolean

      Controls whether we attempt to load pinned stream state into memory at startup

    Returns Promise<void>

_loadStream

  • _loadStream(streamId: StreamID, opts: LoadOpts): Promise<RunningState>

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 record

    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

    • Optional timeout: number

      Timeout in milliseconds

    Returns Promise<Record<string, Stream>>

restoreStreams

  • restoreStreams(): void

setDID

  • setDID(did: DID): Promise<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 Promise<void>

Static _cleanupConfigForLogging

  • _cleanupConfigForLogging(config: CeramicConfig): Record<string, any>
  • Takes a CeramicConfig and returns an object that can be logged containing the relevant properties of the config, but with complex objects removed or replaced with strings or simple objects containing their relevant pieces.

    Parameters

    Returns Record<string, any>

Static _processConfig

Static create