File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed
Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -603,13 +603,13 @@ export class Proxy {
603603 * @returns
604604 * @memberof Proxy
605605 */
606- async getContractMetadata ( network_id , contract_name ) {
606+ async getContractMetadata ( network_id , contract_name , channel_genesis_hash ) {
607607 const client = this . platform . getClient ( network_id ) ;
608- const channel_name = Object . keys ( client . fabricGateway . config . channels ) [ 0 ] ;
608+ const channel_name = client . getChannelNameByHash ( channel_genesis_hash ) ;
609609 let metadata ;
610610 try {
611- metadata = await client . fabricGateway . queryContractMetadata ( channel_name , contract_name ) ;
612- } catch ( e ) {
611+ metadata = await client . fabricGateway . queryContractMetadata ( channel_name , contract_name , channel_genesis_hash ) ;
612+ } catch ( e ) {
613613 logger . debug ( 'getContractMetadata >> ' , e ) ;
614614 } if ( metadata ) {
615615 return metadata ;
Original file line number Diff line number Diff line change @@ -260,10 +260,11 @@ export async function platformroutes(
260260 * GET /metadata
261261 * curl -i 'http://<host>:<port>/metadata/<chaincode>'
262262 */
263- router . get ( '/metadata/:chaincode' , ( req , res ) => {
263+ router . get ( '/metadata/:channel_genesis_hash/: chaincode' , ( req , res ) => {
264264 const chaincode = req . params . chaincode ;
265- if ( chaincode ) {
266- proxy . getContractMetadata ( req . network , chaincode ) . then ( ( data : any ) => {
265+ const channel_genesis_hash = req . params . channel_genesis_hash ;
266+ if ( chaincode && channel_genesis_hash ) {
267+ proxy . getContractMetadata ( req . network , chaincode , channel_genesis_hash ) . then ( ( data : any ) => {
267268 res . send ( { status : 200 , data : data } ) ;
268269 } ) ;
269270 } else {
You can’t perform that action at this time.
0 commit comments