Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Support Cairo 0.10.1 #268

Merged
merged 124 commits into from
Nov 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
124 commits
Select commit Hold shift + click to select a range
3b9bd03
add async deps
andrew-fleming Oct 17, 2022
31faeb4
update funcs to async
andrew-fleming Oct 17, 2022
4313220
adjust run_cmd, add helper funcs
andrew-fleming Oct 17, 2022
4ee68d4
adjust methods to async
andrew-fleming Oct 17, 2022
3c916bb
adjust nre to async
andrew-fleming Oct 17, 2022
6d742af
fix formatting
andrew-fleming Oct 17, 2022
c47a75a
replace arg object, fix nre and output
andrew-fleming Oct 17, 2022
1fe7e8d
fix formatting
andrew-fleming Oct 17, 2022
0f5770f
add rstrip to capture
andrew-fleming Oct 18, 2022
2c38d82
async get-nonce
andrew-fleming Oct 18, 2022
485469f
remove comments
andrew-fleming Oct 18, 2022
f7c76c7
fix formatting
andrew-fleming Oct 18, 2022
2c205e8
add event loop
andrew-fleming Oct 18, 2022
cf3896e
update tests without subprocess
andrew-fleming Oct 19, 2022
26cf600
update cli tests with asyncclick
andrew-fleming Oct 19, 2022
515a1fa
adjust tests to async
andrew-fleming Oct 19, 2022
054cce6
add set_args func
andrew-fleming Oct 19, 2022
0b0da87
simplify context with set_args
andrew-fleming Oct 19, 2022
602b14b
remove subprocess, add set_args
andrew-fleming Oct 19, 2022
195a24b
add tests for common funcs
andrew-fleming Oct 20, 2022
9fe9d17
async debug, remove subprocess
andrew-fleming Oct 20, 2022
50484e8
fix test
andrew-fleming Oct 21, 2022
1ef5ff0
bump cairo-lang
martriay Oct 28, 2022
9064a8c
fix conflicts
andrew-fleming Oct 28, 2022
f6c7933
fix conflicts
andrew-fleming Oct 28, 2022
e0f066c
fix account test conflicts
andrew-fleming Oct 28, 2022
d2bbed3
add sign_deployment
martriay Oct 28, 2022
aff6c49
bump tox version
martriay Oct 28, 2022
4170096
update account tests to async
andrew-fleming Oct 31, 2022
cb138a7
update debug test to async
andrew-fleming Oct 31, 2022
552b42c
update get_accounts to async
andrew-fleming Oct 31, 2022
910490e
start test refactor
andrew-fleming Oct 31, 2022
134978e
Merge branch 'main' into support-cairo-0.10.1
martriay Nov 1, 2022
4e36c40
fix conflicts
andrew-fleming Nov 2, 2022
8c4e3f2
add async to nre snippets
andrew-fleming Nov 2, 2022
87621b2
add language to code block
andrew-fleming Nov 2, 2022
d04f45d
fix conflicts
andrew-fleming Nov 2, 2022
ce76753
fix url tests
andrew-fleming Nov 2, 2022
ec61c35
fix tests
andrew-fleming Nov 2, 2022
122a481
fix formatting
andrew-fleming Nov 2, 2022
f0a2a62
fix get_gateway handling
andrew-fleming Nov 2, 2022
c8f92e1
remove redundant mock
andrew-fleming Nov 2, 2022
bf49f3f
fix formatting
andrew-fleming Nov 2, 2022
0f5a7c8
remove unused func
andrew-fleming Nov 2, 2022
1333b42
fix conflicts
andrew-fleming Nov 3, 2022
4085231
Merge branch 'main' into replace-subprocess
andrew-fleming Nov 3, 2022
82f49c0
Merge branch 'main' into support-cairo-0.10.1
martriay Nov 3, 2022
5b2c644
fix linter
martriay Nov 3, 2022
e170c4b
bump devnet (to support depploy_account)
martriay Nov 3, 2022
12b5a57
bump devnet (to support depploy_account)
martriay Nov 3, 2022
8075a2d
clean up test
andrew-fleming Nov 3, 2022
7058547
fix network handling
andrew-fleming Nov 3, 2022
f673b26
fix tx_status calls
andrew-fleming Nov 3, 2022
154ff15
fix conflicts
andrew-fleming Nov 4, 2022
420af49
Merge branch 'replace-subprocess' into support-cairo-0.10.1
martriay Nov 5, 2022
448efc8
add account.deploy with __validate_deploy__
martriay Nov 5, 2022
b0c1159
support mainnet token
martriay Nov 5, 2022
57395fa
add call_cli func
andrew-fleming Nov 5, 2022
13a5a36
abstract command args
andrew-fleming Nov 5, 2022
d7c0577
fix tests with call_cli
andrew-fleming Nov 5, 2022
c6e4eae
fix tests with call_cli
andrew-fleming Nov 5, 2022
a8209b7
fix formatting
andrew-fleming Nov 5, 2022
5ccf195
fix conflicts
andrew-fleming Nov 7, 2022
ae62502
remove unnecessary hex
andrew-fleming Nov 9, 2022
67f8f0b
remove async from simulate methods
andrew-fleming Nov 10, 2022
f57df83
remove unnecessary int conversion
andrew-fleming Nov 10, 2022
8a5bac0
add comment regarding AsyncObject in Account
andrew-fleming Nov 10, 2022
b7f2dd8
handle async logging
andrew-fleming Nov 10, 2022
ab02531
fix formatting
andrew-fleming Nov 10, 2022
33f4ad0
refactor _process_arguments
andrew-fleming Nov 10, 2022
d674b53
fix formatting
andrew-fleming Nov 10, 2022
eb16901
test account.deploy
martriay Nov 12, 2022
effe69b
fix conflicts
andrew-fleming Nov 12, 2022
14e4d75
test deploy_account
martriay Nov 12, 2022
3f82196
fix linting
martriay Nov 12, 2022
743a383
add salt and max_fee to Account constructor
martriay Nov 12, 2022
0c5ce88
fix linting
martriay Nov 12, 2022
7fa5ac7
fix _process_arguments
andrew-fleming Nov 12, 2022
6df837f
fix test
andrew-fleming Nov 13, 2022
73de60a
fix tx output and error handling
andrew-fleming Nov 14, 2022
86e7851
fix formatting
andrew-fleming Nov 14, 2022
ede0077
add starknet_cli module
andrew-fleming Nov 14, 2022
97bc116
improve command_args handling
andrew-fleming Nov 14, 2022
0bbb764
fix sender param
andrew-fleming Nov 14, 2022
b808dfb
fix docstring formatting
andrew-fleming Nov 14, 2022
cc58510
add starknet_cli tests
andrew-fleming Nov 14, 2022
303d634
fix status test
andrew-fleming Nov 14, 2022
517a564
move tests to starknet_cli
andrew-fleming Nov 14, 2022
42cca30
update patch location
andrew-fleming Nov 14, 2022
483cd3a
test args in execute_call
andrew-fleming Nov 15, 2022
f33ccc2
add comments
andrew-fleming Nov 15, 2022
fbcef31
remove comments
andrew-fleming Nov 15, 2022
fc88d0d
Merge branch 'replace-subprocess' into support-cairo-0.10.1
martriay Nov 15, 2022
0312997
Merge branch 'replace-subprocess' into support-cairo-0.10.1
martriay Nov 15, 2022
084326d
fix conflicts. address review comments
martriay Nov 15, 2022
43fc96a
fix linting
martriay Nov 15, 2022
b88a415
Merge branch 'main' into support-cairo-0.10.1
martriay Nov 17, 2022
574a442
fix merge
martriay Nov 17, 2022
7802f73
add gateway response tests
martriay Nov 17, 2022
f4afd8e
update account artifacts w/vali_deploy
martriay Nov 17, 2022
95f81fd
add get_balance and conterfactual_address
martriay Nov 17, 2022
224fe97
fix tests and implementations
martriay Nov 18, 2022
18d1b1f
fix linting
martriay Nov 18, 2022
be74fc8
fix tests
martriay Nov 18, 2022
1df21d2
add README
martriay Nov 18, 2022
8df1330
fix typo
martriay Nov 18, 2022
a118fc7
Update README.md
martriay Nov 18, 2022
6a914a1
Update src/nile/signer.py
martriay Nov 18, 2022
c165eb7
apply review comments
martriay Nov 18, 2022
dac6673
fix linting
martriay Nov 18, 2022
e4116c2
fix linting
martriay Nov 18, 2022
53f7297
Merge branch 'support-cairo-0.10.1' of github.com:OpenZeppelin/nile i…
martriay Nov 18, 2022
9358d8c
fix linting
martriay Nov 18, 2022
593fab8
test get_balance, fix circular depedency
martriay Nov 18, 2022
b0a4f17
fix linting
martriay Nov 18, 2022
7b067ee
improve get-balance logging
martriay Nov 18, 2022
3116fdf
fix tests
martriay Nov 18, 2022
f931f88
Merge branch 'main' into support-cairo-0.10.1
martriay Nov 18, 2022
aab2f27
fix linting
martriay Nov 18, 2022
9ccec7c
fix tests
martriay Nov 18, 2022
800712a
fix tests
martriay Nov 18, 2022
f5f28b8
fix linting
martriay Nov 19, 2022
df92ee7
apply review suggestions
martriay Nov 21, 2022
803c66b
fix linting
martriay Nov 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ Deploy an Account associated with a given private key.
To avoid accidentally leaking private keys, this command takes an alias instead of the actual private key. This alias is associated with an environmental variable of the same name, whose value is the actual private key.

