Class: EmbeddedConnection

(abstract, protected) EmbeddedConnection(connectionManager, connectionProfile, businessNetworkIdentifier)

Base class representing a connection to a business network.

Constructor

(abstract, protected) new EmbeddedConnection(connectionManager, connectionProfile, businessNetworkIdentifier)

Constructor.

Parameters:
Name Type Description
connectionManager ConnectionManager

The owning connection manager.

connectionProfile string

The name of the connection profile associated with this connection

businessNetworkIdentifier string

The identifier of the business network for this connection

Source:

Methods

(static) addBusinessNetwork(businessNetworkIdentifier, connectionProfile, chaincodeUUID)

Add a business network.

Parameters:
Name Type Description
businessNetworkIdentifier string

The business network identifier.

connectionProfile string

The connection profile name.

chaincodeUUID string

The chaincode UUID.

Source:

(static) addChaincode(chaincodeUUID, container, engine, ibn)

Add a chaincode.

Parameters:
Name Type Description
chaincodeUUID string

The chaincode UUID.

container Container

The container.

engine Engine

The engine.

ibn InstalledBusinessNetwork

The Installed Business Network

Source:

(static) addInstalledChaincode(businessNetworkDefinition)

Add chaincode package to the list of installed chaincodes, keyed off of the name and version only.

Parameters:
Name Type Description
businessNetworkDefinition BusinessNetworkDefinition

the business network definition which defines the chaincode

Source:

(static) createContainer() → {Container}

Create a new container.

Source:
Returns:

The new container.

Type
Container

(static) createEngine(container) → {Engine}

Create a new engine.

Parameters:
Name Type Description
container Container

The container.

Source:
Returns:

The new engine.

Type
Engine

(static) getBusinessNetwork(businessNetworkIdentifier, connectionProfile) → {string}

Get the specified business network.

Parameters:
Name Type Description
businessNetworkIdentifier string

The business network identifier.

connectionProfile string

The connection profile name.

Source:
Returns:

The chaincode UUID.

Type
string

(static) getChaincode(chaincodeUUID) → {object}

Get the specified chaincode.

Parameters:
Name Type Description
chaincodeUUID string

The chaincode UUID.

Source:
Returns:

The chaincode.

Type
object

(static) getInstalledChaincode(name, version) → {BusinessNetworkDefinition}

Retrieve a business network definition chaincode keyed off name and version.∂

Parameters:
Name Type Description
name string

The name of the chaincode to retrieve

version string

The version of the chaincode to retrieve

Source:
Returns:

A business network definition chaincode or null if not found.

Type
BusinessNetworkDefinition

(static) reset()

Clear any registered business networks and chaincodes.

Source:

(async) _createAdminIdentity() → {Promise}

Create the default admin identity.

Source:
Returns:

A promise that is resolved with the admin identity when complete,
or rejected with an error.

Type
Promise

(async) createIdentity(securityContext, identityName, optionsopt) → {Promise}

Create a new identity for the specified name.

Parameters:
Name Type Attributes Description
securityContext SecurityContext

The participant's security context.

identityName string

The name for the new identity.

options object <optional>

Options for the new identity.

Properties
Name Type Attributes Description
issuer boolean <optional>

Whether or not the new identity should have
permissions to create additional new identities. False by default.

affiliation string <optional>

Specify the affiliation for the new
identity. Defaults to 'institution_a'.

Source:
Returns:

A promise that is resolved with a generated user
secret once the new identity has been created, or rejected with an error.

Type
Promise

(async) createTransactionId(securityContext) → {Promise}

Create a new transaction id
Note: as this is not a real fabric it returns null to let the composer-common use uuid to create one.

Parameters:
Name Type Description
securityContext SecurityContext

The participant's security context.

Source:
Returns:

A promise that is resolved with a null

Type
Promise

(async) disconnect()

Terminate the connection to the business network.

Source:

(async) getIdentities() → {Promise}

Get the data collection that stores identities.

Source:
Returns:

A promise that is resolved with the data collection
that stores identities.

Type
Promise

(async) getIdentity(identityName) → {Promise}

Get the identity for the specified name.

