Move PrecomputeAddress function to 'contract' package #574
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.
The PrecomputeAddress function precomputes the address of a contract instance thus it's not directly related to the 'account' package, but to the 'contract' package. The only use of this function in the 'account' package is to calculate the account contract address for deploying an account, and to satisfy that I created the PrecomputeAccountAddress function in the 'account' package that calls the PrecomputeAddress function passing the proper parameters.
This will prevent developers from generating wrong account addresses when deploying an account as this process requires the 'deployer_address' to be '0', but the previous function was not intuitive when asking for the 'deployerAddress' parameter without describing that it should be '0' in such case. The new account.PrecomputeAccountAddress function passes '0' as 'deployer_address' automatically to the contract.PrecomputeAccount without prompting the user.
https://docs.starknet.io/architecture-and-concepts/smart-contracts/contract-address/