diff --git a/README.md b/README.md index a0c7c80..4ad52db 100644 --- a/README.md +++ b/README.md @@ -35,12 +35,12 @@ pip install -e . ## Quick Usage -Once installed, you can use the ape_call command to call view functions on Ethereum smart contracts. Here is how you can use it: +Once installed, you can use the ape_utils command to call view functions on Ethereum smart contracts. Here is how you can use it: ![help](media/help.png) ```sh -ape_call call --function-sig "function_signature" --address "contract_address" --args argument +ape_utils call --function-sig "function_signature" --address "contract_address" --args argument ``` ### Example @@ -48,7 +48,7 @@ ape_call call --function-sig "function_signature" --address "contract_address" - To call a view function with the signature `call_this_view_function(uint256)(string)` on a contract at address `0x80E097a70cacA11EB71B6401FB12D48A1A61Ef54` with an argument `6147190`, you can use: ```bash -ape_call call --function-sig "call_this_view_function(uint256)(string)" --address "0x80E097a70cacA11EB71B6401FB12D48A1A61Ef54" --args 6147190 +ape_utils call --function-sig "call_this_view_function(uint256)(string)" --address "0x80E097a70cacA11EB71B6401FB12D48A1A61Ef54" --args 6147190 ``` ![working](media/working.png) diff --git a/demo.tape b/demo.tape index 1e4376c..82c3e7c 100644 --- a/demo.tape +++ b/demo.tape @@ -9,9 +9,9 @@ Set WindowBar Colorful Set Framerate 60 -Type "ape_call --help" +Type "ape_utils --help" Enter 1 Sleep 2s -Type "ape_call call --function-sig 'call_this_view_function(uint256)(string)' --address '0x80E097a70cacA11EB71B6401FB12D48A1A61Ef54' --args 6147190" +Type "ape_utils call --function-sig 'call_this_view_function(uint256)(string)' --address '0x80E097a70cacA11EB71B6401FB12D48A1A61Ef54' --args 6147190" Enter 1 Sleep 10s diff --git a/src/ape_utils/_cli.py b/src/ape_utils/_cli.py index 986e5a0..c6c9dd8 100644 --- a/src/ape_utils/_cli.py +++ b/src/ape_utils/_cli.py @@ -1,10 +1,12 @@ import click import rich_click as rclick from rich.console import Console +from rich.traceback import install from ape_utils.__about__ import __version__ from ape_utils.utils import call_view_function, encode_calldata_using_ape +install() console = Console() rclick.OPTION_GROUPS = { @@ -84,10 +86,13 @@ def encode(signature: str, args: list) -> None: console.print(f"[blue bold]Encoded Calldata: [green]{calldata.hex()}") except Exception as e: console.print(f"Error: [red]{e!s}") + # TODO: Raise if debug mode is enabled + # raise e # Add commands to the CLI group cli.add_command(call_view_function_from_cli, name="call") +cli.add_command(encode, name="encode") cli.add_command(version, name="version") if __name__ == "__main__":