Parameters:
Name Type Description
identityName string

The name for the identity.

Source:
Returns:

A promise that is resolved with the identity, or
rejected with an error.

Type
Promise

getNativeAPI()

Get the native API for this connection. The native API returned is specific
to the underlying blockchain platform, and may throw an error if there is no
native API available.

Source:

(async) install(securityContext, businessNetworkDefinition, installOptions) → {Promise}

For the embedded connector, this is just a no-op, there is nothing to install. I Don't think this is true now

Parameters:
Name Type Description
securityContext SecurityContext

The participant's security context.

businessNetworkDefinition string

The business network definition that will be started

installOptions Object

connector specific installation options

Source:
Returns:

returns a resolved promise to indicate success

Type
Promise

(async) invokeChainCode(securityContext, functionName, args, additionalConnectorOptionsopt) → {Buffer}

Invoke a "invoke" chaincode function with the specified name and arguments.

Parameters:
Name Type Attributes Description
securityContext SecurityContext

The participant's security context.

functionName string

The name of the chaincode function to invoke.

args Array.<string>

The arguments to pass to the chaincode function.

additionalConnectorOptions Object <optional>

Additional connector specific options for this transaction.

Source:
Returns:

A buffer containing the data returned by the chaincode function,
or null if no data was returned.

Type
Buffer

(async) login(enrollmentID, enrollmentSecret) → {Promise}

Login as a participant on the business network.

Parameters:
Name Type Description
enrollmentID string

The enrollment ID of the participant.

enrollmentSecret string

The enrollment secret of the participant.

Source:
Returns:

A promise that is resolved with a SecurityContext
object representing the logged in participant, or rejected with a login error.

Type
Promise

(async) ping(securityContext) → {Promise}

Test ("ping") the connection to the business network.

Parameters:
Name Type Description
securityContext SecurityContext

The participant's security context.

Source:
Returns:

A promise that is resolved once the connection to the
business network has been tested, or rejected with an error.

Type
Promise

(async) queryChainCode(securityContext, functionName, args) → {Buffer}

Invoke a "query" chaincode function with the specified name and arguments.

Parameters:
Name Type Description
securityContext SecurityContext

The participant's security context.

functionName string

The name of the chaincode function to invoke.

args Array.<string>

The arguments to pass to the chaincode function.

Source:
Returns:

A buffer containing the data returned by the chaincode function,
or null if no data was returned.

Type
Buffer

registryCheckRequired() → {boolean}

Return whether a registry check is required before executing createIdentity to prevent duplicates.

Source:
Returns:

true.

Type
boolean

(async) start(securityContext, businessNetworkIdentifier, businessNetworkVersion, startTransaction, startOptions)

Start a business network.

Parameters:
Name Type Description
securityContext HFCSecurityContext

The participant's security context.

businessNetworkIdentifier string

The identifier of the Business network that will be started in this installed runtime

businessNetworkVersion string

The version of the Business network that will be started in this installed runtime

startTransaction string

The serialized start transaction.

startOptions Object

connector specific start options

Source:

(async) testIdentity(identityName, identitySecret) → {Promise}

Test the specified identity name and secret to ensure that it is valid.
admin userid doesn't require a secret.

Parameters:
Name Type Description
identityName string

The name for the identity.

identitySecret string

The secret for the identity.

Source:
Returns:

A promise that is resolved if the user ID and secret
is valid, or rejected with an error.

Type
Promise

(async) undeploy(securityContext, networkName)

Undeploy a business network definition.

Parameters:
Name Type Description
securityContext SecurityContext

The participant's security context.

networkName String

Name of the business network to remove

Source:

(async) upgrade(securityContext, businessNetworkIdentifier, businessNetworkVersion, upgradeOptions)

Upgrade a business network. This connector implementation effectively allows you to
switch between installed chaincodes, and doesn't complain even if you switch to the
same chaincode.

Parameters:
Name Type Description
securityContext HFCSecurityContext

The participant's security context.

businessNetworkIdentifier string

The name of the business network to upgrade.

businessNetworkVersion String

The version of the business network to upgrade.

upgradeOptions Object

connector specific start options

Source: