Skip to content

[JS] Add Pausable Extension to IDL & TS client#485

Merged
joncinque merged 3 commits intosolana-program:mainfrom
gitteri:pausable-idl
Jun 6, 2025
Merged

[JS] Add Pausable Extension to IDL & TS client#485
joncinque merged 3 commits intosolana-program:mainfrom
gitteri:pausable-idl

Conversation

@gitteri
Copy link
Copy Markdown
Contributor

@gitteri gitteri commented Jun 6, 2025

Add Pausable Extension to IDL, TypeScript Client, and Tests

Summary

This PR adds the Pausable extension to the Token-2022 ts library. It updates the IDL, generates the relevant TypeScript client code, and adds tests to ensure correct behavior for initializing, pausing, and resuming mints with the pausable extension.


Changes

1. IDL Update

  • Extended program/idl.json to include the PausableConfig extension, supporting new instructions for pausing and resuming mints.
  • Adds required types for the generated ts client

2. TypeScript Generated Client Code

  • Generated new instruction files:
    • initializePausableConfig.ts
    • pause.ts
    • resume.ts
  • Updated:
    • index.ts to export new instructions.
    • programs/token2022.ts, types/extension.ts, and types/extensionType.ts to support the new extension.
    • getInitializeInstructionsForExtensions.ts to handle pausable config initialization.

3. Tests

  • Added tests under clients/js/test/extensions/pausable/:
    • initializePausable.test.ts: Verifies mint initialization with the pausable extension.
    • pause.test.ts: Ensures a mint can be paused and the state is reflected on-chain.
    • resume.test.ts: Ensures a paused mint can be resumed and the state is updated accordingly.

Copy link
Copy Markdown
Contributor

@joncinque joncinque left a comment

Choose a reason for hiding this comment

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

I mainly checked the IDL, and it looks great to me! A small nit on typing, which you can take or leave

Comment on lines +7572 to +7577
"type": {
"kind": "zeroableOptionTypeNode",
"item": {
"kind": "publicKeyTypeNode"
}
}
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.

Technically, this is just a public key, but it shouldn't make a difference -- the program will fail if provided a None

@joncinque joncinque merged commit 2a5d854 into solana-program:main Jun 6, 2025
20 checks passed
@gitteri gitteri deleted the pausable-idl branch June 7, 2025 02:33
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