Skip to content

Conversation

@aorumbayev
Copy link
Collaborator

@aorumbayev aorumbayev commented Sep 4, 2025

Initial version of ts api jinja generator and resulting algod/indexer clients based off algo-fetch from awesomealgo.

@aorumbayev aorumbayev force-pushed the feat/ts-api-generator branch 2 times, most recently from df8e6df to 983b927 Compare September 4, 2025 16:11
@aorumbayev aorumbayev force-pushed the feat/ts-api-generator branch 3 times, most recently from b3ed18f to 6986612 Compare September 8, 2025 21:05
@aorumbayev aorumbayev marked this pull request as ready for review September 8, 2025 21:08
Copilot AI review requested due to automatic review settings September 8, 2025 21:08
@aorumbayev aorumbayev requested a review from a team as a code owner September 8, 2025 21:08

This comment was marked as outdated.

@aorumbayev
Copy link
Collaborator Author

aorumbayev commented Sep 8, 2025

@neilcampbell note current version duplicates SignedTransaction object from core from future branch on utils - for the time being until its movied to the monorepo

@aorumbayev aorumbayev force-pushed the feat/ts-api-generator branch from 6986612 to f0fe799 Compare September 8, 2025 21:17
@aorumbayev aorumbayev requested a review from Copilot September 10, 2025 11:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces TypeScript API client generation for Algorand algod and indexer services through a Jinja-based code generator. The implementation creates comprehensive TypeScript clients that support modern features like msgpack encoding, BigInt handling, and request/response transformation.

Key changes:

  • Add TypeScript code generation commands for algod and indexer clients
  • Implement comprehensive client libraries with typed models and APIs
  • Add msgpack support for Algorand-compliant transaction encoding/decoding
  • Include manual test suites for client functionality validation

Reviewed Changes

Copilot reviewed 232 out of 238 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tools/api_tools/src/main.rs Adds new CLI commands for TypeScript client generation with cleaning, formatting, and building steps
packages/typescript//src/models/.ts Generated TypeScript type definitions for all API models with proper BigInt support
packages/typescript//src/core/.ts Core HTTP client infrastructure with msgpack, JSON parsing, and request handling
packages/typescript//src/apis/.ts Generated API service classes with comprehensive endpoint coverage
packages/typescript//tests/.ts Manual test suites for client functionality verification
Comments suppressed due to low confidence (1)

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@PatrickDinh
Copy link
Collaborator

PatrickDinh commented Sep 15, 2025

@aorumbayev I noticed that the approvalProgram and clearStateProgram when calling getApplicationById are string while the rust version is Vec<u8>. The reason is that the rust version uses serde to automatically convert the base64 string returned by algod to Vec. Do you remember the reason why it was done that way in Rust?

@PatrickDinh
Copy link
Collaborator

hi @aorumbayev, I tested the output from this branch and found some possible improvements

  • The type field should be number
export type TealValue = {
  /**
   * \[tt\] value type. Value `1` refers to **bytes**, value `2` refers to **uint**
   */
  type: bigint;

  /**
   * \[tb\] bytes value.
   */
  bytes: string;

  /**
   * \[ui\] uint value.
   */
  uint: bigint;
};
  • In AssetParams, fields unitNameB64, nameB64 and urlB64 should be Uint8Array

@aorumbayev aorumbayev force-pushed the feat/ts-api-generator branch from 73124c1 to bbe4668 Compare September 19, 2025 20:22
@aorumbayev aorumbayev force-pushed the feat/ts-api-generator branch from bbe4668 to 3198ae0 Compare September 22, 2025 08:44
@aorumbayev aorumbayev marked this pull request as draft September 24, 2025 23:17
@aorumbayev aorumbayev force-pushed the feat/ts-api-generator branch 4 times, most recently from 1553069 to 902bb02 Compare September 25, 2025 22:00
@aorumbayev aorumbayev force-pushed the feat/ts-api-generator branch from 902bb02 to b1a0745 Compare September 25, 2025 22:04
@aorumbayev aorumbayev force-pushed the feat/ts-api-generator branch from eaf4abd to f3f529a Compare September 25, 2025 22:29
@aorumbayev
Copy link
Collaborator Author

hi @aorumbayev, I tested the output from this branch and found some possible improvements

  • The type field should be number
export type TealValue = {
  /**
   * \[tt\] value type. Value `1` refers to **bytes**, value `2` refers to **uint**
   */
  type: bigint;

  /**
   * \[tb\] bytes value.
   */
  bytes: string;

  /**
   * \[ui\] uint value.
   */
  uint: bigint;
};
  • In AssetParams, fields unitNameB64, nameB64 and urlB64 should be Uint8Array

should be fixed now

@aorumbayev
Copy link
Collaborator Author

@aorumbayev I noticed that the approvalProgram and clearStateProgram when calling getApplicationById are string while the rust version is Vec<u8>. The reason is that the rust version uses serde to automatically convert the base64 string returned by algod to Vec. Do you remember the reason why it was done that way in Rust?

this should now be consistent with rust, in ts those fields should be uint8arrays and decoder must convert the base64 strings to bytes.

@aorumbayev aorumbayev marked this pull request as ready for review September 25, 2025 22:52
@aorumbayev aorumbayev force-pushed the feat/ts-api-generator branch from 4513339 to 6f2b563 Compare September 26, 2025 09:15
@aorumbayev aorumbayev force-pushed the feat/ts-api-generator branch from 6f2b563 to f84c538 Compare September 26, 2025 09:22
@aorumbayev aorumbayev merged commit d86e646 into main Sep 26, 2025
19 checks passed
@aorumbayev aorumbayev deleted the feat/ts-api-generator branch September 26, 2025 09:38
@engineering-ci
Copy link
Contributor

🎉 This PR is included in version 1.0.0-alpha.68 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants