Options
All
  • Public
  • Public/Protected
  • All
Menu

Caip10Link stream implementation

Hierarchy

  • Stream
    • Caip10Link

Implements

  • Subscribable<StreamState>
  • StreamStateHolder

Index

Constructors

constructor

  • new Caip10Link(state$: RunningStateLike, _context: Context): Caip10Link
  • Parameters

    • state$: RunningStateLike
    • _context: Context

    Returns Caip10Link

Properties

operator

operator: Operator<any, StreamState> | undefined
deprecated

Internal implementation detail, do not use directly. Will be made internal in v8.

source

source: Observable<any> | undefined
deprecated

Internal implementation detail, do not use directly. Will be made internal in v8.

Protected Readonly state$

state$: RunningStateLike

Static STREAM_TYPE_ID

STREAM_TYPE_ID: number = 1

Static STREAM_TYPE_NAME

STREAM_TYPE_NAME: string = "caip10-link"

Static create

create: (...args: any[]) => any

Creates a new Observable by calling the Observable constructor

owner

Observable

method

create

param

the subscriber function to be passed to the Observable constructor

returns

a new observable

nocollapse
deprecated

Use new Observable() instead. Will be removed in v8.

Type declaration

    • (...args: any[]): any
    • Parameters

      • Rest ...args: any[]

      Returns any

Accessors

allCommitIds

  • get allCommitIds(): Array<CommitID>
  • Returns Array<CommitID>

anchorCommitIds

  • get anchorCommitIds(): Array<CommitID>

api

  • get api(): CeramicApi
  • Returns CeramicApi

commitId

  • get commitId(): CommitID
  • Returns CommitID

content

  • get content(): any
  • Returns any

controllers

  • get controllers(): Array<string>
  • Returns Array<string>

did

  • get did(): string | null

id

  • get id(): StreamID
  • Returns StreamID

isReadOnly

  • get isReadOnly(): boolean

metadata

  • get metadata(): StreamMetadata
  • Returns StreamMetadata

state

  • get state(): StreamState
  • Returns StreamState

tip

  • get tip(): CID
  • Returns CID

Methods

forEach

  • forEach(next: (value: StreamState) => void): Promise<void>
  • forEach(next: (value: StreamState) => void, promiseCtor: PromiseConstructorLike): Promise<void>
  • Used as a NON-CANCELLABLE means of subscribing to an observable, for use with APIs that expect promises, like async/await. You cannot unsubscribe from this.

    WARNING: Only use this with observables you know will complete. If the source observable does not complete, you will end up with a promise that is hung up, and potentially all of the state of an async function hanging out in memory. To avoid this situation, look into adding something like {@link timeout}, {@link take}, {@link takeWhile}, or {@link takeUntil} amongst others.

    Example:

    import { interval } from 'rxjs';
    import { take } from 'rxjs/operators';
    
    const source$ = interval(1000).pipe(take(4));
    
    async function getTotal() {
       let total = 0;
    
       await source$.forEach(value => {
         total += value;
         console.log('observable -> ', value);
       });
    
       return total;
    }
    
    getTotal().then(
       total => console.log('Total:', total)
    )
    
    // Expected:
    // "observable -> 0"
    // "observable -> 1"
    // "observable -> 2"
    // "observable -> 3"
    // "Total: 6"
    

    Parameters

    • next: (value: StreamState) => void

      a handler for each value emitted by the observable

        • (value: StreamState): void
        • Parameters

          • value: StreamState

          Returns void

    Returns Promise<void>

    a promise that either resolves on observable completion or rejects with the handled error

  • deprecated

    Passing a Promise constructor will no longer be available in upcoming versions of RxJS. This is because it adds weight to the library, for very little benefit. If you need this functionality, it is recommended that you either polyfill Promise, or you create an adapter to convert the returned native promise to whatever promise implementation you wanted. Will be removed in v8.

    Parameters

    • next: (value: StreamState) => void

      a handler for each value emitted by the observable

        • (value: StreamState): void
        • Parameters

          • value: StreamState

          Returns void

    • promiseCtor: PromiseConstructorLike

      a constructor function used to instantiate the Promise

    Returns Promise<void>

    a promise that either resolves on observable completion or rejects with the handled error

lift

  • lift<R>(operator?: Operator<StreamState, R>): Observable<R>
  • Creates a new Observable, with this Observable instance as the source, and the passed operator defined as the new observable's operator.

    method

    lift

    deprecated

    Internal implementation detail, do not use directly. Will be made internal in v8. If you have implemented an operator using lift, it is recommended that you create an operator by simply returning new Observable() directly. See "Creating new operators from scratch" section here: https://rxjs.dev/guide/operators

    Type parameters

    • R

    Parameters

    • Optional operator: Operator<StreamState, R>

      the operator defining the operation to take on the observable

    Returns Observable<R>

    a new observable with the Operator applied

