Skip to content

cli: Properly support token-2022 mints#171

Merged
joncinque merged 1 commit intosolana-program:mainfrom
joncinque:tk2
Apr 23, 2025
Merged

cli: Properly support token-2022 mints#171
joncinque merged 1 commit intosolana-program:mainfrom
joncinque:tk2

Conversation

@joncinque
Copy link
Copy Markdown
Contributor

Problem

Although the stake pool program allows for mints on token-2022, the CLI still does not.

Summary of changes

A few changes:

  • use spl-token-2022 for instruction creators
  • allow for the token program id to be spl_token::id() or spl_token_2022::id()
  • derive ATAs with the token program id
  • use the token program id stored on the stake pool
  • during pool creation, return a helpful error if the mint is configured incorrectly
  • add a test script using token-2022

@joncinque joncinque requested a review from 2501babe March 21, 2025 16:30
2501babe
2501babe previously approved these changes Apr 15, 2025
Comment on lines +63 to +65

spl-token create-token --program-2022 "$mint_keyfile"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this ux and the corresponding "fall back to tokenkeg" rather than adding a cli flag is clever

@joncinque
Copy link
Copy Markdown
Contributor Author

@2501babe can I get another approval here? I had to rebase

2501babe
2501babe previously approved these changes Apr 22, 2025
@2501babe
Copy link
Copy Markdown
Member

approved then saw the previous automerge required another rebase but i did it (taking a chance on the github web editor! lmao) so it should just require your approve now

#### Problem

Although the stake pool program allows for mints on token-2022, the CLI
still does not.

#### Summary of changes

A few changes:

* use spl-token-2022 for instruction creators
* allow for the token program id to be spl_token::id() or
  spl_token_2022::id()
* derive ATAs with the token program id
* use the token program id stored on the stake pool
* during pool creation, return a helpful error if the mint is configured
  incorrectly
* add a test script using token-2022
Copy link
Copy Markdown
Contributor Author

@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 can't approve because it's my own pull request 🙃 so I just redid the rebase -- can you approve one more time?

@joncinque joncinque disabled auto-merge April 23, 2025 10:11
@joncinque joncinque merged commit e40e324 into solana-program:main Apr 23, 2025
12 checks passed
@joncinque joncinque deleted the tk2 branch April 23, 2025 10:11
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