new Gateway()
Methods
-
<async> connect(config, options)
-
Connect to the Gateway with a connection profile or a prebuilt Client instance.
Parameters:
Name Type Description config
object | Client The configuration for this Gateway which can be: - A common connection profile JSON (Object)
- A pre-configured client instance
options
module:fabric-network.GatewayOptions specific options for creating this Gateway instance Example
const gateway = new Gateway(); const wallet = await Wallets.newFileSystemWallet('./WALLETS/wallet'); const connectionProfileJson = (await fs.promises.readFile('network.json')).toString(); const connectionProfile = JSON.parse(connectionProfileJson); await gateway.connect(connectionProfile, { identity: 'admin', wallet: wallet });
-
disconnect()
-
Clean up and disconnect this Gateway connection in preparation for it to be discarded and garbage collected
-
getIdentity()
-
Get the identity associated with the gateway connection.
Returns:
An identity. -
<async> getNetwork(networkName)
-
Returns an object representing a network
Parameters:
Name Type Description networkName
string The name of the network (channel name) Returns:
-
getOptions()
-
Returns the set of options associated with the Gateway connection
Returns:
The Gateway connection options- Type
- module:fabric-network.Gateway~GatewayOptions