digitalproperty-network
Advanced tools
Comparing version 0.0.1 to 0.0.2-20170314174623
/* | ||
* IBM Confidential | ||
* OCO Source Materials | ||
* IBM Mozart - Blockchain Solution Framework | ||
* Copyright IBM Corp. 2016 | ||
* The source code for this program is not published or otherwise | ||
* divested of its trade secrets, irrespective of what has | ||
* been deposited with the U.S. Copyright Office. | ||
*/ | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ |
@@ -15,7 +15,11 @@ /* | ||
/* global getAssetRegistry */ | ||
/*eslint-disable no-unused-vars*/ | ||
/*eslint-disable no-undef*/ | ||
'use strict'; | ||
/** | ||
* Process a property that is held for sale | ||
* @param {net.biz.digitalPropertyNetwork.RegisterPropertyForSale} propertyForSale the property to be sold | ||
* @return {Promise} Asset Registry Promise | ||
* @transaction | ||
@@ -28,5 +32,5 @@ */ | ||
return getAssetRegistry('net.biz.digitalPropertyNetwork.LandTitle').then(function(result) { | ||
return result.update(propertyForSale.title); | ||
} | ||
return result.update(propertyForSale.title); | ||
} | ||
); | ||
} |
{ | ||
"name": "digitalproperty-network", | ||
"version": "0.0.1", | ||
"version": "0.0.2-20170314174623", | ||
"description": "Digital Property Network", | ||
"scripts": { | ||
"prepublish": "mkdirp ./dist && composer archive create --sourceType dir --sourceName . -a ./dist/digitalproperty-network.zip", | ||
"pretest": "npm run lint", | ||
@@ -16,17 +16,16 @@ "lint": "eslint .", | ||
}, | ||
"author": "Fabric Composer", | ||
"license": "Apache-2.0", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/fabric-composer/sample-networks.git" | ||
}, | ||
"keywords": [ | ||
"land" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/fabric-composer/fabric-composer.git" | ||
}, | ||
"author": "Fabric Composer", | ||
"license": "Apache-2", | ||
"devDependencies": { | ||
"composer-admin": "~0.3.0-0", | ||
"composer-cli": "^0.3.0-0", | ||
"composer-client": "~0.3.0-0", | ||
"composer-common": "~0.3.2-0", | ||
"composer-connector-embedded": "~0.3.0-0", | ||
"composer-admin": "*", | ||
"composer-cli": "*", | ||
"composer-client": "*", | ||
"composer-connector-embedded": "*", | ||
"chai": "^3.5.0", | ||
@@ -58,2 +57,2 @@ "eslint": "^3.6.1", | ||
} | ||
} | ||
} |
/* | ||
* IBM Confidential | ||
* OCO Source Materials | ||
* IBM Mozart - Blockchain Solution Framework | ||
* Copyright IBM Corp. 2016 | ||
* The source code for this program is not published or otherwise | ||
* divested of its trade secrets, irrespective of what has | ||
* been deposited with the U.S. Copyright Office. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
@@ -13,5 +17,5 @@ | ||
const AdminConnection = require('@ibm/concerto-admin').AdminConnection; | ||
const BusinessNetworkConnection = require('@ibm/concerto-client').BusinessNetworkConnection; | ||
const BusinessNetworkDefinition = require('@ibm/concerto-common').BusinessNetworkDefinition; | ||
const AdminConnection = require('composer-admin').AdminConnection; | ||
const BusinessNetworkConnection = require('composer-client').BusinessNetworkConnection; | ||
const BusinessNetworkDefinition = require('composer-common').BusinessNetworkDefinition; | ||
const path = require('path'); | ||
@@ -40,3 +44,3 @@ | ||
businessNetworkConnection = new BusinessNetworkConnection(); | ||
return businessNetworkConnection.connect('testprofile', '@ibm/digitalproperty-network', 'WebAppAdmin', 'DJY27pEnl16d'); | ||
return businessNetworkConnection.connect('testprofile', 'digitalproperty-network', 'WebAppAdmin', 'DJY27pEnl16d'); | ||
}); | ||
@@ -51,8 +55,12 @@ }); | ||
let factory = businessNetworkConnection.getBusinessNetwork().getFactory(); | ||
let seller = factory.newInstance('net.biz.digitalPropertyNetwork', 'Person', 'P1'); | ||
seller. firstName = 'Dan'; | ||
seller.lastName = 'Selman'; | ||
let landTitle = factory.newInstance('net.biz.digitalPropertyNetwork', 'LandTitle', 'TITLE_1'); | ||
let person = factory.newInstance('net.biz.digitalPropertyNetwork', 'Person', 'PERSON_1'); | ||
person.firstName = 'Test'; | ||
person.lastName = 'User'; | ||
let person = factory.newRelationship('net.biz.digitalPropertyNetwork', 'Person', 'P1'); | ||
landTitle.owner = person; | ||
landTitle.information = 'Some information'; | ||
landTitle.forSale = false; | ||
@@ -62,33 +70,34 @@ // Create the transaction. | ||
transaction.title = factory.newRelationship('net.biz.digitalPropertyNetwork', 'LandTitle', 'TITLE_1'); | ||
transaction.seller = person; | ||
// Get the asset registry. | ||
return businessNetworkConnection.getAssetRegistry('net.biz.digitalPropertyNetwork.LandTitle') | ||
return businessNetworkConnection.getParticipantRegistry('net.biz.digitalPropertyNetwork.Person') | ||
.then((personRegistry) => { | ||
return personRegistry.add(seller); | ||
}) | ||
.then(() => { | ||
return businessNetworkConnection.getAssetRegistry('net.biz.digitalPropertyNetwork.LandTitle'); | ||
}) | ||
.then((assetRegistry) => { | ||
// Add the LandTitle asset to the asset registry. | ||
return assetRegistry.add(landTitle) | ||
.then(() => { | ||
return assetRegistry.add(landTitle); | ||
}) | ||
.then(() => { | ||
// Submit the transaction. | ||
return businessNetworkConnection.submitTransaction(transaction); | ||
// Submit the transaction. | ||
return businessNetworkConnection.submitTransaction(transaction); | ||
}) | ||
.then(() => { | ||
// Get the modified land title. | ||
return assetRegistry.get('TITLE_1'); | ||
}) | ||
.then((modifiedLandTitle) => { | ||
// Ensure the LandTitle has been modified correctly. | ||
modifiedLandTitle.forSale.should.be.true; | ||
}); | ||
}) | ||
.then(() => { | ||
return businessNetworkConnection.getAssetRegistry('net.biz.digitalPropertyNetwork.LandTitle'); | ||
}) | ||
.then((assetRegistry) => { | ||
// Get the modified land title. | ||
return assetRegistry.get('TITLE_1'); | ||
}) | ||
.then((modifiedLandTitle) => { | ||
// Ensure the LandTitle has been modified correctly. | ||
modifiedLandTitle.forSale.should.be.true; | ||
}); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
25383
13
15
157
0