create_associated_token_account for Token Program 2022
create_associated_token_account does not allow for using the Token 2022 program. Can you add a program_id parameter to it so we can specify if it is a 2022 token.
Modify the following two methods to allow for token_program_id as an argument:
- https://github.com/michaelhly/solana-py/blob/7f2f3cb8e4028cddc5d550e39f66e031942a9884/src/spl/token/instructions.py#L1227
- https://github.com/michaelhly/solana-py/blob/7f2f3cb8e4028cddc5d550e39f66e031942a9884/src/spl/token/instructions.py#L1214
@michaelhly , happy to pick this one up as well. Seems like a quick fix.
I can see that there's already a constant TOKEN_2022_PROGRAM_ID.
https://github.com/michaelhly/solana-py/blob/7f2f3cb8e4028cddc5d550e39f66e031942a9884/src/spl/token/constants.py#L20
For this fix, do we type the new argument token_program_id as an enum between ASSOCIATED_TOKEN_PROGRAM_ID & TOKEN_2022_PROGRAM_ID or simply let be of type Pubkey (and default it to ASSOCIATED_TOKEN_PROGRAM_ID)?
No. We want the following account metadata to be either TOKEN_PROGRAM_ID or TOKEN_2022_PROGRAM_ID:
https://github.com/michaelhly/solana-py/blob/7f2f3cb8e4028cddc5d550e39f66e031942a9884/src/spl/token/instructions.py#L1241
Also here: https://github.com/michaelhly/solana-py/blob/7f2f3cb8e4028cddc5d550e39f66e031942a9884/src/spl/token/instructions.py#L1221