Using ZWeb3 outside of Truffle

How can I use the ZWeb3 with a loaded private key outside of truffle?

So far I’ve tried to use this:

var provider = new HDWalletProvider(pk, kovanUrl);

let web3 = new Web3(provider);

ZWeb3.initialize(web3.currentProvider);

But it didn’t work. I am trying to sign and send a tx using your helper libraries with a loaded private key.

Do you have any suggestions?

3 Likes

Assume you have looked at the ZWeb3 tests (I generally start with the documentation and the tests)

I can send a transaction to ganache-cli by initializing ZWeb3 using the HDWalletProvider.

var provider = new HDWalletProvider(privateKey, RPC);
ZWeb3.initialize(provider);
2 Likes

Hi @tor

Can you advise why you are using ZWeb3 in this way so that I can understand what you are trying to do?