```sh
nile setup <private_key_alias>
nile setup <private_key_alias> [--salt SALT] [--max_fee MAX_FEE] [--network NETWORK]

🚀 Deploying Account
⏳ ️Deployment of Account successfully sent at 0x07db6b52c8ab888183277bc6411c400136fe566c0eebfb96fffa559b2e60e794
Expand All @@ -166,11 +166,28 @@ nile setup <private_key_alias>

A few things to note here:

- This is a counterfactual deployment, meaning the deployed account pays for its own deployment. You can use [`nile counterfactual-address`](#counterfactual-address) to predict the account address and send the necessary funds beforehand.
- `nile setup <private_key_alias>` looks for an environment variable with the name of the private key alias.
- This creates or updates `localhost.accounts.json` file storing all data related to accounts management.
- This creates or updates `localhost.accounts.json` file storing all data related to account management.
- The creates or updates `localhost.deployments.txt` file storing all data related to deployments.
- `--track` and `--debug` flags can be used to watch the status of the account deployment transaction. See `status` below for a complete description.

### `counterfactual-address`
ericnordelo marked this conversation as resolved.
Show resolved Hide resolved

Precompute the deployment address of an Account contract, for a given signer and salt. If not provided, `salt` defaults to `0`.

```sh
nile counterfactual-address <private_key_alias> [--salt SALT]
```

For example:

```sh
nile counterfactual-address <private_key_alias> --salt 123

