Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.teqoin.io/llms.txt

Use this file to discover all available pages before exploring further.

Contract ABIs

Application Binary Interfaces, or ABIs, describe how your app talks to a contract. Every frontend, script, indexer, and automation workflow depends on having the right ABI for the contract you call.

What to store

For each deployed contract, keep:
  • The contract name
  • The deployment address
  • The chain ID
  • The exact ABI used by the deployed bytecode
  • The commit or release that produced that deployment
abi/
  Counter.json
  Treasury.json
deployments/
  teqoin.json
Example deployments/teqoin.json:
{
  "chainId": 420377,
  "contracts": {
    "Counter": {
      "address": "0xYourContractAddress",
      "abiFile": "abi/Counter.json"
    }
  }
}

Export ABI from Hardhat

After compilation, Hardhat writes artifacts to artifacts/contracts/.... You can copy the ABI from the artifact:
cat artifacts/contracts/Counter.sol/Counter.json
Look for the abi array and save it into your app-facing ABI file.

Export ABI from Foundry

Foundry stores compiled output in out/.
cat out/Counter.sol/Counter.json
Again, copy the abi section into the file your frontend imports.

Use an ABI in ethers

import { ethers } from 'ethers';
import counterAbi from './abi/Counter.json';

const provider = new ethers.JsonRpcProvider('https://rpc.teqoin.io');

const counter = new ethers.Contract(
  '0xYourContractAddress',
  counterAbi,
  provider
);

ABI hygiene

Keep these rules in place:
  • Regenerate the ABI every time the contract interface changes
  • Do not hand-edit ABI files
  • Version ABIs by release when you have multiple deployments
  • Keep addresses separate from ABI definitions