Options
All
  • Public
  • Public/Protected
  • All
Menu

Class APIClient

Hierarchy

Index

Constructors

constructor

  • new APIClient(address: string, credentials: ChannelCredentials, options?: undefined | object): APIClient

Methods

anchorTrie

  • Anchors the trie at the given root by creating a trie proof and waiting for it to be confirmed

    Parameters

    • trie: Trie

      the trie at a root

    • Optional anchorType: ValueOfType

      the anchor type the trie proof should be submitted to. Default: Anchor.Type.ETH

    • Optional outputProgress: undefined | false | true

      whether to output the anchoring progress to stdout. Default: true

    Returns Promise<TrieProof>

close

  • close(): void
  • Returns void

createKeyValuesProof

  • createKeyValuesProof(trieId: string, proofId: string, filter: KeyValuesFilter | null, outputPath: string): Promise<void>
  • createKeyValuesProof(trieId: string, proofId: string, filter: KeyValuesFilter | null, outputPath: string, callback: grpc.requestCallback<void>): SurfaceCall
  • createKeyValuesProof(argument: CreateKeyValuesProofRequest, metadataOrOptions?: Metadata | CallOptions | null): grpc.ClientReadableStream<DataChunk>
  • createKeyValuesProof(argument: CreateKeyValuesProofRequest, metadata?: Metadata | null, options?: CallOptions | null): grpc.ClientReadableStream<DataChunk>
  • Creates a key-values proof for the provided key-values out of the given trie proof

    Parameters

    • trieId: string

      trie ID

    • proofId: string

      trie proof ID to base on. When zero (""), a new trie proof will be created on-the-fly

    • filter: KeyValuesFilter | null

      the key-values filter (optional). When null or zero, all key-values will be included in the proof

    • outputPath: string

      the key-values proof output file path

    Returns Promise<void>

  • Parameters

    • trieId: string
    • proofId: string
    • filter: KeyValuesFilter | null
    • outputPath: string
    • callback: grpc.requestCallback<void>

    Returns SurfaceCall

  • Parameters

    Returns grpc.ClientReadableStream<DataChunk>

  • Parameters

    Returns grpc.ClientReadableStream<DataChunk>

createTrie

  • createTrie(storageType?: ValueOfStorageType): Promise<Trie>
  • createTrie(callback: grpc.requestCallback<Trie>, storageType?: ValueOfStorageType): SurfaceCall
  • createTrie(argument: CreateTrieRequest, callback: grpc.requestCallback<Trie>): grpc.ClientUnaryCall
  • createTrie(argument: CreateTrieRequest, metadataOrOptions: Metadata | CallOptions | null, callback: grpc.requestCallback<Trie>): grpc.ClientUnaryCall
  • createTrie(argument: CreateTrieRequest, metadata: Metadata | null, options: CallOptions | null, callback: grpc.requestCallback<Trie>): grpc.ClientUnaryCall

createTrieFromKeyValues

createTrieProof

  • Creates a trie proof for the given trie root. When root is zero (""), the current root hash of the trie will be used, and the request will be blocked until all ongoing updates are finished

    Parameters

    • id: string

      trie Id

    • root: string

      trie root

    • Optional anchorType: ValueOfType

      the anchor type the trie proof should be submitted to. Default: Anchor.Type.ETH. You can find all available anchor types from here and their descriptions from here

    Returns Promise<TrieProof>

  • Parameters

    Returns grpc.ClientUnaryCall

  • Parameters

    Returns grpc.ClientUnaryCall

  • Parameters

    Returns grpc.ClientUnaryCall

