0

I am using extend on web3 to use the evm_unlockUnknownAccount on ganache whit this snippet

const localWeb3 = new Web3(ganache.provider( {fork : web3ws.currentProvider} ));
localWeb3.extend({
  methods: [{
      name: 'unlockUnknownAccount',
      call: 'evm_unlockUnknownAccount',
      params: 1
  }]
});

then I console log the localWeb3 and see the new method. When I tried to use the new method it returns a pending promise, so i added await the issue is the evm_unlockUnknownAccount doesn't return a value bool.

const result = await localWeb3.unlockUnknownAccount(address)
console.log('unlock?', result) // stuck waiting long time

How do I do rpc call correctly with web3? or is there other easier way?

1

this solution is working for me:

web3.currentProvider.sendAsync({
        jsonrpc: '2.0', 
        method: 'evm_unlockUnknownAccount',
        params: [address], 
        id: new Date().getTime() 
      }, console.log);`

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.