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

Add support for goerli2 and integration testnets #272

Merged
merged 9 commits into from
Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ A few things to notice here:
1. `nile deploy <contract_name>` looks for an artifact with the same name
2. This created a `localhost.deployments.txt` file storing all data related to my deployment
3. The `--alias` parameter lets me create a unique identifier for future interactions, if no alias is set then the contract's address can be used as identifier
4. By default Nile works on local, but you can use the `--network` parameter to interact with `mainnet`, `goerli`, and the default `localhost`.
4. By default Nile works on local, but you can use the `--network` parameter to interact with `mainnet`, `goerli`, `goerli2`, `integration`, and the default `localhost`.
5. By default, the ABI corresponding to the contract will be registered with the deployment. To register a different ABI file, use the `--abi` parameter.

### `setup`
Expand Down Expand Up @@ -189,7 +189,7 @@ A few things to notice here:
1. `nile declare <private_key_alias> <contract_name>` looks for an artifact with name `<contract_name>`
2. This creates or updates a `localhost.declarations.txt` file storing all data related to your declarations
3. The `--alias` parameter lets you create a unique identifier for future interactions, if no alias is set then the contract's address can be used as identifier
4. By default Nile works on local, but you can use the `--network` parameter to interact with `mainnet`, `goerli`, and the default `localhost`.
4. By default Nile works on local, but you can use the `--network` parameter to interact with `mainnet`, `goerli`, `goerli2`, `integration`, and the default `localhost`.

### `call`

Expand Down
4 changes: 2 additions & 2 deletions src/nile/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

logging.basicConfig(level=logging.DEBUG, format="%(message)s")

NETWORKS = ("localhost", "goerli", "mainnet")
NETWORKS = ("localhost", "integration", "goerli", "goerli2", "mainnet")


def network_option(f):
Expand All @@ -43,7 +43,7 @@ def network_option(f):
def _validate_network(_ctx, _param, value):
"""Normalize network values."""
# normalize goerli
if "goerli" in value or "testnet" in value:
if "goerli" == value or "testnet" in value:
martriay marked this conversation as resolved.
Show resolved Hide resolved
return "goerli"
# normalize localhost
if "localhost" in value or "127.0.0.1" in value:
martriay marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
8 changes: 7 additions & 1 deletion src/nile/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ def get_gateway():

except FileNotFoundError:
with open(NODE_FILENAME, "w") as f:
f.write('{"localhost": "http://127.0.0.1:5050/"}')
f.write(
"""{
"localhost": "http://127.0.0.1:5050/",
"goerli2": "https://alpha4-2.starknet.io",
"integration": "https://external.integration.starknet.io"
}"""
)
martriay marked this conversation as resolved.
Show resolved Hide resolved
martriay marked this conversation as resolved.
Show resolved Hide resolved


GATEWAYS = get_gateway()
Expand Down
2 changes: 1 addition & 1 deletion src/nile/core/call_or_invoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def call_or_invoke(
@param type: can be either call or invoke.
@param method: the targeted function.
@param params: the targeted function arguments.
@param network: goerli, mainnet, or predefined networks file.
@param network: goerli, goerli2, integration, mainnet, or predefined networks file.
@param signature: optional signature for invoke transactions.
@param max_fee: optional max fee for invoke transactions.
@param query_flag: either simulate or estimate_fee
Expand Down
2 changes: 2 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ def test_node_runs_gateway(opts, expected):
"args",
[
([MOCK_HASH, "--network", "goerli"]),
([MOCK_HASH, "--network", "goerli2"]),
([MOCK_HASH, "--network", "integration"]),
martriay marked this conversation as resolved.
Show resolved Hide resolved
([MOCK_HASH, "--network", "mainnet", "--contracts_file", "example.txt"]),
],
)
Expand Down