This repository has been archived by the owner on Dec 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 76
Devnet predeployed accounts #192
Merged
andrew-fleming
merged 19 commits into
OpenZeppelin:main
from
ericnordelo:feat/devnet-predeployed-accounts-#137
Sep 26, 2022
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
bed9996
feat: add devnet.py and get predeployed accounts logic to nre and cli
ericnordelo 94c4cb5
refactor: format code and fix linter issues
ericnordelo 7ea6979
fix: remove unnecessary _accounts reassignment
ericnordelo 9a7a957
feat: add normalize_number to utils
ericnordelo fa9fed1
feat: add tests for get_predeployed_accounts
ericnordelo 0230a98
fix: linter and format
ericnordelo 373edc9
docs: update README.md for --predeployed entry
ericnordelo 41f5bca
refactor: remove devnet file
ericnordelo 0ee42ac
fix: cast to string before assertion
ericnordelo 6257066
feat: remove logs from requests
ericnordelo b57610f
feat: use contract abi and address in call or invoke
ericnordelo a55453f
fix: format files
ericnordelo e263744
feat: update get_nonce method
ericnordelo 577e6b5
feat: normalize input from load methods
ericnordelo 09ca436
tmp: working on int refactor
ericnordelo fd4835b
fix: update tests
ericnordelo 9eaa6eb
fix: update review
ericnordelo 04fc9d4
fix: format and linter
ericnordelo 3d269bd
Merge branch 'main' of github.com:OpenZeppelin/nile into feat/devnet-…
ericnordelo 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
feat: use contract abi and address in call or invoke
- Loading branch information
commit b57610fd1c61b2f9c0aa656c0255c1b367f7dc2b
There are no files selected for viewing
This file contains 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 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
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -4,14 +4,19 @@ | |||||||||||
import subprocess | ||||||||||||
|
||||||||||||
from nile import deployments | ||||||||||||
from nile.core import account | ||||||||||||
from nile.common import GATEWAYS, prepare_params | ||||||||||||
|
||||||||||||
|
||||||||||||
def call_or_invoke( | ||||||||||||
contract, type, method, params, network, signature=None, max_fee=None | ||||||||||||
): | ||||||||||||
"""Call or invoke functions of StarkNet smart contracts.""" | ||||||||||||
address, abi = next(deployments.load(contract, network)) | ||||||||||||
if isinstance(contract, account.Account): | ||||||||||||
address = hex(contract.address) | ||||||||||||
abi = contract.abi_path | ||||||||||||
else: | ||||||||||||
address, abi = next(deployments.load(contract, network)) | ||||||||||||
Comment on lines
+19
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I believe the
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added it outside the if/else for both branches before calling the starknet cli. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perfect! |
||||||||||||
|
||||||||||||
command = [ | ||||||||||||
"starknet", | ||||||||||||
|
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.
This threw me off for a bit 😅
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.
I think is better to pass the account instance to avoid passing a lot of extra parameters like the ABI (that was required for predeployed accounts). All these params are in the instance already. Suggestions are welcome to address this, of course.
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.
Agreed on this being a better approach. Well done!
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 causing a circular dependency, i'm rolling it back in #268