WalletAccount: silent instantiation #1257
Closed
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.
Motivation and Resolution
This draft PR is a proposal of alternative to the PR #1245 of Dhruv about removal of address reading from the WalletAccount class constructor.
Usage related changes
The PR#1245 is introducing a big breaking change :
new WalletAccount(...)
is replaced byWalletAccount.connect(...)
.My alternative is not changing the creation of a WalletAccount (still `new WalletAccount()`) and is not trying to read the address in the constructor.
myWalletAccount.getAdress()
, or to use a function that needs the address (here I just coded as example thegetNonce
function.This draft PR has been created to initiate the discussion about the pro/con of each solution, especially in term of DAPP devs/final user experiences.
Development related changes
As
.address
is sync, I can't override it with an async API call. This is why there is a breaking change in this proposal.All Account methods that are using
.address
are overrided to first read the address in the API (if needed).Checklist: