From 55c8f55fcd726780eada9a9537bccbb5f131f171 Mon Sep 17 00:00:00 2001 From: "Mark S. Lewis" Date: Thu, 6 Dec 2018 13:57:09 +0000 Subject: [PATCH] FABN-1053: Rename contract namespace to name Change to parameter, JSDoc and TypeScript definitions for Network.getContract(). Change-Id: Ib9130d5b715660d48cba71345c65f642e3abdcd2 Signed-off-by: Mark S. Lewis --- fabric-network/lib/network.js | 8 ++++---- fabric-network/types/index.d.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fabric-network/lib/network.js b/fabric-network/lib/network.js index d3aaa75130..d694baefb2 100644 --- a/fabric-network/lib/network.js +++ b/fabric-network/lib/network.js @@ -152,15 +152,15 @@ class Network { /** * Get an instance of a contract (chaincode) on the current network. * @param {string} chaincodeId the chaincode identifier. - * @param {string} [namespace] optional namespace for the contract. + * @param {string} [name] name of the contract. * @returns {module:fabric-network.Contract} the contract. */ - getContract(chaincodeId, namespace = '') { + getContract(chaincodeId, name = '') { logger.debug('in getContract'); if (!this.initialized) { throw new Error('Unable to get contract as network has failed to initialize'); } - const key = `${chaincodeId}:${namespace}`; + const key = `${chaincodeId}:${name}`; let contract = this.contracts.get(key); if (!contract) { contract = new Contract( @@ -168,7 +168,7 @@ class Network { chaincodeId, this.gateway, this.queryHandler, - namespace + name ); this.contracts.set(key, contract); } diff --git a/fabric-network/types/index.d.ts b/fabric-network/types/index.d.ts index 50d98dc5f2..c6cd6a95d3 100644 --- a/fabric-network/types/index.d.ts +++ b/fabric-network/types/index.d.ts @@ -58,7 +58,7 @@ export class Gateway { export class Network { public getChannel(): Channel; - public getContract(chaincodeId: string, namespace?: string): Contract; + public getContract(chaincodeId: string, name?: string): Contract; } export class Contract {