0x00193c9bf3f66f556b40f0e95dffdd07db2cd6b10552a75048b71550049d1246
```

### `send`

Execute a transaction through the `Account` associated with the private key provided. The syntax is:
Expand Down Expand Up @@ -436,6 +453,18 @@ async def run(nre):
await bob.send(...)
```

### `get-balance`

Retrieves the Ether balance for a given contract address.

```sh
nile get-balance <contract_address> [--network NETWORK]

nile get-balance 0x053edde5384e39bad137d3c4130c708fb96ee28a4c80bf28049c486d3f36992e
🕵️ 0x053ed...6992e balance is:
💰 4444.555501003 gwei
```

### `get-nonce`

Retrieves the nonce for the given contract address (usually an account).
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ install_requires =
click>=8.0,<9.0
importlib-metadata>=4.0
python-dotenv>=0.19.2
starknet-devnet>=0.3.1,<0.3.4
cairo-lang==0.10.0
starknet-devnet>=0.3.5
cairo-lang>=0.10.1
pytest>=7.1.3
pytest-asyncio>=0.19.0
requests>=2.28.1
Expand Down
5,431 changes: 3,572 additions & 1,859 deletions src/nile/artifacts/Account.json

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions src/nile/artifacts/abis/Account.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,25 @@
"outputs": [],
"type": "function"
},
{
"inputs": [
{
"name": "class_hash",
"type": "felt"
},
{
"name": "salt",
"type": "felt"
},
{
"name": "publicKey",
"type": "felt"
}
],
"name": "__validate_deploy__",
"outputs": [],
"type": "function"
},
{
"inputs": [
{
Expand Down
274 changes: 274 additions & 0 deletions src/nile/artifacts/abis/ERC20.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,274 @@
[
{
"members": [
{
"name": "low",
"offset": 0,
"type": "felt"
},
{
"name": "high",
"offset": 1,
"type": "felt"
}
],
"name": "Uint256",
"size": 2,
"type": "struct"
},
{
"data": [
{
"name": "from_",
"type": "felt"
},
{
"name": "to",
"type": "felt"
},
{
"name": "value",
"type": "Uint256"
}
],
"keys": [],
"name": "Transfer",
"type": "event"
},
{
"data": [
{
"name": "owner",
"type": "felt"
},
{
"name": "spender",
"type": "felt"
},
{
"name": "value",
"type": "Uint256"
}
],
"keys": [],
"name": "Approval",
"type": "event"
},
{
"inputs": [
{
"name": "name",
"type": "felt"
},
{
"name": "symbol",
"type": "felt"
},
{
"name": "decimals",
"type": "felt"
},
{
"name": "initial_supply",
"type": "Uint256"
},
{
"name": "recipient",
"type": "felt"
}
],
"name": "constructor",
"outputs": [],
"type": "constructor"
},
{
"inputs": [],
"name": "name",
"outputs": [
{
"name": "name",
"type": "felt"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "symbol",
"outputs": [
{
"name": "symbol",
"type": "felt"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"name": "totalSupply",
"type": "Uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "decimals",
"outputs": [
{
"name": "decimals",
"type": "felt"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"name": "account",
"type": "felt"
}
],
"name": "balanceOf",
"outputs": [
{
"name": "balance",
"type": "Uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"name": "owner",
"type": "felt"
},
{
"name": "spender",
"type": "felt"
}
],
"name": "allowance",
"outputs": [
{
"name": "remaining",
"type": "Uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"name": "recipient",
"type": "felt"
},
{
"name": "amount",
"type": "Uint256"
}
],
"name": "transfer",
"outputs": [
{
"name": "success",
"type": "felt"
}
],
"type": "function"
},
{
"inputs": [
{
"name": "sender",
"type": "felt"
},
{
"name": "recipient",
"type": "felt"
},
{
"name": "amount",
"type": "Uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"name": "success",
"type": "felt"
}
],
"type": "function"
},
{
"inputs": [
{
"name": "spender",
"type": "felt"
},
{
"name": "amount",
"type": "Uint256"
}
],
"name": "approve",
"outputs": [
{
"name": "success",
"type": "felt"
}
],
"type": "function"
},
{
"inputs": [
{
"name": "spender",
"type": "felt"
},
{
"name": "added_value",
"type": "Uint256"
}
],
"name": "increaseAllowance",
"outputs": [
{
"name": "success",
"type": "felt"
}
],
"type": "function"
},
{
"inputs": [
{
"name": "spender",
"type": "felt"
},
{
"name": "subtracted_value",
"type": "Uint256"
}
],
"name": "decreaseAllowance",
"outputs": [
{
"name": "success",
"type": "felt"
}
],
"type": "function"
}
]
Loading