deleteTrie

  • deleteTrie(id: string): Promise<Trie>
  • deleteTrie(id: string, callback: grpc.requestCallback<Trie>): SurfaceCall
  • deleteTrie(argument: TrieRequest, callback: grpc.requestCallback<Trie>): grpc.ClientUnaryCall
  • deleteTrie(argument: TrieRequest, metadataOrOptions: Metadata | CallOptions | null, callback: grpc.requestCallback<Trie>): grpc.ClientUnaryCall
  • deleteTrie(argument: TrieRequest, metadata: Metadata | null, options: CallOptions | null, callback: grpc.requestCallback<Trie>): grpc.ClientUnaryCall
  • Deletes the given trie

    Parameters

    • id: string

      trie ID

    Returns Promise<Trie>

  • Parameters

    • id: string
    • callback: grpc.requestCallback<Trie>

    Returns SurfaceCall

  • Parameters

    Returns grpc.ClientUnaryCall

  • Parameters

    • argument: TrieRequest
    • metadataOrOptions: Metadata | CallOptions | null
    • callback: grpc.requestCallback<Trie>

    Returns grpc.ClientUnaryCall

  • Parameters

    • argument: TrieRequest
    • metadata: Metadata | null
    • options: CallOptions | null
    • callback: grpc.requestCallback<Trie>

    Returns grpc.ClientUnaryCall

deleteTrieProof

  • deleteTrieProof(id: string, proofId: string): Promise<TrieProof>
  • deleteTrieProof(argument: DeleteTrieProofRequest, callback: grpc.requestCallback<TrieProof>): grpc.ClientUnaryCall
  • deleteTrieProof(argument: DeleteTrieProofRequest, metadataOrOptions: Metadata | CallOptions | null, callback: grpc.requestCallback<TrieProof>): grpc.ClientUnaryCall
  • deleteTrieProof(argument: DeleteTrieProofRequest, metadata: Metadata | null, options: CallOptions | null, callback: grpc.requestCallback<TrieProof>): grpc.ClientUnaryCall

exportTrie

  • exportTrie(id: string, outputPath: string): Promise<void>
  • exportTrie(id: string, outputPath: string, callback: grpc.requestCallback<void>): SurfaceCall
  • exportTrie(argument: TrieRequest, metadataOrOptions?: Metadata | CallOptions | null): grpc.ClientReadableStream<DataChunk>
  • exportTrie(argument: TrieRequest, metadata?: Metadata | null, options?: CallOptions | null): grpc.ClientReadableStream<DataChunk>
  • Exports the given trie

    Parameters

    • id: string

      trie ID

    • outputPath: string

      output file path

    Returns Promise<void>

  • Parameters

    • id: string
    • outputPath: string
    • callback: grpc.requestCallback<void>

    Returns SurfaceCall

  • Parameters

    • argument: TrieRequest
    • Optional metadataOrOptions: Metadata | CallOptions | null

    Returns grpc.ClientReadableStream<DataChunk>

  • Parameters

    • argument: TrieRequest
    • Optional metadata: Metadata | null
    • Optional options: CallOptions | null

    Returns grpc.ClientReadableStream<DataChunk>

getChannel

  • getChannel(): Channel
  • Returns Channel

getTrie

  • getTrie(id: string): Promise<Trie>
  • getTrie(argument: TrieRequest, callback: grpc.requestCallback<Trie>): grpc.ClientUnaryCall
  • getTrie(argument: TrieRequest, metadataOrOptions: Metadata | CallOptions | null, callback: grpc.requestCallback<Trie>): grpc.ClientUnaryCall
  • getTrie(argument: TrieRequest, metadata: Metadata | null, options: CallOptions | null, callback: grpc.requestCallback<Trie>): grpc.ClientUnaryCall
  • Gets a trie

    Parameters

    • id: string

      trie ID

    Returns Promise<Trie>

  • Parameters

    Returns grpc.ClientUnaryCall

  • Parameters

    • argument: TrieRequest
    • metadataOrOptions: Metadata | CallOptions | null
    • callback: grpc.requestCallback<Trie>

    Returns grpc.ClientUnaryCall

  • Parameters

    • argument: TrieRequest
    • metadata: Metadata | null
    • options: CallOptions | null
    • callback: grpc.requestCallback<Trie>

    Returns grpc.ClientUnaryCall

