[JS] Add Pausable Extension to IDL & TS client #485
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
program/idl.json
to include thePausableConfig
extension, supporting new instructions for pausing and resuming mints.2. TypeScript Generated Client Code
initializePausableConfig.ts
pause.ts
resume.ts
index.ts
to export new instructions.programs/token2022.ts
,types/extension.ts
, andtypes/extensionType.ts
to support the new extension.getInitializeInstructionsForExtensions.ts
to handle pausable config initialization.3. Tests
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.