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
Remove invoke command #227
Merged
martriay
merged 3 commits into
OpenZeppelin:main
from
ericnordelo:fix/invoke-command-#202
Oct 21, 2022
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 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 |
---|---|---|
|
@@ -154,17 +154,16 @@ You can find an example `.env` file in `example.env`. These are private keys onl | |
nile setup <private_key_alias> | ||
|
||
🚀 Deploying Account | ||
🌕 artifacts/Account.json successfully deployed to 0x07db6b52c8ab888183277bc6411c400136fe566c0eebfb96fffa559b2e60e794 | ||
⏳ ️Deployment of Account successfully sent at 0x07db6b52c8ab888183277bc6411c400136fe566c0eebfb96fffa559b2e60e794 | ||
🧾 Transaction hash: 0x17 | ||
📦 Registering deployment as account-0 in localhost.deployments.txt | ||
Invoke transaction was sent. | ||
Contract address: 0x07db6b52c8ab888183277bc6411c400136fe566c0eebfb96fffa559b2e60e794 | ||
Transaction hash: 0x17 | ||
``` | ||
|
||
A few things to notice here: | ||
A few things to note here: | ||
|
||
1. `nile setup <private_key_alias>` looks for an environment variable with the name of the private key alias | ||
2. This creates a `localhost.accounts.json` file storing all data related to accounts management | ||
2. This creates or updates `localhost.accounts.json` file storing all data related to accounts management | ||
3. The creates or updates `localhost.deployments.txt` file storing all data related to deployments | ||
|
||
### `send` | ||
|
||
|
@@ -189,23 +188,15 @@ Some things to note: | |
- `max_fee` defaults to `0`. Add `--max_fee <max_fee>` to set the maximum fee for the transaction | ||
- `network` defaults to the `localhost`. Add `--network <network>` to change the network for the transaction | ||
|
||
### `call` and `invoke` | ||
### `call` | ||
|
||
Using `call` and `invoke`, we can perform read and write operations against our local node (or public one using the `--network mainnet` parameter). The syntax is: | ||
Using `call`, we can perform read operations against our local node or the specified public network. The syntax is: | ||
martriay marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```sh | ||
nile <command> <contract_identifier> <method> [PARAM_1, PARAM2...] | ||
nile call <contract_identifier> <method> [PARAM_1, PARAM2...] | ||
``` | ||
|
||
Where `<command>` is either `call` or `invoke` and `<contract_identifier>` is either our contract address or alias, as defined on `deploy`. | ||
|
||
```sh | ||
nile invoke my_contract increase_balance 1 | ||
|
||
Invoke transaction was sent. | ||
Contract address: 0x07ec10eb0758f7b1bc5aed0d5b4d30db0ab3c087eba85d60858be46c1a5e4680 | ||
Transaction hash: 0x1 | ||
``` | ||
Where `<contract_identifier>` is either our contract address or alias, as defined on `deploy`. | ||
|
||
```sh | ||
nile call my_contract get_balance | ||
|
@@ -239,17 +230,6 @@ Please note: | |
|
||
- `localhost` is the default network. Add `--network <network>` to change the network for the script | ||
|
||
### `get_declaration` (NRE only) | ||
|
||
Return the hash of a declared class. This can be useful in scenarios where a contract class is already declared with an alias prior to running a script. | ||
|
||
```python | ||
def run(nre): | ||
predeclared_class = nre.get_declaration("alias") | ||
``` | ||
|
||
> Note that this command is only available in the context of scripting in the Nile Runtime Environment. | ||
|
||
### `clean` | ||
|
||
Deletes the `artifacts/` directory for a fresh start ❄️ | ||
|
@@ -391,7 +371,7 @@ def run(nre): | |
|
||
> Please note that the list of accounts includes only those that exist in the local `<network>.accounts.json` file. In a recent release we added a flag to the command, to get predeployed accounts if the network you are connected to is a [starknet-devnet](https://github.com/Shard-Labs/starknet-devnet) instance. | ||
|
||
### `get-accounts --predeployed` | ||
### `get-accounts --predeployed (only starknet-devnet)` | ||
|
||
This flag retrieves the predeployed accounts if the network you are connecting to is a [starknet-devnet](https://github.com/Shard-Labs/starknet-devnet) instance. | ||
|
||
|
@@ -426,6 +406,18 @@ Retrieves the nonce for the given contract address (usually an account). | |
nile get-nonce <contract_address> | ||
``` | ||
|
||
### `get_declaration` (NRE only) | ||
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 moved 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. Nice! Yes, I agree it looks more organized. Perhaps, it's soon time to give NRE it's own heading and save us the trouble of adding things like |
||
|
||
Return the hash of a declared class. This can be useful in scenarios where a contract class is already declared with an alias prior to running a script. | ||
|
||
```python | ||
def run(nre): | ||
predeclared_class = nre.get_declaration("alias") | ||
``` | ||
|
||
> Note that this command is only available in the context of scripting in the Nile Runtime Environment. | ||
|
||
|
||
## Short string literals | ||
|
||
From [cairo-lang docs](https://www.cairo-lang.org/docs/how_cairo_works/consts.html#short-string-literals): A short string is a string whose length is at most 31 characters, and therefore can fit into a single field element. | ||
|
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
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.
Good fix^