'use strict' ; import { IFabricEnvironmentConnection , IFabricGatewayConnection , OutputAdapter , IFabricWalletGenerator , FabricWalletGeneratorFactory } from 'ibm-blockchain-platform-common' ; export class FabricConnectionFactory { public static createFabricGatewayConnection ( connection , outputAdapter ? ) { if ( ! this . gatewayConnection ) { this . gatewayConnection = require ( 'ibm-blockchain-platform-gateway-v1' ) ; } return new ( this . gatewayConnection ) . FabricGatewayConnection ( connection , outputAdapter ) ; } public static createFabricEnvironmentConnection ( environmentName , outputAdapter ? ) { if ( ! this . environmentConnection ) { this . environmentConnection = require ( 'ibm-blockchain-platform-environment-v1' ) ; } return new ( this . environmentConnection ) . FabricEnvironmentConnection ( environmentName , outputAdapter ) ; } public static createFabricWallet ( ) { if ( ! this . walletConnection ) { this . walletConnection = require ( 'ibm-blockchain-platform-wallet' ) ; const walletGenerator = ( this . walletConnection ) . FabricWalletGenerator . instance ( ) ; FabricWalletGeneratorFactory . setFabricWalletGenerator ( walletGenerator ) ; } } private static environmentConnection : any ; private static gatewayConnection : any ; private static walletConnection : any ; }