getTrieKeyValue

  • getTrieKeyValue(id: string, root: string, key: Key): Promise<KeyValue>
  • getTrieKeyValue(argument: TrieKeyValueRequest, callback: grpc.requestCallback<KeyValue>): grpc.ClientUnaryCall
  • getTrieKeyValue(argument: TrieKeyValueRequest, metadataOrOptions: Metadata | CallOptions | null, callback: grpc.requestCallback<KeyValue>): grpc.ClientUnaryCall
  • getTrieKeyValue(argument: TrieKeyValueRequest, metadata: Metadata | null, options: CallOptions | null, callback: grpc.requestCallback<KeyValue>): grpc.ClientUnaryCall
  • Get a key-value of the trie at the given root. When root is zero (""), the current root hash of the trie will be used, and the request will be blocked until all ongoing updates are finished

    Parameters

    • id: string

      trie ID

    • root: string

      trie root

    • key: Key

      the key of the key-value

    Returns Promise<KeyValue>

  • Parameters

    Returns grpc.ClientUnaryCall

  • Parameters

    Returns grpc.ClientUnaryCall

  • Parameters

    Returns grpc.ClientUnaryCall

getTrieKeyValues

  • getTrieKeyValues(id: string, root: string): AsyncIterable<KeyValue>
  • getTrieKeyValues(argument: TrieKeyValuesRequest, metadataOrOptions?: Metadata | CallOptions | null): grpc.ClientReadableStream<KeyValue>
  • getTrieKeyValues(argument: TrieKeyValuesRequest, metadata?: Metadata | null, options?: CallOptions | null): grpc.ClientReadableStream<KeyValue>
  • Gets the key-values of the trie at the given root. When root is zero (""), the current root hash of the trie will be used, and the request will be blocked until all ongoing updates are finished

    Parameters

    • id: string

      trie ID

    • root: string

      trie root

    Returns AsyncIterable<KeyValue>

  • Parameters

    Returns grpc.ClientReadableStream<KeyValue>

  • Parameters

    • argument: TrieKeyValuesRequest
    • Optional metadata: Metadata | null
    • Optional options: CallOptions | null

    Returns grpc.ClientReadableStream<KeyValue>

getTrieProof

  • getTrieProof(id: string, query?: string | RootFilter): Promise<TrieProof>
  • getTrieProof(argument: TrieProofRequest, callback: grpc.requestCallback<TrieProof>): grpc.ClientUnaryCall
  • getTrieProof(argument: TrieProofRequest, metadataOrOptions: Metadata | CallOptions | null, callback: grpc.requestCallback<TrieProof>): grpc.ClientUnaryCall
  • getTrieProof(argument: TrieProofRequest, metadata: Metadata | null, options: CallOptions | null, callback: grpc.requestCallback<TrieProof>): grpc.ClientUnaryCall
  • Gets a trie proof by either proof ID or root. If by root, the latest proof of that root will be returned

    Parameters

    • id: string

      trie ID

    • Optional query: string | RootFilter

      trie proof ID or root filter. When not provided, the oldest TrieProof for current trie root will be returned

    Returns Promise<TrieProof>

  • Parameters

    Returns grpc.ClientUnaryCall

  • Parameters

    Returns grpc.ClientUnaryCall

  • Parameters

    Returns grpc.ClientUnaryCall

getTrieProofs

getTrieRoots

  • getTrieRoots(id: string, filter?: RootFilter): AsyncIterable<TrieRoot>
  • getTrieRoots(argument: TrieRootsRequest, metadataOrOptions?: Metadata | CallOptions | null): grpc.ClientReadableStream<TrieRoot>
  • getTrieRoots(argument: TrieRootsRequest, metadata?: Metadata | null, options?: CallOptions | null): grpc.ClientReadableStream<TrieRoot>
  • Gets roots of a trie. This is a series of roots showing the modification history of a trie

    Parameters

    • id: string

      trie ID

    • Optional filter: RootFilter

      the root filter. When not provided, all TrieRoots will be returned

    Returns AsyncIterable<TrieRoot>

  • Parameters

    • argument: TrieRootsRequest
    • Optional metadataOrOptions: Metadata | CallOptions | null

    Returns grpc.ClientReadableStream<TrieRoot>

  • Parameters

    • argument: TrieRootsRequest
    • Optional metadata: Metadata | null
    • Optional options: CallOptions | null

    Returns grpc.ClientReadableStream<TrieRoot>

