Skip to content

feat: Add /ahm-info endpoint#1739

Merged
TarikGul merged 7 commits into
masterfrom
tg-ahm-info-endpoint
Aug 29, 2025
Merged

feat: Add /ahm-info endpoint#1739
TarikGul merged 7 commits into
masterfrom
tg-ahm-info-endpoint

Conversation

@TarikGul

@TarikGul TarikGul commented Aug 29, 2025

Copy link
Copy Markdown
Member

Add /ahm-info endpoint for Asset Hub Migration information

Summary

Adds a new REST endpoint /ahm-info that provides Asset Hub Migration (AHM) boundary information including migration start/end blocks for both relay chain and Asset Hub.

Changes

  • Controller: AhmInfoController with GET /ahm-info endpoint
  • Service: AhmInfoService with smart dual-mode detection logic
  • Types: IAhmInfo interface for structured migration data
  • Constants: Migration boundaries for Westend and Paseo networks
  • Documentation: Complete OpenAPI spec with new ahm tag and schema

Response Structure

{
  "relay": {
    "startBlock": 26041702,
    "endBlock": 26071771
  },
  "assetHub": {
    "startBlock": 11716733,
    "endBlock": 11736597
  }
}

Usage

GET /ahm-info - Returns migration boundaries for current chain context

filvecchiato
filvecchiato previously approved these changes Aug 29, 2025
@filvecchiato

Copy link
Copy Markdown
Contributor

@TarikGul are docs needed for this endpoint?

@TarikGul

Copy link
Copy Markdown
Member Author

Yea I still need to add some docs, and then add the controllers to the correct assethubs

@TarikGul TarikGul marked this pull request as ready for review August 29, 2025 14:57
@TarikGul TarikGul requested a review from a team as a code owner August 29, 2025 14:57

@filvecchiato filvecchiato left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One minor typo and a suggestion for a possible update

Comment thread src/services/ahm/AhmInfoService.ts Outdated
* @param hash `BlockHash` to make call at.
*/
async fetchAhmInfo(): Promise<IAhmInfo> {
if (ApiPromiseRegistry.assetHubInfo.isAssetHub) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we could potentially remove some duplication of code by checking if RC or AH specName from the main handleFrom{X} function. But for now it can work

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yea I thought about this - but I wanted to keep the logic easier to read because juggling the rcApi, and ahApi becomes a little confusing.

But that being said all this extra logic will be removed once polkadot is migrated because we will have everything hardcoded.

@TarikGul TarikGul merged commit e7e11e0 into master Aug 29, 2025
14 checks passed
@TarikGul TarikGul deleted the tg-ahm-info-endpoint branch August 29, 2025 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants