-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathtemp.js
More file actions
69 lines (48 loc) · 2.13 KB
/
temp.js
File metadata and controls
69 lines (48 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
'use strict';
/**
* Write the unit tests for your transction processor functions here
*/
const participantRegistry
const asset_of_type_B
const asset_A_Registry
asset_A_Registry.add(asset_of_type_A)
asset_A_Registry.add(asset_of_type_B)
const asset_B_Registry
var asset_a_instance_1
var asset_a_instance_2
var createFlightTransaction = Factory.newTransaction( );
createFlightTransaction.setPropertyValue('property_name', 'property_value')
const AdminConnection = require('composer-admin').AdminConnection;
const BusinessNetworkConnection = require('composer-client').BusinessNetworkConnection;
const BusinessNetworkDefinition = require('composer-common').BusinessNetworkDefinition;
const IdCard = require('composer-common').IdCard;
const MemoryCardStore = require('composer-common').MemoryCardStore;
const namespace = 'org.example.biznet';
const assetType = 'SampleAsset';
// In-memory card store for testing so cards are not persisted to the file system
const cardStore = new MemoryCardStore();
let adminConnection;
let businessNetworkConnection;
// Embedded connection used for local testing
const connectionProfile = {
name: 'embedded',
type: 'embedded'
};
// Embedded connection does not need real credentials
const credentials = {
certificate: 'FAKE CERTIFICATE',
privateKey: 'FAKE PRIVATE KEY'
};
// PeerAdmin identity used with the admin connection to deploy business networks
const deployerMetadata = {
version: 1,
userName: 'PeerAdmin',
roles: [ 'PeerAdmin', 'ChannelAdmin' ]
};
const deployerCard = new IdCard(deployerMetadata, connectionProfile);
deployerCard.setCredentials(credentials);
const deployerCardName = 'PeerAdmin';
adminConnection = new AdminConnection({ cardStore: cardStore });
return adminConnection.importCard(deployerCardName, deployerCard).then(() => {
return adminConnection.connect(deployerCardName);
});