Ethcode docs
Search…
⌃K

Add ABI into Ethcode

ABI stands for Application Binary Interface. It defines the methods and variables that are available in a smart contract and which we can use to interact with smart contracts deployed on the network.
We can interact with smart contracts deployed on the blockchain networks as long as we have ABI available.
Structure of smart contract ABI:
  • type - specifies the nature of the function can be one of constructor or function.
  • name - the name of the function.
  • inputs - an array of objects with the following schema:
    • name - the name of the parameter.
    • type - the type of the parameter.
    • components - used when the type is a tuple.
  • outputs - an array of objects similar to inputs
  • stateMutability - defines the state of function. it can be view, pure, payable, or nonpayable.

Load all Compiled JSON in Ethcode

Make sure all the contracts present in your current working directory are compiled and their compiled JSON file is present in the artifacts folder. root/artifacts/<MYCONTRACT>/MYCONTRACT.json
As discussed earlier ABI is used to interact with smart contracts deployed on the network and is also used to deploy contracts on the blockchain network.
To make contract calls or to deploy contracts on the blockchain networks using Ethcode the ABI for all the contracts present in the working directory must be accessible to the Ethcode extension.
  1. 1.
    ctrl + shift + P - open VScode command palate.
  2. 2.
    Ethcode: Load all compiled JSON output - command to give access to all contracts ABI to Ethcode.
load all compiled JSON output
JSON loaded

Select one compiled JSON

In the previous section, we gave access to Ethcode to use all the contracts present in our working directory to perform contract operations.
we can perform operations on a single contract at a time.
  1. 1.
    a ctrl + shift + P - open VScode command palate.
  2. 2.
    Ethcode: Select one compiled JSON output - command to select a single contract to perform operations.
select one compiled JSON output
3. Select contracts from the quick menu.
contract quick pick
contract selected