getTries

  • getTries(): AsyncIterable<Trie>
  • getTries(argument: Empty, metadataOrOptions?: Metadata | CallOptions | null): grpc.ClientReadableStream<Trie>
  • getTries(argument: Empty, metadata?: Metadata | null, options?: CallOptions | null): grpc.ClientReadableStream<Trie>
  • Gets all tries. Admin privilege is required

    Returns AsyncIterable<Trie>

  • Parameters

    • argument: Empty
    • Optional metadataOrOptions: Metadata | CallOptions | null

    Returns grpc.ClientReadableStream<Trie>

  • Parameters

    • argument: Empty
    • Optional metadata: Metadata | null
    • Optional options: CallOptions | null

    Returns grpc.ClientReadableStream<Trie>

importAndVerifyTrieWithSortedKeyValues

  • Imports a trie and verifies its given root with the original data in sorted stream of key-values. The returned results contain both proof and key-values status

    Parameters

    • path: string

      the trie input file path

    • sortedKeyValues: Iterable<KeyValue> | AsyncIterable<KeyValue>

      the original data in sorted stream. You can use sortKeyValues to sort a key-values array

    • Optional trieProofQuery: string | RootFilter

      trie proof ID or root filter. When not provided, the oldest TrieProof for current trie root will be used

    • Optional dotGraphOutputPath: undefined | string

      Graphviz Dot Graph output file path. Default: undefined (don't output)

    Returns Promise<ProofVerificationResult>

importTrie

  • importTrie(id: string, path: string, storageType?: ValueOfStorageType): Promise<Trie>
  • importTrie(id: string, path: string, callback: grpc.requestCallback<Trie>, storageType?: ValueOfStorageType): SurfaceCall
  • importTrie(callback: grpc.requestCallback<Trie>): grpc.ClientWritableStream<DataChunk>
  • importTrie(metadataOrOptions: Metadata | CallOptions | null, callback: grpc.requestCallback<Trie>): grpc.ClientWritableStream<DataChunk>
  • importTrie(metadata: Metadata | null, options: CallOptions | null, callback: grpc.requestCallback<Trie>): grpc.ClientWritableStream<DataChunk>
  • Imports the trie data and creates a new trie. If id is zero, a new trie ID will be generated, which is recommended when importing

    Parameters

    • id: string

      trie ID

    • path: string

      the trie input file path

    • Optional storageType: ValueOfStorageType

      storage type of the trie. Default: Trie.StorageType.LOCAL

    Returns Promise<Trie>

  • Parameters

    Returns SurfaceCall

  • Parameters

    • callback: grpc.requestCallback<Trie>

    Returns grpc.ClientWritableStream<DataChunk>

  • Parameters

    • metadataOrOptions: Metadata | CallOptions | null
    • callback: grpc.requestCallback<Trie>

    Returns grpc.ClientWritableStream<DataChunk>

  • Parameters

    • metadata: Metadata | null
    • options: CallOptions | null
    • callback: grpc.requestCallback<Trie>

    Returns grpc.ClientWritableStream<DataChunk>

makeBidiStreamRequest

  • makeBidiStreamRequest<RequestType, ResponseType>(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, metadata: Metadata, options?: CallOptions): ClientDuplexStream<RequestType, ResponseType>
  • makeBidiStreamRequest<RequestType, ResponseType>(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, options?: CallOptions): ClientDuplexStream<RequestType, ResponseType>
  • Type parameters

    • RequestType

    • ResponseType

    Parameters

    • method: string
    • serialize: (value: RequestType) => Buffer
        • (value: RequestType): Buffer
        • Parameters

          • value: RequestType

          Returns Buffer

    • deserialize: (value: Buffer) => ResponseType
        • (value: Buffer): ResponseType
        • Parameters

          • value: Buffer

          Returns ResponseType

    • metadata: Metadata
    • Optional options: CallOptions

    Returns ClientDuplexStream<RequestType, ResponseType>

  • Type parameters

    • RequestType

    • ResponseType

    Parameters

    • method: string
    • serialize: (value: RequestType) => Buffer
        • (value: RequestType): Buffer
        • Parameters

          • value: RequestType

          Returns Buffer

    • deserialize: (value: Buffer) => ResponseType
        • (value: Buffer): ResponseType
        • Parameters

          • value: Buffer

          Returns ResponseType

    • Optional options: CallOptions

    Returns ClientDuplexStream<RequestType, ResponseType>

makeClientStreamRequest

  • makeClientStreamRequest<RequestType, ResponseType>(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, metadata: Metadata, options: CallOptions, callback: UnaryCallback<ResponseType>): ClientWritableStream<RequestType>
  • makeClientStreamRequest<RequestType, ResponseType>(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, metadata: Metadata, callback: UnaryCallback<ResponseType>): ClientWritableStream<RequestType>
  • makeClientStreamRequest<RequestType, ResponseType>(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, options: CallOptions, callback: UnaryCallback<ResponseType>): ClientWritableStream<RequestType>
  • makeClientStreamRequest<RequestType, ResponseType>(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, callback: UnaryCallback<ResponseType>): ClientWritableStream<RequestType>
  • Type parameters

    • RequestType

    • ResponseType

    Parameters

    • method: string
    • serialize: (value: RequestType) => Buffer
        • (value: RequestType): Buffer
        • Parameters

          • value: RequestType

          Returns Buffer

    • deserialize: (value: Buffer) => ResponseType
        • (value: Buffer): ResponseType
        • Parameters

          • value: Buffer

          Returns ResponseType

    • metadata: Metadata
    • options: CallOptions
    • callback: UnaryCallback<ResponseType>

    Returns ClientWritableStream<RequestType>

  • Type parameters

    • RequestType

    • ResponseType

    Parameters

    • method: string
    • serialize: (value: RequestType) => Buffer
        • (value: RequestType): Buffer
        • Parameters

          • value: RequestType

          Returns Buffer

    • deserialize: (value: Buffer) => ResponseType
        • (value: Buffer): ResponseType
        • Parameters

          • value: Buffer

          Returns ResponseType

    • metadata: Metadata
    • callback: UnaryCallback<ResponseType>

    Returns ClientWritableStream<RequestType>

  • Type parameters

    • RequestType

    • ResponseType

    Parameters

    • method: string
    • serialize: (value: RequestType) => Buffer
        • (value: RequestType): Buffer
        • Parameters

          • value: RequestType

          Returns Buffer

    • deserialize: (value: Buffer) => ResponseType
        • (value: Buffer): ResponseType
        • Parameters

          • value: Buffer

          Returns ResponseType

    • options: CallOptions
    • callback: UnaryCallback<ResponseType>

    Returns ClientWritableStream<RequestType>

  • Type parameters

    • RequestType

    • ResponseType

    Parameters

    • method: string
    • serialize: (value: RequestType) => Buffer
        • (value: RequestType): Buffer
        • Parameters

          • value: RequestType

          Returns Buffer

    • deserialize: (value: Buffer) => ResponseType
        • (value: Buffer): ResponseType
        • Parameters

          • value: Buffer

          Returns ResponseType

    • callback: UnaryCallback<ResponseType>

    Returns ClientWritableStream<RequestType>

makeServerStreamRequest

  • makeServerStreamRequest<RequestType, ResponseType>(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, argument: RequestType, metadata: Metadata, options?: CallOptions): ClientReadableStream<ResponseType>
  • makeServerStreamRequest<RequestType, ResponseType>(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, argument: RequestType, options?: CallOptions): ClientReadableStream<ResponseType>
  • Type parameters

    • RequestType

    • ResponseType

    Parameters

    • method: string
    • serialize: (value: RequestType) => Buffer
        • (value: RequestType): Buffer
        • Parameters

          • value: RequestType

          Returns Buffer

    • deserialize: (value: Buffer) => ResponseType
        • (value: Buffer): ResponseType
        • Parameters

          • value: Buffer

          Returns ResponseType

    • argument: RequestType
    • metadata: Metadata
    • Optional options: CallOptions

    Returns ClientReadableStream<ResponseType>

  • Type parameters

    • RequestType

    • ResponseType

    Parameters

    • method: string
    • serialize: (value: RequestType) => Buffer
        • (value: RequestType): Buffer
        • Parameters

          • value: RequestType

          Returns Buffer

    • deserialize: (value: Buffer) => ResponseType
        • (value: Buffer): ResponseType
        • Parameters

          • value: Buffer

          Returns ResponseType

    • argument: RequestType
    • Optional options: CallOptions

    Returns ClientReadableStream<ResponseType>

makeUnaryRequest

  • makeUnaryRequest<RequestType, ResponseType>(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, argument: RequestType, metadata: Metadata, options: CallOptions, callback: UnaryCallback<ResponseType>): ClientUnaryCall
  • makeUnaryRequest<RequestType, ResponseType>(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, argument: RequestType, metadata: Metadata, callback: UnaryCallback<ResponseType>): ClientUnaryCall
  • makeUnaryRequest<RequestType, ResponseType>(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, argument: RequestType, options: CallOptions, callback: UnaryCallback<ResponseType>): ClientUnaryCall
  • makeUnaryRequest<RequestType, ResponseType>(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, argument: RequestType, callback: UnaryCallback<ResponseType>): ClientUnaryCall
  • Type parameters

    • RequestType

    • ResponseType

    Parameters

    • method: string
    • serialize: (value: RequestType) => Buffer
        • (value: RequestType): Buffer
        • Parameters

          • value: RequestType

          Returns Buffer

    • deserialize: (value: Buffer) => ResponseType
        • (value: Buffer): ResponseType
        • Parameters

          • value: Buffer

          Returns ResponseType

    • argument: RequestType
    • metadata: Metadata
    • options: CallOptions
    • callback: UnaryCallback<ResponseType>

    Returns ClientUnaryCall

  • Type parameters

    • RequestType

    • ResponseType

    Parameters

    • method: string
    • serialize: (value: RequestType) => Buffer
        • (value: RequestType): Buffer
        • Parameters

          • value: RequestType

          Returns Buffer

    • deserialize: (value: Buffer) => ResponseType
        • (value: Buffer): ResponseType
        • Parameters

          • value: Buffer

          Returns ResponseType

    • argument: RequestType
    • metadata: Metadata
    • callback: UnaryCallback<ResponseType>

    Returns ClientUnaryCall

  • Type parameters

    • RequestType

    • ResponseType

    Parameters

    • method: string
    • serialize: (value: RequestType) => Buffer
        • (value: RequestType): Buffer
        • Parameters

          • value: RequestType

          Returns Buffer

    • deserialize: (value: Buffer) => ResponseType
        • (value: Buffer): ResponseType
        • Parameters

          • value: Buffer

          Returns ResponseType

    • argument: RequestType
    • options: CallOptions
    • callback: UnaryCallback<ResponseType>

    Returns ClientUnaryCall

  • Type parameters

    • RequestType

    • ResponseType

    Parameters

    • method: string
    • serialize: (value: RequestType) => Buffer
        • (value: RequestType): Buffer
        • Parameters

          • value: RequestType

          Returns Buffer

    • deserialize: (value: Buffer) => ResponseType
        • (value: Buffer): ResponseType
        • Parameters

          • value: Buffer

          Returns ResponseType

    • argument: RequestType
    • callback: UnaryCallback<ResponseType>

    Returns ClientUnaryCall

setTrieKeyValues

  • setTrieKeyValues(id: string, root: string, keyValues: Iterable<KeyValue> | AsyncIterable<KeyValue>): Promise<Trie>
  • setTrieKeyValues(id: string, root: string, keyValues: Iterable<KeyValue>, callback: grpc.requestCallback<Trie>): SurfaceCall
  • setTrieKeyValues(callback: grpc.requestCallback<Trie>): grpc.ClientWritableStream<KeyValue>
  • setTrieKeyValues(metadataOrOptions: Metadata | CallOptions | null, callback: grpc.requestCallback<Trie>): grpc.ClientWritableStream<KeyValue>
  • setTrieKeyValues(metadata: Metadata | null, options: CallOptions | null, callback: grpc.requestCallback<Trie>): grpc.ClientWritableStream<KeyValue>
  • Sets the key-values to the trie. When root is zero (""), the current root hash of the trie will be used, and the request will be blocked until all ongoing updates are finished

    Parameters

    • id: string

      trie ID

    • root: string

      trie root

    • keyValues: Iterable<KeyValue> | AsyncIterable<KeyValue>

      the key-values

    Returns Promise<Trie>

  • Parameters

    • id: string
    • root: string
    • keyValues: Iterable<KeyValue>
    • callback: grpc.requestCallback<Trie>

    Returns SurfaceCall

  • Parameters

    • callback: grpc.requestCallback<Trie>

    Returns grpc.ClientWritableStream<KeyValue>

  • Parameters

    • metadataOrOptions: Metadata | CallOptions | null
    • callback: grpc.requestCallback<Trie>

    Returns grpc.ClientWritableStream<KeyValue>

  • Parameters

    • metadata: Metadata | null
    • options: CallOptions | null
    • callback: grpc.requestCallback<Trie>

    Returns grpc.ClientWritableStream<KeyValue>

setTrieRoot

  • setTrieRoot(id: string, root: string): Promise<Trie>
  • setTrieRoot(argument: SetTrieRootRequest, callback: grpc.requestCallback<Trie>): grpc.ClientUnaryCall
  • setTrieRoot(argument: SetTrieRootRequest, metadataOrOptions: Metadata | CallOptions | null, callback: grpc.requestCallback<Trie>): grpc.ClientUnaryCall
  • setTrieRoot(argument: SetTrieRootRequest, metadata: Metadata | null, options: CallOptions | null, callback: grpc.requestCallback<Trie>): grpc.ClientUnaryCall
  • Sets the root of a trie to the given one. This will add an entry in the root history

    Parameters

    • id: string

      trie ID

    • root: string

      trie root

    Returns Promise<Trie>

  • Parameters

    Returns grpc.ClientUnaryCall

  • Parameters

    • argument: SetTrieRootRequest
    • metadataOrOptions: Metadata | CallOptions | null
    • callback: grpc.requestCallback<Trie>

    Returns grpc.ClientUnaryCall

  • Parameters

    • argument: SetTrieRootRequest
    • metadata: Metadata | null
    • options: CallOptions | null
    • callback: grpc.requestCallback<Trie>

    Returns grpc.ClientUnaryCall

setTrieStorageType

subscribeTrieProof

  • subscribeTrieProof(id: string, query?: string | RootFilter): AsyncIterable<TrieProof>
  • subscribeTrieProof(argument: TrieProofRequest, metadataOrOptions?: Metadata | CallOptions | null): grpc.ClientReadableStream<TrieProof>
  • subscribeTrieProof(argument: TrieProofRequest, metadata?: Metadata | null, options?: CallOptions | null): grpc.ClientReadableStream<TrieProof>
  • Subscribes to the given trie proof

    Parameters

    • id: string

      trie ID

    • Optional query: string | RootFilter

      trie proof ID or root filter. When not provided, the oldest TrieProof for current trie root will be used

    Returns AsyncIterable<TrieProof>

  • Parameters

    • argument: TrieProofRequest
    • Optional metadataOrOptions: Metadata | CallOptions | null

    Returns grpc.ClientReadableStream<TrieProof>

  • Parameters

    • argument: TrieProofRequest
    • Optional metadata: Metadata | null
    • Optional options: CallOptions | null

    Returns grpc.ClientReadableStream<TrieProof>

verifyKeyValuesProof

  • verifyKeyValuesProof(path: string, outputKeyValues?: undefined | false | true, dotGraphOutputPath?: undefined | string): AsyncIterable<KeyValue | VerifyProofReply>
  • verifyKeyValuesProof(path: string, callback: grpc.requestCallback<VerifyProofReply>, onKeyValue?: undefined | ((kv: KeyValue) => void), dotGraphOutputPath?: undefined | string): SurfaceCall
  • verifyKeyValuesProof(metadataOrOptions?: Metadata | CallOptions | null): grpc.ClientDuplexStream<DataChunk, VerifyProofReplyChunk>
  • verifyKeyValuesProof(metadata?: Metadata | null, options?: CallOptions | null): grpc.ClientDuplexStream<DataChunk, VerifyProofReplyChunk>
  • Verifies the given key-values proof

    Parameters

    • path: string

      the key-values proof input file path

    • Optional outputKeyValues: undefined | false | true

      whether to output key-values contained in the trie. Default: false

    • Optional dotGraphOutputPath: undefined | string

      Graphviz Dot Graph output file path. Default: undefined (don't output)

    Returns AsyncIterable<KeyValue | VerifyProofReply>

  • Parameters

    • path: string
    • callback: grpc.requestCallback<VerifyProofReply>
    • Optional onKeyValue: undefined | ((kv: KeyValue) => void)
    • Optional dotGraphOutputPath: undefined | string

    Returns SurfaceCall

  • Parameters

    • Optional metadataOrOptions: Metadata | CallOptions | null

    Returns grpc.ClientDuplexStream<DataChunk, VerifyProofReplyChunk>

  • Parameters

    • Optional metadata: Metadata | null
    • Optional options: CallOptions | null

    Returns grpc.ClientDuplexStream<DataChunk, VerifyProofReplyChunk>

verifyKeyValuesProofWithSortedKeyValues

  • Verifies the key-values proof with the original data in sorted stream of key-values. The returned results contain both proof and key-values status

    Parameters

    • path: string

      the key-values proof input file path

    • sortedKeyValues: Iterable<KeyValue> | AsyncIterable<KeyValue>

      the original data in sorted stream. You can use sortKeyValues to sort a key-values array

    • Optional dotGraphOutputPath: undefined | string

      Graphviz Dot Graph output file path. Default: undefined (don't output)

    Returns Promise<ProofVerificationResult>

verifyTrieProof

  • verifyTrieProof(trieId: string, proofId: string, outputKeyValues?: undefined | false | true, dotGraphOutputPath?: undefined | string): AsyncIterable<KeyValue | VerifyProofReply>
  • verifyTrieProof(trieId: string, proofId: string, callback: grpc.requestCallback<VerifyProofReply>, onKeyValue?: undefined | ((kv: KeyValue) => void), dotGraphOutputPath?: undefined | string): SurfaceCall
  • verifyTrieProof(argument: VerifyTrieProofRequest, metadataOrOptions?: Metadata | CallOptions | null): grpc.ClientReadableStream<VerifyProofReplyChunk>
  • verifyTrieProof(argument: VerifyTrieProofRequest, metadata?: Metadata | null, options?: CallOptions | null): grpc.ClientReadableStream<VerifyProofReplyChunk>
  • Verifies the given trie proof

    Parameters

    • trieId: string

      trie ID

    • proofId: string

      trie proof ID

    • Optional outputKeyValues: undefined | false | true

      whether to output key-values contained in the trie. Default: false

    • Optional dotGraphOutputPath: undefined | string

      Graphviz Dot Graph output file path. Default: undefined (don't output)

    Returns AsyncIterable<KeyValue | VerifyProofReply>

  • Parameters

    • trieId: string
    • proofId: string
    • callback: grpc.requestCallback<VerifyProofReply>
    • Optional onKeyValue: undefined | ((kv: KeyValue) => void)
    • Optional dotGraphOutputPath: undefined | string

    Returns SurfaceCall

  • Parameters

    Returns grpc.ClientReadableStream<VerifyProofReplyChunk>

  • Parameters

    Returns grpc.ClientReadableStream<VerifyProofReplyChunk>

verifyTrieWithSortedKeyValues

  • Verifies the trie at the given root with the original data in sorted stream of key-values. The returned results contain both proof and key-values status

    Parameters

    • trie: Trie

      the trie at a root

    • sortedKeyValues: Iterable<KeyValue> | AsyncIterable<KeyValue>

      the original data in sorted stream. You can use sortKeyValues to sort a key-values array

    • Optional trieProofQuery: string | RootFilter

      trie proof ID or root filter. When not provided, the oldest TrieProof for current trie root will be used

    • Optional dotGraphOutputPath: undefined | string

      Graphviz Dot Graph output file path. Default: undefined (don't output)

    Returns Promise<ProofVerificationResult>

waitForReady

  • waitForReady(deadline: Deadline, callback: (error?: Error) => void): void
  • Parameters

    • deadline: Deadline
    • callback: (error?: Error) => void
        • (error?: Error): void
        • Parameters

          • Optional error: Error

          Returns void

    Returns void

Generated using TypeDoc