Skip to content
This repository was archived by the owner on Jan 6, 2026. It is now read-only.
This repository was archived by the owner on Jan 6, 2026. It is now read-only.

Use human-readable ABI format in smart contract client #118

@NikolasHaimerl

Description

@NikolasHaimerl

Use human-readable ABI format in smart contract client

Description

Following the implementation of smart-contract-based mapping of MinerID to IndexProviderPeerID in #117 , we should improve the developer experience by switching to a human-readable ABI format in the smart contract client.

This issue originated from the discussion in CheckerNetwork/roadmap#250 (comment), where it was noted that:

  1. The current implementation uses a standard JSON ABI format which lacks type inference
  2. This results in no autocomplete or type checking when working with the contract
  3. Ethers.js supports a human-readable ABI format that would improve developer experience

While we decided to stick with ethers.js for now instead of switching to viem (to minimize changes in the time-pressing initial implementation), updating to a human-readable ABI format would be a good improvement for maintainability.

Current ABI format

const contractABI = [
  {
    inputs: [
      {
        internalType: 'uint64',
        name: 'minerID',
        type: 'uint64'
      }
    ],
    name: 'getPeerData',
    outputs: [
      {
        components: [
          {
            internalType: 'string',
            name: 'peerID',
            type: 'string'
          },
          {
            internalType: 'bytes',
            name: 'signature',
            type: 'bytes'
          }
        ],
        internalType: 'struct MinerPeerIDMapping.PeerData',
        name: '',
        type: 'tuple'
      }
    ],
    stateMutability: 'view',
    type: 'function'
  }
]

Proposed human-readable ABI format

const contractABI = [
  "function getPeerData(uint64 minerID) view returns (tuple(string peerID, bytes signature))"
]

Related issues/PRs

Metadata

Metadata

Labels

No labels
No labels

Projects

Status

📥 candidate

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions