Socket
Socket
Sign inDemoInstall

fabric-contract-api

Package Overview
Dependencies
Maintainers
3
Versions
221
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fabric-contract-api - npm Package Compare versions

Comparing version 2.5.4 to 2.5.5

.nyc_output/a54c17a7-0165-47d6-9986-f453f593de46.json

2

.nyc_output/processinfo/index.json

@@ -1,1 +0,1 @@

{"processes":{"0a15a2e1-24ba-4286-a660-efebcb86738e":{"parent":null,"children":[]},"a4f3b7b0-6980-43c3-a47d-62978c0084cc":{"parent":null,"children":[]}},"files":{"/home/runner/work/fabric-chaincode-node/fabric-chaincode-node/apis/fabric-contract-api/lib/annotations/default.js":["0a15a2e1-24ba-4286-a660-efebcb86738e","a4f3b7b0-6980-43c3-a47d-62978c0084cc"],"/home/runner/work/fabric-chaincode-node/fabric-chaincode-node/apis/fabric-contract-api/lib/logger.js":["0a15a2e1-24ba-4286-a660-efebcb86738e","a4f3b7b0-6980-43c3-a47d-62978c0084cc"],"/home/runner/work/fabric-chaincode-node/fabric-chaincode-node/apis/fabric-contract-api/lib/annotations/info.js":["0a15a2e1-24ba-4286-a660-efebcb86738e","a4f3b7b0-6980-43c3-a47d-62978c0084cc"],"/home/runner/work/fabric-chaincode-node/fabric-chaincode-node/apis/fabric-contract-api/lib/annotations/object.js":["0a15a2e1-24ba-4286-a660-efebcb86738e","a4f3b7b0-6980-43c3-a47d-62978c0084cc"],"/home/runner/work/fabric-chaincode-node/fabric-chaincode-node/apis/fabric-contract-api/lib/annotations/utils.js":["0a15a2e1-24ba-4286-a660-efebcb86738e","a4f3b7b0-6980-43c3-a47d-62978c0084cc"],"/home/runner/work/fabric-chaincode-node/fabric-chaincode-node/apis/fabric-contract-api/lib/annotations/transaction.js":["0a15a2e1-24ba-4286-a660-efebcb86738e","a4f3b7b0-6980-43c3-a47d-62978c0084cc"],"/home/runner/work/fabric-chaincode-node/fabric-chaincode-node/apis/fabric-contract-api/lib/context.js":["0a15a2e1-24ba-4286-a660-efebcb86738e","a4f3b7b0-6980-43c3-a47d-62978c0084cc"],"/home/runner/work/fabric-chaincode-node/fabric-chaincode-node/apis/fabric-contract-api/lib/contract.js":["0a15a2e1-24ba-4286-a660-efebcb86738e","a4f3b7b0-6980-43c3-a47d-62978c0084cc"],"/home/runner/work/fabric-chaincode-node/fabric-chaincode-node/apis/fabric-contract-api/index.js":["0a15a2e1-24ba-4286-a660-efebcb86738e","a4f3b7b0-6980-43c3-a47d-62978c0084cc"],"/home/runner/work/fabric-chaincode-node/fabric-chaincode-node/apis/fabric-contract-api/lib/annotations/index.js":["0a15a2e1-24ba-4286-a660-efebcb86738e","a4f3b7b0-6980-43c3-a47d-62978c0084cc"],"/home/runner/work/fabric-chaincode-node/fabric-chaincode-node/apis/fabric-contract-api/lib/jsontransactionserializer.js":["0a15a2e1-24ba-4286-a660-efebcb86738e","a4f3b7b0-6980-43c3-a47d-62978c0084cc"]},"externalIds":{}}
{"processes":{"a54c17a7-0165-47d6-9986-f453f593de46":{"parent":null,"children":[]},"af9f3aa3-df9e-4706-80d7-c5c20d921363":{"parent":null,"children":[]}},"files":{"/home/runner/work/fabric-chaincode-node/fabric-chaincode-node/apis/fabric-contract-api/lib/annotations/default.js":["a54c17a7-0165-47d6-9986-f453f593de46","af9f3aa3-df9e-4706-80d7-c5c20d921363"],"/home/runner/work/fabric-chaincode-node/fabric-chaincode-node/apis/fabric-contract-api/lib/logger.js":["a54c17a7-0165-47d6-9986-f453f593de46","af9f3aa3-df9e-4706-80d7-c5c20d921363"],"/home/runner/work/fabric-chaincode-node/fabric-chaincode-node/apis/fabric-contract-api/lib/annotations/info.js":["a54c17a7-0165-47d6-9986-f453f593de46","af9f3aa3-df9e-4706-80d7-c5c20d921363"],"/home/runner/work/fabric-chaincode-node/fabric-chaincode-node/apis/fabric-contract-api/lib/annotations/object.js":["a54c17a7-0165-47d6-9986-f453f593de46","af9f3aa3-df9e-4706-80d7-c5c20d921363"],"/home/runner/work/fabric-chaincode-node/fabric-chaincode-node/apis/fabric-contract-api/lib/annotations/utils.js":["a54c17a7-0165-47d6-9986-f453f593de46","af9f3aa3-df9e-4706-80d7-c5c20d921363"],"/home/runner/work/fabric-chaincode-node/fabric-chaincode-node/apis/fabric-contract-api/lib/annotations/transaction.js":["a54c17a7-0165-47d6-9986-f453f593de46","af9f3aa3-df9e-4706-80d7-c5c20d921363"],"/home/runner/work/fabric-chaincode-node/fabric-chaincode-node/apis/fabric-contract-api/lib/context.js":["a54c17a7-0165-47d6-9986-f453f593de46","af9f3aa3-df9e-4706-80d7-c5c20d921363"],"/home/runner/work/fabric-chaincode-node/fabric-chaincode-node/apis/fabric-contract-api/lib/contract.js":["a54c17a7-0165-47d6-9986-f453f593de46","af9f3aa3-df9e-4706-80d7-c5c20d921363"],"/home/runner/work/fabric-chaincode-node/fabric-chaincode-node/apis/fabric-contract-api/index.js":["a54c17a7-0165-47d6-9986-f453f593de46","af9f3aa3-df9e-4706-80d7-c5c20d921363"],"/home/runner/work/fabric-chaincode-node/fabric-chaincode-node/apis/fabric-contract-api/lib/annotations/index.js":["a54c17a7-0165-47d6-9986-f453f593de46","af9f3aa3-df9e-4706-80d7-c5c20d921363"],"/home/runner/work/fabric-chaincode-node/fabric-chaincode-node/apis/fabric-contract-api/lib/jsontransactionserializer.js":["a54c17a7-0165-47d6-9986-f453f593de46","af9f3aa3-df9e-4706-80d7-c5c20d921363"]},"externalIds":{}}
{
"files": {
"apis/fabric-contract-api/.rush/temp/shrinkwrap-deps.json": "d4f7b3b8c5d8a8b884461f5284043e46a23dd568",
"apis/fabric-contract-api/.npmignore": "d5ef42f00478a442c788d62a5b8ebf5d5ca300a1",

@@ -18,3 +17,3 @@ "apis/fabric-contract-api/LICENSE": "8f71f43fee3f78649d238238cbde51e6d7055c82",

"apis/fabric-contract-api/lib/logger.js": "8b92ac903d0529d809cadf14bcd5a000c5e41ca5",
"apis/fabric-contract-api/package.json": "1b069a95ce6cbe2620253c48de5e70c3201ba650",
"apis/fabric-contract-api/package.json": "c2d5dfa639a444399bf3298de77613f573c09422",
"apis/fabric-contract-api/schema/contract-schema.json": "e9109dc09122b63defe9ecbc9ec2076472ae1b16",

@@ -25,4 +24,3 @@ "apis/fabric-contract-api/schema/data.json": "c8228d6ec022cc08f1d11234efa6b2af304b80e2",

"apis/fabric-contract-api/schema/testschema.json": "24b5039c14c4f7c054711743045b2af22038cf52",
"apis/fabric-contract-api/test/typescript/smartcontract.ts": "e972212d5df8e8dc8cb72d2df22e646b6a41dfea",
"apis/fabric-contract-api/test/typescript/tsconfig.json": "02a31c3aa79d1b3ad801d5c15f1a094d257119d8",
"apis/fabric-contract-api/test/typescript/smartcontract.ts": "d681ca55418363050ed18166297d86f637c53f18",
"apis/fabric-contract-api/test/unit/annotations/default.js": "a0fe3fdddb2700f5e34617dca02c86563958a36c",

@@ -40,6 +38,7 @@ "apis/fabric-contract-api/test/unit/annotations/info.js": "6a76c8f6bf17dc73b0d17ba9e534ac66f3420077",

"apis/fabric-contract-api/test/unit/metadata.json": "54d9184128c475f96b29520097f73c40c843c62a",
"apis/fabric-contract-api/types/index.d.ts": "71c9342a3c641b716ec64ef816bd614728ead181",
"apis/fabric-contract-api/types/tsconfig.json": "8eabad9cba9295338da2c3ae8c391a5235638790"
"apis/fabric-contract-api/tsconfig.json": "59a3ec302e3072b2e4ef400664e329af1f662821",
"apis/fabric-contract-api/types/index.d.ts": "8c0c5f662ce654de234fd277b5833de6938e4b5f",
"apis/fabric-contract-api/.rush/temp/shrinkwrap-deps.json": "7a5d1887c8329513f72477072f0a66dc4ca69988"
},
"arguments": "npm run lint && npm run test:unit && npm run test:schema "
}
{
"name": "fabric-contract-api",
"version": "2.5.4",
"version": "2.5.5",
"tag": "latest",

@@ -17,3 +17,3 @@ "description": "A node.js implementation of Hyperledger Fabric chaincode shim, to allow endorsing peers and user-provided chaincodes to communicate with each other",

"engines": {
"node": "^18.0.0"
"node": ">=18"
},

@@ -41,3 +41,3 @@ "license": "Apache-2.0",

"dependencies": {
"fabric-shim-api": "2.5.4",
"fabric-shim-api": "2.5.5",
"class-transformer": "^0.4.0",

@@ -70,7 +70,6 @@ "fast-safe-stringify": "^2.1.1",

"build": "npm run lint && npm run test:unit && npm run test:schema",
"lint": "eslint ./lib/",
"lint": "eslint ./lib ./types ./test/typescript/*.ts --ext .js --ext .ts",
"test:unit": "npm run test",
"test:schema": "ajv compile -s ./schema/contract-schema.json && ajv validate -s ./schema/contract-schema.json -d ./schema/example-full.json"
},
"readme": "[![NPM](https://nodei.co/npm/fabric-contract-api.svg?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/fabric-contract-api/)\n[![NPM](https://nodei.co/npm/fabric-shim.svg?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/fabric-shim/)\n\n\n[![Version](https://badge.fury.io/js/fabric-shim.svg)](http://badge.fury.io/js/fabric-shim)\n\nThe `fabric-contract-api` provides the *contract interface* a high level API for application developers to implement [Smart Contracts](https://hyperledger-fabric.readthedocs.io/en/release-2.1/glossary.html#smart-contract). Working with this API provides a high level entry point to writing business logic.\n\nWithin Hyperledger Fabric, Smart Contracts can also be referred to as [Chaincode](https://hyperledger-fabric.readthedocs.io/en/release-2.1/glossary.html#chaincode). To be more specific, the term chaincode is preferred to be used to refer to the overall container that is hosting the contracts.\n\nThe `fabric-shim` provides the *chaincode interface*, a lower level API for implementing \"Smart Contracts\". It also _currently_ provides the implementation to support communication with Hyperledger Fabric peers for Smart Contracts written using the `fabric-contract-api`. To confirm that this is the same as the `fabric-shim` in previous versions of Hyperledger Fabric.\n\nDetailed explanation on the concept and programming model can be found here: [https://hyperledger-fabric.readthedocs.io/en/latest/smartcontract/smartcontract.html](https://hyperledger-fabric.readthedocs.io/en/latest/smartcontract/smartcontract.html).\n\n## Contract Interface\n\n### Installation\n\n```sh\nnpm install --save fabric-contract-api\n```\n\n### Usage\n\nImplement a class that ends the `contract` class, a constructor is needed.\nThe other functions will be invokable functions of your Smart Contract\n\n```javascript\n// updatevalues.js\n'use strict';\n\n// SDK Library to asset with writing the logic\nconst { Contract } = require('fabric-contract-api');\n\n// Business logic (well just util but still it's general purpose logic)\nconst util = require('util');\n\n/**\n * Support the Updating of values within the SmartContract\n */\nclass UpdateValuesContract extends Contract\n\n constructor(){\n\t \tsuper('UpdateValuesContract');\n\t}\n\n\tasync transactionA(ctx, newValue) {\n\t\t// retrieve existing chaincode states\n\t\tlet oldValue = await ctx.stub.getState(key);\n\n\t\tawait ctx.stub.putState(key, Buffer.from(newValue));\n\n\t\treturn Buffer.from(newValue.toString());\n\t}\n\n\tasync transactionB(ctx) {\n\t // .....\n\t}\n\n};\n\nmodule.exports = UpdateValuesContract\n```\n\nAs with standard node modules make sure that this class is exported as follows.\n```javascript\n// index.js\n'use strict';\n\nconst UpdateValues = require('./updatevalues')\nmodule.exports.contracts = [UpdateValues];\n```\n\n**Note:** In order to make this contract 'runnable' you must also install the `fabric-shim` module as below, and ensure that the 'start' script in `package.json` refers to `fabric-chaincode-node start`\n\n```json\n \"scripts\": {\n \t\"start\": \"fabric-chaincode-node start\"\n }\n```\n\nThe `fabric-shim` provides the `fabric-chaincode-node` commands; this can also be used to create a skelton metadata file. \n\n## Chaincode Interface\n\n### Installation\n```sh\nnpm install --save fabric-shim\n```\n\n### Usage\nThe [chaincode interface](https://hyperledger.github.io/fabric-chaincode-node/main/api/fabric-shim.ChaincodeInterface.html) contains two methods to be implemented:\n```javascript\nconst shim = require('fabric-shim');\n\nconst Chaincode = class {\n\tasync Init(stub) {\n\t\t// use the instantiate input arguments to decide initial chaincode state values\n\n\t\t// save the initial states\n\t\tawait stub.putState(key, Buffer.from(aStringValue));\n\n\t\treturn shim.success(Buffer.from('Initialized Successfully!'));\n\t}\n\n\tasync Invoke(stub) {\n\t\t// use the invoke input arguments to decide intended changes\n\n\t\t// retrieve existing chaincode states\n\t\tlet oldValue = await stub.getState(key);\n\n\t\t// calculate new state values and saves them\n\t\tlet newValue = oldValue + delta;\n\t\tawait stub.putState(key, Buffer.from(newValue));\n\n\t\treturn shim.success(Buffer.from(newValue.toString()));\n\t}\n};\n```\n\nStart the chaincode process and listen for incoming endorsement requests:\n```javascript\nshim.start(new Chaincode());\n```\n\n### API Reference\nVisit [API Reference](https://hyperledger.github.io/fabric-chaincode-node/main/api/) and click on \"Classes\" link in the navigation bar on the top to view the list of class APIs.\n\n\n\n## Support\nTested with Node v12 LTS release.\n\n## License\n\nThis package is distributed under the\n[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0),\nsee LICENSE.txt for more information.\n"
}
}

@@ -9,4 +9,4 @@ /*

declare module 'fabric-contract-api' {
import { Logger } from 'winston';
import { ChaincodeStub, ClientIdentity } from 'fabric-shim-api';
import {Logger} from 'winston';
import {ChaincodeStub, ClientIdentity} from 'fabric-shim-api';

@@ -40,4 +40,4 @@ export class Context {

export class JSONSerializer {
toBuffer(result: any,schema:any,loggerPrefix?:string): Buffer;
fromBuffer(data: Buffer,schema:any,loggerPrefix?:string): any;
toBuffer(result: any, schema:any, loggerPrefix?:string): Buffer;
fromBuffer(data: Buffer, schema:any, loggerPrefix?:string): any;
}

@@ -44,0 +44,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc