Closed ksanjaykumar1 closed 8 months ago
Contract (similar to many of the other types defined by @hyperledger/fabric-gateway
) is an interface. It is just a TypeScript type definition to describe the behaviour of objects returned from Network.getContract(). There is no concrete Contract class exported. If you are using TypeScript, you should be able to import all of those types OK and, based on those types, get code assistance in your IDE and compile-time validation from the TypeScript compiler. If you are writing plain JavaScript, you can ignore all the interface types and probably only need to import the connect function (and signers to use the signers.newPrivateKeySigner function). The API documentation indicates which types are concrete classes, interfaces and functions.
It works. Thank you.
I want to use ''@hyperledger/fabric-gateway'' in my nodejs application which is in ES module format but it's not importing correctly I tried two hacks listed online to fix it but failed.
I imported as mentioned in the error message but it failed to import Contract and Identity.![Screenshot from 2023-12-18 13-21-54](https://github.com/hyperledger/fabric-gateway/assets/72605368/2401b5a3-07aa-4755-8114-d5ae19afd0b7)
I set the format type as module in the fabric gateway library but it failed.