0.0.21 • Published 3 years ago

hyperledger-fabric-chaincode-helper v0.0.21

Weekly downloads
74
License
AGPL-3.0
Repository
github
Last release
3 years ago

|| BLOCKOTUS || Chaincode Helper

for Hyperledger Fabric

Documentation

Built-in DID requests.

Methods

getTimestamp(ctx): number

getUniqueClientId(ctx): string

getParams(ctx, rules): Array

exists(ctx, id): Promise

getAllResultsFromIterator(iterator, isHistory, limit): Promise<Array>

Example

import { BlockotusContract } from 'hyperledger-fabric-chaincode-helper';


class MyContract extends BlockotusContract {

  public async anyfunction(ctx) {
    const timestamp = this.getTimestamp(ctx);
    const uniqueClientId = this.getUniqueClientId(ctx);
    const params = this.getParams(ctx, { length: 2 });
    const exists = await this.exists(ctx, id);
    const results = await this.getAllResultsFromIterator(iterator, false, 5); // in a Write transaction, Fabric does not support Limit Queries. This helper does the job.
  }

  /**
   * Cross-contract invokeChaincode() does not support Parent Contract method as far as I know.
   * This is why we duplicate the method here.
   * Because the method is called from Did contract https://github.com/BLOCKOTUS/did
   */
  public async did(ctx: Context, subject: string, method: string, data: string): Promise<string> {
      return this.didRequest(ctx, subject, method, data);
  }

  /**
   * Cross-contract invokeChaincode() does not support Parent Contract method as far as I know.
   * This is why we duplicate the method here.
   */
  public async authDIDRequest(ctx: Context, origin: string, id: string): Promise<boolean> {
      return this.didAuthDIDRequest(ctx, origin, id);
  }

}

Tool compatible with || BLOCKOTUS || Organism

Build complete decentralized applications with Blockotus Open and Decentralized Standard and Hyperledger Fabric.

The kit includes a Frontend (Svelte / React), a Backend (Nodejs / Express), a Network and Chaincode Contracts (Hyperledger Fabric) as specified by Blockotus Open and Decentralized Standard.

BLOCKOTUS Organism.

0.0.21

3 years ago

0.0.20

3 years ago

0.0.19

3 years ago

0.0.17

3 years ago

0.0.18

3 years ago

0.0.15

3 years ago

0.0.16

3 years ago

0.0.12

3 years ago

0.0.13

3 years ago

0.0.14

3 years ago

0.0.10

3 years ago

0.0.11

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago