Skip to main content

Utility plugin to expose some of the Ape's awesome features to CLI

Project description

Ape_utils

Quick Start

Ape Utils is a CLI tool designed to interact with Ethereum smart contracts, specifically focusing on calling view functions. The tool allows you to call a view function from a given function signature and address directly from the command line.

Demo

demo

Features

  • Call View Functions: Invoke view functions on Ethereum smart contracts using their function signature and address.
  • Flexible Input: Provide function signature, contract address, and arguments through the command line.

Dependencies

Installation

via pip

You can install the latest release via pip:

pip install ape_utils

Build locally

You can clone the repository and use pip for the most up-to-date version:

git clone https://github.com/Aviksaikat/ape_utils.git
cd ape_utils
pip install -e .

Quick Usage

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

ape_utils call --function-sig "function_signature" --address "contract_address" --args argument --network [ecosystem-name][:[network-name][:[provider-name]]]

Examples

Calling a view function

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:

ape_utils call --function-sig "call_this_view_function(uint256)(string)" --address "0x80E097a70cacA11EB71B6401FB12D48A1A61Ef54" --args 6147190 --network :sepolia:infura

Use as ape plugin

ape utils --help
ape utils call --function-sig "call_this_view_function(uint256)(string)" --address "0x80E097a70cacA11EB71B6401FB12D48A1A61Ef54" --args 6147190 --network :sepolia:infura

ABI encode the given function

ape_utils encode --signature 'call_this_view_function(uint256 arg1, string addr)' 1234 '0xdeadbeef'

ABI Decode input data

ape_utils decode --signature 'call_this_view_function(uint256 arg1, string addr)' '0x00000000000000000000000000000000000000000000000000000000000004d20000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000a3078646561646265656600000000000000000000000000000000000000000000'

Encode the given function with function selector

ape_utils encode --signature "call_this_view_function(uint256 arg1)" 1234

Decode the given function with function selector

ape_utils decode --signature "call_this_view_function(uint256 arg1)" "0x1e4f420d00000000000000000000000000000000000000000000000000000000000004d2"

working

Development

Please see the contributing guide to learn more how to contribute to this project. Comments, questions, criticisms and pull requests are welcomed.

Contact

For any issues or questions, please open an issue on the GitHub repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ape_utils-0.0.4.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

ape_utils-0.0.4-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file ape_utils-0.0.4.tar.gz.

File metadata

  • Download URL: ape_utils-0.0.4.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.2

File hashes

Hashes for ape_utils-0.0.4.tar.gz
Algorithm Hash digest
SHA256 784bbbd24a453815d2414499c4d4560d680129827cfc7dc1d4adf817412b23d5
MD5 b7a240111ec25ad36d9a89228b5fba27
BLAKE2b-256 ef1cdcc2e8f9f9bf70b045a080ea2def967a5f0703839de68a6bd62de6d9a28e

See more details on using hashes here.

File details

Details for the file ape_utils-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: ape_utils-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.2

File hashes

Hashes for ape_utils-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3f3cde6e7efbb2e98521e54e2f78db740ce03e8f665973ed8acfcff982a50e99
MD5 e8a8046f2dac9a7274af6402806b8848
BLAKE2b-256 5262f0d8a0e94570caa404f15c9eccecbdf7a77c78efa0e57e471fdf6c3edb94

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page