Introduction to Plugins
Welcome to the first part of our plugins development tutorial. In this video we will be going over the basics of the plugin architecture and the types of plugins that you can make.
How To Plugin - Part 1
Welcome to the first part of our plugins development tutorial. This video will cover the basics of a plugin architecture and the types of plugins you can make.
Why Plugins?
Plugins are the core of ApeWorX’s foundation. We use plugins because it helps keep the software lightweight and allows for modularity for users only to install exactly what they need for their project.
Plugins for ApeWorX can divide into three separate categories.
1. Core Plugins
Core plugins are included in the installation of the apeworx package and help it run out-of-the-box.
Some of these include:
- networks: which manages connecting to different network providers
- geth: Ethereum client for connecting and communicating with Ethereum nodes
- test: an eth-tester plugin providing access to pytest and pre-funded accounts
- console: interactive Python environment with access to ape locals
2. ApeWorX-maintained Plugins
You can view these by typing `ape plugins list --all` in the terminal.
You can install plugins by either installing all the plugins listed in the ape-config.yaml and running ape plugins installed in the root directory of the project
OR
You can install plugins individually by typing `ape plugins install [plugin name]`
3. Community Plugins
Community plugins are written by the community and can be installed at your discretion.
Types of Plugins
Compiler
Compiler plugins implement the CompilerAPI base class. The responsibility of a compiler plugin is to generate contract_type data. See the ethpm-types package for more information on what to expect in the contract_type data. Some examples of compiler plugins are ape-vyper, ape-solidity, and ape-cairo. Notice that ape-cairo is a compiler type for a non-EVM ecosystem. This is because the plugin system allows for this!
Provider
They implement the ProviderAPI base class, and their job is to interface with the blockchain. Some providers are great at testing, such as ape-hardhat, while others are better at mainnet / or testnet interaction, such as ape-infura or ape-alchemy
Account
Account plugins implement the AccountAPI. This supports interaction with hardware wallets which is useful for not exposing your private keys when interacting with chains. Some examples are ape-trezor and ape-ledger
Ecosystem
Ecosystem plugins will connect to the ecosystem they are designed to work with, like ape-arbitrum and ape-polygon, which connect to the Arbitrum and Polygon networks.
CLI
CLI plugins change the CLI like ape-token, which provides a nicer UX for providing token amounts to contract transactions
Resources:
Here is the link to our documentation on developing plugins.