Socket
Socket
Sign inDemoInstall

digitalproperty-network

Package Overview
Dependencies
Maintainers
3
Versions
185
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

digitalproperty-network - npm Package Compare versions

Comparing version 0.2.1-20180106190715 to 0.2.1-20180106210816

11

lib/DigitalLandTitle.js

@@ -16,4 +16,2 @@ /*

/* global getAssetRegistry */
/*eslint-disable no-unused-vars*/
/*eslint-disable no-undef*/

@@ -24,13 +22,10 @@ 'use strict';

* @param {net.biz.digitalPropertyNetwork.RegisterPropertyForSale} propertyForSale the property to be sold
* @return {Promise} Asset Registry Promise
* @transaction
*/
function onRegisterPropertyForSale(propertyForSale) {
async function onRegisterPropertyForSale(propertyForSale) { // eslint-disable-line no-unused-vars
console.log('### onRegisterPropertyForSale ' + propertyForSale.toString());
propertyForSale.title.forSale = true;
return getAssetRegistry('net.biz.digitalPropertyNetwork.LandTitle').then(function(result) {
return result.update(propertyForSale.title);
}
);
const registry = await getAssetRegistry('net.biz.digitalPropertyNetwork.LandTitle');
await registry.update(propertyForSale.title);
}

@@ -6,3 +6,3 @@ {

"name": "digitalproperty-network",
"version": "0.2.1-20180106190715",
"version": "0.2.1-20180106210816",
"description": "Digital Property Network",

@@ -9,0 +9,0 @@ "networkImage": "https://hyperledger.github.io/composer-sample-networks/packages/digitalproperty-network/networkimage.svg",

@@ -32,3 +32,3 @@ /*

before(() => {
before(async () => {
// Embedded connection used for local testing

@@ -57,8 +57,7 @@ const connectionProfile = {

return adminConnection.importCard(deployerCardName, deployerCard).then(() => {
return adminConnection.connect(deployerCardName);
});
await adminConnection.importCard(deployerCardName, deployerCard);
await adminConnection.connect(deployerCardName);
});
beforeEach(() => {
beforeEach(async () => {
businessNetworkConnection = new BusinessNetworkConnection({ cardStore: cardStore });

@@ -68,27 +67,24 @@

let adminCardName;
let businessNetworkDefinition;
let businessNetworkDefinition = await BusinessNetworkDefinition.fromDirectory(path.resolve(__dirname, '..'));
return BusinessNetworkDefinition.fromDirectory(path.resolve(__dirname, '..')).then(definition => {
businessNetworkDefinition = definition;
// Install the Composer runtime for the new business network
return adminConnection.install(businessNetworkDefinition.getName());
}).then(() => {
// Start the business network and configure an network admin identity
const startOptions = {
networkAdmins: [
{
userName: adminUserName,
enrollmentSecret: 'adminpw'
}
]
};
return adminConnection.start(businessNetworkDefinition, startOptions);
}).then(adminCards => {
// Import the network admin identity for us to use
adminCardName = `${adminUserName}@${businessNetworkDefinition.getName()}`;
return adminConnection.importCard(adminCardName, adminCards.get(adminUserName));
}).then(() => {
// Connect to the business network using the network admin identity
return businessNetworkConnection.connect(adminCardName);
});
// Install the Composer runtime for the new business network
await adminConnection.install(businessNetworkDefinition.getName());
// Start the business network and configure an network admin identity
const startOptions = {
networkAdmins: [
{
userName: adminUserName,
enrollmentSecret: 'adminpw'
}
]
};
const adminCards = await adminConnection.start(businessNetworkDefinition, startOptions);
// Import the network admin identity for us to use
adminCardName = `${adminUserName}@${businessNetworkDefinition.getName()}`;
await adminConnection.importCard(adminCardName, adminCards.get(adminUserName));
// Connect to the business network using the network admin identity
await businessNetworkConnection.connect(adminCardName);
});

@@ -98,3 +94,3 @@

it('should change the forSale flag from undefined to true', () => {
it('should change the forSale flag from undefined to true', async () => {

@@ -120,31 +116,19 @@ // Create the existing LandTitle asset.

// Get the asset registry.
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(() => {
// Submit the transaction.
return businessNetworkConnection.submitTransaction(transaction);
const personRegistry = await businessNetworkConnection.getParticipantRegistry('net.biz.digitalPropertyNetwork.Person');
await personRegistry.add(seller);
})
.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;
});
// Add the LandTitle asset to the asset registry.
const assetRegistry = await businessNetworkConnection.getAssetRegistry('net.biz.digitalPropertyNetwork.LandTitle');
await assetRegistry.add(landTitle);
// Submit the transaction.
await businessNetworkConnection.submitTransaction(transaction);
// Get the modified land title.
const modifiedLandTitle = await assetRegistry.get('TITLE_1');
// Ensure the LandTitle has been modified correctly.
modifiedLandTitle.forSale.should.be.true;
});
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc