Platform

Platform

Handles all functions related to the blockcluster platform operation

Constructor

new Platform(options)

Source:
Properties:
Name Type Description
privatehive Privatehive

Privatehive networks related functions

Parameters:
Name Type Description
options object

Options

Properties
Name Type Attributes Description
apiKey string

API Key for authentication

domain string <optional>

Domain where the platform is hosted

Methods

(async) acceptInvite(options) → {Promise.<any>}

Source:

Accepts an invite sent using the inviteViaEmail() function

Parameters:
Name Type Description
options object

Invite options

Properties
Name Type Description
inviteId string

Id of the invite to accept

locationCode string

Location code from the list of available location from fetchLocations() function

networkConfigId string

Id of the network type from the fetchNetworkType() function

Returns:

Instance id or error

Type
Promise.<any>

(async) acceptPrivatehiveChannelInvite(inviteId, peerId) → {string}

Source:
Deprecated:
  • Since 3.0.1. Use Platform.privatehive.acceptChannelInvite

Accepts an invite to join a channel

Parameters:
Name Type Description
inviteId string

InviteID to be accepted

peerId string

InstanceID of the peer to join the channel

Returns:

InstanceID of the joined peer

Type
string

(async) createNetwork(options) → {Promise.<(string|err)>}

Source:

Creates a blockcluster node

Parameters:
Name Type Description
options object

Network options

Properties
Name Type Description
networkName string

Name of the network to be created

networkConfigId string

Id of the network type from the fetchNetworkType() function

locationCode string

Location code from the list of available location from fetchLocations() function

Returns:

Id of the network which was created

Type
Promise.<(string|err)>

(async) createPrivatehiveNetwork(options) → {string}

Source:
Deprecated:
  • Since 3.0.1. Use Platform.privatehive.create

Creates a privatehive node

Parameters:
Name Type Description
options object

Options

Properties
Name Type Attributes Description
peerId string <optional>

Peer Id to which the orderer joins. Required only incase of orderer type

locationCode string

Location code where the network should be deployed

type peer | orderer

Type of network. Either peer or orderer

voucherCode string <optional>

Voucher code to be applied

name string

Name of the network. Required

orgName string

Organization to which the node belongs to

ordererType solo | kafka <optional>

Type of orderer to be created. Solo or Kafka. Required only if type is orderer

networkConfigId stirng

ID of network configuration

diskSpace number <optional>

Disk space required for this node. Applicable only if network configuration has isDiskChangeable = true

Returns:

Instance ID of the created network

Type
string

(async) deleteNetwork(networkId) → {Promise.<any>}

Source:

Deletes a network from the blockcluster platform

Parameters:
Name Type Description
networkId string

Id of the network to be deleted

Returns:

Response of the delete operation

Type
Promise.<any>

(async) deletePrivatehiveNetwork(networkId) → {string}

Source:
Deprecated:
  • Since 3.0.1. Use Platform.privatehive.delete

Delets a privatehive node

Parameters:
Name Type Description
networkId string

Instance ID of the network to be deleted

Returns:

InstanceID of deleted network

Type
string

(async) fetchLocations(serviceopt) → {Promise.<array>}

Source:

Fetches all the applicable locations. You need to pass the location code in any create or invite request

Parameters:
Name Type Attributes Default Description
service dynamo | privatehive <optional>
dynamo

Service for which the locations are to be fetched

Returns:

List of locations

Type
Promise.<array>

(async) fetchNetworkTypes(serviceopt) → {Promise.<array>}

Source:

Fetches all the applicable network types. You need to pass the network type id in any create or invite request

Parameters:
Name Type Attributes Default Description
service dynamo | privatehive <optional>
dynamo

Service for which the configurations are to be fetched

Returns:

List of network types

Type
Promise.<array>

getPrivatehiveNode(nodeInfo) → {PrivatehiveNode}

Source:

const res = await helpers.sendPlatformRequest({ domain: this.domain, path, method: 'GET', apiKey: this.apiKey }); return res.data; } catch (err) { return Promise.reject(err); } }

/** Returns privatehive node object to operate on it

Parameters:
Name Type Description
nodeInfo object

Node information details. Can be fetched from listPrivatehiveNetworks(instanceId)

Returns:

Privatehive node instance

Type
PrivatehiveNode

(async) inviteUserToChannel(params) → {string}

Source:
Deprecated:
  • Since 3.0.1. Use Platform.privatehive.inviteUserToChannel

Invites a user to a HLF channel. The invited user can select the peer which will join the channel

Parameters:
Name Type Description
params object

Options

Properties
Name Type Description
email string

Email of the user to be invited

peerId string

Instance ID of the peer to be invited

channelName string

Channel to which the user should be invited to

ordererDomain string

Domain of the orderer

ordererConnectionDetails string

Connection details of the orderer like "grpc://1.2.3.4:1234"

Returns:

Invite ID

Type
string

(async) inviteViaEmail(options) → {Promise.<string>}

Source:

Invites another use to join a node on the blockcluster platform

Parameters:
Name Type Description
options object

Invite options

Properties
Name Type Description
inviteToEmail string

Email id of the user to be invited. The email id should be a user of blockcluster to be able to join the network. If the user is not on the blockcluster platform then an account in pending state will be created with this email id

networkId string

Id of the network to which the new node should join

networkType string.<(peer|authority)>

Type of network the new network will be

Returns:

Invite id of the invite. Use this invite id to accept

Type
Promise.<string>

(async) joinNetwork(options) → {Promise.<any>}

Source:

Creates a network which will be joined to an existing network having all the details

Parameters:
Name Type Description
options object

Network options

Properties
Name Type Description
networkName string

Name of the network to be created

nodeType string.<(authority|peer)>

Type of network

genesisFileContent string

Content of genesis block

totalENodes Array.<string>

List of enode urls to be joined

impulseURL string

URL of impulse

assetsContractAddress string

Asset smart contract address

atomicSwapContractAddress string

Atomic Swap smart contract address

streamsContractAddress string

Steams smart contract address

impulseContractAddress string

Impulse smart contract address

locationCode string

Location code from the list of available location from fetchLocations() function

networkConfigId string

Id of the network type from the fetchNetworkType() function

Returns:

Instance id or error message

Type
Promise.<any>

(async) listPrivatehiveNetworks(instanceIdopt, options) → {Array.<Node>}

Source:
Deprecated:
  • Since 3.0.1. Use Platform.privatehive.list

Lists details of privatehive networks

Parameters:
Name Type Attributes Description
instanceId string <optional>

If provided then fetches details of only this instance

options object

Additional filters

Properties
Name Type Attributes Description
showDeleted bool <optional>

If true then shows all the deleted networks as well

nodeType peer | orderer <optional>

Queries only a particular type of node

locationCode string <optional>

Queries networks only in this location

createdAfter date <optional>

Queries networks created after this date

createdBefore date <optional>

Queries networks created before this date

Returns:

Array of networks matching the filters

Type
Array.<Node>