Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support different networks #32

Merged
merged 15 commits into from
Mar 29, 2024
17 changes: 12 additions & 5 deletions mech_client/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ def cli() -> None:
@click.command()
@click.argument("prompt")
@click.argument("agent_id", type=int)
@click.option(
"--key",
type=click.Path(exists=True, file_okay=True, dir_okay=False),
help="Path to private key to use for request minting",
)
@click.option(
"--tool",
type=str,
Expand All @@ -52,11 +57,6 @@ def cli() -> None:
help="Extra attribute (key=value) to be included in the request metadata",
metavar="KEY=VALUE",
)
@click.option(
"--key",
type=click.Path(exists=True, file_okay=True, dir_okay=False),
help="Path to private key to use for request minting",
)
@click.option(
"--confirm",
type=click.Choice(
Expand All @@ -79,6 +79,11 @@ def cli() -> None:
type=float,
help="Amount of sleep before retrying the transaction",
)
@click.option(
"--chain-id",
type=str,
help="Id of the mech's chain configuration (stored configs/mechs.json)",
)
def interact( # pylint: disable=too-many-arguments
prompt: str,
agent_id: int,
Expand All @@ -89,6 +94,7 @@ def interact( # pylint: disable=too-many-arguments
retries: Optional[int] = None,
timeout: Optional[float] = None,
sleep: Optional[float] = None,
chain_id: Optional[str] = None,
) -> None:
"""Interact with a mech specifying a prompt and tool."""
try:
Expand All @@ -112,6 +118,7 @@ def interact( # pylint: disable=too-many-arguments
retries=retries,
timeout=timeout,
sleep=sleep,
chain_id=chain_id,
jmoreira-valory marked this conversation as resolved.
Show resolved Hide resolved
)
except (ValueError, FileNotFoundError) as e:
raise click.ClickException(str(e)) from e
Expand Down
32 changes: 32 additions & 0 deletions mech_client/configs/mechs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"gnosis": {
DavidMinarsch marked this conversation as resolved.
Show resolved Hide resolved
"agent_registry_contract": "0xE49CB081e8d96920C38aA7AB90cb0294ab4Bc8EA",
"rpc_url": "https://rpc.eu-central-2.gateway.fm/v4/gnosis/non-archival/mainnet",
"wss_endpoint": "wss://rpc.eu-central-2.gateway.fm/ws/v4/gnosis/non-archival/mainnet",
"ledger_config": {
"address": "https://rpc.eu-central-2.gateway.fm/v4/gnosis/non-archival/mainnet",
"chain_id": 100,
"poa_chain": false,
"default_gas_price_strategy": "eip1559",
"is_gas_estimation_enabled": false
},
"manual_gas_limit": 100000,
"block_explorer_url": "https://gnosis.blockscout.com/api/v2/smart-contracts/{contract_address}",
"subgraph_url": "https://api.studio.thegraph.com/query/57238/mech/version/latest"
DavidMinarsch marked this conversation as resolved.
Show resolved Hide resolved
},
"polygon": {
"agent_registry_contract": "0xE49CB081e8d96920C38aA7AB90cb0294ab4Bc8EA",
"rpc_url": "https://rpc.eu-central-2.gateway.fm/v4/gnosis/non-archival/mainnet",
"wss_endpoint": "wss://rpc.eu-central-2.gateway.fm/ws/v4/gnosis/non-archival/mainnet",
"ledger_config": {
"address": "https://rpc.eu-central-2.gateway.fm/v4/gnosis/non-archival/mainnet",
"chain_id": 100,
"poa_chain": false,
"default_gas_price_strategy": "eip1559",
"is_gas_estimation_enabled": false
},
"manual_gas_limit": 100000,
"block_explorer_url": "https://gnosis.blockscout.com/api/v2/smart-contracts/{contract_address}",
"subgraph_url": "https://api.studio.thegraph.com/query/57238/mech/version/latest"
}
}
jmoreira-valory marked this conversation as resolved.
Show resolved Hide resolved
Loading
Loading