makeCommit

  • makeCommit(proof: LinkProof): RawCommit

makeReadOnly

  • makeReadOnly(): void

pipe

  • pipe(): Observable<StreamState>
  • pipe<A>(op1: OperatorFunction<StreamState, A>): Observable<A>
  • pipe<A, B>(op1: OperatorFunction<StreamState, A>, op2: OperatorFunction<A, B>): Observable<B>
  • pipe<A, B, C>(op1: OperatorFunction<StreamState, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>): Observable<C>
  • pipe<A, B, C, D>(op1: OperatorFunction<StreamState, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>): Observable<D>
  • pipe<A, B, C, D, E>(op1: OperatorFunction<StreamState, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>): Observable<E>
  • pipe<A, B, C, D, E, F>(op1: OperatorFunction<StreamState, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>): Observable<F>
  • pipe<A, B, C, D, E, F, G>(op1: OperatorFunction<StreamState, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>): Observable<G>
  • pipe<A, B, C, D, E, F, G, H>(op1: OperatorFunction<StreamState, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>): Observable<H>
  • pipe<A, B, C, D, E, F, G, H, I>(op1: OperatorFunction<StreamState, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, op9: OperatorFunction<H, I>): Observable<I>
  • pipe<A, B, C, D, E, F, G, H, I>(op1: OperatorFunction<StreamState, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, op9: OperatorFunction<H, I>, ...operations: OperatorFunction<any, any>[]): Observable<unknown>
  • Returns Observable<StreamState>

  • Type parameters

    • A

    Parameters

    • op1: OperatorFunction<StreamState, A>

    Returns Observable<A>

  • Type parameters

    • A

    • B

    Parameters

    • op1: OperatorFunction<StreamState, A>
    • op2: OperatorFunction<A, B>

    Returns Observable<B>

  • Type parameters

    • A

    • B

    • C

    Parameters

    • op1: OperatorFunction<StreamState, A>
    • op2: OperatorFunction<A, B>
    • op3: OperatorFunction<B, C>

    Returns Observable<C>

  • Type parameters

    • A

    • B

    • C

    • D

    Parameters

    • op1: OperatorFunction<StreamState, A>
    • op2: OperatorFunction<A, B>
    • op3: OperatorFunction<B, C>
    • op4: OperatorFunction<C, D>

    Returns Observable<D>

  • Type parameters

    • A

    • B

    • C

    • D

    • E

    Parameters

    • op1: OperatorFunction<StreamState, A>
    • op2: OperatorFunction<A, B>
    • op3: OperatorFunction<B, C>
    • op4: OperatorFunction<C, D>
    • op5: OperatorFunction<D, E>

    Returns Observable<E>

  • Type parameters

    • A

    • B

    • C

    • D

    • E

    • F

    Parameters

    • op1: OperatorFunction<StreamState, A>
    • op2: OperatorFunction<A, B>
    • op3: OperatorFunction<B, C>
    • op4: OperatorFunction<C, D>
    • op5: OperatorFunction<D, E>
    • op6: OperatorFunction<E, F>

    Returns Observable<F>

  • Type parameters

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    Parameters

    • op1: OperatorFunction<StreamState, A>
    • op2: OperatorFunction<A, B>
    • op3: OperatorFunction<B, C>
    • op4: OperatorFunction<C, D>
    • op5: OperatorFunction<D, E>
    • op6: OperatorFunction<E, F>
    • op7: OperatorFunction<F, G>

    Returns Observable<G>

  • Type parameters

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    Parameters

    • op1: OperatorFunction<StreamState, A>
    • op2: OperatorFunction<A, B>
    • op3: OperatorFunction<B, C>
    • op4: OperatorFunction<C, D>
    • op5: OperatorFunction<D, E>
    • op6: OperatorFunction<E, F>
    • op7: OperatorFunction<F, G>
    • op8: OperatorFunction<G, H>

    Returns Observable<H>

  • Type parameters

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    • I

    Parameters

    • op1: OperatorFunction<StreamState, A>
    • op2: OperatorFunction<A, B>
    • op3: OperatorFunction<B, C>
    • op4: OperatorFunction<C, D>
    • op5: OperatorFunction<D, E>
    • op6: OperatorFunction<E, F>
    • op7: OperatorFunction<F, G>
    • op8: OperatorFunction<G, H>
    • op9: OperatorFunction<H, I>

    Returns Observable<I>

  • Type parameters

    • A

    • B

    • C

    • D

    • E

    • F

    • G

    • H

    • I

    Parameters

    • op1: OperatorFunction<StreamState, A>
    • op2: OperatorFunction<A, B>
    • op3: OperatorFunction<B, C>
    • op4: OperatorFunction<C, D>
    • op5: OperatorFunction<D, E>
    • op6: OperatorFunction<E, F>
    • op7: OperatorFunction<F, G>
    • op8: OperatorFunction<G, H>
    • op9: OperatorFunction<H, I>
    • Rest ...operations: OperatorFunction<any, any>[]

    Returns Observable<unknown>

