Skip to content

Commit

Permalink
[besu] Updates
Browse files Browse the repository at this point in the history
Signed-off-by: sownak.roy <[email protected]>
  • Loading branch information
sownak committed Jan 22, 2024
1 parent 6aa5553 commit 4919ac1
Show file tree
Hide file tree
Showing 29 changed files with 146 additions and 300 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@
**/.vscode/
# custom config templates
*_custom.tpl
.env*
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ router.get("/:trackingID?", function(req, res) {
container.custodian = newContainer.custodian;
container.custodian = container.custodian + "," + newContainer.lastScannedAt;
container.trackingID = newContainer.trackingID;
let timestampAsNumber = Number(newContainer.timestamp);
if(protocol==="raft")
container.timestamp = (new Date(newContainer.timestamp/1000000)).getTime();
container.timestamp = (new Date(timestampAsNumber/1000000)).getTime();
else
container.timestamp = (new Date(newContainer.timestamp*1000)).getTime();
container.timestamp = (new Date(timestampAsNumber*1000)).getTime();
container.containerID = newContainer.containerID;
container.linearId = {};
container.linearId.externalId = null;
Expand Down Expand Up @@ -90,10 +91,11 @@ router.get("/:trackingID?", function(req, res) {
container.custodian = container.custodian + "," + toPush.lastScannedAt;
container.lastScannedAt = toPush.lastScannedAt;
container.trackingID = toPush.trackingID;
let timestampAsNumber = Number(toPush.timestamp);
if(protocol==="raft")
container.timestamp = (new Date(toPush.timestamp/1000000)).getTime();
container.timestamp = (new Date(timestampAsNumber/1000000)).getTime();
else
container.timestamp = (new Date(toPush.timestamp*1000)).getTime();
container.timestamp = (new Date(timestampAsNumber*1000)).getTime();
container.containerID = toPush.containerID;
container.linearId = {};
container.linearId.externalId = null;
Expand Down Expand Up @@ -124,7 +126,9 @@ router.post("/", upload.array(), function(req, res) {
};
// Add this.address in the counterparties list
newContainer.counterparties.push(fromAddress+","+fromNodeSubject);

web3.eth.getBalance(fromAddress).then(balance => {
console.log(`Account Balance: ${balance}`);
});

var misc = [];
var keys = Object.keys(newContainer.misc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ router.get('/:trackingID/history', function (req, res) {
var history = {};
history.party = toPush.custodian;
history.party = history.party+","+toPush.lastScannedAt;
let timestampAsNumber = Number(toPush.timestamp);
if(protocol==="raft")
history.time = (new Date(toPush.timestamp/1000000)).getTime();
history.time = (new Date(timestampAsNumber/1000000)).getTime();
else
history.time = (new Date(toPush.timestamp * 1000)).getTime();
history.time = (new Date(timestampAsNumber * 1000)).getTime();
history.location = toPush.lastScannedAt;
allTransaction.push(history);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ router.get('/containerless', function (req, res) {
product.recalled = toPush.recalled;
product.custodian = toPush.custodian;
product.custodian = product.custodian + "," + toPush.lastScannedAt;
let timestampAsNumber = Number(toPush.timestamp);
if(protocol==="raft")
product.time = (new Date(toPush.timestamp/1000000)).getTime();
product.time = (new Date(timestampAsNumber/1000000)).getTime();
else
product.time = (new Date(toPush.timestamp * 1000)).getTime();
product.time = (new Date(timestampAsNumber * 1000)).getTime();
product.lastScannedAt = toPush.lastScannedAt;
product.containerID = toPush.containerID;
product.misc = {};
Expand Down Expand Up @@ -90,10 +91,11 @@ router.get('/:trackingID?', function (req, res) {
product.custodian = newProduct.custodian;
product.custodian = product.custodian + "," + newProduct.lastScannedAt;
product.trackingID = newProduct.trackingID;
let timestampAsNumber = Number(newProduct.timestamp);
if(protocol==="raft")
product.timestamp = (new Date(newProduct.timestamp/1000000)).getTime();
product.timestamp = (new Date(timestampAsNumber/1000000)).getTime();
else
product.timestamp = (new Date(newProduct.timestamp * 1000)).getTime();
product.timestamp = (new Date(timestampAsNumber * 1000)).getTime();
product.containerID = newProduct.containerID;
product.linearId = {
"externalId": null,
Expand Down Expand Up @@ -137,10 +139,11 @@ router.get('/:trackingID?', function (req, res) {
product.custodian = toPush.custodian;
product.custodian = product.custodian + "," + toPush.lastScannedAt;
product.trackingID = toPush.trackingID;
let timestampAsNumber = Number(toPush.timestamp);
if(protocol==="raft")
product.timestamp = (new Date(toPush.timestamp/1000000)).getTime();
product.timestamp = (new Date(timestampAsNumber/1000000)).getTime();
else
product.timestamp = (new Date(toPush.timestamp * 1000)).getTime();
product.timestamp = (new Date(timestampAsNumber * 1000)).getTime();
product.containerID = toPush.containerID;
product.linearId = {
"externalId": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// SPDX-License-Identifier: Apache-2.0 //
/////////////////////////////////////////////////////////////////////////////////////////////////

var Web3 = require("web3");
const { Web3 } = require("web3");
var {productABI} = require("./ABI/productABI");
var {productContractAddress,quorumServer, ganacheServer, nodeIdentity, nodeOrganization, nodeOrganizationUnit, nodeSubject,protocol} = require("./config");

Expand Down
Loading

0 comments on commit 4919ac1

Please sign in to comment.