ANCHOR IDL WORKFLOW · IDL TYPE GENERATOR

Turn the program definition into types you can use.

IDL Type Generator accepts an Anchor IDL in the browser, exposes the output settings, and generates TypeScript for the accounts, enums, events, and custom types you select.

ILLUSTRATIVE IDL COMPILER

{
  "name": "vault",
  "accounts": [...],
  "types": [...]
}
GENERATE →
export interface Vault {
  authority: PublicKey
  balance: BN
}

export type VaultEvent = …

THE ROUTE

Decide what the output should mean.

Generation is not only a paste-and-copy step. BN handling, interfaces versus aliases, and included sections change how the result fits the application.

  1. 01

    Use the current IDL

    Start with the program definition that matches the deployment or codebase you are integrating.

  2. 02

    Choose the TypeScript shape

    Select interfaces or type aliases and decide how BN values should be represented.

  3. 03

    Select included sections

    Keep the accounts, enums, events, and custom types needed by the client.

  4. 04

    Generate and inspect

    Copy the output only after checking that the expected names and sections are present.

REVIEW POINTS

Before the types enter the project

Generated types describe the supplied IDL. They do not prove that the IDL matches an on-chain deployment.

VERSION
The IDL matches the program version the client will call.
NUMBERS
The selected BN representation matches the rest of the codebase.
SURFACE
Only the accounts and types the client needs are included.
REVIEW
Generated output is inspected like any other dependency boundary.

THE PRODUCT BEHIND THIS ROUTE

IDL Type Generator

Generate TypeScript types from an Anchor IDL in the browser.