wearetheledger / fabric-node-chaincode-utils

Utilities for writing and testing hyperledger Fabric nodejs chaincode
https://theledger.be
MIT License
78 stars 29 forks source link

New version of fabric 1.3.0 #18

Closed romstyop closed 5 years ago

romstyop commented 6 years ago

Do you plan to upgrade the package to version 1.3.0 of fabric-shim?

sneljo1 commented 6 years ago

I already mostly did. I am currently maintaining a bunch of projects. I didn't get to adding wrappers for the new methods just yet and must've forgot about it. I'll look at it tonight.

sneljo1 commented 6 years ago

PRs are always welcome 😄

marweck commented 5 years ago

Hi, after upgrading to version 4.0.0

"@theledger/fabric-chaincode-utils": "^4.0.0",

I got the errors below (for example):

node_modules/fabric-shim/types/index.d.ts:262:13 - error TS2300: Duplicate identifier 'DELIVER_SEEK_INFO'.

262 DELIVER_SEEK_INFO = 5,


`node_modules/fabric-shim/types/index.d.ts:263:13 - error TS2300: Duplicate identifier 'CHAINCODE_PACKAGE'.`

263             CHAINCODE_PACKAGE = 6,

Inside node_modules/@theledger/fabric-chaincode-utils I see the subfolder node_modules/node_modules/fabric_shim.

Is that correct?

sneljo1 commented 5 years ago

@marweck Yes, thats correct. Are you still using @wearetheledger/fabric-shim-types perhaps?

sneljo1 commented 5 years ago

Btw @romstyop, I was mistaken, I actually did upgrade it a month ago.

marweck commented 5 years ago

Hi @Superjo149 , thanks for the quick answer.

No, I'm not using @wearetheledger/fabric-shim-types anymore.

Here are my dependencies:

"dependencies": {
    "@theledger/fabric-chaincode-utils": "^4.0.0",
    "@types/lodash": "^4.14.104",
    "lodash": "^4.17.5",
    "winston": "^2.4.0",
    "yup": "^0.24.1"
  },
  "devDependencies": {
    "@theledger/fabric-mock-stub": "^2.0.0",
    "@theledger/fabric-shim-crypto-types": "^1.0.4",
    "@types/chai": "^4.1.2",
    "@types/mocha": "^2.2.48",
    "@types/node": "^8.5.8",
    "@types/winston": "^2.3.8",
    "@types/yup": "^0.24.1",
    "chai": "^4.1.2",
    "mocha": "^4.1.0",
    "nodemon": "^1.12.1",
    "ts-node": "^5.0.1",
    "tslint": "4.5.1",
    "typescript": "^2.6.2"
  }

This is my tsconfig.json:

{
  "compilerOptions": {
    "rootDir": "./src",
    "suppressImplicitAnyIndexErrors": true,
    "noImplicitAny": true,
    "sourceMap": false,
    "target": "es5",
    "module": "commonjs",
    "declaration": false,
    "outDir": "./dist",
    "types": ["@theledger/fabric-shim-crypto-types"],
    "typeRoots": ["./node_modules/@types"],
    "lib": ["es2015", "dom"]
  },
  "exclude": ["**/*.spec.ts"]
}

Been trying to exclude type definitions from fabric-shim inside fabric-node-chaincode-utils/node_modules without success.

I keep getting "Duplicate identifier" errors on node_modules/fabric-shim/types/index.d.ts file.

Do you have any ideas?

sneljo1 commented 5 years ago

Hmm, try also upgrading the mock-stub to 3.0.0, this also has duplicate types when using fabric 1.3

marweck commented 5 years ago

Hi @Superjo149

I had upgraded mock-stub to 3.0.0 earlier but I got the errors below when I executed my tests:

stack: 'TypeError: signingId.getIdBytes(...).toBuffer is not a function\n    at new ClientIdentity (/Users/marweck/workspace/blockchain/sbp-chaincode/sbp-poder/node_modules/@theledger/fabric-chaincode-utils/node_modules/fabric-shim/lib/chaincode.js:238:40)\n    at StubHelper.getClientIdentity (/Users/marweck/workspace/blockchain/sbp-chaincode/sbp-poder/node_modules/@theledger/fabric-chaincode-utils/src/StubHelper.ts:54:16)\n

And the build didn't work either.

One curious thing. When I deleted fabric-shim inside fabric-node-chaincode-utils/node_modules, my build worked fine.

Any ideas?

sneljo1 commented 5 years ago

This has been fixed btw