Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 6, 2025

Conversation

gitteri
Copy link
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
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
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