-
Notifications
You must be signed in to change notification settings - Fork 0
[CD] | provider: add nonce and is web3 provider methods #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5e36e77
feat: add fetch nonce
cbrzn 3361c2b
chore: update interface & deploy hash
cbrzn 84c9ef0
feat: add is wallet method
cbrzn e0a1641
chore: update version & deploy hash
cbrzn 6719f2d
chore: change is wallet to is web3 provider
cbrzn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
For me, this name is not intuitive. I would expect
isWalletto return true if the signer itself is a wallet (e.g. an instance ofethers.Wallet). It sounds like this method instead distinguishes between web3provider and jsonRpcProvider. Is that correct?It is possible to interface with a wallet via RPC, like we do with Ganache
And with MetaMask, we would generally want to call
sendTransaction, notsendRawTransactionThat is my understanding
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.
The reason for using
sendTransactionis so that the wallet can handle both signing and sending securely. My understanding is that signing a transaction and then sending it withsendRawTransactionis not secure, and most wallets don't even allow it.Have you tested this with MetaMask to make sure it works?
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.
that's correct - maybe doing
isWeb3Providerwould be better?yes, it's possible, but neither infura or alchemy accept
sendTransactionbecause they don't manipulate signing keys. Meaning that currently, we're only able to execute transactions using a private key in testnet, but not in any other chain (we are not able to execute ethereum transactions in a script like this, for example)metamask uses
sendTransactionto make sure that the private key used to sign the transaction never leaves the user's device, which in our case it, might not always be that way. the reason is that we acceptWalletobject (which has access to these private keys) as a signer (besides aWeb3Provider). so effectively with metamask we are still doingsendTransactionwhile I completely understand your point I think that we're not a wallet but rather a development tool (that probably wallets will eventually use!) and we should allow users to interact and execute transactions in any way they would like to
yes! i tested with safe wrapper demo app and worked as expected
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.
This is just my understanding of things at the moment.
I never said we should limit how users use the wrapper. I am just saying that I thought signing and sending raw transactions was supposed to be less secure. If so, they shouldn't be used in cases where a more secure option is available. I could be wrong about all of this!
Does Infura or Alchemy provide wallets? I thought they were always providers without signers
I think with MetaMask we can always do
eth_sendTransaction, right? Or do we need to useeth_sendRawTransaction?Uh oh!
There was an error while loading. Please reload this page.
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.
they do not, that's why we need to sign it locally
you're right! with metamask or any web3provider we will use
eth_sendTransaction(and that's what we're doing in the other PR, if the provider is aWeb3Provider(currently checked withisWalletmethod), we doeth_sendTransaction)just for clarification, when I said I tested with metamask, I meant that the
eth_sendTransactionis being done as expected, and with a script (giving the private key) we're doingeth_sendRawTransactionThere 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.
Okay, so to clarify, the Safe wrapper is using a private key to sign transactions but does not have access to an Ethereum provider, so you need to send the transactions using something like Infura?
What if we just use two methods? One would be syntax sugar for signing and sending raw transactions (which is already possible), the other for handling standard transactions. That way we are still calling
eth_sendTransactionwith wallets that have signers but are not of typeWeb3Provider.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.
in a node js script context, we need to pass the private key (and a JSON RPC, like infura or alchemy) - but in the demo app all works fresh and uses
eth_sendTransaction(we use the metamask provider)yes I like this!
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.
Awesome, okay. I apologize for making this more complicated!