Open gomezgoiri opened 2 years ago
Sorry unrelated request, but did you solved this? @gomezgoiri ? Also could you please post a short guide, how to build web3js-quorum for browser? Can't make it work.
Sorry, I was just testing web3js-quorum at that time and I ended up not using privateEndpoint (and therefore the ptm module).
Priv is enough for our solution, so I simply specify the endpoint of the Besu node (not GoQuorum) which talks to Tessera and use it like this:
const EEAClient = require("web3js-quorum")
...
const web3 = new EEAClient(new Web3(endpoint), chainId)
web3.priv.whatever()
Thanks!
When I pass a privateUrl to the Web3Quorum constructor in the browser, the url dependency fails here.
I checked the dependencies of web3js-quorum and there is no "url" defined.
After checking my project's dependencies, I see that it react-scripts transitively adds url@0.11.0. This is probably not the dependency Web3Quorum should be using because it does not have any constructor (you should use Url.parse() instead).
I see different solutions:
Adding the original dependency to Web3Quorum.
Using url@0.11.0 and explicitly defining it as Web3Quorum's dependency
const { URL } = require("url");
const Url = require("url"); ...
const { protocol } = new URL(privateEndpoint);
const { protocol } = Url.parse(privateEndpoint);
Use a package like universal-url or iso-url to rely on browser's URL implementation whenever it is possible and to use a different implementation on NodeJS. For example:
const { URL } = require("url");
require('universal-url').shim(); ... const { protocol } = new URL(privateEndpoint);