[New] Generator of TypeScript interfaces based on Aeternity Contract Interface

Application Status

Status: Submitted on 17.01.2025
Last updated: 17.01.2025
Submitted by Ilia Shekhovtsov [[email protected]]
Team: Ilia Shekhovtsov, Denis Davidyuk
Approved Budget (in h): 120
Used Budget (in h): 0
Planned Delivery: 17.03.2025

Specify the funding category

Open Source Development

Application Title

Generator of TypeScript interfaces based on Aeternity Contract Interface

Applicant

Ilia Shekhovtsov - GitHub
Denis Davidyuk – GitHub

Value Application

The goal is to implement a code generator. This generator will speed up the development by automating the definition of contract types, currently done manually.

Definition of Terms

ACI - Aeternity Contract Interface, JSON document containing definition of aeternity contract methods.
TypeScript - A version of JavaScript with type checking.

Status Quo

If the developer needs type-checking of contract methods, he must manually define the contract interface. For example, having a contract

contract Identity =
 entrypoint getArg(x : int) = x

it needs to be defined as

import { Contract } from '@aeternity/aepp-sdk';

const contract = new Contract<{
  // extra work, can be extacted from contract source
  getArg: (x: number | bigint) => bigint;
}>(options);

Required Work

To implemet a unit generating a TypeScript interface by ACI. The generated interface should explain contract methods in TypeScript and compatible with JavaScript SDK. For example, it should be usable as:

import { Contract } from '@aeternity/aepp-sdk';
import IdentityInterface from './generated.ts';

const identity = new Contract<IdentityInterface>(options);
2 Likes

I’ll continue since @Shini can’t post more than two links in a post.

Estimate

Ilia would be working less then 60 hours per month on this.
Denis will explain the details, review the code as a part of the separate grant, this will take less than 10 hours per month.

Known Limitations

There are no known limitations at the moment.

Outlook

We expect the implemented generator to be used in TypeScript projects interacting with aeternity smart contracts.

Potentially it can be integrated to contract-builder or aeproject.

Publishment

From Denis perspective, the best place for this functionality is aepp-calldata repository. But since the calldata lead developer (@dincho.chain) is not fine with that, we probably need to create a new one in the aeternity organization.

Maintainance

Maintenance is part of the proposal and included in the proposed timeframe.

2 Likes