diff --git a/.github/settings.yml b/.github/settings.yml index 5da0c571..10b76952 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -3,7 +3,7 @@ repository: description: Hyperledger Fabric Node.js Smart Contracts issues in JIRA please https://jira.hyperledger.org homepage: https://wiki.hyperledger.org/display/fabric - default_branch: master + default_branch: main has_downloads: true has_issues: false has_projects: false diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bee823d9..5596ddea 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,7 +27,7 @@ The following [Rush categories](https://rushjs.io/pages/maintainer/add_to_repo/) > Note that npm v6 has some bugs that mean adding new dependencies etc are not properly picked up. Longer term we should consider moving to yarn or pnpm. However in practice this isn't a serious problem and has been possible to be worked around by issuing `rm ./common/config/rush/npm-shrinkwrap.json` and then `rush update` -The fv and e2e tests require a set of docker images of Fabric Peers, Orderers and CAs. To ensure you have the correct images ensure these have been dowloaded and tagged. `rush edge-docker` will do this for you. +The fv and e2e tests require a set of docker images of Fabric Peers, Orderers and CAs. To ensure you have the correct images ensure these have been dowloaded and tagged. `rush edge-docker` will do this for you. They also need to have the `nodeenv` image present - this is build as part of the `rush rebuild` so please ensure this has been run first. It is advisable to clean up the docker containers and images between test runs to avoid any odd behaviour. Commands to help do this are below. @@ -50,8 +50,8 @@ For more specific purposes during development the following are useful: * `rush publish --include-all --pack --release-folder ./tarballs --publish` If you want to get a set of `.tar.gz` files of the node modules to use for local testing this command will put them into the `tarballs` directory * `rush rebuild --to fvtests` to run the unit tests for the core modules, but not the docker or jsdoc -* `rush rebuild --to fabric-contract-api` to build, lint and run just the `fabric-contract-api` -* `rush logs` will show the location of all the log files +* `rush rebuild --to fabric-contract-api` to build, lint and run just the `fabric-contract-api` +* `rush logs` will show the location of all the log files To clean up docker @@ -67,10 +67,10 @@ The codebase is maintained in [github](https://github.com/hyperledger/fabric-cha ## Code of Conduct Guidelines -See our [Code of Conduct Guidelines](../blob/master/CODE_OF_CONDUCT.md). +See our [Code of Conduct Guidelines](../blob/main/CODE_OF_CONDUCT.md). ## Maintainers -Should you have any questions or concerns, please reach out to one of the project's [Maintainers](../blob/master/MAINTAINERS.md). +Should you have any questions or concerns, please reach out to one of the project's [Maintainers](../blob/main/MAINTAINERS.md). Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License. diff --git a/MAINTAINERS.md b/MAINTAINERS.md index 406160d6..6aab3bb2 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -10,7 +10,7 @@ Maintainers | James Taylor | [jt-nti][jt-nti] | jtonline | | Chaoyi Zhao | [zhaochy1990][zhaochy1990] | zhaochy | -Also: Please see the [Release Manager section](https://github.com/hyperledger/fabric/blob/master/MAINTAINERS.md) +Also: Please see the [Release Manager section](https://github.com/hyperledger/fabric/blob/main/MAINTAINERS.md) Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License. diff --git a/README.md b/README.md index 57eda8db..07140514 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ # Hyperledger Fabric - Node.js Contracts -[![Build Status](https://dev.azure.com/Hyperledger/Fabric-Chaincode-Node/_apis/build/status/Fabric-Chaincode-Node?branchName=master)](https://dev.azure.com/Hyperledger/Fabric-Chaincode-Node/_build/latest?definitionId=33&branchName=master) +[![Build Status](https://dev.azure.com/Hyperledger/Fabric-Chaincode-Node/_apis/build/status/Fabric-Chaincode-Node?branchName=main)](https://dev.azure.com/Hyperledger/Fabric-Chaincode-Node/_build/latest?definitionId=33&branchName=main) [![fabric-contract-api npm module](https://img.shields.io/npm/v/fabric-shim?label=fabric-contract-api)](https://www.npmjs.com/package/fabric-contract-api) [![fabric-shim npm module](https://img.shields.io/npm/v/fabric-shim?label=fabric-shim)](https://www.npmjs.com/package/fabric-shim) [![fabric-shim-api npm module](https://img.shields.io/npm/v/fabric-shim?label=fabric-shim-api)](https://www.npmjs.com/package/fabric-shim-api) [![fabric-shim-crypto npm module](https://img.shields.io/npm/v/fabric-shim?label=fabric-shim-crypto)](https://www.npmjs.com/package/fabric-shim-crypto) [![Rocket.Chat](https://chat.hyperledger.org/images/join-chat.svg)](https://chat.hyperledger.org/channel/fabric-chaincode-dev) -This is the project to support the writing of Contracts with the node.js runtime. +This is the project to support the writing of Contracts with the node.js runtime. ## Documentation @@ -24,9 +24,9 @@ For details on what Nodejs runtime and versions of Hyperledger Fabric can be use ## npm Shrinkwrap -In line with the advice from [npm on shrinkwrap](https://docs.npmjs.com/files/shrinkwrap.json#description) the modules published do not contain a `npm-shrinkwrap.json` file. +In line with the advice from [npm on shrinkwrap](https://docs.npmjs.com/files/shrinkwrap.json#description) the modules published do not contain a `npm-shrinkwrap.json` file. -It is **STRONGLY** recommended therefore that after testing, and before putting your contract into production a `npm-shrinkwrap.json` file is created. When the chaincode is install it will be via a `npm install --production` command. +It is **STRONGLY** recommended therefore that after testing, and before putting your contract into production a `npm-shrinkwrap.json` file is created. When the chaincode is install it will be via a `npm install --production` command. ## Contributing @@ -41,4 +41,4 @@ There is also a [release guide](RELEASING.md) describing the process for publish Hyperledger Project source code files are made available under the Apache License, Version 2.0 (Apache-2.0), located in the [LICENSE](LICENSE) file. Hyperledger Project documentation files are made available under the Creative -Commons Attribution 4.0 International License (CC-BY-4.0), available at http://creativecommons.org/licenses/by/4.0/. \ No newline at end of file +Commons Attribution 4.0 International License (CC-BY-4.0), available at http://creativecommons.org/licenses/by/4.0/. diff --git a/apis/fabric-contract-api/README.md b/apis/fabric-contract-api/README.md index bcf38978..d5248048 100644 --- a/apis/fabric-contract-api/README.md +++ b/apis/fabric-contract-api/README.md @@ -89,7 +89,7 @@ npm install --save fabric-shim ``` ### Usage -The [chaincode interface](https://hyperledger.github.io/fabric-chaincode-node/master/api/fabric-shim.ChaincodeInterface.html) contains two methods to be implemented: +The [chaincode interface](https://hyperledger.github.io/fabric-chaincode-node/main/api/fabric-shim.ChaincodeInterface.html) contains two methods to be implemented: ```javascript const shim = require('fabric-shim'); @@ -124,7 +124,7 @@ shim.start(new Chaincode()); ``` ### API Reference -Visit [API Reference](https://hyperledger.github.io/fabric-chaincode-node/master/api/) and click on "Classes" link in the navigation bar on the top to view the list of class APIs. +Visit [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. diff --git a/apis/fabric-contract-api/test/unit/metadata.json b/apis/fabric-contract-api/test/unit/metadata.json index 689a6098..a53f78fe 100644 --- a/apis/fabric-contract-api/test/unit/metadata.json +++ b/apis/fabric-contract-api/test/unit/metadata.json @@ -1,5 +1,5 @@ { - "$schema": "https://hyperledger.github.io/fabric-chaincode-node/master/api/contract-schema.json", + "$schema": "https://hyperledger.github.io/fabric-chaincode-node/main/api/contract-schema.json", "contracts": { "ShippingContract": { "name": "ShippingContract", diff --git a/ci/azure-pipelines.yml b/ci/azure-pipelines.yml index 1118236c..23b0eedb 100644 --- a/ci/azure-pipelines.yml +++ b/ci/azure-pipelines.yml @@ -13,15 +13,15 @@ schedules: displayName: 'Chaincode Node Nightly Driver' branches: include: - - master + - main -# Trigger on the master branch +# Trigger on the main branch # Standard Pull Request and Merge builds # Any git tag will also trigger a build that should do publishing trigger: branches: include: - - 'master' + - 'main' tags: include: - '*' @@ -145,12 +145,12 @@ stages: path: $(Build.SourcesDirectory)/build - script: | set -ev - ./tools/getEdgeDocker.sh # essential to get master docker images of peer etc. + ./tools/getEdgeDocker.sh # essential to get main docker images of peer etc. docker image load --input build/fabric-nodeenv.tar.gz # gets the build image of nodeenv docker images node common/scripts/install-run-rush.js install node common/scripts/install-run-rush.js update # should the tests need 'building' this will need to go here - displayName: 'Get the latest master docker images' + displayName: 'Get the latest main docker images' - script: | set -ev export TLS=true @@ -224,9 +224,9 @@ stages: dependsOn: displayenv condition: and(succeeded(),eq(variables['Build.Reason'], 'IndividualCI')) variables: - ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/master') }}: - jsdoc_release: master - ${{ if ne(variables['Build.SourceBranch'], 'refs/heads/master') }}: + ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/main') }}: + jsdoc_release: main + ${{ if ne(variables['Build.SourceBranch'], 'refs/heads/main') }}: jsdoc_release: $[format('release-{0}',dependencies.displayenv.outputs['BuildData.MINOR_PACKAGE_VERSION'])] steps: - task: NodeTool@0 @@ -249,7 +249,7 @@ stages: cleanTargetFolder: true displayName: 'Copy JSDoc' - task: CopyFiles@2 - condition: eq(variables['Build.SourceBranch'], 'refs/heads/master') + condition: eq(variables['Build.SourceBranch'], 'refs/heads/main') inputs: contents: | _config.yml @@ -261,7 +261,7 @@ stages: sourceFolder: '$(Build.SourcesDirectory)/docs' targetFolder: $(Build.ArtifactStagingDirectory)/gh-pages cleanTargetFolder: true - displayName: 'Copy gh-pages doc (master branch only)' + displayName: 'Copy gh-pages doc (main branch only)' - script: | git reset --hard HEAD git clean -xdf @@ -273,7 +273,7 @@ stages: rm -rf $(jsdoc_release)/api/* cp -r $(Build.ArtifactStagingDirectory)/jsdoc/gen/* $(jsdoc_release)/api if [ -d $(Build.ArtifactStagingDirectory)/gh-pages ]; then - find . -maxdepth 1 ! \( -name [.]* -o -name 'gh-pages' -o -name 'master' -o -name 'release-*' \) -exec rm -rf {} \; + find . -maxdepth 1 ! \( -name [.]* -o -name 'gh-pages' -o -name 'main' -o -name 'release-*' \) -exec rm -rf {} \; cp -r $(Build.ArtifactStagingDirectory)/gh-pages/* . fi displayName: 'Update gh-pages branch' diff --git a/common/config/rush/command-line.json b/common/config/rush/command-line.json index 5f447fb9..c4c5fccf 100644 --- a/common/config/rush/command-line.json +++ b/common/config/rush/command-line.json @@ -79,8 +79,8 @@ { "commandKind": "global", "name": "edge-docker", - "summary": "Gets the latest master docker images for Fabric ", - "description": "Run this command before doing anything to get the master branch Fabric docker images", + "summary": "Gets the latest main docker images for Fabric ", + "description": "Run this command before doing anything to get the main branch Fabric docker images", "shellCommand": "./tools/getEdgeDocker.sh" } ] diff --git a/docs/_jsdoc/index.md b/docs/_jsdoc/index.md index 98e89331..7c801500 100644 --- a/docs/_jsdoc/index.md +++ b/docs/_jsdoc/index.md @@ -1,4 +1,4 @@ -[![Build Status](https://dev.azure.com/Hyperledger/Fabric-Chaincode-Node/_apis/build/status/Fabric-Chaincode-Node?branchName=master)](https://dev.azure.com/Hyperledger/Fabric-Chaincode-Node/_build/latest?definitionId=33&branchName=master) +[![Build Status](https://dev.azure.com/Hyperledger/Fabric-Chaincode-Node/_apis/build/status/Fabric-Chaincode-Node?branchName=main)](https://dev.azure.com/Hyperledger/Fabric-Chaincode-Node/_build/latest?definitionId=33&branchName=main) [![fabric-contract-api npm module](https://img.shields.io/npm/v/fabric-shim?label=fabric-contract-api)](https://www.npmjs.com/package/fabric-contract-api) [![fabric-shim npm module](https://img.shields.io/npm/v/fabric-shim?label=fabric-shim)](https://www.npmjs.com/package/fabric-shim) [![fabric-shim-api npm module](https://img.shields.io/npm/v/fabric-shim?label=fabric-shim-api)](https://www.npmjs.com/package/fabric-shim-api) @@ -91,7 +91,7 @@ npm install --save fabric-shim ``` ### Usage -The [chaincode interface](https://hyperledger.github.io/fabric-chaincode-node/master/api/fabric-shim.ChaincodeInterface.html) contains two methods to be implemented: +The [chaincode interface](https://hyperledger.github.io/fabric-chaincode-node/main/api/fabric-shim.ChaincodeInterface.html) contains two methods to be implemented: ```javascript const shim = require('fabric-shim'); diff --git a/docs/_jsdoc/tutorials/annotated-contract-metadata.md b/docs/_jsdoc/tutorials/annotated-contract-metadata.md index f08b6b1b..79e832a3 100644 --- a/docs/_jsdoc/tutorials/annotated-contract-metadata.md +++ b/docs/_jsdoc/tutorials/annotated-contract-metadata.md @@ -1,22 +1,22 @@ # Annotated Contract Metadata -The Contract Metadata can be supplied either by the Contract developer or it can be inferred from the source code. Depending on the source language used, and the amount of annotations (if permitted by the language) you may need to augment the metadata that is generated. +The Contract Metadata can be supplied either by the Contract developer or it can be inferred from the source code. Depending on the source language used, and the amount of annotations (if permitted by the language) you may need to augment the metadata that is generated. ## Metadata Schema -The metadata itself is in JSON, and there is a JSON-Schema definition that defines the contents; this schema is available online at https://hyperledger.github.io/fabric-chaincode-node/master/api/contract-schema.json +The metadata itself is in JSON, and there is a JSON-Schema definition that defines the contents; this schema is available online at https://hyperledger.github.io/fabric-chaincode-node/main/api/contract-schema.json This is the latest ga copy of the schema. Specific version can be obtained using urls https://hyperledger.github.io/fabric-chaincode-node/{release}/api/contract-schema.json where releases matches the release name, for example -`master` `release-1.4`. Note that metadata was first introduced at v1.4. +`main` `release-1.4`. Note that metadata was first introduced at v1.4. A lot of the elements of this metadata are heavily inspired from the [OpenAPI v3.0 specification](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md) and [JSON Schema](http://json-schema.org/) -Adding a reference at the top of the metadata file to this schema, permits editors and tools to be able to perform validation on the JSON at the point of editing. +Adding a reference at the top of the metadata file to this schema, permits editors and tools to be able to perform validation on the JSON at the point of editing. ```json { - "$schema": "https://hyperledger.github.io/fabric-chaincode-node/master/api/contract-schema.json", + "$schema": "https://hyperledger.github.io/fabric-chaincode-node/main/api/contract-schema.json", } ``` @@ -37,7 +37,7 @@ Depending on the language and implementation, you may only need to augment the m The metadata consists of three top level objects, 'info' 'contracts' and 'components'; you can supply all or none of these elements. (Supplying none is not considered an error, but has no practical effect) -The contents of each of these top level elements in your own metadata are used _in preference_ to any that can be automatically inferred. +The contents of each of these top level elements in your own metadata are used _in preference_ to any that can be automatically inferred. _*It is a programming error to have logical inconsistencies between the 'contracts' and 'components' section.This could arise in the cases where the 'contracts' you specified is different from the automatically created 'components' section*_ @@ -52,7 +52,7 @@ The metadata consists of three top level objects, 'info' 'contracts' and 'compon To represent information about all the contracts defined in this chaincode module. -*Full Example:* +*Full Example:* ```json "info": { "title": "Commercial Paper Smart Contract", @@ -90,14 +90,14 @@ This has exactly the same elements, and requirements as OpenAPI's [info object]( This represents each contract class. -So for example the contracts object could be +So for example the contracts object could be ```json "contracts": { "initUpgrade": { ... }, - "purchasing":{ + "purchasing":{ ... }, "query": { @@ -107,12 +107,12 @@ So for example the contracts object could be ``` ### Contract Object -*Purpose:* +*Purpose:* Individual Contract object *Structure:* - + Each contract object has the following structure ```json @@ -163,7 +163,7 @@ A starting example is a very simple transaction function. - the name of the function is 'setGreetingText' - it has a tag of 'submitTx' that means that this transaction is intended to be submitted with the 'submitTransaction' sdk function. The implication is that this is then submitted to the orderder. If this is not present, then the function will be 'evaluated', not submitted to the order so in effect a query-style operation. - the parameters of the function are defined in 'parameters' as an array of parameter definitions. (each of which follows the [parameterObject](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#parameterObject) of OpenAPI) -- typically a parameter will contain a 'name', optional 'description' and critically the 'schema' +- typically a parameter will contain a 'name', optional 'description' and critically the 'schema' - again 'schema' comes from OpenAPI [schemaObject](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#schemaObject) - In this example, there are two parameters one is a simple string, and the schema uses type to refer to this simply @@ -179,7 +179,7 @@ Where as the second uses the concept of references to permit a more complex obje This section defines the more complex components that can occur in functions. This is typicaly used to represent objects or similar in the contract. They are generated for example from the `@object` annotation. -In the above example, the schema is defined as +In the above example, the schema is defined as ```json "schema": { "$ref": "#/components/schemas/Greeting" @@ -214,11 +214,11 @@ The `#/components/schemas/Greeting` is a JSON pointer to the following element: The `schemas` section is an object listing the schemas (the key and $id element match). Each of these has the specification from the OpenAPI [schemaObject](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#schemaObject) -At runtime, any object that is supplied as one of the parameters matching a defined schema (in this case the Greeting object), has to match this supplied schema. The 'serializer' within the contract-api will produce a JSON representation of the object that is validated against this schema. +At runtime, any object that is supplied as one of the parameters matching a defined schema (in this case the Greeting object), has to match this supplied schema. The 'serializer' within the contract-api will produce a JSON representation of the object that is validated against this schema. -In this case for example, only the field 'text' is permitted - as additionalProperties is false. And has to be a string. +In this case for example, only the field 'text' is permitted - as additionalProperties is false. And has to be a string. -An other example would be to have a numeric value and limit its range. +An other example would be to have a numeric value and limit its range. ```json "age": { @@ -228,11 +228,11 @@ An other example would be to have a numeric value and limit its range. } ``` -Individual elements of an object can refer to other objects for example, and the overall object can define required fields. +Individual elements of an object can refer to other objects for example, and the overall object can define required fields. -This example is defining the concept of a person; who has a name, address and an age. +This example is defining the concept of a person; who has a name, address and an age. -- The name is mandatory and has to exist, +- The name is mandatory and has to exist, - additional properties not listed here will be accepted. - The address is defined elsewhere, and the age has to be at least 0 @@ -313,10 +313,10 @@ Strict semantic checking can be performed on strings and numbers. As an example **Note: The `required` tag at present is not enforced by the node chaincode.** -- __Pupilname__ this is a string, but has no restrictions placed up on it. +- __Pupilname__ this is a string, but has no restrictions placed up on it. - __formId__ a string, but has to matched the regular expression. In this case it has to be exactly composed of lower or upcase letters and numbers - __description__ a string, with the restriction that it can't be more than 100 characters in length - __lifetime__ an integer with minimum value of 1 and maxiomum of 30 - __startDate__ an string but has to contain a date (As defined by full-date - [RFC3339](http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14)). -The alternative to `format:date` is `format:dateTime` ... the string here has to confirmed to date-time defined in [RFC3339](http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) \ No newline at end of file +The alternative to `format:date` is `format:dateTime` ... the string here has to confirmed to date-time defined in [RFC3339](http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14) diff --git a/docs/_jsdoc/tutorials/deep-dive-contract-interface.md b/docs/_jsdoc/tutorials/deep-dive-contract-interface.md index 4352bceb..8b7588db 100644 --- a/docs/_jsdoc/tutorials/deep-dive-contract-interface.md +++ b/docs/_jsdoc/tutorials/deep-dive-contract-interface.md @@ -13,7 +13,7 @@ Each Smart Contract package is, from a node perspective, a NPM module. - A 'main' entry to point to your `index.js` file contain the exports of the node module - index.js - - It is mandatory to have a `contracts` element exported that is a array of classes. + - It is mandatory to have a `contracts` element exported that is a array of classes. - Each of these classes must extend the `Contract` class from the `fabric-contract-api` module - Optionally, a custom `serializer` may be defined to control how data is converted for transmission between chaincode, peer and ultimately client applications (in future this could also include serialization to the ledger state). @@ -37,14 +37,14 @@ export const contracts: any[] = [ GreetingContract ]; - META-INF/metadata.json (alternatively contract-metadata/metadata.json) -This file describes the *external* api that is exposed from these Smart Contracts; these are the functions that can be invoked by client applications. It describes all details about what is callable, and the datatypes of parameter and return values. It can also include information about documentation and licensing. +This file describes the *external* api that is exposed from these Smart Contracts; these are the functions that can be invoked by client applications. It describes all details about what is callable, and the datatypes of parameter and return values. It can also include information about documentation and licensing. -It describes the callable interface, and does not make any assertions about how the code is implemented. +It describes the callable interface, and does not make any assertions about how the code is implemented. ## Defining your contract classes The node module must export an array of one or more contract classes in the `contracts` property. -Each of these class must extend the correct type. At runtime each of these will have a single instance created, and will persist for the lifetime of the chaincode container. +Each of these class must extend the correct type. At runtime each of these will have a single instance created, and will persist for the lifetime of the chaincode container. > Each function MUST NOT use the instance to store data; all data MUST be stored within either the ledger, or within the transaction context @@ -61,7 +61,7 @@ export class GreetingContract extends Contract { The constructor must call super, the argument is optional but is used to name this instance, and is used to refer to this instance when it is called by client . applications. If no argument is supplied, then the name of the class is used (in this case GreetingContract ). If an empty string is supplied that is valid, but not recommended. -It is not recommended to supply the same name, the behaviour if function names within the two contracts overlap is undefined. +It is not recommended to supply the same name, the behaviour if function names within the two contracts overlap is undefined. ### Transaction Functions @@ -72,10 +72,10 @@ Each transaction must take as it's first parameter the transaction context ### Context -The first parameter is the 'transaction context' - it is quite plausible for several transactions to be invoked concurrently; the transaction context is required to give information specific to the transaction that is currently being executed. +The first parameter is the 'transaction context' - it is quite plausible for several transactions to be invoked concurrently; the transaction context is required to give information specific to the transaction that is currently being executed. Currently the 'stub' api for handling world state, and the 'Client Identity' is available from the context. -Each contract has a 'createContext' method that can be overridden by specific implementations to provide specific control to add information to the +Each contract has a 'createContext' method that can be overridden by specific implementations to provide specific control to add information to the ### Before, After, Around and Unknown Functions @@ -108,8 +108,8 @@ Typical use cases of these functions would be - checks of the identity of the caller - wrap all functions into a try/catch -The unknown function is called if the requested function is not known; the default implementation is to throw an error. `You've asked to invoke a function that does not exist: {requested function}` -However you can implement an `unkownTransition` function - this can return a successful or throw an error as you wish. +The unknown function is called if the requested function is not known; the default implementation is to throw an error. `You've asked to invoke a function that does not exist: {requested function}` +However you can implement an `unkownTransition` function - this can return a successful or throw an error as you wish. ```javascript async unknownTransaction(ctx) { @@ -124,7 +124,7 @@ A correctly specified metadata file, at the top level has this structure ```json { - "$schema" : "https://hyperledger.github.io/fabric-chaincode-node/master/api/contract-schema.json", + "$schema" : "https://hyperledger.github.io/fabric-chaincode-node/main/api/contract-schema.json", "info" : { }, @@ -137,4 +137,4 @@ A correctly specified metadata file, at the top level has this structure } ``` -The metadata file that the user specifies has precedence over the information generated from the code, on a per section basis. If the user has not specified any of the above sections, then the 'gap' will be filled with auto generated values. +The metadata file that the user specifies has precedence over the information generated from the code, on a per section basis. If the user has not specified any of the above sections, then the 'gap' will be filled with auto generated values. diff --git a/docs/_jsdoc/tutorials/using-chaincodeinterface.md b/docs/_jsdoc/tutorials/using-chaincodeinterface.md index 97a9fa5f..744ccff8 100644 --- a/docs/_jsdoc/tutorials/using-chaincodeinterface.md +++ b/docs/_jsdoc/tutorials/using-chaincodeinterface.md @@ -7,7 +7,7 @@ mkdir mycc cd mycc // create a new node project npm init -// install fabric-shim at master branch +// install fabric-shim at main branch npm install fabric-shim@2.3.1-unstable // or using the released version npm install fabric-shim diff --git a/libraries/fabric-shim/README.md b/libraries/fabric-shim/README.md index 6e9d85b7..da4676b5 100644 --- a/libraries/fabric-shim/README.md +++ b/libraries/fabric-shim/README.md @@ -18,7 +18,7 @@ npm install --save fabric-shim ``` ### Usage -The [chaincode interface](https://hyperledger.github.io/fabric-chaincode-node/master/api/fabric-shim.ChaincodeInterface.html) contains two methods to be implemented: +The [chaincode interface](https://hyperledger.github.io/fabric-chaincode-node/main/api/fabric-shim.ChaincodeInterface.html) contains two methods to be implemented: ```javascript const shim = require('fabric-shim'); @@ -53,7 +53,7 @@ shim.start(new Chaincode()); ``` ### API Reference -Visit [API Reference](https://hyperledger.github.io/fabric-chaincode-node/master/api/) and click on "Classes" link in the navigation bar on the top to view the list of class APIs. +Visit [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. ## Support Tested with node.js 8.9.0 (LTS). diff --git a/libraries/fabric-shim/lib/contract-spi/chaincodefromcontract.js b/libraries/fabric-shim/lib/contract-spi/chaincodefromcontract.js index cdde65fd..c4ca0eaa 100644 --- a/libraries/fabric-shim/lib/contract-spi/chaincodefromcontract.js +++ b/libraries/fabric-shim/lib/contract-spi/chaincodefromcontract.js @@ -183,7 +183,7 @@ class ChaincodeFromContract { _augmentMetadataFromCode(metadata) { if (!metadata.$schema) { - metadata.$schema = 'https://hyperledger.github.io/fabric-chaincode-node/master/api/contract-schema.json'; + metadata.$schema = 'https://hyperledger.github.io/fabric-chaincode-node/main/api/contract-schema.json'; } if (!metadata.contracts || Object.keys(metadata.contracts).length === 0) { diff --git a/libraries/fabric-shim/test/unit/contract-spi/chaincodefromcontract.js b/libraries/fabric-shim/test/unit/contract-spi/chaincodefromcontract.js index 68a70eb0..33bdb099 100644 --- a/libraries/fabric-shim/test/unit/contract-spi/chaincodefromcontract.js +++ b/libraries/fabric-shim/test/unit/contract-spi/chaincodefromcontract.js @@ -1221,7 +1221,7 @@ describe('chaincodefromcontract', () => { const metadata = fakeCcfc._augmentMetadataFromCode(partialMetadata); const correctData = { - '$schema': 'https://hyperledger.github.io/fabric-chaincode-node/master/api/contract-schema.json', + '$schema': 'https://hyperledger.github.io/fabric-chaincode-node/main/api/contract-schema.json', 'components': { 'schemas': {} }, @@ -1356,7 +1356,7 @@ describe('chaincodefromcontract', () => { metadata.components.should.deep.equal(metadataToSend.components); metadata.contracts.should.deep.equal(metadataToSend.contracts); metadata.info.should.deep.equal(metadataToSend.info); - metadata.$schema.should.deep.equal('https://hyperledger.github.io/fabric-chaincode-node/master/api/contract-schema.json'); + metadata.$schema.should.deep.equal('https://hyperledger.github.io/fabric-chaincode-node/main/api/contract-schema.json'); }); }); diff --git a/package.json b/package.json index 96be5751..4f5227cb 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "tag": "unstable", "description": "fabric-chaincode-node monorepo, built with rush", - "testFabricVersion": "master", + "testFabricVersion": "main", "testFabricCAVersion": "1.4.4", "testFabricThirdParty": "0.4.15", "docsLatestVersion": "release-1.4", diff --git a/test/chaincodes/annotations/src/test_contract/expected-metadata.json b/test/chaincodes/annotations/src/test_contract/expected-metadata.json index d4b8f53d..ab530c0d 100644 --- a/test/chaincodes/annotations/src/test_contract/expected-metadata.json +++ b/test/chaincodes/annotations/src/test_contract/expected-metadata.json @@ -1,5 +1,5 @@ { - "$schema": "https://hyperledger.github.io/fabric-chaincode-node/master/api/contract-schema.json", + "$schema": "https://hyperledger.github.io/fabric-chaincode-node/main/api/contract-schema.json", "contracts": { "TestContract": { "name": "TestContract", diff --git a/test/e2e/scenario.js b/test/e2e/scenario.js index 80185b0d..190b050e 100644 --- a/test/e2e/scenario.js +++ b/test/e2e/scenario.js @@ -47,7 +47,7 @@ const queryFunctions = async () => { const metadata = JSON.parse(stdout); - const expectedMetadata = '{"$schema":"https://hyperledger.github.io/fabric-chaincode-node/master/api/contract-schema.json","contracts":{"UpdateValues":{"name":"UpdateValues","contractInstance":{"name":"UpdateValues","logBuffer":{"output":[]},"default":true},"transactions":[{"name":"setup","tags":["submitTx"]},{"name":"setNewAssetValue","tags":["submitTx"],"parameters":[{"name":"arg0","description":"Argument 0","schema":{"type":"string"}}]},{"name":"doubleAssetValue","tags":["submitTx"]}],"info":{"title":"","version":""}},"RemoveValues":{"name":"RemoveValues","contractInstance":{"name":"RemoveValues"},"transactions":[{"name":"quarterAssetValue","tags":["submitTx"]},{"name":"getAssetValue","tags":["submitTx"]}],"info":{"title":"","version":""}},"org.hyperledger.fabric":{"name":"org.hyperledger.fabric","contractInstance":{"name":"org.hyperledger.fabric"},"transactions":[{"name":"GetMetadata"}],"info":{"title":"","version":""}}},"info":{"version":"1.0.0","title":"chaincode"},"components":{"schemas":{}}}'; + const expectedMetadata = '{"$schema":"https://hyperledger.github.io/fabric-chaincode-node/main/api/contract-schema.json","contracts":{"UpdateValues":{"name":"UpdateValues","contractInstance":{"name":"UpdateValues","logBuffer":{"output":[]},"default":true},"transactions":[{"name":"setup","tags":["submitTx"]},{"name":"setNewAssetValue","tags":["submitTx"],"parameters":[{"name":"arg0","description":"Argument 0","schema":{"type":"string"}}]},{"name":"doubleAssetValue","tags":["submitTx"]}],"info":{"title":"","version":""}},"RemoveValues":{"name":"RemoveValues","contractInstance":{"name":"RemoveValues"},"transactions":[{"name":"quarterAssetValue","tags":["submitTx"]},{"name":"getAssetValue","tags":["submitTx"]}],"info":{"title":"","version":""}},"org.hyperledger.fabric":{"name":"org.hyperledger.fabric","contractInstance":{"name":"org.hyperledger.fabric"},"transactions":[{"name":"GetMetadata"}],"info":{"title":"","version":""}}},"info":{"version":"1.0.0","title":"chaincode"},"components":{"schemas":{}}}'; const schema = fs.readFileSync(path.join(__dirname, '../../apis/fabric-contract-api/schema/contract-schema.json')); diff --git a/test/fv/package.json b/test/fv/package.json index 7c896806..f3ee0bc5 100644 --- a/test/fv/package.json +++ b/test/fv/package.json @@ -2,7 +2,7 @@ "name": "fvtests", "version": "2.3.1-unstable", "description": "fv tests", - "testFabricVersion": "master", + "testFabricVersion": "main", "testFabricThirdParty": "0.4.15", "docsLatestVersion": "release-1.4", "engines": {