-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! @ryanio just need to update the changelog.
But this is very interesting... im wondering what the impact might be on #3656 and related issues. I'm wondering if previously there may have been a weird collision with how jsonRPC id
was being incremented and other providers being used. What im really curious to know is if the bind:
callbackify(this.provider.request.bind(this.provider))(payload, callback);
was causing the provider to miss increment because of setting _this in the websocket provider might pull the wrong instance of the provider?
anyway g2g and I'll monitor this in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me 🤙
@ryanio @GregTheGreek callbackify(this.provider.request.bind(this.provider))(payload, callback); to: callbackRequest(requestArgs, callback); I can confirm this change caused some problems. //....
EthereumProvider.prototype.request = (payload) => {
return this._eip1193Send(payload.method, payload.params)
}
window.ethereum = new EthereumProvider() Now, web3.js call |
@frankiebee Hmmm We should add a way to test this out, maybe we can add some "buttons" to the netflify preview to allow us to test out that type of functionality? |
👋 I can confirm the issue @sapjax is explaining. I'm currently trying to use WalletConnect as web3 provider, but when i try to call When i check with the debugger, This is how my code +- looks: import WalletConnectProvider from "@walletconnect/web3-provider";
import Web3 from "web3";
const provider = new WalletConnectProvider({ infuraId, chainId });
// Enable session (triggers QR Code modal)
await provider.enable();
// Create Web3
web3 = new Web3(provider);
// Get accouts
await vm.web3.eth.getAccounts(); // => throws the error! Would appreciate the fix! |
Description
This PR improves RequestManager.send in a few ways:
{ method, params }
toprovider.request
, instead of whole jsonrpc shape, to be more conformant with spec.I also removed the bind I had in callbackify, after reading more about callbackify and bind I determined it is not needed in this case. If anyone thinks otherwise I would very much appreciate some reasoning.
Type of change
Checklist:
npm run dtslint
with success and extended the tests and types if necessary.npm run test:unit
with success.npm run test:cov
and my test cases cover all the lines and branches of the added code.npm run build
and testeddist/web3.min.js
in a browser.CHANGELOG.md
file in the root folder.