requestAnchor

setDid

  • setDid(did: string | DID, authProvider: AuthProvider, opts?: UpdateOpts): Promise<void>
  • Given a DID and an AuthProvider which includes support for the CAIP2 chainid of the CAIP10 address that this Caip10Link represents, updates this Caip10Link to create a verifiable link from the CAIP10 address to the DID.

    Parameters

    • did: string | DID

      The DID being linked to the CAIP10 address that this Caip10Link object represents. If the 'did' provided is an instance of the DID type, the DID must already be authenticated so that the did string it represents is avapilable.

    • authProvider: AuthProvider

      AuthProvider instance from the "@ceramicnetwork/blockchain-utils-linking" package. Must include support for the blockchain that the CAIP10 address associated with this Caip10Link lives on.

    • Default value opts: UpdateOpts = {}

      Additional options

    Returns Promise<void>

setDidProof

  • setDidProof(proof: LinkProof, opts?: UpdateOpts): Promise<void>
  • Given a LinkProof proving the relationship between a DID and a CAIP10 account, updates this CAIP10Link to contain the proof, thereby making the link from the CAIP10 address to the DID publicly discoverable.

    Parameters

    • proof: LinkProof

      LinkProof as generated by the "@ceramicnetwork/blockchain-utils-linking" package

    • Default value opts: UpdateOpts = {}

      Additional options

    Returns Promise<void>

subscribe

  • subscribe(observer?: Partial<Observer<StreamState>>): Subscription
  • subscribe(next: (value: StreamState) => void): Subscription
  • subscribe(next?: ((value: StreamState) => void) | null, error?: ((error: any) => void) | null, complete?: (() => void) | null): Subscription
  • Parameters

    • Optional observer: Partial<Observer<StreamState>>

    Returns Subscription

  • Parameters

    • next: (value: StreamState) => void
        • (value: StreamState): void
        • Parameters

          • value: StreamState

          Returns void

    Returns Subscription

  • deprecated

    Instead of passing separate callback arguments, use an observer argument. Signatures taking separate callback arguments will be removed in v8. Details: https://rxjs.dev/deprecations/subscribe-arguments

    Parameters

    • Optional next: ((value: StreamState) => void) | null
    • Optional error: ((error: any) => void) | null
    • Optional complete: (() => void) | null

    Returns Subscription

sync

  • sync(opts?: LoadOpts): Promise<void>
  • Parameters

    • Optional opts: LoadOpts

    Returns Promise<void>

toPromise

  • toPromise(): Promise<StreamState | undefined>
  • toPromise(PromiseCtor: typeof Promise): Promise<StreamState | undefined>
  • toPromise(PromiseCtor: PromiseConstructorLike): Promise<StreamState | undefined>
  • deprecated

    Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise

    Returns Promise<StreamState | undefined>

  • deprecated

    Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise

    Parameters

    • PromiseCtor: typeof Promise

    Returns Promise<StreamState | undefined>

  • deprecated

    Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise

    Parameters

    • PromiseCtor: PromiseConstructorLike

    Returns Promise<StreamState | undefined>

Static fromAccount

  • fromAccount(ceramic: CeramicApi, accountId: string | AccountID, opts?: CreateOpts | LoadOpts): Promise<Caip10Link>
  • Creates a Caip10Link for the given CAIP10 address. Initially created without a link to any DID, use 'setDid' to create the public link between the given CAIP10 account and a DID.

    Parameters

    • ceramic: CeramicApi

      Instance of CeramicAPI used to communicate with the Ceramic network

    • accountId: string | AccountID

      Blockchain account id in CAIP10 format.

    • Default value opts: CreateOpts | LoadOpts = {}

      Additional options.

    Returns Promise<Caip10Link>

Static fromGenesis

  • fromGenesis(ceramic: CeramicApi, genesisCommit: GenesisCommit, opts?: CreateOpts | LoadOpts): Promise<Caip10Link>
  • Create Caip10Link from the genesis commit

    Parameters

    • ceramic: CeramicApi

      Instance of CeramicAPI used to communicate with the Ceramic network

    • genesisCommit: GenesisCommit

      Genesis commit (first commit in stream log)

    • Default value opts: CreateOpts | LoadOpts = {}

      Additional options

    Returns Promise<Caip10Link>

Static load

  • load(ceramic: CeramicApi, streamId: StreamID | CommitID | string, opts?: LoadOpts): Promise<Caip10Link>
  • Loads a Caip10Link from a given StreamID

    Parameters

    • ceramic: CeramicApi

      Instance of CeramicAPI used to communicate with the Ceramic network

    • streamId: StreamID | CommitID | string

      StreamID to load. Must correspond to a Caip10Link

    • Default value opts: LoadOpts = {}

      Additional options

    Returns Promise<Caip10Link>

Static makeGenesis