Skip to content

Commit

Permalink
feat(connector-iroha): update-iroha-js
Browse files Browse the repository at this point in the history
Signed-off-by: yashrajdesai <[email protected]>
  • Loading branch information
yashrajdesai authored and petermetz committed Nov 17, 2022
1 parent f4ae605 commit 74929b1
Show file tree
Hide file tree
Showing 8 changed files with 142 additions and 133 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"extensions/cactus-*"
],
"nohoist": [
"**/iroha-helpers-ts"
"**/iroha-helpers"
]
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/cactus-plugin-ledger-connector-iroha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"express": "4.17.1",
"fast-safe-stringify": "2.1.1",
"grpc": "1.24.11",
"iroha-helpers-ts": "0.9.25-ss",
"iroha-helpers": "1.5.0",
"openapi-types": "7.0.1",
"prom-client": "13.1.0",
"sanitize-html": "2.7.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* Signing utility functions for HL Iroha ledger.
*/

import txHelper from "iroha-helpers-ts/lib/txHelper";
import { Transaction } from "iroha-helpers-ts/lib/proto/transaction_pb";
import { txHelper } from "iroha-helpers";
import { Transaction } from "iroha-helpers/lib/proto/transaction_pb";

/**
* Sign transaction binary received from `generateTransactionV1()` call.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import * as grpc from "grpc";
import { CommandService_v1Client as CommandService } from "iroha-helpers-ts/lib/proto/endpoint_grpc_pb";
import { QueryService_v1Client as QueryService } from "iroha-helpers-ts/lib/proto/endpoint_grpc_pb";
import { Transaction } from "iroha-helpers-ts/lib/proto/transaction_pb";
import commands from "iroha-helpers-ts/lib/commands/index";
import queries from "iroha-helpers-ts/lib/queries";
import { TxBuilder } from "iroha-helpers-ts/lib/chain";
import { CommandService_v1Client as CommandService } from "iroha-helpers/lib/proto/endpoint_grpc_pb";
import { QueryService_v1Client as QueryService } from "iroha-helpers/lib/proto/endpoint_grpc_pb";
import { Transaction } from "iroha-helpers/lib/proto/transaction_pb";
import commands from "iroha-helpers/lib/commands/index";
import queries from "iroha-helpers/lib/queries";
import { TxBuilder } from "iroha-helpers/lib/chain";
import type { Express } from "express";
import {
GrantablePermission,
GrantablePermissionMap,
} from "iroha-helpers-ts/lib/proto/primitive_pb";
} from "iroha-helpers/lib/proto/primitive_pb";

import OAS from "../json/openapi.json";

Expand Down Expand Up @@ -588,6 +588,7 @@ export class PluginLedgerConnectorIroha
key: req.params[1],
value: req.params[2],
oldValue: req.params[3],
checkEmpty: req.params[4],
};
} else {
params = req.params;
Expand Down Expand Up @@ -694,6 +695,14 @@ export class PluginLedgerConnectorIroha
params = {
pageSize: req.params[0],
firstTxHash: req.params[1],
firstTxTime: req.params[2],
lastTxTime: req.params[3],
firstTxHeight: req.params[4],
lastTxHeight: req.params[5],
ordering: {
field: req.params[6],
direction: req.params[7],
},
};
} else {
params = req.params;
Expand All @@ -715,6 +724,14 @@ export class PluginLedgerConnectorIroha
accountId: req.params[0],
pageSize: req.params[1],
firstTxHash: req.params[2],
firstTxTime: req.params[3],
lastTxTime: req.params[4],
firstTxHeight: req.params[5],
lastTxHeight: req.params[6],
ordering: {
field: req.params[7],
direction: req.params[8],
},
};
} else {
params = req.params;
Expand All @@ -737,6 +754,14 @@ export class PluginLedgerConnectorIroha
assetId: req.params[1],
pageSize: req.params[2],
firstTxHash: req.params[3],
firstTxTime: req.params[4],
lastTxTime: req.params[5],
firstTxHeight: req.params[6],
lastTxHeight: req.params[7],
ordering: {
field: req.params[8],
direction: req.params[9],
},
};
} else {
params = req.params;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import { v4 as uuidv4 } from "uuid";
import { v4 as internalIpV4 } from "internal-ip";
import "jest-extended";

import cryptoHelper from "iroha-helpers-ts/lib/cryptoHelper";
import cryptoHelper from "iroha-helpers/lib/cryptoHelper";

import {
PluginLedgerConnectorIroha,
Expand Down Expand Up @@ -258,7 +258,7 @@ describe("Generate and send signed transaction tests", () => {
expect(createAccResponse).toBeTruthy();
expect(createAccResponse.data).toBeTruthy();
expect(createAccResponse.status).toEqual(200);
expect(createAccResponse.data.transactionReceipt.status).toEqual(
expect(createAccResponse.data.transactionReceipt.status[0]).toEqual(
"COMMITTED",
);

Expand Down Expand Up @@ -331,7 +331,7 @@ describe("Generate and send signed transaction tests", () => {
expect(sendTransactionResponse.data).toBeTruthy();
expect(sendTransactionResponse.data.transactionReceipt).toBeTruthy();
expect(sendTransactionResponse.data.transactionReceipt.txHash).toBeTruthy();
expect(sendTransactionResponse.data.transactionReceipt.status).toEqual(
expect(sendTransactionResponse.data.transactionReceipt.status[0]).toEqual(
"COMMITTED",
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
IrohaQuery,
KeyPair,
} from "../../../main/typescript/generated/openapi/typescript-axios";
import cryptoHelper from "iroha-helpers-ts/lib/cryptoHelper";
import cryptoHelper from "iroha-helpers/lib/cryptoHelper";

const testCase = "runs tx on an Iroha v1.2.0 ledger";
const logLevel: LogLevelDesc = "ERROR";
Expand Down Expand Up @@ -188,7 +188,7 @@ test.skip(testCase, async (t: Test) => {
t.ok(res);
t.ok(res.data);
t.equal(res.status, 200);
t.equal(res.data.transactionReceipt.status, "COMMITTED");
t.equal(res.data.transactionReceipt.status[0], "COMMITTED");
}

//Verify the generated priv/pub keys are equivalent to those pulled from the ledger.
Expand Down Expand Up @@ -221,7 +221,7 @@ test.skip(testCase, async (t: Test) => {
t.ok(res);
t.ok(res.data);
t.equal(res.status, 200);
t.equal(res.data.transactionReceipt.status, "COMMITTED");
t.equal(res.data.transactionReceipt.status[0], "COMMITTED");
}
//Iroha1's admin is initialized with 100 (coolcoin#test).
{
Expand All @@ -242,7 +242,7 @@ test.skip(testCase, async (t: Test) => {
t.ok(res);
t.ok(res.data);
t.equal(res.status, 200);
t.equal(res.data.transactionReceipt.status, "COMMITTED");
t.equal(res.data.transactionReceipt.status[0], "COMMITTED");
}

// Iroha1's admin transfers 30 (coolcoin#test) to Iroha2's admin.
Expand All @@ -265,7 +265,7 @@ test.skip(testCase, async (t: Test) => {
t.ok(res);
t.ok(res.data);
t.equal(res.status, 200);
t.equal(res.data.transactionReceipt.status, "COMMITTED");
t.equal(res.data.transactionReceipt.status[0], "COMMITTED");
}
//i.e., Iroha2's admin adds 30 (coolcoin#test).
{
Expand All @@ -286,7 +286,7 @@ test.skip(testCase, async (t: Test) => {
t.ok(res);
t.ok(res.data);
t.equal(res.status, 200);
t.equal(res.data.transactionReceipt.status, "COMMITTED");
t.equal(res.data.transactionReceipt.status[0], "COMMITTED");
}
//Verification: iroha1's admin has 70 (coolcoin#test).
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
KeyPair,
RunTransactionRequestV1,
} from "../../../../main/typescript/generated/openapi/typescript-axios";
import cryptoHelper from "iroha-helpers-ts/lib/cryptoHelper";
import cryptoHelper from "iroha-helpers/lib/cryptoHelper";

import OAS from "../../../../main/json/openapi.json";
import { installOpenapiValidationMiddleware } from "@hyperledger/cactus-core";
Expand Down
Loading

0 comments on commit 74929b1

Please sign in to comment.